From 4c7e83a53e70a78a9d744e68ad8222059bcd6717 Mon Sep 17 00:00:00 2001 From: cha0s Date: Fri, 5 Jan 2024 22:49:48 -0600 Subject: [PATCH] fix: mixin --- packages/behavior/src/resources/script.js | 2 +- packages/entity/test/entity.js | 8 ++++---- packages/graphics/src/components/stage/index.jsx | 3 +-- packages/resource/src/persea/index.js | 9 +++++---- packages/traits/src/index.js | 7 ++++--- packages/traits/src/persea/index.js | 9 +++++---- 6 files changed, 20 insertions(+), 18 deletions(-) diff --git a/packages/behavior/src/resources/script.js b/packages/behavior/src/resources/script.js index 72fe8fa..d234aee 100644 --- a/packages/behavior/src/resources/script.js +++ b/packages/behavior/src/resources/script.js @@ -49,7 +49,7 @@ export default (flecks) => { } return { [Populated]: true, - ...flecks.avocado.behavior, + ...flecks.avocado.behavior.globals, ...locals, }; } diff --git a/packages/entity/test/entity.js b/packages/entity/test/entity.js index d8ef0a6..6436aff 100644 --- a/packages/entity/test/entity.js +++ b/packages/entity/test/entity.js @@ -36,7 +36,7 @@ it('can add and remove traits', async () => { } }; - flecks.avocado.traits.Traits['TestTrait'] = TestTrait; + flecks.avocado.traits.Traits.TestTrait = TestTrait; await entity.addTrait('TestTrait'); expect(entity.is('TestTrait')).to.be.true; entity.removeTrait('TestTrait'); @@ -55,7 +55,7 @@ it('can add traits asynchronously', async () => { } } - flecks.avocado.traits.Traits['Async'] = AsyncTrait; + flecks.avocado.traits.Traits.Async = AsyncTrait; const start = Date.now(); await Entity.load({ traits: { @@ -95,8 +95,8 @@ it('can invoke hooks', async () => { } } - flecks.avocado.traits.Traits['AnotherTrait'] = AnotherTrait; - flecks.avocado.traits.Traits['YetAnotherTrait'] = YetAnotherTrait; + flecks.avocado.traits.Traits.AnotherTrait = AnotherTrait; + flecks.avocado.traits.Traits.YetAnotherTrait = YetAnotherTrait; const entity = new Entity(); await entity.addTrait('AnotherTrait'); await entity.addTrait('YetAnotherTrait'); diff --git a/packages/graphics/src/components/stage/index.jsx b/packages/graphics/src/components/stage/index.jsx index 66579f7..2608282 100644 --- a/packages/graphics/src/components/stage/index.jsx +++ b/packages/graphics/src/components/stage/index.jsx @@ -1,4 +1,3 @@ -import Renderer from '@avocado/graphics/renderer'; import {Vector} from '@avocado/math'; import { forwardRef, @@ -130,7 +129,7 @@ const Stage = forwardRef(({ Stage.defaultProps = { centered: true, - renderer: new Renderer([0, 0]), + renderer: undefined, scale: 1, styles: { canvas: '', diff --git a/packages/resource/src/persea/index.js b/packages/resource/src/persea/index.js index 6337af4..6de64a4 100644 --- a/packages/resource/src/persea/index.js +++ b/packages/resource/src/persea/index.js @@ -33,9 +33,10 @@ export const hooks = { if (!this.avocado.resource) { this.avocado.resource = {}; } - this.avocado.resource.persea = { - Controllers: {}, - }; + if (!this.avocado.resource.persea) { + this.avocado.resource.persea = {}; + } + this.avocado.resource.persea.Controllers = {}; } } @@ -49,7 +50,7 @@ export const hooks = { TextController, BinaryController, ); - this.avocado.resource.persea.Controllers = Controllers; + flecks.avocado.resource.persea.Controllers = Controllers; }, '@flecks/redux.reducers': () => reducer, }; diff --git a/packages/traits/src/index.js b/packages/traits/src/index.js index 937b201..c05cdbe 100644 --- a/packages/traits/src/index.js +++ b/packages/traits/src/index.js @@ -10,9 +10,10 @@ export const hooks = { if (!this.avocado) { this.avocado = {}; } - this.avocado.traits = { - Traits: {}, - }; + if (!this.avocado.traits) { + this.avocado.traits = {}; + } + this.avocado.traits.Traits = {}; } } diff --git a/packages/traits/src/persea/index.js b/packages/traits/src/persea/index.js index c3b9373..4b45959 100644 --- a/packages/traits/src/persea/index.js +++ b/packages/traits/src/persea/index.js @@ -1,6 +1,6 @@ export const hooks = { '@flecks/core.mixin': (Flecks) => ( - class FlecksWithAvocadoTraitrs extends Flecks { + class FlecksWithAvocadoTraits extends Flecks { constructor(...args) { super(...args); @@ -10,9 +10,10 @@ export const hooks = { if (!this.avocado.traits) { this.avocado.traits = {}; } - this.avocado.traits.persea = { - Components: {}, - }; + if (!this.avocado.traits.persea) { + this.avocado.traits.persea = {}; + } + this.avocado.traits.persea.Components = {}; } }