@zcomponent/core 1.25.0-beta.1 → 1.25.0-beta.2

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.
@@ -466,7 +466,7 @@ export function removeNodeScriptNameFromRegister(zcomp, id) {
466
466
  if (!node)
467
467
  return;
468
468
  if (node.scriptName) {
469
- if (zcomp.entitiesByScriptName) {
469
+ if (zcomp.entitiesByScriptName?.[node.scriptName]) {
470
470
  delete zcomp.entitiesByScriptName[node.scriptName][id];
471
471
  if (Object.keys(zcomp.entitiesByScriptName[node.scriptName]).length === 0) {
472
472
  delete zcomp.entitiesByScriptName[node.scriptName];
package/lib/selectors.js CHANGED
@@ -349,10 +349,20 @@ ${Object.entries(scriptNames ?? {})
349
349
  .map(entry => {
350
350
  const values = Object.keys(entry[1]);
351
351
  if (values.length > 1) {
352
- return `\t\t${entry[0]}: {${values.map(e => `${JSON.stringify(e)}: ${importMapping.get(nodes[e].type)}${getBehaviorBlockForNode(behaviors, behaviorsByNodeID[nodes[e].id] ?? [], importMapping)}`).join(', ')}},`;
352
+ return `\t\t${entry[0]}: {${values
353
+ .map(e => {
354
+ const node = nodes[e];
355
+ if (!node)
356
+ return `${JSON.stringify(e)}: any,`;
357
+ return `${JSON.stringify(e)}: ${importMapping.get(nodes[e].type)}${getBehaviorBlockForNode(behaviors, behaviorsByNodeID[nodes[e].id] ?? [], importMapping)}`;
358
+ })
359
+ .join(', ')}},`;
353
360
  }
354
361
  else {
355
- return `\t\t${entry[0]}: ${importMapping.get(nodes[values[0]].type)}${getBehaviorBlockForNode(behaviors, behaviorsByNodeID[nodes[values[0]].id] ?? [], importMapping)},`;
362
+ const node = nodes[values[0]];
363
+ if (!node)
364
+ return `\t\t${entry[0]}: any,`;
365
+ return `\t\t${entry[0]}: ${importMapping.get(node.type)}${getBehaviorBlockForNode(behaviors, behaviorsByNodeID[node.id] ?? [], importMapping)},`;
356
366
  }
357
367
  })
358
368
  .join('\n')}
package/lib/zcomponent.js CHANGED
@@ -279,8 +279,13 @@ export class ZComponent extends Component {
279
279
  */
280
280
  resolveNodeID(id, type) {
281
281
  const entity = this.entityByID.get(id);
282
- if (!entity)
283
- return this.getZComponentInstance()?.resolveNodeID(id, type);
282
+ try {
283
+ if (!entity)
284
+ return this.getZComponentInstance()?.resolveNodeID(id, type);
285
+ }
286
+ catch (err) {
287
+ return undefined;
288
+ }
284
289
  if (!(entity instanceof Component))
285
290
  return undefined;
286
291
  if (!type)
@@ -295,8 +300,13 @@ export class ZComponent extends Component {
295
300
  */
296
301
  resolveBehaviorID(id, type) {
297
302
  const entity = this.entityByID.get(id);
298
- if (!entity)
299
- return this.getZComponentInstance()?.resolveBehaviorID(id, type);
303
+ try {
304
+ if (!entity)
305
+ return this.getZComponentInstance()?.resolveBehaviorID(id, type);
306
+ }
307
+ catch (err) {
308
+ return undefined;
309
+ }
300
310
  if (!(entity instanceof Behavior))
301
311
  return undefined;
302
312
  if (!type)
@@ -314,8 +324,13 @@ export class ZComponent extends Component {
314
324
  */
315
325
  resolveEntityID(id) {
316
326
  const entity = this.entityByID.get(id);
317
- if (!entity)
318
- return this.getZComponentInstance()?.resolveEntityID(id);
327
+ try {
328
+ if (!entity)
329
+ return this.getZComponentInstance()?.resolveEntityID(id);
330
+ }
331
+ catch (err) {
332
+ return undefined;
333
+ }
319
334
  if (!(entity instanceof Entity))
320
335
  return undefined;
321
336
  return entity;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zcomponent/core",
3
- "version": "1.25.0-beta.1",
3
+ "version": "1.25.0-beta.2",
4
4
  "description": "The core component model and built-in functionality for Mattercraft.",
5
5
  "author": "Zappar Limited",
6
6
  "license": "Proprietary",