Jake Wilkinson 2025-11-13 10:45:18 +08:00
parent 244dcf3893
commit 52bf4dc0bc
66 changed files with 10208 additions and 13092 deletions

View File

@ -1,38 +1,38 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<title>URDF Robot Viewer</title>
<style>
body {
margin: 0;
overflow: hidden;
background-color: #111;
}
#status {
position: absolute;
top: 10px;
left: 10px;
color: white;
background: rgba(0, 0, 0, 0.5);
padding: 6px 10px;
border-radius: 4px;
font-family: sans-serif;
font-size: 14px;
}
</style>
</head>
<body>
<div id="status">Loading URDF...</div>
<canvas id="urdf-canvas"></canvas>
<!-- Your logic -->
<script type="module" src="script.js"></script>
</body>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<title>URDF Robot Viewer</title>
<style>
body {
margin: 0;
overflow: hidden;
background-color: #111;
}
#status {
position: absolute;
top: 10px;
left: 10px;
color: white;
background: rgba(0, 0, 0, 0.5);
padding: 6px 10px;
border-radius: 4px;
font-family: sans-serif;
font-size: 14px;
}
</style>
</head>
<body>
<div id="status">Loading URDF...</div>
<canvas id="urdf-canvas"></canvas>
<!-- Your logic -->
<script type="module" src="script.js"></script>
</body>
</html>

34
node_modules/.bin/esbuild.cmd generated vendored
View File

@ -1,17 +1,17 @@
@ECHO off
GOTO start
:find_dp0
SET dp0=%~dp0
EXIT /b
:start
SETLOCAL
CALL :find_dp0
IF EXIST "%dp0%\node.exe" (
SET "_prog=%dp0%\node.exe"
) ELSE (
SET "_prog=node"
SET PATHEXT=%PATHEXT:;.JS;=;%
)
endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\esbuild\bin\esbuild" %*
@ECHO off
GOTO start
:find_dp0
SET dp0=%~dp0
EXIT /b
:start
SETLOCAL
CALL :find_dp0
IF EXIST "%dp0%\node.exe" (
SET "_prog=%dp0%\node.exe"
) ELSE (
SET "_prog=node"
SET PATHEXT=%PATHEXT:;.JS;=;%
)
endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\esbuild\bin\esbuild" %*

34
node_modules/.bin/nanoid.cmd generated vendored
View File

@ -1,17 +1,17 @@
@ECHO off
GOTO start
:find_dp0
SET dp0=%~dp0
EXIT /b
:start
SETLOCAL
CALL :find_dp0
IF EXIST "%dp0%\node.exe" (
SET "_prog=%dp0%\node.exe"
) ELSE (
SET "_prog=node"
SET PATHEXT=%PATHEXT:;.JS;=;%
)
endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\nanoid\bin\nanoid.cjs" %*
@ECHO off
GOTO start
:find_dp0
SET dp0=%~dp0
EXIT /b
:start
SETLOCAL
CALL :find_dp0
IF EXIST "%dp0%\node.exe" (
SET "_prog=%dp0%\node.exe"
) ELSE (
SET "_prog=node"
SET PATHEXT=%PATHEXT:;.JS;=;%
)
endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\nanoid\bin\nanoid.cjs" %*

34
node_modules/.bin/rollup.cmd generated vendored
View File

@ -1,17 +1,17 @@
@ECHO off
GOTO start
:find_dp0
SET dp0=%~dp0
EXIT /b
:start
SETLOCAL
CALL :find_dp0
IF EXIST "%dp0%\node.exe" (
SET "_prog=%dp0%\node.exe"
) ELSE (
SET "_prog=node"
SET PATHEXT=%PATHEXT:;.JS;=;%
)
endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\rollup\dist\bin\rollup" %*
@ECHO off
GOTO start
:find_dp0
SET dp0=%~dp0
EXIT /b
:start
SETLOCAL
CALL :find_dp0
IF EXIST "%dp0%\node.exe" (
SET "_prog=%dp0%\node.exe"
) ELSE (
SET "_prog=node"
SET PATHEXT=%PATHEXT:;.JS;=;%
)
endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\rollup\dist\bin\rollup" %*

16
node_modules/.bin/vite generated vendored
View File

@ -1,16 +0,0 @@
#!/bin/sh
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
case `uname` in
*CYGWIN*|*MINGW*|*MSYS*)
if command -v cygpath > /dev/null 2>&1; then
basedir=`cygpath -w "$basedir"`
fi
;;
esac
if [ -x "$basedir/node" ]; then
exec "$basedir/node" "$basedir/../vite/bin/vite.js" "$@"
else
exec node "$basedir/../vite/bin/vite.js" "$@"
fi

1
node_modules/.bin/vite generated vendored Symbolic link
View File

@ -0,0 +1 @@
../vite/bin/vite.js

34
node_modules/.bin/vite.cmd generated vendored
View File

@ -1,17 +1,17 @@
@ECHO off
GOTO start
:find_dp0
SET dp0=%~dp0
EXIT /b
:start
SETLOCAL
CALL :find_dp0
IF EXIST "%dp0%\node.exe" (
SET "_prog=%dp0%\node.exe"
) ELSE (
SET "_prog=node"
SET PATHEXT=%PATHEXT:;.JS;=;%
)
endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\vite\bin\vite.js" %*
@ECHO off
GOTO start
:find_dp0
SET dp0=%~dp0
EXIT /b
:start
SETLOCAL
CALL :find_dp0
IF EXIST "%dp0%\node.exe" (
SET "_prog=%dp0%\node.exe"
) ELSE (
SET "_prog=node"
SET PATHEXT=%PATHEXT:;.JS;=;%
)
endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\vite\bin\vite.js" %*

52
node_modules/.package-lock.json generated vendored
View File

@ -4,6 +4,23 @@
"lockfileVersion": 3,
"requires": true,
"packages": {
"node_modules/@esbuild/linux-x64": {
"version": "0.25.12",
"resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.25.12.tgz",
"integrity": "sha512-uqZMTLr/zR/ed4jIGnwSLkaHmPjOjJvnm6TVVitAa08SLS9Z0VM8wIRx7gWbJB5/J54YuIMInDquWyYvQLZkgw==",
"cpu": [
"x64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"linux"
],
"engines": {
"node": ">=18"
}
},
"node_modules/@esbuild/win32-x64": {
"version": "0.25.12",
"resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.25.12.tgz",
@ -21,6 +38,34 @@
"node": ">=18"
}
},
"node_modules/@rollup/rollup-linux-x64-gnu": {
"version": "4.52.5",
"resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.52.5.tgz",
"integrity": "sha512-hXGLYpdhiNElzN770+H2nlx+jRog8TyynpTVzdlc6bndktjKWyZyiCsuDAlpd+j+W+WNqfcyAWz9HxxIGfZm1Q==",
"cpu": [
"x64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"linux"
]
},
"node_modules/@rollup/rollup-linux-x64-musl": {
"version": "4.52.5",
"resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.52.5.tgz",
"integrity": "sha512-arCGIcuNKjBoKAXD+y7XomR9gY6Mw7HnFBv5Rw7wQRvwYLR7gBAgV7Mb2QTyjXfTveBNFAtPt46/36vV9STLNg==",
"cpu": [
"x64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"linux"
]
},
"node_modules/@rollup/rollup-win32-x64-gnu": {
"version": "4.52.5",
"resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-gnu/-/rollup-win32-x64-gnu-4.52.5.tgz",
@ -260,11 +305,10 @@
}
},
"node_modules/vite": {
"version": "7.1.12",
"resolved": "https://registry.npmjs.org/vite/-/vite-7.1.12.tgz",
"integrity": "sha512-ZWyE8YXEXqJrrSLvYgrRP7p62OziLW7xI5HYGWFzOvupfAlrLvURSzv/FyGyy0eidogEM3ujU+kUG1zuHgb6Ug==",
"version": "7.2.2",
"resolved": "https://registry.npmjs.org/vite/-/vite-7.2.2.tgz",
"integrity": "sha512-BxAKBWmIbrDgrokdGZH1IgkIk/5mMHDreLDmCJ0qpyJaAteP8NvMhkwr/ZCQNqNH97bw/dANTE9PDzqwJghfMQ==",
"dev": true,
"license": "MIT",
"dependencies": {
"esbuild": "^0.25.0",
"fdir": "^6.5.0",

View File

@ -1,52 +1,37 @@
{
"hash": "d903b885",
"configHash": "3e836f7b",
"lockfileHash": "e28807c3",
"browserHash": "9a7a5c1b",
"hash": "9696e02b",
"configHash": "e103e9de",
"lockfileHash": "8d45ad8a",
"browserHash": "8e3e062d",
"optimized": {
"three": {
"src": "../../three/build/three.module.js",
"file": "three.js",
"fileHash": "357a2d6a",
"fileHash": "acdec5e5",
"needsInterop": false
},
"three/examples/jsm/controls/OrbitControls.js": {
"src": "../../three/examples/jsm/controls/OrbitControls.js",
"file": "three_examples_jsm_controls_OrbitControls__js.js",
"fileHash": "06df99c3",
"needsInterop": false
},
"three/examples/jsm/controls/TransformControls.js": {
"src": "../../three/examples/jsm/controls/TransformControls.js",
"file": "three_examples_jsm_controls_TransformControls__js.js",
"fileHash": "0772f5bb",
"fileHash": "c1a4f949",
"needsInterop": false
},
"three/examples/jsm/loaders/ColladaLoader.js": {
"src": "../../three/examples/jsm/loaders/ColladaLoader.js",
"file": "three_examples_jsm_loaders_ColladaLoader__js.js",
"fileHash": "9054d4c1",
"fileHash": "dcb1087e",
"needsInterop": false
},
"three/examples/jsm/loaders/STLLoader.js": {
"src": "../../three/examples/jsm/loaders/STLLoader.js",
"file": "three_examples_jsm_loaders_STLLoader__js.js",
"fileHash": "3632de55",
"fileHash": "618ff280",
"needsInterop": false
},
"esbuild": {
"src": "../../esbuild/lib/main.js",
"file": "esbuild.js",
"fileHash": "0a908aaf",
"needsInterop": true
}
},
"chunks": {
"chunk-22FAE54D": {
"file": "chunk-22FAE54D.js"
},
"chunk-VUNV25KB": {
"file": "chunk-VUNV25KB.js"
"chunk-5P7KF7VS": {
"file": "chunk-5P7KF7VS.js"
}
}
}

View File

@ -44170,14 +44170,4 @@ export {
WebGLUtils,
WebGLRenderer
};
/*! Bundled license information:
three/build/three.core.js:
three/build/three.module.js:
(**
* @license
* Copyright 2010-2025 Three.js Authors
* SPDX-License-Identifier: MIT
*)
*/
//# sourceMappingURL=chunk-22FAE54D.js.map
//# sourceMappingURL=chunk-5P7KF7VS.js.map

View File

@ -1,15 +0,0 @@
var __getOwnPropNames = Object.getOwnPropertyNames;
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
}) : x)(function(x) {
if (typeof require !== "undefined") return require.apply(this, arguments);
throw Error('Dynamic require of "' + x + '" is not supported');
});
var __commonJS = (cb, mod) => function __require2() {
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
};
export {
__require,
__commonJS
};

View File

@ -1,7 +0,0 @@
{
"version": 3,
"sources": [],
"sourcesContent": [],
"mappings": "",
"names": []
}

2309
node_modules/.vite/deps/esbuild.js generated vendored

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

3
node_modules/.vite/deps/three.js generated vendored
View File

