mirror of
https://github.com/denoland/deno.git
synced 2025-02-08 07:16:56 -05:00
feat: Geometry Interfaces Module
Co-authored-by: ud2 <sjx233@qq.com>
This commit is contained in:
parent
7cabd02c59
commit
daeca252ad
27 changed files with 4811 additions and 1 deletions
101
Cargo.lock
generated
101
Cargo.lock
generated
|
@ -192,6 +192,15 @@ version = "1.0.86"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b3d1d046238990b9cf5bcde22a3fb3584ee5cf65fb2765f454ed428c7a0063da"
|
||||
|
||||
[[package]]
|
||||
name = "approx"
|
||||
version = "0.5.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "cab112f0a86d568ea0e627cc1d6be74a1e9cd55214684db5561995f6dad897c6"
|
||||
dependencies = [
|
||||
"num-traits",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "arbitrary"
|
||||
version = "1.3.2"
|
||||
|
@ -1748,6 +1757,14 @@ dependencies = [
|
|||
"windows-sys 0.59.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "deno_geometry"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"deno_core",
|
||||
"nalgebra",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "deno_graph"
|
||||
version = "0.86.7"
|
||||
|
@ -2218,6 +2235,7 @@ dependencies = [
|
|||
"deno_fetch",
|
||||
"deno_ffi",
|
||||
"deno_fs",
|
||||
"deno_geometry",
|
||||
"deno_http",
|
||||
"deno_io",
|
||||
"deno_kv",
|
||||
|
@ -4836,6 +4854,16 @@ version = "0.7.3"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0e7465ac9959cc2b1404e8e2367b43684a6d13790fe23056cc8c6c5a6b7bcb94"
|
||||
|
||||
[[package]]
|
||||
name = "matrixmultiply"
|
||||
version = "0.3.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7574c1cf36da4798ab73da5b215bbf444f50718207754cb522201d78d1cd0ff2"
|
||||
dependencies = [
|
||||
"autocfg",
|
||||
"rawpointer",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "md-5"
|
||||
version = "0.10.6"
|
||||
|
@ -4994,6 +5022,21 @@ dependencies = [
|
|||
"unicode-xid",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "nalgebra"
|
||||
version = "0.33.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "26aecdf64b707efd1310e3544d709c5c0ac61c13756046aaaba41be5c4f66a3b"
|
||||
dependencies = [
|
||||
"approx",
|
||||
"matrixmultiply",
|
||||
"num-complex",
|
||||
"num-rational",
|
||||
"num-traits",
|
||||
"simba",
|
||||
"typenum",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "napi-build"
|
||||
version = "1.2.1"
|
||||
|
@ -5165,6 +5208,15 @@ dependencies = [
|
|||
"zeroize",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "num-complex"
|
||||
version = "0.4.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "23c6602fda94a57c990fe0df199a035d83576b496aa29f4e634a8ac6004e68a6"
|
||||
dependencies = [
|
||||
"num-traits",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "num-conv"
|
||||
version = "0.1.0"
|
||||
|
@ -5191,6 +5243,17 @@ dependencies = [
|
|||
"num-traits",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "num-rational"
|
||||
version = "0.4.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f83d14da390562dca69fc84082e73e548e1ad308d24accdedd2720017cb37824"
|
||||
dependencies = [
|
||||
"num-bigint",
|
||||
"num-integer",
|
||||
"num-traits",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "num-traits"
|
||||
version = "0.2.18"
|
||||
|
@ -6141,6 +6204,12 @@ version = "0.6.1"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8cc3bcbdb1ddfc11e700e62968e6b4cc9c75bb466464ad28fb61c5b2c964418b"
|
||||
|
||||
[[package]]
|
||||
name = "rawpointer"
|
||||
version = "0.2.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "60a357793950651c4ed0f3f52338f53b2f809f32d83a07f72909fa13e4c6c1e3"
|
||||
|
||||
[[package]]
|
||||
name = "rayon"
|
||||
version = "1.10.0"
|
||||
|
@ -6590,6 +6659,15 @@ version = "1.0.1"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ad97d4ce1560a5e27cec89519dc8300d1aa6035b099821261c651486a19e44d5"
|
||||
|
||||
[[package]]
|
||||
name = "safe_arch"
|
||||
version = "0.7.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f398075ce1e6a179b46f51bd88d0598b92b00d3551f1a2d4ac49e771b56ac354"
|
||||
dependencies = [
|
||||
"bytemuck",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "saffron"
|
||||
version = "0.1.0"
|
||||
|
@ -6907,6 +6985,19 @@ dependencies = [
|
|||
"rand_core",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "simba"
|
||||
version = "0.9.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b3a386a501cd104797982c15ae17aafe8b9261315b5d07e3ec803f2ea26be0fa"
|
||||
dependencies = [
|
||||
"approx",
|
||||
"num-complex",
|
||||
"num-traits",
|
||||
"paste",
|
||||
"wide",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "simd-abstraction"
|
||||
version = "0.7.1"
|
||||
|
@ -8764,6 +8855,16 @@ dependencies = [
|
|||
"web-sys",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wide"
|
||||
version = "0.7.16"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "81a1851a719f11d1d2fea40e15c72f6c00de8c142d7ac47c1441cc7e4d0d5bc6"
|
||||
dependencies = [
|
||||
"bytemuck",
|
||||
"safe_arch",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "widestring"
|
||||
version = "1.1.0"
|
||||
|
|
|
@ -14,6 +14,7 @@ members = [
|
|||
"ext/fetch",
|
||||
"ext/ffi",
|
||||
"ext/fs",
|
||||
"ext/geometry",
|
||||
"ext/http",
|
||||
"ext/io",
|
||||
"ext/kv",
|
||||
|
@ -78,6 +79,7 @@ deno_crypto = { version = "0.198.0", path = "./ext/crypto" }
|
|||
deno_fetch = { version = "0.208.0", path = "./ext/fetch" }
|
||||
deno_ffi = { version = "0.171.0", path = "./ext/ffi" }
|
||||
deno_fs = { version = "0.94.0", path = "./ext/fs" }
|
||||
deno_geometry = { version = "0.1.0", path = "./ext/geometry" }
|
||||
deno_http = { version = "0.182.0", path = "./ext/http" }
|
||||
deno_io = { version = "0.94.0", path = "./ext/io" }
|
||||
deno_kv = { version = "0.92.0", path = "./ext/kv" }
|
||||
|
@ -227,6 +229,9 @@ opentelemetry_sdk = "0.27.0"
|
|||
hkdf = "0.12.3"
|
||||
rsa = { version = "0.9.3", default-features = false, features = ["std", "pem", "hazmat"] } # hazmat needed for PrehashSigner in ext/node
|
||||
|
||||
# geometry
|
||||
nalgebra = { version = "0.33.2", default-features = false, features = ["std"] }
|
||||
|
||||
# webgpu
|
||||
raw-window-handle = "0.6.0"
|
||||
wgpu-core = "0.21.1"
|
||||
|
@ -297,6 +302,8 @@ opt-level = 3
|
|||
opt-level = 3
|
||||
[profile.release.package.deno_ffi]
|
||||
opt-level = 3
|
||||
[profile.release.package.deno_geometry]
|
||||
opt-level = 3
|
||||
[profile.release.package.deno_http]
|
||||
opt-level = 3
|
||||
[profile.release.package.deno_napi]
|
||||
|
|
|
@ -146,6 +146,7 @@ mod ts {
|
|||
op_crate_libs.insert("deno.url", deno_url::get_declaration());
|
||||
op_crate_libs.insert("deno.web", deno_web::get_declaration());
|
||||
op_crate_libs.insert("deno.fetch", deno_fetch::get_declaration());
|
||||
op_crate_libs.insert("deno.geometry", deno_geometry::get_declaration());
|
||||
op_crate_libs.insert("deno.webgpu", deno_webgpu_get_declaration());
|
||||
op_crate_libs.insert("deno.websocket", deno_websocket::get_declaration());
|
||||
op_crate_libs.insert("deno.webstorage", deno_webstorage::get_declaration());
|
||||
|
|
1
cli/tsc/dts/lib.deno.shared_globals.d.ts
vendored
1
cli/tsc/dts/lib.deno.shared_globals.d.ts
vendored
|
@ -11,6 +11,7 @@
|
|||
/// <reference lib="deno.webgpu" />
|
||||
/// <reference lib="deno.canvas" />
|
||||
/// <reference lib="deno.fetch" />
|
||||
/// <reference lib="deno.geometry" />
|
||||
/// <reference lib="deno.websocket" />
|
||||
/// <reference lib="deno.crypto" />
|
||||
/// <reference lib="deno.ns" />
|
||||
|
|
|
@ -103,6 +103,7 @@ pub fn get_types_declaration_file_text() -> String {
|
|||
"deno.webstorage",
|
||||
"deno.canvas",
|
||||
"deno.crypto",
|
||||
"deno.geometry",
|
||||
"deno.broadcast_channel",
|
||||
"deno.net",
|
||||
"deno.shared_globals",
|
||||
|
|
27
ext/geometry/00_init.js
Normal file
27
ext/geometry/00_init.js
Normal file
|
@ -0,0 +1,27 @@
|
|||
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
|
||||
|
||||
import { core } from "ext:core/mod.js";
|
||||
|
||||
const lazyLoad = core.createLazyLoader("ext:deno_geometry/01_geometry.js");
|
||||
|
||||
let geometry;
|
||||
|
||||
/**
|
||||
* @param {(transformList: string, prefix: string) => { matrix: Float64Array, is2D: boolean }} transformListParser
|
||||
* @param {boolean} enableWindowFeatures
|
||||
*/
|
||||
export function createGeometryLoader(
|
||||
transformListParser,
|
||||
enableWindowFeatures,
|
||||
) {
|
||||
return () => {
|
||||
if (geometry !== undefined) {
|
||||
return geometry;
|
||||
}
|
||||
|
||||
geometry = lazyLoad();
|
||||
geometry.init(transformListParser, enableWindowFeatures);
|
||||
|
||||
return geometry;
|
||||
};
|
||||
}
|
2117
ext/geometry/01_geometry.js
Normal file
2117
ext/geometry/01_geometry.js
Normal file
File diff suppressed because it is too large
Load diff
18
ext/geometry/Cargo.toml
Normal file
18
ext/geometry/Cargo.toml
Normal file
|
@ -0,0 +1,18 @@
|
|||
# Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
|
||||
|
||||
[package]
|
||||
name = "deno_geometry"
|
||||
version = "0.1.0"
|
||||
authors.workspace = true
|
||||
edition.workspace = true
|
||||
license.workspace = true
|
||||
readme = "README.md"
|
||||
repository.workspace = true
|
||||
description = "Geometry Interfaces Module API implementation for Deno"
|
||||
|
||||
[lib]
|
||||
path = "lib.rs"
|
||||
|
||||
[dependencies]
|
||||
deno_core.workspace = true
|
||||
nalgebra.workspace = true
|
108
ext/geometry/README.md
Normal file
108
ext/geometry/README.md
Normal file
|
@ -0,0 +1,108 @@
|
|||
# deno_geometry
|
||||
|
||||
This crate implements the Geometry Interfaces Module API.
|
||||
|
||||
Spec: https://drafts.fxtf.org/geometry/
|
||||
|
||||
## Usage Example
|
||||
|
||||
From javascript, include the extension's source:
|
||||
|
||||
```javascript
|
||||
import { core } from "ext:core/mod.js";
|
||||
import { createGeometryLoader } from "ext:deno_geometry/00_init.js";
|
||||
```
|
||||
|
||||
For environments that do not have a CSS `<transform-list>` parser, such as Web Worker, configure as follows:
|
||||
|
||||
```javascript
|
||||
const loadGeometry = createGeometryLoader((_transformList, prefix) => {
|
||||
throw new TypeError(
|
||||
`${prefix}: Cannot parse CSS <transform-list> on Workers`,
|
||||
);
|
||||
}, /* enableWindowFeatures */ false);
|
||||
```
|
||||
|
||||
On the other hand, in environments with a CSS `<transform-list>` parser, you can configure as follows:
|
||||
|
||||
```javascript
|
||||
const loadGeometry = createGeometryLoader((transformList, prefix) => {
|
||||
try {
|
||||
// parse <transform-list> by yourself
|
||||
const { sequence, is2D } = parse(transformList);
|
||||
return {
|
||||
matrix: new Float64Array(sequence),
|
||||
is2D,
|
||||
};
|
||||
} catch {
|
||||
throw new TypeError(
|
||||
`${prefix}: Invalid <transform-list> string: ${transformList}`,
|
||||
);
|
||||
}
|
||||
}, /* enableWindowFeatures */ true);
|
||||
```
|
||||
|
||||
Then define to globalThis:
|
||||
|
||||
```javascript
|
||||
Object.defineProperties(globalThis, {
|
||||
DOMMatrix: core.propNonEnumerableLazyLoaded(
|
||||
(geometry) => geometry.DOMMatrix,
|
||||
loadGeometry,
|
||||
),
|
||||
DOMMatrixReadOnly: core.propNonEnumerableLazyLoaded(
|
||||
(geometry) => geometry.DOMMatrixReadOnly,
|
||||
loadGeometry,
|
||||
),
|
||||
DOMPoint: core.propNonEnumerableLazyLoaded(
|
||||
(geometry) => geometry.DOMPoint,
|
||||
loadGeometry,
|
||||
),
|
||||
DOMPointReadOnly: core.propNonEnumerableLazyLoaded(
|
||||
(geometry) => geometry.DOMPointReadOnly,
|
||||
loadGeometry,
|
||||
),
|
||||
DOMQuad: core.propNonEnumerableLazyLoaded(
|
||||
(geometry) => geometry.DOMQuad,
|
||||
loadGeometry,
|
||||
),
|
||||
DOMRect: core.propNonEnumerableLazyLoaded(
|
||||
(geometry) => geometry.DOMRect,
|
||||
loadGeometry,
|
||||
),
|
||||
DOMRectReadOnly: core.propNonEnumerableLazyLoaded(
|
||||
(geometry) => geometry.DOMRectReadOnly,
|
||||
loadGeometry,
|
||||
),
|
||||
});
|
||||
```
|
||||
|
||||
Then from rust, provide:
|
||||
`deno_geometry::deno_geometry::init_ops_and_esm()` in the `extensions`
|
||||
field of your `RuntimeOptions`
|
||||
|
||||
## Dependencies
|
||||
|
||||
- **deno_webidl**: Provided by the `deno_webidl` crate
|
||||
- **deno_web**: Provided by the `deno_web` crate
|
||||
- **deno_console**: Provided by the `deno_console` crate
|
||||
|
||||
## Provided ops
|
||||
|
||||
Following ops are provided, which can be accessed through `Deno.ops`:
|
||||
|
||||
- op_geometry_translate_self
|
||||
- op_geometry_scale_self
|
||||
- op_geometry_scale_with_origin_self
|
||||
- op_geometry_rotate_self
|
||||
- op_geometry_rotate_from_vector_self
|
||||
- op_geometry_rotate_axis_angle_self
|
||||
- op_geometry_skew_self
|
||||
- op_geometry_multiply
|
||||
- op_geometry_multiply_self
|
||||
- op_geometry_premultiply_self
|
||||
- op_geometry_flip_x_self
|
||||
- op_geometry_flip_y_self
|
||||
- op_geometry_invert_self
|
||||
- op_geometry_invert_2d_self
|
||||
- op_geometry_premultiply_point_self
|
602
ext/geometry/lib.deno_geometry.d.ts
vendored
Normal file
602
ext/geometry/lib.deno_geometry.d.ts
vendored
Normal file
|
@ -0,0 +1,602 @@
|
|||
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
|
||||
|
||||
// deno-lint-ignore-file no-var
|
||||
|
||||
/// <reference no-default-lib="true" />
|
||||
/// <reference lib="esnext" />
|
||||
|
||||
/** @category Geometry Interfaces Module API */
|
||||
declare interface DOMMatrix2DInit {
|
||||
a?: number;
|
||||
b?: number;
|
||||
c?: number;
|
||||
d?: number;
|
||||
e?: number;
|
||||
f?: number;
|
||||
m11?: number;
|
||||
m12?: number;
|
||||
m21?: number;
|
||||
m22?: number;
|
||||
m41?: number;
|
||||
m42?: number;
|
||||
}
|
||||
|
||||
/** @category Geometry Interfaces Module API */
|
||||
declare interface DOMMatrixInit extends DOMMatrix2DInit {
|
||||
is2D?: boolean;
|
||||
m13?: number;
|
||||
m14?: number;
|
||||
m23?: number;
|
||||
m24?: number;
|
||||
m31?: number;
|
||||
m32?: number;
|
||||
m33?: number;
|
||||
m34?: number;
|
||||
m43?: number;
|
||||
m44?: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* A 4×4 matrix (column-major order), suitable for 2D and 3D operations including rotation and translation.
|
||||
* [MDN](https://developer.mozilla.org/docs/Web/API/DOMMatrix)
|
||||
*
|
||||
* ```
|
||||
* | m11 m21 m31 m41 |
|
||||
* | m12 m22 m32 m42 |
|
||||
* | m13 m23 m33 m43 |
|
||||
* | m14 m24 m34 m44 |
|
||||
* ```
|
||||
*
|
||||
* @category Geometry Interfaces Module API
|
||||
*/
|
||||
declare interface DOMMatrix extends DOMMatrixReadOnly {
|
||||
a: number;
|
||||
b: number;
|
||||
c: number;
|
||||
d: number;
|
||||
e: number;
|
||||
f: number;
|
||||
m11: number;
|
||||
m12: number;
|
||||
m13: number;
|
||||
m14: number;
|
||||
m21: number;
|
||||
m22: number;
|
||||
m23: number;
|
||||
m24: number;
|
||||
m31: number;
|
||||
m32: number;
|
||||
m33: number;
|
||||
m34: number;
|
||||
m41: number;
|
||||
m42: number;
|
||||
m43: number;
|
||||
m44: number;
|
||||
/**
|
||||
* Modifies the matrix by inverting it.
|
||||
* If the matrix can't be inverted, its components are all set to `NaN`, and is2D property is set to `false`.
|
||||
*/
|
||||
invertSelf(): DOMMatrix;
|
||||
/**
|
||||
* Modifies the matrix by post-multiplying it with the specified DOMMatrix.
|
||||
* This is equivalent to the dot product `A⋅B`, where matrix `A` is the source matrix and `B` is the matrix given as an input to the method.
|
||||
*
|
||||
* @param other
|
||||
*/
|
||||
multiplySelf(other?: DOMMatrixInit): DOMMatrix;
|
||||
/**
|
||||
* Modifies the matrix by pre-multiplying it with the specified DOMMatrix.
|
||||
* This is equivalent to the dot product B⋅A, where matrix `A` is the source matrix and `B` is the matrix given as an input to the method.
|
||||
*
|
||||
* @param other
|
||||
*/
|
||||
preMultiplySelf(other?: DOMMatrixInit): DOMMatrix;
|
||||
/**
|
||||
* Modifies the matrix by rotating it by the specified angle around the given vector.
|
||||
*
|
||||
* @param x
|
||||
* @param y
|
||||
* @param z
|
||||
* @param angle in degrees
|
||||
*/
|
||||
rotateAxisAngleSelf(
|
||||
x?: number,
|
||||
y?: number,
|
||||
z?: number,
|
||||
angle?: number,
|
||||
): DOMMatrix;
|
||||
/**
|
||||
* Modifies the matrix by rotating it by the angle between the specified vector and `(1, 0)`.
|
||||
*
|
||||
* @param x
|
||||
* @param y
|
||||
*/
|
||||
rotateFromVectorSelf(x?: number, y?: number): DOMMatrix;
|
||||
/**
|
||||
* Modifies the matrix by rotating itself around each axis by the specified number of degrees.
|
||||
*
|
||||
* @param rotZ yaw angle in degrees
|
||||
*/
|
||||
rotateSelf(rotZ?: number): DOMMatrix;
|
||||
/**
|
||||
* Modifies the matrix by rotating itself around each axis by the specified number of degrees.
|
||||
*
|
||||
* @param rotX roll angle in degrees
|
||||
* @param rotY pitch angle in degrees
|
||||
* @param rotZ yaw angle in degrees
|
||||
*/
|
||||
rotateSelf(rotX?: number, rotY?: number, rotZ?: number): DOMMatrix;
|
||||
/**
|
||||
* Modifies the matrix by applying the specified scaling factor to all three axes, centered on the given origin.
|
||||
*
|
||||
* @param scale
|
||||
* @param originX
|
||||
* @param originY
|
||||
* @param originZ
|
||||
*/
|
||||
scale3dSelf(
|
||||
scale?: number,
|
||||
originX?: number,
|
||||
originY?: number,
|
||||
originZ?: number,
|
||||
): DOMMatrix;
|
||||
/**
|
||||
* Modifies the matrix by applying the specified scaling factors, with the center located at the specified origin. Also returns itself.
|
||||
* By default, the X and Z axes are scaled by `1` and the Y axis is given the same scaling value as the X axis.
|
||||
* The default origin is `(0, 0, 0)`.
|
||||
*
|
||||
* @param scaleX
|
||||
* @param scaleY
|
||||
* @param scaleZ
|
||||
* @param originX
|
||||
* @param originY
|
||||
* @param originZ
|
||||
*/
|
||||
scaleSelf(
|
||||
scaleX?: number,
|
||||
scaleY?: number,
|
||||
scaleZ?: number,
|
||||
originX?: number,
|
||||
originY?: number,
|
||||
originZ?: number,
|
||||
): DOMMatrix;
|
||||
/**
|
||||
* NOTE: Not available in Worker
|
||||
*
|
||||
* Replaces the contents of the matrix with the matrix described by the specified transform or transforms.
|
||||
*
|
||||
* @param transformList
|
||||
*/
|
||||
setMatrixValue(transformList: string): DOMMatrix;
|
||||
/**
|
||||
* Modifies the matrix by applying the specified skew transformation along the X-axis.
|
||||
*
|
||||
* @param sx in degrees
|
||||
*/
|
||||
skewXSelf(sx?: number): DOMMatrix;
|
||||
/**
|
||||
* Modifies the matrix by applying the specified skew transformation along the Y-axis.
|
||||
*
|
||||
* @param sy in degrees
|
||||
*/
|
||||
skewYSelf(sy?: number): DOMMatrix;
|
||||
/**
|
||||
* Modifies the matrix by applying the specified vector. The default vector is `(0, 0, 0)`.
|
||||
*
|
||||
* @param tx
|
||||
* @param ty
|
||||
* @param tz
|
||||
*/
|
||||
translateSelf(tx?: number, ty?: number, tz?: number): DOMMatrix;
|
||||
}
|
||||
|
||||
/**
|
||||
* A 4×4 matrix (column-major order), suitable for 2D and 3D operations including rotation and translation.
|
||||
* [MDN](https://developer.mozilla.org/docs/Web/API/DOMMatrix)
|
||||
*
|
||||
* ```
|
||||
* | m11 m21 m31 m41 |
|
||||
* | m12 m22 m32 m42 |
|
||||
* | m13 m23 m33 m43 |
|
||||
* | m14 m24 m34 m44 |
|
||||
* ```
|
||||
*
|
||||
* @category Geometry Interfaces Module API
|
||||
*/
|
||||
declare var DOMMatrix: {
|
||||
prototype: DOMMatrix;
|
||||
new (init?: number[]): DOMMatrix;
|
||||
new (init: DOMMatrix | DOMMatrixReadOnly): DOMMatrix;
|
||||
/** NOTE: Not available in Worker */
|
||||
new (init: string): DOMMatrix;
|
||||
fromFloat32Array(array32: Float32Array): DOMMatrix;
|
||||
fromFloat64Array(array64: Float64Array): DOMMatrix;
|
||||
fromMatrix(other?: DOMMatrixInit): DOMMatrix;
|
||||
};
|
||||
|
||||
/**
|
||||
* A read-only 4×4 matrix (column-major order), suitable for 2D and 3D operations including rotation and translation.
|
||||
* [MDN](https://developer.mozilla.org/docs/Web/API/DOMMatrixReadOnly)
|
||||
*
|
||||
* ```
|
||||
* | m11 m21 m31 m41 |
|
||||
* | m12 m22 m32 m42 |
|
||||
* | m13 m23 m33 m43 |
|
||||
* | m14 m24 m34 m44 |
|
||||
* ```
|
||||
*
|
||||
* @category Geometry Interfaces Module API
|
||||
*/
|
||||
declare interface DOMMatrixReadOnly {
|
||||
readonly a: number;
|
||||
readonly b: number;
|
||||
readonly c: number;
|
||||
readonly d: number;
|
||||
readonly e: number;
|
||||
readonly f: number;
|
||||
readonly is2D: boolean;
|
||||
readonly isIdentity: boolean;
|
||||
readonly m11: number;
|
||||
readonly m12: number;
|
||||
readonly m13: number;
|
||||
readonly m14: number;
|
||||
readonly m21: number;
|
||||
readonly m22: number;
|
||||
readonly m23: number;
|
||||
readonly m24: number;
|
||||
readonly m31: number;
|
||||
readonly m32: number;
|
||||
readonly m33: number;
|
||||
readonly m34: number;
|
||||
readonly m41: number;
|
||||
readonly m42: number;
|
||||
readonly m43: number;
|
||||
readonly m44: number;
|
||||
/** Returns a new `DOMMatrix` created by flipping the source matrix around its X-axis. */
|
||||
flipX(): DOMMatrix;
|
||||
/** Returns a new `DOMMatrix` created by flipping the source matrix around its Y-axis. */
|
||||
flipY(): DOMMatrix;
|
||||
/**
|
||||
* Returns a new `DOMMatrix` created by inverting the source matrix.
|
||||
* If the matrix cannot be inverted, the new matrix's components are all set to `NaN` and its is2D property is set to `false`.
|
||||
*/
|
||||
inverse(): DOMMatrix;
|
||||
/**
|
||||
* Returns a new `DOMMatrix` created by computing the dot product of the source matrix and the specified matrix: `A⋅B`.
|
||||
*
|
||||
* @param other
|
||||
*/
|
||||
multiply(other?: DOMMatrixInit): DOMMatrix;
|
||||
/**
|
||||
* Returns a new `DOMMatrix` created by rotating the source matrix around each of its axes by the specified number of degrees.
|
||||
*
|
||||
* @param rotZ yaw angle in degrees
|
||||
*/
|
||||
rotate(rotZ?: number): DOMMatrix;
|
||||
/**
|
||||
* Returns a new `DOMMatrix` created by rotating the source matrix around each of its axes by the specified number of degrees.
|
||||
*
|
||||
* @param rotX roll angle in degrees
|
||||
* @param rotY pitch angle in degrees
|
||||
* @param rotZ yaw angle in degrees
|
||||
*/
|
||||
rotate(rotX?: number, rotY?: number, rotZ?: number): DOMMatrix;
|
||||
/**
|
||||
* Returns a new DOMMatrix created by rotating the source matrix by the given angle around the specified vector.
|
||||
*
|
||||
* @param x
|
||||
* @param y
|
||||
* @param z
|
||||
* @param angle in degrees
|
||||
*/
|
||||
rotateAxisAngle(
|
||||
x?: number,
|
||||
y?: number,
|
||||
z?: number,
|
||||
angle?: number,
|
||||
): DOMMatrix;
|
||||
/**
|
||||
* Returns a new `DOMMatrix` created by rotating the source matrix by the angle between the specified vector and `(1, 0)`.
|
||||
*
|
||||
* @param x
|
||||
* @param y
|
||||
*/
|
||||
rotateFromVector(x?: number, y?: number): DOMMatrix;
|
||||
/**
|
||||
* Returns a new `DOMMatrix` created by scaling the source matrix by the amount specified for each axis, centered on the given origin.
|
||||
* By default, the X and Z axes are scaled by `1` and the Y axis is given the same scaling value as the X axis.
|
||||
* The default origin is `(0, 0, 0)`.
|
||||
*
|
||||
* @param scaleX
|
||||
* @param scaleY
|
||||
* @param scaleZ
|
||||
* @param originX
|
||||
* @param originY
|
||||
* @param originZ
|
||||
*/
|
||||
scale(
|
||||
scaleX?: number,
|
||||
scaleY?: number,
|
||||
scaleZ?: number,
|
||||
originX?: number,
|
||||
originY?: number,
|
||||
originZ?: number,
|
||||
): DOMMatrix;
|
||||
/**
|
||||
* Returns a new `DOMMatrix` created by scaling the source 3D matrix by the given factor along all its axes, centered on the specified origin point.
|
||||
* The default origin is `(0, 0, 0)`.
|
||||
*
|
||||
* @param scale
|
||||
* @param originX
|
||||
* @param originY
|
||||
* @param originZ
|
||||
*/
|
||||
scale3d(
|
||||
scale?: number,
|
||||
originX?: number,
|
||||
originY?: number,
|
||||
originZ?: number,
|
||||
): DOMMatrix;
|
||||
/**
|
||||
* Returns a new `DOMMatrix` created by applying the specified scaling on the X, Y, and Z axes, centered at the given origin.
|
||||
* By default, the X and Y axes' scaling factors are both `1`.
|
||||
*
|
||||
* @deprecated Supported for legacy reasons to be compatible with `SVGMatrix` as defined in SVG 1.1. Use `scale()` instead.
|
||||
*
|
||||
* @param scaleX
|
||||
* @param scaleY
|
||||
*/
|
||||
scaleNonUniform(scaleX?: number, scaleY?: number): DOMMatrix;
|
||||
/**
|
||||
* Returns a new DOMMatrix created by applying the specified skew transformation to the source matrix along its X-axis.
|
||||
*
|
||||
* @param sx in degrees
|
||||
*/
|
||||
skewX(sx?: number): DOMMatrix;
|
||||
/**
|
||||
* Returns a new DOMMatrix created by applying the specified skew transformation to the source matrix along its Y-axis.
|
||||
*
|
||||
* @param sy in degrees
|
||||
*/
|
||||
skewY(sy?: number): DOMMatrix;
|
||||
toFloat32Array(): Float32Array;
|
||||
toFloat64Array(): Float64Array;
|
||||
toJSON(): {
|
||||
a: number;
|
||||
b: number;
|
||||
c: number;
|
||||
d: number;
|
||||
e: number;
|
||||
f: number;
|
||||
is2D: boolean;
|
||||
isIdentity: boolean;
|
||||
m11: number;
|
||||
m12: number;
|
||||
m13: number;
|
||||
m14: number;
|
||||
m21: number;
|
||||
m22: number;
|
||||
m23: number;
|
||||
m24: number;
|
||||
m31: number;
|
||||
m32: number;
|
||||
m33: number;
|
||||
m34: number;
|
||||
m41: number;
|
||||
m42: number;
|
||||
m43: number;
|
||||
m44: number;
|
||||
};
|
||||
transformPoint(point?: DOMPointInit): DOMPoint;
|
||||
translate(tx?: number, ty?: number, tz?: number): DOMMatrix;
|
||||
/** NOTE: Not available in Worker */
|
||||
toString(): string;
|
||||
}
|
||||
|
||||
/**
|
||||
* A read-only 4×4 matrix (column-major order), suitable for 2D and 3D operations including rotation and translation.
|
||||
* [MDN](https://developer.mozilla.org/docs/Web/API/DOMMatrixReadOnly)
|
||||
*
|
||||
* ```
|
||||
* | m11 m21 m31 m41 |
|
||||
* | m12 m22 m32 m42 |
|
||||
* | m13 m23 m33 m43 |
|
||||
* | m14 m24 m34 m44 |
|
||||
* ```
|
||||
*
|
||||
* @category Geometry Interfaces Module API
|
||||
*/
|
||||
declare var DOMMatrixReadOnly: {
|
||||
prototype: DOMMatrixReadOnly;
|
||||
new (init?: number[]): DOMMatrixReadOnly;
|
||||
new (init: DOMMatrix | DOMMatrixReadOnly): DOMMatrixReadOnly;
|
||||
/** Not available in Worker */
|
||||
new (init: string): DOMMatrixReadOnly;
|
||||
fromFloat32Array(array32: Float32Array): DOMMatrixReadOnly;
|
||||
fromFloat64Array(array64: Float64Array): DOMMatrixReadOnly;
|
||||
fromMatrix(other?: DOMMatrixInit): DOMMatrixReadOnly;
|
||||
};
|
||||
|
||||
/** @category Geometry Interfaces Module API */
|
||||
declare interface DOMPointInit {
|
||||
w?: number;
|
||||
x?: number;
|
||||
y?: number;
|
||||
z?: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* A object represents a 2D or 3D point in a coordinate system; it includes values for the coordinates in up to three dimensions, as well as an optional perspective value.
|
||||
* [MDN](https://developer.mozilla.org/docs/Web/API/DOMPoint)
|
||||
*
|
||||
* @category Geometry Interfaces Module API
|
||||
*/
|
||||
declare interface DOMPoint extends DOMPointReadOnly {
|
||||
w: number;
|
||||
x: number;
|
||||
y: number;
|
||||
z: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* A object represents a 2D or 3D point in a coordinate system; it includes values for the coordinates in up to three dimensions, as well as an optional perspective value.
|
||||
* [MDN](https://developer.mozilla.org/docs/Web/API/DOMPoint)
|
||||
*
|
||||
* @category Geometry Interfaces Module API
|
||||
*/
|
||||
declare var DOMPoint: {
|
||||
prototype: DOMPoint;
|
||||
new (x?: number, y?: number, z?: number, w?: number): DOMPoint;
|
||||
fromPoint(other?: DOMPointInit): DOMPoint;
|
||||
};
|
||||
|
||||
/**
|
||||
* A read-only object represents a 2D or 3D point in a coordinate system; it includes values for the coordinates in up to three dimensions, as well as an optional perspective value.
|
||||
* [MDN](https://developer.mozilla.org/docs/Web/API/DOMPointReadOnly)
|
||||
*
|
||||
* @category Geometry Interfaces Module API
|
||||
*/
|
||||
declare interface DOMPointReadOnly {
|
||||
readonly w: number;
|
||||
readonly x: number;
|
||||
readonly y: number;
|
||||
readonly z: number;
|
||||
matrixTransform(matrix?: DOMMatrixInit): DOMPoint;
|
||||
toJSON(): {
|
||||
w: number;
|
||||
x: number;
|
||||
y: number;
|
||||
z: number;
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* A read-only object represents a 2D or 3D point in a coordinate system; it includes values for the coordinates in up to three dimensions, as well as an optional perspective value.
|
||||
* [MDN](https://developer.mozilla.org/docs/Web/API/DOMPointReadOnly)
|
||||
*
|
||||
* @category Geometry Interfaces Module API
|
||||
*/
|
||||
declare var DOMPointReadOnly: {
|
||||
prototype: DOMPointReadOnly;
|
||||
new (x?: number, y?: number, z?: number, w?: number): DOMPointReadOnly;
|
||||
fromPoint(other?: DOMPointInit): DOMPointReadOnly;
|
||||
};
|
||||
|
||||
/** @category Geometry Interfaces Module API */
|
||||
declare interface DOMQuadInit {
|
||||
p1?: DOMPointInit;
|
||||
p2?: DOMPointInit;
|
||||
p3?: DOMPointInit;
|
||||
p4?: DOMPointInit;
|
||||
}
|
||||
|
||||
/**
|
||||
* A collection of four DOMPoints defining the corners of an arbitrary quadrilateral.
|
||||
* [MDN](https://developer.mozilla.org/docs/Web/API/DOMQuad)
|
||||
*
|
||||
* @category Geometry Interfaces Module API
|
||||
*/
|
||||
declare interface DOMQuad {
|
||||
readonly p1: DOMPoint;
|
||||
readonly p2: DOMPoint;
|
||||
readonly p3: DOMPoint;
|
||||
readonly p4: DOMPoint;
|
||||
getBounds(): DOMRect;
|
||||
toJSON(): {
|
||||
p1: DOMPoint;
|
||||
p2: DOMPoint;
|
||||
p3: DOMPoint;
|
||||
p4: DOMPoint;
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* A collection of four DOMPoints defining the corners of an arbitrary quadrilateral.
|
||||
* [MDN](https://developer.mozilla.org/docs/Web/API/DOMQuad)
|
||||
*
|
||||
* @category Geometry Interfaces Module API
|
||||
*/
|
||||
declare var DOMQuad: {
|
||||
prototype: DOMQuad;
|
||||
new (
|
||||
p1?: DOMPointInit,
|
||||
p2?: DOMPointInit,
|
||||
p3?: DOMPointInit,
|
||||
p4?: DOMPointInit,
|
||||
): DOMQuad;
|
||||
fromQuad(other?: DOMQuadInit): DOMQuad;
|
||||
fromRect(other?: DOMRectInit): DOMQuad;
|
||||
};
|
||||
|
||||
/** @category Geometry Interfaces Module API */
|
||||
declare interface DOMRectInit {
|
||||
height?: number;
|
||||
width?: number;
|
||||
x?: number;
|
||||
y?: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* [MDN](https://developer.mozilla.org/docs/Web/API/DOMRect)
|
||||
*
|
||||
* @category Geometry Interfaces Module API
|
||||
*/
|
||||
declare interface DOMRect extends DOMRectReadOnly {
|
||||
height: number;
|
||||
width: number;
|
||||
x: number;
|
||||
y: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* [MDN](https://developer.mozilla.org/docs/Web/API/DOMRect)
|
||||
*
|
||||
* @category Geometry Interfaces Module API
|
||||
*/
|
||||
declare var DOMRect: {
|
||||
prototype: DOMRect;
|
||||
new (x?: number, y?: number, width?: number, height?: number): DOMRect;
|
||||
fromRect(other?: DOMRectInit): DOMRect;
|
||||
};
|
||||
|
||||
/**
|
||||
* [MDN](https://developer.mozilla.org/docs/Web/API/DOMRectReadOnly)
|
||||
*
|
||||
* @category Geometry Interfaces Module API
|
||||
*/
|
||||
declare interface DOMRectReadOnly {
|
||||
readonly bottom: number;
|
||||
readonly height: number;
|
||||
readonly left: number;
|
||||
readonly right: number;
|
||||
readonly top: number;
|
||||
readonly width: number;
|
||||
readonly x: number;
|
||||
readonly y: number;
|
||||
toJSON(): {
|
||||
bottom: number;
|
||||
height: number;
|
||||
left: number;
|
||||
right: number;
|
||||
top: number;
|
||||
width: number;
|
||||
x: number;
|
||||
y: number;
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* [MDN](https://developer.mozilla.org/docs/Web/API/DOMRectReadOnly)
|
||||
*
|
||||
* @category Geometry Interfaces Module API
|
||||
*/
|
||||
declare var DOMRectReadOnly: {
|
||||
prototype: DOMRectReadOnly;
|
||||
new (
|
||||
x?: number,
|
||||
y?: number,
|
||||
width?: number,
|
||||
height?: number,
|
||||
): DOMRectReadOnly;
|
||||
fromRect(other?: DOMRectInit): DOMRectReadOnly;
|
||||
};
|
269
ext/geometry/lib.rs
Normal file
269
ext/geometry/lib.rs
Normal file
|
@ -0,0 +1,269 @@
|
|||
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
|
||||
|
||||
use deno_core::op2;
|
||||
use nalgebra::Matrix3;
|
||||
use nalgebra::Matrix4;
|
||||
use nalgebra::Matrix4x2;
|
||||
use nalgebra::Matrix4x3;
|
||||
use nalgebra::MatrixView4;
|
||||
use nalgebra::MatrixViewMut4;
|
||||
use nalgebra::Rotation3;
|
||||
use nalgebra::UnitVector3;
|
||||
use nalgebra::Vector3;
|
||||
use nalgebra::Vector4;
|
||||
use nalgebra::VectorViewMut4;
|
||||
use std::path::PathBuf;
|
||||
|
||||
deno_core::extension!(
|
||||
deno_geometry,
|
||||
deps = [deno_webidl, deno_web, deno_console],
|
||||
ops = [
|
||||
op_geometry_translate_self,
|
||||
op_geometry_scale_self,
|
||||
op_geometry_scale_with_origin_self,
|
||||
op_geometry_rotate_self,
|
||||
op_geometry_rotate_from_vector_self,
|
||||
op_geometry_rotate_axis_angle_self,
|
||||
op_geometry_skew_self,
|
||||
op_geometry_multiply,
|
||||
op_geometry_multiply_self,
|
||||
op_geometry_premultiply_self,
|
||||
op_geometry_flip_x_self,
|
||||
op_geometry_flip_y_self,
|
||||
op_geometry_invert_self,
|
||||
op_geometry_invert_2d_self,
|
||||
op_geometry_premultiply_point_self,
|
||||
],
|
||||
esm = ["00_init.js"],
|
||||
lazy_loaded_esm = ["01_geometry.js"],
|
||||
);
|
||||
|
||||
pub fn get_declaration() -> PathBuf {
|
||||
PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("lib.deno_geometry.d.ts")
|
||||
}
|
||||
|
||||
#[op2(fast)]
|
||||
pub fn op_geometry_translate_self(
|
||||
x: f64,
|
||||
y: f64,
|
||||
z: f64,
|
||||
#[buffer] inout: &mut [f64],
|
||||
) {
|
||||
let shift = Vector3::new(x, y, z);
|
||||
let mut inout = MatrixViewMut4::from_slice(inout);
|
||||
inout.prepend_translation_mut(&shift);
|
||||
}
|
||||
|
||||
#[op2(fast)]
|
||||
pub fn op_geometry_scale_self(
|
||||
x: f64,
|
||||
y: f64,
|
||||
z: f64,
|
||||
#[buffer] inout: &mut [f64],
|
||||
) {
|
||||
let scaling = Vector3::new(x, y, z);
|
||||
let mut inout = MatrixViewMut4::from_slice(inout);
|
||||
inout.prepend_nonuniform_scaling_mut(&scaling);
|
||||
}
|
||||
|
||||
#[op2(fast)]
|
||||
pub fn op_geometry_scale_with_origin_self(
|
||||
x: f64,
|
||||
y: f64,
|
||||
z: f64,
|
||||
origin_x: f64,
|
||||
origin_y: f64,
|
||||
origin_z: f64,
|
||||
#[buffer] inout: &mut [f64],
|
||||
) {
|
||||
let scaling = Vector3::new(x, y, z);
|
||||
let mut shift = Vector3::new(origin_x, origin_y, origin_z);
|
||||
let mut inout = MatrixViewMut4::from_slice(inout);
|
||||
inout.prepend_translation_mut(&shift);
|
||||
inout.prepend_nonuniform_scaling_mut(&scaling);
|
||||
shift.neg_mut();
|
||||
inout.prepend_translation_mut(&shift);
|
||||
}
|
||||
|
||||
#[op2(fast)]
|
||||
pub fn op_geometry_rotate_self(
|
||||
roll_degrees: f64,
|
||||
pitch_degrees: f64,
|
||||
yaw_degrees: f64,
|
||||
#[buffer] inout: &mut [f64],
|
||||
) {
|
||||
let rotation = Rotation3::from_euler_angles(
|
||||
roll_degrees.to_radians(),
|
||||
pitch_degrees.to_radians(),
|
||||
yaw_degrees.to_radians(),
|
||||
)
|
||||
.to_homogeneous();
|
||||
let mut inout = MatrixViewMut4::from_slice(inout);
|
||||
let mut result = Matrix4x3::zeros();
|
||||
inout.mul_to(&rotation.fixed_view::<4, 3>(0, 0), &mut result);
|
||||
inout.set_column(0, &result.column(0));
|
||||
inout.set_column(1, &result.column(1));
|
||||
inout.set_column(2, &result.column(2));
|
||||
}
|
||||
|
||||
#[op2(fast)]
|
||||
pub fn op_geometry_rotate_from_vector_self(
|
||||
x: f64,
|
||||
y: f64,
|
||||
#[buffer] inout: &mut [f64],
|
||||
) {
|
||||
let rotation =
|
||||
Rotation3::from_axis_angle(&Vector3::z_axis(), y.atan2(x)).to_homogeneous();
|
||||
let mut inout = MatrixViewMut4::from_slice(inout);
|
||||
let mut result = Matrix4x3::zeros();
|
||||
inout.mul_to(&rotation.fixed_view::<4, 3>(0, 0), &mut result);
|
||||
inout.set_column(0, &result.column(0));
|
||||
inout.set_column(1, &result.column(1));
|
||||
inout.set_column(2, &result.column(2));
|
||||
}
|
||||
|
||||
#[op2(fast)]
|
||||
pub fn op_geometry_rotate_axis_angle_self(
|
||||
x: f64,
|
||||
y: f64,
|
||||
z: f64,
|
||||
angle_degrees: f64,
|
||||
#[buffer] inout: &mut [f64],
|
||||
) {
|
||||
let rotation = Rotation3::from_axis_angle(
|
||||
&UnitVector3::new_normalize(Vector3::new(x, y, z)),
|
||||
angle_degrees.to_radians(),
|
||||
)
|
||||
.to_homogeneous();
|
||||
let mut inout = MatrixViewMut4::from_slice(inout);
|
||||
let mut result = Matrix4x3::zeros();
|
||||
inout.mul_to(&rotation.fixed_view::<4, 3>(0, 0), &mut result);
|
||||
inout.set_column(0, &result.column(0));
|
||||
inout.set_column(1, &result.column(1));
|
||||
inout.set_column(2, &result.column(2));
|
||||
}
|
||||
|
||||
#[op2(fast)]
|
||||
pub fn op_geometry_skew_self(
|
||||
x_degrees: f64,
|
||||
y_degrees: f64,
|
||||
#[buffer] inout: &mut [f64],
|
||||
) {
|
||||
let skew = Matrix4x2::new(
|
||||
1.0,
|
||||
x_degrees.to_radians().tan(),
|
||||
y_degrees.to_radians().tan(),
|
||||
1.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
);
|
||||
let mut inout = MatrixViewMut4::from_slice(inout);
|
||||
let mut result = Matrix4x2::zeros();
|
||||
inout.mul_to(&skew, &mut result);
|
||||
inout.set_column(0, &result.column(0));
|
||||
inout.set_column(1, &result.column(1));
|
||||
}
|
||||
|
||||
#[op2(fast)]
|
||||
pub fn op_geometry_multiply(
|
||||
#[buffer] lhs: &[f64],
|
||||
#[buffer] rhs: &[f64],
|
||||
#[buffer] out: &mut [f64],
|
||||
) {
|
||||
let lhs = MatrixView4::from_slice(lhs);
|
||||
let rhs = MatrixView4::from_slice(rhs);
|
||||
let mut out = MatrixViewMut4::from_slice(out);
|
||||
lhs.mul_to(&rhs, &mut out);
|
||||
}
|
||||
|
||||
#[op2(fast)]
|
||||
pub fn op_geometry_multiply_self(
|
||||
#[buffer] rhs: &[f64],
|
||||
#[buffer] inout: &mut [f64],
|
||||
) {
|
||||
let rhs = MatrixView4::from_slice(rhs);
|
||||
let mut inout = MatrixViewMut4::from_slice(inout);
|
||||
let mut result = Matrix4::zeros();
|
||||
inout.mul_to(&rhs, &mut result);
|
||||
inout.copy_from(&result);
|
||||
}
|
||||
|
||||
#[op2(fast)]
|
||||
pub fn op_geometry_premultiply_self(
|
||||
#[buffer] lhs: &[f64],
|
||||
#[buffer] inout: &mut [f64],
|
||||
) {
|
||||
let lhs = MatrixView4::from_slice(lhs);
|
||||
let mut inout = MatrixViewMut4::from_slice(inout);
|
||||
let mut result = Matrix4::zeros();
|
||||
lhs.mul_to(&inout, &mut result);
|
||||
inout.copy_from(&result);
|
||||
}
|
||||
|
||||
#[op2(fast)]
|
||||
pub fn op_geometry_flip_x_self(#[buffer] inout: &mut [f64]) {
|
||||
let mut inout = MatrixViewMut4::from_slice(inout);
|
||||
inout.column_mut(0).neg_mut();
|
||||
}
|
||||
|
||||
#[op2(fast)]
|
||||
pub fn op_geometry_flip_y_self(#[buffer] inout: &mut [f64]) {
|
||||
let mut inout = MatrixViewMut4::from_slice(inout);
|
||||
inout.column_mut(1).neg_mut();
|
||||
}
|
||||
|
||||
#[op2(fast)]
|
||||
pub fn op_geometry_invert_self(#[buffer] inout: &mut [f64]) -> bool {
|
||||
if inout.iter().any(|&x| x.is_infinite()) {
|
||||
inout.fill(f64::NAN);
|
||||
return false;
|
||||
}
|
||||
|
||||
let mut inout = MatrixViewMut4::from_slice(inout);
|
||||
if !inout.try_inverse_mut() {
|
||||
inout.fill(f64::NAN);
|
||||
return false;
|
||||
}
|
||||
|
||||
true
|
||||
}
|
||||
|
||||
#[op2(fast)]
|
||||
pub fn op_geometry_invert_2d_self(#[buffer] inout: &mut [f64]) -> bool {
|
||||
if inout.iter().any(|&x| x.is_infinite()) {
|
||||
inout.fill(f64::NAN);
|
||||
return false;
|
||||
}
|
||||
|
||||
let mut matrix = Matrix3::new(
|
||||
inout[0], inout[4], inout[12], inout[1], inout[5], inout[13], 0.0, 0.0, 1.0,
|
||||
);
|
||||
if !matrix.try_inverse_mut() {
|
||||
inout.fill(f64::NAN);
|
||||
return false;
|
||||
}
|
||||
|
||||
let matrix = matrix.as_slice();
|
||||
inout[0] = matrix[0];
|
||||
inout[1] = matrix[1];
|
||||
inout[4] = matrix[3];
|
||||
inout[5] = matrix[4];
|
||||
inout[12] = matrix[6];
|
||||
inout[13] = matrix[7];
|
||||
|
||||
true
|
||||
}
|
||||
|
||||
#[op2(fast)]
|
||||
pub fn op_geometry_premultiply_point_self(
|
||||
#[buffer] lhs: &[f64],
|
||||
#[buffer] inout: &mut [f64],
|
||||
) {
|
||||
let lhs = MatrixView4::from_slice(lhs);
|
||||
let mut inout = VectorViewMut4::from_slice(inout);
|
||||
let mut result = Vector4::zeros();
|
||||
lhs.mul_to(&inout, &mut result);
|
||||
inout.copy_from(&result);
|
||||
}
|
|
@ -679,6 +679,9 @@ converters["UVString?"] = createNullableConverter(
|
|||
converters["sequence<double>"] = createSequenceConverter(
|
||||
converters.double,
|
||||
);
|
||||
converters["sequence<unrestricted double>"] = createSequenceConverter(
|
||||
converters["unrestricted double"],
|
||||
);
|
||||
converters["sequence<object>"] = createSequenceConverter(
|
||||
converters.object,
|
||||
);
|
||||
|
|
6
ext/webidl/internal.d.ts
vendored
6
ext/webidl/internal.d.ts
vendored
|
@ -348,6 +348,12 @@ declare module "ext:deno_webidl/00_webidl.js" {
|
|||
context?: string,
|
||||
opts?: any,
|
||||
): number[];
|
||||
["sequence<unrestricted double>"](
|
||||
v: any,
|
||||
prefix?: string,
|
||||
context?: string,
|
||||
opts?: any,
|
||||
): number[];
|
||||
|
||||
[type: string]: (
|
||||
v: any,
|
||||
|
|
|
@ -51,6 +51,7 @@ deno_crypto.workspace = true
|
|||
deno_fetch.workspace = true
|
||||
deno_ffi.workspace = true
|
||||
deno_fs = { workspace = true, features = ["sync_fs"] }
|
||||
deno_geometry.workspace = true
|
||||
deno_http.workspace = true
|
||||
deno_io.workspace = true
|
||||
deno_net.workspace = true
|
||||
|
@ -82,6 +83,7 @@ deno_crypto.workspace = true
|
|||
deno_fetch.workspace = true
|
||||
deno_ffi.workspace = true
|
||||
deno_fs = { workspace = true, features = ["sync_fs"] }
|
||||
deno_geometry.workspace = true
|
||||
deno_http.workspace = true
|
||||
deno_io.workspace = true
|
||||
deno_kv.workspace = true
|
||||
|
|
|
@ -7,18 +7,93 @@ import {
|
|||
op_bootstrap_user_agent,
|
||||
} from "ext:core/ops";
|
||||
const {
|
||||
ArrayPrototypeMap,
|
||||
ArrayPrototypeSome,
|
||||
Float64Array,
|
||||
Number,
|
||||
NumberIsNaN,
|
||||
ObjectDefineProperties,
|
||||
ObjectPrototypeIsPrototypeOf,
|
||||
SafeRegExp,
|
||||
StringPrototypeMatch,
|
||||
StringPrototypeSplit,
|
||||
SymbolFor,
|
||||
TypeError,
|
||||
} = primordials;
|
||||
|
||||
import * as location from "ext:deno_web/12_location.js";
|
||||
import * as console from "ext:deno_console/01_console.js";
|
||||
import * as webidl from "ext:deno_webidl/00_webidl.js";
|
||||
import { DOMException } from "ext:deno_web/01_dom_exception.js";
|
||||
import * as globalInterfaces from "ext:deno_web/04_global_interfaces.js";
|
||||
import * as webStorage from "ext:deno_webstorage/01_webstorage.js";
|
||||
import * as prompt from "ext:runtime/41_prompt.js";
|
||||
import { loadWebGPU } from "ext:deno_webgpu/00_init.js";
|
||||
import { createGeometryLoader } from "ext:deno_geometry/00_init.js";
|
||||
|
||||
const MATRIX_PATTERN = new SafeRegExp(
|
||||
/^\s*matrix(3d)?\(([-\+0-9.e,\s]+)\)\s*$/iu,
|
||||
);
|
||||
|
||||
const loadGeometry = createGeometryLoader((transformList, prefix) => {
|
||||
if (transformList === "") {
|
||||
return {
|
||||
// deno-fmt-ignore
|
||||
matrix: new Float64Array([
|
||||
1, 0, 0, 0,
|
||||
0, 1, 0, 0,
|
||||
0, 0, 1, 0,
|
||||
0, 0, 0, 1,
|
||||
]),
|
||||
is2D: true,
|
||||
};
|
||||
}
|
||||
|
||||
// Currently only parsing of a single matrix, matrix3d function without units
|
||||
// as arguments is implemented
|
||||
// TODO(petamoriken): Add CSS parser such as lightningcss to support more cases
|
||||
const matrixMatch = StringPrototypeMatch(transformList, MATRIX_PATTERN);
|
||||
if (matrixMatch !== null) {
|
||||
const is2D = matrixMatch[1] === undefined;
|
||||
/** @type {number[]} */
|
||||
const seq = ArrayPrototypeMap(
|
||||
StringPrototypeSplit(matrixMatch[2], ","),
|
||||
(str) => Number(str),
|
||||
);
|
||||
if (
|
||||
is2D && seq.length !== 6 ||
|
||||
!is2D && seq.length !== 16 ||
|
||||
ArrayPrototypeSome(seq, (num) => NumberIsNaN(num))
|
||||
) {
|
||||
throw new DOMException(
|
||||
`${prefix}: Failed to parse '${transformList}'`,
|
||||
"SyntaxError",
|
||||
);
|
||||
}
|
||||
if (is2D) {
|
||||
const { 0: a, 1: b, 2: c, 3: d, 4: e, 5: f } = seq;
|
||||
return {
|
||||
// deno-fmt-ignore
|
||||
matrix: new Float64Array([
|
||||
a, b, 0, 0,
|
||||
c, d, 0, 0,
|
||||
0, 0, 1, 0,
|
||||
e, f, 0, 1,
|
||||
]),
|
||||
is2D,
|
||||
};
|
||||
} else {
|
||||
return {
|
||||
matrix: new Float64Array(seq),
|
||||
is2D,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
throw new TypeError(
|
||||
`${prefix}: CSS <transform-list> parser is not fully implemented`,
|
||||
);
|
||||
}, true);
|
||||
|
||||
class Navigator {
|
||||
constructor() {
|
||||
|
@ -121,6 +196,34 @@ const mainRuntimeGlobalProperties = {
|
|||
localStorage: core.propGetterOnly(webStorage.localStorage),
|
||||
sessionStorage: core.propGetterOnly(webStorage.sessionStorage),
|
||||
Storage: core.propNonEnumerable(webStorage.Storage),
|
||||
DOMMatrix: core.propNonEnumerableLazyLoaded(
|
||||
(geometry) => geometry.DOMMatrix,
|
||||
loadGeometry,
|
||||
),
|
||||
DOMMatrixReadOnly: core.propNonEnumerableLazyLoaded(
|
||||
(geometry) => geometry.DOMMatrixReadOnly,
|
||||
loadGeometry,
|
||||
),
|
||||
DOMPoint: core.propNonEnumerableLazyLoaded(
|
||||
(geometry) => geometry.DOMPoint,
|
||||
loadGeometry,
|
||||
),
|
||||
DOMPointReadOnly: core.propNonEnumerableLazyLoaded(
|
||||
(geometry) => geometry.DOMPointReadOnly,
|
||||
loadGeometry,
|
||||
),
|
||||
DOMQuad: core.propNonEnumerableLazyLoaded(
|
||||
(geometry) => geometry.DOMQuad,
|
||||
loadGeometry,
|
||||
),
|
||||
DOMRect: core.propNonEnumerableLazyLoaded(
|
||||
(geometry) => geometry.DOMRect,
|
||||
loadGeometry,
|
||||
),
|
||||
DOMRectReadOnly: core.propNonEnumerableLazyLoaded(
|
||||
(geometry) => geometry.DOMRectReadOnly,
|
||||
loadGeometry,
|
||||
),
|
||||
};
|
||||
|
||||
export { mainRuntimeGlobalProperties, memoizeLazy };
|
||||
|
|
|
@ -10,6 +10,7 @@ const {
|
|||
ObjectDefineProperties,
|
||||
ObjectPrototypeIsPrototypeOf,
|
||||
SymbolFor,
|
||||
TypeError,
|
||||
} = primordials;
|
||||
|
||||
import * as location from "ext:deno_web/12_location.js";
|
||||
|
@ -17,6 +18,13 @@ import * as console from "ext:deno_console/01_console.js";
|
|||
import * as webidl from "ext:deno_webidl/00_webidl.js";
|
||||
import * as globalInterfaces from "ext:deno_web/04_global_interfaces.js";
|
||||
import { loadWebGPU } from "ext:deno_webgpu/00_init.js";
|
||||
import { createGeometryLoader } from "ext:deno_geometry/00_init.js";
|
||||
|
||||
const loadGeometry = createGeometryLoader((_transformList, prefix) => {
|
||||
throw new TypeError(
|
||||
`${prefix}: Cannot parse CSS <transform-list> on Workers`,
|
||||
);
|
||||
}, false);
|
||||
|
||||
function memoizeLazy(f) {
|
||||
let v_ = null;
|
||||
|
@ -115,6 +123,34 @@ const workerRuntimeGlobalProperties = {
|
|||
WorkerNavigator: core.propNonEnumerable(WorkerNavigator),
|
||||
navigator: core.propGetterOnly(() => workerNavigator),
|
||||
self: core.propGetterOnly(() => globalThis),
|
||||
DOMMatrix: core.propNonEnumerableLazyLoaded(
|
||||
(geometry) => geometry.DOMMatrix,
|
||||
loadGeometry,
|
||||
),
|
||||
DOMMatrixReadOnly: core.propNonEnumerableLazyLoaded(
|
||||
(geometry) => geometry.DOMMatrixReadOnly,
|
||||
loadGeometry,
|
||||
),
|
||||
DOMPoint: core.propNonEnumerableLazyLoaded(
|
||||
(geometry) => geometry.DOMPoint,
|
||||
loadGeometry,
|
||||
),
|
||||
DOMPointReadOnly: core.propNonEnumerableLazyLoaded(
|
||||
(geometry) => geometry.DOMPointReadOnly,
|
||||
loadGeometry,
|
||||
),
|
||||
DOMQuad: core.propNonEnumerableLazyLoaded(
|
||||
(geometry) => geometry.DOMQuad,
|
||||
loadGeometry,
|
||||
),
|
||||
DOMRect: core.propNonEnumerableLazyLoaded(
|
||||
(geometry) => geometry.DOMRect,
|
||||
loadGeometry,
|
||||
),
|
||||
DOMRectReadOnly: core.propNonEnumerableLazyLoaded(
|
||||
(geometry) => geometry.DOMRectReadOnly,
|
||||
loadGeometry,
|
||||
),
|
||||
};
|
||||
|
||||
export { workerRuntimeGlobalProperties };
|
||||
|
|
|
@ -10,6 +10,7 @@ pub use deno_crypto;
|
|||
pub use deno_fetch;
|
||||
pub use deno_ffi;
|
||||
pub use deno_fs;
|
||||
pub use deno_geometry;
|
||||
pub use deno_http;
|
||||
pub use deno_io;
|
||||
pub use deno_kv;
|
||||
|
|
|
@ -22,6 +22,7 @@ extension!(runtime,
|
|||
deno_web,
|
||||
deno_fetch,
|
||||
deno_cache,
|
||||
deno_geometry,
|
||||
deno_websocket,
|
||||
deno_webstorage,
|
||||
deno_crypto,
|
||||
|
|
|
@ -281,6 +281,7 @@ pub fn create_runtime_snapshot(
|
|||
deno_webgpu::deno_webgpu::init_ops_and_esm(),
|
||||
deno_canvas::deno_canvas::init_ops_and_esm(),
|
||||
deno_fetch::deno_fetch::init_ops_and_esm::<Permissions>(Default::default()),
|
||||
deno_geometry::deno_geometry::init_ops_and_esm(),
|
||||
deno_cache::deno_cache::init_ops_and_esm::<SqliteBackedCache>(None),
|
||||
deno_websocket::deno_websocket::init_ops_and_esm::<Permissions>(
|
||||
"".to_owned(),
|
||||
|
|
|
@ -462,6 +462,7 @@ impl WebWorker {
|
|||
..Default::default()
|
||||
},
|
||||
),
|
||||
deno_geometry::deno_geometry::init_ops_and_esm(),
|
||||
deno_cache::deno_cache::init_ops_and_esm::<SqliteBackedCache>(
|
||||
create_cache,
|
||||
),
|
||||
|
|
|
@ -372,6 +372,7 @@ impl MainWorker {
|
|||
..Default::default()
|
||||
},
|
||||
),
|
||||
deno_geometry::deno_geometry::init_ops_and_esm(),
|
||||
deno_cache::deno_cache::init_ops_and_esm::<SqliteBackedCache>(
|
||||
create_cache,
|
||||
),
|
||||
|
|
|
@ -39,6 +39,7 @@ util::unit_test_factory!(
|
|||
filereader_test,
|
||||
files_test,
|
||||
fs_events_test,
|
||||
geometry_test,
|
||||
get_random_values_test,
|
||||
globals_test,
|
||||
headers_test,
|
||||
|
|
1195
tests/unit/geometry_test.ts
Normal file
1195
tests/unit/geometry_test.ts
Normal file
File diff suppressed because it is too large
Load diff
|
@ -6,6 +6,7 @@ export { colors };
|
|||
import { join, resolve } from "@std/path";
|
||||
export {
|
||||
assert,
|
||||
assertAlmostEquals,
|
||||
assertEquals,
|
||||
assertFalse,
|
||||
AssertionError,
|
||||
|
|
|
@ -14231,12 +14231,215 @@
|
|||
"eventsource-constructor-stringify.window.html": false,
|
||||
"eventsource-cross-origin.window.html": false,
|
||||
"eventsource-reconnect.window.html": false,
|
||||
"request-status-error.window.html": false,
|
||||
"eventsource-constructor-empty-url.any.serviceworker.html": false,
|
||||
"eventsource-constructor-empty-url.any.sharedworker.html": false,
|
||||
"eventsource-constructor-url-bogus.any.serviceworker.html": false,
|
||||
"eventsource-constructor-url-bogus.any.sharedworker.html": false,
|
||||
"request-credentials.window.html": false,
|
||||
"request-redirect.window.html": false
|
||||
},
|
||||
"css": {
|
||||
"geometry": {
|
||||
"DOMMatrix-001.html": [
|
||||
"new DOMMatrix(\"none\")",
|
||||
"new DOMMatrix(\" none\")",
|
||||
"new DOMMatrix(\"none \")",
|
||||
"new DOMMatrix(\"NONE\")",
|
||||
"new DOMMatrix(\"none/**/\")",
|
||||
"new DOMMatrix(\"/**/none\")",
|
||||
"new DOMMatrix(\"scale(2) translateX(5px) translateY(5px)\")",
|
||||
"new DOMMatrix(\"scale(2, 2) translateX(5px) translateY(5px)\")",
|
||||
"new DOMMatrix(\"scale(2)translateX(5px)translateY(5px)\")",
|
||||
"new DOMMatrix(\"scale(2) translateX(calc(2 * 2.5px)) translateY(5px)\")",
|
||||
"new DOMMatrix(\"scale(2) translateX(5px) translateY(5px) rotate(5deg) rotate(-5deg)\")",
|
||||
"new DOMMatrix(\"translateX (5px)\")",
|
||||
"new DOMMatrix(\"scale(2 2) translateX(5) translateY(5)\")",
|
||||
"new DOMMatrix(\"scale(2, 2), translateX(5) ,translateY(5)\")",
|
||||
"new DOMMatrix(\"translateX(5em)\")",
|
||||
"new DOMMatrix(\"translateX(5ex)\")",
|
||||
"new DOMMatrix(\"translateX(5ch)\")",
|
||||
"new DOMMatrix(\"translateX(5rem)\")",
|
||||
"new DOMMatrix(\"translateX(5cqw)\")",
|
||||
"new DOMMatrix(\"translateX(5cqh)\")",
|
||||
"new DOMMatrix(\"translateX(5cqb)\")",
|
||||
"new DOMMatrix(\"translateX(5cqi)\")",
|
||||
"new DOMMatrix(\"translateX(5cqmin)\")",
|
||||
"new DOMMatrix(\"translateX(5cqmax)\")",
|
||||
"new DOMMatrix(\"translateX(5vw)\")",
|
||||
"new DOMMatrix(\"translateX(5vh)\")",
|
||||
"new DOMMatrix(\"translateX(5vb)\")",
|
||||
"new DOMMatrix(\"translateX(5vi)\")",
|
||||
"new DOMMatrix(\"translateX(5vmin)\")",
|
||||
"new DOMMatrix(\"translateX(5vmax)\")",
|
||||
"new DOMMatrix(\"translateX(5%)\")",
|
||||
"new DOMMatrix(\"rotate(5)\")",
|
||||
"new DOMMatrix(\"rotate(5, 5, 5)\")",
|
||||
"new DOMMatrix(\"rotate(5, 5px, 5px)\")",
|
||||
"new DOMMatrix(\"rotate(5deg, 5px, 5px)\")",
|
||||
"new DOMMatrix(\" \")",
|
||||
"new DOMMatrix(\"/**/\")",
|
||||
"new DOMMatrix(\"\\0\")",
|
||||
"new DOMMatrix(\";\")",
|
||||
"new DOMMatrix(\"none;\")",
|
||||
"new DOMMatrix(\"null\")",
|
||||
"new DOMMatrix(null)",
|
||||
"new DOMMatrix(\"undefined\")",
|
||||
"new DOMMatrix(\"inherit\")",
|
||||
"new DOMMatrix(\"initial\")",
|
||||
"new DOMMatrix(\"unset\")",
|
||||
"new DOMMatrix(\"scale(2, 2), translateX(5px) translateY(5px)\")",
|
||||
"new DOMMatrixReadOnly(\"none\")",
|
||||
"new DOMMatrixReadOnly(\" none\")",
|
||||
"new DOMMatrixReadOnly(\"none \")",
|
||||
"new DOMMatrixReadOnly(\"NONE\")",
|
||||
"new DOMMatrixReadOnly(\"none/**/\")",
|
||||
"new DOMMatrixReadOnly(\"/**/none\")",
|
||||
"new DOMMatrixReadOnly(\"scale(2) translateX(5px) translateY(5px)\")",
|
||||
"new DOMMatrixReadOnly(\"scale(2, 2) translateX(5px) translateY(5px)\")",
|
||||
"new DOMMatrixReadOnly(\"scale(2)translateX(5px)translateY(5px)\")",
|
||||
"new DOMMatrixReadOnly(\"scale(2) translateX(calc(2 * 2.5px)) translateY(5px)\")",
|
||||
"new DOMMatrixReadOnly(\"scale(2) translateX(5px) translateY(5px) rotate(5deg) rotate(-5deg)\")",
|
||||
"new DOMMatrixReadOnly(\"translateX (5px)\")",
|
||||
"new DOMMatrixReadOnly(\"scale(2 2) translateX(5) translateY(5)\")",
|
||||
"new DOMMatrixReadOnly(\"scale(2, 2), translateX(5) ,translateY(5)\")",
|
||||
"new DOMMatrixReadOnly(\"translateX(5em)\")",
|
||||
"new DOMMatrixReadOnly(\"translateX(5ex)\")",
|
||||
"new DOMMatrixReadOnly(\"translateX(5ch)\")",
|
||||
"new DOMMatrixReadOnly(\"translateX(5rem)\")",
|
||||
"new DOMMatrixReadOnly(\"translateX(5cqw)\")",
|
||||
"new DOMMatrixReadOnly(\"translateX(5cqh)\")",
|
||||
"new DOMMatrixReadOnly(\"translateX(5cqb)\")",
|
||||
"new DOMMatrixReadOnly(\"translateX(5cqi)\")",
|
||||
"new DOMMatrixReadOnly(\"translateX(5cqmin)\")",
|
||||
"new DOMMatrixReadOnly(\"translateX(5cqmax)\")",
|
||||
"new DOMMatrixReadOnly(\"translateX(5vw)\")",
|
||||
"new DOMMatrixReadOnly(\"translateX(5vh)\")",
|
||||
"new DOMMatrixReadOnly(\"translateX(5vb)\")",
|
||||
"new DOMMatrixReadOnly(\"translateX(5vi)\")",
|
||||
"new DOMMatrixReadOnly(\"translateX(5vmin)\")",
|
||||
"new DOMMatrixReadOnly(\"translateX(5vmax)\")",
|
||||
"new DOMMatrixReadOnly(\"translateX(5%)\")",
|
||||
"new DOMMatrixReadOnly(\"rotate(5)\")",
|
||||
"new DOMMatrixReadOnly(\"rotate(5, 5, 5)\")",
|
||||
"new DOMMatrixReadOnly(\"rotate(5, 5px, 5px)\")",
|
||||
"new DOMMatrixReadOnly(\"rotate(5deg, 5px, 5px)\")",
|
||||
"new DOMMatrixReadOnly(\" \")",
|
||||
"new DOMMatrixReadOnly(\"/**/\")",
|
||||
"new DOMMatrixReadOnly(\"\\0\")",
|
||||
"new DOMMatrixReadOnly(\";\")",
|
||||
"new DOMMatrixReadOnly(\"none;\")",
|
||||
"new DOMMatrixReadOnly(\"null\")",
|
||||
"new DOMMatrixReadOnly(null)",
|
||||
"new DOMMatrixReadOnly(\"undefined\")",
|
||||
"new DOMMatrixReadOnly(\"inherit\")",
|
||||
"new DOMMatrixReadOnly(\"initial\")",
|
||||
"new DOMMatrixReadOnly(\"unset\")",
|
||||
"new DOMMatrixReadOnly(\"scale(2, 2), translateX(5px) translateY(5px)\")"
|
||||
],
|
||||
"DOMMatrix-002.html": true,
|
||||
"DOMMatrix-003.html": true,
|
||||
"DOMMatrix-a-f-alias.html": true,
|
||||
"DOMMatrix-attributes.html": true,
|
||||
"DOMMatrix-css-string.worker.html": true,
|
||||
"DOMMatrix-invert-invertible.html": true,
|
||||
"DOMMatrix-invert-non-invertible.html": true,
|
||||
"DOMMatrix-invert-preserves-2d.html": true,
|
||||
"DOMMatrix-newobject.html": true,
|
||||
"DOMMatrix-stringifier.html": [
|
||||
"WebKitCSSMatrix stringifier: identity (2d)",
|
||||
"WebKitCSSMatrix stringifier: identity (3d)",
|
||||
"WebKitCSSMatrix stringifier: NaN (2d)",
|
||||
"WebKitCSSMatrix stringifier: NaN (3d)",
|
||||
"WebKitCSSMatrix stringifier: Infinity (2d)",
|
||||
"WebKitCSSMatrix stringifier: Infinity (3d)",
|
||||
"WebKitCSSMatrix stringifier: -Infinity (2d)",
|
||||
"WebKitCSSMatrix stringifier: -Infinity (3d)",
|
||||
"WebKitCSSMatrix stringifier: 1/3 (2d)",
|
||||
"WebKitCSSMatrix stringifier: 1/3 (3d)",
|
||||
"WebKitCSSMatrix stringifier: 1/300000 (2d)",
|
||||
"WebKitCSSMatrix stringifier: 1/300000 (3d)",
|
||||
"WebKitCSSMatrix stringifier: 1/300000000 (2d)",
|
||||
"WebKitCSSMatrix stringifier: 1/300000000 (3d)",
|
||||
"WebKitCSSMatrix stringifier: 100000 + (1/3) (2d)",
|
||||
"WebKitCSSMatrix stringifier: 100000 + (1/3) (3d)",
|
||||
"WebKitCSSMatrix stringifier: Math.pow(2, 53) + 1 (2d)",
|
||||
"WebKitCSSMatrix stringifier: Math.pow(2, 53) + 1 (3d)",
|
||||
"WebKitCSSMatrix stringifier: Math.pow(2, 53) + 2 (2d)",
|
||||
"WebKitCSSMatrix stringifier: Math.pow(2, 53) + 2 (3d)",
|
||||
"WebKitCSSMatrix stringifier: Number.MAX_VALUE (2d)",
|
||||
"WebKitCSSMatrix stringifier: Number.MAX_VALUE (3d)",
|
||||
"WebKitCSSMatrix stringifier: Number.MIN_VALUE (2d)",
|
||||
"WebKitCSSMatrix stringifier: Number.MIN_VALUE (3d)",
|
||||
"WebKitCSSMatrix stringifier: throwing getters (2d)",
|
||||
"WebKitCSSMatrix stringifier: throwing getters (3d)"
|
||||
],
|
||||
"DOMMatrix2DInit-validate-fixup.html": false,
|
||||
"DOMMatrixInit-validate-fixup.html": true,
|
||||
"DOMPoint-001.html": true,
|
||||
"DOMPoint-002.html": true,
|
||||
"DOMQuad-001.html": true,
|
||||
"DOMQuad-002.html": true,
|
||||
"DOMQuad-nan.html": true,
|
||||
"DOMRect-001.html": true,
|
||||
"DOMRect-002.html": true,
|
||||
"DOMRect-nan.html": true,
|
||||
"DOMRectList.html": false,
|
||||
"WebKitCSSMatrix.html": false,
|
||||
"WebKitCSSMatrix.worker.html": true,
|
||||
"historical.html": true,
|
||||
"idlharness.any.html": [
|
||||
"DOMPointReadOnly interface: existence and properties of interface object",
|
||||
"DOMPoint interface: existence and properties of interface object",
|
||||
"DOMRectReadOnly interface: existence and properties of interface object",
|
||||
"DOMRect interface: existence and properties of interface object",
|
||||
"DOMRectList interface: existence and properties of interface object",
|
||||
"DOMRectList interface object length",
|
||||
"DOMRectList interface object name",
|
||||
"DOMRectList interface: existence and properties of interface prototype object",
|
||||
"DOMRectList interface: existence and properties of interface prototype object's \"constructor\" property",
|
||||
"DOMRectList interface: existence and properties of interface prototype object's @@unscopables property",
|
||||
"DOMRectList interface: attribute length",
|
||||
"DOMRectList interface: operation item(unsigned long)",
|
||||
"DOMQuad interface: existence and properties of interface object",
|
||||
"DOMMatrixReadOnly interface: existence and properties of interface object",
|
||||
"DOMMatrix interface: existence and properties of interface object"
|
||||
],
|
||||
"idlharness.any.worker.html": [
|
||||
"DOMPointReadOnly interface: existence and properties of interface object",
|
||||
"DOMPoint interface: existence and properties of interface object",
|
||||
"DOMRectReadOnly interface: existence and properties of interface object",
|
||||
"DOMRect interface: existence and properties of interface object",
|
||||
"DOMQuad interface: existence and properties of interface object",
|
||||
"DOMMatrixReadOnly interface: existence and properties of interface object",
|
||||
"DOMMatrix interface: existence and properties of interface object"
|
||||
],
|
||||
"spec-examples.html": true,
|
||||
"structured-serialization.html": [
|
||||
"DOMPointReadOnly clone: basic",
|
||||
"DOMPointReadOnly clone: custom property",
|
||||
"DOMPointReadOnly clone: non-initial values",
|
||||
"DOMPoint clone: basic",
|
||||
"DOMPoint clone: custom property",
|
||||
"DOMPoint clone: non-initial values",
|
||||
"DOMRectReadOnly clone: basic",
|
||||
"DOMRectReadOnly clone: custom property",
|
||||
"DOMRectReadOnly clone: non-initial values",
|
||||
"DOMRect clone: basic",
|
||||
"DOMRect clone: custom property",
|
||||
"DOMRect clone: non-initial values",
|
||||
"DOMQuad clone: basic",
|
||||
"DOMQuad clone: custom property",
|
||||
"DOMQuad clone: non-initial values",
|
||||
"DOMMatrixReadOnly clone: basic",
|
||||
"DOMMatrixReadOnly clone: custom property",
|
||||
"DOMMatrixReadOnly clone: non-initial values (2d)",
|
||||
"DOMMatrixReadOnly clone: non-initial values (3d)",
|
||||
"DOMMatrix clone: basic",
|
||||
"DOMMatrix clone: custom property",
|
||||
"DOMMatrix clone: non-initial values (2d)",
|
||||
"DOMMatrix clone: non-initial values (3d)",
|
||||
"DOMRectList clone"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,6 +17,8 @@
|
|||
"ext:deno_fetch/26_fetch.js": "../ext/fetch/26_fetch.js",
|
||||
"ext:deno_ffi/00_ffi.js": "../ext/ffi/00_ffi.js",
|
||||
"ext:deno_fs/30_fs.js": "../ext/fs/30_fs.js",
|
||||
"ext:deno_geometry/00_init.js": "../ext/geometry/00_init.js",
|
||||
"ext:deno_geometry/01_geometry.js": "../ext/geometry/01_geometry.js",
|
||||
"ext:deno_http/00_serve.ts": "../ext/http/00_serve.ts",
|
||||
"ext:deno_http/01_http.js": "../ext/http/01_http.js",
|
||||
"ext:deno_io/12_io.js": "../ext/io/12_io.js",
|
||||
|
|
|
@ -13,6 +13,7 @@ const libs = [
|
|||
join(ROOT_PATH, "ext/webstorage/lib.deno_webstorage.d.ts"),
|
||||
join(ROOT_PATH, "ext/canvas/lib.deno_canvas.d.ts"),
|
||||
join(ROOT_PATH, "ext/crypto/lib.deno_crypto.d.ts"),
|
||||
join(ROOT_PATH, "ext/geometry/lib.deno_geometry.d.ts"),
|
||||
join(ROOT_PATH, "ext/net/lib.deno_net.d.ts"),
|
||||
join(ROOT_PATH, "cli/tsc/dts/lib.deno.ns.d.ts"),
|
||||
join(ROOT_PATH, "cli/tsc/dts/lib.deno.shared_globals.d.ts"),
|
||||
|
|
Loading…
Add table
Reference in a new issue