ranuts 0.1.0-alpha.9 → 0.2.0-alpha.1
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/CLAUDE.md +164 -0
- package/README.md +116 -0
- package/{readme.md → README.zh-CN.md} +43 -12
- package/dist/bin/generate-api-docs.d.ts +1 -0
- package/dist/build/build.es.d.ts +2 -0
- package/dist/build/build.umd.d.ts +2 -0
- package/dist/build/build.umd.node.d.ts +2 -0
- package/dist/build/build.umd.utils.d.ts +2 -0
- package/dist/color-CRdlaDqQ.js +1 -0
- package/dist/examples/clone-deep-example.d.ts +1 -0
- package/dist/examples/is-equal-example.d.ts +1 -0
- package/dist/index.d.ts +5 -21
- package/dist/index.js +1 -2484
- package/dist/plugins/vite-plugins-banner.d.ts +2 -0
- package/dist/rolldown-runtime-I3TIJKkN.js +1 -0
- package/dist/src/node/appendFile.d.ts +7 -0
- package/dist/src/node/body.d.ts +9 -0
- package/dist/src/node/color.d.ts +7 -0
- package/dist/src/node/command.d.ts +8 -0
- package/dist/src/node/ctx2req.d.ts +5 -0
- package/dist/src/node/fileInfo.d.ts +7 -0
- package/dist/src/node/fs.d.ts +7 -0
- package/dist/src/node/get.d.ts +10 -0
- package/dist/src/node/getIPAdress.d.ts +1 -0
- package/dist/src/node/index.d.ts +25 -0
- package/dist/src/node/index.js +1 -0
- package/dist/src/node/isColorSupported.d.ts +2 -0
- package/dist/src/node/paresUrl.d.ts +19 -0
- package/dist/src/node/readDir.d.ts +6 -0
- package/dist/src/node/readFile.d.ts +9 -0
- package/dist/src/node/router.d.ts +42 -0
- package/dist/src/node/send.d.ts +7 -0
- package/dist/src/node/server.d.ts +18 -0
- package/dist/src/node/startTask.d.ts +2 -0
- package/dist/src/node/stream.d.ts +15 -0
- package/dist/src/node/taskEnd.d.ts +2 -0
- package/dist/src/node/traverse.d.ts +17 -0
- package/dist/src/node/watchFile.d.ts +8 -0
- package/dist/src/node/writeFile.d.ts +8 -0
- package/dist/src/node/ws.d.ts +8 -0
- package/dist/src/utils/audioRecorder.d.ts +16 -0
- package/dist/src/utils/behavior.d.ts +15 -0
- package/dist/src/utils/bom.d.ts +294 -0
- package/dist/src/utils/color.d.ts +71 -0
- package/dist/src/utils/compose.d.ts +10 -0
- package/dist/src/utils/console.d.ts +1 -0
- package/dist/src/utils/debounce.d.ts +7 -0
- package/dist/src/utils/device.d.ts +25 -0
- package/dist/src/utils/dom.d.ts +105 -0
- package/dist/src/utils/error.d.ts +1 -0
- package/dist/src/utils/func.d.ts +1 -0
- package/dist/src/utils/img.d.ts +16 -0
- package/dist/src/utils/index.d.ts +35 -0
- package/dist/src/utils/index.js +1 -0
- package/dist/src/utils/memoize.d.ts +7 -0
- package/dist/src/utils/mimeType.d.ts +9 -0
- package/dist/src/utils/monitor.d.ts +38 -0
- package/dist/src/utils/network.d.ts +39 -0
- package/dist/src/utils/noop.d.ts +2 -0
- package/dist/src/utils/number.d.ts +45 -0
- package/dist/src/utils/obj.d.ts +83 -0
- package/dist/src/utils/performance.d.ts +21 -0
- package/dist/src/utils/queue.d.ts +33 -0
- package/dist/src/utils/report.d.ts +8 -0
- package/dist/src/utils/request.d.ts +17 -0
- package/dist/src/utils/script.d.ts +7 -0
- package/dist/src/utils/signal.d.ts +6 -0
- package/dist/src/utils/storage.d.ts +2 -0
- package/dist/src/utils/str.d.ts +212 -0
- package/dist/src/utils/subscribe.d.ts +46 -0
- package/dist/src/utils/throttle.d.ts +15 -0
- package/dist/src/utils/time.d.ts +20 -0
- package/dist/src/utils/totp/sha/common.d.ts +151 -0
- package/dist/src/utils/totp/sha/converters.d.ts +88 -0
- package/dist/src/utils/totp/sha/custom_types.d.ts +60 -0
- package/dist/src/utils/totp/sha/primitives_32.d.ts +98 -0
- package/dist/src/utils/totp/sha/primitives_64.d.ts +116 -0
- package/dist/src/utils/totp/sha/sha.d.ts +103 -0
- package/dist/src/utils/totp/sha/sha1.d.ts +18 -0
- package/dist/src/utils/totp/sha/sha256.d.ts +20 -0
- package/dist/src/utils/totp/sha/sha3.d.ts +53 -0
- package/dist/src/utils/totp/sha/sha512.d.ts +21 -0
- package/dist/src/utils/totp/totp.d.ts +23 -0
- package/dist/src/utils/visual/application.d.ts +27 -0
- package/dist/src/utils/visual/enums.d.ts +27 -0
- package/dist/src/utils/visual/event/boundary.d.ts +22 -0
- package/dist/src/utils/visual/event/event.d.ts +14 -0
- package/dist/src/utils/visual/event/index.d.ts +6 -0
- package/dist/src/utils/visual/event/types.d.ts +32 -0
- package/dist/src/utils/visual/graphics/graphics.d.ts +81 -0
- package/dist/src/utils/visual/graphics/graphicsData.d.ts +13 -0
- package/dist/src/utils/visual/graphics/graphicsGeometry.d.ts +35 -0
- package/dist/src/utils/visual/graphics/index.d.ts +4 -0
- package/dist/src/utils/visual/index.d.ts +7 -0
- package/dist/src/utils/visual/index.js +1 -0
- package/dist/src/utils/visual/math/bezier.d.ts +2 -0
- package/dist/src/utils/visual/math/enums.d.ts +3 -0
- package/dist/src/utils/visual/math/index.d.ts +5 -0
- package/dist/src/utils/visual/math/matrix.d.ts +113 -0
- package/dist/src/utils/visual/math/transform.d.ts +29 -0
- package/dist/src/utils/visual/render/batchRenderer.d.ts +78 -0
- package/dist/src/utils/visual/render/canvasRenderer.d.ts +10 -0
- package/dist/src/utils/visual/render/index.d.ts +3 -0
- package/dist/src/utils/visual/render/render.d.ts +11 -0
- package/dist/src/utils/visual/render/utils/batch/index.d.ts +90 -0
- package/dist/src/utils/visual/render/utils/batch/index.test.d.ts +1 -0
- package/dist/src/utils/visual/render/utils/float.d.ts +63 -0
- package/dist/src/utils/visual/render/utils/index.d.ts +3 -0
- package/dist/src/utils/visual/render/utils/index.test.d.ts +1 -0
- package/dist/src/utils/visual/render/utils/verticy.d.ts +13 -0
- package/dist/src/utils/visual/render/utils/webgl/initShader.d.ts +7 -0
- package/dist/src/utils/visual/render/utils/webgl/shaders.d.ts +2 -0
- package/dist/src/utils/visual/render/utils/webgpu/shaders.d.ts +8 -0
- package/dist/src/utils/visual/render/webGPURenderer.d.ts +49 -0
- package/dist/src/utils/visual/render/webGlRenderer.d.ts +14 -0
- package/dist/src/utils/visual/shape/circle.d.ts +11 -0
- package/dist/src/utils/visual/shape/ellipse.d.ts +12 -0
- package/dist/src/utils/visual/shape/index.d.ts +7 -0
- package/dist/src/utils/visual/shape/polygon.d.ts +11 -0
- package/dist/src/utils/visual/shape/rectangle.d.ts +12 -0
- package/dist/src/utils/visual/shape/roundedRectangle.d.ts +13 -0
- package/dist/src/utils/visual/shape/shape.d.ts +6 -0
- package/dist/src/utils/visual/style/fill.d.ts +8 -0
- package/dist/src/utils/visual/style/index.d.ts +3 -0
- package/dist/src/utils/visual/style/line.d.ts +10 -0
- package/dist/src/utils/visual/types.d.ts +18 -0
- package/dist/src/utils/visual/vertex/container.d.ts +74 -0
- package/dist/src/utils/visual/vertex/point.d.ts +18 -0
- package/dist/src/utils/visual/vertex/vertex.d.ts +36 -0
- package/dist/src/vnode/chainDom.d.ts +47 -0
- package/dist/src/vnode/h.d.ts +6 -0
- package/dist/src/vnode/hooks.d.ts +23 -0
- package/dist/src/vnode/htmlDomApi.d.ts +33 -0
- package/dist/src/vnode/index.d.ts +18 -0
- package/dist/src/vnode/index.js +1 -0
- package/dist/src/vnode/init.d.ts +2 -0
- package/dist/src/vnode/is.d.ts +5 -0
- package/dist/src/vnode/modules/attributes.d.ts +8 -0
- package/dist/src/vnode/modules/class.d.ts +8 -0
- package/dist/src/vnode/modules/index.d.ts +3 -0
- package/dist/src/vnode/modules/listeners.d.ts +12 -0
- package/dist/src/vnode/modules/props.d.ts +8 -0
- package/dist/src/vnode/modules/style.d.ts +14 -0
- package/dist/src/vnode/vnode.d.ts +31 -0
- package/dist/subscribe-CINWsor3.js +1 -0
- package/dist/test/bridge.test.d.ts +1 -0
- package/dist/test/clearBr.test.d.ts +1 -0
- package/dist/test/cloneDeep.test.d.ts +1 -0
- package/dist/test/command.test.d.ts +1 -0
- package/dist/test/encodeUrl.test.d.ts +1 -0
- package/dist/test/escapeHtml.test.d.ts +1 -0
- package/dist/test/is-equal.test.d.ts +1 -0
- package/dist/test/mimeType.test.d.ts +1 -0
- package/dist/test/package-exports.test.d.ts +1 -0
- package/dist/test/server.test.d.ts +1 -0
- package/dist/test/status.test.d.ts +1 -0
- package/dist/test/totp.test.d.ts +1 -0
- package/dist/test/utils/compose.test.d.ts +1 -0
- package/dist/test/utils/mergeObj.test.d.ts +1 -0
- package/dist/test/visual/math.test.d.ts +1 -0
- package/dist/test/visual-application.test.d.ts +1 -0
- package/dist/test/visual-batch.test.d.ts +1 -0
- package/dist/test/visual-math.test.d.ts +1 -0
- package/dist/test/vnode/index.d.ts +1 -0
- package/dist/test/vnode/server.d.ts +2 -0
- package/dist/test/vnode/vnode.d.ts +1 -0
- package/dist/test/vnode.test.d.ts +1 -0
- package/dist/test/websocket.test.d.ts +1 -0
- package/dist/test/writeFile.test.d.ts +1 -0
- package/dist/umd/index.umd.cjs +1 -0
- package/dist/umd/node/node.umd.cjs +1 -0
- package/dist/umd/utils/utils.umd.cjs +1 -0
- package/dist/utils-_OxsVZmz.js +1 -0
- package/dist/vite.config.d.ts +8 -0
- package/dist/vitest.config.d.ts +2 -0
- package/docs/API.md +305 -0
- package/package.json +67 -15
- package/typings.d.ts +28 -0
- package/dist/index.umd.cjs +0 -1
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { BatchRenderer } from '@/utils/visual/render/batchRenderer';
|
|
2
|
+
import type { IApplicationOptions } from '@/utils/visual/types';
|
|
3
|
+
export declare class WebGLRenderer extends BatchRenderer {
|
|
4
|
+
gl: WebGLRenderingContext;
|
|
5
|
+
private program;
|
|
6
|
+
private glVertexBuffer;
|
|
7
|
+
private glIndexBuffer;
|
|
8
|
+
private unifLoc;
|
|
9
|
+
constructor(options: IApplicationOptions);
|
|
10
|
+
protected setProjectionMatrix(): void;
|
|
11
|
+
protected setRootTransform(a: number, b: number, c: number, d: number, tx: number, ty: number): void;
|
|
12
|
+
protected updateBuffer(): void;
|
|
13
|
+
protected draw(): void;
|
|
14
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Shape } from '@/utils/visual/shape/shape';
|
|
2
|
+
import { SHAPE_TYPE } from '@/utils/visual/enums';
|
|
3
|
+
import type { Point } from '@/utils/visual/vertex/point';
|
|
4
|
+
export declare class Circle extends Shape {
|
|
5
|
+
x: number;
|
|
6
|
+
y: number;
|
|
7
|
+
radius: number;
|
|
8
|
+
readonly type = SHAPE_TYPE.CIRCLE;
|
|
9
|
+
constructor(x?: number, y?: number, radius?: number);
|
|
10
|
+
contains(p: Point): boolean;
|
|
11
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Shape } from '@/utils/visual/shape/shape';
|
|
2
|
+
import { SHAPE_TYPE } from '@/utils/visual/enums';
|
|
3
|
+
import type { Point } from '@/utils/visual/vertex/point';
|
|
4
|
+
export declare class Ellipse extends Shape {
|
|
5
|
+
x: number;
|
|
6
|
+
y: number;
|
|
7
|
+
radiusX: number;
|
|
8
|
+
radiusY: number;
|
|
9
|
+
readonly type = SHAPE_TYPE.ELLIPSE;
|
|
10
|
+
constructor(x?: number, y?: number, radiusX?: number, radiusY?: number);
|
|
11
|
+
contains(p: Point): boolean;
|
|
12
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Circle } from '@/utils/visual/shape/circle';
|
|
2
|
+
import { Ellipse } from '@/utils/visual/shape/ellipse';
|
|
3
|
+
import { Polygon } from '@/utils/visual/shape/polygon';
|
|
4
|
+
import { Rectangle } from '@/utils/visual/shape/rectangle';
|
|
5
|
+
import { Shape } from '@/utils/visual/shape/shape';
|
|
6
|
+
import { RoundedRectangle } from '@/utils/visual/shape/roundedRectangle';
|
|
7
|
+
export { Shape, Circle, Ellipse, Polygon, Rectangle, RoundedRectangle };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Shape } from '@/utils/visual/shape/shape';
|
|
2
|
+
import { SHAPE_TYPE } from '@/utils/visual/enums';
|
|
3
|
+
import type { Point } from '@/utils/visual/vertex/point';
|
|
4
|
+
export declare class Polygon extends Shape {
|
|
5
|
+
points: number[];
|
|
6
|
+
closeStroke: boolean;
|
|
7
|
+
type: SHAPE_TYPE;
|
|
8
|
+
constructor(points?: number[]);
|
|
9
|
+
private isIntersect;
|
|
10
|
+
contains(p: Point): boolean;
|
|
11
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Shape } from '@/utils/visual/shape/shape';
|
|
2
|
+
import { SHAPE_TYPE } from '@/utils/visual/enums';
|
|
3
|
+
import type { Point } from '@/utils/visual/vertex/point';
|
|
4
|
+
export declare class Rectangle extends Shape {
|
|
5
|
+
x: number;
|
|
6
|
+
y: number;
|
|
7
|
+
width: number;
|
|
8
|
+
height: number;
|
|
9
|
+
type: SHAPE_TYPE;
|
|
10
|
+
constructor(x?: number, y?: number, width?: number, height?: number);
|
|
11
|
+
contains(p: Point): boolean;
|
|
12
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Shape } from '@/utils/visual/shape/shape';
|
|
2
|
+
import { SHAPE_TYPE } from '@/utils/visual/enums';
|
|
3
|
+
import type { Point } from '@/utils/visual/vertex/point';
|
|
4
|
+
export declare class RoundedRectangle extends Shape {
|
|
5
|
+
x: number;
|
|
6
|
+
y: number;
|
|
7
|
+
width: number;
|
|
8
|
+
height: number;
|
|
9
|
+
radius: number;
|
|
10
|
+
readonly type = SHAPE_TYPE.ROUNDED_RECTANGLE;
|
|
11
|
+
constructor(x?: number, y?: number, width?: number, height?: number, radius?: number);
|
|
12
|
+
contains(p: Point): boolean;
|
|
13
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { LINE_CAP, LINE_JOIN } from '@/utils/visual/enums';
|
|
2
|
+
import { Fill } from '@/utils/visual/style/fill';
|
|
3
|
+
export declare class Line extends Fill {
|
|
4
|
+
width: number;
|
|
5
|
+
cap: LINE_CAP;
|
|
6
|
+
join: LINE_JOIN;
|
|
7
|
+
miterLimit: number;
|
|
8
|
+
clone(): Line;
|
|
9
|
+
reset(): void;
|
|
10
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { LINE_CAP, LINE_JOIN, RENDERER_TYPE } from '@/utils/visual/enums';
|
|
2
|
+
export interface IApplicationOptions {
|
|
3
|
+
prefer?: RENDERER_TYPE.CANVAS | RENDERER_TYPE.WEB_GL | RENDERER_TYPE.WEB_GPU;
|
|
4
|
+
view?: HTMLCanvasElement;
|
|
5
|
+
backgroundColor?: string;
|
|
6
|
+
backgroundAlpha?: number;
|
|
7
|
+
debug?: boolean;
|
|
8
|
+
}
|
|
9
|
+
export interface IFillStyleOptions {
|
|
10
|
+
color?: string;
|
|
11
|
+
alpha?: number;
|
|
12
|
+
visible?: boolean;
|
|
13
|
+
}
|
|
14
|
+
export interface ILineStyleOptions extends IFillStyleOptions {
|
|
15
|
+
width?: number;
|
|
16
|
+
cap?: LINE_CAP;
|
|
17
|
+
join?: LINE_JOIN;
|
|
18
|
+
}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { Vertex } from '@/utils/visual/vertex/vertex';
|
|
2
|
+
import type { CanvasRenderer } from '@/utils/visual/render/canvasRenderer';
|
|
3
|
+
import type { Point } from '@/utils/visual/vertex/point';
|
|
4
|
+
import type { BatchRenderer } from '@/utils/visual/render/batchRenderer';
|
|
5
|
+
import type { Batch } from '@/utils/visual/render/utils/batch/index';
|
|
6
|
+
export declare class Container extends Vertex {
|
|
7
|
+
isSort: boolean;
|
|
8
|
+
type: string;
|
|
9
|
+
/**
|
|
10
|
+
* 所有子元素
|
|
11
|
+
*/
|
|
12
|
+
readonly children: Container[];
|
|
13
|
+
/**
|
|
14
|
+
* 用来标记 worldTransform 是否发生了改变
|
|
15
|
+
*/
|
|
16
|
+
protected worldId: number;
|
|
17
|
+
/**
|
|
18
|
+
* 所有 batch
|
|
19
|
+
*/
|
|
20
|
+
protected batches: Batch[];
|
|
21
|
+
/**
|
|
22
|
+
* batch 总数
|
|
23
|
+
*/
|
|
24
|
+
protected batchCount: number;
|
|
25
|
+
/**
|
|
26
|
+
* 场景结构版本号(仅根节点上的值有意义)。任何会改变“大数组该长什么样”的操作
|
|
27
|
+
* (增删子节点、Graphics 重绘)都会冒泡到根节点并使其 +1,渲染器据此决定是否重建大数组。
|
|
28
|
+
*/
|
|
29
|
+
structureVersion: number;
|
|
30
|
+
constructor();
|
|
31
|
+
/**
|
|
32
|
+
* 标记场景结构已变化:冒泡到根节点并递增其版本号,触发下一帧的大数组重建。
|
|
33
|
+
*/
|
|
34
|
+
protected markStructureDirty: () => void;
|
|
35
|
+
/**
|
|
36
|
+
* @description: 添加子元素
|
|
37
|
+
* @param {Container} child
|
|
38
|
+
* @return {*}
|
|
39
|
+
*/
|
|
40
|
+
addChild: (child: Container) => void;
|
|
41
|
+
/**
|
|
42
|
+
* @description:删除子元素
|
|
43
|
+
* @param {Container} child
|
|
44
|
+
* @return {void}
|
|
45
|
+
*/
|
|
46
|
+
removeChild: (child: Container) => void;
|
|
47
|
+
/**
|
|
48
|
+
* @description: 根据 z-index 排序子元素
|
|
49
|
+
* @return {*}
|
|
50
|
+
*/
|
|
51
|
+
sortChildren: () => void;
|
|
52
|
+
/**
|
|
53
|
+
* 渲染自身,在 container 上面没有东西要渲染,所以这个函数的内容为空
|
|
54
|
+
*/
|
|
55
|
+
protected renderCanvas(_render: CanvasRenderer): void;
|
|
56
|
+
/**
|
|
57
|
+
* 递归渲染以自身为根的整棵节点树
|
|
58
|
+
*/
|
|
59
|
+
renderCanvasRecursive: (render: CanvasRenderer) => void;
|
|
60
|
+
/**
|
|
61
|
+
* 递归更新当前元素以及所有子元素的 transform
|
|
62
|
+
*/
|
|
63
|
+
updateTransform: () => void;
|
|
64
|
+
containsPoint: (p: Point) => boolean;
|
|
65
|
+
/**
|
|
66
|
+
* 构建自身的 batch。组容器自身没有可渲染内容,子类(如 Graphics)会重写此方法。
|
|
67
|
+
* WebGL / WebGPU 后端统一通过 BatchRenderer 的 buildArray 递归调用本方法。
|
|
68
|
+
*/
|
|
69
|
+
buildBatches(_batchRenderer: BatchRenderer): void;
|
|
70
|
+
/**
|
|
71
|
+
* 更新自身的所有 batch 对应的大数组中的顶点
|
|
72
|
+
*/
|
|
73
|
+
updateBatches(_floatView: Float32Array): void;
|
|
74
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export declare class Point {
|
|
2
|
+
x: number;
|
|
3
|
+
y: number;
|
|
4
|
+
constructor(x?: number, y?: number);
|
|
5
|
+
set(x?: number, y?: number): void;
|
|
6
|
+
clone: () => Point;
|
|
7
|
+
}
|
|
8
|
+
export declare class ObservablePoint {
|
|
9
|
+
private _x;
|
|
10
|
+
private _y;
|
|
11
|
+
private cb;
|
|
12
|
+
constructor(cb: (x: number, y: number) => void, x?: number, y?: number);
|
|
13
|
+
set(x?: number, y?: number): void;
|
|
14
|
+
get x(): number;
|
|
15
|
+
set x(value: number);
|
|
16
|
+
get y(): number;
|
|
17
|
+
set y(value: number);
|
|
18
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { SyncHook } from '@/utils/subscribe';
|
|
2
|
+
import { Transform } from '@/utils/visual/math/transform';
|
|
3
|
+
import type { Container } from '@/utils/visual/vertex/container';
|
|
4
|
+
import type { ObservablePoint } from '@/utils/visual/vertex/point';
|
|
5
|
+
import type { Matrix } from '@/utils/visual/math/matrix';
|
|
6
|
+
import type { Cursor, FederatedEventMap } from '@/utils/visual/event';
|
|
7
|
+
import type { Shape } from '@/utils/visual/shape';
|
|
8
|
+
export declare abstract class Vertex extends SyncHook {
|
|
9
|
+
protected _zIndex: number;
|
|
10
|
+
parent: Container | undefined;
|
|
11
|
+
visible: boolean;
|
|
12
|
+
transform: Transform;
|
|
13
|
+
alpha: number;
|
|
14
|
+
worldAlpha: number;
|
|
15
|
+
hitArea: Shape | null;
|
|
16
|
+
cursor: Cursor;
|
|
17
|
+
get zIndex(): number;
|
|
18
|
+
set zIndex(value: number);
|
|
19
|
+
get position(): ObservablePoint;
|
|
20
|
+
get localTransform(): Matrix;
|
|
21
|
+
get worldTransform(): Matrix;
|
|
22
|
+
get x(): number;
|
|
23
|
+
set x(value: number);
|
|
24
|
+
get y(): number;
|
|
25
|
+
set y(value: number);
|
|
26
|
+
get scale(): ObservablePoint;
|
|
27
|
+
get pivot(): ObservablePoint;
|
|
28
|
+
get skew(): ObservablePoint;
|
|
29
|
+
get rotation(): number;
|
|
30
|
+
set rotation(value: number);
|
|
31
|
+
get angle(): number;
|
|
32
|
+
set angle(value: number);
|
|
33
|
+
updateTransform(): void;
|
|
34
|
+
addEventListener: <K extends keyof FederatedEventMap>(type: K, listener: (e: FederatedEventMap[K]) => unknown, options?: boolean | AddEventListenerOptions) => void;
|
|
35
|
+
removeEventListener: <K extends keyof FederatedEventMap>(type: K, listener: (e: FederatedEventMap[K]) => unknown, capture?: boolean) => void;
|
|
36
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @description: 链式调用的 dom 操作
|
|
3
|
+
* @return {HTMLElement}
|
|
4
|
+
*/
|
|
5
|
+
export declare class Chain {
|
|
6
|
+
element: HTMLElement;
|
|
7
|
+
constructor(tagName: string, options?: ElementCreationOptions);
|
|
8
|
+
/**
|
|
9
|
+
* @description: 创建元素
|
|
10
|
+
* @param {string} tagName
|
|
11
|
+
* @param {ElementCreationOptions} options
|
|
12
|
+
* @return {Chain}
|
|
13
|
+
*/
|
|
14
|
+
create: (tagName: string, options?: ElementCreationOptions) => HTMLElement;
|
|
15
|
+
/**
|
|
16
|
+
* @description: 设置当前元素的属性
|
|
17
|
+
* @param {string} name
|
|
18
|
+
* @param {string} value
|
|
19
|
+
* @return {Chain}
|
|
20
|
+
*/
|
|
21
|
+
setAttribute: (name: string, value: string) => Chain;
|
|
22
|
+
/**
|
|
23
|
+
* @description: 移除当前元素的属性
|
|
24
|
+
* @param {string} name
|
|
25
|
+
* @return {Chain}
|
|
26
|
+
*/
|
|
27
|
+
removeAttribute: (name: string) => Chain;
|
|
28
|
+
/**
|
|
29
|
+
* @description: 当前元素添加子元素
|
|
30
|
+
* @param {HTMLElement} child
|
|
31
|
+
* @return {ChainElement}
|
|
32
|
+
*/
|
|
33
|
+
append: (child: HTMLElement) => Chain;
|
|
34
|
+
/**
|
|
35
|
+
* @description: 当前元素移除子元素
|
|
36
|
+
* @param {HTMLElement} child
|
|
37
|
+
* @return {Chain}
|
|
38
|
+
*/
|
|
39
|
+
remove: (child: HTMLElement) => Chain;
|
|
40
|
+
/**
|
|
41
|
+
* @description: 给当前元素设置文本内容
|
|
42
|
+
* @param {string} text
|
|
43
|
+
* @return {Chain}
|
|
44
|
+
*/
|
|
45
|
+
setTextContent: (text: string) => Chain;
|
|
46
|
+
}
|
|
47
|
+
export declare const create: (tagName: string, options?: ElementCreationOptions) => Chain;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { VNode, VNodeChildren, VNodeData } from './vnode';
|
|
2
|
+
export declare function addNS(data: VNodeData, children: Array<VNode | string | number> | undefined, sel: string | undefined): void;
|
|
3
|
+
export declare function h(sel: string): VNode;
|
|
4
|
+
export declare function h(sel: string, data: VNodeData | null): VNode;
|
|
5
|
+
export declare function h(sel: string, children: VNodeChildren): VNode;
|
|
6
|
+
export declare function h(sel: string, data: VNodeData | null, children: VNodeChildren): VNode;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { VNode } from './vnode';
|
|
2
|
+
export type PreHook = () => any;
|
|
3
|
+
export type InitHook = (vNode: VNode) => any;
|
|
4
|
+
export type CreateHook = (emptyVNode: VNode, vNode: VNode) => any;
|
|
5
|
+
export type InsertHook = (vNode: VNode) => any;
|
|
6
|
+
export type PrePatchHook = (oldVNode: VNode, vNode: VNode) => any;
|
|
7
|
+
export type UpdateHook = (oldVNode: VNode, vNode: VNode) => any;
|
|
8
|
+
export type PostPatchHook = (oldVNode: VNode, vNode: VNode) => any;
|
|
9
|
+
export type DestroyHook = (vNode: VNode) => any;
|
|
10
|
+
export type RemoveHook = (vNode: VNode, removeCallback: () => void) => any;
|
|
11
|
+
export type PostHook = () => any;
|
|
12
|
+
export interface Hooks {
|
|
13
|
+
pre?: PreHook;
|
|
14
|
+
init?: InitHook;
|
|
15
|
+
create?: CreateHook;
|
|
16
|
+
insert?: InsertHook;
|
|
17
|
+
prepatch?: PrePatchHook;
|
|
18
|
+
update?: UpdateHook;
|
|
19
|
+
postpatch?: PostPatchHook;
|
|
20
|
+
destroy?: DestroyHook;
|
|
21
|
+
remove?: RemoveHook;
|
|
22
|
+
post?: PostHook;
|
|
23
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
export interface Fragment extends DocumentFragment {
|
|
2
|
+
parent: Node | null;
|
|
3
|
+
firstChildNode: ChildNode | null;
|
|
4
|
+
lastChildNode: ChildNode | null;
|
|
5
|
+
}
|
|
6
|
+
export interface DOMAPI {
|
|
7
|
+
createElement: (tagName: any, options?: ElementCreationOptions) => HTMLElement;
|
|
8
|
+
createElementNS: (namespaceURI: string, qualifiedName: string, options?: ElementCreationOptions) => Element;
|
|
9
|
+
/**
|
|
10
|
+
* @experimental
|
|
11
|
+
* @todo Make it required when the fragment is considered stable.
|
|
12
|
+
*/
|
|
13
|
+
createDocumentFragment?: () => Fragment;
|
|
14
|
+
createTextNode: (text: string) => Text;
|
|
15
|
+
createComment: (text: string) => Comment;
|
|
16
|
+
insertBefore: (parentNode: Node, newNode: Node, referenceNode: Node | null) => void;
|
|
17
|
+
removeChild: (node: Node, child: Node) => void;
|
|
18
|
+
appendChild: (node: Node, child: Node) => void;
|
|
19
|
+
parentNode: (node: Node) => Node | null;
|
|
20
|
+
nextSibling: (node: Node) => Node | null;
|
|
21
|
+
tagName: (elm: Element) => string;
|
|
22
|
+
setTextContent: (node: Node, text: string | null) => void;
|
|
23
|
+
getTextContent: (node: Node) => string | null;
|
|
24
|
+
isElement: (node: Node) => node is Element;
|
|
25
|
+
isText: (node: Node) => node is Text;
|
|
26
|
+
isComment: (node: Node) => node is Comment;
|
|
27
|
+
/**
|
|
28
|
+
* @experimental
|
|
29
|
+
* @todo Make it required when the fragment is considered stable.
|
|
30
|
+
*/
|
|
31
|
+
isDocumentFragment?: (node: Node) => node is DocumentFragment;
|
|
32
|
+
}
|
|
33
|
+
export declare const htmlDomApi: DOMAPI;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { init } from './init';
|
|
2
|
+
import { addNS, h } from './h';
|
|
3
|
+
import { vnode } from './vnode';
|
|
4
|
+
import { Chain, create } from './chainDom';
|
|
5
|
+
import { htmlDomApi } from './htmlDomApi';
|
|
6
|
+
import { modules } from './modules';
|
|
7
|
+
import { attributesModule } from './modules/attributes';
|
|
8
|
+
import { classModule } from './modules/class';
|
|
9
|
+
import { eventListenersModule } from './modules/listeners';
|
|
10
|
+
import { propsModule } from './modules/props';
|
|
11
|
+
import { styleModule } from './modules/style';
|
|
12
|
+
import * as is from './is';
|
|
13
|
+
import type { ArrayOrElement, Key, VNode, VNodeChildElement, VNodeChildren, VNodeData, VNodes } from './vnode';
|
|
14
|
+
import type { Hooks } from './hooks';
|
|
15
|
+
import type { DOMAPI, Fragment } from './htmlDomApi';
|
|
16
|
+
import type { ModuleHook, Modules } from './modules';
|
|
17
|
+
export { init, h, addNS, vnode, Chain, create, htmlDomApi, modules, attributesModule, classModule, eventListenersModule, propsModule, styleModule, is, };
|
|
18
|
+
export type { VNode, VNodeData, VNodes, VNodeChildren, VNodeChildElement, ArrayOrElement, Key, Hooks, DOMAPI, Fragment, Modules, ModuleHook, };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e}from"../../rolldown-runtime-I3TIJKkN.js";function t(e,t,n,o,r){return{sel:e,data:t,children:n,text:o,elm:r,key:void 0===t?void 0:t.key}}function n(e){if(o(e)){for(;e&&o(e);)e=r(e).parent;return e??null}return e.parentNode}function o(e){return 11===e.nodeType}function r(e,t){const n=e;return n.parent??=t??null,n.firstChildNode??=e.firstChild,n.lastChildNode??=e.lastChild,n}var i={createElement:function(e,t){return document.createElement(e,t)},createElementNS:function(e,t,n){return document.createElementNS(e,t,n)},createTextNode:function(e){return document.createTextNode(e)},createDocumentFragment:function(){return r(document.createDocumentFragment())},createComment:function(e){return document.createComment(e)},insertBefore:function(e,t,n){if(o(e)){let t=e;for(;t&&o(t);)t=r(t).parent;e=t??e}o(t)&&(t=r(t,e)),n&&o(n)&&(n=r(n).firstChildNode),e.insertBefore(t,n)},removeChild:function(e,t){e.removeChild(t)},appendChild:function(e,t){o(t)&&(t=r(t,e)),e.appendChild(t)},parentNode:n,nextSibling:function(e){if(o(e)){const t=r(e),o=n(t);if(o&&t.lastChildNode){const e=Array.from(o.childNodes);return e[e.indexOf(t.lastChildNode)+1]??null}return null}return e.nextSibling},tagName:function(e){return e.tagName},setTextContent:function(e,t){e.textContent=t},getTextContent:function(e){return e.textContent},isElement:function(e){return 1===e.nodeType},isText:function(e){return 3===e.nodeType},isComment:function(e){return 8===e.nodeType},isDocumentFragment:o},l=/* @__PURE__ */e({array:()=>s,isStr:()=>c,isVnode:()=>d,primitive:()=>a}),s=Array.isArray,c=e=>"string"==typeof e;function a(e){return"string"==typeof e||"number"==typeof e}function d(e){return!!e?.sel}function u(e,t){let n;const o=t.elm;let r=e.data&&e.data.attrs,i=t.data&&t.data.attrs;if((r||i)&&r!==i){for(n in r=r||{},i=i||{},i){const e=i[n];r[n]!==e&&(!0===e?o.setAttribute(n,""):!1===e?o.removeAttribute(n):120!==n.charCodeAt(0)?o.setAttribute(n,e):58===n.charCodeAt(3)?o.setAttributeNS("http://www.w3.org/XML/1998/namespace",n,e):58===n.charCodeAt(5)?o.setAttributeNS("http://www.w3.org/1999/xlink",n,e):o.setAttribute(n,`${e}`))}for(n in r)n in i||o.removeAttribute(n)}}var f={create:u,update:u};function m(e,t){let n,o;const r=t.elm;let i=e.data&&e.data.class,l=t.data&&t.data.class;if((i||l)&&i!==l){for(o in i=i||{},l=l||{},i)i[o]&&!Object.prototype.hasOwnProperty.call(l,o)&&r.classList.remove(o);for(o in l)n=l[o],n!==i[o]&&r.classList[n?"add":"remove"](o)}}var p={create:m,update:m};function v(e,t,n){if((e=>"function"==typeof e)(e))e.call(t,n,t);else if("object"==typeof e)for(let o=0;o<e.length;o++)v(e[o],t,n)}function h(e,t){const n=e.type,o=t.data&&t.data.on;o&&o[n]&&v(o[n],t,e)}function y(e,t){const n=e?.data?.on,o=e?.listener,r=e.elm,i=t?.data?.on,l=t&&t.elm;let s;if(n!==i){if(n&&o)if(i)for(s in n)i[s]||r.removeEventListener(s,o,!1);else for(s in n)r.removeEventListener(s,o,!1);if(i){const o=t.listener=e.listener||function e(t){h(t,e.vnode)};if(n)for(s in i)n[s]||l.addEventListener(s,o,!1);else for(s in i)l.addEventListener(s,o,!1)}}}var g={create:y,update:y,destroy:y};function C(e,t){let n,o,r;const i=t.elm;let l=e.data?e.data.props:void 0,s=t.data?t.data.props:void 0;if((l||s)&&l!==s)for(n in l=l||{},s=s||{},s)o=s[n],r=l[n],r===o||"value"===n&&i[n]===o||(i[n]=o)}var x={create:C,update:C},b=!1;function N(e,t){let n,o;const r=t.elm;let i=e.data.style,l=t.data.style;if((i||l)&&i!==l){for(o in i=i||{},l=l||{},i)l[o]||("-"===o[0]&&"-"===o[1]?r.style.removeProperty(o):r.style[o]="");for(o in l)n=l[o],n!==i[o]&&("-"===o[0]&&"-"===o[1]?r.style.setProperty(o,n):r.style[o]=n)}}var A={pre:function(){b=!1},create:N,update:N,destroy:function(e){let t,n;const o=e.elm,r=e.data.style;if(r&&(t=r.destroy))for(n in t)o.style[n]=t[n]},remove:function(e,t){const n=e.data.style;if(!n||!n.remove)return void t();let o;b||(b=!0);const r=e.elm;let i=0;const l=n.remove;let s=0;const c=[];for(o in l)c.push(o),r.style[o]=l[o];const a=getComputedStyle(r)["transition-property"].split(", ");for(;i<a.length;++i)-1!==c.indexOf(a[i])&&s++;r.addEventListener("transitionend",function(e){e.target===r&&--s,0===s&&t()})}},w={attributesModule:f,classModule:p,eventListenersModule:g,propsModule:x,styleModule:A};function E(e,t){return e.key===t.key&&e.sel===t.sel}function T(e,t,n){const o={};for(let r=t;r<=n;++r){const t=e[r]?.key;void 0!==t&&(o[t]=r)}return o}var L=t("",{},[],void 0,void 0);function S(){const e=i,n={create:[],update:[],destroy:[]};for(const t of Object.keys(n)){n[t]=[];for(const e of Object.keys(w)){const o=w[e][t];void 0!==o&&n[t].push(o)}}function o(n){const o=n.id?"#"+n.id:"",r=n.className?"."+n.className.split(" ").join("."):"";return t(e.tagName(n).toLowerCase()+o+r,{},[],void 0,n)}function r(e){return void 0===e}function l(e){return void 0!==e}function c(t){let o;const i=t.children,l=t.sel;if("!"===l)r(t.text)&&(t.text=""),t.elm=e.createComment(`${t.text}`);else if(void 0!==l){const r=l.indexOf("#"),d=l.indexOf(".",r),u=r>0?r:l.length,f=d>0?d:l.length,m=-1!==r||-1!==d?l.slice(0,Math.min(u,f)):l,p=t.elm=e.createElement(m);for(u<f&&p.setAttribute("id",l.slice(u+1,f)),d>0&&p.setAttribute("class",l.slice(f+1).replace(/\./g," ")),o=0;o<n.create.length;++o)n.create[o](L,t);if(s(i))for(o=0;o<i.length;++o){const t=i[o];null!=t&&e.appendChild(p,c(t))}else a(t.text)&&e.appendChild(p,e.createTextNode(`${t.text}`))}else t.elm=e.createTextNode(`${t.text}`);return t.elm}function d(e){if(void 0!==e.data){for(let t=0;t<n.destroy.length;++t)n.destroy[t](e);if(void 0!==e.children)for(let t=0;t<e.children.length;++t){const n=e.children[t];null!=n&&"string"!=typeof n&&"number"!=typeof n&&d(n)}}}function u(t){return function(){const n=e.parentNode(t);e.removeChild(n,t)}}function f(t,n,o,r){for(;o<=r;++o){let r;const i=n[o];null!=i&&(l(i.sel)?(d(i),r=u(i.elm),r()):e.removeChild(t,i.elm))}}function m(t,n,o){let i,l,s,a,d=0,u=0,m=n.length-1,v=o.length-1,h=n[0],y=n[m],g=o[0],C=o[v];for(;d<=m&&u<=v;)null==h?h=n[++d]:null==y?y=n[--m]:null==g?g=o[++u]:null==C?C=o[--v]:E(h,g)?(p(h,g),h=n[++d],g=o[++u]):E(y,C)?(p(y,C),y=n[--m],C=o[--v]):E(h,C)?(p(h,C),e.insertBefore(t,h.elm,e.nextSibling(y.elm)),h=n[++d],C=o[--v]):E(y,g)?(p(y,g),e.insertBefore(t,y.elm,h.elm),y=n[--m],g=o[++u]):(void 0===i&&(i=T(n,d,m)),l=i[g.key],r(l)?e.insertBefore(t,c(g),h.elm):(s=n[l],s.sel!==g.sel?e.insertBefore(t,c(g),h.elm):(p(s,g),n[l]=void 0,e.insertBefore(t,s.elm,h.elm))),g=o[++u]);(d<=m||u<=v)&&(d>m?(a=null==o[v+1]?null:o[v+1].elm,function(t,n,o,r,i){for(;r<=i;++r){const i=o[r];null!=i&&e.insertBefore(t,c(i),n)}}(t,a,o,u,v)):f(t,n,d,m))}function p(e,t){if(void 0!==t.data)for(let r=0;r<n.update.length;++r)n.update[r](e,t);const o=t.elm=e.elm,i=e.children,s=t.children;e!==t&&r(t.text)&&l(i)&&l(s)&&i!==s&&m(o,i,s)}return function(t,n){let r,i;return function(e){return void 0!==e.sel}(t)||(t=o(t)),E(t,n)?p(t,n):(r=t.elm,i=e.parentNode(r),c(n),null!=i&&(e.insertBefore(i,n.elm,e.nextSibling(r)),f(i,[t],0,0))),n}}function k(e,t,n){if(e.ns="http://www.w3.org/2000/svg","foreignObject"!==n&&void 0!==t)for(let o=0;o<t.length;++o){const e=t[o];if("string"==typeof e||"number"==typeof e)continue;const n=e.data;void 0!==n&&k(n,e.children,e.sel)}}function B(e,n,o){let r,i,l,c={};if(void 0!==o?(null!=n&&(c=n),s(o)?r=o:a(o)?i=o:o&&o.sel&&(r=[o])):void 0!==n&&null!=n&&(s(n)?r=n:a(n)?i=n:d(n)?r=[n]:c=n),void 0!==r)for(l=0;l<r.length;++l){const e=r[l];a(e)&&(r[l]=t(void 0,void 0,void 0,e,void 0))}return"s"!==e[0]||"v"!==e[1]||"g"!==e[2]||3!==e.length&&"."!==e[3]&&"#"!==e[3]||k(c,r,e),t(e,c,r,i,void 0)}var O=class{element;constructor(e,t){this.element=this.create(e,t)}create=(e,t)=>document.createElement(e,t);setAttribute=(e,t)=>(this.element.setAttribute(e,t),this);removeAttribute=e=>(this.element.removeAttribute(e),this);append=e=>(this.element.appendChild(e),this);remove=e=>(this.element.removeChild(e),this);setTextContent=e=>(this.element.textContent=e,this)},j=(e,t)=>new O(e,t);export{O as Chain,k as addNS,f as attributesModule,p as classModule,j as create,g as eventListenersModule,B as h,i as htmlDomApi,S as init,l as is,w as modules,x as propsModule,A as styleModule,t as vnode};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { VNode } from './vnode';
|
|
2
|
+
export declare const array: (arg: any) => arg is any[];
|
|
3
|
+
export declare const isStr: (str: unknown) => str is string;
|
|
4
|
+
export declare function primitive(s: unknown): s is string | number;
|
|
5
|
+
export declare function isVnode(s: any): s is VNode;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { VNode } from '../vnode';
|
|
2
|
+
export type Attrs = Record<string, string | number | boolean>;
|
|
3
|
+
declare function updateAttrs(oldVnode: VNode, vnode: VNode): void;
|
|
4
|
+
export declare const attributesModule: {
|
|
5
|
+
create: typeof updateAttrs;
|
|
6
|
+
update: typeof updateAttrs;
|
|
7
|
+
};
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { VNode } from '../vnode';
|
|
2
|
+
export type Classes = Record<string, boolean>;
|
|
3
|
+
declare function updateClass(oldVnode: VNode, vnode: VNode): void;
|
|
4
|
+
export declare const classModule: {
|
|
5
|
+
create: typeof updateClass;
|
|
6
|
+
update: typeof updateClass;
|
|
7
|
+
};
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { VNode } from '../vnode';
|
|
2
|
+
type Listener<T> = (this: VNode, ev: T, vnode: VNode) => void;
|
|
3
|
+
export type On = {
|
|
4
|
+
[N in keyof HTMLElementEventMap]?: Listener<HTMLElementEventMap[N]> | Array<Listener<HTMLElementEventMap[N]>>;
|
|
5
|
+
} & Record<string, Listener<any> | Array<Listener<any>>>;
|
|
6
|
+
declare function updateEventListeners(oldVnode: VNode, vnode?: VNode): void;
|
|
7
|
+
export declare const eventListenersModule: {
|
|
8
|
+
create: typeof updateEventListeners;
|
|
9
|
+
update: typeof updateEventListeners;
|
|
10
|
+
destroy: typeof updateEventListeners;
|
|
11
|
+
};
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { VNode } from '../vnode';
|
|
2
|
+
export type Props = Record<string, any>;
|
|
3
|
+
declare function updateProps(oldVnode: VNode, vnode: VNode): void;
|
|
4
|
+
export declare const propsModule: {
|
|
5
|
+
create: typeof updateProps;
|
|
6
|
+
update: typeof updateProps;
|
|
7
|
+
};
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { VNode } from '../vnode';
|
|
2
|
+
export type VNodeStyle = Record<string, any>;
|
|
3
|
+
declare function updateStyle(oldVnode: VNode, vnode: VNode): void;
|
|
4
|
+
declare function forceReflow(): void;
|
|
5
|
+
declare function applyDestroyStyle(vnode: VNode): void;
|
|
6
|
+
declare function applyRemoveStyle(vnode: VNode, rm: () => void): void;
|
|
7
|
+
export declare const styleModule: {
|
|
8
|
+
pre: typeof forceReflow;
|
|
9
|
+
create: typeof updateStyle;
|
|
10
|
+
update: typeof updateStyle;
|
|
11
|
+
destroy: typeof applyDestroyStyle;
|
|
12
|
+
remove: typeof applyRemoveStyle;
|
|
13
|
+
};
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { On } from './modules/listeners';
|
|
2
|
+
import type { Attrs } from './modules/attributes';
|
|
3
|
+
import type { Classes } from './modules/class';
|
|
4
|
+
import type { Props } from './modules/props';
|
|
5
|
+
import type { VNodeStyle } from './modules/style';
|
|
6
|
+
import type { Hooks } from './hooks';
|
|
7
|
+
export type VNodes = VNode[];
|
|
8
|
+
export type VNodeChildElement = VNode | string | number;
|
|
9
|
+
export type ArrayOrElement<T> = T | T[];
|
|
10
|
+
export type VNodeChildren = ArrayOrElement<VNodeChildElement>;
|
|
11
|
+
export type Key = string | number;
|
|
12
|
+
export interface VNode {
|
|
13
|
+
sel: string | undefined;
|
|
14
|
+
data: VNodeData | undefined;
|
|
15
|
+
children: Array<VNode | string | number> | undefined;
|
|
16
|
+
elm: Node | undefined;
|
|
17
|
+
text: string | number | undefined;
|
|
18
|
+
key: Key | undefined;
|
|
19
|
+
listener?: EventListenerOrEventListenerObject | undefined;
|
|
20
|
+
}
|
|
21
|
+
export interface VNodeData {
|
|
22
|
+
props?: Props;
|
|
23
|
+
attrs?: Attrs;
|
|
24
|
+
class?: Classes;
|
|
25
|
+
style?: VNodeStyle;
|
|
26
|
+
on?: On;
|
|
27
|
+
key?: Key;
|
|
28
|
+
ns?: string;
|
|
29
|
+
hook?: Hooks;
|
|
30
|
+
}
|
|
31
|
+
export declare function vnode(sel: string | undefined, data: any | undefined, children: Array<VNode | string | number> | undefined, text: string | number | undefined, elm: Element | Text | undefined): VNode;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var t=class{_events=/* @__PURE__ */new Map;tap=(t,e)=>{this._events.get(t)&&t!==Symbol.for("NEW_LISTENER")&&this.call(Symbol.for("NEW_LISTENER"),t);const a=this._events.get(t)||/* @__PURE__ */new Set;return"function"==typeof e?a.add({name:t,callback:e}):a.add(e),this._events.set(t,a),this};call=(t,...e)=>((this._events.get(t)||/* @__PURE__ */new Set).forEach(t=>{const{callback:a}=t;a(...e)}),this);callSync=async(t,...e)=>{const a=this._events.get(t)||/* @__PURE__ */new Set;for(const n of a){const{callback:t}=n;await t(...e)}return this};once=(t,e)=>{let a;if("function"==typeof e)a={name:t,callback:(...n)=>{e(...n),this.off(t,a)},initialCallback:e};else{const{callback:n}=e;a={name:t,callback:(...e)=>{n(...e),this.off(t,a)},initialCallback:n}}return this.tap(t,a),this};off=(t,e)=>{const a=[...this._events.get(t)||/* @__PURE__ */new Set].filter(t=>{if("function"==typeof e)return t.callback!==e&&t.initialCallback!==e;{const{callback:a}=e;return t.callback!==a&&t.initialCallback!==a}});return this._events.set(t,new Set(a)),this}};export{t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|