@vworlds/vecs 1.0.30 → 1.0.32
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/filter.d.ts +10 -9
- package/dist/filter.js +6 -7
- package/dist/filter.js.map +1 -1
- package/dist/inject.d.ts +20 -9
- package/dist/inject.js +33 -18
- package/dist/inject.js.map +1 -1
- package/dist/package.json +1 -1
- package/dist/query/callbacks.d.ts +9 -9
- package/dist/query/callbacks.js +52 -28
- package/dist/query/callbacks.js.map +1 -1
- package/dist/query/group.d.ts +3 -2
- package/dist/query/group.js +2 -2
- package/dist/query/group.js.map +1 -1
- package/dist/query/options.d.ts +29 -0
- package/dist/query/options.js +2 -0
- package/dist/query/options.js.map +1 -0
- package/dist/query/query.d.ts +34 -19
- package/dist/query/query.js +29 -13
- package/dist/query/query.js.map +1 -1
- package/dist/system.d.ts +10 -9
- package/dist/system.js +15 -20
- package/dist/system.js.map +1 -1
- package/docs/README.md +2 -2
- package/docs/design-guide.md +4 -4
- package/docs/queries-and-filters.md +7 -6
- package/docs/systems.md +35 -17
- package/package.json +1 -1
package/dist/filter.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ import type { World } from "./world/index.js";
|
|
|
4
4
|
import { type QueryDSL } from "./dsl.js";
|
|
5
5
|
import type { Term } from "./terms/term.js";
|
|
6
6
|
import { Iter, type FanInjectTuple, type MaybeResolvedInjectTuple } from "./inject.js";
|
|
7
|
+
import type { EntityCursorOption, FanInjectCallbackOptions, IterCursorOption } from "./query/options.js";
|
|
7
8
|
/**
|
|
8
9
|
* A non-reactive, one-shot entity filter.
|
|
9
10
|
*
|
|
@@ -71,17 +72,17 @@ export declare class Filter<R extends ComponentType[] = []> {
|
|
|
71
72
|
*/
|
|
72
73
|
forEach<J extends FanInjectTuple>(components: readonly [...J], callback: (e: Entity, resolved: MaybeResolvedInjectTuple<J, R>) => void): this;
|
|
73
74
|
/**
|
|
74
|
-
* As above, but pass `Entity`
|
|
75
|
-
* explicit. Identical behavior to the
|
|
75
|
+
* As above, but pass `{ cursor: Entity, inject: [...] }` to make the
|
|
76
|
+
* entity-first signature explicit. Identical behavior to the array form.
|
|
76
77
|
*/
|
|
77
|
-
forEach<J extends FanInjectTuple>(
|
|
78
|
+
forEach<J extends FanInjectTuple>(options: EntityCursorOption & FanInjectCallbackOptions<J>, callback: (e: Entity, resolved: MaybeResolvedInjectTuple<J, R>) => void): this;
|
|
78
79
|
/**
|
|
79
|
-
* As above, but pass `Iter`
|
|
80
|
-
* cursor instead of the bare entity. The cursor exposes the
|
|
81
|
-
* (`it.entity`) and, in `it.src`, the source entity each
|
|
82
|
-
* was read from (the visited entity for direct components,
|
|
83
|
-
* relationship's target entity for ones injected via `target`).
|
|
80
|
+
* As above, but pass `{ cursor: Iter, inject: [...] }` to receive a reused
|
|
81
|
+
* {@link Iter} cursor instead of the bare entity. The cursor exposes the
|
|
82
|
+
* visited entity (`it.entity`) and, in `it.src`, the source entity each
|
|
83
|
+
* resolved component was read from (the visited entity for direct components,
|
|
84
|
+
* the relationship's target entity for ones injected via `target`).
|
|
84
85
|
*/
|
|
85
|
-
forEach<J extends FanInjectTuple>(
|
|
86
|
+
forEach<J extends FanInjectTuple>(options: IterCursorOption & FanInjectCallbackOptions<J>, callback: (it: Iter, resolved: MaybeResolvedInjectTuple<J, R>) => void): this;
|
|
86
87
|
private _forEachMatch;
|
|
87
88
|
}
|
package/dist/filter.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { _compile, getDSLCacheKey } from "./dsl.js";
|
|
2
|
-
import {
|
|
2
|
+
import { makeInjectedInvoker, normalizeFanInjectCallbackArgs, } from "./inject.js";
|
|
3
3
|
/**
|
|
4
4
|
* A non-reactive, one-shot entity filter.
|
|
5
5
|
*
|
|
@@ -45,18 +45,17 @@ export class Filter {
|
|
|
45
45
|
get rootTerm() {
|
|
46
46
|
return this.world._getCachedTermByKey(this._termKey);
|
|
47
47
|
}
|
|
48
|
-
forEach(arg0, arg1
|
|
49
|
-
// Bare `forEach(callback)
|
|
50
|
-
if (typeof arg0 === "function"
|
|
48
|
+
forEach(arg0, arg1) {
|
|
49
|
+
// Bare `forEach(callback)`.
|
|
50
|
+
if (typeof arg0 === "function") {
|
|
51
51
|
const callback = arg0;
|
|
52
52
|
this.world.defer(() => {
|
|
53
53
|
this._forEachMatch(callback);
|
|
54
54
|
});
|
|
55
55
|
return this;
|
|
56
56
|
}
|
|
57
|
-
const useIter =
|
|
58
|
-
const
|
|
59
|
-
const callback = (isCursorMarker(arg0) ? arg2 : arg1);
|
|
57
|
+
const { components, useIter } = normalizeFanInjectCallbackArgs(arg0);
|
|
58
|
+
const callback = arg1;
|
|
60
59
|
this.world.defer(() => {
|
|
61
60
|
const invoke = makeInjectedInvoker(this.world, components, useIter, callback);
|
|
62
61
|
this._forEachMatch(invoke);
|
package/dist/filter.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"filter.js","sourceRoot":"","sources":["../src/filter.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAsC,MAAM,UAAU,CAAC;AAExF,OAAO,
|
|
1
|
+
{"version":3,"file":"filter.js","sourceRoot":"","sources":["../src/filter.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAsC,MAAM,UAAU,CAAC;AAExF,OAAO,EAEL,mBAAmB,EACnB,8BAA8B,GAK/B,MAAM,aAAa,CAAC;AAOrB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,MAAM,OAAO,MAAM;IAKjB;IACE,6CAA6C;IAC7B,KAAY,EAC5B,GAAa;QADG,UAAK,GAAL,KAAK,CAAO;QAG5B,IAAI,CAAC,IAAI,GAAG,GAAG,CAAC;QAChB,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;QACrC,IAAI,CAAC,QAAQ,GAAG,cAAc,CAAC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,CAAC,CAAC,CAAC,CAAC;YACd,CAAC;QACH,CAAC,CAAC,CAAC;IACL,CAAC;CACF"}
|
package/dist/inject.d.ts
CHANGED
|
@@ -2,7 +2,6 @@ import { type ComponentInstance, type ComponentRef, type ComponentType } from ".
|
|
|
2
2
|
import { Entity, type EID } from "./entity/index.js";
|
|
3
3
|
import { type World } from "./world/index.js";
|
|
4
4
|
import { type MaybeRequired } from "./dsl.js";
|
|
5
|
-
import { type ArrayMap } from "./util/array_map.js";
|
|
6
5
|
export type TargetInject<J extends readonly ComponentType[] = readonly ComponentType[]> = {
|
|
7
6
|
target: readonly [ComponentRef, readonly [...J]];
|
|
8
7
|
};
|
|
@@ -18,6 +17,8 @@ export type ResolvedInjectTerm = EID | {
|
|
|
18
17
|
} | {
|
|
19
18
|
down: readonly [EID, readonly EID[]];
|
|
20
19
|
};
|
|
20
|
+
export type InjectSnapshot = readonly (ComponentInstance | undefined)[];
|
|
21
|
+
export type InjectSnapshotTypes = readonly (EID | undefined)[];
|
|
21
22
|
/** Resolves the component instance type for one injected component class. */
|
|
22
23
|
type ResolvedComponentInstance<T> = T extends ComponentType ? InstanceType<T> : never;
|
|
23
24
|
type OptionalResolvedComponentInstances<J extends readonly ComponentType[]> = {
|
|
@@ -32,16 +33,17 @@ export type RequiredResolvedInjectTuple<J extends InjectTuple> = J extends reado
|
|
|
32
33
|
] ? [...RequiredResolvedInjectElement<First>, ...RequiredResolvedInjectTuple<Rest>] : [];
|
|
33
34
|
export declare function mapInject(world: World, inject: readonly FanInjectElement[]): ResolvedInjectTerm[];
|
|
34
35
|
export declare function injectArity(inject: readonly ResolvedInjectTerm[]): number;
|
|
35
|
-
export declare function getInjected(e: Entity, inject: readonly ResolvedInjectTerm[], requireDirectComponents: boolean, out: (ComponentInstance | undefined)[],
|
|
36
|
-
export declare function getInjectedWithSrc(e: Entity, inject: readonly ResolvedInjectTerm[], out: (ComponentInstance | undefined)[], src: (Entity | undefined)[], requireDirectComponents?: boolean, exitSnapshot?:
|
|
36
|
+
export declare function getInjected(e: Entity, inject: readonly ResolvedInjectTerm[], requireDirectComponents: boolean, out: (ComponentInstance | undefined)[], snapshot?: InjectSnapshot): void;
|
|
37
|
+
export declare function getInjectedWithSrc(e: Entity, inject: readonly ResolvedInjectTerm[], out: (ComponentInstance | undefined)[], src: (Entity | undefined)[], requireDirectComponents?: boolean, exitSnapshot?: InjectSnapshot): void;
|
|
37
38
|
export declare function directInjectEids(inject: readonly ResolvedInjectTerm[]): EID[];
|
|
39
|
+
export declare function directInjectSnapshotTypes(inject: readonly ResolvedInjectTerm[]): InjectSnapshotTypes | undefined;
|
|
38
40
|
/**
|
|
39
41
|
* Per-iteration cursor passed to `each` / `forEach` / `enter` / `exit` /
|
|
40
42
|
* `update` / `orderBy` callbacks when the caller opts in by passing `Iter` as
|
|
41
43
|
* the first argument:
|
|
42
44
|
*
|
|
43
45
|
* ```ts
|
|
44
|
-
* system.each(Iter, [Body, { target: [ChildOf, [Position]] }], (it, [body, pos]) => {
|
|
46
|
+
* system.each({ cursor: Iter, inject: [Body, { target: [ChildOf, [Position]] }] }, (it, [body, pos]) => {
|
|
45
47
|
* it.entity; // the visited entity
|
|
46
48
|
* it.src[0]; // entity `body` was read from (the visited entity)
|
|
47
49
|
* it.src[1]; // entity `pos` was read from (the ChildOf target), or undefined
|
|
@@ -66,17 +68,26 @@ export declare class Iter {
|
|
|
66
68
|
readonly src: (Entity | undefined)[];
|
|
67
69
|
constructor(arity: number);
|
|
68
70
|
}
|
|
69
|
-
export declare function isCursorMarker(x: unknown): x is typeof Entity | typeof Iter;
|
|
70
71
|
export declare function wantsIter(x: unknown): x is typeof Iter;
|
|
72
|
+
export type FanInjectCallbackOptions<J extends FanInjectTuple = FanInjectTuple> = {
|
|
73
|
+
cursor?: typeof Entity | typeof Iter;
|
|
74
|
+
inject: readonly [...J];
|
|
75
|
+
};
|
|
76
|
+
export type FanInjectCallbackArg<J extends FanInjectTuple = FanInjectTuple> = readonly [...J] | FanInjectCallbackOptions<J>;
|
|
77
|
+
export type InjectedCallback = (eOrIt: Entity | Iter, resolved: readonly (ComponentInstance | undefined)[]) => void;
|
|
71
78
|
/**
|
|
72
79
|
* Iterate `entities`, resolving injected components per the `forEach` /
|
|
73
|
-
* `each` argument grammar (bare callback, `[components]`,
|
|
74
|
-
* cursor
|
|
80
|
+
* `each` argument grammar (bare callback, `[components]`, or
|
|
81
|
+
* `{ cursor, inject }`). Runs inside a deferred scope so mutations made by the
|
|
75
82
|
* callback are buffered and applied after iteration finishes.
|
|
76
83
|
*
|
|
77
84
|
* Shared by {@link Query.forEach} and {@link Group.forEach} so both honour the
|
|
78
85
|
* same injection and deferral semantics.
|
|
79
86
|
*/
|
|
80
|
-
export declare function forEachInjected(world: World, entities: Iterable<Entity>,
|
|
81
|
-
export declare function
|
|
87
|
+
export declare function forEachInjected(world: World, entities: Iterable<Entity>, callbackOrInject: ((e: Entity) => void) | FanInjectCallbackArg, injectedCallback?: InjectedCallback): void;
|
|
88
|
+
export declare function normalizeFanInjectCallbackArgs(callbackOrInject: FanInjectCallbackArg): {
|
|
89
|
+
components: readonly FanInjectElement[];
|
|
90
|
+
useIter: boolean;
|
|
91
|
+
};
|
|
92
|
+
export declare function makeInjectedInvoker(world: World, components: readonly FanInjectElement[], useIter: boolean, callback: InjectedCallback): (e: Entity) => void;
|
|
82
93
|
export {};
|
package/dist/inject.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { Entity } from "./entity/index.js";
|
|
2
1
|
import { _resolveRelationship } from "./dsl.js";
|
|
3
2
|
function _isTargetInject(value) {
|
|
4
3
|
return typeof value === "object" && value !== null && "target" in value;
|
|
@@ -35,11 +34,11 @@ export function injectArity(inject) {
|
|
|
35
34
|
});
|
|
36
35
|
return arity;
|
|
37
36
|
}
|
|
38
|
-
export function getInjected(e, inject, requireDirectComponents, out,
|
|
37
|
+
export function getInjected(e, inject, requireDirectComponents, out, snapshot) {
|
|
39
38
|
let outIndex = 0;
|
|
40
|
-
inject.forEach((term) => {
|
|
39
|
+
inject.forEach((term, termIndex) => {
|
|
41
40
|
if (typeof term === "number") {
|
|
42
|
-
const c =
|
|
41
|
+
const c = snapshot?.[termIndex] ?? e._get(term);
|
|
43
42
|
if (requireDirectComponents && !c) {
|
|
44
43
|
throw new Error("query does not contain component");
|
|
45
44
|
}
|
|
@@ -61,9 +60,9 @@ export function getInjected(e, inject, requireDirectComponents, out, exitSnapsho
|
|
|
61
60
|
}
|
|
62
61
|
export function getInjectedWithSrc(e, inject, out, src, requireDirectComponents = false, exitSnapshot) {
|
|
63
62
|
let outIndex = 0;
|
|
64
|
-
inject.forEach((term) => {
|
|
63
|
+
inject.forEach((term, termIndex) => {
|
|
65
64
|
if (typeof term === "number") {
|
|
66
|
-
const c = exitSnapshot?.
|
|
65
|
+
const c = exitSnapshot?.[termIndex] ?? e._get(term);
|
|
67
66
|
if (requireDirectComponents && !c) {
|
|
68
67
|
throw new Error("query does not contain component");
|
|
69
68
|
}
|
|
@@ -88,13 +87,24 @@ export function getInjectedWithSrc(e, inject, out, src, requireDirectComponents
|
|
|
88
87
|
export function directInjectEids(inject) {
|
|
89
88
|
return inject.filter((term) => typeof term === "number");
|
|
90
89
|
}
|
|
90
|
+
export function directInjectSnapshotTypes(inject) {
|
|
91
|
+
let hasDirectInject = false;
|
|
92
|
+
const snapshotTypes = inject.map((term) => {
|
|
93
|
+
if (typeof term === "number") {
|
|
94
|
+
hasDirectInject = true;
|
|
95
|
+
return term;
|
|
96
|
+
}
|
|
97
|
+
return undefined;
|
|
98
|
+
});
|
|
99
|
+
return hasDirectInject ? snapshotTypes : undefined;
|
|
100
|
+
}
|
|
91
101
|
/**
|
|
92
102
|
* Per-iteration cursor passed to `each` / `forEach` / `enter` / `exit` /
|
|
93
103
|
* `update` / `orderBy` callbacks when the caller opts in by passing `Iter` as
|
|
94
104
|
* the first argument:
|
|
95
105
|
*
|
|
96
106
|
* ```ts
|
|
97
|
-
* system.each(Iter, [Body, { target: [ChildOf, [Position]] }], (it, [body, pos]) => {
|
|
107
|
+
* system.each({ cursor: Iter, inject: [Body, { target: [ChildOf, [Position]] }] }, (it, [body, pos]) => {
|
|
98
108
|
* it.entity; // the visited entity
|
|
99
109
|
* it.src[0]; // entity `body` was read from (the visited entity)
|
|
100
110
|
* it.src[1]; // entity `pos` was read from (the ChildOf target), or undefined
|
|
@@ -111,34 +121,30 @@ export class Iter {
|
|
|
111
121
|
this.src = new Array(arity);
|
|
112
122
|
}
|
|
113
123
|
}
|
|
114
|
-
export function isCursorMarker(x) {
|
|
115
|
-
return x === Entity || x === Iter;
|
|
116
|
-
}
|
|
117
124
|
export function wantsIter(x) {
|
|
118
125
|
return x === Iter;
|
|
119
126
|
}
|
|
120
127
|
/**
|
|
121
128
|
* Iterate `entities`, resolving injected components per the `forEach` /
|
|
122
|
-
* `each` argument grammar (bare callback, `[components]`,
|
|
123
|
-
* cursor
|
|
129
|
+
* `each` argument grammar (bare callback, `[components]`, or
|
|
130
|
+
* `{ cursor, inject }`). Runs inside a deferred scope so mutations made by the
|
|
124
131
|
* callback are buffered and applied after iteration finishes.
|
|
125
132
|
*
|
|
126
133
|
* Shared by {@link Query.forEach} and {@link Group.forEach} so both honour the
|
|
127
134
|
* same injection and deferral semantics.
|
|
128
135
|
*/
|
|
129
|
-
export function forEachInjected(world, entities,
|
|
136
|
+
export function forEachInjected(world, entities, callbackOrInject, injectedCallback) {
|
|
130
137
|
world.beginDefer();
|
|
131
138
|
try {
|
|
132
139
|
// Bare `forEach(callback)`: a function that is not a cursor marker.
|
|
133
|
-
if (typeof
|
|
140
|
+
if (typeof callbackOrInject === "function") {
|
|
134
141
|
for (const entity of entities) {
|
|
135
|
-
|
|
142
|
+
callbackOrInject(entity);
|
|
136
143
|
}
|
|
137
144
|
return;
|
|
138
145
|
}
|
|
139
|
-
const useIter =
|
|
140
|
-
const
|
|
141
|
-
const callback = (isCursorMarker(arg0) ? arg2 : arg1);
|
|
146
|
+
const { components, useIter } = normalizeFanInjectCallbackArgs(callbackOrInject);
|
|
147
|
+
const callback = injectedCallback;
|
|
142
148
|
const invoke = makeInjectedInvoker(world, components, useIter, callback);
|
|
143
149
|
for (const entity of entities) {
|
|
144
150
|
invoke(entity);
|
|
@@ -148,6 +154,15 @@ export function forEachInjected(world, entities, arg0, arg1, arg2) {
|
|
|
148
154
|
world.endDefer();
|
|
149
155
|
}
|
|
150
156
|
}
|
|
157
|
+
export function normalizeFanInjectCallbackArgs(callbackOrInject) {
|
|
158
|
+
if (!Array.isArray(callbackOrInject) && "inject" in callbackOrInject) {
|
|
159
|
+
return {
|
|
160
|
+
components: callbackOrInject.inject,
|
|
161
|
+
useIter: wantsIter(callbackOrInject.cursor),
|
|
162
|
+
};
|
|
163
|
+
}
|
|
164
|
+
return { components: callbackOrInject, useIter: false };
|
|
165
|
+
}
|
|
151
166
|
export function makeInjectedInvoker(world, components, useIter, callback) {
|
|
152
167
|
const inject = mapInject(world, components);
|
|
153
168
|
const arity = injectArity(inject);
|
package/dist/inject.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"inject.js","sourceRoot":"","sources":["../src/inject.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"inject.js","sourceRoot":"","sources":["../src/inject.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,oBAAoB,EAAsB,MAAM,UAAU,CAAC;AAmDpE,SAAS,eAAe,CAAC,KAAuB;IAC9C,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,QAAQ,IAAI,KAAK,CAAC;AAC1E,CAAC;AAED,SAAS,aAAa,CAAC,KAAuB;IAC5C,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,MAAM,IAAI,KAAK,CAAC;AACxE,CAAC;AAED,MAAM,UAAU,SAAS,CAAC,KAAY,EAAE,MAAmC;IACzE,OAAO,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EA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|
|
2
2
|
import { Entity, type EID } from "../entity/index.js";
|
|
3
|
-
import {
|
|
3
|
+
import { type InjectElement, type InjectSnapshot, type InjectSnapshotTypes, type InjectTuple } from "../inject.js";
|
|
4
|
+
import type { InjectCallbackOptions, OrderByOptions, UpdateCallbackOptions } from "./options.js";
|
|
4
5
|
import { OrderedSet } from "../util/ordered_set.js";
|
|
5
|
-
import { type ArrayMap } from "../util/array_map.js";
|
|
6
6
|
import { type World } from "../world/index.js";
|
|
7
|
-
export type EntityCallback = (e: Entity, snapshot?:
|
|
7
|
+
export type EntityCallback = (e: Entity, snapshot?: InjectSnapshot) => void;
|
|
8
8
|
export type ComponentCallback = (e: Entity, c: ComponentInstance) => void;
|
|
9
|
-
export declare function makeEnterCallback(world: World, arg0: InjectTuple | ((e: Entity) => void)
|
|
9
|
+
export declare function makeEnterCallback(world: World, arg0: InjectTuple | InjectCallbackOptions<InjectTuple> | ((e: Entity) => void), arg1?: Function): {
|
|
10
10
|
callback: EntityCallback;
|
|
11
|
-
snapshotTypes:
|
|
11
|
+
snapshotTypes: InjectSnapshotTypes | undefined;
|
|
12
12
|
};
|
|
13
|
-
export declare function makeExitCallback(world: World, arg0:
|
|
13
|
+
export declare function makeExitCallback(world: World, arg0: InjectTuple | InjectCallbackOptions<InjectTuple> | ((e: Entity) => void), arg1?: (...args: any[]) => void): {
|
|
14
14
|
callback: EntityCallback;
|
|
15
|
-
snapshotTypes:
|
|
15
|
+
snapshotTypes: InjectSnapshotTypes | undefined;
|
|
16
16
|
};
|
|
17
|
-
export declare function makeSortedEntitySet(world: World, arg0: readonly InjectElement[] |
|
|
17
|
+
export declare function makeSortedEntitySet(world: World, arg0: readonly InjectElement[] | OrderByOptions<InjectTuple>, arg1?: Function): {
|
|
18
18
|
set: OrderedSet<Entity>;
|
|
19
19
|
watchEids: EID[];
|
|
20
20
|
};
|
|
21
|
-
export declare function makeUpdateRegistration<C extends ComponentType>(world: World, arg0: C |
|
|
21
|
+
export declare function makeUpdateRegistration<C extends ComponentType>(world: World, arg0: C | UpdateCallbackOptions<C, InjectTuple>, arg1: (...args: any[]) => void): {
|
|
22
22
|
componentEid: EID;
|
|
23
23
|
callback: ComponentCallback;
|
|
24
24
|
};
|
package/dist/query/callbacks.js
CHANGED
|
@@ -1,20 +1,19 @@
|
|
|
1
|
-
import { directInjectEids, getInjected, getInjectedWithSrc, injectArity,
|
|
1
|
+
import { directInjectEids, directInjectSnapshotTypes, getInjected, getInjectedWithSrc, injectArity, Iter, mapInject, wantsIter, } from "../inject.js";
|
|
2
2
|
import { OrderedSet } from "../util/ordered_set.js";
|
|
3
|
-
export function makeEnterCallback(world, arg0, arg1
|
|
4
|
-
if (typeof arg0 === "function"
|
|
3
|
+
export function makeEnterCallback(world, arg0, arg1) {
|
|
4
|
+
if (typeof arg0 === "function") {
|
|
5
5
|
// Wrap so the drain's extra snapshot argument never leaks to a plain
|
|
6
6
|
// (non-injecting) enter callback — it observes only the entity.
|
|
7
7
|
const fn = arg0;
|
|
8
8
|
return { callback: (e) => fn(e), snapshotTypes: undefined };
|
|
9
9
|
}
|
|
10
|
-
const useIter =
|
|
11
|
-
const
|
|
12
|
-
const cb = (isCursorMarker(arg0) ? arg2 : arg1);
|
|
10
|
+
const { components, useIter } = normalizeInjectCallbackArgs(arg0);
|
|
11
|
+
const cb = arg1;
|
|
13
12
|
const inject = mapInject(world, components);
|
|
14
13
|
// Mirror exit: capture the injected components so a System's inbox-queued enter
|
|
15
14
|
// still resolves them even if the entity is destroyed before the inbox drains.
|
|
16
15
|
// Snapshots store component references, so live entities see current values.
|
|
17
|
-
const snapshotTypes =
|
|
16
|
+
const snapshotTypes = directInjectSnapshotTypes(inject);
|
|
18
17
|
const arity = injectArity(inject);
|
|
19
18
|
if (useIter) {
|
|
20
19
|
const callback = (e, enterSnapshot) => {
|
|
@@ -33,15 +32,14 @@ export function makeEnterCallback(world, arg0, arg1, arg2) {
|
|
|
33
32
|
};
|
|
34
33
|
return { callback, snapshotTypes };
|
|
35
34
|
}
|
|
36
|
-
export function makeExitCallback(world, arg0, arg1
|
|
37
|
-
if (typeof arg0 === "function"
|
|
35
|
+
export function makeExitCallback(world, arg0, arg1) {
|
|
36
|
+
if (typeof arg0 === "function") {
|
|
38
37
|
return { callback: arg0, snapshotTypes: undefined };
|
|
39
38
|
}
|
|
40
|
-
const useIter =
|
|
41
|
-
const
|
|
42
|
-
const cb = (isCursorMarker(arg0) ? arg2 : arg1);
|
|
39
|
+
const { components, useIter } = normalizeInjectCallbackArgs(arg0);
|
|
40
|
+
const cb = arg1;
|
|
43
41
|
const inject = mapInject(world, components);
|
|
44
|
-
const snapshotTypes =
|
|
42
|
+
const snapshotTypes = directInjectSnapshotTypes(inject);
|
|
45
43
|
const arity = injectArity(inject);
|
|
46
44
|
if (useIter) {
|
|
47
45
|
const callback = (e, exitSnapshot) => {
|
|
@@ -60,10 +58,9 @@ export function makeExitCallback(world, arg0, arg1, arg2) {
|
|
|
60
58
|
};
|
|
61
59
|
return { callback, snapshotTypes };
|
|
62
60
|
}
|
|
63
|
-
export function makeSortedEntitySet(world, arg0, arg1
|
|
64
|
-
const useIter =
|
|
65
|
-
const
|
|
66
|
-
const cb = (isCursorMarker(arg0) ? arg2 : arg1);
|
|
61
|
+
export function makeSortedEntitySet(world, arg0, arg1) {
|
|
62
|
+
const { components, useIter } = normalizeInjectCallbackArgs(arg0);
|
|
63
|
+
const cb = arg1;
|
|
67
64
|
const inject = mapInject(world, components);
|
|
68
65
|
const arity = injectArity(inject);
|
|
69
66
|
const watchEids = directInjectEids(inject);
|
|
@@ -90,20 +87,25 @@ export function makeSortedEntitySet(world, arg0, arg1, arg2) {
|
|
|
90
87
|
});
|
|
91
88
|
return { set, watchEids };
|
|
92
89
|
}
|
|
93
|
-
export function makeUpdateRegistration(world, arg0, arg1
|
|
94
|
-
const
|
|
95
|
-
|
|
96
|
-
arg0 = arg1;
|
|
97
|
-
arg1 = arg2;
|
|
98
|
-
arg2 = arg3;
|
|
99
|
-
}
|
|
100
|
-
const ComponentClass = arg0;
|
|
90
|
+
export function makeUpdateRegistration(world, arg0, arg1) {
|
|
91
|
+
const normalized = normalizeUpdateCallbackArgs(arg0);
|
|
92
|
+
const { ComponentClass, components, useIter } = normalized;
|
|
101
93
|
const componentEid = world.entity(ComponentClass).eid;
|
|
102
|
-
if (
|
|
94
|
+
if (components === undefined) {
|
|
95
|
+
const fn = arg1;
|
|
96
|
+
if (useIter) {
|
|
97
|
+
const it = new Iter(0);
|
|
98
|
+
return {
|
|
99
|
+
componentEid,
|
|
100
|
+
callback: (e, c) => {
|
|
101
|
+
it.entity = e;
|
|
102
|
+
fn(it, c);
|
|
103
|
+
},
|
|
104
|
+
};
|
|
105
|
+
}
|
|
103
106
|
return { componentEid, callback: arg1 };
|
|
104
107
|
}
|
|
105
|
-
const
|
|
106
|
-
const callback = arg2;
|
|
108
|
+
const callback = arg1;
|
|
107
109
|
const inject = mapInject(world, components);
|
|
108
110
|
const arity = injectArity(inject);
|
|
109
111
|
const injected = new Array(arity);
|
|
@@ -122,4 +124,26 @@ export function makeUpdateRegistration(world, arg0, arg1, arg2, arg3) {
|
|
|
122
124
|
};
|
|
123
125
|
return { componentEid, callback: cb };
|
|
124
126
|
}
|
|
127
|
+
function isOptionsObject(value) {
|
|
128
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
129
|
+
}
|
|
130
|
+
function normalizeInjectCallbackArgs(arg0) {
|
|
131
|
+
if (isOptionsObject(arg0) && "inject" in arg0) {
|
|
132
|
+
return {
|
|
133
|
+
components: arg0.inject,
|
|
134
|
+
useIter: wantsIter(arg0.cursor),
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
return { components: arg0, useIter: false };
|
|
138
|
+
}
|
|
139
|
+
function normalizeUpdateCallbackArgs(arg0) {
|
|
140
|
+
if (isOptionsObject(arg0) && "watch" in arg0) {
|
|
141
|
+
return {
|
|
142
|
+
ComponentClass: arg0.watch,
|
|
143
|
+
components: arg0.inject,
|
|
144
|
+
useIter: wantsIter(arg0.cursor),
|
|
145
|
+
};
|
|
146
|
+
}
|
|
147
|
+
return { ComponentClass: arg0, components: undefined, useIter: false };
|
|
148
|
+
}
|
|
125
149
|
//# sourceMappingURL=callbacks.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"callbacks.js","sourceRoot":"","sources":["../../src/query/callbacks.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,gBAAgB,EAChB,WAAW,EACX,kBAAkB,EAClB,WAAW,EACX,
|
|
1
|
+
{"version":3,"file":"callbacks.js","sourceRoot":"","sources":["../../src/query/callbacks.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,gBAAgB,EAChB,yBAAyB,EACzB,WAAW,EACX,kBAAkB,EAClB,WAAW,EACX,IAAI,EACJ,SAAS,EACT,SAAS,GAKV,MAAM,cAAc,CAAC;AAEtB,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAcpD,MAAM,UAAU,iBAAiB,CAC/B,KAAY,EACZ,IAA8E,EAC9E,IAAe;IAEf,IAAI,OAAO,IAAI,KAAK,UAAU,EAAE,CAAC;QAC/B,qEAAqE;QACrE,gEAAgE;QAChE,MAAM,EAAE,GAAG,IAA2B,CAAC;QACvC,OAAO,EAAE,QAAQ,EAAE,CAAC,CAAS,EAAE,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,aAAa,EAAE,SAAS,EAAE,CAAC;IACtE,CAAC;IACD,MAAM,EAAE,UAAU,EAAE,OAAO,EAAE,GAAG,2BAA2B,CAAC,IAAI,CAAC,CAAC;IAClE,MAAM,EAAE,GAAG,IAAoE,CAAC;IAChF,MAAM,MAAM,GAAG,SAAS,CAAC,KAAK,EAAE,UAAU,CAAC,CAAC;IAC5C,gFAAgF;IAChF,+EAA+E;IAC/E,6EAA6E;IAC7E,MAAM,aAAa,GAAG,yBAAyB,CAAC,MAAM,CAAC,CAAC;IACxD,MAAM,KAAK,GAAG,WAAW,CAAC,MAAM,CAAC,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AAC;QAC7C,OAAO;YACL,cAAc,EAAE,IAAI,CAAC,KAAU;YAC/B,UAAU,EAAE,IAAI,CAAC,MAA8C;YAC/D,OAAO,EAAE,SAAS,CAAC,IAAI,CAAC,MAAM,CAAC;SAChC,CAAC;IACJ,CAAC;IACD,OAAO,EAAE,cAAc,EAAE,IAAS,EAAE,UAAU,EAAE,SAAS,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;AAC9E,CAAC"}
|
package/dist/query/group.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import { type ComponentType } from "../component.js";
|
|
|
2
2
|
import { Entity } from "../entity/index.js";
|
|
3
3
|
import { Iter, type FanInjectTuple, type MaybeResolvedInjectTuple } from "../inject.js";
|
|
4
4
|
import { type World } from "../world/index.js";
|
|
5
|
+
import type { EntityCursorOption, FanInjectCallbackOptions, IterCursorOption } from "./options.js";
|
|
5
6
|
export declare class Group<K = unknown, R extends ComponentType[] = []> {
|
|
6
7
|
readonly key: K;
|
|
7
8
|
private readonly _entities;
|
|
@@ -11,7 +12,7 @@ export declare class Group<K = unknown, R extends ComponentType[] = []> {
|
|
|
11
12
|
[Symbol.iterator](): IterableIterator<Entity>;
|
|
12
13
|
forEach(callback: (e: Entity) => void): this;
|
|
13
14
|
forEach<J extends FanInjectTuple>(components: readonly [...J], callback: (e: Entity, resolved: MaybeResolvedInjectTuple<J, R>) => void): this;
|
|
14
|
-
forEach<J extends FanInjectTuple>(
|
|
15
|
-
forEach<J extends FanInjectTuple>(
|
|
15
|
+
forEach<J extends FanInjectTuple>(options: EntityCursorOption & FanInjectCallbackOptions<J>, callback: (e: Entity, resolved: MaybeResolvedInjectTuple<J, R>) => void): this;
|
|
16
|
+
forEach<J extends FanInjectTuple>(options: IterCursorOption & FanInjectCallbackOptions<J>, callback: (it: Iter, resolved: MaybeResolvedInjectTuple<J, R>) => void): this;
|
|
16
17
|
has(e: Entity): boolean;
|
|
17
18
|
}
|
package/dist/query/group.js
CHANGED
|
@@ -11,8 +11,8 @@ export class Group {
|
|
|
11
11
|
[Symbol.iterator]() {
|
|
12
12
|
return this._entities[Symbol.iterator]();
|
|
13
13
|
}
|
|
14
|
-
forEach(arg0, arg1
|
|
15
|
-
forEachInjected(this._world, this._entities, arg0, arg1
|
|
14
|
+
forEach(arg0, arg1) {
|
|
15
|
+
forEachInjected(this._world, this._entities, arg0, arg1);
|
|
16
16
|
return this;
|
|
17
17
|
}
|
|
18
18
|
has(e) {
|
package/dist/query/group.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"group.js","sourceRoot":"","sources":["../../src/query/group.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,eAAe,
|
|
1
|
+
{"version":3,"file":"group.js","sourceRoot":"","sources":["../../src/query/group.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,eAAe,GAMhB,MAAM,cAAc,CAAC;AAItB,MAAM,OAAO,KAAK;IAKhB,YAAmB,KAAY,EAAE,GAAM;QAHtB,cAAS,GAAG,IAAI,GAAG,EAAU,CAAC;QAI7C,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;QACpB,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;IACjB,CAAC;IAED,IAAW,KAAK;QACd,OAAO,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC;IAC7B,CAAC;IAEM,CAAC,MAAM,CAAC,QAAQ,CAAC;QACtB,OAAO,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,CAAC;IAC3C,CAAC;IAeM,OAAO,CAAC,IAAkD,EAAE,IAAe;QAChF,eAAe,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,SAAS,EAAE,IAAI,EAAE,IAAwB,CAAC,CAAC;QAC7E,OAAO,IAAI,CAAC;IACd,CAAC;IAEM,GAAG,CAAC,CAAS;QAClB,OAAO,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;IAC/B,CAAC;IAED,gBAAgB;IACT,IAAI,CAAC,CAAS;QACnB,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;IACxB,CAAC;IAED,gBAAgB;IACT,OAAO,CAAC,CAAS;QACtB,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;QACzB,OAAO,IAAI,CAAC,SAAS,CAAC,IAAI,KAAK,CAAC,CAAC;IACnC,CAAC;CACF"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { type ComponentRef, type ComponentType } from "../component.js";
|
|
2
|
+
import { Entity } from "../entity/index.js";
|
|
3
|
+
import { Iter, type FanInjectTuple, type InjectTuple } from "../inject.js";
|
|
4
|
+
export type EntityCursorOption = {
|
|
5
|
+
cursor?: typeof Entity;
|
|
6
|
+
};
|
|
7
|
+
export type IterCursorOption = {
|
|
8
|
+
cursor: typeof Iter;
|
|
9
|
+
};
|
|
10
|
+
type CursorOption = EntityCursorOption | IterCursorOption;
|
|
11
|
+
type InjectOption<J extends InjectTuple> = {
|
|
12
|
+
inject: readonly [...J];
|
|
13
|
+
};
|
|
14
|
+
type FanInjectOption<J extends FanInjectTuple> = {
|
|
15
|
+
inject: readonly [...J];
|
|
16
|
+
};
|
|
17
|
+
type WatchOption<C extends ComponentType> = {
|
|
18
|
+
watch: C;
|
|
19
|
+
};
|
|
20
|
+
type RelationshipOption<R extends ComponentRef = ComponentRef> = {
|
|
21
|
+
relationship: R;
|
|
22
|
+
};
|
|
23
|
+
export type InjectCallbackOptions<J extends InjectTuple> = CursorOption & InjectOption<J>;
|
|
24
|
+
export type FanInjectCallbackOptions<J extends FanInjectTuple> = CursorOption & FanInjectOption<J>;
|
|
25
|
+
export type UpdateCallbackOptions<C extends ComponentType, J extends InjectTuple> = CursorOption & WatchOption<C> & Partial<InjectOption<J>>;
|
|
26
|
+
export type OrderByOptions<J extends InjectTuple> = CursorOption & InjectOption<J>;
|
|
27
|
+
export type GroupByOptions<J extends FanInjectTuple> = FanInjectOption<J>;
|
|
28
|
+
export type CascadeOptions = RelationshipOption;
|
|
29
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"options.js","sourceRoot":"","sources":["../../src/query/options.ts"],"names":[],"mappings":""}
|