@n3rdw1z4rd/core 0.22.0 → 0.23.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/README.md +59 -4
- package/dist/astar.d.ts +1 -3
- package/dist/astar.js +1 -2
- package/dist/canvas-renderer.d.ts +1 -3
- package/dist/canvas-renderer.js +1 -2
- package/dist/clock.d.ts +1 -3
- package/dist/clock.js +1 -2
- package/dist/color-palette.d.ts +1 -3
- package/dist/color-palette.js +1 -2
- package/dist/color.d.ts +1 -3
- package/dist/color.js +1 -2
- package/dist/disposable.d.ts +1 -3
- package/dist/disposable.js +1 -2
- package/dist/dungeon-generator.d.ts +2 -4
- package/dist/dungeon-generator.js +3 -4
- package/dist/ecs.d.ts +1 -3
- package/dist/ecs.js +1 -2
- package/dist/emitter.d.ts +1 -3
- package/dist/emitter.js +1 -2
- package/dist/event-queue.d.ts +1 -3
- package/dist/event-queue.js +1 -2
- package/dist/graph/doc.d.ts +2 -4
- package/dist/graph/doc.js +1 -2
- package/dist/graph/evaluate.d.ts +1 -3
- package/dist/graph/evaluate.js +1 -2
- package/dist/graph/index.d.ts +4 -4
- package/dist/graph/index.js +4 -4
- package/dist/graph/node.d.ts +7 -9
- package/dist/graph/node.js +1 -2
- package/dist/graph/nodes.d.ts +1 -3
- package/dist/graph/nodes.js +1 -2
- package/dist/graph/script.d.ts +37 -40
- package/dist/graph/script.js +14 -60
- package/dist/graph/sources.d.ts +1 -3
- package/dist/graph/sources.js +1 -2
- package/dist/graph/subgraph.d.ts +2 -4
- package/dist/graph/subgraph.js +1 -2
- package/dist/graph/types.d.ts +3 -5
- package/dist/graph/types.js +2 -3
- package/dist/graph.cjs +22 -77
- package/dist/graph.d.cts +44 -61
- package/dist/index.cjs +27 -52
- package/dist/index.d.cts +1 -63
- package/dist/index.d.ts +10 -10
- package/dist/index.js +14 -14
- package/dist/input/_input.d.ts +1 -3
- package/dist/input/_input.js +1 -2
- package/dist/input/action-map.d.ts +1 -3
- package/dist/input/action-map.js +1 -2
- package/dist/input/bindings.d.ts +1 -3
- package/dist/input/bindings.js +1 -2
- package/dist/input/gestures.d.ts +1 -3
- package/dist/input/gestures.js +1 -2
- package/dist/input/index.d.ts +1 -1
- package/dist/input/index.js +1 -1
- package/dist/input/input-action-map.d.ts +3 -5
- package/dist/input/input-action-map.js +3 -4
- package/dist/input/input.d.ts +2 -4
- package/dist/input/input.js +2 -3
- package/dist/log.d.ts +1 -3
- package/dist/log.js +1 -2
- package/dist/map2d.d.ts +1 -3
- package/dist/map2d.js +1 -2
- package/dist/{map3d-CHDJiq5T.d.cts → map3d-DRHhbrFn.d.cts} +0 -8
- package/dist/map3d.d.ts +1 -3
- package/dist/map3d.js +1 -2
- package/dist/math.d.ts +1 -3
- package/dist/math.js +1 -2
- package/dist/misc.d.ts +1 -3
- package/dist/misc.js +1 -2
- package/dist/observable.d.ts +1 -3
- package/dist/observable.js +1 -2
- package/dist/particle-renderer.d.ts +1 -3
- package/dist/particle-renderer.js +1 -2
- package/dist/particle-system-2d.d.ts +1 -3
- package/dist/particle-system-2d.js +3 -4
- package/dist/random.d.ts +1 -3
- package/dist/random.js +1 -2
- package/dist/rectangle.d.ts +1 -3
- package/dist/rectangle.js +1 -2
- package/dist/{rng-Dhqq7owV.cjs → rng-edL6atS3.cjs} +3 -6
- package/dist/rng.d.ts +1 -3
- package/dist/rng.js +2 -3
- package/dist/signal.d.ts +1 -3
- package/dist/signal.js +1 -2
- package/dist/spatial-partition-2d.d.ts +1 -3
- package/dist/spatial-partition-2d.js +1 -2
- package/dist/{spatial-partition-3d-CmSCL87Z.cjs → spatial-partition-3d-D1uyJVhM.cjs} +7 -13
- package/dist/spatial-partition-3d.d.ts +1 -3
- package/dist/spatial-partition-3d.js +1 -2
- package/dist/three/adaptive-grid.d.ts +1 -3
- package/dist/three/adaptive-grid.js +1 -2
- package/dist/three/asteroid-mesh.d.ts +1 -3
- package/dist/three/asteroid-mesh.js +1 -2
- package/dist/three/camera-rig.d.ts +1 -3
- package/dist/three/camera-rig.js +1 -2
- package/dist/three/cube-sphere-geometry.d.ts +1 -3
- package/dist/three/cube-sphere-geometry.js +1 -2
- package/dist/three/ecs.d.ts +1 -3
- package/dist/three/ecs.js +1 -2
- package/dist/three/editor-camera.d.ts +1 -3
- package/dist/three/editor-camera.js +1 -2
- package/dist/three/index.d.ts +4 -4
- package/dist/three/index.js +1 -1
- package/dist/three/particle-system-3d.d.ts +1 -3
- package/dist/three/particle-system-3d.js +3 -4
- package/dist/three/picking.d.ts +2 -4
- package/dist/three/picking.js +1 -2
- package/dist/three/renderer.d.ts +1 -3
- package/dist/three/renderer.js +1 -2
- package/dist/three/schema.d.ts +0 -2
- package/dist/three/schema.js +1 -2
- package/dist/three/starfield.d.ts +1 -3
- package/dist/three/starfield.js +1 -2
- package/dist/three/texture-atlas.d.ts +1 -3
- package/dist/three/texture-atlas.js +1 -2
- package/dist/three/texture-utils.d.ts +1 -3
- package/dist/three/texture-utils.js +1 -2
- package/dist/three/voxel-geometry.d.ts +2 -4
- package/dist/three/voxel-geometry.js +2 -3
- package/dist/three/voxel-mesh.d.ts +1 -3
- package/dist/three/voxel-mesh.js +1 -2
- package/dist/three/world.d.ts +0 -2
- package/dist/three/world.js +1 -2
- package/dist/three.cjs +18 -34
- package/dist/three.d.cts +1 -33
- package/dist/tilemap.d.ts +1 -3
- package/dist/tilemap.js +1 -2
- package/dist/types.d.ts +1 -3
- package/dist/vector.d.ts +1 -3
- package/dist/vector.js +1 -2
- package/dist/vite.cjs +1 -2
- package/dist/vite.d.cts +1 -3
- package/dist/vite.d.ts +1 -3
- package/dist/vite.js +1 -2
- package/dist/webgl-renderer.d.ts +1 -3
- package/dist/webgl-renderer.js +1 -2
- package/dist/webgl.d.ts +1 -3
- package/dist/webgl.js +1 -2
- package/dist/worker-interface.d.ts +1 -3
- package/dist/worker-interface.js +1 -2
- package/package.json +6 -6
package/dist/graph.d.cts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
//#region src/graph/types.d.ts
|
|
2
1
|
/**
|
|
3
|
-
* Pin types. A type is a name (`number`, `vec2`,
|
|
2
|
+
* Pin types. A type is a name (`number`, `vec2`, your own…) with a color for the editor;
|
|
4
3
|
* a trailing `[]` in a port declaration (`vec2[]`) makes the port a **list port** — it takes
|
|
5
4
|
* or produces a whole list instead of one value at a time (see {@link GraphEvaluator}).
|
|
6
5
|
*
|
|
@@ -48,13 +47,11 @@ export declare class TypeRegistry {
|
|
|
48
47
|
all(): PortTypeDef[];
|
|
49
48
|
}
|
|
50
49
|
/**
|
|
51
|
-
* The default pin types
|
|
50
|
+
* The default pin types. Add your own with `portTypes.define(name, color)`.
|
|
52
51
|
*
|
|
53
52
|
* @category Graph
|
|
54
53
|
*/
|
|
55
54
|
export declare const portTypes: TypeRegistry;
|
|
56
|
-
//#endregion
|
|
57
|
-
//#region src/graph/node.d.ts
|
|
58
55
|
/**
|
|
59
56
|
* Node definitions: a node is a function with a typed interface.
|
|
60
57
|
*
|
|
@@ -69,11 +66,11 @@ export declare const portTypes: TypeRegistry;
|
|
|
69
66
|
*
|
|
70
67
|
* ```ts
|
|
71
68
|
* defineNode({
|
|
72
|
-
* type: '
|
|
73
|
-
* inputs: {
|
|
74
|
-
* params: {
|
|
75
|
-
* outputs: {
|
|
76
|
-
* run: ({
|
|
69
|
+
* type: 'math/lerp',
|
|
70
|
+
* inputs: { a: 'number', b: { type: 'number', default: 1 } },
|
|
71
|
+
* params: { t: { type: 'number', default: 0.5, min: 0, max: 1, step: 0.05 } },
|
|
72
|
+
* outputs: { value: 'number' },
|
|
73
|
+
* run: ({ a, b }, { t }) => ({ value: a + (b - a) * t }),
|
|
77
74
|
* });
|
|
78
75
|
* ```
|
|
79
76
|
*
|
|
@@ -108,7 +105,7 @@ export type ParamSpec = {
|
|
|
108
105
|
export interface RunContext {
|
|
109
106
|
/** the node instance's id */
|
|
110
107
|
nodeId: string;
|
|
111
|
-
/** the node's type, and its source module (if it has one)
|
|
108
|
+
/** the node's type, and its source module (if it has one), for nodes whose output carries their own code */
|
|
112
109
|
type: string;
|
|
113
110
|
source?: string;
|
|
114
111
|
/** while broadcasting over lists: this call's index (else 0) and the call count (else 1) */
|
|
@@ -205,8 +202,6 @@ export declare class NodeRegistry {
|
|
|
205
202
|
/** Called when a type is registered (or replaced) or removed; returns an unsubscribe. */
|
|
206
203
|
onChange(listener: (def: NodeDef, removed: boolean) => void): () => void;
|
|
207
204
|
}
|
|
208
|
-
//#endregion
|
|
209
|
-
//#region src/graph/doc.d.ts
|
|
210
205
|
/**
|
|
211
206
|
* The graph document: plain JSON, saved and shared as-is.
|
|
212
207
|
*
|
|
@@ -344,8 +339,6 @@ export declare function canConnect(doc: GraphDoc, registry: NodeRegistry, from:
|
|
|
344
339
|
export declare function connect(doc: GraphDoc, registry: NodeRegistry, from: PortRef, to: PortRef, types?: TypeRegistry): GraphLink;
|
|
345
340
|
/** @category Graph */
|
|
346
341
|
export declare function disconnect(doc: GraphDoc, linkId: string): void;
|
|
347
|
-
//#endregion
|
|
348
|
-
//#region src/graph/evaluate.d.ts
|
|
349
342
|
/**
|
|
350
343
|
* Evaluates a graph: runs the nodes the outputs depend on, in dependency order, passing
|
|
351
344
|
* values along the links.
|
|
@@ -455,8 +448,6 @@ export interface EvaluateResult {
|
|
|
455
448
|
ran: string[];
|
|
456
449
|
results: Map<string, NodeResult>;
|
|
457
450
|
}
|
|
458
|
-
//#endregion
|
|
459
|
-
//#region src/graph/nodes.d.ts
|
|
460
451
|
/** @category Graph */
|
|
461
452
|
export declare const BUILTIN_NODES: NodeSpec[];
|
|
462
453
|
/**
|
|
@@ -465,18 +456,16 @@ export declare const BUILTIN_NODES: NodeSpec[];
|
|
|
465
456
|
* @category Graph
|
|
466
457
|
*/
|
|
467
458
|
export declare function createNodeRegistry(): NodeRegistry;
|
|
468
|
-
//#endregion
|
|
469
|
-
//#region src/graph/script.d.ts
|
|
470
459
|
/**
|
|
471
460
|
* Script nodes: a node type written as a plain ES module, compiled at runtime.
|
|
472
461
|
*
|
|
473
462
|
* ```js
|
|
474
|
-
* export const title = '
|
|
475
|
-
* export const inputs = {
|
|
476
|
-
* export const params = {
|
|
477
|
-
* export const outputs = {
|
|
478
|
-
* export function run({
|
|
479
|
-
* return {
|
|
463
|
+
* export const title = 'Lerp'; // optional: title, category, description, output, animate
|
|
464
|
+
* export const inputs = { a: 'number', b: { type: 'number', default: 1 } };
|
|
465
|
+
* export const params = { t: { type: 'number', default: 0.5, min: 0, max: 1, step: 0.05 } };
|
|
466
|
+
* export const outputs = { value: 'number' };
|
|
467
|
+
* export function run({ a, b }, { t }, ctx) {
|
|
468
|
+
* return { value: a + (b - a) * t };
|
|
480
469
|
* }
|
|
481
470
|
* ```
|
|
482
471
|
*
|
|
@@ -487,49 +476,46 @@ export declare function createNodeRegistry(): NodeRegistry;
|
|
|
487
476
|
* @module
|
|
488
477
|
*/
|
|
489
478
|
/**
|
|
490
|
-
*
|
|
491
|
-
*
|
|
492
|
-
*
|
|
479
|
+
* Another shape of script module a host understands, besides `run` nodes: a module that exports
|
|
480
|
+
* no `run` but any of `hooks` is compiled into a node with this `run` (and these outputs and
|
|
481
|
+
* category, unless the module declares its own). What the hooks mean is up to the host — e.g. a
|
|
482
|
+
* per-frame `update` it calls later: `run` typically packs the node's params and `ctx.source`
|
|
483
|
+
* into a value the host picks up from the output.
|
|
493
484
|
*
|
|
494
|
-
*
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
*
|
|
499
|
-
*
|
|
500
|
-
*
|
|
501
|
-
|
|
502
|
-
export declare function compileNodeScript(type: string, source: string): Promise<NodeDef>;
|
|
503
|
-
/**
|
|
504
|
-
* A behaviour: what a behaviour node evaluates to. The host runs `source`'s hooks
|
|
505
|
-
* ({@link BEHAVIOR_HOOKS}) against whatever it's attached to, with `params`.
|
|
485
|
+
* ```ts
|
|
486
|
+
* const agent: ModuleKind = {
|
|
487
|
+
* hooks: ['update'],
|
|
488
|
+
* outputs: { agent: 'agent' },
|
|
489
|
+
* run: (inputs, params, ctx) => ({ agent: { params: { ...inputs, ...params }, source: ctx.source } }),
|
|
490
|
+
* };
|
|
491
|
+
* const def = await compileNodeScript('agents/wander', source, { kinds: [agent] });
|
|
492
|
+
* ```
|
|
506
493
|
*
|
|
507
494
|
* @category Graph
|
|
508
495
|
*/
|
|
509
|
-
export interface
|
|
510
|
-
kind
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
496
|
+
export interface ModuleKind {
|
|
497
|
+
/** exporting any of these (and no `run`) makes a module this kind */
|
|
498
|
+
hooks: readonly string[];
|
|
499
|
+
/** the node's run */
|
|
500
|
+
run: NodeSpec['run'];
|
|
501
|
+
/** outputs, unless the module exports its own */
|
|
502
|
+
outputs?: NodeSpec['outputs'];
|
|
503
|
+
/** category, unless the module exports its own */
|
|
504
|
+
category?: string;
|
|
505
|
+
}
|
|
506
|
+
/** @category Graph */
|
|
507
|
+
export interface ScriptOptions {
|
|
508
|
+
/** the module kinds this host understands besides `run` nodes (first match wins) */
|
|
509
|
+
kinds?: readonly ModuleKind[];
|
|
519
510
|
}
|
|
520
511
|
/**
|
|
521
|
-
*
|
|
522
|
-
* on the `behavior` output. Behaviour modules (exporting a hook, no `run`) get it automatically.
|
|
512
|
+
* Compiles a script node's source into a node type named `type`.
|
|
523
513
|
*
|
|
524
514
|
* @category Graph
|
|
525
515
|
*/
|
|
526
|
-
export declare function
|
|
527
|
-
behavior: BehaviorValue;
|
|
528
|
-
};
|
|
516
|
+
export declare function compileNodeScript(type: string, source: string, options?: ScriptOptions): Promise<NodeDef>;
|
|
529
517
|
/** A starting point for a new script node. @category Graph */
|
|
530
518
|
export declare const SCRIPT_NODE_TEMPLATE = "// A node is a function with a typed interface.\n// inputs: pins wired from other nodes (an unconnected one uses its widget value / default)\n// params: widgets on the node\n// outputs: what run() returns\n// A \"type[]\" pin takes (or gives) a whole list; a list wired into a plain pin runs\n// run() once per item and collects the results into lists.\n\nexport const inputs = {\n a: { type: 'number', default: 1 },\n b: { type: 'number', default: 2 },\n};\n\nexport const params = {\n scale: { type: 'number', default: 1, min: 0, max: 10, step: 0.1 },\n};\n\nexport const outputs = {\n result: 'number',\n};\n\nexport function run({ a, b }, { scale }, ctx) {\n return { result: (a + b) * scale };\n}\n";
|
|
531
|
-
//#endregion
|
|
532
|
-
//#region src/graph/sources.d.ts
|
|
533
519
|
/**
|
|
534
520
|
* The built-in nodes as script modules: the same interface and behaviour as the TypeScript
|
|
535
521
|
* definitions in `nodes.ts`, written self-contained so the editor can show a built-in's code
|
|
@@ -539,8 +525,6 @@ export declare const SCRIPT_NODE_TEMPLATE = "// A node is a function with a type
|
|
|
539
525
|
*/
|
|
540
526
|
/** @category Graph */
|
|
541
527
|
export declare const BUILTIN_SOURCES: Record<string, string>;
|
|
542
|
-
//#endregion
|
|
543
|
-
//#region src/graph/subgraph.d.ts
|
|
544
528
|
/**
|
|
545
529
|
* Subgraphs: a selection of nodes collapsed into one node type. The inner graph is stored in
|
|
546
530
|
* `doc.subgraphs[type]` with its interface — every wire that crossed the selection's edge
|
|
@@ -572,5 +556,4 @@ export declare function collapseToSubgraph(doc: GraphDoc, registry: NodeRegistry
|
|
|
572
556
|
* `defs`: where the definitions are (default: `doc.subgraphs`; pass the top-level document's
|
|
573
557
|
* when `doc` is itself a subgraph's inner graph).
|
|
574
558
|
*/
|
|
575
|
-
export declare function expandSubgraph(doc: GraphDoc, nodeId: string, defs?: Record<string, SubgraphDef> | undefined): string[];
|
|
576
|
-
//#endregion
|
|
559
|
+
export declare function expandSubgraph(doc: GraphDoc, nodeId: string, defs?: Record<string, SubgraphDef> | undefined): string[];
|
package/dist/index.cjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_rng = require("./rng-
|
|
3
|
-
const require_spatial_partition_3d = require("./spatial-partition-3d-
|
|
2
|
+
const require_rng = require("./rng-edL6atS3.cjs");
|
|
3
|
+
const require_spatial_partition_3d = require("./spatial-partition-3d-D1uyJVhM.cjs");
|
|
4
4
|
let heap_js = require("heap-js");
|
|
5
|
-
|
|
5
|
+
// src/astar.ts
|
|
6
6
|
const DEFAULT_MAX_NODES = 1e4;
|
|
7
7
|
const DIRECTIONS = [
|
|
8
8
|
[0, -1],
|
|
@@ -116,8 +116,7 @@ function buildPath(end) {
|
|
|
116
116
|
});
|
|
117
117
|
return path.reverse();
|
|
118
118
|
}
|
|
119
|
-
|
|
120
|
-
//#region src/canvas-renderer.ts
|
|
119
|
+
// src/canvas-renderer.ts
|
|
121
120
|
/**
|
|
122
121
|
* Fill / stroke color used when {@link DrawParams.color} is not given.
|
|
123
122
|
*
|
|
@@ -321,8 +320,7 @@ var CanvasRenderer = class {
|
|
|
321
320
|
else this.context.drawImage(image, x, y, width, height);
|
|
322
321
|
}
|
|
323
322
|
};
|
|
324
|
-
|
|
325
|
-
//#region src/clock.ts
|
|
323
|
+
// src/clock.ts
|
|
326
324
|
/**
|
|
327
325
|
* Milliseconds in one second.
|
|
328
326
|
*
|
|
@@ -428,8 +426,7 @@ var Clock = class {
|
|
|
428
426
|
this._fpsFrames = 0;
|
|
429
427
|
}
|
|
430
428
|
};
|
|
431
|
-
|
|
432
|
-
//#region src/color-palette.ts
|
|
429
|
+
// src/color-palette.ts
|
|
433
430
|
const DEFAULT_COLORS = [
|
|
434
431
|
[
|
|
435
432
|
237,
|
|
@@ -539,8 +536,7 @@ function buildColorPalette(grayscaleSteps = 8, colorSteps = 4, ...colors) {
|
|
|
539
536
|
for (const rgb of colorList) palette.push(...colorRamp(rgb, colorSteps));
|
|
540
537
|
return palette;
|
|
541
538
|
}
|
|
542
|
-
|
|
543
|
-
//#region src/disposable.ts
|
|
539
|
+
// src/disposable.ts
|
|
544
540
|
/**
|
|
545
541
|
* Collects cleanup functions (e.g. the unsubscribe functions returned by {@link Observable.subscribe}
|
|
546
542
|
* and {@link Signal.subscribe}) and runs them all at once.
|
|
@@ -570,8 +566,7 @@ var Disposable = class {
|
|
|
570
566
|
while (this.disposers.length) this.disposers.pop()?.();
|
|
571
567
|
}
|
|
572
568
|
};
|
|
573
|
-
|
|
574
|
-
//#region src/map2d.ts
|
|
569
|
+
// src/map2d.ts
|
|
575
570
|
/**
|
|
576
571
|
* Default "empty" value of a {@link Map2D}: cells holding it are not stored.
|
|
577
572
|
*
|
|
@@ -689,8 +684,7 @@ var Map2D = class {
|
|
|
689
684
|
});
|
|
690
685
|
}
|
|
691
686
|
};
|
|
692
|
-
|
|
693
|
-
//#region src/vector.ts
|
|
687
|
+
// src/vector.ts
|
|
694
688
|
/**
|
|
695
689
|
* Mutable 2D vector. Most methods modify the vector in place and return `this` for chaining;
|
|
696
690
|
* {@link Vector.clone} and {@link Vector.floored} return new vectors.
|
|
@@ -856,8 +850,7 @@ var Vector = class Vector {
|
|
|
856
850
|
return new Vector(-1, 0);
|
|
857
851
|
}
|
|
858
852
|
};
|
|
859
|
-
|
|
860
|
-
//#region src/rectangle.ts
|
|
853
|
+
// src/rectangle.ts
|
|
861
854
|
/**
|
|
862
855
|
* Axis-aligned rectangle given by its top-left corner (`x`, `y`) and size. Edges are inclusive
|
|
863
856
|
* in the containment and intersection tests.
|
|
@@ -923,8 +916,7 @@ var Rectangle = class Rectangle {
|
|
|
923
916
|
return this.contains(vec, padding);
|
|
924
917
|
}
|
|
925
918
|
};
|
|
926
|
-
|
|
927
|
-
//#region src/dungeon-generator.ts
|
|
919
|
+
// src/dungeon-generator.ts
|
|
928
920
|
/**
|
|
929
921
|
* Tile value for empty (unused) space.
|
|
930
922
|
*
|
|
@@ -1201,8 +1193,7 @@ function GenerateWalls(map) {
|
|
|
1201
1193
|
});
|
|
1202
1194
|
return [...walls.values()];
|
|
1203
1195
|
}
|
|
1204
|
-
|
|
1205
|
-
//#region src/ecs.ts
|
|
1196
|
+
// src/ecs.ts
|
|
1206
1197
|
/**
|
|
1207
1198
|
* A minimal entity-component store. Entities are integers; components are class instances stored
|
|
1208
1199
|
* per class, and {@link ECS.query} iterates the entities that have every requested component.
|
|
@@ -1301,8 +1292,7 @@ var ECS = class {
|
|
|
1301
1292
|
* @category ECS
|
|
1302
1293
|
*/
|
|
1303
1294
|
const ecs = new ECS();
|
|
1304
|
-
|
|
1305
|
-
//#region src/emitter.ts
|
|
1295
|
+
// src/emitter.ts
|
|
1306
1296
|
/**
|
|
1307
1297
|
* A string-keyed event emitter. Listeners get the emitted arguments followed by the event name,
|
|
1308
1298
|
* so one listener can tell apart the events it was added to.
|
|
@@ -1354,8 +1344,7 @@ var Emitter = class {
|
|
|
1354
1344
|
return this;
|
|
1355
1345
|
}
|
|
1356
1346
|
};
|
|
1357
|
-
|
|
1358
|
-
//#region src/event-queue.ts
|
|
1347
|
+
// src/event-queue.ts
|
|
1359
1348
|
/**
|
|
1360
1349
|
* A buffered queue of events: producers `emit()` events, and a consumer reads them later (e.g.
|
|
1361
1350
|
* once per frame) with `drain()`, or with `consume()` followed by `clear()`.
|
|
@@ -1393,8 +1382,7 @@ var EventQueue = class {
|
|
|
1393
1382
|
return this.events.length;
|
|
1394
1383
|
}
|
|
1395
1384
|
};
|
|
1396
|
-
|
|
1397
|
-
//#region src/input/bindings.ts
|
|
1385
|
+
// src/input/bindings.ts
|
|
1398
1386
|
/**
|
|
1399
1387
|
* W3C "standard" gamepad mapping, in button-index order (Xbox names; on PlayStation A = Cross,
|
|
1400
1388
|
* B = Circle, X = Square, Y = Triangle).
|
|
@@ -1642,8 +1630,7 @@ function bindingLabel(binding, keyLabels) {
|
|
|
1642
1630
|
case "xrAxis": return `${capitalize(binding.hand)} ${AXIS_NAMES[binding.axis][binding.direction > 0 ? 1 : 0]}`;
|
|
1643
1631
|
}
|
|
1644
1632
|
}
|
|
1645
|
-
|
|
1646
|
-
//#region src/input/action-map.ts
|
|
1633
|
+
// src/input/action-map.ts
|
|
1647
1634
|
/**
|
|
1648
1635
|
* Deadzone given to new actions when none is specified.
|
|
1649
1636
|
*
|
|
@@ -1797,8 +1784,7 @@ var ActionMap = class {
|
|
|
1797
1784
|
return this;
|
|
1798
1785
|
}
|
|
1799
1786
|
};
|
|
1800
|
-
|
|
1801
|
-
//#region src/input/gestures.ts
|
|
1787
|
+
// src/input/gestures.ts
|
|
1802
1788
|
const DEFAULT_THRESHOLDS = {
|
|
1803
1789
|
tapMaxDuration: 250,
|
|
1804
1790
|
tapMaxMovement: 10,
|
|
@@ -1981,8 +1967,7 @@ var GestureRecognizer = class {
|
|
|
1981
1967
|
return frame;
|
|
1982
1968
|
}
|
|
1983
1969
|
};
|
|
1984
|
-
|
|
1985
|
-
//#region src/input/input.ts
|
|
1970
|
+
// src/input/input.ts
|
|
1986
1971
|
const BUTTON_BITS = [
|
|
1987
1972
|
1,
|
|
1988
1973
|
4,
|
|
@@ -2221,8 +2206,7 @@ var Input = class Input extends Emitter {
|
|
|
2221
2206
|
return this._state[`button${buttonNumber}`]?.state ?? 0;
|
|
2222
2207
|
}
|
|
2223
2208
|
};
|
|
2224
|
-
|
|
2225
|
-
//#region src/observable.ts
|
|
2209
|
+
// src/observable.ts
|
|
2226
2210
|
/**
|
|
2227
2211
|
* A set of observers notified with a value (plus optional extra arguments). Observers are
|
|
2228
2212
|
* called in subscription order; subscribing the same function twice has no effect.
|
|
@@ -2273,8 +2257,7 @@ var Observable = class {
|
|
|
2273
2257
|
return this.observers.size;
|
|
2274
2258
|
}
|
|
2275
2259
|
};
|
|
2276
|
-
|
|
2277
|
-
//#region src/input/input-action-map.ts
|
|
2260
|
+
// src/input/input-action-map.ts
|
|
2278
2261
|
const ANY = -1;
|
|
2279
2262
|
const now = () => performance.now();
|
|
2280
2263
|
const MOUSE_BUTTONS = [
|
|
@@ -2956,8 +2939,7 @@ var InputActionMap = class {
|
|
|
2956
2939
|
});
|
|
2957
2940
|
}
|
|
2958
2941
|
};
|
|
2959
|
-
|
|
2960
|
-
//#region src/misc.ts
|
|
2942
|
+
// src/misc.ts
|
|
2961
2943
|
/**
|
|
2962
2944
|
* True if `target` is `null` or `undefined`.
|
|
2963
2945
|
* @category Utilities
|
|
@@ -3025,8 +3007,7 @@ const xyz2k = (x, y, z, delimiter = ",") => `${x}${delimiter}${y}${delimiter}${z
|
|
|
3025
3007
|
* @category Utilities
|
|
3026
3008
|
*/
|
|
3027
3009
|
const k2xyz = (key, delimiter = ",") => key.split(delimiter).map(parseFloat);
|
|
3028
|
-
|
|
3029
|
-
//#region src/particle-renderer.ts
|
|
3010
|
+
// src/particle-renderer.ts
|
|
3030
3011
|
/**
|
|
3031
3012
|
* Double-buffered square-pixel renderer for particle effects: draw with `setPixel()` into an
|
|
3032
3013
|
* offscreen buffer, then `render()` copies the buffer to the visible canvas and clears it.
|
|
@@ -3106,8 +3087,7 @@ var ParticleRenderer = class {
|
|
|
3106
3087
|
this.bufferContext.clearRect(0, 0, this._screenCanvas.width, this._screenCanvas.height);
|
|
3107
3088
|
}
|
|
3108
3089
|
};
|
|
3109
|
-
|
|
3110
|
-
//#region src/signal.ts
|
|
3090
|
+
// src/signal.ts
|
|
3111
3091
|
/**
|
|
3112
3092
|
* A value holder that notifies subscribers when the value changes (compared with `Object.is`).
|
|
3113
3093
|
* Subscribers are called immediately with the current value when they subscribe.
|
|
@@ -3146,8 +3126,7 @@ var Signal = class {
|
|
|
3146
3126
|
return () => this.subscribers.delete(subscriber);
|
|
3147
3127
|
}
|
|
3148
3128
|
};
|
|
3149
|
-
|
|
3150
|
-
//#region src/tilemap.ts
|
|
3129
|
+
// src/tilemap.ts
|
|
3151
3130
|
/**
|
|
3152
3131
|
* Sparse 2D grid of arbitrary values, keyed by floored integer coordinates. Simpler than
|
|
3153
3132
|
* {@link Map2D} (string keys, any value type, no default value or range limit).
|
|
@@ -3171,8 +3150,7 @@ var Tilemap = class {
|
|
|
3171
3150
|
this.map.set(this._key(x, y), v);
|
|
3172
3151
|
}
|
|
3173
3152
|
};
|
|
3174
|
-
|
|
3175
|
-
//#region src/webgl.ts
|
|
3153
|
+
// src/webgl.ts
|
|
3176
3154
|
/**
|
|
3177
3155
|
* Literal GLenum values, so importing this module doesn't require `WebGL2RenderingContext` to exist.
|
|
3178
3156
|
*
|
|
@@ -3798,8 +3776,7 @@ function Draw(gl, info, vertexArray, options = {}) {
|
|
|
3798
3776
|
else gl.drawArrays(mode, offset, count);
|
|
3799
3777
|
gl.bindVertexArray(null);
|
|
3800
3778
|
}
|
|
3801
|
-
|
|
3802
|
-
//#region src/webgl-renderer.ts
|
|
3779
|
+
// src/webgl-renderer.ts
|
|
3803
3780
|
/**
|
|
3804
3781
|
* A thin owner of a WebGL2 context: sizing (CSS pixels x pixel ratio), clearing, render targets,
|
|
3805
3782
|
* drawing, and context-loss notifications. Everything else is the webgl.ts wrappers on `gl`.
|
|
@@ -3935,8 +3912,7 @@ var WebGlRenderer = class {
|
|
|
3935
3912
|
this._listeners.push([type, listener]);
|
|
3936
3913
|
}
|
|
3937
3914
|
};
|
|
3938
|
-
|
|
3939
|
-
//#region src/worker-interface.ts
|
|
3915
|
+
// src/worker-interface.ts
|
|
3940
3916
|
/**
|
|
3941
3917
|
* Thin wrapper around a module `Worker` that exposes its errors and messages as
|
|
3942
3918
|
* {@link Observable}s.
|
|
@@ -3972,7 +3948,6 @@ var WorkerInterface = class {
|
|
|
3972
3948
|
this._worker.terminate();
|
|
3973
3949
|
}
|
|
3974
3950
|
};
|
|
3975
|
-
//#endregion
|
|
3976
3951
|
exports.ActionMap = ActionMap;
|
|
3977
3952
|
exports.BindRenderTarget = BindRenderTarget;
|
|
3978
3953
|
exports.CanvasRenderer = CanvasRenderer;
|