@fi4f/hg 0.0.1 → 0.0.3
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/core/asset.d.ts.map +1 -0
- package/dist/core/asset.js.map +1 -0
- package/dist/core/event.d.ts.map +1 -0
- package/dist/core/event.js.map +1 -0
- package/dist/{scene.d.ts → core/scene.d.ts} +1 -1
- package/dist/core/scene.d.ts.map +1 -0
- package/dist/core/scene.js.map +1 -0
- package/dist/{stage.d.ts → core/stage.d.ts} +1 -1
- package/dist/core/stage.d.ts.map +1 -0
- package/dist/{stage.js → core/stage.js} +1 -1
- package/dist/core/stage.js.map +1 -0
- package/dist/hg.d.ts +11 -11
- package/dist/hg.d.ts.map +1 -1
- package/dist/hg.js +15 -12
- package/dist/hg.js.map +1 -1
- package/dist/{math.d.ts → math/index.d.ts} +1 -1
- package/dist/math/index.d.ts.map +1 -0
- package/dist/{math.js → math/index.js} +1 -1
- package/dist/math/index.js.map +1 -0
- package/dist/{matrix2.d.ts → math/matrix2.d.ts} +5 -38
- package/dist/math/matrix2.d.ts.map +1 -0
- package/dist/{matrix2.js → math/matrix2.js} +17 -17
- package/dist/math/matrix2.js.map +1 -0
- package/dist/math/matrix3.d.ts +92 -0
- package/dist/math/matrix3.d.ts.map +1 -0
- package/dist/{matrix3.js → math/matrix3.js} +29 -29
- package/dist/math/matrix3.js.map +1 -0
- package/dist/math/matrix4.d.ts +138 -0
- package/dist/math/matrix4.d.ts.map +1 -0
- package/dist/{matrix4.js → math/matrix4.js} +45 -45
- package/dist/math/matrix4.js.map +1 -0
- package/dist/math/vector2.d.ts.map +1 -0
- package/dist/{vector2.js → math/vector2.js} +1 -1
- package/dist/math/vector2.js.map +1 -0
- package/dist/{vector3.d.ts → math/vector3.d.ts} +4 -16
- package/dist/math/vector3.d.ts.map +1 -0
- package/dist/{vector3.js → math/vector3.js} +9 -9
- package/dist/math/vector3.js.map +1 -0
- package/dist/{vector4.d.ts → math/vector4.d.ts} +5 -20
- package/dist/math/vector4.d.ts.map +1 -0
- package/dist/{vector4.js → math/vector4.js} +11 -11
- package/dist/math/vector4.js.map +1 -0
- package/dist/util/types.d.ts.map +1 -0
- package/dist/util/types.js.map +1 -0
- package/dist/util/version.d.ts.map +1 -0
- package/dist/util/version.js.map +1 -0
- package/package.json +4 -6
- package/.gitattributes +0 -2
- package/.github/workflows/publish.yml +0 -25
- package/dist/asset.d.ts.map +0 -1
- package/dist/asset.js.map +0 -1
- package/dist/event.d.ts.map +0 -1
- package/dist/event.js.map +0 -1
- package/dist/math.d.ts.map +0 -1
- package/dist/math.js.map +0 -1
- package/dist/matrix2.d.ts.map +0 -1
- package/dist/matrix2.js.map +0 -1
- package/dist/matrix3.d.ts +0 -146
- package/dist/matrix3.d.ts.map +0 -1
- package/dist/matrix3.js.map +0 -1
- package/dist/matrix4.d.ts +0 -219
- package/dist/matrix4.d.ts.map +0 -1
- package/dist/matrix4.js.map +0 -1
- package/dist/scene.d.ts.map +0 -1
- package/dist/scene.js.map +0 -1
- package/dist/stage.d.ts.map +0 -1
- package/dist/stage.js.map +0 -1
- package/dist/types.d.ts.map +0 -1
- package/dist/types.js.map +0 -1
- package/dist/vector2.d.ts.map +0 -1
- package/dist/vector2.js.map +0 -1
- package/dist/vector3.d.ts.map +0 -1
- package/dist/vector3.js.map +0 -1
- package/dist/vector4.d.ts.map +0 -1
- package/dist/vector4.js.map +0 -1
- package/dist/version.d.ts.map +0 -1
- package/dist/version.js.map +0 -1
- package/src/asset.ts +0 -249
- package/src/event.ts +0 -174
- package/src/hg.ts +0 -21
- package/src/math.ts +0 -5
- package/src/matrix2.ts +0 -215
- package/src/matrix3.ts +0 -302
- package/src/matrix4.ts +0 -415
- package/src/scene.ts +0 -45
- package/src/stage.ts +0 -481
- package/src/types.ts +0 -1
- package/src/vector2.ts +0 -80
- package/src/vector3.ts +0 -88
- package/src/vector4.ts +0 -96
- package/src/version.ts +0 -26
- package/tsconfig.json +0 -44
- /package/dist/{asset.d.ts → core/asset.d.ts} +0 -0
- /package/dist/{asset.js → core/asset.js} +0 -0
- /package/dist/{event.d.ts → core/event.d.ts} +0 -0
- /package/dist/{event.js → core/event.js} +0 -0
- /package/dist/{scene.js → core/scene.js} +0 -0
- /package/dist/{vector2.d.ts → math/vector2.d.ts} +0 -0
- /package/dist/{types.d.ts → util/types.d.ts} +0 -0
- /package/dist/{types.js → util/types.js} +0 -0
- /package/dist/{version.d.ts → util/version.d.ts} +0 -0
- /package/dist/{version.js → util/version.js} +0 -0
package/dist/vector3.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"vector3.d.ts","sourceRoot":"","sources":["../src/vector3.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,OAAO,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAA;AAE9C,eAAO,MAAM,CAAC,EAAG,CAAU,CAAC;AAC5B,eAAO,MAAM,CAAC,EAAG,CAAU,CAAC;AAC5B,eAAO,MAAM,CAAC,EAAG,CAAU,CAAC;AAE5B,eAAO,MAAM,OAAO;SACb,OAAO;SACP,OAAO;SACP,OAAO;CACb,CAAA;AAED,eAAO,MAAM,OAAO;SACb,OAAO,KAAK,MAAM;SAClB,OAAO,KAAK,MAAM;SAClB,OAAO,KAAK,MAAM;CACxB,CAAA;AAED,wBAAgB,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,CAAE,CAAC,EAAE,MAAM,UAExC;AAED,wBAAgB,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,CAAE,CAAC,EAAE,MAAM,UAExC;AAED,wBAAgB,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,CAAE,CAAC,EAAE,MAAM,UAExC;AAED,eAAO,MAAM,OAAO;;;;;aAvBb,OAAO;aACP,OAAO;aACP,OAAO;;;aAIP,OAAO,KAAK,MAAM;aAClB,OAAO,KAAK,MAAM;aAClB,OAAO,KAAK,MAAM;;;;;gBAqBb,KAAK,CA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CAC1B,CAAA;AAED,eAAO,MAAM,OAAO;cACT;QACP,OAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,KAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,KAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,KAAQ,CAAC,EAAE,MAAM,CAAC;KACnB;;;;;;gBASW,OAAO;CAGpB,CAAA"}
|
package/dist/version.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"version.js","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"AAOA,MAAM,CAAC,MAAM,OAAO,GAAG;IACrB,GAAG,CAAC,CAKH;QACC,OAAO;YACL,OAAO,EAAE,CAAC,EAAE,OAAO,IAAI,IAAI;YAC3B,KAAK,EAAI,CAAC,EAAE,KAAK,IAAM,CAAC;YACxB,KAAK,EAAI,CAAC,EAAE,KAAK,IAAM,CAAC;YACxB,KAAK,EAAI,CAAC,EAAE,KAAK,IAAM,CAAC;SACP,CAAC;IACtB,CAAC;IAED,QAAQ,CAAC,CAAU;QACjB,OAAO,GAAG,CAAC,CAAC,OAAO,IAAI,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,KAAK,EAAE,CAAC;IACzD,CAAC;CACF,CAAA"}
|
package/src/asset.ts
DELETED
|
@@ -1,249 +0,0 @@
|
|
|
1
|
-
export const IMAGE = "image" as const;
|
|
2
|
-
export const AUDIO = "audio" as const;
|
|
3
|
-
export const TEXT = "text" as const;
|
|
4
|
-
export const BLOB = "blob" as const;
|
|
5
|
-
export const JSON = "json" as const;
|
|
6
|
-
|
|
7
|
-
export type IMAGE = typeof IMAGE;
|
|
8
|
-
export type AUDIO = typeof AUDIO;
|
|
9
|
-
export type TEXT = typeof TEXT ;
|
|
10
|
-
export type BLOB = typeof BLOB ;
|
|
11
|
-
export type JSON = typeof JSON ;
|
|
12
|
-
|
|
13
|
-
export type Kind = IMAGE | AUDIO | TEXT | BLOB | JSON;
|
|
14
|
-
|
|
15
|
-
export type Asset<T extends Kind> = { kind: T, path: string, id ?: string | undefined }
|
|
16
|
-
export namespace Asset {
|
|
17
|
-
export type Image = Asset<IMAGE>
|
|
18
|
-
export type Audio = Asset<AUDIO>
|
|
19
|
-
export type Text = Asset<TEXT >
|
|
20
|
-
export type Blob = Asset<BLOB >
|
|
21
|
-
export type Json = Asset<JSON >
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
export type Cache = {
|
|
25
|
-
images: { [id: string]: HTMLImageElement }
|
|
26
|
-
audios: { [id: string]: HTMLAudioElement }
|
|
27
|
-
texts: { [id: string]: string }
|
|
28
|
-
blobs: { [id: string]: globalThis.Blob }
|
|
29
|
-
jsons: { [id: string]: any }
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
export function load(a: Asset<any>) {
|
|
33
|
-
switch (a.kind) {
|
|
34
|
-
case IMAGE: return loadImage(a);
|
|
35
|
-
case AUDIO: return loadAudio(a);
|
|
36
|
-
case TEXT: return loadText (a);
|
|
37
|
-
case BLOB: return loadBlob (a);
|
|
38
|
-
case JSON: return loadJson (a);
|
|
39
|
-
default: throw `[Asset.load]: Unknown kind of asset '${a.kind}'`;
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
export function loadImage(a: Asset.Image) {
|
|
44
|
-
return new Promise<HTMLImageElement>((res, rej) => {
|
|
45
|
-
const image = new Image();
|
|
46
|
-
image.onload = () => res(image);
|
|
47
|
-
image.onerror = () => rej( );
|
|
48
|
-
image.src = a.path;
|
|
49
|
-
})
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
export function loadAudio(a: Asset.Audio) {
|
|
53
|
-
return new Promise<HTMLAudioElement>((res, rej) => {
|
|
54
|
-
const audio = new Audio();
|
|
55
|
-
audio.onload = () => res(audio);
|
|
56
|
-
audio.onerror = () => rej( );
|
|
57
|
-
audio.src = a.path;
|
|
58
|
-
})
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
export async function loadText(a: Asset.Text) {
|
|
62
|
-
return fetch(a.path).then(res => res.text())
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
export async function loadBlob(a: Asset.Blob) {
|
|
66
|
-
return fetch(a.path).then(res => res.blob())
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
export async function loadJson(a: Asset.Json) {
|
|
70
|
-
return fetch(a.path).then(res => res.json())
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
export const Asset = {
|
|
74
|
-
new<T extends Kind>(kind: T, path: string, id ?: string) {
|
|
75
|
-
return { kind, path, id } satisfies Asset<T>
|
|
76
|
-
},
|
|
77
|
-
|
|
78
|
-
Image(path: string, id ?: string) {
|
|
79
|
-
return Asset.new(IMAGE, path, id) satisfies Asset.Image
|
|
80
|
-
},
|
|
81
|
-
|
|
82
|
-
Audio(path: string, id ?: string) {
|
|
83
|
-
return Asset.new(AUDIO, path, id) satisfies Asset.Audio
|
|
84
|
-
},
|
|
85
|
-
|
|
86
|
-
Text(path: string, id ?: string) {
|
|
87
|
-
return Asset.new(TEXT, path, id) satisfies Asset.Text
|
|
88
|
-
},
|
|
89
|
-
|
|
90
|
-
Blob(path: string, id ?: string) {
|
|
91
|
-
return Asset.new(BLOB, path, id) satisfies Asset.Blob
|
|
92
|
-
},
|
|
93
|
-
|
|
94
|
-
Json(path: string, id ?: string) {
|
|
95
|
-
return Asset.new(JSON, path, id) satisfies Asset.Json
|
|
96
|
-
},
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
export const Cache = {
|
|
100
|
-
new() {
|
|
101
|
-
return {
|
|
102
|
-
images: {},
|
|
103
|
-
audios: {},
|
|
104
|
-
texts: {},
|
|
105
|
-
blobs: {},
|
|
106
|
-
jsons: {},
|
|
107
|
-
} satisfies Cache
|
|
108
|
-
},
|
|
109
|
-
|
|
110
|
-
getImage(cache: Cache, id: string) {
|
|
111
|
-
if (!(id in cache.images))
|
|
112
|
-
throw `[Cache.getImage]: Image with id '${id}' does not exist`;
|
|
113
|
-
return cache.images[id];
|
|
114
|
-
},
|
|
115
|
-
|
|
116
|
-
getAudio(cache: Cache, id: string) {
|
|
117
|
-
if (!(id in cache.audios))
|
|
118
|
-
throw `[Cache.getAudio]: Audio with id '${id}' does not exist`;
|
|
119
|
-
return cache.audios[id];
|
|
120
|
-
},
|
|
121
|
-
|
|
122
|
-
getText(cache: Cache, id: string) {
|
|
123
|
-
if (!(id in cache.texts))
|
|
124
|
-
throw `[Cache.getText]: Text with id '${id}' does not exist`;
|
|
125
|
-
return cache.texts[id];
|
|
126
|
-
},
|
|
127
|
-
|
|
128
|
-
getBlob(cache: Cache, id: string) {
|
|
129
|
-
if (!(id in cache.blobs))
|
|
130
|
-
throw `[Cache.getBlob]: Blob with id '${id}' does not exist`;
|
|
131
|
-
return cache.blobs[id];
|
|
132
|
-
},
|
|
133
|
-
|
|
134
|
-
getJson(cache: Cache, id: string) {
|
|
135
|
-
if(!(id in cache.jsons))
|
|
136
|
-
throw `[Cache.getJson]: Json with id '${id}' does not exist`;
|
|
137
|
-
return cache.jsons[id];
|
|
138
|
-
},
|
|
139
|
-
|
|
140
|
-
putImage(cache: Cache, id: string, image: HTMLImageElement) {
|
|
141
|
-
if (id in cache.images)
|
|
142
|
-
console.warn(`[Cache.putImage]: Image with id '${id}' already exists`);
|
|
143
|
-
return cache.images[id] = image;
|
|
144
|
-
},
|
|
145
|
-
|
|
146
|
-
putAudio(cache: Cache, id: string, audio: HTMLAudioElement) {
|
|
147
|
-
if (id in cache.audios)
|
|
148
|
-
console.warn(`[Cache.putAudio]: Audio with id '${id}' already exists`);
|
|
149
|
-
return cache.audios[id] = audio;
|
|
150
|
-
},
|
|
151
|
-
|
|
152
|
-
putText(cache: Cache, id: string, text: string) {
|
|
153
|
-
if (id in cache.texts)
|
|
154
|
-
console.warn(`[Cache.putText]: Text with id '${id}' already exists`);
|
|
155
|
-
return cache.texts[id] = text;
|
|
156
|
-
},
|
|
157
|
-
|
|
158
|
-
putBlob(cache: Cache, id: string, blob: Blob) {
|
|
159
|
-
if (id in cache.blobs)
|
|
160
|
-
console.warn(`[Cache.putBlob]: Blob with id '${id}' already exists`);
|
|
161
|
-
return cache.blobs[id] = blob;
|
|
162
|
-
},
|
|
163
|
-
|
|
164
|
-
putJson(cache: Cache, id: string, json: any) {
|
|
165
|
-
if (id in cache.jsons)
|
|
166
|
-
console.warn(`[Cache.putJson]: Json with id '${id}' already exists`);
|
|
167
|
-
return cache.jsons[id] = json;
|
|
168
|
-
},
|
|
169
|
-
|
|
170
|
-
freeImage(cache: Cache, id: string) {
|
|
171
|
-
delete cache.images[id];
|
|
172
|
-
},
|
|
173
|
-
|
|
174
|
-
freeAudio(cache: Cache, id: string) {
|
|
175
|
-
delete cache.audios[id];
|
|
176
|
-
},
|
|
177
|
-
|
|
178
|
-
freeText(cache: Cache, id: string) {
|
|
179
|
-
delete cache.texts[id];
|
|
180
|
-
},
|
|
181
|
-
|
|
182
|
-
freeBlob(cache: Cache, id: string) {
|
|
183
|
-
delete cache.blobs[id];
|
|
184
|
-
},
|
|
185
|
-
|
|
186
|
-
freeJson(cache: Cache, id: string) {
|
|
187
|
-
delete cache.jsons[id];
|
|
188
|
-
},
|
|
189
|
-
|
|
190
|
-
freeAll(cache: Cache) {
|
|
191
|
-
cache.images = {};
|
|
192
|
-
cache.audios = {};
|
|
193
|
-
cache.texts = {};
|
|
194
|
-
cache.blobs = {};
|
|
195
|
-
cache.jsons = {};
|
|
196
|
-
},
|
|
197
|
-
|
|
198
|
-
load(cache: Cache, a: Asset<any>) {
|
|
199
|
-
switch (a.kind) {
|
|
200
|
-
case IMAGE: return Cache.loadImage(cache, a);
|
|
201
|
-
case AUDIO: return Cache.loadAudio(cache, a);
|
|
202
|
-
case TEXT: return Cache.loadText (cache, a);
|
|
203
|
-
case BLOB: return Cache.loadBlob (cache, a);
|
|
204
|
-
case JSON: return Cache.loadJson (cache, a);
|
|
205
|
-
default: throw `[Cache.load]: Unknown kind of asset '${a.kind}'`;
|
|
206
|
-
}
|
|
207
|
-
},
|
|
208
|
-
|
|
209
|
-
async loadImage(cache: Cache, a: Asset.Image) {
|
|
210
|
-
const id = a.id ?? uniqueId(cache.images);
|
|
211
|
-
Cache.putImage(cache, id, await loadImage(a));
|
|
212
|
-
return id;
|
|
213
|
-
},
|
|
214
|
-
|
|
215
|
-
async loadAudio(cache: Cache, a: Asset.Audio) {
|
|
216
|
-
const id = a.id ?? uniqueId(cache.audios);
|
|
217
|
-
Cache.putAudio(cache, id, await loadAudio(a));
|
|
218
|
-
return id;
|
|
219
|
-
},
|
|
220
|
-
|
|
221
|
-
async loadText(cache: Cache, a: Asset.Text) {
|
|
222
|
-
const id = a.id ?? uniqueId(cache.texts );
|
|
223
|
-
Cache.putText(cache, id, await loadText(a));
|
|
224
|
-
return id;
|
|
225
|
-
},
|
|
226
|
-
|
|
227
|
-
async loadBlob(cache: Cache, a: Asset.Blob) {
|
|
228
|
-
const id = a.id ?? uniqueId(cache.blobs );
|
|
229
|
-
Cache.putBlob(cache, id, await loadBlob(a));
|
|
230
|
-
return id;
|
|
231
|
-
},
|
|
232
|
-
|
|
233
|
-
async loadJson(cache: Cache, a: Asset.Json) {
|
|
234
|
-
const id = a.id ?? uniqueId(cache.jsons );
|
|
235
|
-
Cache.putJson(cache, id, await loadJson(a));
|
|
236
|
-
return id;
|
|
237
|
-
},
|
|
238
|
-
|
|
239
|
-
async loadAll(cache: Cache, a: Array<Asset<any>>) {
|
|
240
|
-
return Promise.all(a.map(a => Cache.load(cache, a)));
|
|
241
|
-
}
|
|
242
|
-
}
|
|
243
|
-
|
|
244
|
-
function uniqueId(ids: {[id: string]: any}) {
|
|
245
|
-
let id = crypto.randomUUID();
|
|
246
|
-
while (id in ids)
|
|
247
|
-
id = crypto.randomUUID();
|
|
248
|
-
return id;
|
|
249
|
-
}
|
package/src/event.ts
DELETED
|
@@ -1,174 +0,0 @@
|
|
|
1
|
-
import type { Maybe } from "./types.js"
|
|
2
|
-
|
|
3
|
-
export namespace Event {
|
|
4
|
-
export type Listener<T> = (event: T, context: Event.Context<T>) => void
|
|
5
|
-
|
|
6
|
-
export type Listen = { action: "listen" , path: string, type : string , listener : Listener<any> }
|
|
7
|
-
export type Deafen = { action: "deafen" , path: string, type ?: string | undefined, listener ?: Listener<any> | undefined }
|
|
8
|
-
export type Dispatch = { action: "dispatch", path: string, type: string, event: any }
|
|
9
|
-
|
|
10
|
-
export type Action = Listen | Deafen | Dispatch
|
|
11
|
-
|
|
12
|
-
export type Tree = {
|
|
13
|
-
root : Event.Node
|
|
14
|
-
pending: Array<Event.Action>
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
export type Node = {
|
|
18
|
-
children : Map<string, Event.Node >
|
|
19
|
-
listeners: Map<string, Set<Event.Listener<any>>>
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
export type Context<T> = {
|
|
23
|
-
tree: Event.Tree
|
|
24
|
-
node: Event.Node
|
|
25
|
-
path: string
|
|
26
|
-
type: string
|
|
27
|
-
self: Event.Listener<T>
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
export const Event = {
|
|
32
|
-
Tree: {
|
|
33
|
-
new() {
|
|
34
|
-
return {
|
|
35
|
-
root : Event.Node.new(),
|
|
36
|
-
pending: [ ]
|
|
37
|
-
} satisfies Event.Tree
|
|
38
|
-
}
|
|
39
|
-
},
|
|
40
|
-
|
|
41
|
-
Node: {
|
|
42
|
-
new() {
|
|
43
|
-
return {
|
|
44
|
-
children : new Map(),
|
|
45
|
-
listeners: new Map()
|
|
46
|
-
} satisfies Event.Node
|
|
47
|
-
}
|
|
48
|
-
},
|
|
49
|
-
|
|
50
|
-
once<T>(listener: Event.Listener<T>) {
|
|
51
|
-
return ((event: T, context: Event.Context<T>) => {
|
|
52
|
-
listener(event, context)
|
|
53
|
-
const { tree, path, type, self } = context
|
|
54
|
-
Event.deafen(tree, type, self, { path, defer: false })
|
|
55
|
-
}) satisfies Event.Listener<T>
|
|
56
|
-
},
|
|
57
|
-
|
|
58
|
-
listen<T>(tree: Event.Tree, type : string, listener : Event.Listener<T>, o ?: { path ?: string, defer ?: boolean }) {
|
|
59
|
-
const a: Event.Listen = { action: "listen", path: o?.path ?? "", type, listener }
|
|
60
|
-
if (o?.defer ?? true) queue(tree, a)
|
|
61
|
-
else flush(tree, a)
|
|
62
|
-
},
|
|
63
|
-
|
|
64
|
-
deafen<T>(tree: Event.Tree, type ?: string, listener ?: Event.Listener<T>, o ?: { path ?: string, defer ?: boolean }) {
|
|
65
|
-
const a: Event.Deafen = { action: "deafen", path: o?.path ?? "", type, listener }
|
|
66
|
-
if (o?.defer ?? true) queue(tree, a)
|
|
67
|
-
else flush(tree, a)
|
|
68
|
-
},
|
|
69
|
-
|
|
70
|
-
dispatch(tree: Event.Tree, type: string, event: any, o ?: { path ?: string, defer ?: boolean }) {
|
|
71
|
-
const a: Event.Dispatch = { action: "dispatch", path: o?.path ?? "", type, event }
|
|
72
|
-
if (o?.defer ?? true) queue(tree, a)
|
|
73
|
-
else flush(tree, a)
|
|
74
|
-
},
|
|
75
|
-
|
|
76
|
-
poll(tree: Event.Tree) {
|
|
77
|
-
tree.pending.splice(0).forEach(
|
|
78
|
-
a => flush(tree, a)
|
|
79
|
-
)
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
function queue(tree: Event.Tree, a: Event.Action) {
|
|
84
|
-
tree.pending.push(a)
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
function flush(tree: Event.Tree, a: Event.Action) {
|
|
88
|
-
switch(a.action) {
|
|
89
|
-
case "listen" : return onListen (tree, a)
|
|
90
|
-
case "deafen" : return onDeafen (tree, a)
|
|
91
|
-
case "dispatch": return onDispatch(tree, a)
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
function requestListeners(node: Maybe<Event.Node>, type: string) {
|
|
96
|
-
let list = node?.listeners.get(type)
|
|
97
|
-
// if (!list) node.listeners.set(
|
|
98
|
-
// type, list = new Set()
|
|
99
|
-
// )
|
|
100
|
-
return list
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
function requireListeners(node: Event.Node , type: string) {
|
|
104
|
-
let list = node.listeners.get(type)
|
|
105
|
-
if (!list) node.listeners.set(
|
|
106
|
-
type, list = new Set()
|
|
107
|
-
)
|
|
108
|
-
return list
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
function requestNode(root: Maybe<Event.Node>, path: string) {
|
|
112
|
-
for (const part of path.split("/")) {
|
|
113
|
-
let node = root?.children.get(part)
|
|
114
|
-
if (!node) return
|
|
115
|
-
root = node
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
return root
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
function requireNode(root: Event.Node , path: string) {
|
|
122
|
-
for (const part of path.split("/")) {
|
|
123
|
-
let node = root.children.get(part)
|
|
124
|
-
if (!node) root.children.set(
|
|
125
|
-
part, node = Event.Node.new()
|
|
126
|
-
)
|
|
127
|
-
root = node
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
return root
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
function onListen (tree: Event.Tree, a: Event.Listen ) {
|
|
134
|
-
const node = requireNode(tree.root, a.path)
|
|
135
|
-
const list = requireListeners(node, a.type)
|
|
136
|
-
list.add(a.listener)
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
function onDeafen (tree: Event.Tree, a: Event.Deafen ) {
|
|
140
|
-
if (a.type !== undefined && a.listener !== undefined) {
|
|
141
|
-
const node = requestNode(tree.root, a.path)
|
|
142
|
-
const list = requestListeners(node, a.type)
|
|
143
|
-
list?.delete(a.listener)
|
|
144
|
-
} else if (a.type !== undefined && a.listener === undefined) {
|
|
145
|
-
const node = requestNode(tree.root, a.path)
|
|
146
|
-
const list = requestListeners(node, a.type)
|
|
147
|
-
list?.clear()
|
|
148
|
-
} else if (a.type === undefined && a.listener !== undefined) {
|
|
149
|
-
const node = requestNode(tree.root, a.path)
|
|
150
|
-
node?.listeners.forEach((list) => {
|
|
151
|
-
list.delete(a.listener!)
|
|
152
|
-
})
|
|
153
|
-
} else if (a.type === undefined && a.listener === undefined) {
|
|
154
|
-
const node = requestNode(tree.root, a.path)
|
|
155
|
-
node?.children .clear()
|
|
156
|
-
node?.listeners.clear()
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
function onDispatch(tree: Event.Tree, { path, type, event }: Event.Dispatch) {
|
|
161
|
-
const node = requestNode(tree.root, path)
|
|
162
|
-
if (!node) return
|
|
163
|
-
reDispatch(tree, node, path, type, event)
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
function reDispatch(tree: Event.Tree, node: Event.Node, path: string, type: string, event: any) {
|
|
167
|
-
requestListeners(node, type)?.forEach(self => {
|
|
168
|
-
self(event, { tree, node, path, type, self })
|
|
169
|
-
})
|
|
170
|
-
|
|
171
|
-
node.children.forEach((child, name) => {
|
|
172
|
-
reDispatch(tree, child, `${path}/${name}`, type, event)
|
|
173
|
-
})
|
|
174
|
-
}
|
package/src/hg.ts
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { Version } from "./version.js";
|
|
2
|
-
|
|
3
|
-
export const VERSION = Version.new({
|
|
4
|
-
moniker: "hg",
|
|
5
|
-
major : 0,
|
|
6
|
-
minor : 0,
|
|
7
|
-
patch : 1,
|
|
8
|
-
})
|
|
9
|
-
|
|
10
|
-
export { Version } from "./version.js"
|
|
11
|
-
export { Vector2 } from "./vector2.js"
|
|
12
|
-
export { Vector3 } from "./vector3.js"
|
|
13
|
-
export { Vector4 } from "./vector4.js"
|
|
14
|
-
export { Matrix2 } from "./matrix2.js"
|
|
15
|
-
export { Matrix3 } from "./matrix3.js"
|
|
16
|
-
export { Matrix4 } from "./matrix4.js"
|
|
17
|
-
export { Stage } from "./stage.js"
|
|
18
|
-
export { Scene } from "./scene.js"
|
|
19
|
-
export { Event } from "./event.js"
|
|
20
|
-
|
|
21
|
-
export { Asset, Cache } from "./asset.js"
|
package/src/math.ts
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
export function ADD(a: number, b: number) { return a + b }
|
|
2
|
-
export function SUB(a: number, b: number) { return a - b }
|
|
3
|
-
export function MUL(a: number, b: number) { return a * b }
|
|
4
|
-
export function DIV(a: number, b: number) { return a / b }
|
|
5
|
-
export function MOD(a: number, b: number) { return a % b }
|