ranuts 0.1.0-alpha.12 → 0.1.0-alpha.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/src/node/appendFile.d.ts +0 -1
- package/dist/src/node/body.d.ts +0 -1
- package/dist/src/node/command.d.ts +0 -1
- package/dist/src/node/ctx2req.d.ts +0 -1
- package/dist/src/node/fileInfo.d.ts +0 -1
- package/dist/src/node/fs.d.ts +0 -3
- package/dist/src/node/paresUrl.d.ts +0 -1
- package/dist/src/node/readFile.d.ts +0 -1
- package/dist/src/node/server.d.ts +0 -1
- package/dist/src/node/stream.d.ts +0 -1
- package/dist/src/node/traverse.d.ts +0 -1
- package/dist/src/node/watchFile.d.ts +0 -1
- package/dist/src/node/websocket.d.ts +0 -4
- package/dist/src/node/writeFile.d.ts +0 -1
- package/dist/src/node/ws.d.ts +0 -1
- package/dist/src/utils/dom.d.ts +1 -0
- package/dist/src/utils/index.js +13 -2
- package/dist/src/utils/visual/application.d.ts +10 -0
- package/dist/src/utils/visual/event/boundary.d.ts +1 -1
- package/dist/src/utils/visual/event/event.d.ts +1 -1
- package/dist/src/utils/visual/event/types.d.ts +2 -1
- package/dist/src/utils/visual/graphics/graphics.d.ts +5 -92
- package/dist/src/utils/visual/graphics/graphicsData.d.ts +3 -2
- package/dist/src/utils/visual/graphics/graphicsGeometry.d.ts +3 -8
- package/dist/src/utils/visual/index.d.ts +3 -8
- package/dist/src/utils/visual/math/matrix.d.ts +1 -1
- package/dist/src/utils/visual/math/transform.d.ts +1 -1
- package/dist/src/utils/visual/render/canvasRenderer.d.ts +2 -2
- package/dist/src/utils/visual/render/index.d.ts +0 -3
- package/dist/src/utils/visual/render/render.d.ts +2 -2
- package/dist/src/utils/visual/render/webGlRenderer.d.ts +1 -1
- package/dist/src/utils/visual/shape/circle.d.ts +2 -2
- package/dist/src/utils/visual/shape/ellipse.d.ts +1 -1
- package/dist/src/utils/visual/shape/polygon.d.ts +4 -19
- package/dist/src/utils/visual/shape/rectangle.d.ts +2 -12
- package/dist/src/utils/visual/shape/shape.d.ts +1 -1
- package/dist/src/utils/visual/types.d.ts +1 -11
- package/dist/src/utils/visual/vertex/container.d.ts +1 -1
- package/dist/tsconfig.json +0 -1
- package/dist/umd/index.umd.cjs +1 -1
- package/dist/umd/utils/utils.umd.cjs +1 -1
- package/package.json +2 -2
- package/readme.md +1 -1
- package/dist/src/cache/expires.d.ts +0 -1
package/dist/src/node/body.d.ts
CHANGED
package/dist/src/node/fs.d.ts
CHANGED
package/dist/src/node/ws.d.ts
CHANGED
package/dist/src/utils/dom.d.ts
CHANGED
package/dist/src/utils/index.js
CHANGED
|
@@ -3027,6 +3027,15 @@ class Chain {
|
|
|
3027
3027
|
this.element.style.setProperty(name, value);
|
|
3028
3028
|
return this;
|
|
3029
3029
|
});
|
|
3030
|
+
// 根据不同的子元素类型,添加元素
|
|
3031
|
+
__publicField(this, "addElementByType", (item, parent) => {
|
|
3032
|
+
if (item instanceof Chain) {
|
|
3033
|
+
parent.appendChild(item.element);
|
|
3034
|
+
}
|
|
3035
|
+
if (item instanceof HTMLElement) {
|
|
3036
|
+
parent.appendChild(item);
|
|
3037
|
+
}
|
|
3038
|
+
});
|
|
3030
3039
|
/**
|
|
3031
3040
|
* @description: 给当前元素添加子元素
|
|
3032
3041
|
* @return {Chain}
|
|
@@ -3034,10 +3043,12 @@ class Chain {
|
|
|
3034
3043
|
__publicField(this, "addChild", (child) => {
|
|
3035
3044
|
if (Array.isArray(child)) {
|
|
3036
3045
|
const Fragment = document.createDocumentFragment();
|
|
3037
|
-
child.forEach((item) =>
|
|
3046
|
+
child.forEach((item) => {
|
|
3047
|
+
this.addElementByType(item, Fragment);
|
|
3048
|
+
});
|
|
3038
3049
|
this.element.appendChild(Fragment);
|
|
3039
3050
|
} else {
|
|
3040
|
-
this.
|
|
3051
|
+
this.addElementByType(child, this.element);
|
|
3041
3052
|
}
|
|
3042
3053
|
return this;
|
|
3043
3054
|
});
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Container } from '@/utils/visual/vertex/container';
|
|
2
|
+
import type { IApplicationOptions } from '@/utils/visual/types';
|
|
3
|
+
export declare class Application {
|
|
4
|
+
private renderer;
|
|
5
|
+
stage: Container;
|
|
6
|
+
view: HTMLCanvasElement;
|
|
7
|
+
constructor(options: IApplicationOptions);
|
|
8
|
+
private render;
|
|
9
|
+
private start;
|
|
10
|
+
}
|
|
@@ -1,106 +1,19 @@
|
|
|
1
|
-
import { Container } from '@/utils/visual/vertex';
|
|
2
|
-
import
|
|
3
|
-
import type {
|
|
4
|
-
import type {
|
|
5
|
-
import type { Point } from '@/utils/visual/vertex';
|
|
1
|
+
import { Container } from '@/utils/visual/vertex/container';
|
|
2
|
+
import { Polygon } from '@/utils/visual/shape/polygon';
|
|
3
|
+
import type { Shape } from '@/utils/visual/shape/shape';
|
|
4
|
+
import type { CanvasRenderer } from '@/utils/visual/render/canvasRenderer';
|
|
6
5
|
export declare class Graphics extends Container {
|
|
7
6
|
private _lineStyle;
|
|
8
7
|
private _fillStyle;
|
|
9
8
|
private _geometry;
|
|
10
|
-
|
|
9
|
+
currentPath: Polygon | null;
|
|
11
10
|
constructor();
|
|
12
|
-
lineStyle(width: number, color?: string, alpha?: number): this;
|
|
13
|
-
lineStyle(options: ILineStyleOptions): this;
|
|
14
|
-
resetLineStyle(): void;
|
|
15
11
|
protected drawShape(shape: Shape): Graphics;
|
|
16
12
|
/**
|
|
17
13
|
* 清空已有的 path,开始新的 path
|
|
18
14
|
*/
|
|
19
15
|
protected startPoly(): void;
|
|
20
|
-
/**
|
|
21
|
-
* 开始填充模式,接下来绘制的所有路径都将被填充,直到调用了 endFill
|
|
22
|
-
* @param color 填充颜色
|
|
23
|
-
* @param alpha 不透明度
|
|
24
|
-
*/
|
|
25
16
|
beginFill(color?: string, alpha?: number): Graphics;
|
|
26
|
-
/**
|
|
27
|
-
* 结束填充模式
|
|
28
|
-
*/
|
|
29
|
-
endFill(): Graphics;
|
|
30
|
-
/**
|
|
31
|
-
* 画矩形
|
|
32
|
-
* @param x x 坐标
|
|
33
|
-
* @param y y 坐标
|
|
34
|
-
* @param width 宽度
|
|
35
|
-
* @param height 高度
|
|
36
|
-
*/
|
|
37
17
|
drawRect(x: number, y: number, width: number, height: number): Graphics;
|
|
38
|
-
/**
|
|
39
|
-
* 画圆
|
|
40
|
-
* @param x 圆心 X 坐标
|
|
41
|
-
* @param y 圆心 Y 坐标
|
|
42
|
-
* @param radius 半径
|
|
43
|
-
*/
|
|
44
|
-
drawCircle(x: number, y: number, radius: number): Graphics;
|
|
45
|
-
/**
|
|
46
|
-
* 画圆角矩形
|
|
47
|
-
* @param x x 坐标
|
|
48
|
-
* @param y y 坐标
|
|
49
|
-
* @param width 宽度
|
|
50
|
-
* @param height 高度
|
|
51
|
-
* @param radius 圆角半径
|
|
52
|
-
*/
|
|
53
|
-
drawRoundedRect(x: number, y: number, width: number, height: number, radius: number): Graphics;
|
|
54
|
-
drawEllipse(x: number, y: number, radiusX: number, radiusY: number): Graphics;
|
|
55
|
-
/**
|
|
56
|
-
* 画多边形
|
|
57
|
-
* @param points 多边形顶点坐标数组,每 2 个元素算一组 (x,y)
|
|
58
|
-
*/
|
|
59
|
-
drawPolygon(points: number[]): Graphics;
|
|
60
|
-
moveTo(x: number, y: number): Graphics;
|
|
61
|
-
lineTo(x: number, y: number): Graphics;
|
|
62
|
-
closePath(): Graphics;
|
|
63
|
-
/**
|
|
64
|
-
* 画二阶贝塞尔曲线
|
|
65
|
-
* @param cpX 控制点的 X 坐标
|
|
66
|
-
* @param cpY 控制点的 Y 坐标
|
|
67
|
-
* @param toX 终点的 X 坐标
|
|
68
|
-
* @param toY 终点的 Y 坐标
|
|
69
|
-
*/
|
|
70
|
-
quadraticCurveTo(cpX: number, cpY: number, toX: number, toY: number): Graphics;
|
|
71
|
-
/**
|
|
72
|
-
* 画三阶贝塞尔曲线
|
|
73
|
-
* @param cpX 控制点1的X坐标
|
|
74
|
-
* @param cpY 控制点1的Y坐标
|
|
75
|
-
* @param cpX2 控制点2的X坐标
|
|
76
|
-
* @param cpY2 控制点2的Y坐标
|
|
77
|
-
* @param toX 终点的X坐标
|
|
78
|
-
* @param toY 终点的Y坐标
|
|
79
|
-
*/
|
|
80
|
-
bezierCurveTo(cpX: number, cpY: number, cpX2: number, cpY2: number, toX: number, toY: number): Graphics;
|
|
81
|
-
/**
|
|
82
|
-
* 画圆弧
|
|
83
|
-
* @param cx 圆弧对应的圆的中心点的x坐标
|
|
84
|
-
* @param cy 圆弧对应的圆的中心点的y坐标
|
|
85
|
-
* @param radius 半径
|
|
86
|
-
* @param startAngle 开始角度
|
|
87
|
-
* @param endAngle 结束角度
|
|
88
|
-
* @param anticlockwise 是否逆时针
|
|
89
|
-
*/
|
|
90
|
-
arc(cx: number, cy: number, radius: number, startAngle: number, endAngle: number, anticlockwise?: boolean): Graphics;
|
|
91
|
-
/**
|
|
92
|
-
* 画圆弧
|
|
93
|
-
* @param x1 控制点1的x坐标
|
|
94
|
-
* @param y1 控制点1的y坐标
|
|
95
|
-
* @param x2 控制点2的x坐标
|
|
96
|
-
* @param y2 控制点2的y坐标
|
|
97
|
-
* @param radius 半径
|
|
98
|
-
*/
|
|
99
|
-
arcTo(x1: number, y1: number, x2: number, y2: number, radius: number): Graphics;
|
|
100
|
-
clear(): Graphics;
|
|
101
|
-
/**
|
|
102
|
-
* 调用 canvas API 绘制自身
|
|
103
|
-
*/
|
|
104
18
|
protected renderCanvas(render: CanvasRenderer): void;
|
|
105
|
-
containsPoint(p: Point): boolean;
|
|
106
19
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import type { Shape } from '@/utils/visual/shape';
|
|
2
|
-
import type { Fill
|
|
1
|
+
import type { Shape } from '@/utils/visual/shape/shape';
|
|
2
|
+
import type { Fill } from '@/utils/visual/style/fill';
|
|
3
|
+
import type { Line } from '@/utils/visual/style/line';
|
|
3
4
|
export declare class GraphicsData {
|
|
4
5
|
shape: Shape;
|
|
5
6
|
lineStyle: Line;
|
|
@@ -1,15 +1,10 @@
|
|
|
1
|
-
import type { Shape } from '@/utils/visual/shape';
|
|
2
|
-
import type { Fill
|
|
1
|
+
import type { Shape } from '@/utils/visual/shape/shape';
|
|
2
|
+
import type { Fill } from '@/utils/visual/style/fill';
|
|
3
|
+
import type { Line } from '@/utils/visual/style/line';
|
|
3
4
|
import { GraphicsData } from '@/utils/visual/graphics/graphicsData';
|
|
4
|
-
import type { Point } from '@/utils/visual/vertex';
|
|
5
5
|
export declare class GraphicsGeometry {
|
|
6
6
|
graphicsData: GraphicsData[];
|
|
7
7
|
constructor();
|
|
8
8
|
drawShape(shape: Shape, fillStyle: Fill, lineStyle: Line): void;
|
|
9
|
-
/**
|
|
10
|
-
* @param p 待检测点
|
|
11
|
-
* @returns {boolean} 待检测点是否落在某一个子图形内
|
|
12
|
-
*/
|
|
13
|
-
containsPoint(p: Point): boolean;
|
|
14
9
|
clear(): void;
|
|
15
10
|
}
|
|
@@ -1,9 +1,4 @@
|
|
|
1
|
-
export * from '@/utils/visual/
|
|
2
|
-
export * from '@/utils/visual/
|
|
1
|
+
export * from '@/utils/visual/application';
|
|
2
|
+
export * from '@/utils/visual/vertex/container';
|
|
3
|
+
export * from '@/utils/visual/graphics/graphics';
|
|
3
4
|
export * from '@/utils/visual/enums';
|
|
4
|
-
export * from '@/utils/visual/event';
|
|
5
|
-
export * from '@/utils/visual/math';
|
|
6
|
-
export * from '@/utils/visual/render';
|
|
7
|
-
export * from '@/utils/visual/shape';
|
|
8
|
-
export * from '@/utils/visual/style';
|
|
9
|
-
export * from '@/utils/visual/types';
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { Renderer } from '@/utils/visual/render/render';
|
|
2
2
|
import type { IApplicationOptions } from '@/utils/visual/types';
|
|
3
|
-
import type { Container } from '@/utils/visual/vertex';
|
|
3
|
+
import type { Container } from '@/utils/visual/vertex/container';
|
|
4
4
|
export declare class CanvasRenderer extends Renderer {
|
|
5
5
|
ctx: CanvasRenderingContext2D;
|
|
6
6
|
private background;
|
|
7
7
|
constructor(options: IApplicationOptions);
|
|
8
|
-
render
|
|
8
|
+
render(container: Container): void;
|
|
9
9
|
}
|
|
@@ -1,6 +1,3 @@
|
|
|
1
1
|
import type { Renderer } from '@/utils/visual/render/render';
|
|
2
2
|
import type { IApplicationOptions } from '@/utils/visual/types';
|
|
3
3
|
export declare const getRenderer: (options: IApplicationOptions) => Renderer;
|
|
4
|
-
export * from '@/utils/visual/render/canvasRenderer';
|
|
5
|
-
export * from '@/utils/visual/render/render';
|
|
6
|
-
export * from '@/utils/visual/render/webGlRenderer';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { Container } from '@/utils/visual/vertex';
|
|
2
|
-
import { Rectangle } from '@/utils/visual/shape';
|
|
1
|
+
import type { Container } from '@/utils/visual/vertex/container';
|
|
2
|
+
import { Rectangle } from '@/utils/visual/shape/rectangle';
|
|
3
3
|
import type { IApplicationOptions } from '@/utils/visual/types';
|
|
4
4
|
export declare class Renderer {
|
|
5
5
|
canvasEle: HTMLCanvasElement;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Renderer } from '@/utils/visual/render/render';
|
|
2
2
|
import type { IApplicationOptions } from '@/utils/visual/types';
|
|
3
|
-
import type { Container } from '@/utils/visual/vertex';
|
|
3
|
+
import type { Container } from '@/utils/visual/vertex/container';
|
|
4
4
|
export declare class WebGlRenderer extends Renderer {
|
|
5
5
|
constructor(options: IApplicationOptions);
|
|
6
6
|
render(container: Container): void;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { Shape } from '@/utils/visual/shape/shape';
|
|
2
2
|
import { ShapeType } from '@/utils/visual/enums';
|
|
3
|
-
import type { Point } from '@/utils/visual/vertex';
|
|
3
|
+
import type { Point } from '@/utils/visual/vertex/point';
|
|
4
4
|
export declare class Circle extends Shape {
|
|
5
5
|
x: number;
|
|
6
6
|
y: number;
|
|
7
7
|
radius: number;
|
|
8
8
|
readonly type = ShapeType.Circle;
|
|
9
9
|
constructor(x?: number, y?: number, radius?: number);
|
|
10
|
-
contains(
|
|
10
|
+
contains(point: Point): boolean;
|
|
11
11
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Shape } from '@/utils/visual/shape/shape';
|
|
2
2
|
import { ShapeType } from '@/utils/visual/enums';
|
|
3
|
-
import type { Point } from '@/utils/visual/vertex';
|
|
3
|
+
import type { Point } from '@/utils/visual/vertex/point';
|
|
4
4
|
export declare class Ellipse extends Shape {
|
|
5
5
|
x: number;
|
|
6
6
|
y: number;
|
|
@@ -1,25 +1,10 @@
|
|
|
1
1
|
import { Shape } from '@/utils/visual/shape/shape';
|
|
2
2
|
import { ShapeType } from '@/utils/visual/enums';
|
|
3
|
-
import type { Point } from '@/utils/visual/vertex';
|
|
3
|
+
import type { Point } from '@/utils/visual/vertex/point';
|
|
4
4
|
export declare class Polygon extends Shape {
|
|
5
5
|
points: number[];
|
|
6
6
|
closeStroke: boolean;
|
|
7
|
-
|
|
8
|
-
constructor(
|
|
9
|
-
|
|
10
|
-
*
|
|
11
|
-
* @param px 待检测点的 x 坐标
|
|
12
|
-
* @param py 待检测点的 y 坐标
|
|
13
|
-
* @param p1x 线段的其中一个端点的 x 坐标
|
|
14
|
-
* @param p1y 线段的其中一个端点的 y 坐标
|
|
15
|
-
* @param p2x 线段的另一个端点的 x 坐标
|
|
16
|
-
* @param p2y 线段的另一个端点的 y 坐标
|
|
17
|
-
* @returns {boolean} 从待检测点发出的射线是否与线段相交
|
|
18
|
-
*/
|
|
19
|
-
private isIntersect;
|
|
20
|
-
/**
|
|
21
|
-
* @param p 待检测点
|
|
22
|
-
* @returns {boolean} 待检测点是否在多边形内部
|
|
23
|
-
*/
|
|
24
|
-
contains(p: Point): boolean;
|
|
7
|
+
type: ShapeType;
|
|
8
|
+
constructor();
|
|
9
|
+
contains(point: Point): boolean;
|
|
25
10
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Shape } from '@/utils/visual/shape/shape';
|
|
2
2
|
import { ShapeType } from '@/utils/visual/enums';
|
|
3
|
-
import type { Point } from '@/utils/visual/vertex';
|
|
3
|
+
import type { Point } from '@/utils/visual/vertex/point';
|
|
4
4
|
export declare class Rectangle extends Shape {
|
|
5
5
|
x: number;
|
|
6
6
|
y: number;
|
|
@@ -8,15 +8,5 @@ export declare class Rectangle extends Shape {
|
|
|
8
8
|
height: number;
|
|
9
9
|
type: ShapeType;
|
|
10
10
|
constructor(x?: number, y?: number, width?: number, height?: number);
|
|
11
|
-
contains(
|
|
12
|
-
}
|
|
13
|
-
export declare class RoundedRectangle extends Shape {
|
|
14
|
-
x: number;
|
|
15
|
-
y: number;
|
|
16
|
-
width: number;
|
|
17
|
-
height: number;
|
|
18
|
-
radius: number;
|
|
19
|
-
readonly type = ShapeType.RoundedRectangle;
|
|
20
|
-
constructor(x?: number, y?: number, width?: number, height?: number, radius?: number);
|
|
21
|
-
contains(p: Point): boolean;
|
|
11
|
+
contains(point: Point): boolean;
|
|
22
12
|
}
|
|
@@ -1,16 +1,6 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { RendererType } from '@/utils/visual/enums';
|
|
2
2
|
export interface IApplicationOptions {
|
|
3
3
|
rendererType?: RendererType;
|
|
4
4
|
view: HTMLCanvasElement;
|
|
5
5
|
backgroundColor?: string;
|
|
6
6
|
}
|
|
7
|
-
export interface IFillStyleOptions {
|
|
8
|
-
color?: string;
|
|
9
|
-
alpha?: number;
|
|
10
|
-
visible?: boolean;
|
|
11
|
-
}
|
|
12
|
-
export interface ILineStyleOptions extends IFillStyleOptions {
|
|
13
|
-
width?: number;
|
|
14
|
-
cap?: LineCap;
|
|
15
|
-
join?: LineJoin;
|
|
16
|
-
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Vertex } from '@/utils/visual/vertex/vertex';
|
|
2
|
-
import type { CanvasRenderer } from '@/utils/visual/render';
|
|
2
|
+
import type { CanvasRenderer } from '@/utils/visual/render/canvasRenderer';
|
|
3
3
|
import type { Point } from '@/utils/visual/vertex/point';
|
|
4
4
|
export declare class Container extends Vertex {
|
|
5
5
|
readonly children: Container[];
|