three-stdlib 2.23.2 → 2.23.4
Sign up to get free protection for your applications and to get access to all the features.
- package/LICENSE +21 -0
- package/README.md +44 -0
- package/loaders/3DMLoader.d.ts +1 -2
- package/loaders/3MFLoader.d.ts +1 -2
- package/loaders/AMFLoader.d.ts +1 -2
- package/loaders/AssimpLoader.d.ts +1 -2
- package/loaders/BVHLoader.d.ts +1 -2
- package/loaders/BasisTextureLoader.d.ts +1 -2
- package/loaders/ColladaLoader.d.ts +1 -2
- package/loaders/DRACOLoader.d.ts +1 -2
- package/loaders/FBXLoader.d.ts +1 -2
- package/loaders/FontLoader.cjs +4 -2
- package/loaders/FontLoader.d.ts +2 -1
- package/loaders/FontLoader.js +4 -2
- package/loaders/GCodeLoader.d.ts +1 -2
- package/loaders/GLTFLoader.d.ts +1 -1
- package/loaders/HDRCubeTextureLoader.d.ts +1 -2
- package/loaders/KMZLoader.d.ts +1 -2
- package/loaders/LDrawLoader.d.ts +1 -2
- package/loaders/LUT3dlLoader.d.ts +1 -2
- package/loaders/LUTCubeLoader.d.ts +1 -2
- package/loaders/LWOLoader.d.ts +1 -2
- package/loaders/LottieLoader.d.ts +1 -2
- package/loaders/MD2Loader.d.ts +1 -2
- package/loaders/MDDLoader.d.ts +1 -2
- package/loaders/MMDLoader.d.ts +1 -2
- package/loaders/MTLLoader.d.ts +1 -2
- package/loaders/NRRDLoader.d.ts +3 -2
- package/loaders/OBJLoader.d.ts +1 -2
- package/loaders/PCDLoader.d.ts +1 -2
- package/loaders/PDBLoader.d.ts +1 -2
- package/loaders/PLYLoader.d.ts +1 -2
- package/loaders/PRWMLoader.d.ts +1 -2
- package/loaders/STLLoader.d.ts +1 -2
- package/loaders/SVGLoader.d.ts +1 -2
- package/loaders/TDSLoader.d.ts +1 -2
- package/loaders/TTFLoader.d.ts +1 -2
- package/loaders/TiltLoader.d.ts +1 -2
- package/loaders/VOXLoader.d.ts +1 -2
- package/loaders/VRMLLoader.d.ts +1 -2
- package/loaders/VRMLoader.d.ts +1 -2
- package/loaders/VTKLoader.d.ts +1 -2
- package/loaders/XLoader.d.ts +1 -2
- package/loaders/XYZLoader.d.ts +1 -2
- package/package.json +2 -2
- package/types/Loader.cjs +0 -26
- package/types/Loader.d.ts +0 -4
- package/types/Loader.js +0 -9
package/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2021-2023 Poimandres
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
@@ -0,0 +1,44 @@
|
|
1
|
+
# three-stdlib
|
2
|
+
|
3
|
+
[![Version](https://img.shields.io/npm/v/three-stdlib?style=flat&colorA=000000&colorB=000000)](https://npmjs.com/package/three-stdlib)
|
4
|
+
[![Downloads](https://img.shields.io/npm/dt/three-stdlib.svg?style=flat&colorA=000000&colorB=000000)](https://npmjs.com/package/three-stdlib)
|
5
|
+
[![Twitter](https://img.shields.io/twitter/follow/pmndrs?label=%40pmndrs&style=flat&colorA=000000&colorB=000000&logo=twitter&logoColor=000000)](https://twitter.com/pmndrs)
|
6
|
+
[![Discord](https://img.shields.io/discord/740090768164651008?style=flat&colorA=000000&colorB=000000&label=discord&logo=discord&logoColor=000000)](https://discord.gg/ZZjjNvJ)
|
7
|
+
[![release](https://github.com/pmndrs/three-stdlib/actions/workflows/main.yml/badge.svg?style=flat&colorA=000000&colorB=000000)](https://github.com/pmndrs/three-stdlib/actions/workflows/main.yml)
|
8
|
+
|
9
|
+
Stand-alone version of [threejs/examples/jsm](https://github.com/mrdoob/three.js/tree/dev/examples/jsm) written in Typescript & built for ESM & CJS.
|
10
|
+
|
11
|
+
## Basic usage
|
12
|
+
|
13
|
+
npm install three-stdlib
|
14
|
+
|
15
|
+
```ts
|
16
|
+
// Export collection
|
17
|
+
import * as STDLIB from 'three-stdlib'
|
18
|
+
// Flatbundle
|
19
|
+
import { OrbitControls, ... } from 'three-stdlib'
|
20
|
+
```
|
21
|
+
|
22
|
+
## Problem
|
23
|
+
|
24
|
+
`threejs/examples` are usually regarded as something that you copy/paste into your project and adapt to your needs. That's not how people use it, and this has caused numerous issues in the past.
|
25
|
+
|
26
|
+
## Solution
|
27
|
+
|
28
|
+
- A build system for esm and cjs
|
29
|
+
- Version managed dependencies
|
30
|
+
- Class based, optimized for tree-shaking, no globals, exports instead of collections
|
31
|
+
- Single flatbundle as well as individual transpiles
|
32
|
+
- Typesafety with simple annotation-like types
|
33
|
+
- CI, tests, linting, formatting (prettier)
|
34
|
+
|
35
|
+
But most importantly, allowing more people that use and rely on these primitives to hold a little stake, and to share the weight of maintaining it.
|
36
|
+
|
37
|
+
## How to contribute
|
38
|
+
|
39
|
+
If you want to get involved you could do any of the following:
|
40
|
+
|
41
|
+
- Help to maintain and sync the existing primitives
|
42
|
+
- Create stories for these examples for our dedicated storybook
|
43
|
+
- Convert some of the files to Typescript
|
44
|
+
- Add new examples for the library you think could be helpful for others
|
package/loaders/3DMLoader.d.ts
CHANGED
package/loaders/3MFLoader.d.ts
CHANGED
package/loaders/AMFLoader.d.ts
CHANGED
package/loaders/BVHLoader.d.ts
CHANGED
@@ -1,5 +1,4 @@
|
|
1
|
-
import { CompressedTexture, LoadingManager, WebGLRenderer } from 'three'
|
2
|
-
import { Loader } from '../types/Loader'
|
1
|
+
import { Loader, CompressedTexture, LoadingManager, WebGLRenderer } from 'three'
|
3
2
|
|
4
3
|
export class BasisTextureLoader extends Loader {
|
5
4
|
constructor(manager?: LoadingManager)
|
package/loaders/DRACOLoader.d.ts
CHANGED
package/loaders/FBXLoader.d.ts
CHANGED
package/loaders/FontLoader.cjs
CHANGED
@@ -7,8 +7,7 @@ var __publicField = (obj, key, value) => {
|
|
7
7
|
};
|
8
8
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
9
9
|
const THREE = require("three");
|
10
|
-
|
11
|
-
class FontLoader extends Loader.Loader {
|
10
|
+
class FontLoader extends THREE.Loader {
|
12
11
|
constructor(manager) {
|
13
12
|
super(manager);
|
14
13
|
}
|
@@ -31,6 +30,9 @@ class FontLoader extends Loader.Loader {
|
|
31
30
|
onError
|
32
31
|
);
|
33
32
|
}
|
33
|
+
loadAsync(url, onProgress) {
|
34
|
+
return super.loadAsync(url, onProgress);
|
35
|
+
}
|
34
36
|
parse(json) {
|
35
37
|
return new Font(json);
|
36
38
|
}
|
package/loaders/FontLoader.d.ts
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
import { Loader } from '
|
1
|
+
import { Loader } from 'three';
|
2
2
|
import type { LoadingManager, Shape } from 'three';
|
3
3
|
type Options = {
|
4
4
|
lineHeight: number;
|
@@ -7,6 +7,7 @@ type Options = {
|
|
7
7
|
export declare class FontLoader extends Loader {
|
8
8
|
constructor(manager?: LoadingManager);
|
9
9
|
load(url: string, onLoad?: (responseFont: Font) => void, onProgress?: (event: ProgressEvent) => void, onError?: (event: ErrorEvent) => void): void;
|
10
|
+
loadAsync(url: string, onProgress?: (event: ProgressEvent) => void): Promise<Font>;
|
10
11
|
parse(json: FontData): Font;
|
11
12
|
}
|
12
13
|
type Glyph = {
|
package/loaders/FontLoader.js
CHANGED
@@ -4,8 +4,7 @@ var __publicField = (obj, key, value) => {
|
|
4
4
|
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
5
5
|
return value;
|
6
6
|
};
|
7
|
-
import { FileLoader, ShapePath } from "three";
|
8
|
-
import { Loader } from "../types/Loader.js";
|
7
|
+
import { Loader, FileLoader, ShapePath } from "three";
|
9
8
|
class FontLoader extends Loader {
|
10
9
|
constructor(manager) {
|
11
10
|
super(manager);
|
@@ -29,6 +28,9 @@ class FontLoader extends Loader {
|
|
29
28
|
onError
|
30
29
|
);
|
31
30
|
}
|
31
|
+
loadAsync(url, onProgress) {
|
32
|
+
return super.loadAsync(url, onProgress);
|
33
|
+
}
|
32
34
|
parse(json) {
|
33
35
|
return new Font(json);
|
34
36
|
}
|
package/loaders/GCodeLoader.d.ts
CHANGED
package/loaders/GLTFLoader.d.ts
CHANGED
package/loaders/KMZLoader.d.ts
CHANGED
package/loaders/LDrawLoader.d.ts
CHANGED
package/loaders/LWOLoader.d.ts
CHANGED
package/loaders/MD2Loader.d.ts
CHANGED
package/loaders/MDDLoader.d.ts
CHANGED
package/loaders/MMDLoader.d.ts
CHANGED
@@ -1,5 +1,4 @@
|
|
1
|
-
import { Camera, AnimationClip, FileLoader, LoadingManager, SkinnedMesh } from 'three'
|
2
|
-
import { Loader } from '../types/Loader'
|
1
|
+
import { Loader, Camera, AnimationClip, FileLoader, LoadingManager, SkinnedMesh } from 'three'
|
3
2
|
|
4
3
|
export interface MMDLoaderAnimationObject {
|
5
4
|
animation: AnimationClip
|
package/loaders/MTLLoader.d.ts
CHANGED
@@ -1,5 +1,4 @@
|
|
1
|
-
import { Material, LoadingManager, Mapping, BufferGeometry, Side, Texture, Vector2, Wrapping } from 'three'
|
2
|
-
import { Loader } from '../types/Loader'
|
1
|
+
import { Loader, Material, LoadingManager, Mapping, BufferGeometry, Side, Texture, Vector2, Wrapping } from 'three'
|
3
2
|
|
4
3
|
export interface MaterialCreatorOptions {
|
5
4
|
/**
|
package/loaders/NRRDLoader.d.ts
CHANGED
@@ -1,8 +1,8 @@
|
|
1
|
-
import { LoadingManager } from 'three'
|
1
|
+
import { Loader, LoadingManager } from 'three'
|
2
2
|
|
3
3
|
import { Volume } from '../misc/Volume'
|
4
4
|
|
5
|
-
export class NRRDLoader {
|
5
|
+
export class NRRDLoader extends Loader {
|
6
6
|
constructor(manager?: LoadingManager)
|
7
7
|
manager: LoadingManager
|
8
8
|
path: string
|
@@ -15,6 +15,7 @@ export class NRRDLoader {
|
|
15
15
|
onProgress?: (event: ProgressEvent) => void,
|
16
16
|
onError?: (event: ErrorEvent) => void,
|
17
17
|
): void
|
18
|
+
loadAsync(url: string, onProgress?: (event: ProgressEvent) => void): Promise<Volume>
|
18
19
|
parse(data: string): Volume
|
19
20
|
parseChars(array: number[], start?: number, end?: number): string
|
20
21
|
setPath(value: string): this
|
package/loaders/OBJLoader.d.ts
CHANGED
package/loaders/PCDLoader.d.ts
CHANGED
package/loaders/PDBLoader.d.ts
CHANGED
package/loaders/PLYLoader.d.ts
CHANGED
package/loaders/PRWMLoader.d.ts
CHANGED
package/loaders/STLLoader.d.ts
CHANGED
package/loaders/SVGLoader.d.ts
CHANGED
@@ -1,5 +1,4 @@
|
|
1
|
-
import { LoadingManager, ShapePath, BufferGeometry, Vector3, Shape } from 'three'
|
2
|
-
import { Loader } from '../types/Loader'
|
1
|
+
import { Loader, LoadingManager, ShapePath, BufferGeometry, Vector3, Shape } from 'three'
|
3
2
|
|
4
3
|
export interface SVGResultPaths extends ShapePath {
|
5
4
|
userData?:
|
package/loaders/TDSLoader.d.ts
CHANGED
@@ -1,5 +1,4 @@
|
|
1
|
-
import { Color, Group, LoadingManager, Material, Mesh, Texture } from 'three'
|
2
|
-
import { Loader } from '../types/Loader'
|
1
|
+
import { Loader, Color, Group, LoadingManager, Material, Mesh, Texture } from 'three'
|
3
2
|
|
4
3
|
export class TDSLoader extends Loader {
|
5
4
|
constructor(manager?: LoadingManager)
|
package/loaders/TTFLoader.d.ts
CHANGED
package/loaders/TiltLoader.d.ts
CHANGED
package/loaders/VOXLoader.d.ts
CHANGED
package/loaders/VRMLLoader.d.ts
CHANGED
package/loaders/VRMLoader.d.ts
CHANGED
package/loaders/VTKLoader.d.ts
CHANGED
package/loaders/XLoader.d.ts
CHANGED
package/loaders/XYZLoader.d.ts
CHANGED
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "three-stdlib",
|
3
|
-
"version": "2.23.
|
3
|
+
"version": "2.23.4",
|
4
4
|
"description": "stand-alone library of threejs examples",
|
5
5
|
"keywords": [
|
6
6
|
"three",
|
@@ -49,7 +49,7 @@
|
|
49
49
|
"three": ">=0.128.0"
|
50
50
|
},
|
51
51
|
"scripts": {
|
52
|
-
"build": "rimraf dist && vite build && tsc --emitDeclarationOnly && copyfiles -u 1 \"src/**/*.d.ts\" dist && copyfiles package.json dist && json -I -f dist/package.json -e \"this.private=undefined; this.types=\\\"./index.d.ts\\\"; this.main=\\\"./index.cjs\\\"; this.module=\\\"./index.js\\\";\"",
|
52
|
+
"build": "rimraf dist && vite build && tsc --emitDeclarationOnly && copyfiles -u 1 \"src/**/*.d.ts\" dist && copyfiles package.json README.md LICENSE dist && json -I -f dist/package.json -e \"this.private=undefined; this.types=\\\"./index.d.ts\\\"; this.main=\\\"./index.cjs\\\"; this.module=\\\"./index.js\\\";\"",
|
53
53
|
"lint": "tsc --noEmit"
|
54
54
|
}
|
55
55
|
}
|
package/types/Loader.cjs
DELETED
@@ -1,26 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
3
|
-
const THREE = require("three");
|
4
|
-
function _interopNamespaceDefault(e) {
|
5
|
-
const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
|
6
|
-
if (e) {
|
7
|
-
for (const k in e) {
|
8
|
-
if (k !== "default") {
|
9
|
-
const d = Object.getOwnPropertyDescriptor(e, k);
|
10
|
-
Object.defineProperty(n, k, d.get ? d : {
|
11
|
-
enumerable: true,
|
12
|
-
get: () => e[k]
|
13
|
-
});
|
14
|
-
}
|
15
|
-
}
|
16
|
-
}
|
17
|
-
n.default = e;
|
18
|
-
return Object.freeze(n);
|
19
|
-
}
|
20
|
-
const THREE__namespace = /* @__PURE__ */ _interopNamespaceDefault(THREE);
|
21
|
-
class Loader extends THREE__namespace.Loader {
|
22
|
-
loadAsync(url, onProgress) {
|
23
|
-
return super.loadAsync(url, onProgress);
|
24
|
-
}
|
25
|
-
}
|
26
|
-
exports.Loader = Loader;
|
package/types/Loader.d.ts
DELETED