@bloopjs/bloop 0.0.20 → 0.0.22
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/bloop.d.ts +52 -0
- package/dist/bloop.d.ts.map +1 -0
- package/dist/context.d.ts +17 -0
- package/dist/context.d.ts.map +1 -0
- package/dist/data/bag.d.ts +8 -0
- package/dist/data/bag.d.ts.map +1 -0
- package/dist/data/schema.d.ts +5 -0
- package/dist/data/schema.d.ts.map +1 -0
- package/dist/events.d.ts +17 -0
- package/dist/events.d.ts.map +1 -0
- package/dist/mod.d.ts +8 -0
- package/dist/mod.d.ts.map +1 -0
- package/dist/mod.js +1290 -0
- package/dist/mod.js.map +14 -0
- package/dist/mount.d.ts +17 -0
- package/dist/mount.d.ts.map +1 -0
- package/dist/runtime.d.ts +60 -0
- package/dist/runtime.d.ts.map +1 -0
- package/dist/system.d.ts +26 -0
- package/dist/system.d.ts.map +1 -0
- package/dist/util.d.ts +4 -0
- package/dist/util.d.ts.map +1 -0
- package/package.json +10 -2
- package/src/bloop.ts +145 -129
- package/src/mod.ts +8 -3
- package/src/mount.ts +86 -0
- package/src/runtime.ts +15 -94
- package/.cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc +0 -111
- package/jsr.json +0 -6
- package/publish/tsconfig.publish.json +0 -7
- package/test/inputs.test.ts +0 -227
- package/test/runtime.test.ts +0 -298
- package/test/tape.test.ts +0 -128
- package/tsconfig.json +0 -34
package/dist/bloop.d.ts
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import type { Context } from "./context";
|
|
2
|
+
import type { Bag } from "./data/bag";
|
|
3
|
+
import type { BloopSchema } from "./data/schema";
|
|
4
|
+
import type { EngineHooks } from "./runtime";
|
|
5
|
+
import type { System } from "./system";
|
|
6
|
+
export type BloopOpts<B extends Bag> = {
|
|
7
|
+
/** defaults to "Game" */
|
|
8
|
+
name?: string;
|
|
9
|
+
/**
|
|
10
|
+
* component definitions, defaults to empty object
|
|
11
|
+
*
|
|
12
|
+
* use `defineComponents` to generate component definitions from a simple schema
|
|
13
|
+
*/
|
|
14
|
+
/**
|
|
15
|
+
* input map, defaults to empty object
|
|
16
|
+
*/
|
|
17
|
+
/**
|
|
18
|
+
* bag definition, defaults to empty object
|
|
19
|
+
*
|
|
20
|
+
*/
|
|
21
|
+
bag?: B;
|
|
22
|
+
};
|
|
23
|
+
export declare class Bloop<GS extends BloopSchema> {
|
|
24
|
+
#private;
|
|
25
|
+
/**
|
|
26
|
+
* Bloop.create() is the way to create a new bloop instance.
|
|
27
|
+
*/
|
|
28
|
+
static create<B extends Bag>(opts?: BloopOpts<B>): Bloop<MakeGS<B>>;
|
|
29
|
+
/**
|
|
30
|
+
* DO NOT USE `new Bloop` - use `Bloop.create()` instead for proper type hints.
|
|
31
|
+
*/
|
|
32
|
+
constructor(opts: BloopOpts<GS["B"]> | undefined, dontCallMeDirectly: string);
|
|
33
|
+
/**
|
|
34
|
+
* Read the game singleton bag
|
|
35
|
+
*/
|
|
36
|
+
get bag(): GS["B"];
|
|
37
|
+
/**
|
|
38
|
+
* Read the game context object
|
|
39
|
+
*/
|
|
40
|
+
get context(): Readonly<Context<GS>>;
|
|
41
|
+
/**
|
|
42
|
+
* Register a system with the game loop.
|
|
43
|
+
*/
|
|
44
|
+
system(label: string, system: System<GS>): number;
|
|
45
|
+
/**
|
|
46
|
+
* Low level hooks to engine functionality. Editing these is for advanced use cases, defaults should usually work.
|
|
47
|
+
*/
|
|
48
|
+
hooks: EngineHooks;
|
|
49
|
+
}
|
|
50
|
+
type MakeGS<B extends Bag> = BloopSchema<B>;
|
|
51
|
+
export {};
|
|
52
|
+
//# sourceMappingURL=bloop.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bloop.d.ts","sourceRoot":"","sources":["../src/bloop.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAQjD,OAAO,KAAK,EAAiB,WAAW,EAAe,MAAM,WAAW,CAAC;AACzE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAEvC,MAAM,MAAM,SAAS,CAAC,CAAC,SAAS,GAAG,IAAI;IACrC,yBAAyB;IACzB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;;OAIG;IAEH;;OAEG;IAEH;;;OAGG;IACH,GAAG,CAAC,EAAE,CAAC,CAAC;CAET,CAAC;AAEF,qBAAa,KAAK,CAAC,EAAE,SAAS,WAAW;;IAKvC;;OAEG;IACH,MAAM,CAAC,MAAM,CAGX,CAAC,SAAS,GAAG,EAGb,IAAI,GAAE,SAAS,CAAC,CAAC,CAAM,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;IAI5C;;OAEG;gBACS,IAAI,EAAE,SAAS,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,YAAK,EAAE,kBAAkB,EAAE,MAAM;IAerE;;OAEG;IACH,IAAI,GAAG,IAAI,EAAE,CAAC,GAAG,CAAC,CAEjB;IAED;;OAEG;IACH,IAAI,OAAO,IAAI,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,CAEnC;IAED;;OAEG;IACH,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,CAAC,GAAG,MAAM;IAMjD;;OAEG;IACH,KAAK,EAAE,WAAW,CAsIhB;CACH;AAUD,KAAK,MAAM,CAAC,CAAC,SAAS,GAAG,IAAI,WAAW,CAAC,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { EnginePointer, InputContext, TimeContext } from "@bloopjs/engine";
|
|
2
|
+
import type { BloopSchema } from "./data/schema";
|
|
3
|
+
export type Context<GS extends BloopSchema = BloopSchema> = {
|
|
4
|
+
/** The wrapper to the engine instance */
|
|
5
|
+
/** Result of any resources requested */
|
|
6
|
+
/** Result of the main query if there was one */
|
|
7
|
+
/** Results of multiple queries if there were any */
|
|
8
|
+
/** The bag of values for the system */
|
|
9
|
+
bag: GS["B"];
|
|
10
|
+
/** The timing information for the current frame */
|
|
11
|
+
time: TimeContext;
|
|
12
|
+
/** The input snapshot */
|
|
13
|
+
inputs: InputContext;
|
|
14
|
+
/** The engine pointer to the injected system arguments (for advanced use cases) */
|
|
15
|
+
rawPointer: EnginePointer;
|
|
16
|
+
};
|
|
17
|
+
//# sourceMappingURL=context.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../src/context.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAChF,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAEjD,MAAM,MAAM,OAAO,CACjB,EAAE,SAAS,WAAW,GAAG,WAAW,IAGlC;IACF,yCAAyC;IAEzC,wCAAwC;IAExC,gDAAgD;IAEhD,oDAAoD;IAEpD,uCAAuC;IACvC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,CAAC;IACb,mDAAmD;IACnD,IAAI,EAAE,WAAW,CAAC;IAClB,yBAAyB;IACzB,MAAM,EAAE,YAAY,CAAC;IACrB,mFAAmF;IACnF,UAAU,EAAE,aAAa,CAAC;CAC3B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bag.d.ts","sourceRoot":"","sources":["../../src/data/bag.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,GAAG;IAClB,CAAC,GAAG,EAAE,MAAM,GAAG,QAAQ,CAAC;CACzB;AAED,MAAM,MAAM,QAAQ,GAChB,MAAM,GACN,MAAM,GACN,OAAO,GACP,QAAQ,EAAE,GACV,GAAG,GACH,UAAU,GACV,IAAI,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../src/data/schema.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAEjC,MAAM,MAAM,WAAW,CAErB,CAAC,SAAS,GAAG,GAAG,GAAG,IAEjB;IAEF,CAAC,EAAE,CAAC,CAAC;CAEN,CAAC"}
|
package/dist/events.d.ts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { Key, MouseButton } from "@bloopjs/engine";
|
|
2
|
+
export type InputEvent = KeyEvent | MouseButtonEvent | MouseMoveEvent | MouseWheelEvent;
|
|
3
|
+
export type KeyEvent = {
|
|
4
|
+
key: Key;
|
|
5
|
+
};
|
|
6
|
+
export type MouseButtonEvent = {
|
|
7
|
+
button: MouseButton;
|
|
8
|
+
};
|
|
9
|
+
export type MouseMoveEvent = {
|
|
10
|
+
x: number;
|
|
11
|
+
y: number;
|
|
12
|
+
};
|
|
13
|
+
export type MouseWheelEvent = {
|
|
14
|
+
x: number;
|
|
15
|
+
y: number;
|
|
16
|
+
};
|
|
17
|
+
//# sourceMappingURL=events.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../src/events.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAExD,MAAM,MAAM,UAAU,GAClB,QAAQ,GACR,gBAAgB,GAChB,cAAc,GACd,eAAe,CAAC;AAEpB,MAAM,MAAM,QAAQ,GAAG;IACrB,GAAG,EAAE,GAAG,CAAC;CACV,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG;IAC7B,MAAM,EAAE,WAAW,CAAC;CACrB,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG;IAC3B,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG;IAC5B,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX,CAAC"}
|
package/dist/mod.d.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export type * as typesRuntime from "./runtime";
|
|
2
|
+
export type * as typesMount from "./mount";
|
|
3
|
+
export type * as typesBloop from "./bloop";
|
|
4
|
+
export type * as typesContext from "./context";
|
|
5
|
+
export * as Util from "./util";
|
|
6
|
+
export { mount } from "./mount";
|
|
7
|
+
export { Bloop } from "./bloop";
|
|
8
|
+
//# sourceMappingURL=mod.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../src/mod.ts"],"names":[],"mappings":"AAAA,YAAY,KAAK,YAAY,MAAM,WAAW,CAAA;AAC9C,YAAY,KAAK,UAAU,MAAM,SAAS,CAAA;AAC1C,YAAY,KAAK,UAAU,MAAM,SAAS,CAAA;AAC1C,YAAY,KAAK,YAAY,MAAM,WAAW,CAAA;AAE9C,OAAO,KAAK,IAAI,MAAM,QAAQ,CAAC;AAE/B,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA"}
|