@vworlds/vecs 1.0.44 → 1.0.46
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 +7 -1
- package/dist/component.d.ts +57 -51
- package/dist/component.js +25 -9
- package/dist/component.js.map +1 -1
- package/dist/component_meta.d.ts +71 -66
- package/dist/component_meta.js +331 -34
- package/dist/component_meta.js.map +1 -1
- package/dist/dsl.js +1 -1
- package/dist/dsl.js.map +1 -1
- package/dist/entity/entity.base.js +4 -0
- package/dist/entity/entity.base.js.map +1 -1
- package/dist/entity/entity.components.d.ts +39 -27
- package/dist/entity/entity.components.js +258 -74
- package/dist/entity/entity.components.js.map +1 -1
- package/dist/entity/entity.d.ts +1 -2
- package/dist/entity/entity.js +2 -3
- package/dist/entity/entity.js.map +1 -1
- package/dist/entity/entity.lifecycle.d.ts +7 -1
- package/dist/entity/entity.lifecycle.js +40 -53
- package/dist/entity/entity.lifecycle.js.map +1 -1
- package/dist/entity/entity.queries.js +30 -0
- package/dist/entity/entity.queries.js.map +1 -1
- package/dist/entity/entity.relationships.d.ts +4 -0
- package/dist/entity/entity.relationships.js +18 -10
- package/dist/entity/entity.relationships.js.map +1 -1
- package/dist/index.d.ts +7 -4
- package/dist/index.js +4 -2
- package/dist/index.js.map +1 -1
- package/dist/inject.d.ts +63 -14
- package/dist/inject.js +165 -89
- package/dist/inject.js.map +1 -1
- package/dist/modules/identity.js +2 -2
- package/dist/modules/identity.js.map +1 -1
- package/dist/modules/implements.js +2 -2
- package/dist/modules/implements.js.map +1 -1
- package/dist/modules/pipeline.js +5 -5
- package/dist/modules/pipeline.js.map +1 -1
- package/dist/modules/relationship_types.d.ts +70 -3
- package/dist/modules/relationship_types.js +70 -3
- package/dist/modules/relationship_types.js.map +1 -1
- package/dist/modules/relationships.d.ts +31 -8
- package/dist/modules/relationships.js +120 -30
- package/dist/modules/relationships.js.map +1 -1
- package/dist/modules/singleton.js +2 -2
- package/dist/modules/singleton.js.map +1 -1
- package/dist/modules/snapshot.d.ts +26 -0
- package/dist/modules/snapshot.js +45 -0
- package/dist/modules/snapshot.js.map +1 -0
- package/dist/modules/snapshot_types.d.ts +85 -0
- package/dist/modules/snapshot_types.js +130 -0
- package/dist/modules/snapshot_types.js.map +1 -0
- package/dist/package.json +2 -2
- package/dist/query/callbacks.d.ts +9 -7
- package/dist/query/callbacks.js +27 -41
- package/dist/query/callbacks.js.map +1 -1
- package/dist/query/grouped_query.js +7 -7
- package/dist/query/grouped_query.js.map +1 -1
- package/dist/query/grouping.d.ts +6 -2
- package/dist/query/grouping.js +84 -15
- package/dist/query/grouping.js.map +1 -1
- package/dist/query/query.d.ts +4 -4
- package/dist/query/query.js +37 -14
- package/dist/query/query.js.map +1 -1
- package/dist/snapshot/capture.d.ts +1 -0
- package/dist/snapshot/capture.js +212 -0
- package/dist/snapshot/capture.js.map +1 -0
- package/dist/snapshot/clone.d.ts +1 -0
- package/dist/snapshot/clone.js +107 -0
- package/dist/snapshot/clone.js.map +1 -0
- package/dist/snapshot/index.d.ts +5 -0
- package/dist/snapshot/index.js +21 -0
- package/dist/snapshot/index.js.map +1 -0
- package/dist/snapshot/preflight.d.ts +1 -0
- package/dist/snapshot/preflight.js +40 -0
- package/dist/snapshot/preflight.js.map +1 -0
- package/dist/snapshot/restore.d.ts +1 -0
- package/dist/snapshot/restore.js +111 -0
- package/dist/snapshot/restore.js.map +1 -0
- package/dist/snapshot/types.d.ts +135 -0
- package/dist/snapshot/types.js +26 -0
- package/dist/snapshot/types.js.map +1 -0
- package/dist/system.d.ts +3 -1
- package/dist/system.js +33 -23
- package/dist/system.js.map +1 -1
- package/dist/terms/all_term.js +19 -0
- package/dist/terms/all_term.js.map +1 -1
- package/dist/terms/any_term.js +19 -0
- package/dist/terms/any_term.js.map +1 -1
- package/dist/terms/not_term.js +4 -0
- package/dist/terms/not_term.js.map +1 -1
- package/dist/terms/target_term.d.ts +1 -2
- package/dist/terms/target_term.js +2 -4
- package/dist/terms/target_term.js.map +1 -1
- package/dist/terms/term.d.ts +2 -0
- package/dist/terms/term.js +59 -10
- package/dist/terms/term.js.map +1 -1
- package/dist/util/array_map.d.ts +43 -12
- package/dist/util/array_map.js +90 -41
- package/dist/util/array_map.js.map +1 -1
- package/dist/util/dense_set.js +26 -0
- package/dist/util/dense_set.js.map +1 -1
- package/dist/world/world.base.js +12 -0
- package/dist/world/world.base.js.map +1 -1
- package/dist/world/world.d.ts +7 -0
- package/dist/world/world.deferred.js +17 -0
- package/dist/world/world.deferred.js.map +1 -1
- package/dist/world/world.entities.d.ts +13 -2
- package/dist/world/world.entities.js +16 -2
- package/dist/world/world.entities.js.map +1 -1
- package/dist/world/world.js +15 -3
- package/dist/world/world.js.map +1 -1
- package/dist/world/world.pipeline.d.ts +2 -2
- package/dist/world/world.pipeline.js +4 -2
- package/dist/world/world.pipeline.js.map +1 -1
- package/dist/world/world.queries.d.ts +7 -0
- package/dist/world/world.queries.js +52 -0
- package/dist/world/world.queries.js.map +1 -1
- package/dist/world/world.transfers.d.ts +137 -0
- package/dist/world/world.transfers.js +188 -0
- package/dist/world/world.transfers.js.map +1 -0
- package/docs/README.md +18 -6
- package/docs/components.md +91 -48
- package/docs/concepts.md +21 -17
- package/docs/design-guide.md +125 -89
- package/docs/entities.md +62 -72
- package/docs/execution-model.md +26 -10
- package/docs/getting-started.md +6 -6
- package/docs/glossary.md +19 -10
- package/docs/modules.md +8 -8
- package/docs/queries-and-filters.md +15 -10
- package/docs/relationships.md +250 -115
- package/docs/snapshots.md +181 -0
- package/docs/systems.md +64 -21
- package/docs/utilities.md +10 -6
- package/package.json +2 -2
- package/skills/vecs/SKILL.md +5 -4
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
// The destination side of a subtree transfer: allocate fresh ids, then rebuild
|
|
2
|
+
// every component and edge through vecs' own APIs so ownership, aliases,
|
|
3
|
+
// exclusivity, hooks, and query routing happen exactly once per component.
|
|
4
|
+
//
|
|
5
|
+
// Nothing in this file touches the source world's entities beyond reading the
|
|
6
|
+
// snapshot records; entity ids and relationship edges cannot be transplanted,
|
|
7
|
+
// only recreated.
|
|
8
|
+
import { _preflightRestore, _requireUsable } from "./preflight.js";
|
|
9
|
+
/**
|
|
10
|
+
* @internal Recreate a captured snapshot inside `destination`.
|
|
11
|
+
*
|
|
12
|
+
* Order matters and is fixed:
|
|
13
|
+
*
|
|
14
|
+
* 1. Preflight every class against the destination's registry and policies.
|
|
15
|
+
* 2. Allocate one destination entity per record, so every edge target exists
|
|
16
|
+
* before any edge is added.
|
|
17
|
+
* 3. Materialize components through the canonical materializer, using the
|
|
18
|
+
* materializer bound into each record at capture time.
|
|
19
|
+
* 4. Rebuild the traversal relationship's edges, then every other edge, so
|
|
20
|
+
* hierarchy-sensitive policies (`OneOf`, `Traversable`) see a complete tree.
|
|
21
|
+
* 5. Assign each relationship's non-edge data, in capture order.
|
|
22
|
+
*
|
|
23
|
+
* Steps 3–5 never consult the destination's declared policy: each record carries
|
|
24
|
+
* the materializer it was captured with, so a policy declared or changed between
|
|
25
|
+
* capture and restore cannot alter what this snapshot rebuilds.
|
|
26
|
+
*
|
|
27
|
+
* Any throw in steps 2–5 destroys everything this attempt created and
|
|
28
|
+
* rethrows, so a failed restore leaves the destination as it was found.
|
|
29
|
+
*
|
|
30
|
+
* @throws If a class is unusable in `destination`, an edge target is missing
|
|
31
|
+
* from the snapshot, or materialization fails.
|
|
32
|
+
*/
|
|
33
|
+
export function _restoreSubtree(destination, snapshot) {
|
|
34
|
+
const entities = new Map();
|
|
35
|
+
const sourceToDestination = new Map();
|
|
36
|
+
const created = [];
|
|
37
|
+
try {
|
|
38
|
+
_preflightRestore(destination, snapshot);
|
|
39
|
+
for (const record of snapshot.entities) {
|
|
40
|
+
const entity = destination.entity();
|
|
41
|
+
entities.set(record.key, entity);
|
|
42
|
+
sourceToDestination.set(record.source, entity);
|
|
43
|
+
created.push(entity);
|
|
44
|
+
}
|
|
45
|
+
for (const record of snapshot.entities) {
|
|
46
|
+
const entity = entities.get(record.key);
|
|
47
|
+
for (const captured of record.components) {
|
|
48
|
+
const meta = _requireUsable(destination, captured.Class, record.key);
|
|
49
|
+
entity._materialize(meta, captured.data, captured.materialize);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
_rebuildEdges(destination, snapshot, entities, true);
|
|
53
|
+
_rebuildEdges(destination, snapshot, entities, false);
|
|
54
|
+
for (const record of snapshot.entities) {
|
|
55
|
+
const entity = entities.get(record.key);
|
|
56
|
+
for (const captured of record.relationships) {
|
|
57
|
+
if (captured.materialize !== undefined) {
|
|
58
|
+
// A custom relationship policy owns construction outright, so the
|
|
59
|
+
// instance is built before its edges land and step 5 has nothing to
|
|
60
|
+
// assign. The default path still lets the first edge create the
|
|
61
|
+
// instance, which keeps the existing add/target-add hook order intact.
|
|
62
|
+
continue;
|
|
63
|
+
}
|
|
64
|
+
if (captured.data != null) {
|
|
65
|
+
entity._set(_requireUsable(destination, captured.Class, record.key), captured.data);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
catch (error) {
|
|
71
|
+
for (let i = created.length - 1; i >= 0; i--) {
|
|
72
|
+
if (!created[i].destroyed) {
|
|
73
|
+
created[i].destroy();
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
throw error;
|
|
77
|
+
}
|
|
78
|
+
return {
|
|
79
|
+
entities,
|
|
80
|
+
sourceToDestination,
|
|
81
|
+
roots: snapshot.roots.map((key) => entities.get(key)),
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* @internal Rebuild one pass of relationship edges.
|
|
86
|
+
*
|
|
87
|
+
* `hierarchy` selects the traversal relationship, which is rebuilt first so that
|
|
88
|
+
* parent-sensitive policies see a complete hierarchy before any other edge lands.
|
|
89
|
+
*/
|
|
90
|
+
function _rebuildEdges(destination, snapshot, entities, hierarchy) {
|
|
91
|
+
for (const record of snapshot.entities) {
|
|
92
|
+
const source = entities.get(record.key);
|
|
93
|
+
for (const captured of record.relationships) {
|
|
94
|
+
if ((captured.Class === snapshot.traversal) !== hierarchy) {
|
|
95
|
+
continue;
|
|
96
|
+
}
|
|
97
|
+
const meta = _requireUsable(destination, captured.Class, record.key);
|
|
98
|
+
if (captured.materialize !== undefined) {
|
|
99
|
+
source._materialize(meta, undefined, () => captured.materialize(captured.data));
|
|
100
|
+
}
|
|
101
|
+
for (const key of captured.targets) {
|
|
102
|
+
const target = entities.get(key);
|
|
103
|
+
if (target === undefined) {
|
|
104
|
+
throw new Error(`restoreSubtree: ${captured.Class.name} on entity ${record.key} targets snapshot key ${key}, which is not part of the snapshot`);
|
|
105
|
+
}
|
|
106
|
+
source._addTarget(meta, target);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
//# sourceMappingURL=restore.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"restore.js","sourceRoot":"","sources":["../../src/snapshot/restore.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAC/E,yEAAyE;AACzE,2EAA2E;AAC3E,EAAE;AACF,8EAA8E;AAC9E,8EAA8E;AAC9E,kBAAkB;AAIlB,OAAO,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAGnE;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,MAAM,UAAU,eAAe,CAC7B,WAAkB,EAClB,QAA+B;IAE/B,MAAM,QAAQ,GAAG,IAAI,GAAG,EAAe,CAAC;IACxC,MAAM,mBAAmB,GAAG,IAAI,GAAG,EAAkB,CAAC;IACtD,MAAM,OAAO,GAAa,EAAE,CAAC;IAE7B,IAAI,CAAC;QACH,iBAAiB,CAAC,WAAW,EAAE,QAAQ,CAAC,CAAC;QAEzC,KAAK,MAAM,MAAM,IAAI,QAAQ,CAAC,QAAQ,EAAE,CAAC;YACvC,MAAM,MAAM,GAAG,WAAW,CAAC,MAAM,EAAE,CAAC;YACpC,Q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AM,CAAC,YAAY,CAAC,IAAI,EAAE,SAAS,EAAE,GAAG,EAAE,CAAC,QAAQ,CAAC,WAAY,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC;YACnF,CAAC;YACD,KAAK,MAAM,GAAG,IAAI,QAAQ,CAAC,OAAO,EAAE,CAAC;gBACnC,MAAM,MAAM,GAAG,QAAQ,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;gBACjC,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;oBACzB,MAAM,IAAI,KAAK,CACb,mBAAmB,QAAQ,CAAC,KAAK,CAAC,IAAI,cAAc,MAAM,CAAC,GAAG,yBAAyB,GAAG,qCAAqC,CAChI,CAAC;gBACJ,CAAC;gBACD,MAAM,CAAC,UAAU,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;YAClC,CAAC;QACH,CAAC;IACH,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
import { type ComponentType, type Relationship } from "../component_meta.js";
|
|
2
|
+
import { type EID, type Entity } from "../entity/index.js";
|
|
3
|
+
import { type SnapshotMaterialize } from "../modules/snapshot_types.js";
|
|
4
|
+
/** A relationship component class. */
|
|
5
|
+
export type RelationshipType = ComponentType<Relationship>;
|
|
6
|
+
/**
|
|
7
|
+
* What to do with a captured relationship edge whose target is **outside** the
|
|
8
|
+
* captured subtree.
|
|
9
|
+
*
|
|
10
|
+
* - `"omit"` (default) — drop the edge. The destination entity keeps the
|
|
11
|
+
* relationship's other targets and its non-edge data.
|
|
12
|
+
* - `"error"` — fail the capture. Use it when a partial forest would be a
|
|
13
|
+
* silent gameplay bug.
|
|
14
|
+
*/
|
|
15
|
+
export type ExternalTargetPolicy = "omit" | "error";
|
|
16
|
+
/** Caller-controlled selection and traversal for {@link World.snapshotSubtree}. */
|
|
17
|
+
export interface SubtreeSnapshotOptions {
|
|
18
|
+
/**
|
|
19
|
+
* Relationship traversed from each root to collect the subtree. Defaults to
|
|
20
|
+
* {@link ChildOf}. Must be registered in the source world.
|
|
21
|
+
*/
|
|
22
|
+
traversal?: RelationshipType;
|
|
23
|
+
/**
|
|
24
|
+
* Component classes to capture. When omitted, every captured component type
|
|
25
|
+
* participates — the caller selects what moves by narrowing this list.
|
|
26
|
+
*
|
|
27
|
+
* Naming a type whose {@link OnSnapshot} policy is `DontSnapshot` is a
|
|
28
|
+
* preflight error, never a silent omission.
|
|
29
|
+
*/
|
|
30
|
+
components?: readonly ComponentType[];
|
|
31
|
+
/**
|
|
32
|
+
* Relationship classes whose edges to capture. When omitted, every captured
|
|
33
|
+
* relationship participates. The `traversal` relationship is captured only if
|
|
34
|
+
* it is named here.
|
|
35
|
+
*/
|
|
36
|
+
relationships?: readonly RelationshipType[];
|
|
37
|
+
/**
|
|
38
|
+
* How to treat relationship targets outside the captured subtree. Defaults
|
|
39
|
+
* to `"omit"`.
|
|
40
|
+
*/
|
|
41
|
+
externalTargets?: ExternalTargetPolicy;
|
|
42
|
+
}
|
|
43
|
+
/** One captured component: its class, its detached data, and how to rebuild it. */
|
|
44
|
+
export interface ComponentSnapshot {
|
|
45
|
+
/** Component class, as registered in the source world. */
|
|
46
|
+
readonly Class: ComponentType;
|
|
47
|
+
/**
|
|
48
|
+
* Payload produced by the type's capture policy. Never references the source
|
|
49
|
+
* world.
|
|
50
|
+
*/
|
|
51
|
+
readonly data: unknown;
|
|
52
|
+
/**
|
|
53
|
+
* The materializer the source world's policy resolved to **at capture time**.
|
|
54
|
+
*
|
|
55
|
+
* Binding it here is what makes a snapshot stable: a policy declared, changed,
|
|
56
|
+
* or revoked after the capture cannot change how this snapshot restores.
|
|
57
|
+
*/
|
|
58
|
+
readonly materialize: SnapshotMaterialize;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* One captured relationship: its class, its non-edge data, and the edges it
|
|
62
|
+
* keeps.
|
|
63
|
+
*
|
|
64
|
+
* Edge data is stored separately from the relationship payload because targets
|
|
65
|
+
* are world-local entity references: restore rebuilds each edge through the
|
|
66
|
+
* public relationship API and remaps internal targets onto freshly allocated
|
|
67
|
+
* destination ids.
|
|
68
|
+
*/
|
|
69
|
+
export interface RelationshipSnapshot {
|
|
70
|
+
/** Relationship class, as registered in the source world. */
|
|
71
|
+
readonly Class: RelationshipType;
|
|
72
|
+
/** Payload for the relationship's own fields, excluding target storage. */
|
|
73
|
+
readonly data: unknown;
|
|
74
|
+
/** Snapshot keys of the targets inside the captured subtree, in edge order. */
|
|
75
|
+
readonly targets: readonly EID[];
|
|
76
|
+
/**
|
|
77
|
+
* How many targets were left behind because they sit outside the captured
|
|
78
|
+
* subtree. Always `0` under the `"error"` external-target policy.
|
|
79
|
+
*/
|
|
80
|
+
readonly externalTargets: number;
|
|
81
|
+
/**
|
|
82
|
+
* The materializer the source world's policy resolved to at capture time, for
|
|
83
|
+
* a relationship that declares a custom policy. `undefined` for the default
|
|
84
|
+
* {@link ClonePublic}, where edges create the instance and the payload is
|
|
85
|
+
* assigned through the ordinary relationship path.
|
|
86
|
+
*/
|
|
87
|
+
readonly materialize: SnapshotMaterialize | undefined;
|
|
88
|
+
}
|
|
89
|
+
/** One captured entity: its identity, its position in the forest, and its data. */
|
|
90
|
+
export interface SubtreeEntitySnapshot {
|
|
91
|
+
/**
|
|
92
|
+
* Snapshot key: the source entity's id at capture time. Stable for the life of
|
|
93
|
+
* the snapshot and unique within it.
|
|
94
|
+
*/
|
|
95
|
+
readonly key: EID;
|
|
96
|
+
/** The source entity. A snapshot stays bound to the world it was captured in. */
|
|
97
|
+
readonly source: Entity;
|
|
98
|
+
/** `true` for an explicitly requested root, `false` for a traversed member. */
|
|
99
|
+
readonly root: boolean;
|
|
100
|
+
/** Captured plain-data components, in ascending component-id order. */
|
|
101
|
+
readonly components: readonly ComponentSnapshot[];
|
|
102
|
+
/** Captured relationships, in ascending component-id order. */
|
|
103
|
+
readonly relationships: readonly RelationshipSnapshot[];
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Detached, world-agnostic capture of one root or an atomic forest.
|
|
107
|
+
*
|
|
108
|
+
* Produced by {@link World.snapshotSubtree} before any mutation, consumed by
|
|
109
|
+
* {@link World.restoreSubtree} and {@link World.moveSubtree}. Holding a
|
|
110
|
+
* snapshot does not reserve anything and does not keep the source entities
|
|
111
|
+
* alive — restore always allocates fresh destination ids.
|
|
112
|
+
*/
|
|
113
|
+
export interface EntitySubtreeSnapshot {
|
|
114
|
+
/** Captured records in depth-first order, roots first. */
|
|
115
|
+
readonly entities: readonly SubtreeEntitySnapshot[];
|
|
116
|
+
/** Snapshot keys of the requested roots, in the order they were given. */
|
|
117
|
+
readonly roots: readonly EID[];
|
|
118
|
+
/** The relationship traversed during capture. */
|
|
119
|
+
readonly traversal: RelationshipType;
|
|
120
|
+
}
|
|
121
|
+
/** What {@link World.restoreSubtree} and {@link World.moveSubtree} return. */
|
|
122
|
+
export interface RestoreSubtreeResult {
|
|
123
|
+
/** Snapshot key to the destination entity created for that record. */
|
|
124
|
+
readonly entities: ReadonlyMap<EID, Entity>;
|
|
125
|
+
/** Source entity to the destination entity that replaced it. */
|
|
126
|
+
readonly sourceToDestination: ReadonlyMap<Entity, Entity>;
|
|
127
|
+
/** The destination entities for the requested roots, in order. */
|
|
128
|
+
readonly roots: readonly Entity[];
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* What {@link World.moveSubtree} returns. Identical to
|
|
132
|
+
* {@link RestoreSubtreeResult}; named separately because the source entities no
|
|
133
|
+
* longer exist when it resolves.
|
|
134
|
+
*/
|
|
135
|
+
export type MoveSubtreeResult = RestoreSubtreeResult;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
// Public data shapes for cross-world subtree snapshots. The capture, preflight,
|
|
2
|
+
// and restore implementations live in `capture.ts`, `preflight.ts`, and
|
|
3
|
+
// `restore.ts`; `materialize.ts` holds the one component materializer that both
|
|
4
|
+
// ordinary `set` and restore go through.
|
|
5
|
+
/**
|
|
6
|
+
* @internal Capture a relationship instance's own fields, minus target storage.
|
|
7
|
+
*
|
|
8
|
+
* Ownership and cleanup decisions live in the snapshot, not in the transfer.
|
|
9
|
+
* Destroying a source root can cascade through a `CleanupPolicy.Delete` edge to
|
|
10
|
+
* an entity the caller did not select, and that is the correct reading of "the
|
|
11
|
+
* source is gone" rather than a leak — which is why the reverse direction holds
|
|
12
|
+
* too: an edge pointing *into* the subtree from outside is never carried across,
|
|
13
|
+
* by a successful move or by a rollback. Inbound state belongs to whatever world
|
|
14
|
+
* the outside entity still lives in.
|
|
15
|
+
*/
|
|
16
|
+
export function _relationshipData(instance) {
|
|
17
|
+
const data = {};
|
|
18
|
+
for (const key of Object.keys(instance)) {
|
|
19
|
+
if (key === "target" || key === "targets" || key === "_targets") {
|
|
20
|
+
continue;
|
|
21
|
+
}
|
|
22
|
+
data[key] = instance[key];
|
|
23
|
+
}
|
|
24
|
+
return data;
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/snapshot/types.ts"],"names":[],"mappings":"AAAA,gFAAgF;AAChF,wEAAwE;AACxE,gFAAgF;AAChF,yCAAyC;AAgKzC;;;;;;;;;;GAUG;AACH,MAAM,UAAU,iBAAiB,CAAC,QAAsB;IACtD,MAAM,IAAI,GAA4B,EAAE,CAAC;IACzC,KAAK,MAAM,GAAG,IAAI,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC;QACxC,IAAI,GAAG,KAAK,QAAQ,IAAI,GAAG,KAAK,SAAS,IAAI,GAAG,KAAK,UAAU,EAAE,CAAC;YAChE,SAAS;QACX,CAAC;QACD,IAAI,CAAC,GAAG,CAAC,GAAI,QAA+C,CAAC,GAAG,CAAC,CAAC;IACpE,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC"}
|
package/dist/system.d.ts
CHANGED
|
@@ -27,7 +27,9 @@ type RunCallback = (now: number, delta: number) => void;
|
|
|
27
27
|
* Internally each system holds a single ordered **inbox** of routed events
|
|
28
28
|
* (`enter`, `exit`, `update`). The world appends to it during command-queue
|
|
29
29
|
* routing; the system replays the inbox at the top of every `_run` so
|
|
30
|
-
* callbacks observe events in arrival order.
|
|
30
|
+
* callbacks observe events in arrival order. An `enter` only dispatches when
|
|
31
|
+
* the entity remains a member at drain time; its paired `exit` is suppressed
|
|
32
|
+
* when that `enter` was skipped.
|
|
31
33
|
*
|
|
32
34
|
* ### Component injection and type inference
|
|
33
35
|
*
|
package/dist/system.js
CHANGED
|
@@ -24,7 +24,9 @@ import { ALWAYS_TICK_SOURCE, IntervalTickSource, RateTickSource, } from "./timer
|
|
|
24
24
|
* Internally each system holds a single ordered **inbox** of routed events
|
|
25
25
|
* (`enter`, `exit`, `update`). The world appends to it during command-queue
|
|
26
26
|
* routing; the system replays the inbox at the top of every `_run` so
|
|
27
|
-
* callbacks observe events in arrival order.
|
|
27
|
+
* callbacks observe events in arrival order. An `enter` only dispatches when
|
|
28
|
+
* the entity remains a member at drain time; its paired `exit` is suppressed
|
|
29
|
+
* when that `enter` was skipped.
|
|
28
30
|
*
|
|
29
31
|
* ### Component injection and type inference
|
|
30
32
|
*
|
|
@@ -51,10 +53,15 @@ export class System extends Query {
|
|
|
51
53
|
* Reset alongside the inbox after each drain.
|
|
52
54
|
*/
|
|
53
55
|
this._exitedSinceDrain = false;
|
|
56
|
+
/** @internal Callback registered via {@link run}, fired every tick. */
|
|
57
|
+
this._runCallback = undefined;
|
|
58
|
+
/** @internal Callback registered via {@link each}, fired per tracked entity every tick. */
|
|
59
|
+
this._eachCallback = undefined;
|
|
54
60
|
/** @internal Whether this system processes events and runs callbacks. */
|
|
55
61
|
this._enabled = true;
|
|
56
62
|
/** @internal Cadence source for this system. Defaults to every frame. */
|
|
57
63
|
this._tickSource = ALWAYS_TICK_SOURCE;
|
|
64
|
+
this._queuesUpdates = true;
|
|
58
65
|
this.entity.attach(System, this);
|
|
59
66
|
this.phase(ON_UPDATE);
|
|
60
67
|
}
|
|
@@ -87,13 +94,7 @@ export class System extends Query {
|
|
|
87
94
|
return;
|
|
88
95
|
}
|
|
89
96
|
if (this._enterCallback !== undefined) {
|
|
90
|
-
|
|
91
|
-
// so the queued enter still resolves them if the entity is destroyed before
|
|
92
|
-
// the inbox drains — otherwise the injected read would crash on `undefined`.
|
|
93
|
-
let enterSnapshot;
|
|
94
|
-
if (this._enterSnapshotTypes && this._enterSnapshotTypes.length > 0) {
|
|
95
|
-
enterSnapshot = snapshotDirectInjects(e, this._enterSnapshotTypes);
|
|
96
|
-
}
|
|
97
|
+
const enterSnapshot = this._enterSnapshotter?.(e);
|
|
97
98
|
this._inbox.push({ kind: 0 /* InboxCommand.Enter */, entity: e, snapshot: enterSnapshot });
|
|
98
99
|
}
|
|
99
100
|
for (const ceid of this._onEnterUpdateEids) {
|
|
@@ -126,10 +127,7 @@ export class System extends Query {
|
|
|
126
127
|
// updates for staleness.
|
|
127
128
|
this._exitedSinceDrain = true;
|
|
128
129
|
if (this._exitCallback !== undefined) {
|
|
129
|
-
|
|
130
|
-
if (this._exitSnapshotTypes && this._exitSnapshotTypes.length > 0) {
|
|
131
|
-
exitSnapshot = snapshotDirectInjects(e, this._exitSnapshotTypes);
|
|
132
|
-
}
|
|
130
|
+
const exitSnapshot = this._exitSnapshotter?.(e);
|
|
133
131
|
this._inbox.push({ kind: 1 /* InboxCommand.Exit */, entity: e, snapshot: exitSnapshot });
|
|
134
132
|
}
|
|
135
133
|
}
|
|
@@ -190,13 +188,34 @@ export class System extends Query {
|
|
|
190
188
|
*/
|
|
191
189
|
_runDeferred(now, tickDelta) {
|
|
192
190
|
this.world.defer(() => {
|
|
191
|
+
let suppressedEnters;
|
|
193
192
|
for (let i = 0; i < this._inbox.length; i++) {
|
|
194
193
|
const event = this._inbox[i];
|
|
195
194
|
switch (event.kind) {
|
|
196
195
|
case 0 /* InboxCommand.Enter */:
|
|
196
|
+
// Stale-event guard: an Enter queued for an entity that has since
|
|
197
|
+
// left this system (destroyed, or lost a `.with` component) before
|
|
198
|
+
// this inbox drained must not dispatch. Enter callbacks commonly
|
|
199
|
+
// create related state, so dispatching one for a non-member leaves
|
|
200
|
+
// that state orphaned. A stale enter is only possible when something
|
|
201
|
+
// exited this window, so `_exitedSinceDrain` gates the O(1)
|
|
202
|
+
// membership probe and steady-state frames pay nothing. The probe is
|
|
203
|
+
// `belongs()` (the root term's own O(1) membership), not
|
|
204
|
+
// `_isMemberOf()`: enter/exit-only systems are not in the entity's
|
|
205
|
+
// `_queries` set, and widening that set would tax every enter/exit
|
|
206
|
+
// and every component-update routing pass. A re-entered
|
|
207
|
+
// ("came back") entity is a member again here, so its enter still
|
|
208
|
+
// fires. Suppress its paired exit because the enter never ran.
|
|
209
|
+
if (this._exitedSinceDrain && !this.belongs(event.entity)) {
|
|
210
|
+
(suppressedEnters ?? (suppressedEnters = new Set())).add(event.entity);
|
|
211
|
+
break;
|
|
212
|
+
}
|
|
197
213
|
this._enterCallback(event.entity, event.snapshot);
|
|
198
214
|
break;
|
|
199
215
|
case 1 /* InboxCommand.Exit */:
|
|
216
|
+
if (suppressedEnters?.delete(event.entity)) {
|
|
217
|
+
break;
|
|
218
|
+
}
|
|
200
219
|
this._exitCallback(event.entity, event.snapshot);
|
|
201
220
|
break;
|
|
202
221
|
case 2 /* InboxCommand.Update */:
|
|
@@ -211,7 +230,7 @@ export class System extends Query {
|
|
|
211
230
|
// re-entered ("came back") entity is a member again here, so its
|
|
212
231
|
// update still fires. Exit events fire regardless — they carry
|
|
213
232
|
// their own snapshot.
|
|
214
|
-
if (this._exitedSinceDrain && !event.entity
|
|
233
|
+
if (this._exitedSinceDrain && !this.belongs(event.entity)) {
|
|
215
234
|
break;
|
|
216
235
|
}
|
|
217
236
|
const callback = this._componentUpdateCallbacks.get(event.eid);
|
|
@@ -252,7 +271,7 @@ export class System extends Query {
|
|
|
252
271
|
phase(phase) {
|
|
253
272
|
this._assertConfigurable();
|
|
254
273
|
const target = (typeof phase === "string" ? this.world.entity(phase) : phase).add(Phase);
|
|
255
|
-
this.entity.
|
|
274
|
+
this.entity.add(DependsOn, target);
|
|
256
275
|
return this;
|
|
257
276
|
}
|
|
258
277
|
/**
|
|
@@ -417,13 +436,4 @@ export class System extends Query {
|
|
|
417
436
|
super.destroy();
|
|
418
437
|
}
|
|
419
438
|
}
|
|
420
|
-
function snapshotDirectInjects(e, snapshotTypes) {
|
|
421
|
-
const snapshot = new Array(snapshotTypes.length);
|
|
422
|
-
snapshotTypes.forEach((ceid, index) => {
|
|
423
|
-
if (ceid !== undefined) {
|
|
424
|
-
snapshot[index] = e._get(ceid);
|
|
425
|
-
}
|
|
426
|
-
});
|
|
427
|
-
return snapshot;
|
|
428
|
-
}
|
|
429
439
|
//# sourceMappingURL=system.js.map
|
package/dist/system.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"system.js","sourceRoot":"","sources":["../src/system.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,mBAAmB,EACnB,8BAA8B,
|
|
1
|
+
{"version":3,"file":"system.js","sourceRoot":"","sources":["../src/system.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,mBAAmB,EACnB,8BAA8B,GAM/B,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,0BAA0B,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAMrE,OAAO,EACL,gBAAgB,GAIjB,MAAM,UAAU,CAAC;AAElB,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AACvD,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAEnD,OAAO,EACL,kBAAkB,EAClB,kBAAkB,EAElB,cAAc,GACf,MAAM,YAAY,CAAC;AAoCpB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,MAAM,OAAO,MAAuC,SAAQ,KAAQ;IAoBlE,YAAY,IAA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O;QACZ,IAAI,CAAC,QAAQ,GAAG,KAAK,CAAC;QACtB,IAAI,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC;QACvB,IAAI,CAAC,iBAAiB,GAAG,KAAK,CAAC;QAC/B,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;;;;;;;;;;OAWG;IACI,MAAM;QACX,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC;QACrB,OAAO,IAAI,CAAC;IACd,CAAC;IAED,qDAAqD;IACrC,OAAO;QACrB,IAAI,CAAC,OAAO,EAAE,CAAC;QACf,KAAK,CAAC,OAAO,EAAE,CAAC;IAClB,CAAC;CACF"}
|
package/dist/terms/all_term.js
CHANGED
|
@@ -32,5 +32,24 @@ export class AllTerm extends Term {
|
|
|
32
32
|
_matches(entity) {
|
|
33
33
|
return this._children.every((child) => child.has(entity));
|
|
34
34
|
}
|
|
35
|
+
/**
|
|
36
|
+
* @internal React to a child's data refresh.
|
|
37
|
+
*
|
|
38
|
+
* Membership here is a function of the children's membership alone, and every
|
|
39
|
+
* child membership change reaches this term through `onTermEvent`. With no
|
|
40
|
+
* membership event in flight the term already agrees with its children, so
|
|
41
|
+
* re-evaluating would be a no-op and is skipped. A refresh that arrives while
|
|
42
|
+
* an event is still being delivered (user code mutating inline from a query
|
|
43
|
+
* callback) is re-evaluated as before.
|
|
44
|
+
*/
|
|
45
|
+
_onChildRefresh(entity, _child) {
|
|
46
|
+
if (this.world._termEmitDepth !== 0) {
|
|
47
|
+
this.onTermRefresh(entity);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
/** @internal See {@link _onChildRefresh}. */
|
|
51
|
+
_childRefreshesOnlyInFlight() {
|
|
52
|
+
return true;
|
|
53
|
+
}
|
|
35
54
|
}
|
|
36
55
|
//# sourceMappingURL=all_term.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"all_term.js","sourceRoot":"","sources":["../../src/terms/all_term.ts"],"names":[],"mappings":"AAGA,OAA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,IAAI,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC;QAC5B,IAAI,CAAC,oBAAoB,EAAE,CAAC;IAC9B,CAAC;IAED;;;;;;;;;;;;OAYG;IACI,MAAM,CAAC,KAAK,CACjB,KAAY,EACZ,KAA0B,EAC1B,GAAW,EACX,WAAqB,EACrB,OAAyB,EACzB,QAA2B,EAC3B,SAA+B;QAE/B,OAAO,kBAAkB,CACvB,OAAO,EACP,KAAK,EACL,KAAK,EACL,GAAG,EACH,WAAW,EACX,OAAO,EACP,QAAQ,EACR,SAAS,CACV,CAAC;IACJ,CAAC;IAED,gBAAgB;IACN,QAAQ,CAAC,MAAc;QAC/B,OAAO,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC;IAC5D,CAAC;IAED;;;;;;;;;OASG;IACgB,eAAe,CAAC,MAAc,EAAE,MAAY;QAC7D,IAAI,IAAI,CAAC,KAAK,CAAC,cAAc,KAAK,CAAC,EAAE,CAAC;YACpC,IAAI,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC;QAC7B,CAAC;IACH,CAAC;IAED,6CAA6C;IAC1B,2BAA2B;QAC5C,OAAO,IAAI,CAAC;IACd,CAAC;CACF"}
|
package/dist/terms/any_term.js
CHANGED
|
@@ -33,5 +33,24 @@ export class AnyTerm extends Term {
|
|
|
33
33
|
_matches(entity) {
|
|
34
34
|
return this._children.some((child) => child.has(entity));
|
|
35
35
|
}
|
|
36
|
+
/**
|
|
37
|
+
* @internal React to a child's data refresh.
|
|
38
|
+
*
|
|
39
|
+
* Membership here is a function of the children's membership alone, and every
|
|
40
|
+
* child membership change reaches this term through `onTermEvent`. With no
|
|
41
|
+
* membership event in flight the term already agrees with its children, so
|
|
42
|
+
* re-evaluating would be a no-op and is skipped. A refresh that arrives while
|
|
43
|
+
* an event is still being delivered (user code mutating inline from a query
|
|
44
|
+
* callback) is re-evaluated as before.
|
|
45
|
+
*/
|
|
46
|
+
_onChildRefresh(entity, _child) {
|
|
47
|
+
if (this.world._termEmitDepth !== 0) {
|
|
48
|
+
this.onTermRefresh(entity);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
/** @internal See {@link _onChildRefresh}. */
|
|
52
|
+
_childRefreshesOnlyInFlight() {
|
|
53
|
+
return true;
|
|
54
|
+
}
|
|
36
55
|
}
|
|
37
56
|
//# sourceMappingURL=any_term.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"any_term.js","sourceRoot":"","sources":["../../src/terms/any_term.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,kBAAkB,EAA0B,MAAM,sBAAsB,CAAC;AAGlF;;;;;;GAMG;AACH,MAAM,OAAO,OAAQ,SAAQ,IAAI;IAC/B,YACE,KAAY,EACZ,GAAW,EACX,QAAyB,EACzB,SAA+B;QAE/B,KAAK,CAAC,KAAK,EAAE,GAAG,EAAE,KAAK,EAAE,KAAK,EAAE,SAAS,CAAC,CAAC;QAC3C,IAAI,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC;QAC5B,IAAI,CAAC,oBAAoB,EAAE,CAAC;IAC9B,CAAC;IAED;;;;;;;;;;;;OAYG;IACI,MAAM,CAAC,KAAK,CACjB,KAAY,EACZ,KAA0B,EAC1B,GAAW,EACX,WAAqB,EACrB,OAAyB,EACzB,QAA2B,EAC3B,SAA+B;QAE/B,OAAO,kBAAkB,CACvB,OAAO,EACP,KAAK,EACL,KAAK,EACL,GAAG,EACH,WAAW,EACX,OAAO,EACP,QAAQ,EACR,SAAS,CACV,CAAC;IACJ,CAAC;IAED,gBAAgB;IACN,QAAQ,CAAC,MAAc;QAC/B,OAAO,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC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ist/terms/not_term.js
CHANGED
|
@@ -39,6 +39,10 @@ export class NotTerm extends Term {
|
|
|
39
39
|
// Shape/data refreshes do not affect a pure negation unless the child emits
|
|
40
40
|
// a real membership event, or the world emits a lifecycle event.
|
|
41
41
|
}
|
|
42
|
+
/** @internal A negation ignores child refreshes altogether; see {@link onTermRefresh}. */
|
|
43
|
+
_childRefreshesOnlyInFlight() {
|
|
44
|
+
return true;
|
|
45
|
+
}
|
|
42
46
|
/** @internal */
|
|
43
47
|
_matches(entity) {
|
|
44
48
|
return this._children[0].has(entity) && !this._children[1].has(entity);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"not_term.js","sourceRoot":"","sources":["../../src/terms/not_term.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAIjC;;;;;;GAMG;AACH,MAAM,OAAO,OAAQ,SAAQ,IAAI;IAC/B,YACE,KAAY,EACZ,GAAW,EACX,SAAe,EACf,KAAW,EACX,SAA+B;QAE/B,KAAK,CAAC,KAAK,EAAE,GAAG,EAAE,KAAK,EAAE,KAAK,EAAE,SAAS,CAAC,CAAC;QAC3C,IAAI,CAAC,YAAY,CAAC,CAAC,SAAS,EAAE,KAAK,CAAC,CAAC,CAAC;QACtC,IAAI,CAAC,oBAAoB,EAAE,CAAC;IAC9B,CAAC;IAED;;;;;;;;OAQG;IACI,MAAM,CAAC,KAAK,CACjB,KAAY,EACZ,QAAkB,EAClB,GAAW,EACX,OAAyB,EACzB,SAA+B;QAE/B,MAAM,SAAS,GAAG,OAAO,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;QACvC,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;QACvC,OAAO,IAAI,OAAO,CAAC,KAAK,EAAE,GAAG,EAAE,SAAS,EAAE,KAAK,EAAE,SAAS,CAAC,CAAC;IAC9D,CAAC;IAED;;;;;;;;OAQG;IACa,aAAa,CAAC,OAAe;Q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ACN,QAAQ,CAAC,MAAc;QAC/B,OAAO,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;IACzE,CAAC;CACF"}
|
|
@@ -8,8 +8,7 @@ import type { getTerm as GetTermFn } from "./build.js";
|
|
|
8
8
|
* given inner predicate.
|
|
9
9
|
*
|
|
10
10
|
* An entity `e` matches when it carries the relationship component
|
|
11
|
-
* `_relationshipEid` **and**
|
|
12
|
-
* satisfies `_innerTerm`.
|
|
11
|
+
* `_relationshipEid` **and** at least one target entity satisfies `_innerTerm`.
|
|
13
12
|
*
|
|
14
13
|
* Children: `[relationshipTerm, innerTerm]`.
|
|
15
14
|
* - `children[0]` (`relationshipTerm`): the `ComponentTerm` for the
|
|
@@ -4,8 +4,7 @@ import { Term } from "./term.js";
|
|
|
4
4
|
* given inner predicate.
|
|
5
5
|
*
|
|
6
6
|
* An entity `e` matches when it carries the relationship component
|
|
7
|
-
* `_relationshipEid` **and**
|
|
8
|
-
* satisfies `_innerTerm`.
|
|
7
|
+
* `_relationshipEid` **and** at least one target entity satisfies `_innerTerm`.
|
|
9
8
|
*
|
|
10
9
|
* Children: `[relationshipTerm, innerTerm]`.
|
|
11
10
|
* - `children[0]` (`relationshipTerm`): the `ComponentTerm` for the
|
|
@@ -74,8 +73,7 @@ export class TargetTerm extends Term {
|
|
|
74
73
|
if (entity.destroyed) {
|
|
75
74
|
return false;
|
|
76
75
|
}
|
|
77
|
-
|
|
78
|
-
return target !== undefined && this._innerTerm.has(target);
|
|
76
|
+
return entity._someTargetByEid(this._relationshipEid, (target) => this._innerTerm.has(target));
|
|
79
77
|
}
|
|
80
78
|
}
|
|
81
79
|
//# sourceMappingURL=target_term.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"target_term.js","sourceRoot":"","sources":["../../src/terms/target_term.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;;;;;OAQG;IACK,OAAO,CAAC,MAAc,EAAE,KAAW;QACzC,IAAI,KAAK,KAAK,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC;YAChC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;YACnB,OAAO;QACT,CAAC;QACD,MAAM,CAAC,cAAc,CAAC,IAAI,CAAC,gBAAgB,CAAC,EAAE,OAAO,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC;IACxF,CAAC;IAED,gBAAgB;IACN,QAAQ,CAAC,MAAc;QAC/B,IAAI,MAAM,CAAC,SAAS,EAAE,CAAC;YACrB,OAAO,KAAK,CAAC;QACf,CAAC;QACD,OAAO,MAAM,CAAC,gBAAgB,CAAC,IAAI,CAAC,gBAAgB,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC;IACjG,CAAC;CACF"}
|
package/dist/terms/term.d.ts
CHANGED
|
@@ -50,6 +50,8 @@ export declare abstract class Term implements TermConsumer {
|
|
|
50
50
|
private readonly _onDestroy;
|
|
51
51
|
private _destroyed;
|
|
52
52
|
private readonly _childUnsubscribes;
|
|
53
|
+
/** Consumers that may act on a refresh while no membership event is in flight. */
|
|
54
|
+
private _quiescentRefreshConsumers;
|
|
53
55
|
protected constructor(world: World, key: string, kind: TermKind, _pinned: boolean, _onDestroy: (term: Term) => void);
|
|
54
56
|
get count(): number;
|
|
55
57
|
[Symbol.iterator](): IterableIterator<Entity>;
|