@ -427,8 +427,7 @@ import {
setConsoleFunction,
warn,
warnOnce
} from "./chunk-22FAE54D.js";
import "./chunk-VUNV25KB.js";
} from "./chunk-5P7KF7VS.js";
export {
ACESFilmicToneMapping,
AddEquation,

View File

@ -9,8 +9,7 @@ import {
TOUCH,
Vector2,
Vector3
} from "./chunk-22FAE54D.js";
import "./chunk-VUNV25KB.js";
} from "./chunk-5P7KF7VS.js";
// node_modules/three/examples/jsm/controls/OrbitControls.js
var _changeEvent = { type: "change" };

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@ -40,8 +40,7 @@ import {
Vector2,
Vector3,
VectorKeyframeTrack
} from "./chunk-22FAE54D.js";
import "./chunk-VUNV25KB.js";
} from "./chunk-5P7KF7VS.js";
// node_modules/three/examples/jsm/loaders/TGALoader.js
var TGALoader = class extends DataTextureLoader {

File diff suppressed because one or more lines are too long

View File

@ -7,8 +7,7 @@ import {
Loader,
SRGBColorSpace,
Vector3
} from "./chunk-22FAE54D.js";
import "./chunk-VUNV25KB.js";
} from "./chunk-5P7KF7VS.js";
// node_modules/three/examples/jsm/loaders/STLLoader.js
var STLLoader = class extends Loader {

File diff suppressed because one or more lines are too long

3
node_modules/@esbuild/linux-x64/README.md generated vendored Normal file
View File

@ -0,0 +1,3 @@
# esbuild
This is the Linux 64-bit binary for esbuild, a JavaScript bundler and minifier. See https://github.com/evanw/esbuild for details.

BIN
node_modules/@esbuild/linux-x64/bin/esbuild generated vendored Normal file

Binary file not shown.

20
node_modules/@esbuild/linux-x64/package.json generated vendored Normal file
View File

@ -0,0 +1,20 @@
{
"name": "@esbuild/linux-x64",
"version": "0.25.12",
"description": "The Linux 64-bit binary for esbuild, a JavaScript bundler.",
"repository": {
"type": "git",
"url": "git+https://github.com/evanw/esbuild.git"
},
"license": "MIT",
"preferUnplugged": true,
"engines": {
"node": ">=18"
},
"os": [
"linux"
],
"cpu": [
"x64"
]
}

3
node_modules/@rollup/rollup-linux-x64-gnu/README.md generated vendored Normal file
View File

@ -0,0 +1,3 @@
# `@rollup/rollup-linux-x64-gnu`
This is the **x86_64-unknown-linux-gnu** binary for `rollup`

25
node_modules/@rollup/rollup-linux-x64-gnu/package.json generated vendored Normal file
View File

@ -0,0 +1,25 @@
{
"name": "@rollup/rollup-linux-x64-gnu",
"version": "4.52.5",
"os": [
"linux"
],
"cpu": [
"x64"
],
"files": [
"rollup.linux-x64-gnu.node"
],
"description": "Native bindings for Rollup",
"author": "Lukas Taegert-Atkinson",
"homepage": "https://rollupjs.org/",
"license": "MIT",
"repository": {
"type": "git",
"url": "git+https://github.com/rollup/rollup.git"
},
"libc": [
"glibc"
],
"main": "./rollup.linux-x64-gnu.node"
}

Binary file not shown.

3
node_modules/@rollup/rollup-linux-x64-musl/README.md generated vendored Normal file
View File

@ -0,0 +1,3 @@
# `@rollup/rollup-linux-x64-musl`
This is the **x86_64-unknown-linux-musl** binary for `rollup`

View File

@ -0,0 +1,25 @@
{
"name": "@rollup/rollup-linux-x64-musl",
"version": "4.52.5",
"os": [
"linux"
],
"cpu": [
"x64"
],
"files": [
"rollup.linux-x64-musl.node"
],
"description": "Native bindings for Rollup",
"author": "Lukas Taegert-Atkinson",
"homepage": "https://rollupjs.org/",
"license": "MIT",
"repository": {
"type": "git",
"url": "git+https://github.com/rollup/rollup.git"
},
"libc": [
"musl"
],
"main": "./rollup.linux-x64-musl.node"
}

Binary file not shown.

30
node_modules/@types/estree/README.md generated vendored
View File

@ -1,15 +1,15 @@
# Installation
> `npm install --save @types/estree`
# Summary
This package contains type definitions for estree (https://github.com/estree/estree).
# Details
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/estree.
### Additional Details
* Last updated: Fri, 06 Jun 2025 00:04:33 GMT
* Dependencies: none
# Credits
These definitions were written by [RReverser](https://github.com/RReverser).
# Installation
> `npm install --save @types/estree`
# Summary
This package contains type definitions for estree (https://github.com/estree/estree).
# Details
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/estree.
### Additional Details
* Last updated: Fri, 06 Jun 2025 00:04:33 GMT
* Dependencies: none
# Credits
These definitions were written by [RReverser](https://github.com/RReverser).

140
node_modules/rollup/dist/bin/rollup generated vendored
View File

@ -1246,76 +1246,76 @@ yargsParser.camelCase = camelCase;
yargsParser.decamelize = decamelize;
yargsParser.looksLikeNumber = looksLikeNumber;
/******************************************************************************
Copyright (c) Microsoft Corporation.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */
/* global Reflect, Promise, SuppressedError, Symbol, Iterator */
function __addDisposableResource(env, value, async) {
if (value !== null && value !== void 0) {
if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected.");
var dispose, inner;
if (async) {
if (!Symbol.asyncDispose) throw new TypeError("Symbol.asyncDispose is not defined.");
dispose = value[Symbol.asyncDispose];
}
if (dispose === void 0) {
if (!Symbol.dispose) throw new TypeError("Symbol.dispose is not defined.");
dispose = value[Symbol.dispose];
if (async) inner = dispose;
}
if (typeof dispose !== "function") throw new TypeError("Object not disposable.");
if (inner) dispose = function() { try { inner.call(this); } catch (e) { return Promise.reject(e); } };
env.stack.push({ value: value, dispose: dispose, async: async });
}
else if (async) {
env.stack.push({ async: true });
}
return value;
}
var _SuppressedError = typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
var e = new Error(message);
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
};
function __disposeResources(env) {
function fail(e) {
env.error = env.hasError ? new _SuppressedError(e, env.error, "An error was suppressed during disposal.") : e;
env.hasError = true;
}
var r, s = 0;
function next() {
while (r = env.stack.pop()) {
try {
if (!r.async && s === 1) return s = 0, env.stack.push(r), Promise.resolve().then(next);
if (r.dispose) {
var result = r.dispose.call(r.value);
if (r.async) return s |= 2, Promise.resolve(result).then(next, function(e) { fail(e); return next(); });
}
else s |= 1;
}
catch (e) {
fail(e);
}
}
if (s === 1) return env.hasError ? Promise.reject(env.error) : Promise.resolve();
if (env.hasError) throw env.error;
}
return next();
/******************************************************************************
Copyright (c) Microsoft Corporation.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */
/* global Reflect, Promise, SuppressedError, Symbol, Iterator */
function __addDisposableResource(env, value, async) {
if (value !== null && value !== void 0) {
if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected.");
var dispose, inner;
if (async) {
if (!Symbol.asyncDispose) throw new TypeError("Symbol.asyncDispose is not defined.");
dispose = value[Symbol.asyncDispose];
}
if (dispose === void 0) {
if (!Symbol.dispose) throw new TypeError("Symbol.dispose is not defined.");
dispose = value[Symbol.dispose];
if (async) inner = dispose;
}
if (typeof dispose !== "function") throw new TypeError("Object not disposable.");
if (inner) dispose = function() { try { inner.call(this); } catch (e) { return Promise.reject(e); } };
env.stack.push({ value: value, dispose: dispose, async: async });
}
else if (async) {
env.stack.push({ async: true });
}
return value;
}
var _SuppressedError = typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
var e = new Error(message);
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
};
function __disposeResources(env) {
function fail(e) {
env.error = env.hasError ? new _SuppressedError(e, env.error, "An error was suppressed during disposal.") : e;
env.hasError = true;
}
var r, s = 0;
function next() {
while (r = env.stack.pop()) {
try {
if (!r.async && s === 1) return s = 0, env.stack.push(r), Promise.resolve().then(next);
if (r.dispose) {
var result = r.dispose.call(r.value);
if (r.async) return s |= 2, Promise.resolve(result).then(next, function(e) { fail(e); return next(); });
}
else s |= 1;
}
catch (e) {
fail(e);
}
}
if (s === 1) return env.hasError ? Promise.reject(env.error) : Promise.resolve();
if (env.hasError) throw env.error;
}
return next();
}
const toZeroIfInfinity = value => Number.isFinite(value) ? value : 0;

162
node_modules/vite/LICENSE.md generated vendored
View File

@ -31,7 +31,7 @@ BSD-2-Clause, CC0-1.0, ISC, MIT
## @jridgewell/gen-mapping, @jridgewell/remapping, @jridgewell/sourcemap-codec, @jridgewell/trace-mapping
License: MIT
By: Justin Ridgewell
Repositories: git+https://github.com/jridgewell/sourcemaps.git, git+https://github.com/jridgewell/sourcemaps.git, git+https://github.com/jridgewell/sourcemaps.git, git+https://github.com/jridgewell/sourcemaps.git
Repositories: https://github.com/jridgewell/sourcemaps, https://github.com/jridgewell/sourcemaps, https://github.com/jridgewell/sourcemaps, https://github.com/jridgewell/sourcemaps
> Copyright 2024 Justin Ridgewell <justin@ridgewell.name>
>
@ -84,20 +84,20 @@ Repository: https://github.com/jridgewell/resolve-uri
## @polka/compression
License: MIT
Repository: lukeed/polka
Repository: https://github.com/lukeed/polka
---------------------------------------
## @polka/url
License: MIT
By: Luke Edwards
Repository: lukeed/polka
Repository: https://github.com/lukeed/polka
---------------------------------------
## @rolldown/pluginutils
License: MIT
Repository: git+https://github.com/rolldown/rolldown.git
Repository: https://github.com/rolldown/rolldown
> MIT License
>
@ -130,19 +130,19 @@ Repository: git+https://github.com/rolldown/rolldown.git
## @rollup/plugin-alias, @rollup/plugin-commonjs, @rollup/plugin-dynamic-import-vars, @rollup/pluginutils
License: MIT
By: Johannes Stein
Repository: rollup/plugins
Repository: https://github.com/rollup/plugins
License: MIT
By: Rich Harris
Repository: rollup/plugins
Repository: https://github.com/rollup/plugins
License: MIT
By: LarsDenBakker
Repository: rollup/plugins
Repository: https://github.com/rollup/plugins
License: MIT
By: Rich Harris
Repository: rollup/plugins
Repository: https://github.com/rollup/plugins
> The MIT License (MIT)
>
@ -194,7 +194,7 @@ Repository: https://github.com/micromatch/anymatch
## artichokie
License: MIT
By: sapphi-red, Evan You
Repository: git+https://github.com/sapphi-red/artichokie.git
Repository: https://github.com/sapphi-red/artichokie
> MIT License
>
@ -224,7 +224,7 @@ Repository: git+https://github.com/sapphi-red/artichokie.git
## binary-extensions
License: MIT
By: Sindre Sorhus
Repository: sindresorhus/binary-extensions
Repository: https://github.com/sindresorhus/binary-extensions
> MIT License
>
@ -242,15 +242,15 @@ Repository: sindresorhus/binary-extensions
## braces, fill-range, is-number
License: MIT
By: Jon Schlinkert, Brian Woodward, Elan Shanker, Eugene Sharygin, hemanth.hm
Repository: micromatch/braces
Repository: https://github.com/micromatch/braces
License: MIT
By: Jon Schlinkert, Edo Rivai, Paul Miller, Rouven Weßling
Repository: jonschlinkert/fill-range
Repository: https://github.com/jonschlinkert/fill-range
License: MIT
By: Jon Schlinkert, Olsten Larck, Rouven Weßling
Repository: jonschlinkert/is-number
Repository: https://github.com/jonschlinkert/is-number
> The MIT License (MIT)
>
@ -279,7 +279,7 @@ Repository: jonschlinkert/is-number
## bundle-name, default-browser, default-browser-id, define-lazy-prop, is-docker, is-inside-container, is-wsl, open, run-applescript, wsl-utils
License: MIT
By: Sindre Sorhus
Repositories: sindresorhus/bundle-name, sindresorhus/default-browser, sindresorhus/default-browser-id, sindresorhus/define-lazy-prop, sindresorhus/is-docker, sindresorhus/is-inside-container, sindresorhus/is-wsl, sindresorhus/open, sindresorhus/run-applescript, sindresorhus/wsl-utils
Repositories: https://github.com/sindresorhus/bundle-name, https://github.com/sindresorhus/default-browser, https://github.com/sindresorhus/default-browser-id, https://github.com/sindresorhus/define-lazy-prop, https://github.com/sindresorhus/is-docker, https://github.com/sindresorhus/is-inside-container, https://github.com/sindresorhus/is-wsl, https://github.com/sindresorhus/open, https://github.com/sindresorhus/run-applescript, https://github.com/sindresorhus/wsl-utils
> MIT License
>
@ -296,7 +296,7 @@ Repositories: sindresorhus/bundle-name, sindresorhus/default-browser, sindresorh
## cac
License: MIT
By: egoist
Repository: egoist/cac
Repository: https://github.com/egoist/cac
> The MIT License (MIT)
>
@ -325,7 +325,7 @@ Repository: egoist/cac
## chokidar
License: MIT
By: Paul Miller, Elan Shanker
Repository: git+https://github.com/paulmillr/chokidar.git
Repository: https://github.com/paulmillr/chokidar
> The MIT License (MIT)
>
@ -354,7 +354,7 @@ Repository: git+https://github.com/paulmillr/chokidar.git
## commondir, shell-quote
License: MIT
By: James Halliday
Repositories: http://github.com/substack/node-commondir.git, http://github.com/ljharb/shell-quote.git
Repositories: http://github.com/substack/node-commondir, http://github.com/ljharb/shell-quote
> The MIT License
>
@ -386,7 +386,7 @@ Repositories: http://github.com/substack/node-commondir.git, http://github.com/l
## connect
License: MIT
By: TJ Holowaychuk, Douglas Christopher Wilson, Jonathan Ong, Tim Caswell
Repository: senchalabs/connect
Repository: https://github.com/senchalabs/connect
> (The MIT License)
>
@ -419,7 +419,7 @@ Repository: senchalabs/connect
## convert-source-map
License: MIT
By: Thorsten Lorenz
Repository: git://github.com/thlorenz/convert-source-map.git
Repository: https://github.com/thlorenz/convert-source-map
> Copyright 2013 Thorsten Lorenz.
> All rights reserved.
@ -450,7 +450,7 @@ Repository: git://github.com/thlorenz/convert-source-map.git
## cors
License: MIT
By: Troy Goode
Repository: expressjs/cors
Repository: https://github.com/expressjs/cors
> (The MIT License)
>
@ -480,7 +480,7 @@ Repository: expressjs/cors
## cross-spawn
License: MIT
By: André Cruz
Repository: git@github.com:moxystudio/node-cross-spawn.git
Repository: https://github.com/moxystudio/node-cross-spawn
> The MIT License (MIT)
>
@ -509,7 +509,7 @@ Repository: git@github.com:moxystudio/node-cross-spawn.git
## cssesc
License: MIT
By: Mathias Bynens
Repository: https://github.com/mathiasbynens/cssesc.git
Repository: https://github.com/mathiasbynens/cssesc
> Copyright Mathias Bynens <https://mathiasbynens.be/>
>
@ -537,7 +537,7 @@ Repository: https://github.com/mathiasbynens/cssesc.git
## debug
License: MIT
By: Josh Junon, TJ Holowaychuk, Nathan Rajlich, Andrew Rhyne
Repository: git://github.com/debug-js/debug.git
Repository: https://github.com/debug-js/debug
> (The MIT License)
>
@ -563,7 +563,7 @@ Repository: git://github.com/debug-js/debug.git
## dotenv
License: BSD-2-Clause
Repository: git://github.com/motdotla/dotenv.git
Repository: https://github.com/motdotla/dotenv
> Copyright (c) 2015, Scott Motte
> All rights reserved.
@ -625,7 +625,7 @@ Repository: https://github.com/motdotla/dotenv-expand
## ee-first
License: MIT
By: Jonathan Ong, Douglas Christopher Wilson
Repository: jonathanong/ee-first
Repository: https://github.com/jonathanong/ee-first
> The MIT License (MIT)
>
@ -654,7 +654,7 @@ Repository: jonathanong/ee-first
## encodeurl
License: MIT
By: Douglas Christopher Wilson
Repository: pillarjs/encodeurl
Repository: https://github.com/pillarjs/encodeurl
> (The MIT License)
>
@ -684,7 +684,7 @@ Repository: pillarjs/encodeurl
## entities
License: BSD-2-Clause
By: Felix Boehm
Repository: git://github.com/fb55/entities.git
Repository: https://github.com/fb55/entities
> Copyright (c) Felix Böhm
> All rights reserved.
@ -703,7 +703,7 @@ Repository: git://github.com/fb55/entities.git
## es-module-lexer
License: MIT
By: Guy Bedford
Repository: git+https://github.com/guybedford/es-module-lexer.git
Repository: https://github.com/guybedford/es-module-lexer
> MIT License
> -----------
@ -720,7 +720,7 @@ Repository: git+https://github.com/guybedford/es-module-lexer.git
## escape-html
License: MIT
Repository: component/escape-html
Repository: https://github.com/component/escape-html
> (The MIT License)
>
@ -767,7 +767,7 @@ Repository: https://github.com/Rich-Harris/estree-walker
## etag
License: MIT
By: Douglas Christopher Wilson, David Björklund
Repository: jshttp/etag
Repository: https://github.com/jshttp/etag
> (The MIT License)
>
@ -797,7 +797,7 @@ Repository: jshttp/etag
## finalhandler
License: MIT
By: Douglas Christopher Wilson
Repository: pillarjs/finalhandler
Repository: https://github.com/pillarjs/finalhandler
> (The MIT License)
>
@ -827,7 +827,7 @@ Repository: pillarjs/finalhandler
## follow-redirects
License: MIT
By: Ruben Verborgh, Olivier Lalonde, James Talmage
Repository: git+ssh://git@github.com/follow-redirects/follow-redirects.git
Repository: https://github.com/follow-redirects/follow-redirects
> Copyright 2014present Olivier Lalonde <olalonde@gmail.com>, James Talmage <james@talmage.io>, Ruben Verborgh
>
@ -853,7 +853,7 @@ Repository: git+ssh://git@github.com/follow-redirects/follow-redirects.git
## generic-names
License: MIT
By: Alexey Litvinov
Repository: git+https://github.com/css-modules/generic-names.git
Repository: https://github.com/css-modules/generic-names
> The MIT License (MIT)
>
@ -882,7 +882,7 @@ Repository: git+https://github.com/css-modules/generic-names.git
## glob-parent
License: ISC
By: Gulp Team, Elan Shanker, Blaine Bublitz
Repository: gulpjs/glob-parent
Repository: https://github.com/gulpjs/glob-parent
> The ISC License
>
@ -905,7 +905,7 @@ Repository: gulpjs/glob-parent
## host-validation-middleware
License: MIT
By: sapphi-red
Repository: git+https://github.com/sapphi-red/host-validation-middleware.git
Repository: https://github.com/sapphi-red/host-validation-middleware
> MIT License
>
@ -934,7 +934,7 @@ Repository: git+https://github.com/sapphi-red/host-validation-middleware.git
## http-proxy-3
License: MIT
By: William Stein, Charlie Robbins, Jimb Esser, jcrugzz
Repository: https://github.com/sagemathinc/http-proxy-3.git
Repository: https://github.com/sagemathinc/http-proxy-3
> node-http-3
>
@ -964,7 +964,7 @@ Repository: https://github.com/sagemathinc/http-proxy-3.git
## icss-utils
License: ISC
By: Glen Maddern
Repository: git+https://github.com/css-modules/icss-utils.git
Repository: https://github.com/css-modules/icss-utils
> ISC License (ISC)
> Copyright 2018 Glen Maddern
@ -978,7 +978,7 @@ Repository: git+https://github.com/css-modules/icss-utils.git
## is-binary-path
License: MIT
By: Sindre Sorhus
Repository: sindresorhus/is-binary-path
Repository: https://github.com/sindresorhus/is-binary-path
> MIT License
>
@ -995,7 +995,7 @@ Repository: sindresorhus/is-binary-path
## is-extglob
License: MIT
By: Jon Schlinkert
Repository: jonschlinkert/is-extglob
Repository: https://github.com/jonschlinkert/is-extglob
> The MIT License (MIT)
>
@ -1024,7 +1024,7 @@ Repository: jonschlinkert/is-extglob
## is-glob
License: MIT
By: Jon Schlinkert, Brian Woodward, Daniel Perez
Repository: micromatch/is-glob
Repository: https://github.com/micromatch/is-glob
> The MIT License (MIT)
>
@ -1053,14 +1053,14 @@ Repository: micromatch/is-glob
## is-reference
License: MIT
By: Rich Harris
Repository: git+https://github.com/Rich-Harris/is-reference.git
Repository: https://github.com/Rich-Harris/is-reference
---------------------------------------
## isexe, which
License: ISC
By: Isaac Z. Schlueter
Repositories: git+https://github.com/isaacs/isexe.git, git://github.com/isaacs/node-which.git
Repositories: https://github.com/isaacs/isexe, https://github.com/isaacs/node-which
> The ISC License
>
@ -1083,7 +1083,7 @@ Repositories: git+https://github.com/isaacs/isexe.git, git://github.com/isaacs/n
## js-tokens
License: MIT
By: Simon Lydell
Repository: lydell/js-tokens
Repository: https://github.com/lydell/js-tokens
> The MIT License (MIT)
>
@ -1112,7 +1112,7 @@ Repository: lydell/js-tokens
## launch-editor, launch-editor-middleware
License: MIT
By: Evan You
Repositories: git+https://github.com/yyx990803/launch-editor.git, git+https://github.com/yyx990803/launch-editor.git
Repositories: https://github.com/yyx990803/launch-editor, https://github.com/yyx990803/launch-editor
> The MIT License (MIT)
>
@ -1170,7 +1170,7 @@ Repository: https://github.com/antonk52/lilconfig
## loader-utils
License: MIT
By: Tobias Koppers @sokra
Repository: https://github.com/webpack/loader-utils.git
Repository: https://github.com/webpack/loader-utils
> Copyright JS Foundation and other contributors
>
@ -1198,7 +1198,7 @@ Repository: https://github.com/webpack/loader-utils.git
## lodash.camelcase
License: MIT
By: John-David Dalton, Blaine Bublitz, Mathias Bynens
Repository: lodash/lodash
Repository: https://github.com/lodash/lodash
> Copyright jQuery Foundation and other contributors <https://jquery.org/>
>
@ -1253,7 +1253,7 @@ Repository: lodash/lodash
## magic-string
License: MIT
By: Rich Harris
Repository: https://github.com/rich-harris/magic-string.git
Repository: https://github.com/Rich-Harris/magic-string
> Copyright 2018 Rich Harris
>
@ -1267,7 +1267,7 @@ Repository: https://github.com/rich-harris/magic-string.git
## mlly, ufo
License: MIT
Repositories: unjs/mlly, unjs/ufo
Repositories: https://github.com/unjs/mlly, https://github.com/unjs/ufo
> MIT License
>
@ -1296,7 +1296,7 @@ Repositories: unjs/mlly, unjs/ufo
## mrmime
License: MIT
By: Luke Edwards
Repository: lukeed/mrmime
Repository: https://github.com/lukeed/mrmime
> The MIT License (MIT)
>
@ -1324,7 +1324,7 @@ Repository: lukeed/mrmime
## ms
License: MIT
Repository: vercel/ms
Repository: https://github.com/vercel/ms
> The MIT License (MIT)
>
@ -1353,7 +1353,7 @@ Repository: vercel/ms
## normalize-path
License: MIT
By: Jon Schlinkert, Blaine Bublitz
Repository: jonschlinkert/normalize-path
Repository: https://github.com/jonschlinkert/normalize-path
> The MIT License (MIT)
>
@ -1382,7 +1382,7 @@ Repository: jonschlinkert/normalize-path
## object-assign
License: MIT
By: Sindre Sorhus
Repository: sindresorhus/object-assign
Repository: https://github.com/sindresorhus/object-assign
> The MIT License (MIT)
>
@ -1411,7 +1411,7 @@ Repository: sindresorhus/object-assign
## on-finished
License: MIT
By: Douglas Christopher Wilson, Jonathan Ong
Repository: jshttp/on-finished
Repository: https://github.com/jshttp/on-finished
> (The MIT License)
>
@ -1442,7 +1442,7 @@ Repository: jshttp/on-finished
## parse5
License: MIT
By: Ivan Nikulin, https://github.com/inikulin/parse5/graphs/contributors
Repository: git://github.com/inikulin/parse5.git
Repository: https://github.com/inikulin/parse5
> Copyright (c) 2013-2019 Ivan Nikulin (ifaaan@gmail.com, https://github.com/inikulin)
>
@ -1469,7 +1469,7 @@ Repository: git://github.com/inikulin/parse5.git
## parseurl
License: MIT
By: Douglas Christopher Wilson, Jonathan Ong
Repository: pillarjs/parseurl
Repository: https://github.com/pillarjs/parseurl
> (The MIT License)
>
@ -1500,7 +1500,7 @@ Repository: pillarjs/parseurl
## path-key, shebang-regex
License: MIT
By: Sindre Sorhus
Repositories: sindresorhus/path-key, sindresorhus/shebang-regex
Repositories: https://github.com/sindresorhus/path-key, https://github.com/sindresorhus/shebang-regex
> MIT License
>
@ -1516,7 +1516,7 @@ Repositories: sindresorhus/path-key, sindresorhus/shebang-regex
## periscopic
License: MIT
Repository: Rich-Harris/periscopic
Repository: https://github.com/Rich-Harris/periscopic
> Copyright (c) 2019 Rich Harris
>
@ -1531,7 +1531,7 @@ Repository: Rich-Harris/periscopic
## picocolors
License: ISC
By: Alexey Raspopov
Repository: alexeyraspopov/picocolors
Repository: https://github.com/alexeyraspopov/picocolors
> ISC License
>
@ -1554,7 +1554,7 @@ Repository: alexeyraspopov/picocolors
## postcss-import
License: MIT
By: Maxime Thirouin
Repository: https://github.com/postcss/postcss-import.git
Repository: https://github.com/postcss/postcss-import
> The MIT License (MIT)
>
@ -1582,7 +1582,7 @@ Repository: https://github.com/postcss/postcss-import.git
## postcss-load-config
License: MIT
By: Michael Ciniawky, Ryan Dunckel, Mateusz Derks, Dalton Santos, Patrick Gilday, François Wouts
Repository: postcss/postcss-load-config
Repository: https://github.com/postcss/postcss-load-config
> The MIT License (MIT)
>
@ -1610,7 +1610,7 @@ Repository: postcss/postcss-load-config
## postcss-modules
License: MIT
By: Alexander Madyankin
Repository: https://github.com/css-modules/postcss-modules.git
Repository: https://github.com/css-modules/postcss-modules
> The MIT License (MIT)
>
@ -1638,7 +1638,7 @@ Repository: https://github.com/css-modules/postcss-modules.git
## postcss-modules-extract-imports
License: ISC
By: Glen Maddern
Repository: https://github.com/css-modules/postcss-modules-extract-imports.git
Repository: https://github.com/css-modules/postcss-modules-extract-imports
> Copyright 2015 Glen Maddern
>
@ -1651,7 +1651,7 @@ Repository: https://github.com/css-modules/postcss-modules-extract-imports.git
## postcss-modules-local-by-default
License: MIT
By: Mark Dalgleish
Repository: https://github.com/css-modules/postcss-modules-local-by-default.git
Repository: https://github.com/css-modules/postcss-modules-local-by-default
> The MIT License (MIT)
>
@ -1679,7 +1679,7 @@ Repository: https://github.com/css-modules/postcss-modules-local-by-default.git
## postcss-modules-scope
License: ISC
By: Glen Maddern
Repository: https://github.com/css-modules/postcss-modules-scope.git
Repository: https://github.com/css-modules/postcss-modules-scope
> ISC License (ISC)
>
@ -1694,7 +1694,7 @@ Repository: https://github.com/css-modules/postcss-modules-scope.git
## postcss-modules-values
License: ISC
By: Glen Maddern
Repository: git+https://github.com/css-modules/postcss-modules-values.git
Repository: https://github.com/css-modules/postcss-modules-values
> ISC License (ISC)
>
@ -1709,7 +1709,7 @@ Repository: git+https://github.com/css-modules/postcss-modules-values.git
## postcss-selector-parser
License: MIT
By: Ben Briggs, Chris Eppstein
Repository: postcss/postcss-selector-parser
Repository: https://github.com/postcss/postcss-selector-parser
> Copyright (c) Ben Briggs <beneb.info@gmail.com> (http://beneb.info)
>
@ -1739,7 +1739,7 @@ Repository: postcss/postcss-selector-parser
## postcss-value-parser
License: MIT
By: Bogdan Chadkin
Repository: https://github.com/TrySound/postcss-value-parser.git
Repository: https://github.com/TrySound/postcss-value-parser
> Copyright (c) Bogdan Chadkin <trysound@yandex.ru>
>
@ -1769,7 +1769,7 @@ Repository: https://github.com/TrySound/postcss-value-parser.git
## readdirp
License: MIT
By: Thorsten Lorenz, Paul Miller
Repository: git://github.com/paulmillr/readdirp.git
Repository: https://github.com/paulmillr/readdirp
> MIT License
>
@ -1798,7 +1798,7 @@ Repository: git://github.com/paulmillr/readdirp.git
## resolve.exports, totalist
License: MIT
By: Luke Edwards
Repositories: lukeed/resolve.exports, lukeed/totalist
Repositories: https://github.com/lukeed/resolve.exports, https://github.com/lukeed/totalist
> The MIT License (MIT)
>
@ -1827,7 +1827,7 @@ Repositories: lukeed/resolve.exports, lukeed/totalist
## shebang-command
License: MIT
By: Kevin Mårtensson
Repository: kevva/shebang-command
Repository: https://github.com/kevva/shebang-command
> MIT License
>
@ -1844,14 +1844,14 @@ Repository: kevva/shebang-command
## sirv
License: MIT
By: Luke Edwards
Repository: lukeed/sirv
Repository: https://github.com/lukeed/sirv
---------------------------------------
## statuses
License: MIT
By: Douglas Christopher Wilson, Jonathan Ong
Repository: jshttp/statuses
Repository: https://github.com/jshttp/statuses
> The MIT License (MIT)
>
@ -1881,14 +1881,14 @@ Repository: jshttp/statuses
## string-hash
License: CC0-1.0
By: The Dark Sky Company
Repository: git://github.com/darkskyapp/string-hash.git
Repository: https://github.com/darkskyapp/string-hash
---------------------------------------
## strip-literal
License: MIT
By: Anthony Fu
Repository: git+https://github.com/antfu/strip-literal.git
Repository: https://github.com/antfu/strip-literal
> MIT License
>
@ -1917,7 +1917,7 @@ Repository: git+https://github.com/antfu/strip-literal.git
## to-regex-range
License: MIT
By: Jon Schlinkert, Rouven Weßling
Repository: micromatch/to-regex-range
Repository: https://github.com/micromatch/to-regex-range
> The MIT License (MIT)
>
@ -1946,7 +1946,7 @@ Repository: micromatch/to-regex-range
## tsconfck
License: MIT
By: dominikg
Repository: git+https://github.com/dominikg/tsconfck.git
Repository: https://github.com/dominikg/tsconfck
> MIT License
>
@ -2000,7 +2000,7 @@ Repository: git+https://github.com/dominikg/tsconfck.git
## unpipe
License: MIT
By: Douglas Christopher Wilson
Repository: stream-utils/unpipe
Repository: https://github.com/stream-utils/unpipe
> (The MIT License)
>
@ -2030,7 +2030,7 @@ Repository: stream-utils/unpipe
## util-deprecate
License: MIT
By: Nathan Rajlich
Repository: git://github.com/TooTallNate/util-deprecate.git
Repository: https://github.com/TooTallNate/util-deprecate
> (The MIT License)
>
@ -2062,7 +2062,7 @@ Repository: git://github.com/TooTallNate/util-deprecate.git
## utils-merge
License: MIT
By: Jared Hanson
Repository: git://github.com/jaredhanson/utils-merge.git
Repository: https://github.com/jaredhanson/utils-merge
> The MIT License (MIT)
>
@ -2090,7 +2090,7 @@ Repository: git://github.com/jaredhanson/utils-merge.git
## vary
License: MIT
By: Douglas Christopher Wilson
Repository: jshttp/vary
Repository: https://github.com/jshttp/vary
> (The MIT License)
>
@ -2120,7 +2120,7 @@ Repository: jshttp/vary
## ws
License: MIT
By: Einar Otto Stangvik
Repository: git+https://github.com/websockets/ws.git
Repository: https://github.com/websockets/ws
> Copyright (c) 2011 Einar Otto Stangvik <einaros@gmail.com>
> Copyright (c) 2013 Arnout Kazemier and contributors

View File

@ -1,6 +1,6 @@
import "@vite/env";
//#region \0@oxc-project+runtime@0.94.0/helpers/typeof.js
//#region \0@oxc-project+runtime@0.96.0/helpers/typeof.js
function _typeof(o) {
"@babel/helpers - typeof";
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o$1) {
@ -11,7 +11,7 @@ function _typeof(o) {
}
//#endregion
//#region \0@oxc-project+runtime@0.94.0/helpers/toPrimitive.js
//#region \0@oxc-project+runtime@0.96.0/helpers/toPrimitive.js
function toPrimitive(t, r) {
if ("object" != _typeof(t) || !t) return t;
var e = t[Symbol.toPrimitive];
@ -24,14 +24,14 @@ function toPrimitive(t, r) {
}
//#endregion
//#region \0@oxc-project+runtime@0.94.0/helpers/toPropertyKey.js
//#region \0@oxc-project+runtime@0.96.0/helpers/toPropertyKey.js
function toPropertyKey(t) {
var i = toPrimitive(t, "string");
return "symbol" == _typeof(i) ? i : i + "";
}
//#endregion
//#region \0@oxc-project+runtime@0.94.0/helpers/defineProperty.js
//#region \0@oxc-project+runtime@0.96.0/helpers/defineProperty.js
function _defineProperty(e, r, t) {
return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
value: t,

View File

@ -1,4 +1,4 @@
import "./logger.js";
import { BuildEnvironment, build, buildEnvironmentOptionsDefaults, builderOptionsDefaults, createBuilder, createToImportMetaURLBasedRelativeRuntime, injectEnvironmentToHooks, onRollupLog, resolveBuildEnvironmentOptions, resolveBuildOutputs, resolveBuildPlugins, resolveBuilderOptions, resolveLibFilename, resolveUserExternal, toOutputFilePathInCss, toOutputFilePathInHtml, toOutputFilePathInJS, toOutputFilePathWithoutRuntime } from "./config.js";
import { A as toOutputFilePathInCss, C as onRollupLog, D as resolveBuilderOptions, E as resolveBuildPlugins, M as toOutputFilePathInJS, N as toOutputFilePathWithoutRuntime, O as resolveLibFilename, S as injectEnvironmentToHooks, T as resolveBuildOutputs, _ as build, b as createBuilder, g as BuildEnvironment, j as toOutputFilePathInHtml, k as resolveUserExternal, v as buildEnvironmentOptionsDefaults, w as resolveBuildEnvironmentOptions, x as createToImportMetaURLBasedRelativeRuntime, y as builderOptionsDefaults } from "./config.js";
export { createBuilder, resolveBuildPlugins };
export { BuildEnvironment, build, buildEnvironmentOptionsDefaults, builderOptionsDefaults, createBuilder, createToImportMetaURLBasedRelativeRuntime, injectEnvironmentToHooks, onRollupLog, resolveBuildEnvironmentOptions, resolveBuildOutputs, resolveBuildPlugins, resolveBuilderOptions, resolveLibFilename, resolveUserExternal, toOutputFilePathInCss, toOutputFilePathInHtml, toOutputFilePathInJS, toOutputFilePathWithoutRuntime };

View File

@ -1,5 +1,5 @@
import { __commonJS, __require } from "./chunk.js";
import { require_lib } from "./lib.js";
import { n as __require, t as __commonJS } from "./chunk.js";
import { t as require_lib } from "./lib.js";
//#region ../../node_modules/.pnpm/postcss-modules@6.0.1_postcss@8.5.6/node_modules/postcss-modules/build/fs.js
var require_fs = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/postcss-modules@6.0.1_postcss@8.5.6/node_modules/postcss-modules/build/fs.js": ((exports) => {
@ -188,6 +188,7 @@ var require_src$4 = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/icss-
//#region ../../node_modules/.pnpm/postcss-modules@6.0.1_postcss@8.5.6/node_modules/postcss-modules/build/Parser.js
var require_Parser = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/postcss-modules@6.0.1_postcss@8.5.6/node_modules/postcss-modules/build/Parser.js": ((exports) => {
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = void 0;
var _icssUtils = require_src$4();
const importRegexp = /^:import\((.+)\)$/;
var Parser$1 = class {
@ -955,6 +956,7 @@ var require_localsConvention = /* @__PURE__ */ __commonJS({ "../../node_modules/
//#region ../../node_modules/.pnpm/postcss-modules@6.0.1_postcss@8.5.6/node_modules/postcss-modules/build/FileSystemLoader.js
var require_FileSystemLoader = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/postcss-modules@6.0.1_postcss@8.5.6/node_modules/postcss-modules/build/FileSystemLoader.js": ((exports) => {
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = void 0;
var _postcss$1 = _interopRequireDefault$21(__require("postcss"));
var _path = _interopRequireDefault$21(__require("path"));
var _Parser$1 = _interopRequireDefault$21(require_Parser());
@ -1746,6 +1748,7 @@ var require_stripComments = /* @__PURE__ */ __commonJS({ "../../node_modules/.pn
//#region ../../node_modules/.pnpm/postcss-selector-parser@7.1.0/node_modules/postcss-selector-parser/dist/util/index.js
var require_util = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/postcss-selector-parser@7.1.0/node_modules/postcss-selector-parser/dist/util/index.js": ((exports) => {
exports.__esModule = true;
exports.unesc = exports.stripComments = exports.getProp = exports.ensureObject = void 0;
var _unesc$1 = _interopRequireDefault$20(require_unesc());
exports.unesc = _unesc$1["default"];
var _getProp = _interopRequireDefault$20(require_getProp());
@ -1900,6 +1903,7 @@ var require_node$1 = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/post
//#region ../../node_modules/.pnpm/postcss-selector-parser@7.1.0/node_modules/postcss-selector-parser/dist/selectors/types.js
var require_types = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/postcss-selector-parser@7.1.0/node_modules/postcss-selector-parser/dist/selectors/types.js": ((exports) => {
exports.__esModule = true;
exports.UNIVERSAL = exports.TAG = exports.STRING = exports.SELECTOR = exports.ROOT = exports.PSEUDO = exports.NESTING = exports.ID = exports.COMMENT = exports.COMBINATOR = exports.CLASS = exports.ATTRIBUTE = void 0;
var TAG = "tag";
exports.TAG = TAG;
var STRING = "string";
@ -2372,6 +2376,7 @@ var require_selector = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/po
//#endregion
//#region ../../node_modules/.pnpm/cssesc@3.0.0/node_modules/cssesc/cssesc.js
/*! https://mths.be/cssesc v3.0.0 by @mathias */
var require_cssesc = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/cssesc@3.0.0/node_modules/cssesc/cssesc.js": ((exports, module) => {
var hasOwnProperty$1 = {}.hasOwnProperty;
var merge = function merge$1(options, defaults) {
@ -2803,6 +2808,7 @@ var require_node = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/util-d
//#region ../../node_modules/.pnpm/postcss-selector-parser@7.1.0/node_modules/postcss-selector-parser/dist/selectors/attribute.js
var require_attribute = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/postcss-selector-parser@7.1.0/node_modules/postcss-selector-parser/dist/selectors/attribute.js": ((exports) => {
exports.__esModule = true;
exports["default"] = void 0;
exports.unescapeValue = unescapeValue;
var _cssesc = _interopRequireDefault$9(require_cssesc());
var _unesc = _interopRequireDefault$9(require_unesc());
@ -3249,6 +3255,7 @@ var require_sortAscending = /* @__PURE__ */ __commonJS({ "../../node_modules/.pn
//#region ../../node_modules/.pnpm/postcss-selector-parser@7.1.0/node_modules/postcss-selector-parser/dist/tokenTypes.js
var require_tokenTypes = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/postcss-selector-parser@7.1.0/node_modules/postcss-selector-parser/dist/tokenTypes.js": ((exports) => {
exports.__esModule = true;
exports.word = exports.tilde = exports.tab = exports.str = exports.space = exports.slash = exports.singleQuote = exports.semicolon = exports.plus = exports.pipe = exports.openSquare = exports.openParenthesis = exports.newline = exports.greaterThan = exports.feed = exports.equals = exports.doubleQuote = exports.dollar = exports.cr = exports.comment = exports.comma = exports.combinator = exports.colon = exports.closeSquare = exports.closeParenthesis = exports.caret = exports.bang = exports.backslash = exports.at = exports.asterisk = exports.ampersand = void 0;
var ampersand = 38;
exports.ampersand = ampersand;
var asterisk = 42;
@ -3317,6 +3324,7 @@ var require_tokenTypes = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/
//#region ../../node_modules/.pnpm/postcss-selector-parser@7.1.0/node_modules/postcss-selector-parser/dist/tokenize.js
var require_tokenize = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/postcss-selector-parser@7.1.0/node_modules/postcss-selector-parser/dist/tokenize.js": ((exports) => {
exports.__esModule = true;
exports.FIELDS = void 0;
exports["default"] = tokenize;
var t = _interopRequireWildcard$2(require_tokenTypes());
var _unescapable, _wordDelimiters;
@ -4509,6 +4517,7 @@ var require_processor = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/p
//#region ../../node_modules/.pnpm/postcss-selector-parser@7.1.0/node_modules/postcss-selector-parser/dist/selectors/constructors.js
var require_constructors = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/postcss-selector-parser@7.1.0/node_modules/postcss-selector-parser/dist/selectors/constructors.js": ((exports) => {
exports.__esModule = true;
exports.universal = exports.tag = exports.string = exports.selector = exports.root = exports.pseudo = exports.nesting = exports.id = exports.comment = exports.combinator = exports.className = exports.attribute = void 0;
var _attribute = _interopRequireDefault$3(require_attribute());
var _className = _interopRequireDefault$3(require_className());
var _combinator = _interopRequireDefault$3(require_combinator());
@ -4578,11 +4587,16 @@ var require_constructors = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnp
//#region ../../node_modules/.pnpm/postcss-selector-parser@7.1.0/node_modules/postcss-selector-parser/dist/selectors/guards.js
var require_guards = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/postcss-selector-parser@7.1.0/node_modules/postcss-selector-parser/dist/selectors/guards.js": ((exports) => {
exports.__esModule = true;
exports.isComment = exports.isCombinator = exports.isClassName = exports.isAttribute = void 0;
exports.isContainer = isContainer;
exports.isIdentifier = void 0;
exports.isNamespace = isNamespace;
exports.isNesting = void 0;
exports.isNode = isNode;
exports.isPseudo = void 0;
exports.isPseudoClass = isPseudoClass;
exports.isPseudoElement = isPseudoElement;
exports.isUniversal = exports.isTag = exports.isString = exports.isSelector = exports.isRoot = void 0;
var _types$1 = require_types();
var _IS_TYPE;
var IS_TYPE = (_IS_TYPE = {}, _IS_TYPE[_types$1.ATTRIBUTE] = true, _IS_TYPE[_types$1.CLASS] = true, _IS_TYPE[_types$1.COMBINATOR] = true, _IS_TYPE[_types$1.COMMENT] = true, _IS_TYPE[_types$1.ID] = true, _IS_TYPE[_types$1.NESTING] = true, _IS_TYPE[_types$1.PSEUDO] = true, _IS_TYPE[_types$1.ROOT] = true, _IS_TYPE[_types$1.SELECTOR] = true, _IS_TYPE[_types$1.STRING] = true, _IS_TYPE[_types$1.TAG] = true, _IS_TYPE[_types$1.UNIVERSAL] = true, _IS_TYPE);
@ -5370,6 +5384,7 @@ var require_src = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/postcss
//#region ../../node_modules/.pnpm/postcss-modules@6.0.1_postcss@8.5.6/node_modules/postcss-modules/build/scoping.js
var require_scoping = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/postcss-modules@6.0.1_postcss@8.5.6/node_modules/postcss-modules/build/scoping.js": ((exports) => {
Object.defineProperty(exports, "__esModule", { value: true });
exports.behaviours = void 0;
exports.getDefaultPlugins = getDefaultPlugins;
exports.getDefaultScopeBehaviour = getDefaultScopeBehaviour;
exports.getScopedNameGenerator = getScopedNameGenerator;

View File

@ -28,4 +28,4 @@ var __toDynamicImportESM = (isNodeMode) => (mod) => __toESM(mod.default, isNodeM
var __require = /* @__PURE__ */ createRequire(import.meta.url);
//#endregion
export { __commonJS, __require, __toDynamicImportESM, __toESM };
export { __toESM as i, __require as n, __toDynamicImportESM as r, __commonJS as t };

File diff suppressed because it is too large Load Diff

View File

@ -1,4 +1,4 @@
import "./logger.js";
import { configDefaults, defineConfig, getDefaultEnvironmentOptions, isResolvedConfig, loadConfigFromFile, resolveBaseUrl, resolveConfig, resolveDevEnvironmentOptions, sortUserPlugins } from "./config.js";
import { a as resolveBaseUrl, c as sortUserPlugins, i as loadConfigFromFile, n as getDefaultEnvironmentOptions, o as resolveConfig, r as isResolvedConfig, s as resolveDevEnvironmentOptions, t as defineConfig } from "./config.js";
export { resolveConfig };
export { defineConfig, getDefaultEnvironmentOptions, isResolvedConfig, loadConfigFromFile, resolveBaseUrl, resolveConfig, resolveDevEnvironmentOptions, sortUserPlugins };

View File

@ -6755,4 +6755,4 @@ function parse(html, options) {
}
//#endregion
export { parse };
export { ERR as ErrorCodes, Parser, Tokenizer, TokenizerMode, defaultTreeAdapter, parse };

View File

@ -1,4 +1,4 @@
import { __commonJS } from "./chunk.js";
import { t as __commonJS } from "./chunk.js";
//#region ../../node_modules/.pnpm/postcss-value-parser@4.2.0/node_modules/postcss-value-parser/lib/parse.js
var require_parse = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/postcss-value-parser@4.2.0/node_modules/postcss-value-parser/lib/parse.js": ((exports, module) => {
@ -374,4 +374,4 @@ var require_lib = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/postcss
}) });
//#endregion
export { require_lib };
export { require_lib as t };

View File

@ -1,4 +1,4 @@
import { __commonJS, __toESM } from "./chunk.js";
import { i as __toESM, t as __commonJS } from "./chunk.js";
import { readFileSync } from "node:fs";
import path, { resolve } from "node:path";
import { fileURLToPath } from "node:url";
@ -127,6 +127,15 @@ const DEFAULT_CONDITIONS = [
const DEFAULT_CLIENT_CONDITIONS = Object.freeze(DEFAULT_CONDITIONS.filter((c) => c !== "node"));
const DEFAULT_SERVER_CONDITIONS = Object.freeze(DEFAULT_CONDITIONS.filter((c) => c !== "browser"));
const DEFAULT_EXTERNAL_CONDITIONS = Object.freeze(["node", "module-sync"]);
const DEFAULT_EXTENSIONS = [
".mjs",
".js",
".mts",
".ts",
".jsx",
".tsx",
".json"
];
/**
* The browser versions that are included in the Baseline Widely Available on 2025-05-01.
*
@ -317,4 +326,4 @@ function printServerUrls(urls, optionsHost, info) {
}
//#endregion
export { CLIENT_DIR, CLIENT_ENTRY, CLIENT_PUBLIC_PATH, CSS_LANGS_RE, DEFAULT_ASSETS_INLINE_LIMIT, DEFAULT_ASSETS_RE, DEFAULT_CLIENT_CONDITIONS, DEFAULT_CLIENT_MAIN_FIELDS, DEFAULT_CONFIG_FILES, DEFAULT_DEV_PORT, DEFAULT_EXTERNAL_CONDITIONS, DEFAULT_PREVIEW_PORT, DEFAULT_SERVER_CONDITIONS, DEFAULT_SERVER_MAIN_FIELDS, DEP_VERSION_RE, DEV_PROD_CONDITION, ENV_ENTRY, ENV_PUBLIC_PATH, ERR_FILE_NOT_FOUND_IN_OPTIMIZED_DEP_DIR, ERR_OPTIMIZE_DEPS_PROCESSING_ERROR, ESBUILD_BASELINE_WIDELY_AVAILABLE_TARGET, FS_PREFIX, JS_TYPES_RE, KNOWN_ASSET_TYPES, LogLevels, METADATA_FILENAME, OPTIMIZABLE_ENTRY_RE, ROLLUP_HOOKS, SPECIAL_QUERY_RE, VERSION, VITE_PACKAGE_DIR, createLogger, defaultAllowedOrigins, loopbackHosts, printServerUrls, require_picocolors, wildcardHosts };
export { OPTIMIZABLE_ENTRY_RE as A, ERR_FILE_NOT_FOUND_IN_OPTIMIZED_DEP_DIR as C, JS_TYPES_RE as D, FS_PREFIX as E, defaultAllowedOrigins as F, loopbackHosts as I, wildcardHosts as L, SPECIAL_QUERY_RE as M, VERSION as N, KNOWN_ASSET_TYPES as O, VITE_PACKAGE_DIR as P, require_picocolors as R, ENV_PUBLIC_PATH as S, ESBUILD_BASELINE_WIDELY_AVAILABLE_TARGET as T, DEFAULT_SERVER_CONDITIONS as _, CLIENT_ENTRY as a, DEV_PROD_CONDITION as b, DEFAULT_ASSETS_INLINE_LIMIT as c, DEFAULT_CLIENT_MAIN_FIELDS as d, DEFAULT_CONFIG_FILES as f, DEFAULT_PREVIEW_PORT as g, DEFAULT_EXTERNAL_CONDITIONS as h, CLIENT_DIR as i, ROLLUP_HOOKS as j, METADATA_FILENAME as k, DEFAULT_ASSETS_RE as l, DEFAULT_EXTENSIONS as m, createLogger as n, CLIENT_PUBLIC_PATH as o, DEFAULT_DEV_PORT as p, printServerUrls as r, CSS_LANGS_RE as s, LogLevels as t, DEFAULT_CLIENT_CONDITIONS as u, DEFAULT_SERVER_MAIN_FIELDS as v, ERR_OPTIMIZE_DEPS_PROCESSING_ERROR as w, ENV_ENTRY as x, DEP_VERSION_RE as y };

View File

@ -8,51 +8,59 @@ interface FetchFunctionOptions {
type FetchResult = CachedFetchResult | ExternalFetchResult | ViteFetchResult;
interface CachedFetchResult {
/**
* If module cached in the runner, we can just confirm
* it wasn't invalidated on the server side.
*/
* If module cached in the runner, we can just confirm
* it wasn't invalidated on the server side.
*/
cache: true;
}
interface ExternalFetchResult {
/**
* The path to the externalized module starting with file://,
* by default this will be imported via a dynamic "import"
* instead of being transformed by vite and loaded with vite runner
*/
* The path to the externalized module starting with file://,
* by default this will be imported via a dynamic "import"
* instead of being transformed by vite and loaded with vite runner
*/
externalize: string;
/**
* Type of the module. Will be used to determine if import statement is correct.
* For example, if Vite needs to throw an error if variable is not actually exported
*/
type: 'module' | 'commonjs' | 'builtin' | 'network';
* Type of the module. Will be used to determine if import statement is correct.
* For example, if Vite needs to throw an error if variable is not actually exported
*/
type: "module" | "commonjs" | "builtin" | "network";
}
interface ViteFetchResult {
/**
* Code that will be evaluated by vite runner
* by default this will be wrapped in an async function
*/
* Code that will be evaluated by vite runner
* by default this will be wrapped in an async function
*/
code: string;
/**
* File path of the module on disk.
* This will be resolved as import.meta.url/filename
* Will be equal to `null` for virtual modules
*/
* File path of the module on disk.
* This will be resolved as import.meta.url/filename
* Will be equal to `null` for virtual modules
*/
file: string | null;
/**
* Module ID in the server module graph.
*/
* Module ID in the server module graph.
*/
id: string;
/**
* Module URL used in the import.
*/
* Module URL used in the import.
*/
url: string;
/**
* Invalidate module on the client side.
*/
* Invalidate module on the client side.
*/
invalidate: boolean;
}
type InvokeMethods = {
fetchModule: (id: string, importer?: string, options?: FetchFunctionOptions) => Promise<FetchResult>;
getBuiltins: () => Promise<Array<{
type: "string";
value: string;
} | {
type: "RegExp";
source: string;
flags: string;
}>>;
};
//#endregion
//#region src/shared/moduleRunnerTransport.d.ts
@ -61,8 +69,8 @@ type ModuleRunnerTransportHandlers = {
onDisconnection: () => void;
};
/**
* "send and connect" or "invoke" must be implemented
*/
* "send and connect" or "invoke" must be implemented
*/
interface ModuleRunnerTransport {
connect?(handlers: ModuleRunnerTransportHandlers): Promise<void> | void;
disconnect?(): Promise<void> | void;
@ -85,4 +93,4 @@ declare const createWebSocketModuleRunnerTransport: (options: {
pingInterval?: number;
}) => Required<Pick<ModuleRunnerTransport, "connect" | "disconnect" | "send">>;
//#endregion
export { ExternalFetchResult, FetchFunctionOptions, FetchResult, ModuleRunnerTransport, ModuleRunnerTransportHandlers, NormalizedModuleRunnerTransport, ViteFetchResult, createWebSocketModuleRunnerTransport };
export { ExternalFetchResult as a, ViteFetchResult as c, createWebSocketModuleRunnerTransport as i, ModuleRunnerTransportHandlers as n, FetchFunctionOptions as o, NormalizedModuleRunnerTransport as r, FetchResult as s, ModuleRunnerTransport as t };

View File

@ -1,4 +1,4 @@
import "./logger.js";
import { addManuallyIncludedOptimizeDeps, addOptimizedDepInfo, cleanupDepsCacheStaleDirs, createIsOptimizedDepFile, createIsOptimizedDepUrl, depsFromOptimizedDepInfo, depsLogString, discoverProjectDependencies, extractExportsData, getDepsCacheDir, getOptimizedDepPath, initDepsOptimizerMetadata, isDepOptimizationDisabled, loadCachedDepOptimizationMetadata, optimizeDeps, optimizeExplicitEnvironmentDeps, optimizedDepInfoFromFile, optimizedDepInfoFromId, optimizedDepNeedsInterop, runOptimizeDeps, toDiscoveredDependencies } from "./config.js";
import { $ as runOptimizeDeps, B as depsLogString, F as addOptimizedDepInfo, G as initDepsOptimizerMetadata, H as extractExportsData, I as cleanupDepsCacheStaleDirs, J as optimizeDeps, K as isDepOptimizationDisabled, L as createIsOptimizedDepFile, P as addManuallyIncludedOptimizeDeps, Q as optimizedDepNeedsInterop, R as createIsOptimizedDepUrl, U as getDepsCacheDir, V as discoverProjectDependencies, W as getOptimizedDepPath, X as optimizedDepInfoFromFile, Y as optimizeExplicitEnvironmentDeps, Z as optimizedDepInfoFromId, et as toDiscoveredDependencies, q as loadCachedDepOptimizationMetadata, z as depsFromOptimizedDepInfo } from "./config.js";
export { optimizeDeps };
export { addManuallyIncludedOptimizeDeps, addOptimizedDepInfo, cleanupDepsCacheStaleDirs, createIsOptimizedDepFile, createIsOptimizedDepUrl, depsFromOptimizedDepInfo, depsLogString, discoverProjectDependencies, extractExportsData, getDepsCacheDir, getOptimizedDepPath, initDepsOptimizerMetadata, isDepOptimizationDisabled, loadCachedDepOptimizationMetadata, optimizeDeps, optimizeExplicitEnvironmentDeps, optimizedDepInfoFromFile, optimizedDepInfoFromId, optimizedDepNeedsInterop, runOptimizeDeps, toDiscoveredDependencies };

View File

@ -1,5 +1,5 @@
import { __commonJS, __require } from "./chunk.js";
import { require_lib } from "./lib.js";
import { n as __require, t as __commonJS } from "./chunk.js";
import { t as require_lib } from "./lib.js";
//#region ../../node_modules/.pnpm/postcss-import@16.1.1_postcss@8.5.6/node_modules/postcss-import/lib/format-import-prelude.js
var require_format_import_prelude = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/postcss-import@16.1.1_postcss@8.5.6/node_modules/postcss-import/lib/format-import-prelude.js": ((exports, module) => {

View File

@ -1,4 +1,4 @@
import "./logger.js";
import { preview, resolvePreviewOptions } from "./config.js";
import { d as resolvePreviewOptions, u as preview } from "./config.js";
export { preview };
export { preview, resolvePreviewOptions };

View File

@ -1,4 +1,4 @@
import "./logger.js";
import { _createServer, createServer, createServerCloseFn, resolveServerOptions, restartServerWithUrls, serverConfigDefaults } from "./config.js";
import { at as _createServer, ct as resolveServerOptions, lt as restartServerWithUrls, ot as createServer, st as createServerCloseFn, ut as serverConfigDefaults } from "./config.js";
export { createServer };
export { _createServer, createServer, createServerCloseFn, resolveServerOptions, restartServerWithUrls, serverConfigDefaults };

4
node_modules/vite/dist/node/cli.js generated vendored
View File

@ -1,5 +1,5 @@
import { __toESM } from "./chunks/chunk.js";
import { VERSION, createLogger, require_picocolors } from "./chunks/logger.js";
import { i as __toESM } from "./chunks/chunk.js";
import { N as VERSION, R as require_picocolors, n as createLogger } from "./chunks/logger.js";
import fs from "node:fs";
import path from "node:path";
import { performance } from "node:perf_hooks";

2536
node_modules/vite/dist/node/index.d.ts generated vendored

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +1,5 @@
import { DEFAULT_CLIENT_CONDITIONS, DEFAULT_CLIENT_MAIN_FIELDS, DEFAULT_EXTERNAL_CONDITIONS, DEFAULT_SERVER_CONDITIONS, DEFAULT_SERVER_MAIN_FIELDS, VERSION, createLogger, defaultAllowedOrigins } from "./chunks/logger.js";
import { BuildEnvironment, DevEnvironment, build, buildErrorMessage, createBuilder, createFilter, createIdResolver, createRunnableDevEnvironment, createServer, createServerHotChannel, createServerModuleRunner, createServerModuleRunnerTransport, defineConfig, fetchModule, formatPostcssSourceMap, isCSSRequest, isFileLoadingAllowed, isFileServingAllowed, isRunnableDevEnvironment, loadConfigFromFile, loadEnv, mergeAlias, mergeConfig, normalizePath, optimizeDeps, perEnvironmentPlugin, perEnvironmentState, preprocessCSS, preview, resolveConfig, resolveEnvPrefix, rollupVersion, runnerImport, searchForWorkspaceRoot, send, sortUserPlugins, ssrTransform, transformWithEsbuild } from "./chunks/config.js";
import { F as defaultAllowedOrigins, N as VERSION, _ as DEFAULT_SERVER_CONDITIONS, d as DEFAULT_CLIENT_MAIN_FIELDS, h as DEFAULT_EXTERNAL_CONDITIONS, n as createLogger, u as DEFAULT_CLIENT_CONDITIONS, v as DEFAULT_SERVER_MAIN_FIELDS } from "./chunks/logger.js";
import { Ct as perEnvironmentPlugin, Dt as mergeConfig, Et as mergeAlias, J as optimizeDeps, Ot as normalizePath, St as perEnvironmentState, Tt as isCSSRequest, _ as build, _t as createServerModuleRunnerTransport, b as createBuilder, bt as resolveEnvPrefix, c as sortUserPlugins, dt as searchForWorkspaceRoot, f as createRunnableDevEnvironment, ft as isFileLoadingAllowed, g as BuildEnvironment, gt as createServerModuleRunner, h as fetchModule, ht as ssrTransform, i as loadConfigFromFile, it as createServerHotChannel, kt as rollupVersion, l as runnerImport, m as DevEnvironment, mt as send, nt as preprocessCSS, o as resolveConfig, ot as createServer, p as isRunnableDevEnvironment, pt as isFileServingAllowed, rt as createIdResolver, t as defineConfig, tt as formatPostcssSourceMap, u as preview, vt as buildErrorMessage, wt as createFilter, xt as transformWithEsbuild, yt as loadEnv } from "./chunks/config.js";
import { parseAst, parseAstAsync } from "rollup/parseAst";
import { version as esbuildVersion } from "esbuild";

View File

@ -1,4 +1,4 @@
import { ExternalFetchResult, FetchFunctionOptions, FetchResult, ModuleRunnerTransport, ModuleRunnerTransportHandlers, NormalizedModuleRunnerTransport, ViteFetchResult, createWebSocketModuleRunnerTransport } from "./chunks/moduleRunnerTransport.js";
import { a as ExternalFetchResult, c as ViteFetchResult, i as createWebSocketModuleRunnerTransport, n as ModuleRunnerTransportHandlers, o as FetchFunctionOptions, r as NormalizedModuleRunnerTransport, s as FetchResult, t as ModuleRunnerTransport } from "./chunks/moduleRunnerTransport.js";
import { ModuleNamespace, ViteHotContext } from "#types/hot";
import { HotPayload, Update } from "#types/hmrPayload";
import { InferCustomEventPayload } from "#types/customEvent";
@ -17,6 +17,7 @@ declare class DecodedMap {
_decoded: undefined | number[][][];
_decodedMemo: Stats;
url: string;
file: string;
version: number;
names: string[];
resolvedSources: string[];
@ -62,10 +63,10 @@ declare class HMRClient {
private updateQueue;
private pendingUpdateQueue;
/**
* buffer multiple hot updates triggered by the same src change
* so that they are invoked in the same order they were sent.
* (otherwise the order may be inconsistent because of the http request round trip)
*/
* buffer multiple hot updates triggered by the same src change
* so that they are invoked in the same order they were sent.
* (otherwise the order may be inconsistent because of the http request round trip)
*/
queueUpdate(payload: Update): Promise<void>;
private fetchUpdate;
}
@ -73,14 +74,14 @@ declare class HMRClient {
//#region src/shared/ssrTransform.d.ts
interface DefineImportMetadata {
/**
* Imported names before being transformed to `ssrImportKey`
*
* import foo, { bar as baz, qux } from 'hello'
* => ['default', 'bar', 'qux']
*
* import * as namespace from 'world
* => undefined
*/
* Imported names before being transformed to `ssrImportKey`
*
* import foo, { bar as baz, qux } from 'hello'
* => ['default', 'bar', 'qux']
*
* import * as namespace from 'world
* => undefined
*/
importedNames?: string[];
}
interface SSRImportMetadata extends DefineImportMetadata {
@ -108,30 +109,33 @@ declare class ModuleRunner {
private readonly transport;
private readonly resetSourceMapSupport?;
private readonly concurrentModuleNodePromises;
private isBuiltin?;
private builtinsPromise?;
private closed;
constructor(options: ModuleRunnerOptions, evaluator?: ModuleEvaluator, debug?: ModuleRunnerDebugger | undefined);
/**
* URL to execute. Accepts file path, server path or id relative to the root.
*/
* URL to execute. Accepts file path, server path or id relative to the root.
*/
import<T = any>(url: string): Promise<T>;
/**
* Clear all caches including HMR listeners.
*/
* Clear all caches including HMR listeners.
*/
clearCache(): void;
/**
* Clears all caches, removes all HMR listeners, and resets source map support.
* This method doesn't stop the HMR connection.
*/
* Clears all caches, removes all HMR listeners, and resets source map support.
* This method doesn't stop the HMR connection.
*/
close(): Promise<void>;
/**
* Returns `true` if the runtime has been closed by calling `close()` method.
*/
* Returns `true` if the runtime has been closed by calling `close()` method.
*/
isClosed(): boolean;
private processImport;
private isCircularModule;
private isCircularImport;
private cachedRequest;
private cachedModule;
private ensureBuiltins;
private getModuleInformation;
protected directRequest(url: string, mod: EvaluatedModuleNode, _callstack: string[]): Promise<any>;
}
@ -168,20 +172,20 @@ interface ModuleRunnerContext {
}
interface ModuleEvaluator {
/**
* Number of prefixed lines in the transformed code.
*/
* Number of prefixed lines in the transformed code.
*/
startOffset?: number;
/**
* Run code that was transformed by Vite.
* @param context Function context
* @param code Transformed code
* @param module The module node
*/
* Run code that was transformed by Vite.
* @param context Function context
* @param code Transformed code
* @param module The module node
*/
runInlinedModule(context: ModuleRunnerContext, code: string, module: Readonly<EvaluatedModuleNode>): Promise<any>;
/**
* Run externalized module.
* @param file File URL to the external module
*/
* Run externalized module.
* @param file File URL to the external module
*/
runExternalModule(file: string): Promise<any>;
}
type ResolvedResult = (ExternalFetchResult | ViteFetchResult) & {
@ -191,36 +195,36 @@ type ResolvedResult = (ExternalFetchResult | ViteFetchResult) & {
type FetchFunction = (id: string, importer?: string, options?: FetchFunctionOptions) => Promise<FetchResult>;
interface ModuleRunnerHmr {
/**
* Configure HMR logger.
*/
* Configure HMR logger.
*/
logger?: false | HMRLogger;
}
interface ModuleRunnerOptions {
/**
* A set of methods to communicate with the server.
*/
* A set of methods to communicate with the server.
*/
transport: ModuleRunnerTransport;
/**
* Configure how source maps are resolved. Prefers `node` if `process.setSourceMapsEnabled` is available.
* Otherwise it will use `prepareStackTrace` by default which overrides `Error.prepareStackTrace` method.
* You can provide an object to configure how file contents and source maps are resolved for files that were not processed by Vite.
*/
sourcemapInterceptor?: false | 'node' | 'prepareStackTrace' | InterceptorOptions;
* Configure how source maps are resolved. Prefers `node` if `process.setSourceMapsEnabled` is available.
* Otherwise it will use `prepareStackTrace` by default which overrides `Error.prepareStackTrace` method.
* You can provide an object to configure how file contents and source maps are resolved for files that were not processed by Vite.
*/
sourcemapInterceptor?: false | "node" | "prepareStackTrace" | InterceptorOptions;
/**
* Disable HMR or configure HMR options.
*
* @default true
*/
* Disable HMR or configure HMR options.
*
* @default true
*/
hmr?: boolean | ModuleRunnerHmr;
/**
* Create import.meta object for the module.
*
* @default createDefaultImportMeta
*/
* Create import.meta object for the module.
*
* @default createDefaultImportMeta
*/
createImportMeta?: (modulePath: string) => ModuleRunnerImportMeta | Promise<ModuleRunnerImportMeta>;
/**
* Custom module cache. If not provided, creates a separate module cache for each ModuleRunner instance.
*/
* Custom module cache. If not provided, creates a separate module cache for each ModuleRunner instance.
*/
evaluatedModules?: EvaluatedModules;
}
interface ImportMetaEnv {
@ -251,40 +255,40 @@ declare class EvaluatedModules {
readonly fileToModulesMap: Map<string, Set<EvaluatedModuleNode>>;
readonly urlToIdModuleMap: Map<string, EvaluatedModuleNode>;
/**
* Returns the module node by the resolved module ID. Usually, module ID is
* the file system path with query and/or hash. It can also be a virtual module.
*
* Module runner graph will have 1 to 1 mapping with the server module graph.
* @param id Resolved module ID
*/
* Returns the module node by the resolved module ID. Usually, module ID is
* the file system path with query and/or hash. It can also be a virtual module.
*
* Module runner graph will have 1 to 1 mapping with the server module graph.
* @param id Resolved module ID
*/
getModuleById(id: string): EvaluatedModuleNode | undefined;
/**
* Returns all modules related to the file system path. Different modules
* might have different query parameters or hash, so it's possible to have
* multiple modules for the same file.
* @param file The file system path of the module
*/
* Returns all modules related to the file system path. Different modules
* might have different query parameters or hash, so it's possible to have
* multiple modules for the same file.
* @param file The file system path of the module
*/
getModulesByFile(file: string): Set<EvaluatedModuleNode> | undefined;
/**
* Returns the module node by the URL that was used in the import statement.
* Unlike module graph on the server, the URL is not resolved and is used as is.
* @param url Server URL that was used in the import statement
*/
* Returns the module node by the URL that was used in the import statement.
* Unlike module graph on the server, the URL is not resolved and is used as is.
* @param url Server URL that was used in the import statement
*/
getModuleByUrl(url: string): EvaluatedModuleNode | undefined;
/**
* Ensure that module is in the graph. If the module is already in the graph,
* it will return the existing module node. Otherwise, it will create a new
* module node and add it to the graph.
* @param id Resolved module ID
* @param url URL that was used in the import statement
*/
* Ensure that module is in the graph. If the module is already in the graph,
* it will return the existing module node. Otherwise, it will create a new
* module node and add it to the graph.
* @param id Resolved module ID
* @param url URL that was used in the import statement
*/
ensureModule(id: string, url: string): EvaluatedModuleNode;
invalidateModule(node: EvaluatedModuleNode): void;
/**
* Extracts the inlined source map from the module code and returns the decoded
* source map. If the source map is not inlined, it will return null.
* @param id Resolved module ID
*/
* Extracts the inlined source map from the module code and returns the decoded
* source map. If the source map is not inlined, it will return null.
* @param id Resolved module ID
*/
getModuleSourceMapById(id: string): DecodedMap | null;
clear(): void;
}
@ -300,8 +304,8 @@ declare class ESModulesEvaluator implements ModuleEvaluator {
//#region src/module-runner/createImportMeta.d.ts
declare function createDefaultImportMeta(modulePath: string): ModuleRunnerImportMeta;
/**
* Create import.meta object for Node.js.
*/
* Create import.meta object for Node.js.
*/
declare function createNodeImportMeta(modulePath: string): Promise<ModuleRunnerImportMeta>;
//#endregion
export { ESModulesEvaluator, type EvaluatedModuleNode, EvaluatedModules, type FetchFunction, type FetchFunctionOptions, type FetchResult, type HMRLogger, type InterceptorOptions, type ModuleEvaluator, ModuleRunner, type ModuleRunnerContext, type ModuleRunnerHmr, type ModuleRunnerImportMeta, type ModuleRunnerOptions, type ModuleRunnerTransport, type ModuleRunnerTransportHandlers, type ResolvedResult, type SSRImportMetadata, createDefaultImportMeta, createNodeImportMeta, createWebSocketModuleRunnerTransport, normalizeModuleId, ssrDynamicImportKey, ssrExportAllKey, ssrExportNameKey, ssrImportKey, ssrImportMetaKey, ssrModuleExportsKey };

View File

@ -216,13 +216,16 @@ var DecodedMap = class {
_decoded;
_decodedMemo;
url;
file;
version;
names = [];
resolvedSources;
constructor(map, from) {
this.map = map;
let { mappings, names, sources } = map;
this.version = map.version, this.names = names || [], this._encoded = mappings || "", this._decodedMemo = memoizedState(), this.url = from, this.resolvedSources = (sources || []).map((s) => posixResolve(s || "", from));
this.version = map.version, this.names = names || [], this._encoded = mappings || "", this._decodedMemo = memoizedState(), this.url = from, this.file = from;
let originDir = posixDirname(from);
this.resolvedSources = (sources || []).map((s) => posixResolve(originDir, s || ""));
}
};
function memoizedState() {
@ -619,7 +622,12 @@ const createInvokeableTransport = (transport) => {
ws.send(JSON.stringify(data));
}
};
}, ssrModuleExportsKey = "__vite_ssr_exports__", ssrImportKey = "__vite_ssr_import__", ssrDynamicImportKey = "__vite_ssr_dynamic_import__", ssrExportAllKey = "__vite_ssr_exportAll__", ssrExportNameKey = "__vite_ssr_exportName__", ssrImportMetaKey = "__vite_ssr_import_meta__", noop = () => {}, silentConsole = {
};
function createIsBuiltin(builtins) {
let plainBuiltinsSet = new Set(builtins.filter((builtin) => typeof builtin == "string")), regexBuiltins = builtins.filter((builtin) => typeof builtin != "string");
return (id) => plainBuiltinsSet.has(id) || regexBuiltins.some((regexp) => regexp.test(id));
}
const ssrModuleExportsKey = "__vite_ssr_exports__", ssrImportKey = "__vite_ssr_import__", ssrDynamicImportKey = "__vite_ssr_dynamic_import__", ssrExportAllKey = "__vite_ssr_exportAll__", ssrExportNameKey = "__vite_ssr_exportName__", ssrImportMetaKey = "__vite_ssr_import_meta__", noop = () => {}, silentConsole = {
debug: noop,
error: noop
}, hmrLogger = {
@ -917,11 +925,17 @@ export async function resolve(specifier, context, nextResolve) {
specifier = parsedSpecifier
context.parentURL = parsedImporter
}
return nextResolve(specifier, context)
}
`;
function customizationHookResolve(specifier, context, nextResolve) {
if (specifier.startsWith(customizationHookNamespace)) {
let data = specifier.slice(42), [parsedSpecifier, parsedImporter] = JSON.parse(data);
specifier = parsedSpecifier, context.parentURL = parsedImporter;
}
return nextResolve(specifier, context);
}
async function createImportMetaResolver() {
let module;
try {
@ -929,17 +943,24 @@ async function createImportMetaResolver() {
} catch {
return;
}
if (module?.register) {
try {
let hookModuleContent = `data:text/javascript,${encodeURI(customizationHooksModule)}`;
module.register(hookModuleContent);
} catch (e) {
if ("code" in e && e.code === "ERR_NETWORK_IMPORT_DISALLOWED") return;
throw e;
if (module) {
if (module.registerHooks) return module.registerHooks({ resolve: customizationHookResolve }), importMetaResolveWithCustomHook;
if (module.register) {
try {
let hookModuleContent = `data:text/javascript,${encodeURI(customizationHooksModule)}`;
module.register(hookModuleContent);
} catch (e) {
if ("code" in e && e.code === "ERR_NETWORK_IMPORT_DISALLOWED") return;
throw e;
}
return importMetaResolveWithCustomHook;
}
return (specifier, importer) => import.meta.resolve(`${customizationHookNamespace}${JSON.stringify([specifier, importer])}`);
}
}
function importMetaResolveWithCustomHook(specifier, importer) {
return import.meta.resolve(`${customizationHookNamespace}${JSON.stringify([specifier, importer])}`);
}
`${customizationHookNamespace}`;
const envProxy = new Proxy({}, { get(_, p) {
throw Error(`[module runner] Dynamic access of "import.meta.env" is not supported. Please, use "import.meta.env.${String(p)}" instead.`);
} });
@ -977,6 +998,8 @@ var ModuleRunner = class {
transport;
resetSourceMapSupport;
concurrentModuleNodePromises = /* @__PURE__ */ new Map();
isBuiltin;
builtinsPromise;
closed = !1;
constructor(options, evaluator = new ESModulesEvaluator(), debug) {
if (this.options = options, this.evaluator = evaluator, this.debug = debug, this.evaluatedModules = options.evaluatedModules ?? new EvaluatedModules(), this.transport = normalizeModuleRunnerTransport(options.transport), options.hmr !== !1) {
@ -1043,10 +1066,21 @@ var ModuleRunner = class {
}
return cached;
}
ensureBuiltins() {
if (!this.isBuiltin) return this.builtinsPromise ??= (async () => {
try {
this.debug?.("[module runner] fetching builtins from server");
let builtins = (await this.transport.invoke("getBuiltins", [])).map((builtin) => typeof builtin == "object" && builtin && "type" in builtin ? builtin.type === "string" ? builtin.value : new RegExp(builtin.source, builtin.flags) : builtin);
this.isBuiltin = createIsBuiltin(builtins), this.debug?.("[module runner] builtins loaded:", builtins);
} finally {
this.builtinsPromise = void 0;
}
})(), this.builtinsPromise;
}
async getModuleInformation(url, importer, cachedModule) {
if (this.closed) throw Error("Vite module runner has been closed.");
this.debug?.("[module runner] fetching", url);
let isCached = !!(typeof cachedModule == "object" && cachedModule.meta), fetchedModule = url.startsWith("data:") ? {
await this.ensureBuiltins(), this.debug?.("[module runner] fetching", url);
let isCached = !!(typeof cachedModule == "object" && cachedModule.meta), fetchedModule = url.startsWith("data:") || this.isBuiltin?.(url) ? {
externalize: url,
type: "builtin"
} : await this.transport.invoke("fetchModule", [

18
node_modules/vite/package.json generated vendored
View File

@ -1,6 +1,6 @@
{
"name": "vite",
"version": "7.1.12",
"version": "7.2.2",
"type": "module",
"license": "MIT",
"author": "Evan You",
@ -79,12 +79,12 @@
"fsevents": "~2.3.3"
},
"devDependencies": {
"@babel/parser": "^7.28.4",
"@babel/parser": "^7.28.5",
"@jridgewell/remapping": "^2.3.5",
"@jridgewell/trace-mapping": "^0.3.31",
"@oxc-project/types": "0.90.0",
"@oxc-project/types": "0.95.0",
"@polka/compression": "^1.0.0-next.25",
"@rolldown/pluginutils": "^1.0.0-beta.43",
"@rolldown/pluginutils": "^1.0.0-beta.44",
"@rollup/plugin-alias": "^5.1.1",
"@rollup/plugin-commonjs": "28.0.6",
"@rollup/plugin-dynamic-import-vars": "2.1.4",
@ -92,7 +92,7 @@
"@types/escape-html": "^1.0.4",
"@types/pnpapi": "^0.0.5",
"artichokie": "^0.4.2",
"baseline-browser-mapping": "^2.8.18",
"baseline-browser-mapping": "^2.8.20",
"cac": "^6.7.14",
"chokidar": "^3.6.0",
"connect": "^3.7.0",
@ -110,7 +110,7 @@
"http-proxy-3": "^1.22.0",
"launch-editor-middleware": "^2.11.1",
"lightningcss": "^1.30.2",
"magic-string": "^0.30.19",
"magic-string": "^0.30.21",
"mlly": "^1.8.0",
"mrmime": "^2.0.1",
"nanoid": "^5.1.6",
@ -124,8 +124,8 @@
"postcss-modules": "^6.0.1",
"premove": "^4.0.0",
"resolve.exports": "^2.0.3",
"rolldown": "^1.0.0-beta.43",
"rolldown-plugin-dts": "^0.16.11",
"rolldown": "^1.0.0-beta.46",
"rolldown-plugin-dts": "^0.17.3",
"rollup-plugin-license": "^3.6.0",
"sass": "^1.93.2",
"sass-embedded": "^1.93.2",
@ -191,7 +191,7 @@
"build-types": "pnpm build-types-roll && pnpm build-types-check",
"build-types-roll": "rolldown --config rolldown.dts.config.ts",
"build-types-check": "tsc --project tsconfig.check.json",
"typecheck": "tsc && tsc -p src/node",
"typecheck": "tsc && tsc -p src/node && tsc -p src/module-runner && tsc -p src/shared && tsc -p src/node/__tests_dts__",
"lint": "eslint --cache --ext .ts src/**",
"format": "prettier --write --cache --parser typescript \"src/**/*.ts\"",
"generate-target": "tsx scripts/generateTarget.ts"

View File

@ -6,6 +6,7 @@ import type {
} from './hmrPayload'
export interface CustomEventMap {
// client events
'vite:beforeUpdate': UpdatePayload
'vite:afterUpdate': UpdatePayload
'vite:beforePrune': PrunePayload
@ -14,6 +15,10 @@ export interface CustomEventMap {
'vite:invalidate': InvalidatePayload
'vite:ws:connect': WebSocketConnectionPayload
'vite:ws:disconnect': WebSocketConnectionPayload
// server events
'vite:client:connect': undefined
'vite:client:disconnect': undefined
}
export interface WebSocketConnectionPayload {

9
package-lock.json generated
View File

@ -12,7 +12,7 @@
"three": "^0.181.0"
},
"devDependencies": {
"vite": "^7.1.12"
"vite": "^7.2.2"
}
},
"node_modules/@esbuild/aix-ppc64": {
@ -991,11 +991,10 @@
}
},
"node_modules/vite": {
"version": "7.1.12",
"resolved": "https://registry.npmjs.org/vite/-/vite-7.1.12.tgz",
"integrity": "sha512-ZWyE8YXEXqJrrSLvYgrRP7p62OziLW7xI5HYGWFzOvupfAlrLvURSzv/FyGyy0eidogEM3ujU+kUG1zuHgb6Ug==",
"version": "7.2.2",
"resolved": "https://registry.npmjs.org/vite/-/vite-7.2.2.tgz",
"integrity": "sha512-BxAKBWmIbrDgrokdGZH1IgkIk/5mMHDreLDmCJ0qpyJaAteP8NvMhkwr/ZCQNqNH97bw/dANTE9PDzqwJghfMQ==",
"dev": true,
"license": "MIT",
"dependencies": {
"esbuild": "^0.25.0",
"fdir": "^6.5.0",

View File

@ -14,6 +14,6 @@
"three": "^0.181.0"
},
"devDependencies": {
"vite": "^7.1.12"
"vite": "^7.2.2"
}
}

View File

@ -1,43 +1,43 @@
import xml.etree.ElementTree as ET
import math
def round_axis(x, y, z):
# Normalize vector
mag = math.sqrt(x**2 + y**2 + z**2)
if mag == 0:
return (0, 0, 0)
x, y, z = x/mag, y/mag, z/mag
# Compare to cardinal directions
directions = {
(1, 0, 0): 'X+',
(-1, 0, 0): 'X-',
(0, 1, 0): 'Y+',
(0, -1, 0): 'Y-',
(0, 0, 1): 'Z+',
(0, 0, -1): 'Z-'
}
best = max(directions.keys(), key=lambda d: x*d[0] + y*d[1] + z*d[2])
return best
def process_urdf(file_path, output_path):
tree = ET.parse(file_path)
root = tree.getroot()
for joint in root.findall('joint'):
axis_elem = joint.find('axis')
if axis_elem is not None:
axis_str = axis_elem.attrib.get('xyz', '')
try:
x, y, z = map(float, axis_str.strip().split())
rx, ry, rz = round_axis(x, y, z)
axis_elem.set('xyz', f"{rx} {ry} {rz}")
except:
continue
tree.write(output_path)
print(f"Rounded axes written to {output_path}")
# Example usage
process_urdf("./urdf/sample.urdf", "./urdf/output.urdf")
import xml.etree.ElementTree as ET
import math
def round_axis(x, y, z):
# Normalize vector
mag = math.sqrt(x**2 + y**2 + z**2)
if mag == 0:
return (0, 0, 0)
x, y, z = x/mag, y/mag, z/mag
# Compare to cardinal directions
directions = {
(1, 0, 0): 'X+',
(-1, 0, 0): 'X-',
(0, 1, 0): 'Y+',
(0, -1, 0): 'Y-',
(0, 0, 1): 'Z+',
(0, 0, -1): 'Z-'
}
best = max(directions.keys(), key=lambda d: x*d[0] + y*d[1] + z*d[2])
return best
def process_urdf(file_path, output_path):
tree = ET.parse(file_path)
root = tree.getroot()
for joint in root.findall('joint'):
axis_elem = joint.find('axis')
if axis_elem is not None:
axis_str = axis_elem.attrib.get('xyz', '')
try:
x, y, z = map(float, axis_str.strip().split())
rx, ry, rz = round_axis(x, y, z)
axis_elem.set('xyz', f"{rx} {ry} {rz}")
except:
continue
tree.write(output_path)
print(f"Rounded axes written to {output_path}")
# Example usage
process_urdf("./urdf/sample.urdf", "./urdf/output.urdf")

712
script.js
View File

@ -1,356 +1,356 @@
import * as THREE from 'three';
import { OrbitControls } from 'three/examples/jsm/controls/OrbitControls.js';
import URDFLoader from './urdf/URDFLoader.js';
// Setup scene, camera, renderer
const canvas = document.getElementById('urdf-canvas');
const renderer = new THREE.WebGLRenderer({ canvas, antialias: true });
renderer.setSize(window.innerWidth, window.innerHeight);
const scene = new THREE.Scene();
scene.background = new THREE.Color(0xaaaaaa);
const camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 0.1, 100);
camera.position.set(2, 2, 2);
camera.lookAt(0, 0, 0);
// Lights
scene.add(new THREE.AmbientLight(0xffffff, 0.6));
const directional = new THREE.DirectionalLight(0xffffff, 0.8);
directional.position.set(15, 10, 7);
const directional2 = new THREE.DirectionalLight(0xffffff, 0.8);
directional2.position.set(-15, 10, -7);
scene.add(directional2);
// Controls
const controls = new OrbitControls(camera, renderer.domElement);
controls.target.set(0, 0.5, 0);
controls.update();
// Helpers
scene.add(new THREE.AxesHelper(1));
const gridHelper = new THREE.GridHelper(2, 10);
//gridHelper.rotation.x = Math.PI / 2;
gridHelper.position.z = 0;
scene.add(gridHelper);
// Raycasting
const raycaster = new THREE.Raycaster();
const mouse = new THREE.Vector2();
let hoveredJoint = null;
let isDragging = false;
let lastX = null;
let worldAxis = null;
let draggedJoint = null;
let arc = null;
const jointAngles = {}; // key: jointName, value: current angle in radians
function findJointAncestor(object) {
while (object && object.parent) {
if (object.type === 'URDFJoint') return object;
object = object.parent;
}
return null;
}
function createRotationArc(axis, lower, upper, radius = 0.1, segments = 32) {
const points = [];
console.log(axis);
console.log(axis.clone());
// ✅ Ensure axis is normalized
const normalizedAxis = axis.clone().normalize();
// ✅ Find a perpendicular vector
let perp = new THREE.Vector3(0, 1, 0);
if (Math.abs(normalizedAxis.dot(perp)) > 0.99) {
perp = new THREE.Vector3(1, 0, 0); // fallback if axis is nearly parallel to Y
}
const tangent = perp.cross(normalizedAxis).normalize();
for (let i = 0; i <= segments; i++) {
const angle = lower + (upper - lower) * (i / segments);
const point = tangent.clone().applyAxisAngle(normalizedAxis, angle).multiplyScalar(radius);
points.push(point);
}
const geometry = new THREE.BufferGeometry().setFromPoints(points);
const material = new THREE.LineBasicMaterial({ color: 0xffff00 });
return new THREE.Line(geometry, material);
}
function createRotationSector(axis, lower, upper, radius = 0.1, segments = 64) {
const motorMargin = 0.4; // hardcoded extra range beyond joint limits
const motorLower = lower - motorMargin;
const motorUpper = upper + motorMargin;
const redMaterial = new THREE.MeshBasicMaterial({
color: 0xff0000,
transparent: true,
opacity: 0.2,
side: THREE.DoubleSide,
depthTest: false,
depthWrite: false
});
const whiteMaterial = new THREE.MeshBasicMaterial({
color: 0xffffff,
transparent: true,
opacity: 0.6,
side: THREE.DoubleSide,
depthTest: false,
depthWrite: false
});
function createArc(start, end, material) {
const shape = new THREE.Shape();
shape.moveTo(0, 0);
for (let i = 0; i <= segments; i++) {
const angle = start + (end - start) * (i / segments);
shape.lineTo(Math.cos(angle) * radius, Math.sin(angle) * radius);
}
shape.lineTo(0, 0);
const geometry = new THREE.ShapeGeometry(shape);
return new THREE.Mesh(geometry, material);
}
const redLeft = createArc(motorLower, lower, redMaterial);
const whiteArc = createArc(lower, upper, whiteMaterial);
const redRight = createArc(upper, motorUpper, redMaterial);
// Orient all arcs to match the axis
const basis = new THREE.Matrix4();
const up = new THREE.Vector3(0, 0, 1);
const quaternion = new THREE.Quaternion().setFromUnitVectors(up, axis.clone().normalize());
basis.makeRotationFromQuaternion(quaternion);
redLeft.applyMatrix4(basis);
whiteArc.applyMatrix4(basis);
redRight.applyMatrix4(basis);
const group = new THREE.Group();
group.add(redLeft);
group.add(whiteArc);
group.add(redRight);
return group;
}
function createAngleIndicator(axis, angle, radius = 0.1) {
const dir = new THREE.Vector3(Math.cos(angle), Math.sin(angle), 0).multiplyScalar(radius);
const geometry = new THREE.BufferGeometry().setFromPoints([
new THREE.Vector3(0, 0, 0),
dir,
]);
const material = new THREE.LineBasicMaterial({
color: 0xffffff, // white
linewidth: 2, // note: linewidth only works in some renderers
depthTest: false, // ✅ always on top
depthWrite: false
});
const line = new THREE.Line(geometry, material);
// Rotate into axis plane
const up = new THREE.Vector3(0, 0, 1);
const quaternion = new THREE.Quaternion().setFromUnitVectors(up, axis.clone().normalize());
line.applyQuaternion(quaternion);
return line;
}
// Load URDF
const loader = new URDFLoader();
loader.packages = { '': './urdf/' };
function findObjectByName(root, name) {
let result = null;
root.traverse(child => {
if (child.name === name) result = child;
});
return result;
}
loader.load('./urdf/sample.urdf', robot => {
//scene.rotation.x = -Math.PI / 2;
robot.rotation.x = -Math.PI / 2;
scene.add(robot);
document.getElementById('status').textContent = 'URDF Loaded';
loader.parseVisual = true;
loader.parseCollision = false;
// Add AxesHelpers to all meshes
robot.traverse(obj => {
if (obj.isMesh) obj.add(new THREE.AxesHelper(0.05));
});
// Setup pointer events
canvas.addEventListener('pointermove', event => {
mouse.x = (event.clientX / canvas.clientWidth) * 2 - 1;
mouse.y = -(event.clientY / canvas.clientHeight) * 2 + 1;
raycaster.setFromCamera(mouse, camera);
const intersects = raycaster.intersectObjects(robot.children, true);
if (isDragging && draggedJoint && worldAxis) {
const deltaX = event.clientX - lastX;
lastX = event.clientX;
const angleDelta = deltaX * 0.005;
const jointName = draggedJoint.name;
const limits = robot.joints[jointName]?.limit;
const lower = limits?.lower ?? -Math.PI;
const upper = limits?.upper ?? Math.PI;
const currentAngle = jointAngles[jointName] ?? 0;
const proposedAngle = currentAngle + angleDelta;
// ✅ Clamp to limits
const clampedAngle = Math.max(lower, Math.min(upper, proposedAngle));
const actualDelta = clampedAngle - currentAngle;
// ✅ Apply rotation
draggedJoint.rotateOnAxis(worldAxis, actualDelta);
jointAngles[jointName] = clampedAngle;
// Remove old indicator
if (draggedJoint.userData.gizmo?.indicator) {
draggedJoint.parent.remove(draggedJoint.userData.gizmo.indicator);
}
// Add updated indicator
const newIndicator = createAngleIndicator(worldAxis, jointAngles[jointName]);
newIndicator.position.copy(draggedJoint.position);
draggedJoint.parent.add(newIndicator);
draggedJoint.userData.gizmo.indicator = newIndicator;
}
if (intersects.length > 0) {
const target = intersects[0].object;
// Reset previous highlight
if (
hoveredJoint &&
hoveredJoint.material &&
'emissive' in hoveredJoint.material &&
typeof hoveredJoint.material.emissive.setHex === 'function'
) {
hoveredJoint.material.emissive.setHex(0x000000);
}
hoveredJoint = target;
// Highlight new joint
if (
hoveredJoint.material &&
'emissive' in hoveredJoint.material &&
typeof hoveredJoint.material.emissive.setHex === 'function'
) {
hoveredJoint.material.emissive.setHex(0x333333);
}
} else {
if (
hoveredJoint &&
hoveredJoint.material &&
'emissive' in hoveredJoint.material &&
typeof hoveredJoint.material.emissive.setHex === 'function'
) {
hoveredJoint.material.emissive.setHex(0x000000);
}
hoveredJoint = null;
}
});
canvas.addEventListener('pointerdown', event => {
if (!hoveredJoint) return;
isDragging = true;
lastX = event.clientX;
controls.enabled = false;
draggedJoint = findJointAncestor(hoveredJoint);
if (!draggedJoint) return;
const jointName = draggedJoint.name;
const jointData = robot.joints?.[jointName];
// ✅ Check if axis is a valid THREE.Vector3
if (!(jointData?.axis instanceof THREE.Vector3)) {
console.warn(`Invalid axis for joint "${jointName}":`, jointData?.axis);
return;
}
const urdfAxis = jointData.axis.clone();
if (urdfAxis.lengthSq() === 0) {
console.warn(`Zero-length axis for joint "${jointName}"`);
return;
}
worldAxis = urdfAxis.normalize();
const limits = robot.joints[jointName]?.limit;
const lower = limits?.lower ?? -Math.PI;
const upper = limits?.upper ?? Math.PI;
const sector = createRotationSector(worldAxis, lower, upper);
const indicator = createAngleIndicator(worldAxis, jointAngles[jointName] ?? 0);
sector.position.copy(draggedJoint.position);
indicator.position.copy(draggedJoint.position);
draggedJoint.parent.add(sector);
draggedJoint.parent.add(indicator);
// Store for cleanup
draggedJoint.userData.gizmo = { sector, indicator };
console.log(`Dragging joint "${jointName}" on axis`, worldAxis.toArray());
});
canvas.addEventListener('pointerup', () => {
isDragging = false;
controls.enabled = true;
const gizmo = draggedJoint?.userData.gizmo;
if (gizmo) {
draggedJoint.parent.remove(gizmo.sector);
draggedJoint.parent.remove(gizmo.indicator);
}
draggedJoint = null;
worldAxis = null;
});
animate();
});
function animate() {
requestAnimationFrame(animate);
renderer.render(scene, camera);
}
import * as THREE from 'three';
import { OrbitControls } from 'three/examples/jsm/controls/OrbitControls.js';
import URDFLoader from './urdf/URDFLoader.js';
// Setup scene, camera, renderer
const canvas = document.getElementById('urdf-canvas');
const renderer = new THREE.WebGLRenderer({ canvas, antialias: true });
renderer.setSize(window.innerWidth, window.innerHeight);
const scene = new THREE.Scene();
scene.background = new THREE.Color(0xaaaaaa);
const camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 0.1, 100);
camera.position.set(2, 2, 2);
camera.lookAt(0, 0, 0);
// Lights
scene.add(new THREE.AmbientLight(0xffffff, 0.6));
const directional = new THREE.DirectionalLight(0xffffff, 0.8);
directional.position.set(15, 10, 7);
const directional2 = new THREE.DirectionalLight(0xffffff, 0.8);
directional2.position.set(-15, 10, -7);
scene.add(directional2);
// Controls
const controls = new OrbitControls(camera, renderer.domElement);
controls.target.set(0, 0.5, 0);
controls.update();
// Helpers
scene.add(new THREE.AxesHelper(1));
const gridHelper = new THREE.GridHelper(2, 10);
//gridHelper.rotation.x = Math.PI / 2;
gridHelper.position.z = 0;
scene.add(gridHelper);
// Raycasting
const raycaster = new THREE.Raycaster();
const mouse = new THREE.Vector2();
let hoveredJoint = null;
let isDragging = false;
let lastX = null;
let worldAxis = null;
let draggedJoint = null;
let arc = null;
const jointAngles = {}; // key: jointName, value: current angle in radians
function findJointAncestor(object) {
while (object && object.parent) {
if (object.type === 'URDFJoint') return object;
object = object.parent;
}
return null;
}
function createRotationArc(axis, lower, upper, radius = 0.1, segments = 32) {
const points = [];
console.log(axis);
console.log(axis.clone());
// ✅ Ensure axis is normalized
const normalizedAxis = axis.clone().normalize();
// ✅ Find a perpendicular vector
let perp = new THREE.Vector3(0, 1, 0);
if (Math.abs(normalizedAxis.dot(perp)) > 0.99) {
perp = new THREE.Vector3(1, 0, 0); // fallback if axis is nearly parallel to Y
}
const tangent = perp.cross(normalizedAxis).normalize();
for (let i = 0; i <= segments; i++) {
const angle = lower + (upper - lower) * (i / segments);
const point = tangent.clone().applyAxisAngle(normalizedAxis, angle).multiplyScalar(radius);
points.push(point);
}
const geometry = new THREE.BufferGeometry().setFromPoints(points);
const material = new THREE.LineBasicMaterial({ color: 0xffff00 });
return new THREE.Line(geometry, material);
}
function createRotationSector(axis, lower, upper, radius = 0.1, segments = 64) {
const motorMargin = 0.4; // hardcoded extra range beyond joint limits
const motorLower = lower - motorMargin;
const motorUpper = upper + motorMargin;
const redMaterial = new THREE.MeshBasicMaterial({
color: 0xff0000,
transparent: true,
opacity: 0.2,
side: THREE.DoubleSide,
depthTest: false,
depthWrite: false
});
const whiteMaterial = new THREE.MeshBasicMaterial({
color: 0xffffff,
transparent: true,
opacity: 0.6,
side: THREE.DoubleSide,
depthTest: false,
depthWrite: false
});
function createArc(start, end, material) {
const shape = new THREE.Shape();
shape.moveTo(0, 0);
for (let i = 0; i <= segments; i++) {
const angle = start + (end - start) * (i / segments);
shape.lineTo(Math.cos(angle) * radius, Math.sin(angle) * radius);
}
shape.lineTo(0, 0);
const geometry = new THREE.ShapeGeometry(shape);
return new THREE.Mesh(geometry, material);
}
const redLeft = createArc(motorLower, lower, redMaterial);
const whiteArc = createArc(lower, upper, whiteMaterial);
const redRight = createArc(upper, motorUpper, redMaterial);
// Orient all arcs to match the axis
const basis = new THREE.Matrix4();
const up = new THREE.Vector3(0, 0, 1);
const quaternion = new THREE.Quaternion().setFromUnitVectors(up, axis.clone().normalize());
basis.makeRotationFromQuaternion(quaternion);
redLeft.applyMatrix4(basis);
whiteArc.applyMatrix4(basis);
redRight.applyMatrix4(basis);
const group = new THREE.Group();
group.add(redLeft);
group.add(whiteArc);
group.add(redRight);
return group;
}
function createAngleIndicator(axis, angle, radius = 0.1) {
const dir = new THREE.Vector3(Math.cos(angle), Math.sin(angle), 0).multiplyScalar(radius);
const geometry = new THREE.BufferGeometry().setFromPoints([
new THREE.Vector3(0, 0, 0),
dir,
]);
const material = new THREE.LineBasicMaterial({
color: 0xffffff, // white
linewidth: 2, // note: linewidth only works in some renderers
depthTest: false, // ✅ always on top
depthWrite: false
});
const line = new THREE.Line(geometry, material);
// Rotate into axis plane
const up = new THREE.Vector3(0, 0, 1);
const quaternion = new THREE.Quaternion().setFromUnitVectors(up, axis.clone().normalize());
line.applyQuaternion(quaternion);
return line;
}
// Load URDF
const loader = new URDFLoader();
loader.packages = { '': './urdf/' };
function findObjectByName(root, name) {
let result = null;
root.traverse(child => {
if (child.name === name) result = child;
});
return result;
}
loader.load('./urdf/sample.urdf', robot => {
//scene.rotation.x = -Math.PI / 2;
robot.rotation.x = -Math.PI / 2;
scene.add(robot);
document.getElementById('status').textContent = 'URDF Loaded';
loader.parseVisual = true;
loader.parseCollision = false;
// Add AxesHelpers to all meshes
robot.traverse(obj => {
if (obj.isMesh) obj.add(new THREE.AxesHelper(0.05));
});
// Setup pointer events
canvas.addEventListener('pointermove', event => {
mouse.x = (event.clientX / canvas.clientWidth) * 2 - 1;
mouse.y = -(event.clientY / canvas.clientHeight) * 2 + 1;
raycaster.setFromCamera(mouse, camera);
const intersects = raycaster.intersectObjects(robot.children, true);
if (isDragging && draggedJoint && worldAxis) {
const deltaX = event.clientX - lastX;
lastX = event.clientX;
const angleDelta = deltaX * 0.005;
const jointName = draggedJoint.name;
const limits = robot.joints[jointName]?.limit;
const lower = limits?.lower ?? -Math.PI;
const upper = limits?.upper ?? Math.PI;
const currentAngle = jointAngles[jointName] ?? 0;
const proposedAngle = currentAngle + angleDelta;
// ✅ Clamp to limits
const clampedAngle = Math.max(lower, Math.min(upper, proposedAngle));
const actualDelta = clampedAngle - currentAngle;
// ✅ Apply rotation
draggedJoint.rotateOnAxis(worldAxis, actualDelta);
jointAngles[jointName] = clampedAngle;
// Remove old indicator
if (draggedJoint.userData.gizmo?.indicator) {
draggedJoint.parent.remove(draggedJoint.userData.gizmo.indicator);
}
// Add updated indicator
const newIndicator = createAngleIndicator(worldAxis, jointAngles[jointName]);
newIndicator.position.copy(draggedJoint.position);
draggedJoint.parent.add(newIndicator);
draggedJoint.userData.gizmo.indicator = newIndicator;
}
if (intersects.length > 0) {
const target = intersects[0].object;
// Reset previous highlight
if (
hoveredJoint &&
hoveredJoint.material &&
'emissive' in hoveredJoint.material &&
typeof hoveredJoint.material.emissive.setHex === 'function'
) {
hoveredJoint.material.emissive.setHex(0x000000);
}
hoveredJoint = target;
// Highlight new joint
if (
hoveredJoint.material &&
'emissive' in hoveredJoint.material &&
typeof hoveredJoint.material.emissive.setHex === 'function'
) {
hoveredJoint.material.emissive.setHex(0x333333);
}
} else {
if (
hoveredJoint &&
hoveredJoint.material &&
'emissive' in hoveredJoint.material &&
typeof hoveredJoint.material.emissive.setHex === 'function'
) {
hoveredJoint.material.emissive.setHex(0x000000);
}
hoveredJoint = null;
}
});
canvas.addEventListener('pointerdown', event => {
if (!hoveredJoint) return;
isDragging = true;
lastX = event.clientX;
controls.enabled = false;
draggedJoint = findJointAncestor(hoveredJoint);
if (!draggedJoint) return;
const jointName = draggedJoint.name;
const jointData = robot.joints?.[jointName];
// ✅ Check if axis is a valid THREE.Vector3
if (!(jointData?.axis instanceof THREE.Vector3)) {
console.warn(`Invalid axis for joint "${jointName}":`, jointData?.axis);
return;
}
const urdfAxis = jointData.axis.clone();
if (urdfAxis.lengthSq() === 0) {
console.warn(`Zero-length axis for joint "${jointName}"`);
return;
}
worldAxis = urdfAxis.normalize();
const limits = robot.joints[jointName]?.limit;
const lower = limits?.lower ?? -Math.PI;
const upper = limits?.upper ?? Math.PI;
const sector = createRotationSector(worldAxis, lower, upper);
const indicator = createAngleIndicator(worldAxis, jointAngles[jointName] ?? 0);
sector.position.copy(draggedJoint.position);
indicator.position.copy(draggedJoint.position);
draggedJoint.parent.add(sector);
draggedJoint.parent.add(indicator);
// Store for cleanup
draggedJoint.userData.gizmo = { sector, indicator };
console.log(`Dragging joint "${jointName}" on axis`, worldAxis.toArray());
});
canvas.addEventListener('pointerup', () => {
isDragging = false;
controls.enabled = true;
const gizmo = draggedJoint?.userData.gizmo;
if (gizmo) {
draggedJoint.parent.remove(gizmo.sector);
draggedJoint.parent.remove(gizmo.indicator);
}
draggedJoint = null;
worldAxis = null;
});
animate();
});
function animate() {
requestAnimationFrame(animate);
renderer.render(scene, camera);
}

View File

@ -1,469 +1,469 @@
import { Euler, Object3D, Vector3, Quaternion, Matrix4 } from 'three';
const _tempAxis = new Vector3();
const _tempEuler = new Euler();
const _tempTransform = new Matrix4();
const _tempOrigTransform = new Matrix4();
const _tempQuat = new Quaternion();
const _tempScale = new Vector3(1.0, 1.0, 1.0);
const _tempPosition = new Vector3();
class URDFBase extends Object3D {
constructor(...args) {
super(...args);
this.urdfNode = null;
this.urdfName = '';
}
copy(source, recursive) {
super.copy(source, recursive);
this.urdfNode = source.urdfNode;
this.urdfName = source.urdfName;
return this;
}
}
class URDFCollider extends URDFBase {
constructor(...args) {
super(...args);
this.isURDFCollider = true;
this.type = 'URDFCollider';
}
}
class URDFVisual extends URDFBase {
constructor(...args) {
super(...args);
this.isURDFVisual = true;
this.type = 'URDFVisual';
}
}
class URDFLink extends URDFBase {
constructor(...args) {
super(...args);
this.isURDFLink = true;
this.type = 'URDFLink';
}
}
class URDFJoint extends URDFBase {
get jointType() {
return this._jointType;
}
set jointType(v) {
if (this.jointType === v) return;
this._jointType = v;
this.matrixWorldNeedsUpdate = true;
switch (v) {
case 'fixed':
this.jointValue = [];
break;
case 'continuous':
case 'revolute':
case 'prismatic':
this.jointValue = new Array(1).fill(0);
break;
case 'planar':
// Planar joints are, 3dof: position XY and rotation Z.
this.jointValue = new Array(3).fill(0);
this.axis = new Vector3(0, 0, 1);
break;
case 'floating':
this.jointValue = new Array(6).fill(0);
break;
}
}
get angle() {
return this.jointValue[0];
}
constructor(...args) {
super(...args);
this.isURDFJoint = true;
this.type = 'URDFJoint';
this.jointValue = null;
this.jointType = 'fixed';
this.axis = new Vector3(1, 0, 0);
this.limit = { lower: 0, upper: 0 };
this.ignoreLimits = false;
this.origPosition = null;
this.origQuaternion = null;
this.mimicJoints = [];
}
/* Overrides */
copy(source, recursive) {
super.copy(source, recursive);
this.jointType = source.jointType;
this.axis = source.axis.clone();
this.limit.lower = source.limit.lower;
this.limit.upper = source.limit.upper;
this.ignoreLimits = false;
this.jointValue = [...source.jointValue];
this.origPosition = source.origPosition ? source.origPosition.clone() : null;
this.origQuaternion = source.origQuaternion ? source.origQuaternion.clone() : null;
this.mimicJoints = [...source.mimicJoints];
return this;
}
/* Public Functions */
/**
* @param {...number|null} values The joint value components to set, optionally null for no-op
* @returns {boolean} Whether the invocation of this function resulted in an actual change to the joint value
*/
setJointValue(...values) {
// Parse all incoming values into numbers except null, which we treat as a no-op for that value component.
values = values.map(v => v === null ? null : parseFloat(v));
if (!this.origPosition || !this.origQuaternion) {
this.origPosition = this.position.clone();
this.origQuaternion = this.quaternion.clone();
}
let didUpdate = false;
this.mimicJoints.forEach(joint => {
didUpdate = joint.updateFromMimickedJoint(...values) || didUpdate;
});
switch (this.jointType) {
case 'fixed': {
return didUpdate;
}
case 'continuous':
case 'revolute': {
let angle = values[0];
if (angle == null) return didUpdate;
if (angle === this.jointValue[0]) return didUpdate;
if (!this.ignoreLimits && this.jointType === 'revolute') {
angle = Math.min(this.limit.upper, angle);
angle = Math.max(this.limit.lower, angle);
}
this.quaternion
.setFromAxisAngle(this.axis, angle)
.premultiply(this.origQuaternion);
if (this.jointValue[0] !== angle) {
this.jointValue[0] = angle;
this.matrixWorldNeedsUpdate = true;
return true;
} else {
return didUpdate;
}
}
case 'prismatic': {
let pos = values[0];
if (pos == null) return didUpdate;
if (pos === this.jointValue[0]) return didUpdate;
if (!this.ignoreLimits) {
pos = Math.min(this.limit.upper, pos);
pos = Math.max(this.limit.lower, pos);
}
this.position.copy(this.origPosition);
_tempAxis.copy(this.axis).applyEuler(this.rotation);
this.position.addScaledVector(_tempAxis, pos);
if (this.jointValue[0] !== pos) {
this.jointValue[0] = pos;
this.matrixWorldNeedsUpdate = true;
return true;
} else {
return didUpdate;
}
}
case 'floating': {
// no-op if all values are identical to existing value or are null
if (this.jointValue.every((value, index) => values[index] === value || values[index] === null)) return didUpdate;
// Floating joints have six degrees of freedom: X, Y, Z, R, P, Y.
this.jointValue[0] = values[0] !== null ? values[0] : this.jointValue[0];
this.jointValue[1] = values[1] !== null ? values[1] : this.jointValue[1];
this.jointValue[2] = values[2] !== null ? values[2] : this.jointValue[2];
this.jointValue[3] = values[3] !== null ? values[3] : this.jointValue[3];
this.jointValue[4] = values[4] !== null ? values[4] : this.jointValue[4];
this.jointValue[5] = values[5] !== null ? values[5] : this.jointValue[5];
// Compose transform of joint origin and transform due to joint values
_tempOrigTransform.compose(this.origPosition, this.origQuaternion, _tempScale);
_tempQuat.setFromEuler(
_tempEuler.set(
this.jointValue[3],
this.jointValue[4],
this.jointValue[5],
'XYZ',
),
);
_tempPosition.set(this.jointValue[0], this.jointValue[1], this.jointValue[2]);
_tempTransform.compose(_tempPosition, _tempQuat, _tempScale);
// Calcualte new transform
_tempOrigTransform.premultiply(_tempTransform);
this.position.setFromMatrixPosition(_tempOrigTransform);
this.rotation.setFromRotationMatrix(_tempOrigTransform);
this.matrixWorldNeedsUpdate = true;
return true;
}
case 'planar': {
// no-op if all values are identical to existing value or are null
if (this.jointValue.every((value, index) => values[index] === value || values[index] === null)) return didUpdate;
this.jointValue[0] = values[0] !== null ? values[0] : this.jointValue[0];
this.jointValue[1] = values[1] !== null ? values[1] : this.jointValue[1];
this.jointValue[2] = values[2] !== null ? values[2] : this.jointValue[2];
// Compose transform of joint origin and transform due to joint values
_tempOrigTransform.compose(this.origPosition, this.origQuaternion, _tempScale);
_tempQuat.setFromAxisAngle(this.axis, this.jointValue[2]);
_tempPosition.set(this.jointValue[0], this.jointValue[1], 0.0);
_tempTransform.compose(_tempPosition, _tempQuat, _tempScale);
// Calculate new transform
_tempOrigTransform.premultiply(_tempTransform);
this.position.setFromMatrixPosition(_tempOrigTransform);
this.rotation.setFromRotationMatrix(_tempOrigTransform);
this.matrixWorldNeedsUpdate = true;
return true;
}
}
return didUpdate;
}
}
class URDFMimicJoint extends URDFJoint {
constructor(...args) {
super(...args);
this.type = 'URDFMimicJoint';
this.mimicJoint = null;
this.offset = 0;
this.multiplier = 1;
}
updateFromMimickedJoint(...values) {
const modifiedValues = values.map(x => x * this.multiplier + this.offset);
return super.setJointValue(...modifiedValues);
}
/* Overrides */
copy(source, recursive) {
super.copy(source, recursive);
this.mimicJoint = source.mimicJoint;
this.offset = source.offset;
this.multiplier = source.multiplier;
return this;
}
}
class URDFRobot extends URDFLink {
constructor(...args) {
super(...args);
this.isURDFRobot = true;
this.urdfNode = null;
this.urdfRobotNode = null;
this.robotName = null;
this.links = null;
this.joints = null;
this.colliders = null;
this.visual = null;
this.frames = null;
}
copy(source, recursive) {
super.copy(source, recursive);
this.urdfRobotNode = source.urdfRobotNode;
this.robotName = source.robotName;
this.links = {};
this.joints = {};
this.colliders = {};
this.visual = {};
this.traverse(c => {
if (c.isURDFJoint && c.urdfName in source.joints) {
this.joints[c.urdfName] = c;
}
if (c.isURDFLink && c.urdfName in source.links) {
this.links[c.urdfName] = c;
}
if (c.isURDFCollider && c.urdfName in source.colliders) {
this.colliders[c.urdfName] = c;
}
if (c.isURDFVisual && c.urdfName in source.visual) {
this.visual[c.urdfName] = c;
}
});
// Repair mimic joint references once we've re-accumulated all our joint data
for (const joint in this.joints) {
this.joints[joint].mimicJoints = this.joints[joint].mimicJoints.map((mimicJoint) => this.joints[mimicJoint.name]);
}
this.frames = {
...this.colliders,
...this.visual,
...this.links,
...this.joints,
};
return this;
}
getFrame(name) {
return this.frames[name];
}
setJointValue(jointName, ...angle) {
const joint = this.joints[jointName];
if (joint) {
return joint.setJointValue(...angle);
}
return false;
}
setJointValues(values) {
let didChange = false;
for (const name in values) {
const value = values[name];
if (Array.isArray(value)) {
didChange = this.setJointValue(name, ...value) || didChange;
} else {
didChange = this.setJointValue(name, value) || didChange;
}
}
return didChange;
}
}
import { Euler, Object3D, Vector3, Quaternion, Matrix4 } from 'three';
const _tempAxis = new Vector3();
const _tempEuler = new Euler();
const _tempTransform = new Matrix4();
const _tempOrigTransform = new Matrix4();
const _tempQuat = new Quaternion();
const _tempScale = new Vector3(1.0, 1.0, 1.0);
const _tempPosition = new Vector3();
class URDFBase extends Object3D {
constructor(...args) {
super(...args);
this.urdfNode = null;
this.urdfName = '';
}
copy(source, recursive) {
super.copy(source, recursive);
this.urdfNode = source.urdfNode;
this.urdfName = source.urdfName;
return this;
}
}
class URDFCollider extends URDFBase {
constructor(...args) {
super(...args);
this.isURDFCollider = true;
this.type = 'URDFCollider';
}
}
class URDFVisual extends URDFBase {
constructor(...args) {
super(...args);
this.isURDFVisual = true;
this.type = 'URDFVisual';
}
}
class URDFLink extends URDFBase {
constructor(...args) {
super(...args);
this.isURDFLink = true;
this.type = 'URDFLink';
}
}
class URDFJoint extends URDFBase {
get jointType() {
return this._jointType;
}
set jointType(v) {
if (this.jointType === v) return;
this._jointType = v;
this.matrixWorldNeedsUpdate = true;
switch (v) {
case 'fixed':
this.jointValue = [];
break;
case 'continuous':
case 'revolute':
case 'prismatic':
this.jointValue = new Array(1).fill(0);
break;
case 'planar':
// Planar joints are, 3dof: position XY and rotation Z.
this.jointValue = new Array(3).fill(0);
this.axis = new Vector3(0, 0, 1);
break;
case 'floating':
this.jointValue = new Array(6).fill(0);
break;
}
}
get angle() {
return this.jointValue[0];
}
constructor(...args) {
super(...args);
this.isURDFJoint = true;
this.type = 'URDFJoint';
this.jointValue = null;
this.jointType = 'fixed';
this.axis = new Vector3(1, 0, 0);
this.limit = { lower: 0, upper: 0 };
this.ignoreLimits = false;
this.origPosition = null;
this.origQuaternion = null;
this.mimicJoints = [];
}
/* Overrides */
copy(source, recursive) {
super.copy(source, recursive);
this.jointType = source.jointType;
this.axis = source.axis.clone();
this.limit.lower = source.limit.lower;
this.limit.upper = source.limit.upper;
this.ignoreLimits = false;
this.jointValue = [...source.jointValue];
this.origPosition = source.origPosition ? source.origPosition.clone() : null;
this.origQuaternion = source.origQuaternion ? source.origQuaternion.clone() : null;
this.mimicJoints = [...source.mimicJoints];
return this;
}
/* Public Functions */
/**
* @param {...number|null} values The joint value components to set, optionally null for no-op
* @returns {boolean} Whether the invocation of this function resulted in an actual change to the joint value
*/
setJointValue(...values) {
// Parse all incoming values into numbers except null, which we treat as a no-op for that value component.
values = values.map(v => v === null ? null : parseFloat(v));
if (!this.origPosition || !this.origQuaternion) {
this.origPosition = this.position.clone();
this.origQuaternion = this.quaternion.clone();
}
let didUpdate = false;
this.mimicJoints.forEach(joint => {
didUpdate = joint.updateFromMimickedJoint(...values) || didUpdate;
});
switch (this.jointType) {
case 'fixed': {
return didUpdate;
}
case 'continuous':
case 'revolute': {
let angle = values[0];
if (angle == null) return didUpdate;
if (angle === this.jointValue[0]) return didUpdate;
if (!this.ignoreLimits && this.jointType === 'revolute') {
angle = Math.min(this.limit.upper, angle);
angle = Math.max(this.limit.lower, angle);
}
this.quaternion
.setFromAxisAngle(this.axis, angle)
.premultiply(this.origQuaternion);
if (this.jointValue[0] !== angle) {
this.jointValue[0] = angle;
this.matrixWorldNeedsUpdate = true;
return true;
} else {
return didUpdate;
}
}
case 'prismatic': {
let pos = values[0];
if (pos == null) return didUpdate;
if (pos === this.jointValue[0]) return didUpdate;
if (!this.ignoreLimits) {
pos = Math.min(this.limit.upper, pos);
pos = Math.max(this.limit.lower, pos);
}
this.position.copy(this.origPosition);
_tempAxis.copy(this.axis).applyEuler(this.rotation);
this.position.addScaledVector(_tempAxis, pos);
if (this.jointValue[0] !== pos) {
this.jointValue[0] = pos;
this.matrixWorldNeedsUpdate = true;
return true;
} else {
return didUpdate;
}
}
case 'floating': {
// no-op if all values are identical to existing value or are null
if (this.jointValue.every((value, index) => values[index] === value || values[index] === null)) return didUpdate;
// Floating joints have six degrees of freedom: X, Y, Z, R, P, Y.
this.jointValue[0] = values[0] !== null ? values[0] : this.jointValue[0];
this.jointValue[1] = values[1] !== null ? values[1] : this.jointValue[1];
this.jointValue[2] = values[2] !== null ? values[2] : this.jointValue[2];
this.jointValue[3] = values[3] !== null ? values[3] : this.jointValue[3];
this.jointValue[4] = values[4] !== null ? values[4] : this.jointValue[4];
this.jointValue[5] = values[5] !== null ? values[5] : this.jointValue[5];
// Compose transform of joint origin and transform due to joint values
_tempOrigTransform.compose(this.origPosition, this.origQuaternion, _tempScale);
_tempQuat.setFromEuler(
_tempEuler.set(
this.jointValue[3],
this.jointValue[4],
this.jointValue[5],
'XYZ',
),
);
_tempPosition.set(this.jointValue[0], this.jointValue[1], this.jointValue[2]);
_tempTransform.compose(_tempPosition, _tempQuat, _tempScale);
// Calcualte new transform
_tempOrigTransform.premultiply(_tempTransform);
this.position.setFromMatrixPosition(_tempOrigTransform);
this.rotation.setFromRotationMatrix(_tempOrigTransform);
this.matrixWorldNeedsUpdate = true;
return true;
}
case 'planar': {
// no-op if all values are identical to existing value or are null
if (this.jointValue.every((value, index) => values[index] === value || values[index] === null)) return didUpdate;
this.jointValue[0] = values[0] !== null ? values[0] : this.jointValue[0];
this.jointValue[1] = values[1] !== null ? values[1] : this.jointValue[1];
this.jointValue[2] = values[2] !== null ? values[2] : this.jointValue[2];
// Compose transform of joint origin and transform due to joint values
_tempOrigTransform.compose(this.origPosition, this.origQuaternion, _tempScale);
_tempQuat.setFromAxisAngle(this.axis, this.jointValue[2]);
_tempPosition.set(this.jointValue[0], this.jointValue[1], 0.0);
_tempTransform.compose(_tempPosition, _tempQuat, _tempScale);
// Calculate new transform
_tempOrigTransform.premultiply(_tempTransform);
this.position.setFromMatrixPosition(_tempOrigTransform);
this.rotation.setFromRotationMatrix(_tempOrigTransform);
this.matrixWorldNeedsUpdate = true;
return true;
}
}
return didUpdate;
}
}
class URDFMimicJoint extends URDFJoint {
constructor(...args) {
super(...args);
this.type = 'URDFMimicJoint';
this.mimicJoint = null;
this.offset = 0;
this.multiplier = 1;
}
updateFromMimickedJoint(...values) {
const modifiedValues = values.map(x => x * this.multiplier + this.offset);
return super.setJointValue(...modifiedValues);
}
/* Overrides */
copy(source, recursive) {
super.copy(source, recursive);
this.mimicJoint = source.mimicJoint;
this.offset = source.offset;
this.multiplier = source.multiplier;
return this;
}
}
class URDFRobot extends URDFLink {
constructor(...args) {
super(...args);
this.isURDFRobot = true;
this.urdfNode = null;
this.urdfRobotNode = null;
this.robotName = null;
this.links = null;
this.joints = null;
this.colliders = null;
this.visual = null;
this.frames = null;
}
copy(source, recursive) {
super.copy(source, recursive);
this.urdfRobotNode = source.urdfRobotNode;
this.robotName = source.robotName;
this.links = {};
this.joints = {};
this.colliders = {};
this.visual = {};
this.traverse(c => {
if (c.isURDFJoint && c.urdfName in source.joints) {
this.joints[c.urdfName] = c;
}
if (c.isURDFLink && c.urdfName in source.links) {
this.links[c.urdfName] = c;
}
if (c.isURDFCollider && c.urdfName in source.colliders) {
this.colliders[c.urdfName] = c;
}
if (c.isURDFVisual && c.urdfName in source.visual) {
this.visual[c.urdfName] = c;
}
});
// Repair mimic joint references once we've re-accumulated all our joint data
for (const joint in this.joints) {
this.joints[joint].mimicJoints = this.joints[joint].mimicJoints.map((mimicJoint) => this.joints[mimicJoint.name]);
}
this.frames = {
...this.colliders,
...this.visual,
...this.links,
...this.joints,
};
return this;
}
getFrame(name) {
return this.frames[name];
}
setJointValue(jointName, ...angle) {
const joint = this.joints[jointName];
if (joint) {
return joint.setJointValue(...angle);
}
return false;
}
setJointValues(values) {
let didChange = false;
for (const name in values) {
const value = values[name];
if (Array.isArray(value)) {
didChange = this.setJointValue(name, ...value) || didChange;
} else {
didChange = this.setJointValue(name, value) || didChange;
}
}
return didChange;
}
}
export { URDFRobot, URDFLink, URDFJoint, URDFMimicJoint, URDFVisual, URDFCollider };

View File

@ -1,330 +1,330 @@
import { Raycaster, Vector3, Plane, Vector2 } from 'three';
// Find the nearest parent that is a joint
function isJoint(j) {
return j.isURDFJoint && j.jointType !== 'fixed';
};
function findNearestJoint(child) {
let curr = child;
while (curr) {
if (isJoint(curr)) {
return curr;
}
curr = curr.parent;
}
return curr;
};
const prevHitPoint = new Vector3();
const newHitPoint = new Vector3();
const pivotPoint = new Vector3();
const tempVector = new Vector3();
const tempVector2 = new Vector3();
const projectedStartPoint = new Vector3();
const projectedEndPoint = new Vector3();
const plane = new Plane();
export class URDFDragControls {
constructor(scene) {
this.enabled = true;
this.scene = scene;
this.raycaster = new Raycaster();
this.initialGrabPoint = new Vector3();
this.hitDistance = -1;
this.hovered = null;
this.manipulating = null;
}
update() {
const {
raycaster,
hovered,
manipulating,
scene,
} = this;
if (manipulating) {
return;
}
let hoveredJoint = null;
const intersections = raycaster.intersectObject(scene, true);
if (intersections.length !== 0) {
const hit = intersections[0];
this.hitDistance = hit.distance;
hoveredJoint = findNearestJoint(hit.object);
this.initialGrabPoint.copy(hit.point);
}
if (hoveredJoint !== hovered) {
if (hovered) {
this.onUnhover(hovered);
}
this.hovered = hoveredJoint;
if (hoveredJoint) {
this.onHover(hoveredJoint);
}
}
}
updateJoint(joint, angle) {
joint.setJointValue(angle);
}
onDragStart(joint) {
}
onDragEnd(joint) {
}
onHover(joint) {
}
onUnhover(joint) {
}
getRevoluteDelta(joint, startPoint, endPoint) {
// set up the plane
tempVector
.copy(joint.axis)
.transformDirection(joint.matrixWorld)
.normalize();
pivotPoint
.set(0, 0, 0)
.applyMatrix4(joint.matrixWorld);
plane
.setFromNormalAndCoplanarPoint(tempVector, pivotPoint);
// project the drag points onto the plane
plane.projectPoint(startPoint, projectedStartPoint);
plane.projectPoint(endPoint, projectedEndPoint);
// get the directions relative to the pivot
projectedStartPoint.sub(pivotPoint);
projectedEndPoint.sub(pivotPoint);
tempVector.crossVectors(projectedStartPoint, projectedEndPoint);
const direction = Math.sign(tempVector.dot(plane.normal));
return direction * projectedEndPoint.angleTo(projectedStartPoint);
}
getPrismaticDelta(joint, startPoint, endPoint) {
tempVector.subVectors(endPoint, startPoint);
plane
.normal
.copy(joint.axis)
.transformDirection(joint.parent.matrixWorld)
.normalize();
return tempVector.dot(plane.normal);
}
moveRay(toRay) {
const { raycaster, hitDistance, manipulating } = this;
const { ray } = raycaster;
if (manipulating) {
ray.at(hitDistance, prevHitPoint);
toRay.at(hitDistance, newHitPoint);
let delta = 0;
if (manipulating.jointType === 'revolute' || manipulating.jointType === 'continuous') {
delta = this.getRevoluteDelta(manipulating, prevHitPoint, newHitPoint);
} else if (manipulating.jointType === 'prismatic') {
delta = this.getPrismaticDelta(manipulating, prevHitPoint, newHitPoint);
}
if (delta) {
this.updateJoint(manipulating, manipulating.angle + delta);
}
}
this.raycaster.ray.copy(toRay);
this.update();
}
setGrabbed(grabbed) {
const { hovered, manipulating } = this;
if (grabbed) {
if (manipulating !== null || hovered === null) {
return;
}
this.manipulating = hovered;
this.onDragStart(hovered);
} else {
if (this.manipulating === null) {
return;
}
this.onDragEnd(this.manipulating);
this.manipulating = null;
this.update();
}
}
}
export class PointerURDFDragControls extends URDFDragControls {
constructor(scene, camera, domElement) {
super(scene);
this.camera = camera;
this.domElement = domElement;
const raycaster = new Raycaster();
const mouse = new Vector2();
function updateMouse(e) {
const rect = domElement.getBoundingClientRect();
mouse.x = ((e.clientX - rect.left) / rect.width) * 2 - 1;
mouse.y = -((e.clientY - rect.top) / rect.height) * 2 + 1;
}
this._mouseDown = e => {
updateMouse(e);
raycaster.setFromCamera(mouse, this.camera);
this.moveRay(raycaster.ray);
this.setGrabbed(true);
};
this._mouseMove = e => {
updateMouse(e);
raycaster.setFromCamera(mouse, this.camera);
this.moveRay(raycaster.ray);
};
this._mouseUp = e => {
updateMouse(e);
raycaster.setFromCamera(mouse, this.camera);
this.moveRay(raycaster.ray);
this.setGrabbed(false);
};
domElement.addEventListener('mousedown', this._mouseDown);
domElement.addEventListener('mousemove', this._mouseMove);
domElement.addEventListener('mouseup', this._mouseUp);
}
getRevoluteDelta(joint, startPoint, endPoint) {
const { camera, initialGrabPoint } = this;
// set up the plane
tempVector
.copy(joint.axis)
.transformDirection(joint.matrixWorld)
.normalize();
pivotPoint
.set(0, 0, 0)
.applyMatrix4(joint.matrixWorld);
plane
.setFromNormalAndCoplanarPoint(tempVector, pivotPoint);
tempVector
.copy(camera.position)
.sub(initialGrabPoint)
.normalize();
// if looking into the plane of rotation
if (Math.abs(tempVector.dot(plane.normal)) > 0.3) {
return super.getRevoluteDelta(joint, startPoint, endPoint);
} else {
// get the up direction
tempVector.set(0, 1, 0).transformDirection(camera.matrixWorld);
// get points projected onto the plane of rotation
plane.projectPoint(startPoint, projectedStartPoint);
plane.projectPoint(endPoint, projectedEndPoint);
tempVector.set(0, 0, -1).transformDirection(camera.matrixWorld);
tempVector.cross(plane.normal);
tempVector2.subVectors(endPoint, startPoint);
return tempVector.dot(tempVector2);
}
}
dispose() {
const { domElement } = this;
domElement.removeEventListener('mousedown', this._mouseDown);
domElement.removeEventListener('mousemove', this._mouseMove);
domElement.removeEventListener('mouseup', this._mouseUp);
}
import { Raycaster, Vector3, Plane, Vector2 } from 'three';
// Find the nearest parent that is a joint
function isJoint(j) {
return j.isURDFJoint && j.jointType !== 'fixed';
};
function findNearestJoint(child) {
let curr = child;
while (curr) {
if (isJoint(curr)) {
return curr;
}
curr = curr.parent;
}
return curr;
};
const prevHitPoint = new Vector3();
const newHitPoint = new Vector3();
const pivotPoint = new Vector3();
const tempVector = new Vector3();
const tempVector2 = new Vector3();
const projectedStartPoint = new Vector3();
const projectedEndPoint = new Vector3();
const plane = new Plane();
export class URDFDragControls {
constructor(scene) {
this.enabled = true;
this.scene = scene;
this.raycaster = new Raycaster();
this.initialGrabPoint = new Vector3();
this.hitDistance = -1;
this.hovered = null;
this.manipulating = null;
}
update() {
const {
raycaster,
hovered,
manipulating,
scene,
} = this;
if (manipulating) {
return;
}
let hoveredJoint = null;
const intersections = raycaster.intersectObject(scene, true);
if (intersections.length !== 0) {
const hit = intersections[0];
this.hitDistance = hit.distance;
hoveredJoint = findNearestJoint(hit.object);
this.initialGrabPoint.copy(hit.point);
}
if (hoveredJoint !== hovered) {
if (hovered) {
this.onUnhover(hovered);
}
this.hovered = hoveredJoint;
if (hoveredJoint) {
this.onHover(hoveredJoint);
}
}
}
updateJoint(joint, angle) {
joint.setJointValue(angle);
}
onDragStart(joint) {
}
onDragEnd(joint) {
}
onHover(joint) {
}
onUnhover(joint) {
}
getRevoluteDelta(joint, startPoint, endPoint) {
// set up the plane
tempVector
.copy(joint.axis)
.transformDirection(joint.matrixWorld)
.normalize();
pivotPoint
.set(0, 0, 0)
.applyMatrix4(joint.matrixWorld);
plane
.setFromNormalAndCoplanarPoint(tempVector, pivotPoint);
// project the drag points onto the plane
plane.projectPoint(startPoint, projectedStartPoint);
plane.projectPoint(endPoint, projectedEndPoint);
// get the directions relative to the pivot
projectedStartPoint.sub(pivotPoint);
projectedEndPoint.sub(pivotPoint);
tempVector.crossVectors(projectedStartPoint, projectedEndPoint);
const direction = Math.sign(tempVector.dot(plane.normal));
return direction * projectedEndPoint.angleTo(projectedStartPoint);
}
getPrismaticDelta(joint, startPoint, endPoint) {
tempVector.subVectors(endPoint, startPoint);
plane
.normal
.copy(joint.axis)
.transformDirection(joint.parent.matrixWorld)
.normalize();
return tempVector.dot(plane.normal);
}
moveRay(toRay) {
const { raycaster, hitDistance, manipulating } = this;
const { ray } = raycaster;
if (manipulating) {
ray.at(hitDistance, prevHitPoint);
toRay.at(hitDistance, newHitPoint);
let delta = 0;
if (manipulating.jointType === 'revolute' || manipulating.jointType === 'continuous') {
delta = this.getRevoluteDelta(manipulating, prevHitPoint, newHitPoint);
} else if (manipulating.jointType === 'prismatic') {
delta = this.getPrismaticDelta(manipulating, prevHitPoint, newHitPoint);
}
if (delta) {
this.updateJoint(manipulating, manipulating.angle + delta);
}
}
this.raycaster.ray.copy(toRay);
this.update();
}
setGrabbed(grabbed) {
const { hovered, manipulating } = this;
if (grabbed) {
if (manipulating !== null || hovered === null) {
return;
}
this.manipulating = hovered;
this.onDragStart(hovered);
} else {
if (this.manipulating === null) {
return;
}
this.onDragEnd(this.manipulating);
this.manipulating = null;
this.update();
}
}
}
export class PointerURDFDragControls extends URDFDragControls {
constructor(scene, camera, domElement) {
super(scene);
this.camera = camera;
this.domElement = domElement;
const raycaster = new Raycaster();
const mouse = new Vector2();
function updateMouse(e) {
const rect = domElement.getBoundingClientRect();
mouse.x = ((e.clientX - rect.left) / rect.width) * 2 - 1;
mouse.y = -((e.clientY - rect.top) / rect.height) * 2 + 1;
}
this._mouseDown = e => {
updateMouse(e);
raycaster.setFromCamera(mouse, this.camera);
this.moveRay(raycaster.ray);
this.setGrabbed(true);
};
this._mouseMove = e => {
updateMouse(e);
raycaster.setFromCamera(mouse, this.camera);
this.moveRay(raycaster.ray);
};
this._mouseUp = e => {
updateMouse(e);
raycaster.setFromCamera(mouse, this.camera);
this.moveRay(raycaster.ray);
this.setGrabbed(false);
};
domElement.addEventListener('mousedown', this._mouseDown);
domElement.addEventListener('mousemove', this._mouseMove);
domElement.addEventListener('mouseup', this._mouseUp);
}
getRevoluteDelta(joint, startPoint, endPoint) {
const { camera, initialGrabPoint } = this;
// set up the plane
tempVector
.copy(joint.axis)
.transformDirection(joint.matrixWorld)
.normalize();
pivotPoint
.set(0, 0, 0)
.applyMatrix4(joint.matrixWorld);
plane
.setFromNormalAndCoplanarPoint(tempVector, pivotPoint);
tempVector
.copy(camera.position)
.sub(initialGrabPoint)
.normalize();
// if looking into the plane of rotation
if (Math.abs(tempVector.dot(plane.normal)) > 0.3) {
return super.getRevoluteDelta(joint, startPoint, endPoint);
} else {
// get the up direction
tempVector.set(0, 1, 0).transformDirection(camera.matrixWorld);
// get points projected onto the plane of rotation
plane.projectPoint(startPoint, projectedStartPoint);
plane.projectPoint(endPoint, projectedEndPoint);
tempVector.set(0, 0, -1).transformDirection(camera.matrixWorld);
tempVector.cross(plane.normal);
tempVector2.subVectors(endPoint, startPoint);
return tempVector.dot(tempVector2);
}
}
dispose() {
const { domElement } = this;
domElement.removeEventListener('mousedown', this._mouseDown);
domElement.removeEventListener('mousemove', this._mouseMove);
domElement.removeEventListener('mouseup', this._mouseUp);
}
}

File diff suppressed because it is too large Load Diff

View File

@ -1,446 +1,446 @@
<robot name="robot">
<link name="base_footprint" />
<joint name="base_joint" type="fixed">
<parent link="base_footprint" />
<child link="base_link" />
<origin xyz="0 0 0" rpy="0 0 0" />
</joint>
<link name="base_link">
<visual>
<origin xyz="0 0 0" rpy="0 0 0" />
<geometry>
<box size="0.1 0.05 0.05" />
</geometry>
<material name="base_link-material">
<color rgba="0.0021246888847058823 0.04970656597728775 0.48514994004665124 1" />
</material>
</visual>
<collision>
<origin xyz="0 0 0" rpy="0 0 0" />
<geometry>
<box size="0.1 0.05 0.05" />
</geometry>
</collision>
<inertial>
<origin xyz="0 0 0" rpy="0 0 0" />
<mass value="1" />
<inertia ixx="0.16666666666666666" ixy="0" ixz="0" iyy="0.16666666666666666" iyz="0" izz="0.16666666666666666" />
</inertial>
</link>
<joint name="base_link_to_spine_1" type="revolute">
<parent link="base_link" />
<child link="spine_1" />
<origin xyz="0 0 0.033737961440044734" rpy="0 0 0" />
<axis xyz="-1 0 0" />
<limit effort="1000.0" lower="-1" upper="1" velocity="0.5" /> </joint>
<link name="spine_1">
<visual>
<origin xyz="0 0 0.05" rpy="0 0 0" />
<geometry>
<box size="0.1 0.05 0.1" />
</geometry>
<material name="spine_1-material">
<color rgba="0.0021246888847058823 0.04970656597728775 0.48514994004665124 1" />
</material>
</visual>
<collision>
<origin xyz="0 0 0.05" rpy="0 0 0" />
<geometry>
<box size="0.1 0.05 0.1" />
</geometry>
</collision>
<inertial>
<origin xyz="0 0 0.05" rpy="0 0 0" />
<mass value="1" />
<inertia ixx="0.16666666666666666" ixy="0" ixz="0" iyy="0.16666666666666666" iyz="0" izz="0.16666666666666666" />
</inertial>
</link>
<joint name="base_link_to_upper_arm_right" type="revolute">
<parent link="base_link" />
<child link="upper_arm_right" />
<origin xyz="0.062354968072652533 0 0.13096467297466818" rpy="-3.141592653589793 -0.6586873842445309 -1.548624773543236e-16" />
<axis xyz="-1 0 0" />
<limit effort="1000.0" lower="-1" upper="1" velocity="0.5" /> </joint>
<link name="upper_arm_right">
<visual>
<origin xyz="0 0 0.03" rpy="0 0 0" />
<geometry>
<box size="0.03 0.03 0.06" />
</geometry>
<material name="upper_arm_right-material">
<color rgba="0.0021246888847058823 0.04970656597728775 0.48514994004665124 1" />
</material>
</visual>
<collision>
<origin xyz="0 0 0.03" rpy="0 0 0" />
<geometry>
<box size="0.03 0.03 0.06" />
</geometry>
</collision>
<inertial>
<origin xyz="0 0 0.03" rpy="0 0 0" />
<mass value="1" />
<inertia ixx="0.16666666666666666" ixy="0" ixz="0" iyy="0.16666666666666666" iyz="0" izz="0.16666666666666666" />
</inertial>
</link>
<joint name="base_link_to_lower_arm_right" type="revolute">
<parent link="base_link" />
<child link="lower_arm_right" />
<origin xyz="0.10009022777221713 0 0.08243944985877427" rpy="-3.141592653589793 -0.6586873842445309 -2.496506045944997e-16" />
<axis xyz="-1 0 0" />
<limit effort="1000.0" lower="-1" upper="1" velocity="0.5" /> </joint>
<link name="lower_arm_right">
<visual>
<origin xyz="0 0 0.025" rpy="0 0 0" />
<geometry>
<box size="0.03 0.03 0.05" />
</geometry>
<material name="lower_arm_right-material">
<color rgba="0.0021246888847058823 0.04970656597728775 0.48514994004665124 1" />
</material>
</visual>
<collision>
<origin xyz="0 0 0.025" rpy="0 0 0" />
<geometry>
<box size="0.03 0.03 0.05" />
</geometry>
</collision>
<inertial>
<origin xyz="0 0 0.025" rpy="0 0 0" />
<mass value="1" />
<inertia ixx="0.16666666666666666" ixy="0" ixz="0" iyy="0.16666666666666666" iyz="0" izz="0.16666666666666666" />
</inertial>
</link>
<joint name="base_link_to_hand_right" type="revolute">
<parent link="base_link" />
<child link="hand_right" />
<origin xyz="0.13276109632093022 0 0.03940068352661779" rpy="-3.141592653589793 -0.6586873842445309 -2.496506045944997e-16" />
<axis xyz="-1 0 0" />
<limit effort="1000.0" lower="-1" upper="1" velocity="0.5" /> </joint>
<link name="hand_right">
<visual>
<origin xyz="0 0 0.015" rpy="0 0 0" />
<geometry>
<box size="0.03 0.03 0.03" />
</geometry>
<material name="hand_right-material">
<color rgba="0.0021246888847058823 0.04970656597728775 0.48514994004665124 1" />
</material>
</visual>
<collision>
<origin xyz="0 0 0.015" rpy="0 0 0" />
<geometry>
<box size="0.03 0.03 0.03" />
</geometry>
</collision>
<inertial>
<origin xyz="0 0 0.015" rpy="0 0 0" />
<mass value="1" />
<inertia ixx="0.16666666666666666" ixy="0" ixz="0" iyy="0.16666666666666666" iyz="0" izz="0.16666666666666666" />
</inertial>
</link>
<joint name="base_link_to_upper_arm_left" type="revolute">
<parent link="base_link" />
<child link="upper_arm_left" />
<origin xyz="-0.062354968072652533 0 0.13096467297466818" rpy="-3.141592653589793 0.6586873842445309 -1.548624773543236e-16" />
<axis xyz="-1 0 0" />
<limit effort="1000.0" lower="-1" upper="1" velocity="0.5" />
</joint>
<link name="upper_arm_left">
<visual>
<origin xyz="0 0 0.03" rpy="0 0 0" />
<geometry><box size="0.03 0.03 0.06" /></geometry>
<material name="upper_arm_left-material">
<color rgba="0.0021246888847058823 0.04970656597728775 0.48514994004665124 1" />
</material>
</visual>
<collision>
<origin xyz="0 0 0.03" rpy="0 0 0" />
<geometry><box size="0.03 0.03 0.06" /></geometry>
</collision>
<inertial>
<origin xyz="0 0 0.03" rpy="0 0 0" />
<mass value="1" />
<inertia ixx="0.16666666666666666" ixy="0" ixz="0" iyy="0.16666666666666666" iyz="0" izz="0.16666666666666666" />
</inertial>
</link>
<joint name="base_link_to_lower_arm_left" type="revolute">
<parent link="base_link" />
<child link="lower_arm_left" />
<origin xyz="-0.10009022777221713 0 0.08243944985877427" rpy="-3.141592653589793 0.6586873842445309 -2.496506045944997e-16" />
<axis xyz="-1 0 0" />
<limit effort="1000.0" lower="-1" upper="1" velocity="0.5" />
</joint>
<link name="lower_arm_left">
<visual>
<origin xyz="0 0 0.025" rpy="0 0 0" />
<geometry><box size="0.03 0.03 0.05" /></geometry>
<material name="lower_arm_left-material">
<color rgba="0.0021246888847058823 0.04970656597728775 0.48514994004665124 1" />
</material>
</visual>
<collision>
<origin xyz="0 0 0.025" rpy="0 0 0" />
<geometry><box size="0.03 0.03 0.05" /></geometry>
</collision>
<inertial>
<origin xyz="0 0 0.025" rpy="0 0 0" />
<mass value="1" />
<inertia ixx="0.16666666666666666" ixy="0" ixz="0" iyy="0.16666666666666666" iyz="0" izz="0.16666666666666666" />
</inertial>
</link>
<joint name="base_link_to_hand_left" type="revolute">
<parent link="base_link" />
<child link="hand_left" />
<origin xyz="-0.13276109632093022 0 0.03940068352661779" rpy="-3.141592653589793 0.6586873842445309 -2.496506045944997e-16" />
<axis xyz="-1 0 0" />
<limit effort="1000.0" lower="-1" upper="1" velocity="0.5" />
</joint>
<link name="hand_left">
<visual>
<origin xyz="0 0 0.015" rpy="0 0 0" />
<geometry><box size="0.03 0.03 0.03" /></geometry>
<material name="hand_left-material">
<color rgba="0.0021246888847058823 0.04970656597728775 0.48514994004665124 1" />
</material>
</visual>
<collision>
<origin xyz="0 0 0.015" rpy="0 0 0" />
<geometry><box size="0.03 0.03 0.03" /></geometry>
</collision>
<inertial>
<origin xyz="0 0 0.015" rpy="0 0 0" />
<mass value="1" />
<inertia ixx="0.16666666666666666" ixy="0" ixz="0" iyy="0.0" iyz="0" izz="0.16666666666666666" />
</inertial>
</link>
<joint name="base_link_to_upper_leg_right" type="revolute">
<parent link="base_link" />
<child link="upper_leg_right" />
<origin xyz="0.027260906368426083 0 -0.0372788919866843" rpy="3.141592653589793 2.220446049250313e-16 3.141592653589793" />
<axis xyz="-1 0 0" />
<limit effort="1000.0" lower="-1" upper="1" velocity="0.5" /> </joint>
<link name="upper_leg_right">
<visual>
<origin xyz="0 0 0.03" rpy="0 0 0" />
<geometry>
<box size="0.04 0.04 0.07" />
</geometry>
<material name="upper_leg_right-material">
<color rgba="0.0021246888847058823 0.04970656597728775 0.48514994004665124 1" />
</material>
</visual>
<collision>
<origin xyz="0 0 0.03" rpy="0 0 0" />
<geometry>
<box size="0.04 0.04 0.07" />
</geometry>
</collision>
<inertial>
<origin xyz="0 0 0.03" rpy="0 0 0" />
<mass value="1" />
<inertia ixx="0.16666666666666666" ixy="0" ixz="0" iyy="0.16666666666666666" iyz="0" izz="0.16666666666666666" />
</inertial>
</link>
<joint name="base_link_to_lower_leg_right" type="revolute">
<parent link="base_link" />
<child link="lower_leg_right" />
<origin xyz="0.027260906368426083 0 -0.11088915657500885" rpy="3.141592653589793 2.220446049250313e-16 3.141592653589793" />
<axis xyz="-1 0 0" />
<limit effort="1000.0" lower="-1" upper="1" velocity="0.5" /> </joint>
<link name="lower_leg_right">
<visual>
<origin xyz="0 0 0.03" rpy="0 0 0" />
<geometry>
<box size="0.04 0.04 0.07" />
</geometry>
<material name="lower_leg_right-material">
<color rgba="0.0021246888847058823 0.04970656597728775 0.48514994004665124 1" />
</material>
</visual>
<collision>
<origin xyz="0 0 0.03" rpy="0 0 0" />
<geometry>
<box size="0.04 0.04 0.07" />
</geometry>
</collision>
<inertial>
<origin xyz="0 0 0.03" rpy="0 0 0" />
<mass value="1" />
<inertia ixx="0.16666666666666666" ixy="0" ixz="0" iyy="0.16666666666666666" iyz="0" izz="0.16666666666666666" />
</inertial>
</link>
<joint name="base_link_to_lower_leg_right1" type="revolute">
<parent link="base_link" />
<child link="lower_leg_right1" />
<origin xyz="0.027260906368426083 -0.004866298635659946 -0.17845456205258786" rpy="3.141592653589793 2.220446049250313e-16 3.141592653589793" />
<axis xyz="-1 0 0" />
<limit effort="1000.0" lower="-1" upper="1" velocity="0.5" /> </joint>
<link name="lower_leg_right1">
<visual>
<origin xyz="0 0.025 0.01" rpy="0 0 0" />
<geometry>
<box size="0.04 0.08 0.02" />
</geometry>
<material name="lower_leg_right1-material">
<color rgba="0.0021246888847058823 0.04970656597728775 0.48514994004665124 1" />
</material>
</visual>
<collision>
<origin xyz="0 0.025 0.01" rpy="0 0 0" />
<geometry>
<box size="0.04 0.08 0.02" />
</geometry>
</collision>
<inertial>
<origin xyz="0 0.025 0.01" rpy="0 0 0" />
<mass value="1" />
<inertia ixx="0.16666666666666666" ixy="0" ixz="0" iyy="0.16666666666666666" iyz="0" izz="0.16666666666666666" />
</inertial>
</link>
<joint name="base_link_to_upper_leg_left" type="revolute">
<parent link="base_link" />
<child link="upper_leg_left" />
<origin xyz="-0.027260906368426083 0 -0.0372788919866843" rpy="3.141592653589793 2.220446049250313e-16 3.141592653589793" />
<axis xyz="-1 0 0" />
<limit effort="1000.0" lower="-1" upper="1" velocity="0.5" />
</joint>
<link name="upper_leg_left">
<visual>
<origin xyz="0 0 0.03" rpy="0 0 0" />
<geometry><box size="0.04 0.04 0.07" /></geometry>
<material name="upper_leg_left-material">
<color rgba="0.0021246888847058823 0.04970656597728775 0.48514994004665124 1" />
</material>
</visual>
<collision>
<origin xyz="0 0 0.03" rpy="0 0 0" />
<geometry><box size="0.04 0.04 0.07" /></geometry>
</collision>
<inertial>
<origin xyz="0 0 0.03" rpy="0 0 0" />
<mass value="1" />
<inertia ixx="0.16666666666666666" ixy="0" ixz="0" iyy="0.16666666666666666" iyz="0" izz="0.16666666666666666" />
</inertial>
</link>
<joint name="base_link_to_lower_leg_left" type="revolute">
<parent link="base_link" />
<child link="lower_leg_left" />
<origin xyz="-0.027260906368426083 0 -0.11088915657500885" rpy="3.141592653589793 2.220446049250313e-16 3.141592653589793" />
<axis xyz="-1 0 0" />
<limit effort="1000.0" lower="-1" upper="1" velocity="0.5" />
</joint>
<link name="lower_leg_left">
<visual>
<origin xyz="0 0 0.03" rpy="0 0 0" />
<geometry><box size="0.04 0.04 0.07" /></geometry>
<material name="lower_leg_left-material">
<color rgba="0.0021246888847058823 0.04970656597728775 0.48514994004665124 1" />
</material>
</visual>
<collision>
<origin xyz="0 0 0.03" rpy="0 0 0" />
<geometry><box size="0.04 0.04 0.07" /></geometry>
</collision>
<inertial>
<origin xyz="0 0 0.03" rpy="0 0 0" />
<mass value="1" />
<inertia ixx="0.16666666666666666" ixy="0" ixz="0" iyy="0.16666666666666666" iyz="0" izz="0.16666666666666666" />
</inertial>
</link>
<joint name="base_link_to_lower_leg_left1" type="revolute">
<parent link="base_link" />
<child link="lower_leg_left1" />
<origin xyz="-0.027260906368426083 -0.004866298635659946 -0.17845456205258786" rpy="3.141592653589793 2.220446049250313e-16 3.141592653589793" />
<axis xyz="-1 0 0" />
<limit effort="1000.0" lower="-1" upper="1" velocity="0.5" />
</joint>
<link name="lower_leg_left1">
<visual>
<origin xyz="0 0.025 0.01" rpy="0 0 0" />
<geometry><box size="0.04 0.08 0.02" /></geometry>
<material name="lower_leg_left1-material">
<color rgba="0.0021246888847058823 0.04970656597728775 0.48514994004665124 1" />
</material>
</visual>
<collision>
<origin xyz="0 0.025 0.01" rpy="0 0 0" />
<geometry><box size="0.04 0.08 0.02" /></geometry>
</collision>
<inertial>
<origin xyz="0 0.025 0.01" rpy="0 0 0" />
<mass value="1" />
<inertia ixx="0.16666666666666666" ixy="0" ixz="0" iyy="0.16666666666666666" iyz="0" izz="0.16666666666666666" />
</inertial>
</link>
<joint name="base_link_to_neck" type="revolute">
<parent link="base_link" />
<child link="neck" />
<origin xyz="0 0 0.13701911638953843" rpy="0 0 0" />
<axis xyz="0 0 1" />
<limit effort="1000.0" lower="-1" upper="1" velocity="0.5" /> </joint>
<link name="neck">
<visual>
<origin xyz="0 0 0" rpy="0 0 0" />
<geometry>
<box size="0.03 0.03 0.03" />
</geometry>
<material name="neck-material">
<color rgba="0.0021246888847058823 0.04970656597728775 0.48514994004665124 1" />
</material>
</visual>
<collision>
<origin xyz="0 0 0" rpy="0 0 0" />
<geometry>
<box size="0.03 0.03 0.03" />
</geometry>
</collision>
<inertial>
<origin xyz="0 0 0" rpy="0 0 0" />
<mass value="1" />
<inertia ixx="0.16666666666666666" ixy="0" ixz="0" iyy="0.16666666666666666" iyz="0" izz="0.16666666666666666" />
</inertial>
</link>
<joint name="base_link_to_head" type="revolute">
<parent link="base_link" />
<child link="head" />
<origin xyz="0 0 0.1835254369219812" rpy="0 0 0" />
<axis xyz="1 0 0" />
<limit effort="1000.0" lower="-1" upper="1" velocity="0.5" /> </joint>
<link name="head">
<visual>
<origin xyz="0 0 0" rpy="0 0 0" />
<geometry>
<box size="0.06 0.06 0.06" />
</geometry>
<material name="head-material">
<color rgba="0.0021246888847058823 0.04970656597728775 0.48514994004665124 1" />
</material>
</visual>
<collision>
<origin xyz="0 0 0" rpy="0 0 0" />
<geometry>
<box size="0.06 0.06 0.06" />
</geometry>
</collision>
<inertial>
<origin xyz="0 0 0" rpy="0 0 0" />
<mass value="1" />
<inertia ixx="0.16666666666666666" ixy="0" ixz="0" iyy="0.16666666666666666" iyz="0" izz="0.16666666666666666" />
</inertial>
</link>
<robot name="robot">
<link name="base_footprint" />
<joint name="base_joint" type="fixed">
<parent link="base_footprint" />
<child link="base_link" />
<origin xyz="0 0 0" rpy="0 0 0" />
</joint>
<link name="base_link">
<visual>
<origin xyz="0 0 0" rpy="0 0 0" />
<geometry>
<box size="0.1 0.05 0.05" />
</geometry>
<material name="base_link-material">
<color rgba="0.0021246888847058823 0.04970656597728775 0.48514994004665124 1" />
</material>
</visual>
<collision>
<origin xyz="0 0 0" rpy="0 0 0" />
<geometry>
<box size="0.1 0.05 0.05" />
</geometry>
</collision>
<inertial>
<origin xyz="0 0 0" rpy="0 0 0" />
<mass value="1" />
<inertia ixx="0.16666666666666666" ixy="0" ixz="0" iyy="0.16666666666666666" iyz="0" izz="0.16666666666666666" />
</inertial>
</link>
<joint name="base_link_to_spine_1" type="revolute">
<parent link="base_link" />
<child link="spine_1" />
<origin xyz="0 0 0.033737961440044734" rpy="0 0 0" />
<axis xyz="-1 0 0" />
<limit effort="1000.0" lower="-1" upper="1" velocity="0.5" /> </joint>
<link name="spine_1">
<visual>
<origin xyz="0 0 0.05" rpy="0 0 0" />
<geometry>
<box size="0.1 0.05 0.1" />
</geometry>
<material name="spine_1-material">
<color rgba="0.0021246888847058823 0.04970656597728775 0.48514994004665124 1" />
</material>
</visual>
<collision>
<origin xyz="0 0 0.05" rpy="0 0 0" />
<geometry>
<box size="0.1 0.05 0.1" />
</geometry>
</collision>
<inertial>
<origin xyz="0 0 0.05" rpy="0 0 0" />
<mass value="1" />
<inertia ixx="0.16666666666666666" ixy="0" ixz="0" iyy="0.16666666666666666" iyz="0" izz="0.16666666666666666" />
</inertial>
</link>
<joint name="base_link_to_upper_arm_right" type="revolute">
<parent link="base_link" />
<child link="upper_arm_right" />
<origin xyz="0.062354968072652533 0 0.13096467297466818" rpy="-3.141592653589793 -0.6586873842445309 -1.548624773543236e-16" />
<axis xyz="-1 0 0" />
<limit effort="1000.0" lower="-1" upper="1" velocity="0.5" /> </joint>
<link name="upper_arm_right">
<visual>
<origin xyz="0 0 0.03" rpy="0 0 0" />
<geometry>
<box size="0.03 0.03 0.06" />
</geometry>
<material name="upper_arm_right-material">
<color rgba="0.0021246888847058823 0.04970656597728775 0.48514994004665124 1" />
</material>
</visual>
<collision>
<origin xyz="0 0 0.03" rpy="0 0 0" />
<geometry>
<box size="0.03 0.03 0.06" />
</geometry>
</collision>
<inertial>
<origin xyz="0 0 0.03" rpy="0 0 0" />
<mass value="1" />
<inertia ixx="0.16666666666666666" ixy="0" ixz="0" iyy="0.16666666666666666" iyz="0" izz="0.16666666666666666" />
</inertial>
</link>
<joint name="base_link_to_lower_arm_right" type="revolute">
<parent link="base_link" />
<child link="lower_arm_right" />
<origin xyz="0.10009022777221713 0 0.08243944985877427" rpy="-3.141592653589793 -0.6586873842445309 -2.496506045944997e-16" />
<axis xyz="-1 0 0" />
<limit effort="1000.0" lower="-1" upper="1" velocity="0.5" /> </joint>
<link name="lower_arm_right">
<visual>
<origin xyz="0 0 0.025" rpy="0 0 0" />
<geometry>
<box size="0.03 0.03 0.05" />
</geometry>
<material name="lower_arm_right-material">
<color rgba="0.0021246888847058823 0.04970656597728775 0.48514994004665124 1" />
</material>
</visual>
<collision>
<origin xyz="0 0 0.025" rpy="0 0 0" />
<geometry>
<box size="0.03 0.03 0.05" />
</geometry>
</collision>
<inertial>
<origin xyz="0 0 0.025" rpy="0 0 0" />
<mass value="1" />
<inertia ixx="0.16666666666666666" ixy="0" ixz="0" iyy="0.16666666666666666" iyz="0" izz="0.16666666666666666" />
</inertial>
</link>
<joint name="base_link_to_hand_right" type="revolute">
<parent link="base_link" />
<child link="hand_right" />
<origin xyz="0.13276109632093022 0 0.03940068352661779" rpy="-3.141592653589793 -0.6586873842445309 -2.496506045944997e-16" />
<axis xyz="-1 0 0" />
<limit effort="1000.0" lower="-1" upper="1" velocity="0.5" /> </joint>
<link name="hand_right">
<visual>
<origin xyz="0 0 0.015" rpy="0 0 0" />
<geometry>
<box size="0.03 0.03 0.03" />
</geometry>
<material name="hand_right-material">
<color rgba="0.0021246888847058823 0.04970656597728775 0.48514994004665124 1" />
</material>
</visual>
<collision>
<origin xyz="0 0 0.015" rpy="0 0 0" />
<geometry>
<box size="0.03 0.03 0.03" />
</geometry>
</collision>
<inertial>
<origin xyz="0 0 0.015" rpy="0 0 0" />
<mass value="1" />
<inertia ixx="0.16666666666666666" ixy="0" ixz="0" iyy="0.16666666666666666" iyz="0" izz="0.16666666666666666" />
</inertial>
</link>
<joint name="base_link_to_upper_arm_left" type="revolute">
<parent link="base_link" />
<child link="upper_arm_left" />
<origin xyz="-0.062354968072652533 0 0.13096467297466818" rpy="-3.141592653589793 0.6586873842445309 -1.548624773543236e-16" />
<axis xyz="-1 0 0" />
<limit effort="1000.0" lower="-1" upper="1" velocity="0.5" />
</joint>
<link name="upper_arm_left">
<visual>
<origin xyz="0 0 0.03" rpy="0 0 0" />
<geometry><box size="0.03 0.03 0.06" /></geometry>
<material name="upper_arm_left-material">
<color rgba="0.0021246888847058823 0.04970656597728775 0.48514994004665124 1" />
</material>
</visual>
<collision>
<origin xyz="0 0 0.03" rpy="0 0 0" />
<geometry><box size="0.03 0.03 0.06" /></geometry>
</collision>
<inertial>
<origin xyz="0 0 0.03" rpy="0 0 0" />
<mass value="1" />
<inertia ixx="0.16666666666666666" ixy="0" ixz="0" iyy="0.16666666666666666" iyz="0" izz="0.16666666666666666" />
</inertial>
</link>
<joint name="base_link_to_lower_arm_left" type="revolute">
<parent link="base_link" />
<child link="lower_arm_left" />
<origin xyz="-0.10009022777221713 0 0.08243944985877427" rpy="-3.141592653589793 0.6586873842445309 -2.496506045944997e-16" />
<axis xyz="-1 0 0" />
<limit effort="1000.0" lower="-1" upper="1" velocity="0.5" />
</joint>
<link name="lower_arm_left">
<visual>
<origin xyz="0 0 0.025" rpy="0 0 0" />
<geometry><box size="0.03 0.03 0.05" /></geometry>
<material name="lower_arm_left-material">
<color rgba="0.0021246888847058823 0.04970656597728775 0.48514994004665124 1" />
</material>
</visual>
<collision>
<origin xyz="0 0 0.025" rpy="0 0 0" />
<geometry><box size="0.03 0.03 0.05" /></geometry>
</collision>
<inertial>
<origin xyz="0 0 0.025" rpy="0 0 0" />
<mass value="1" />
<inertia ixx="0.16666666666666666" ixy="0" ixz="0" iyy="0.16666666666666666" iyz="0" izz="0.16666666666666666" />
</inertial>
</link>
<joint name="base_link_to_hand_left" type="revolute">
<parent link="base_link" />
<child link="hand_left" />
<origin xyz="-0.13276109632093022 0 0.03940068352661779" rpy="-3.141592653589793 0.6586873842445309 -2.496506045944997e-16" />
<axis xyz="-1 0 0" />
<limit effort="1000.0" lower="-1" upper="1" velocity="0.5" />
</joint>
<link name="hand_left">
<visual>
<origin xyz="0 0 0.015" rpy="0 0 0" />
<geometry><box size="0.03 0.03 0.03" /></geometry>
<material name="hand_left-material">
<color rgba="0.0021246888847058823 0.04970656597728775 0.48514994004665124 1" />
</material>
</visual>
<collision>
<origin xyz="0 0 0.015" rpy="0 0 0" />
<geometry><box size="0.03 0.03 0.03" /></geometry>
</collision>
<inertial>
<origin xyz="0 0 0.015" rpy="0 0 0" />
<mass value="1" />
<inertia ixx="0.16666666666666666" ixy="0" ixz="0" iyy="0.0" iyz="0" izz="0.16666666666666666" />
</inertial>
</link>
<joint name="base_link_to_upper_leg_right" type="revolute">
<parent link="base_link" />
<child link="upper_leg_right" />
<origin xyz="0.027260906368426083 0 -0.0372788919866843" rpy="3.141592653589793 2.220446049250313e-16 3.141592653589793" />
<axis xyz="-1 0 0" />
<limit effort="1000.0" lower="-1" upper="1" velocity="0.5" /> </joint>
<link name="upper_leg_right">
<visual>
<origin xyz="0 0 0.03" rpy="0 0 0" />
<geometry>
<box size="0.04 0.04 0.07" />
</geometry>
<material name="upper_leg_right-material">
<color rgba="0.0021246888847058823 0.04970656597728775 0.48514994004665124 1" />
</material>
</visual>
<collision>
<origin xyz="0 0 0.03" rpy="0 0 0" />
<geometry>
<box size="0.04 0.04 0.07" />
</geometry>
</collision>
<inertial>
<origin xyz="0 0 0.03" rpy="0 0 0" />
<mass value="1" />
<inertia ixx="0.16666666666666666" ixy="0" ixz="0" iyy="0.16666666666666666" iyz="0" izz="0.16666666666666666" />
</inertial>
</link>
<joint name="base_link_to_lower_leg_right" type="revolute">
<parent link="base_link" />
<child link="lower_leg_right" />
<origin xyz="0.027260906368426083 0 -0.11088915657500885" rpy="3.141592653589793 2.220446049250313e-16 3.141592653589793" />
<axis xyz="-1 0 0" />
<limit effort="1000.0" lower="-1" upper="1" velocity="0.5" /> </joint>
<link name="lower_leg_right">
<visual>
<origin xyz="0 0 0.03" rpy="0 0 0" />
<geometry>
<box size="0.04 0.04 0.07" />
</geometry>
<material name="lower_leg_right-material">
<color rgba="0.0021246888847058823 0.04970656597728775 0.48514994004665124 1" />
</material>
</visual>
<collision>
<origin xyz="0 0 0.03" rpy="0 0 0" />
<geometry>
<box size="0.04 0.04 0.07" />
</geometry>
</collision>
<inertial>
<origin xyz="0 0 0.03" rpy="0 0 0" />
<mass value="1" />
<inertia ixx="0.16666666666666666" ixy="0" ixz="0" iyy="0.16666666666666666" iyz="0" izz="0.16666666666666666" />
</inertial>
</link>
<joint name="base_link_to_lower_leg_right1" type="revolute">
<parent link="base_link" />
<child link="lower_leg_right1" />
<origin xyz="0.027260906368426083 -0.004866298635659946 -0.17845456205258786" rpy="3.141592653589793 2.220446049250313e-16 3.141592653589793" />
<axis xyz="-1 0 0" />
<limit effort="1000.0" lower="-1" upper="1" velocity="0.5" /> </joint>
<link name="lower_leg_right1">
<visual>
<origin xyz="0 0.025 0.01" rpy="0 0 0" />
<geometry>
<box size="0.04 0.08 0.02" />
</geometry>
<material name="lower_leg_right1-material">
<color rgba="0.0021246888847058823 0.04970656597728775 0.48514994004665124 1" />
</material>
</visual>
<collision>
<origin xyz="0 0.025 0.01" rpy="0 0 0" />
<geometry>
<box size="0.04 0.08 0.02" />
</geometry>
</collision>
<inertial>
<origin xyz="0 0.025 0.01" rpy="0 0 0" />
<mass value="1" />
<inertia ixx="0.16666666666666666" ixy="0" ixz="0" iyy="0.16666666666666666" iyz="0" izz="0.16666666666666666" />
</inertial>
</link>
<joint name="base_link_to_upper_leg_left" type="revolute">
<parent link="base_link" />
<child link="upper_leg_left" />
<origin xyz="-0.027260906368426083 0 -0.0372788919866843" rpy="3.141592653589793 2.220446049250313e-16 3.141592653589793" />
<axis xyz="-1 0 0" />
<limit effort="1000.0" lower="-1" upper="1" velocity="0.5" />
</joint>
<link name="upper_leg_left">
<visual>
<origin xyz="0 0 0.03" rpy="0 0 0" />
<geometry><box size="0.04 0.04 0.07" /></geometry>
<material name="upper_leg_left-material">
<color rgba="0.0021246888847058823 0.04970656597728775 0.48514994004665124 1" />
</material>
</visual>
<collision>
<origin xyz="0 0 0.03" rpy="0 0 0" />
<geometry><box size="0.04 0.04 0.07" /></geometry>
</collision>
<inertial>
<origin xyz="0 0 0.03" rpy="0 0 0" />
<mass value="1" />
<inertia ixx="0.16666666666666666" ixy="0" ixz="0" iyy="0.16666666666666666" iyz="0" izz="0.16666666666666666" />
</inertial>
</link>
<joint name="base_link_to_lower_leg_left" type="revolute">
<parent link="base_link" />
<child link="lower_leg_left" />
<origin xyz="-0.027260906368426083 0 -0.11088915657500885" rpy="3.141592653589793 2.220446049250313e-16 3.141592653589793" />
<axis xyz="-1 0 0" />
<limit effort="1000.0" lower="-1" upper="1" velocity="0.5" />
</joint>
<link name="lower_leg_left">
<visual>
<origin xyz="0 0 0.03" rpy="0 0 0" />
<geometry><box size="0.04 0.04 0.07" /></geometry>
<material name="lower_leg_left-material">
<color rgba="0.0021246888847058823 0.04970656597728775 0.48514994004665124 1" />
</material>
</visual>
<collision>
<origin xyz="0 0 0.03" rpy="0 0 0" />
<geometry><box size="0.04 0.04 0.07" /></geometry>
</collision>
<inertial>
<origin xyz="0 0 0.03" rpy="0 0 0" />
<mass value="1" />
<inertia ixx="0.16666666666666666" ixy="0" ixz="0" iyy="0.16666666666666666" iyz="0" izz="0.16666666666666666" />
</inertial>
</link>
<joint name="base_link_to_lower_leg_left1" type="revolute">
<parent link="base_link" />
<child link="lower_leg_left1" />
<origin xyz="-0.027260906368426083 -0.004866298635659946 -0.17845456205258786" rpy="3.141592653589793 2.220446049250313e-16 3.141592653589793" />
<axis xyz="-1 0 0" />
<limit effort="1000.0" lower="-1" upper="1" velocity="0.5" />
</joint>
<link name="lower_leg_left1">
<visual>
<origin xyz="0 0.025 0.01" rpy="0 0 0" />
<geometry><box size="0.04 0.08 0.02" /></geometry>
<material name="lower_leg_left1-material">
<color rgba="0.0021246888847058823 0.04970656597728775 0.48514994004665124 1" />
</material>
</visual>
<collision>
<origin xyz="0 0.025 0.01" rpy="0 0 0" />
<geometry><box size="0.04 0.08 0.02" /></geometry>
</collision>
<inertial>
<origin xyz="0 0.025 0.01" rpy="0 0 0" />
<mass value="1" />
<inertia ixx="0.16666666666666666" ixy="0" ixz="0" iyy="0.16666666666666666" iyz="0" izz="0.16666666666666666" />
</inertial>
</link>
<joint name="base_link_to_neck" type="revolute">
<parent link="base_link" />
<child link="neck" />
<origin xyz="0 0 0.13701911638953843" rpy="0 0 0" />
<axis xyz="0 0 1" />
<limit effort="1000.0" lower="-1" upper="1" velocity="0.5" /> </joint>
<link name="neck">
<visual>
<origin xyz="0 0 0" rpy="0 0 0" />
<geometry>
<box size="0.03 0.03 0.03" />
</geometry>
<material name="neck-material">
<color rgba="0.0021246888847058823 0.04970656597728775 0.48514994004665124 1" />
</material>
</visual>
<collision>
<origin xyz="0 0 0" rpy="0 0 0" />
<geometry>
<box size="0.03 0.03 0.03" />
</geometry>
</collision>
<inertial>
<origin xyz="0 0 0" rpy="0 0 0" />
<mass value="1" />
<inertia ixx="0.16666666666666666" ixy="0" ixz="0" iyy="0.16666666666666666" iyz="0" izz="0.16666666666666666" />
</inertial>
</link>
<joint name="base_link_to_head" type="revolute">
<parent link="base_link" />
<child link="head" />
<origin xyz="0 0 0.1835254369219812" rpy="0 0 0" />
<axis xyz="1 0 0" />
<limit effort="1000.0" lower="-1" upper="1" velocity="0.5" /> </joint>
<link name="head">
<visual>
<origin xyz="0 0 0" rpy="0 0 0" />
<geometry>
<box size="0.06 0.06 0.06" />
</geometry>
<material name="head-material">
<color rgba="0.0021246888847058823 0.04970656597728775 0.48514994004665124 1" />
</material>
</visual>
<collision>
<origin xyz="0 0 0" rpy="0 0 0" />
<geometry>
<box size="0.06 0.06 0.06" />
</geometry>
</collision>
<inertial>
<origin xyz="0 0 0" rpy="0 0 0" />
<mass value="1" />
<inertia ixx="0.16666666666666666" ixy="0" ixz="0" iyy="0.16666666666666666" iyz="0" izz="0.16666666666666666" />
</inertial>
</link>
</robot>

File diff suppressed because it is too large Load Diff

View File

@ -1,7 +1,7 @@
// vite.config.js
export default {
root: '.',
server: {
open: true
}
}
// vite.config.js
export default {
root: '.',
server: {
open: true
}
}