@zcomponent/core 2.0.0-alpha.2 → 2.0.0-alpha.4
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/lib/animation/layer.js +5 -0
- package/lib/animation/tracks/streamtrack.js +12 -1
- package/lib/behavior.d.ts +7 -1
- package/lib/behavior.js +6 -1
- package/lib/behaviors/ConsoleLog.d.ts +2 -0
- package/lib/behaviors/ConsoleLog.js +2 -0
- package/lib/behaviors/LaunchURL.d.ts +2 -0
- package/lib/behaviors/LaunchURL.js +2 -0
- package/lib/behaviors/LogAnalyticsEvent.d.ts +2 -0
- package/lib/behaviors/LogAnalyticsEvent.js +2 -0
- package/lib/behaviors/PlaySound.d.ts +3 -0
- package/lib/behaviors/PlaySound.js +7 -1
- package/lib/behaviors/ShowTextAlert.d.ts +1 -0
- package/lib/behaviors/ShowTextAlert.js +1 -0
- package/lib/behaviors/ToggleLayerClips.d.ts +1 -0
- package/lib/behaviors/ToggleLayerClips.js +9 -3
- package/lib/component.d.ts +7 -0
- package/lib/component.js +6 -0
- package/lib/components/AnimatedLoader.d.ts +6 -0
- package/lib/components/AnimatedLoader.js +6 -0
- package/lib/components/Audio.d.ts +28 -2
- package/lib/components/Audio.js +55 -8
- package/lib/components/DefaultCookieConsent.d.ts +11 -0
- package/lib/components/DefaultCookieConsent.js +33 -9
- package/lib/components/DefaultLoader.d.ts +3 -0
- package/lib/components/DefaultLoader.js +15 -8
- package/lib/components/Gamepad.d.ts +61 -0
- package/lib/components/Gamepad.js +61 -0
- package/lib/components/LongLoad.d.ts +3 -0
- package/lib/components/LongLoad.js +3 -0
- package/lib/components/SnapshotUI.d.ts +14 -0
- package/lib/components/SnapshotUI.js +27 -9
- package/lib/context.d.ts +11 -1
- package/lib/context.js +9 -1
- package/lib/contexts/analyticscontext.d.ts +3 -0
- package/lib/contexts/analyticscontext.js +14 -2
- package/lib/contexts/audiocontextcontext.d.ts +12 -0
- package/lib/contexts/audiocontextcontext.js +131 -56
- package/lib/contexts/canvascontext.d.ts +25 -0
- package/lib/contexts/canvascontext.js +75 -15
- package/lib/contexts/cookieconsentcontext.d.ts +19 -0
- package/lib/contexts/cookieconsentcontext.js +135 -27
- package/lib/contexts/environmentcontext.d.ts +13 -5
- package/lib/contexts/environmentcontext.js +26 -14
- package/lib/contexts/gamepadcontext.d.ts +17 -0
- package/lib/contexts/gamepadcontext.js +160 -74
- package/lib/contexts/gesturecontext.d.ts +11 -0
- package/lib/contexts/gesturecontext.js +266 -169
- package/lib/contexts/globaltagcontext.d.ts +2 -0
- package/lib/contexts/globaltagcontext.js +69 -10
- package/lib/contexts/loadcontext.d.ts +19 -0
- package/lib/contexts/loadcontext.js +68 -18
- package/lib/contexts/orientationcontext.d.ts +13 -0
- package/lib/contexts/orientationcontext.js +60 -11
- package/lib/contexts/snapshotContext.d.ts +10 -0
- package/lib/contexts/snapshotContext.js +55 -9
- package/lib/contexts/tagcontext.d.ts +14 -0
- package/lib/contexts/tagcontext.js +186 -98
- package/lib/entity.d.ts +5 -1
- package/lib/entity.js +4 -1
- package/lib/zcomponent.d.ts +20 -0
- package/lib/zcomponent.js +81 -12
- package/package.json +84 -84
package/lib/zcomponent.d.ts
CHANGED
|
@@ -40,34 +40,41 @@ export declare class ZComponent<RootType = any> extends Component<RootType> {
|
|
|
40
40
|
private _opts;
|
|
41
41
|
/**
|
|
42
42
|
* The id of the component.
|
|
43
|
+
* @zignore
|
|
43
44
|
*/
|
|
44
45
|
readonly id: string;
|
|
45
46
|
/**
|
|
46
47
|
* A map of elements to node IDs.
|
|
48
|
+
* @zignore
|
|
47
49
|
*/
|
|
48
50
|
readonly idByElement: Map<any, string>;
|
|
49
51
|
/**
|
|
50
52
|
* Object that maps node script names to scripts.
|
|
51
53
|
* @default {}
|
|
54
|
+
* @zignore
|
|
52
55
|
*/
|
|
53
56
|
readonly nodes: {
|
|
54
57
|
[id: string]: Component | Component[];
|
|
55
58
|
};
|
|
56
59
|
/**
|
|
57
60
|
* Map of entites by ID.
|
|
61
|
+
* @zignore
|
|
58
62
|
*/
|
|
59
63
|
readonly entityByID: Map<string, Entity>;
|
|
60
64
|
/**
|
|
61
65
|
* A map of entity labels to components.
|
|
66
|
+
* @zignore
|
|
62
67
|
*/
|
|
63
68
|
readonly entityByLabel: Map<string, Entity>;
|
|
64
69
|
/**
|
|
65
70
|
* A map of node labels to components.
|
|
71
|
+
* @zignore
|
|
66
72
|
*/
|
|
67
73
|
readonly nodeByLabel: Map<string, Component<any, ConstructorProps>>;
|
|
68
74
|
private _constructedResolve;
|
|
69
75
|
/**
|
|
70
76
|
* A promise that is resolved once construction of this component is complete.
|
|
77
|
+
* @zignore
|
|
71
78
|
*/
|
|
72
79
|
constructed: Promise<void>;
|
|
73
80
|
/**
|
|
@@ -76,6 +83,7 @@ export declare class ZComponent<RootType = any> extends Component<RootType> {
|
|
|
76
83
|
private _isConstructed;
|
|
77
84
|
/**
|
|
78
85
|
* A boolean indicating if construction of this component is complete.
|
|
86
|
+
* @zignore
|
|
79
87
|
*/
|
|
80
88
|
get isConstructed(): boolean;
|
|
81
89
|
/**
|
|
@@ -86,6 +94,7 @@ export declare class ZComponent<RootType = any> extends Component<RootType> {
|
|
|
86
94
|
/**
|
|
87
95
|
* @zstreams layerclipids
|
|
88
96
|
* @default {}
|
|
97
|
+
* @zignore
|
|
89
98
|
*/
|
|
90
99
|
readonly streams: {
|
|
91
100
|
[id: string]: Stream;
|
|
@@ -113,11 +122,13 @@ export declare class ZComponent<RootType = any> extends Component<RootType> {
|
|
|
113
122
|
* The node ID is used to identify a node in the graph.
|
|
114
123
|
* If a component constructor is passed as `type`, this function will ensure that the node that's returned
|
|
115
124
|
* is an instance of that component, or return undefined if it is not.
|
|
125
|
+
* @zignore
|
|
116
126
|
*/
|
|
117
127
|
resolveNodeID<T extends Component = Component>(id: string, type?: ConstructorForComponent<T>): T | undefined;
|
|
118
128
|
/**
|
|
119
129
|
* This function returns the behavior with the given ID. If the behavior is not found, it will return undefined.
|
|
120
130
|
* This function is used to get a behavior from a behavior ID, which is a string representation of a behavior.
|
|
131
|
+
* @zignore
|
|
121
132
|
*/
|
|
122
133
|
resolveBehaviorID<T extends Behavior = Behavior>(id: string, type?: ConstructorForBehavior<T>): T | undefined;
|
|
123
134
|
/**
|
|
@@ -126,6 +137,7 @@ export declare class ZComponent<RootType = any> extends Component<RootType> {
|
|
|
126
137
|
* @param id - The ID of the entity to resolve.
|
|
127
138
|
* @returns The resolved entity as an instance of T (which extends Entity), or undefined if the entity could not be resolved.
|
|
128
139
|
* @template T The entity type.
|
|
140
|
+
* @zignore
|
|
129
141
|
*/
|
|
130
142
|
resolveEntityID<T extends Entity = Entity>(id: string): T | undefined;
|
|
131
143
|
private _inflateBehaviors;
|
|
@@ -135,12 +147,14 @@ export declare class ZComponent<RootType = any> extends Component<RootType> {
|
|
|
135
147
|
* Notifies the component that the properties of certain entities have changed.
|
|
136
148
|
*
|
|
137
149
|
* @param entries - A map where the keys are entity IDs and the values are sets of property names.
|
|
150
|
+
* @zignore
|
|
138
151
|
*/
|
|
139
152
|
notifyPropsChanged(entries: Map<string, Set<string>>): void;
|
|
140
153
|
/**
|
|
141
154
|
* The animation editor will call this function when the user changes
|
|
142
155
|
* the list of clips in the animation. We need to update the clip
|
|
143
156
|
* data for each clip that was changed.
|
|
157
|
+
* @zignore
|
|
144
158
|
*/
|
|
145
159
|
notifyClipsChanged(clips: Set<string>): void;
|
|
146
160
|
private _initializeOverrides;
|
|
@@ -150,6 +164,7 @@ export declare class ZComponent<RootType = any> extends Component<RootType> {
|
|
|
150
164
|
private _setEntityPropPath;
|
|
151
165
|
/**
|
|
152
166
|
* Returns the node with the specified ID.
|
|
167
|
+
* @zignore
|
|
153
168
|
*/
|
|
154
169
|
_getNodeById(id: string): Component | undefined;
|
|
155
170
|
/**
|
|
@@ -158,6 +173,7 @@ export declare class ZComponent<RootType = any> extends Component<RootType> {
|
|
|
158
173
|
* period, followed by the name of the stream. This function splits the string into
|
|
159
174
|
* parts, and then uses the parts to traverse the entity tree until it finds the
|
|
160
175
|
* named stream.
|
|
176
|
+
* @zignore
|
|
161
177
|
*/
|
|
162
178
|
resolveStreamID(id: string): Stream | undefined;
|
|
163
179
|
/**
|
|
@@ -177,10 +193,14 @@ export declare class ZComponent<RootType = any> extends Component<RootType> {
|
|
|
177
193
|
*
|
|
178
194
|
* @param callback A function that will be called for each component in the traversal. The current component is passed as a parameter to the callback.
|
|
179
195
|
* @param breadthFirst If traversal should be breadth-first. Defaults to `false` (depth-first).
|
|
196
|
+
* @zignore
|
|
180
197
|
*/
|
|
181
198
|
traverse(callback: (comp: Component<any>) => void, breadthFirst?: boolean): void;
|
|
182
199
|
private _traverseBFS;
|
|
183
200
|
private _traverseDFS;
|
|
184
201
|
private _constructTopLevelComponents;
|
|
202
|
+
/**
|
|
203
|
+
* @zignore
|
|
204
|
+
*/
|
|
185
205
|
dispose(): never;
|
|
186
206
|
}
|
package/lib/zcomponent.js
CHANGED
|
@@ -68,77 +68,134 @@ export class ZComponentContext extends Context {
|
|
|
68
68
|
let ZComponent = (() => {
|
|
69
69
|
let _classSuper = Component;
|
|
70
70
|
let _instanceExtraInitializers = [];
|
|
71
|
+
let _id_decorators;
|
|
72
|
+
let _id_initializers = [];
|
|
73
|
+
let _id_extraInitializers = [];
|
|
74
|
+
let _idByElement_decorators;
|
|
75
|
+
let _idByElement_initializers = [];
|
|
76
|
+
let _idByElement_extraInitializers = [];
|
|
77
|
+
let _nodes_decorators;
|
|
78
|
+
let _nodes_initializers = [];
|
|
79
|
+
let _nodes_extraInitializers = [];
|
|
80
|
+
let _entityByID_decorators;
|
|
81
|
+
let _entityByID_initializers = [];
|
|
82
|
+
let _entityByID_extraInitializers = [];
|
|
83
|
+
let _entityByLabel_decorators;
|
|
84
|
+
let _entityByLabel_initializers = [];
|
|
85
|
+
let _entityByLabel_extraInitializers = [];
|
|
86
|
+
let _nodeByLabel_decorators;
|
|
87
|
+
let _nodeByLabel_initializers = [];
|
|
88
|
+
let _nodeByLabel_extraInitializers = [];
|
|
89
|
+
let _constructed_decorators;
|
|
90
|
+
let _constructed_initializers = [];
|
|
91
|
+
let _constructed_extraInitializers = [];
|
|
92
|
+
let _get_isConstructed_decorators;
|
|
71
93
|
let _animation_decorators;
|
|
72
94
|
let _animation_initializers = [];
|
|
73
95
|
let _animation_extraInitializers = [];
|
|
96
|
+
let _streams_decorators;
|
|
97
|
+
let _streams_initializers = [];
|
|
98
|
+
let _streams_extraInitializers = [];
|
|
74
99
|
let _resolveNodeID_decorators;
|
|
75
100
|
let _resolveBehaviorID_decorators;
|
|
76
101
|
let _resolveEntityID_decorators;
|
|
77
102
|
let _notifyPropsChanged_decorators;
|
|
78
103
|
let _notifyClipsChanged_decorators;
|
|
104
|
+
let __getNodeById_decorators;
|
|
79
105
|
let _resolveStreamID_decorators;
|
|
80
106
|
let _traverse_decorators;
|
|
107
|
+
let _dispose_decorators;
|
|
81
108
|
return class ZComponent extends _classSuper {
|
|
82
109
|
static {
|
|
83
110
|
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
111
|
+
_id_decorators = [zIgnore()];
|
|
112
|
+
_idByElement_decorators = [zIgnore()];
|
|
113
|
+
_nodes_decorators = [zIgnore()];
|
|
114
|
+
_entityByID_decorators = [zIgnore()];
|
|
115
|
+
_entityByLabel_decorators = [zIgnore()];
|
|
116
|
+
_nodeByLabel_decorators = [zIgnore()];
|
|
117
|
+
_constructed_decorators = [zIgnore()];
|
|
118
|
+
_get_isConstructed_decorators = [zIgnore()];
|
|
84
119
|
_animation_decorators = [zIgnore()];
|
|
120
|
+
_streams_decorators = [zIgnore()];
|
|
85
121
|
_resolveNodeID_decorators = [zIgnore()];
|
|
86
122
|
_resolveBehaviorID_decorators = [zIgnore()];
|
|
87
123
|
_resolveEntityID_decorators = [zIgnore()];
|
|
88
124
|
_notifyPropsChanged_decorators = [zIgnore()];
|
|
89
125
|
_notifyClipsChanged_decorators = [zIgnore()];
|
|
126
|
+
__getNodeById_decorators = [zIgnore()];
|
|
90
127
|
_resolveStreamID_decorators = [zIgnore()];
|
|
91
128
|
_traverse_decorators = [zIgnore()];
|
|
129
|
+
_dispose_decorators = [zIgnore()];
|
|
130
|
+
__esDecorate(this, null, _get_isConstructed_decorators, { kind: "getter", name: "isConstructed", static: false, private: false, access: { has: obj => "isConstructed" in obj, get: obj => obj.isConstructed }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
92
131
|
__esDecorate(this, null, _resolveNodeID_decorators, { kind: "method", name: "resolveNodeID", static: false, private: false, access: { has: obj => "resolveNodeID" in obj, get: obj => obj.resolveNodeID }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
93
132
|
__esDecorate(this, null, _resolveBehaviorID_decorators, { kind: "method", name: "resolveBehaviorID", static: false, private: false, access: { has: obj => "resolveBehaviorID" in obj, get: obj => obj.resolveBehaviorID }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
94
133
|
__esDecorate(this, null, _resolveEntityID_decorators, { kind: "method", name: "resolveEntityID", static: false, private: false, access: { has: obj => "resolveEntityID" in obj, get: obj => obj.resolveEntityID }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
95
134
|
__esDecorate(this, null, _notifyPropsChanged_decorators, { kind: "method", name: "notifyPropsChanged", static: false, private: false, access: { has: obj => "notifyPropsChanged" in obj, get: obj => obj.notifyPropsChanged }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
96
135
|
__esDecorate(this, null, _notifyClipsChanged_decorators, { kind: "method", name: "notifyClipsChanged", static: false, private: false, access: { has: obj => "notifyClipsChanged" in obj, get: obj => obj.notifyClipsChanged }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
136
|
+
__esDecorate(this, null, __getNodeById_decorators, { kind: "method", name: "_getNodeById", static: false, private: false, access: { has: obj => "_getNodeById" in obj, get: obj => obj._getNodeById }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
97
137
|
__esDecorate(this, null, _resolveStreamID_decorators, { kind: "method", name: "resolveStreamID", static: false, private: false, access: { has: obj => "resolveStreamID" in obj, get: obj => obj.resolveStreamID }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
98
138
|
__esDecorate(this, null, _traverse_decorators, { kind: "method", name: "traverse", static: false, private: false, access: { has: obj => "traverse" in obj, get: obj => obj.traverse }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
139
|
+
__esDecorate(this, null, _dispose_decorators, { kind: "method", name: "dispose", static: false, private: false, access: { has: obj => "dispose" in obj, get: obj => obj.dispose }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
140
|
+
__esDecorate(null, null, _id_decorators, { kind: "field", name: "id", static: false, private: false, access: { has: obj => "id" in obj, get: obj => obj.id, set: (obj, value) => { obj.id = value; } }, metadata: _metadata }, _id_initializers, _id_extraInitializers);
|
|
141
|
+
__esDecorate(null, null, _idByElement_decorators, { kind: "field", name: "idByElement", static: false, private: false, access: { has: obj => "idByElement" in obj, get: obj => obj.idByElement, set: (obj, value) => { obj.idByElement = value; } }, metadata: _metadata }, _idByElement_initializers, _idByElement_extraInitializers);
|
|
142
|
+
__esDecorate(null, null, _nodes_decorators, { kind: "field", name: "nodes", static: false, private: false, access: { has: obj => "nodes" in obj, get: obj => obj.nodes, set: (obj, value) => { obj.nodes = value; } }, metadata: _metadata }, _nodes_initializers, _nodes_extraInitializers);
|
|
143
|
+
__esDecorate(null, null, _entityByID_decorators, { kind: "field", name: "entityByID", static: false, private: false, access: { has: obj => "entityByID" in obj, get: obj => obj.entityByID, set: (obj, value) => { obj.entityByID = value; } }, metadata: _metadata }, _entityByID_initializers, _entityByID_extraInitializers);
|
|
144
|
+
__esDecorate(null, null, _entityByLabel_decorators, { kind: "field", name: "entityByLabel", static: false, private: false, access: { has: obj => "entityByLabel" in obj, get: obj => obj.entityByLabel, set: (obj, value) => { obj.entityByLabel = value; } }, metadata: _metadata }, _entityByLabel_initializers, _entityByLabel_extraInitializers);
|
|
145
|
+
__esDecorate(null, null, _nodeByLabel_decorators, { kind: "field", name: "nodeByLabel", static: false, private: false, access: { has: obj => "nodeByLabel" in obj, get: obj => obj.nodeByLabel, set: (obj, value) => { obj.nodeByLabel = value; } }, metadata: _metadata }, _nodeByLabel_initializers, _nodeByLabel_extraInitializers);
|
|
146
|
+
__esDecorate(null, null, _constructed_decorators, { kind: "field", name: "constructed", static: false, private: false, access: { has: obj => "constructed" in obj, get: obj => obj.constructed, set: (obj, value) => { obj.constructed = value; } }, metadata: _metadata }, _constructed_initializers, _constructed_extraInitializers);
|
|
99
147
|
__esDecorate(null, null, _animation_decorators, { kind: "field", name: "animation", static: false, private: false, access: { has: obj => "animation" in obj, get: obj => obj.animation, set: (obj, value) => { obj.animation = value; } }, metadata: _metadata }, _animation_initializers, _animation_extraInitializers);
|
|
148
|
+
__esDecorate(null, null, _streams_decorators, { kind: "field", name: "streams", static: false, private: false, access: { has: obj => "streams" in obj, get: obj => obj.streams, set: (obj, value) => { obj.streams = value; } }, metadata: _metadata }, _streams_initializers, _streams_extraInitializers);
|
|
100
149
|
if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
101
150
|
}
|
|
102
151
|
constructorProps = __runInitializers(this, _instanceExtraInitializers);
|
|
103
152
|
_opts;
|
|
104
153
|
/**
|
|
105
154
|
* The id of the component.
|
|
155
|
+
* @zignore
|
|
106
156
|
*/
|
|
107
|
-
id;
|
|
157
|
+
id = __runInitializers(this, _id_initializers, void 0);
|
|
108
158
|
/**
|
|
109
159
|
* A map of elements to node IDs.
|
|
160
|
+
* @zignore
|
|
110
161
|
*/
|
|
111
|
-
idByElement = new Map();
|
|
162
|
+
idByElement = (__runInitializers(this, _id_extraInitializers), __runInitializers(this, _idByElement_initializers, new Map()));
|
|
112
163
|
/**
|
|
113
164
|
* Object that maps node script names to scripts.
|
|
114
165
|
* @default {}
|
|
166
|
+
* @zignore
|
|
115
167
|
*/
|
|
116
|
-
nodes = {};
|
|
168
|
+
nodes = (__runInitializers(this, _idByElement_extraInitializers), __runInitializers(this, _nodes_initializers, {}));
|
|
117
169
|
/**
|
|
118
170
|
* Map of entites by ID.
|
|
171
|
+
* @zignore
|
|
119
172
|
*/
|
|
120
|
-
entityByID = new Map();
|
|
173
|
+
entityByID = (__runInitializers(this, _nodes_extraInitializers), __runInitializers(this, _entityByID_initializers, new Map()));
|
|
121
174
|
/**
|
|
122
175
|
* A map of entity labels to components.
|
|
176
|
+
* @zignore
|
|
123
177
|
*/
|
|
124
|
-
entityByLabel = new Map();
|
|
178
|
+
entityByLabel = (__runInitializers(this, _entityByID_extraInitializers), __runInitializers(this, _entityByLabel_initializers, new Map()));
|
|
125
179
|
/**
|
|
126
180
|
* A map of node labels to components.
|
|
181
|
+
* @zignore
|
|
127
182
|
*/
|
|
128
|
-
nodeByLabel = new Map();
|
|
129
|
-
_constructedResolve;
|
|
183
|
+
nodeByLabel = (__runInitializers(this, _entityByLabel_extraInitializers), __runInitializers(this, _nodeByLabel_initializers, new Map()));
|
|
184
|
+
_constructedResolve = __runInitializers(this, _nodeByLabel_extraInitializers);
|
|
130
185
|
/**
|
|
131
186
|
* A promise that is resolved once construction of this component is complete.
|
|
187
|
+
* @zignore
|
|
132
188
|
*/
|
|
133
|
-
constructed = new Promise(resolve => {
|
|
189
|
+
constructed = __runInitializers(this, _constructed_initializers, new Promise(resolve => {
|
|
134
190
|
this._constructedResolve = resolve;
|
|
135
|
-
});
|
|
191
|
+
}));
|
|
136
192
|
/**
|
|
137
193
|
* @default false
|
|
138
194
|
*/
|
|
139
|
-
_isConstructed = false;
|
|
195
|
+
_isConstructed = (__runInitializers(this, _constructed_extraInitializers), false);
|
|
140
196
|
/**
|
|
141
197
|
* A boolean indicating if construction of this component is complete.
|
|
198
|
+
* @zignore
|
|
142
199
|
*/
|
|
143
200
|
get isConstructed() {
|
|
144
201
|
return this._isConstructed;
|
|
@@ -151,9 +208,10 @@ let ZComponent = (() => {
|
|
|
151
208
|
/**
|
|
152
209
|
* @zstreams layerclipids
|
|
153
210
|
* @default {}
|
|
211
|
+
* @zignore
|
|
154
212
|
*/
|
|
155
|
-
streams = (__runInitializers(this, _animation_extraInitializers), {});
|
|
156
|
-
_nodesById = new Map();
|
|
213
|
+
streams = (__runInitializers(this, _animation_extraInitializers), __runInitializers(this, _streams_initializers, {}));
|
|
214
|
+
_nodesById = (__runInitializers(this, _streams_extraInitializers), new Map());
|
|
157
215
|
/**
|
|
158
216
|
* @default []
|
|
159
217
|
*/
|
|
@@ -373,6 +431,7 @@ let ZComponent = (() => {
|
|
|
373
431
|
* The node ID is used to identify a node in the graph.
|
|
374
432
|
* If a component constructor is passed as `type`, this function will ensure that the node that's returned
|
|
375
433
|
* is an instance of that component, or return undefined if it is not.
|
|
434
|
+
* @zignore
|
|
376
435
|
*/
|
|
377
436
|
resolveNodeID(id, type) {
|
|
378
437
|
const entity = this.entityByID.get(id);
|
|
@@ -394,6 +453,7 @@ let ZComponent = (() => {
|
|
|
394
453
|
/**
|
|
395
454
|
* This function returns the behavior with the given ID. If the behavior is not found, it will return undefined.
|
|
396
455
|
* This function is used to get a behavior from a behavior ID, which is a string representation of a behavior.
|
|
456
|
+
* @zignore
|
|
397
457
|
*/
|
|
398
458
|
resolveBehaviorID(id, type) {
|
|
399
459
|
const entity = this.entityByID.get(id);
|
|
@@ -418,6 +478,7 @@ let ZComponent = (() => {
|
|
|
418
478
|
* @param id - The ID of the entity to resolve.
|
|
419
479
|
* @returns The resolved entity as an instance of T (which extends Entity), or undefined if the entity could not be resolved.
|
|
420
480
|
* @template T The entity type.
|
|
481
|
+
* @zignore
|
|
421
482
|
*/
|
|
422
483
|
resolveEntityID(id) {
|
|
423
484
|
const entity = this.entityByID.get(id);
|
|
@@ -525,6 +586,7 @@ let ZComponent = (() => {
|
|
|
525
586
|
* Notifies the component that the properties of certain entities have changed.
|
|
526
587
|
*
|
|
527
588
|
* @param entries - A map where the keys are entity IDs and the values are sets of property names.
|
|
589
|
+
* @zignore
|
|
528
590
|
*/
|
|
529
591
|
notifyPropsChanged(entries) {
|
|
530
592
|
for (const [entityID, propSet] of entries.entries()) {
|
|
@@ -546,6 +608,7 @@ let ZComponent = (() => {
|
|
|
546
608
|
* The animation editor will call this function when the user changes
|
|
547
609
|
* the list of clips in the animation. We need to update the clip
|
|
548
610
|
* data for each clip that was changed.
|
|
611
|
+
* @zignore
|
|
549
612
|
*/
|
|
550
613
|
notifyClipsChanged(clips) {
|
|
551
614
|
for (const clipId of clips.values()) {
|
|
@@ -669,6 +732,7 @@ let ZComponent = (() => {
|
|
|
669
732
|
}
|
|
670
733
|
/**
|
|
671
734
|
* Returns the node with the specified ID.
|
|
735
|
+
* @zignore
|
|
672
736
|
*/
|
|
673
737
|
_getNodeById(id) {
|
|
674
738
|
return this._nodesById.get(id);
|
|
@@ -679,6 +743,7 @@ let ZComponent = (() => {
|
|
|
679
743
|
* period, followed by the name of the stream. This function splits the string into
|
|
680
744
|
* parts, and then uses the parts to traverse the entity tree until it finds the
|
|
681
745
|
* named stream.
|
|
746
|
+
* @zignore
|
|
682
747
|
*/
|
|
683
748
|
resolveStreamID(id) {
|
|
684
749
|
const parts = id.split('.');
|
|
@@ -709,6 +774,7 @@ let ZComponent = (() => {
|
|
|
709
774
|
*
|
|
710
775
|
* @param callback A function that will be called for each component in the traversal. The current component is passed as a parameter to the callback.
|
|
711
776
|
* @param breadthFirst If traversal should be breadth-first. Defaults to `false` (depth-first).
|
|
777
|
+
* @zignore
|
|
712
778
|
*/
|
|
713
779
|
traverse(callback, breadthFirst = false) {
|
|
714
780
|
if (breadthFirst) {
|
|
@@ -801,6 +867,9 @@ let ZComponent = (() => {
|
|
|
801
867
|
}
|
|
802
868
|
}
|
|
803
869
|
}
|
|
870
|
+
/**
|
|
871
|
+
* @zignore
|
|
872
|
+
*/
|
|
804
873
|
dispose() {
|
|
805
874
|
this.animation.dispose();
|
|
806
875
|
for (const [id, entity] of this.entityByID.entries()) {
|
package/package.json
CHANGED
|
@@ -1,86 +1,86 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
2
|
+
"name": "@zcomponent/core",
|
|
3
|
+
"version": "2.0.0-alpha.4",
|
|
4
|
+
"description": "The core component model and built-in functionality for Mattercraft.",
|
|
5
|
+
"author": "Zappar Limited",
|
|
6
|
+
"license": "Proprietary",
|
|
7
|
+
"main": "index.js",
|
|
8
|
+
"types": "index.d.ts",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"development": "./src/index.ts",
|
|
12
|
+
"types": "./index.d.ts",
|
|
13
|
+
"default": "./index.js"
|
|
14
|
+
},
|
|
15
|
+
"./*": {
|
|
16
|
+
"development": "./src/*.ts",
|
|
17
|
+
"types": "./lib/*.d.ts",
|
|
18
|
+
"default": "./lib/*.js"
|
|
19
|
+
},
|
|
20
|
+
"./lib/*": {
|
|
21
|
+
"development": "./src/*.ts",
|
|
22
|
+
"types": "./lib/*.d.ts",
|
|
23
|
+
"default": "./lib/*.js"
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
"type": "module",
|
|
27
|
+
"engines": {
|
|
28
|
+
"node": ">=12.0.0",
|
|
29
|
+
"browsers": "defaults"
|
|
30
|
+
},
|
|
31
|
+
"zexports": [
|
|
32
|
+
"./lib/components/**/*",
|
|
33
|
+
"./lib/behaviors/**/*",
|
|
34
|
+
"./lib/contexts/**/*"
|
|
35
|
+
],
|
|
36
|
+
"directories": {
|
|
37
|
+
"lib": "lib"
|
|
38
|
+
},
|
|
39
|
+
"files": [
|
|
40
|
+
"index.js",
|
|
41
|
+
"index.d.ts",
|
|
42
|
+
"lib/**/*",
|
|
43
|
+
"css/**/*",
|
|
44
|
+
"assets/**/*"
|
|
45
|
+
],
|
|
46
|
+
"scripts": {
|
|
47
|
+
"build": "rm -rf lib && tspc && tsc-alias",
|
|
48
|
+
"watch": "tsc -w",
|
|
49
|
+
"docs": "typedoc --out docs",
|
|
50
|
+
"test": "vitest run",
|
|
51
|
+
"build-animation-tests": "tsc -p ./tsconfig.test.animation.json",
|
|
52
|
+
"predocs": "npm run ctix",
|
|
53
|
+
"ctix": "ctix build"
|
|
54
|
+
},
|
|
55
|
+
"devDependencies": {
|
|
56
|
+
"ts-patch": "^3.3.0",
|
|
57
|
+
"vitest": "3.1.3"
|
|
58
|
+
},
|
|
59
|
+
"keywords": [],
|
|
60
|
+
"release": {
|
|
61
|
+
"extends": "semantic-release-commit-filter",
|
|
62
|
+
"ci": true,
|
|
63
|
+
"branches": [
|
|
64
|
+
"main",
|
|
65
|
+
{
|
|
66
|
+
"name": "beta",
|
|
67
|
+
"channel": "beta",
|
|
68
|
+
"prerelease": "beta"
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
"name": "alpha",
|
|
72
|
+
"channel": "alpha",
|
|
73
|
+
"prerelease": "alpha"
|
|
74
|
+
}
|
|
75
|
+
],
|
|
76
|
+
"plugins": [
|
|
77
|
+
"@semantic-release/commit-analyzer",
|
|
78
|
+
"@semantic-release/release-notes-generator",
|
|
79
|
+
"@semantic-release/changelog",
|
|
80
|
+
"@semantic-release/npm",
|
|
81
|
+
"@semantic-release/gitlab",
|
|
82
|
+
"@semantic-release/git"
|
|
83
|
+
],
|
|
84
|
+
"tagFormat": "@zcomponent/core@${version}"
|
|
85
|
+
}
|
|
86
86
|
}
|