@vived/core 1.4.2 → 1.4.3
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 +118 -20
- package/dist/cjs/AppObject/AppObject.js +53 -0
- package/dist/cjs/AppObject/AppObject.js.map +1 -1
- package/dist/cjs/AppObject/AppObjectComponent.js +78 -0
- package/dist/cjs/AppObject/AppObjectComponent.js.map +1 -1
- package/dist/cjs/AppObject/AppObjectController.js +22 -0
- package/dist/cjs/AppObject/AppObjectController.js.map +1 -1
- package/dist/cjs/AppObject/AppObjectEntity.js +52 -0
- package/dist/cjs/AppObject/AppObjectEntity.js.map +1 -1
- package/dist/cjs/AppObject/AppObjectEntityRepo.js +75 -1
- package/dist/cjs/AppObject/AppObjectEntityRepo.js.map +1 -1
- package/dist/cjs/AppObject/AppObjectPM.js +46 -0
- package/dist/cjs/AppObject/AppObjectPM.js.map +1 -1
- package/dist/cjs/AppObject/AppObjectRepo.js +20 -0
- package/dist/cjs/AppObject/AppObjectRepo.js.map +1 -1
- package/dist/cjs/AppObject/AppObjectUC.js +23 -0
- package/dist/cjs/AppObject/AppObjectUC.js.map +1 -1
- package/dist/cjs/AppObject/AppObjectView.js +22 -0
- package/dist/cjs/AppObject/AppObjectView.js.map +1 -1
- package/dist/cjs/AppObject/getSingletonComponent.js +19 -0
- package/dist/cjs/AppObject/getSingletonComponent.js.map +1 -1
- package/dist/cjs/Entities/MemoizedAngle.js +21 -0
- package/dist/cjs/Entities/MemoizedAngle.js.map +1 -1
- package/dist/cjs/Entities/MemoizedBoolean.js +21 -0
- package/dist/cjs/Entities/MemoizedBoolean.js.map +1 -1
- package/dist/cjs/Entities/MemoizedColor.js +21 -0
- package/dist/cjs/Entities/MemoizedColor.js.map +1 -1
- package/dist/cjs/Entities/MemoizedNumber.js +21 -0
- package/dist/cjs/Entities/MemoizedNumber.js.map +1 -1
- package/dist/cjs/Entities/MemoizedQuaternion.js +21 -0
- package/dist/cjs/Entities/MemoizedQuaternion.js.map +1 -1
- package/dist/cjs/Entities/MemoizedString.js +21 -0
- package/dist/cjs/Entities/MemoizedString.js.map +1 -1
- package/dist/cjs/Entities/MemoizedVector2.js +21 -0
- package/dist/cjs/Entities/MemoizedVector2.js.map +1 -1
- package/dist/cjs/Entities/MemoizedVector3.js +21 -0
- package/dist/cjs/Entities/MemoizedVector3.js.map +1 -1
- package/dist/cjs/Entities/ObservableEntity.js +17 -0
- package/dist/cjs/Entities/ObservableEntity.js.map +1 -1
- package/dist/cjs/Entities/ObserverList.js +21 -0
- package/dist/cjs/Entities/ObserverList.js.map +1 -1
- package/dist/cjs/Entities/RangedNumber.js +29 -0
- package/dist/cjs/Entities/RangedNumber.js.map +1 -1
- package/dist/cjs/Types/PmAdapter.js.map +1 -1
- package/dist/cjs/Types/SingletonPmAdapter.js.map +1 -1
- package/dist/cjs/ValueObjects/Angle.js +1 -1
- package/dist/cjs/ValueObjects/Angle.js.map +1 -1
- package/dist/cjs/ValueObjects/LineSegment2D.js +6 -6
- package/dist/cjs/ValueObjects/LineSegment2D.js.map +1 -1
- package/dist/cjs/ValueObjects/Matrix.js +6 -6
- package/dist/cjs/ValueObjects/Matrix.js.map +1 -1
- package/dist/cjs/ValueObjects/Quaternion.js +17 -17
- package/dist/cjs/ValueObjects/Quaternion.js.map +1 -1
- package/dist/cjs/ValueObjects/Vector2.js +15 -8
- package/dist/cjs/ValueObjects/Vector2.js.map +1 -1
- package/dist/esm/AppObject/AppObject.js +53 -0
- package/dist/esm/AppObject/AppObject.js.map +1 -1
- package/dist/esm/AppObject/AppObjectComponent.js +78 -0
- package/dist/esm/AppObject/AppObjectComponent.js.map +1 -1
- package/dist/esm/AppObject/AppObjectController.js +22 -0
- package/dist/esm/AppObject/AppObjectController.js.map +1 -1
- package/dist/esm/AppObject/AppObjectEntity.js +52 -0
- package/dist/esm/AppObject/AppObjectEntity.js.map +1 -1
- package/dist/esm/AppObject/AppObjectEntityRepo.js +75 -1
- package/dist/esm/AppObject/AppObjectEntityRepo.js.map +1 -1
- package/dist/esm/AppObject/AppObjectPM.js +46 -0
- package/dist/esm/AppObject/AppObjectPM.js.map +1 -1
- package/dist/esm/AppObject/AppObjectRepo.js +20 -0
- package/dist/esm/AppObject/AppObjectRepo.js.map +1 -1
- package/dist/esm/AppObject/AppObjectUC.js +24 -1
- package/dist/esm/AppObject/AppObjectUC.js.map +1 -1
- package/dist/esm/AppObject/AppObjectView.js +23 -1
- package/dist/esm/AppObject/AppObjectView.js.map +1 -1
- package/dist/esm/AppObject/getSingletonComponent.js +19 -0
- package/dist/esm/AppObject/getSingletonComponent.js.map +1 -1
- package/dist/esm/Entities/MemoizedAngle.js +21 -0
- package/dist/esm/Entities/MemoizedAngle.js.map +1 -1
- package/dist/esm/Entities/MemoizedBoolean.js +21 -0
- package/dist/esm/Entities/MemoizedBoolean.js.map +1 -1
- package/dist/esm/Entities/MemoizedColor.js +21 -0
- package/dist/esm/Entities/MemoizedColor.js.map +1 -1
- package/dist/esm/Entities/MemoizedNumber.js +21 -0
- package/dist/esm/Entities/MemoizedNumber.js.map +1 -1
- package/dist/esm/Entities/MemoizedQuaternion.js +21 -0
- package/dist/esm/Entities/MemoizedQuaternion.js.map +1 -1
- package/dist/esm/Entities/MemoizedString.js +21 -0
- package/dist/esm/Entities/MemoizedString.js.map +1 -1
- package/dist/esm/Entities/MemoizedVector2.js +21 -0
- package/dist/esm/Entities/MemoizedVector2.js.map +1 -1
- package/dist/esm/Entities/MemoizedVector3.js +21 -0
- package/dist/esm/Entities/MemoizedVector3.js.map +1 -1
- package/dist/esm/Entities/ObservableEntity.js +17 -0
- package/dist/esm/Entities/ObservableEntity.js.map +1 -1
- package/dist/esm/Entities/ObserverList.js +21 -0
- package/dist/esm/Entities/ObserverList.js.map +1 -1
- package/dist/esm/Entities/RangedNumber.js +29 -0
- package/dist/esm/Entities/RangedNumber.js.map +1 -1
- package/dist/esm/Types/PmAdapter.js.map +1 -1
- package/dist/esm/Types/SingletonPmAdapter.js.map +1 -1
- package/dist/esm/ValueObjects/Angle.js +1 -1
- package/dist/esm/ValueObjects/Angle.js.map +1 -1
- package/dist/esm/ValueObjects/LineSegment2D.js +6 -6
- package/dist/esm/ValueObjects/LineSegment2D.js.map +1 -1
- package/dist/esm/ValueObjects/Matrix.js +6 -6
- package/dist/esm/ValueObjects/Matrix.js.map +1 -1
- package/dist/esm/ValueObjects/Quaternion.js +17 -17
- package/dist/esm/ValueObjects/Quaternion.js.map +1 -1
- package/dist/esm/ValueObjects/Vector2.js +15 -8
- package/dist/esm/ValueObjects/Vector2.js.map +1 -1
- package/dist/types/AppObject/AppObject.d.ts +42 -0
- package/dist/types/AppObject/AppObject.d.ts.map +1 -1
- package/dist/types/AppObject/AppObjectComponent.d.ts +80 -0
- package/dist/types/AppObject/AppObjectComponent.d.ts.map +1 -1
- package/dist/types/AppObject/AppObjectController.d.ts +22 -0
- package/dist/types/AppObject/AppObjectController.d.ts.map +1 -1
- package/dist/types/AppObject/AppObjectEntity.d.ts +55 -0
- package/dist/types/AppObject/AppObjectEntity.d.ts.map +1 -1
- package/dist/types/AppObject/AppObjectEntityRepo.d.ts +75 -0
- package/dist/types/AppObject/AppObjectEntityRepo.d.ts.map +1 -1
- package/dist/types/AppObject/AppObjectPM.d.ts +53 -0
- package/dist/types/AppObject/AppObjectPM.d.ts.map +1 -1
- package/dist/types/AppObject/AppObjectRepo.d.ts +124 -0
- package/dist/types/AppObject/AppObjectRepo.d.ts.map +1 -1
- package/dist/types/AppObject/AppObjectUC.d.ts +23 -0
- package/dist/types/AppObject/AppObjectUC.d.ts.map +1 -1
- package/dist/types/AppObject/AppObjectView.d.ts +22 -0
- package/dist/types/AppObject/AppObjectView.d.ts.map +1 -1
- package/dist/types/AppObject/getSingletonComponent.d.ts +19 -0
- package/dist/types/AppObject/getSingletonComponent.d.ts.map +1 -1
- package/dist/types/Entities/MemoizedAngle.d.ts +21 -0
- package/dist/types/Entities/MemoizedAngle.d.ts.map +1 -1
- package/dist/types/Entities/MemoizedBoolean.d.ts +21 -0
- package/dist/types/Entities/MemoizedBoolean.d.ts.map +1 -1
- package/dist/types/Entities/MemoizedColor.d.ts +21 -0
- package/dist/types/Entities/MemoizedColor.d.ts.map +1 -1
- package/dist/types/Entities/MemoizedNumber.d.ts +21 -0
- package/dist/types/Entities/MemoizedNumber.d.ts.map +1 -1
- package/dist/types/Entities/MemoizedQuaternion.d.ts +21 -0
- package/dist/types/Entities/MemoizedQuaternion.d.ts.map +1 -1
- package/dist/types/Entities/MemoizedString.d.ts +21 -0
- package/dist/types/Entities/MemoizedString.d.ts.map +1 -1
- package/dist/types/Entities/MemoizedVector2.d.ts +21 -0
- package/dist/types/Entities/MemoizedVector2.d.ts.map +1 -1
- package/dist/types/Entities/MemoizedVector3.d.ts +21 -0
- package/dist/types/Entities/MemoizedVector3.d.ts.map +1 -1
- package/dist/types/Entities/ObservableEntity.d.ts +20 -0
- package/dist/types/Entities/ObservableEntity.d.ts.map +1 -1
- package/dist/types/Entities/ObserverList.d.ts +21 -0
- package/dist/types/Entities/ObserverList.d.ts.map +1 -1
- package/dist/types/Entities/RangedNumber.d.ts +37 -0
- package/dist/types/Entities/RangedNumber.d.ts.map +1 -1
- package/dist/types/Types/PmAdapter.d.ts +60 -0
- package/dist/types/Types/PmAdapter.d.ts.map +1 -1
- package/dist/types/Types/SingletonPmAdapter.d.ts +55 -0
- package/dist/types/Types/SingletonPmAdapter.d.ts.map +1 -1
- package/dist/types/ValueObjects/Angle.d.ts +1 -1
- package/dist/types/ValueObjects/Matrix.d.ts +5 -5
- package/dist/types/ValueObjects/Matrix.d.ts.map +1 -1
- package/dist/types/ValueObjects/Quaternion.d.ts +17 -17
- package/dist/types/ValueObjects/Vector2.d.ts +8 -3
- package/dist/types/ValueObjects/Vector2.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/cjs/AppObject/AppObject.test.js +0 -113
- package/dist/cjs/AppObject/AppObject.test.js.map +0 -1
- package/dist/cjs/AppObject/AppObjectComponent.test.js +0 -132
- package/dist/cjs/AppObject/AppObjectComponent.test.js.map +0 -1
- package/dist/cjs/AppObject/AppObjectEntity.test.js +0 -108
- package/dist/cjs/AppObject/AppObjectEntity.test.js.map +0 -1
- package/dist/cjs/AppObject/AppObjectEntityRepo.test.js +0 -149
- package/dist/cjs/AppObject/AppObjectEntityRepo.test.js.map +0 -1
- package/dist/cjs/AppObject/AppObjectPM.test.js +0 -103
- package/dist/cjs/AppObject/AppObjectPM.test.js.map +0 -1
- package/dist/cjs/AppObject/AppObjectRepo.test.js +0 -213
- package/dist/cjs/AppObject/AppObjectRepo.test.js.map +0 -1
- package/dist/cjs/AppObject/getSingletonComponent.test.js +0 -13
- package/dist/cjs/AppObject/getSingletonComponent.test.js.map +0 -1
- package/dist/cjs/Entities/MemoizedAngle.test.js +0 -30
- package/dist/cjs/Entities/MemoizedAngle.test.js.map +0 -1
- package/dist/cjs/Entities/MemoizedBoolean.test.js +0 -34
- package/dist/cjs/Entities/MemoizedBoolean.test.js.map +0 -1
- package/dist/cjs/Entities/MemoizedColor.test.js +0 -32
- package/dist/cjs/Entities/MemoizedColor.test.js.map +0 -1
- package/dist/cjs/Entities/MemoizedNumber.test.js +0 -29
- package/dist/cjs/Entities/MemoizedNumber.test.js.map +0 -1
- package/dist/cjs/Entities/MemoizedQuaternion.test.js +0 -32
- package/dist/cjs/Entities/MemoizedQuaternion.test.js.map +0 -1
- package/dist/cjs/Entities/MemoizedString.test.js +0 -29
- package/dist/cjs/Entities/MemoizedString.test.js.map +0 -1
- package/dist/cjs/Entities/MemoizedVector2.test.js +0 -32
- package/dist/cjs/Entities/MemoizedVector2.test.js.map +0 -1
- package/dist/cjs/Entities/MemoizedVector3.test.js +0 -32
- package/dist/cjs/Entities/MemoizedVector3.test.js.map +0 -1
- package/dist/cjs/Entities/ObservableEntity.test.js +0 -25
- package/dist/cjs/Entities/ObservableEntity.test.js.map +0 -1
- package/dist/cjs/Entities/ObserverList.test.js +0 -44
- package/dist/cjs/Entities/ObserverList.test.js.map +0 -1
- package/dist/cjs/Entities/RangedNumber.test.js +0 -96
- package/dist/cjs/Entities/RangedNumber.test.js.map +0 -1
- package/dist/cjs/Utilities/LengthConverters.test.js +0 -24
- package/dist/cjs/Utilities/LengthConverters.test.js.map +0 -1
- package/dist/cjs/Utilities/LerpNumber.test.js +0 -90
- package/dist/cjs/Utilities/LerpNumber.test.js.map +0 -1
- package/dist/cjs/Utilities/addAlphaToHex.test.js +0 -34
- package/dist/cjs/Utilities/addAlphaToHex.test.js.map +0 -1
- package/dist/cjs/Utilities/alphaToHex.test.js +0 -75
- package/dist/cjs/Utilities/alphaToHex.test.js.map +0 -1
- package/dist/cjs/Utilities/degreesToRadians.test.js +0 -9
- package/dist/cjs/Utilities/degreesToRadians.test.js.map +0 -1
- package/dist/cjs/Utilities/easeFunctions.test.js +0 -209
- package/dist/cjs/Utilities/easeFunctions.test.js.map +0 -1
- package/dist/cjs/Utilities/interpolateNumber.test.js +0 -26
- package/dist/cjs/Utilities/interpolateNumber.test.js.map +0 -1
- package/dist/cjs/ValueObjects/Angle.test.js +0 -28
- package/dist/cjs/ValueObjects/Angle.test.js.map +0 -1
- package/dist/cjs/ValueObjects/Color.test.js +0 -147
- package/dist/cjs/ValueObjects/Color.test.js.map +0 -1
- package/dist/cjs/ValueObjects/LineSegment2D.test.js +0 -102
- package/dist/cjs/ValueObjects/LineSegment2D.test.js.map +0 -1
- package/dist/cjs/ValueObjects/Matrix.test.js +0 -385
- package/dist/cjs/ValueObjects/Matrix.test.js.map +0 -1
- package/dist/cjs/ValueObjects/ParametricLine.test.js +0 -126
- package/dist/cjs/ValueObjects/ParametricLine.test.js.map +0 -1
- package/dist/cjs/ValueObjects/ParametricPlane.test.js +0 -101
- package/dist/cjs/ValueObjects/ParametricPlane.test.js.map +0 -1
- package/dist/cjs/ValueObjects/Quaternion.test.js +0 -240
- package/dist/cjs/ValueObjects/Quaternion.test.js.map +0 -1
- package/dist/cjs/ValueObjects/Rectangle.test.js +0 -32
- package/dist/cjs/ValueObjects/Rectangle.test.js.map +0 -1
- package/dist/cjs/ValueObjects/Vector2.test.js +0 -136
- package/dist/cjs/ValueObjects/Vector2.test.js.map +0 -1
- package/dist/cjs/ValueObjects/Vector3.test.js +0 -188
- package/dist/cjs/ValueObjects/Vector3.test.js.map +0 -1
- package/dist/cjs/ValueObjects/Version.test.js +0 -310
- package/dist/cjs/ValueObjects/Version.test.js.map +0 -1
- package/dist/esm/AppObject/AppObject.test.js +0 -110
- package/dist/esm/AppObject/AppObject.test.js.map +0 -1
- package/dist/esm/AppObject/AppObjectComponent.test.js +0 -130
- package/dist/esm/AppObject/AppObjectComponent.test.js.map +0 -1
- package/dist/esm/AppObject/AppObjectEntity.test.js +0 -106
- package/dist/esm/AppObject/AppObjectEntity.test.js.map +0 -1
- package/dist/esm/AppObject/AppObjectEntityRepo.test.js +0 -147
- package/dist/esm/AppObject/AppObjectEntityRepo.test.js.map +0 -1
- package/dist/esm/AppObject/AppObjectPM.test.js +0 -101
- package/dist/esm/AppObject/AppObjectPM.test.js.map +0 -1
- package/dist/esm/AppObject/AppObjectRepo.test.js +0 -211
- package/dist/esm/AppObject/AppObjectRepo.test.js.map +0 -1
- package/dist/esm/AppObject/getSingletonComponent.test.js +0 -11
- package/dist/esm/AppObject/getSingletonComponent.test.js.map +0 -1
- package/dist/esm/Entities/MemoizedAngle.test.js +0 -28
- package/dist/esm/Entities/MemoizedAngle.test.js.map +0 -1
- package/dist/esm/Entities/MemoizedBoolean.test.js +0 -32
- package/dist/esm/Entities/MemoizedBoolean.test.js.map +0 -1
- package/dist/esm/Entities/MemoizedColor.test.js +0 -30
- package/dist/esm/Entities/MemoizedColor.test.js.map +0 -1
- package/dist/esm/Entities/MemoizedNumber.test.js +0 -27
- package/dist/esm/Entities/MemoizedNumber.test.js.map +0 -1
- package/dist/esm/Entities/MemoizedQuaternion.test.js +0 -30
- package/dist/esm/Entities/MemoizedQuaternion.test.js.map +0 -1
- package/dist/esm/Entities/MemoizedString.test.js +0 -27
- package/dist/esm/Entities/MemoizedString.test.js.map +0 -1
- package/dist/esm/Entities/MemoizedVector2.test.js +0 -30
- package/dist/esm/Entities/MemoizedVector2.test.js.map +0 -1
- package/dist/esm/Entities/MemoizedVector3.test.js +0 -30
- package/dist/esm/Entities/MemoizedVector3.test.js.map +0 -1
- package/dist/esm/Entities/ObservableEntity.test.js +0 -23
- package/dist/esm/Entities/ObservableEntity.test.js.map +0 -1
- package/dist/esm/Entities/ObserverList.test.js +0 -42
- package/dist/esm/Entities/ObserverList.test.js.map +0 -1
- package/dist/esm/Entities/RangedNumber.test.js +0 -94
- package/dist/esm/Entities/RangedNumber.test.js.map +0 -1
- package/dist/esm/Utilities/LengthConverters.test.js +0 -22
- package/dist/esm/Utilities/LengthConverters.test.js.map +0 -1
- package/dist/esm/Utilities/LerpNumber.test.js +0 -88
- package/dist/esm/Utilities/LerpNumber.test.js.map +0 -1
- package/dist/esm/Utilities/addAlphaToHex.test.js +0 -32
- package/dist/esm/Utilities/addAlphaToHex.test.js.map +0 -1
- package/dist/esm/Utilities/alphaToHex.test.js +0 -73
- package/dist/esm/Utilities/alphaToHex.test.js.map +0 -1
- package/dist/esm/Utilities/degreesToRadians.test.js +0 -7
- package/dist/esm/Utilities/degreesToRadians.test.js.map +0 -1
- package/dist/esm/Utilities/easeFunctions.test.js +0 -207
- package/dist/esm/Utilities/easeFunctions.test.js.map +0 -1
- package/dist/esm/Utilities/interpolateNumber.test.js +0 -24
- package/dist/esm/Utilities/interpolateNumber.test.js.map +0 -1
- package/dist/esm/ValueObjects/Angle.test.js +0 -26
- package/dist/esm/ValueObjects/Angle.test.js.map +0 -1
- package/dist/esm/ValueObjects/Color.test.js +0 -145
- package/dist/esm/ValueObjects/Color.test.js.map +0 -1
- package/dist/esm/ValueObjects/LineSegment2D.test.js +0 -100
- package/dist/esm/ValueObjects/LineSegment2D.test.js.map +0 -1
- package/dist/esm/ValueObjects/Matrix.test.js +0 -383
- package/dist/esm/ValueObjects/Matrix.test.js.map +0 -1
- package/dist/esm/ValueObjects/ParametricLine.test.js +0 -124
- package/dist/esm/ValueObjects/ParametricLine.test.js.map +0 -1
- package/dist/esm/ValueObjects/ParametricPlane.test.js +0 -99
- package/dist/esm/ValueObjects/ParametricPlane.test.js.map +0 -1
- package/dist/esm/ValueObjects/Quaternion.test.js +0 -238
- package/dist/esm/ValueObjects/Quaternion.test.js.map +0 -1
- package/dist/esm/ValueObjects/Rectangle.test.js +0 -30
- package/dist/esm/ValueObjects/Rectangle.test.js.map +0 -1
- package/dist/esm/ValueObjects/Vector2.test.js +0 -134
- package/dist/esm/ValueObjects/Vector2.test.js.map +0 -1
- package/dist/esm/ValueObjects/Vector3.test.js +0 -186
- package/dist/esm/ValueObjects/Vector3.test.js.map +0 -1
- package/dist/esm/ValueObjects/Version.test.js +0 -308
- package/dist/esm/ValueObjects/Version.test.js.map +0 -1
- package/dist/types/AppObject/AppObject.test.d.ts +0 -7
- package/dist/types/AppObject/AppObject.test.d.ts.map +0 -1
- package/dist/types/AppObject/AppObjectComponent.test.d.ts +0 -2
- package/dist/types/AppObject/AppObjectComponent.test.d.ts.map +0 -1
- package/dist/types/AppObject/AppObjectEntity.test.d.ts +0 -2
- package/dist/types/AppObject/AppObjectEntity.test.d.ts.map +0 -1
- package/dist/types/AppObject/AppObjectEntityRepo.test.d.ts +0 -2
- package/dist/types/AppObject/AppObjectEntityRepo.test.d.ts.map +0 -1
- package/dist/types/AppObject/AppObjectPM.test.d.ts +0 -2
- package/dist/types/AppObject/AppObjectPM.test.d.ts.map +0 -1
- package/dist/types/AppObject/AppObjectRepo.test.d.ts +0 -2
- package/dist/types/AppObject/AppObjectRepo.test.d.ts.map +0 -1
- package/dist/types/AppObject/getSingletonComponent.test.d.ts +0 -2
- package/dist/types/AppObject/getSingletonComponent.test.d.ts.map +0 -1
- package/dist/types/Entities/MemoizedAngle.test.d.ts +0 -2
- package/dist/types/Entities/MemoizedAngle.test.d.ts.map +0 -1
- package/dist/types/Entities/MemoizedBoolean.test.d.ts +0 -2
- package/dist/types/Entities/MemoizedBoolean.test.d.ts.map +0 -1
- package/dist/types/Entities/MemoizedColor.test.d.ts +0 -2
- package/dist/types/Entities/MemoizedColor.test.d.ts.map +0 -1
- package/dist/types/Entities/MemoizedNumber.test.d.ts +0 -2
- package/dist/types/Entities/MemoizedNumber.test.d.ts.map +0 -1
- package/dist/types/Entities/MemoizedQuaternion.test.d.ts +0 -2
- package/dist/types/Entities/MemoizedQuaternion.test.d.ts.map +0 -1
- package/dist/types/Entities/MemoizedString.test.d.ts +0 -2
- package/dist/types/Entities/MemoizedString.test.d.ts.map +0 -1
- package/dist/types/Entities/MemoizedVector2.test.d.ts +0 -2
- package/dist/types/Entities/MemoizedVector2.test.d.ts.map +0 -1
- package/dist/types/Entities/MemoizedVector3.test.d.ts +0 -2
- package/dist/types/Entities/MemoizedVector3.test.d.ts.map +0 -1
- package/dist/types/Entities/ObservableEntity.test.d.ts +0 -2
- package/dist/types/Entities/ObservableEntity.test.d.ts.map +0 -1
- package/dist/types/Entities/ObserverList.test.d.ts +0 -2
- package/dist/types/Entities/ObserverList.test.d.ts.map +0 -1
- package/dist/types/Entities/RangedNumber.test.d.ts +0 -2
- package/dist/types/Entities/RangedNumber.test.d.ts.map +0 -1
- package/dist/types/Utilities/LengthConverters.test.d.ts +0 -2
- package/dist/types/Utilities/LengthConverters.test.d.ts.map +0 -1
- package/dist/types/Utilities/LerpNumber.test.d.ts +0 -2
- package/dist/types/Utilities/LerpNumber.test.d.ts.map +0 -1
- package/dist/types/Utilities/addAlphaToHex.test.d.ts +0 -2
- package/dist/types/Utilities/addAlphaToHex.test.d.ts.map +0 -1
- package/dist/types/Utilities/alphaToHex.test.d.ts +0 -2
- package/dist/types/Utilities/alphaToHex.test.d.ts.map +0 -1
- package/dist/types/Utilities/degreesToRadians.test.d.ts +0 -2
- package/dist/types/Utilities/degreesToRadians.test.d.ts.map +0 -1
- package/dist/types/Utilities/easeFunctions.test.d.ts +0 -2
- package/dist/types/Utilities/easeFunctions.test.d.ts.map +0 -1
- package/dist/types/Utilities/interpolateNumber.test.d.ts +0 -2
- package/dist/types/Utilities/interpolateNumber.test.d.ts.map +0 -1
- package/dist/types/ValueObjects/Angle.test.d.ts +0 -2
- package/dist/types/ValueObjects/Angle.test.d.ts.map +0 -1
- package/dist/types/ValueObjects/Color.test.d.ts +0 -2
- package/dist/types/ValueObjects/Color.test.d.ts.map +0 -1
- package/dist/types/ValueObjects/LineSegment2D.test.d.ts +0 -2
- package/dist/types/ValueObjects/LineSegment2D.test.d.ts.map +0 -1
- package/dist/types/ValueObjects/Matrix.test.d.ts +0 -2
- package/dist/types/ValueObjects/Matrix.test.d.ts.map +0 -1
- package/dist/types/ValueObjects/ParametricLine.test.d.ts +0 -2
- package/dist/types/ValueObjects/ParametricLine.test.d.ts.map +0 -1
- package/dist/types/ValueObjects/ParametricPlane.test.d.ts +0 -2
- package/dist/types/ValueObjects/ParametricPlane.test.d.ts.map +0 -1
- package/dist/types/ValueObjects/Quaternion.test.d.ts +0 -2
- package/dist/types/ValueObjects/Quaternion.test.d.ts.map +0 -1
- package/dist/types/ValueObjects/Rectangle.test.d.ts +0 -2
- package/dist/types/ValueObjects/Rectangle.test.d.ts.map +0 -1
- package/dist/types/ValueObjects/Vector2.test.d.ts +0 -2
- package/dist/types/ValueObjects/Vector2.test.d.ts.map +0 -1
- package/dist/types/ValueObjects/Vector3.test.d.ts +0 -2
- package/dist/types/ValueObjects/Vector3.test.d.ts.map +0 -1
- package/dist/types/ValueObjects/Version.test.d.ts +0 -2
- package/dist/types/ValueObjects/Version.test.d.ts.map +0 -1
|
@@ -3,27 +3,83 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.AppObjectEntityRepo = void 0;
|
|
4
4
|
const Entities_1 = require("../Entities");
|
|
5
5
|
const AppObjectEntity_1 = require("./AppObjectEntity");
|
|
6
|
+
/**
|
|
7
|
+
* A repository for managing collections of AppObjectEntity instances.
|
|
8
|
+
*
|
|
9
|
+
* This generic class provides a centralized way to store, retrieve, and manage
|
|
10
|
+
* entities that are associated with specific AppObjects. It implements the observer
|
|
11
|
+
* pattern to notify listeners when entities are added or removed.
|
|
12
|
+
*
|
|
13
|
+
* @template T - The type of entities managed by this repository, must extend AppObjectEntity
|
|
14
|
+
* @extends AppObjectEntity
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```typescript
|
|
18
|
+
* // Create a repository for player entities
|
|
19
|
+
* const playerRepo = new AppObjectEntityRepo<PlayerEntity>();
|
|
20
|
+
*
|
|
21
|
+
* // Add a new player
|
|
22
|
+
* const player = new PlayerEntity(appObject);
|
|
23
|
+
* playerRepo.add(player);
|
|
24
|
+
*
|
|
25
|
+
* // Get a player by its AppObject ID
|
|
26
|
+
* const retrievedPlayer = playerRepo.getForAppObject("player1");
|
|
27
|
+
* ```
|
|
28
|
+
*/
|
|
6
29
|
class AppObjectEntityRepo extends AppObjectEntity_1.AppObjectEntity {
|
|
7
30
|
constructor() {
|
|
8
31
|
super(...arguments);
|
|
9
32
|
this.entityLookup = new Map();
|
|
10
33
|
this.onEntityAddedObservers = new Entities_1.ObserverList();
|
|
34
|
+
/**
|
|
35
|
+
* Registers an observer to be notified when an entity is added to the repository.
|
|
36
|
+
*
|
|
37
|
+
* @param {(addedEntity: T) => void} observer - The callback function to invoke when an entity is added
|
|
38
|
+
*/
|
|
11
39
|
this.addEntityAddedObserver = (observer) => {
|
|
12
40
|
this.onEntityAddedObservers.add(observer);
|
|
13
41
|
};
|
|
42
|
+
/**
|
|
43
|
+
* Removes an observer previously registered for entity addition notifications.
|
|
44
|
+
*
|
|
45
|
+
* @param {(addedEntity: T) => void} observer - The callback function to remove
|
|
46
|
+
*/
|
|
14
47
|
this.removeEntityAddedObserver = (observer) => {
|
|
15
48
|
this.onEntityAddedObservers.remove(observer);
|
|
16
49
|
};
|
|
17
50
|
this.onEntityRemovedObservers = new Entities_1.ObserverList();
|
|
51
|
+
/**
|
|
52
|
+
* Registers an observer to be notified when an entity is removed from the repository.
|
|
53
|
+
*
|
|
54
|
+
* @param {(removedEntity: T) => void} observer - The callback function to invoke when an entity is removed
|
|
55
|
+
*/
|
|
18
56
|
this.addEntityRemovedObserver = (observer) => {
|
|
19
57
|
this.onEntityRemovedObservers.add(observer);
|
|
20
58
|
};
|
|
59
|
+
/**
|
|
60
|
+
* Removes an observer previously registered for entity removal notifications.
|
|
61
|
+
*
|
|
62
|
+
* @param {(removedEntity: T) => void} observer - The callback function to remove
|
|
63
|
+
*/
|
|
21
64
|
this.removeEntityRemovedObserver = (observer) => {
|
|
22
65
|
this.onEntityRemovedObservers.remove(observer);
|
|
23
66
|
};
|
|
67
|
+
/**
|
|
68
|
+
* Checks if an entity exists for the given AppObject ID.
|
|
69
|
+
*
|
|
70
|
+
* @param {string} appObjectID - The ID of the AppObject
|
|
71
|
+
* @returns {boolean} True if an entity exists for the given AppObject ID, false otherwise
|
|
72
|
+
*/
|
|
24
73
|
this.hasForAppObject = (appObjectID) => {
|
|
25
74
|
return this.entityLookup.has(appObjectID);
|
|
26
75
|
};
|
|
76
|
+
/**
|
|
77
|
+
* Removes the entity associated with the specified AppObject ID.
|
|
78
|
+
*
|
|
79
|
+
* Notifies all registered observers after the entity is removed.
|
|
80
|
+
*
|
|
81
|
+
* @param {string} id - The ID of the AppObject whose entity should be removed
|
|
82
|
+
*/
|
|
27
83
|
this.removeForAppObject = (id) => {
|
|
28
84
|
const existing = this.entityLookup.get(id);
|
|
29
85
|
if (!existing)
|
|
@@ -33,13 +89,32 @@ class AppObjectEntityRepo extends AppObjectEntity_1.AppObjectEntity {
|
|
|
33
89
|
this.notifyOnChange();
|
|
34
90
|
this.onEntityRemovedObservers.notify(existing);
|
|
35
91
|
};
|
|
92
|
+
/**
|
|
93
|
+
* Gets the entity associated with the specified AppObject ID.
|
|
94
|
+
*
|
|
95
|
+
* @param {string} appObjectID - The ID of the AppObject
|
|
96
|
+
* @returns {T | undefined} The entity if found, undefined otherwise
|
|
97
|
+
*/
|
|
36
98
|
this.getForAppObject = (appObjectID) => {
|
|
37
99
|
return this.entityLookup.get(appObjectID);
|
|
38
100
|
};
|
|
101
|
+
/**
|
|
102
|
+
* Gets all entities in the repository.
|
|
103
|
+
*
|
|
104
|
+
* @returns {T[]} An array of all entities
|
|
105
|
+
*/
|
|
39
106
|
this.getAll = () => {
|
|
40
107
|
return Array.from(this.entityLookup.values());
|
|
41
108
|
};
|
|
42
109
|
}
|
|
110
|
+
/**
|
|
111
|
+
* Adds an entity to the repository.
|
|
112
|
+
*
|
|
113
|
+
* If an entity with the same AppObject ID already exists, it is replaced.
|
|
114
|
+
* Notifies all registered observers after the entity is added.
|
|
115
|
+
*
|
|
116
|
+
* @param {T} entity - The entity to add
|
|
117
|
+
*/
|
|
43
118
|
add(entity) {
|
|
44
119
|
const existing = this.entityLookup.get(entity.appObject.id);
|
|
45
120
|
if (existing) {
|
|
@@ -50,7 +125,6 @@ class AppObjectEntityRepo extends AppObjectEntity_1.AppObjectEntity {
|
|
|
50
125
|
this.notifyOnChange();
|
|
51
126
|
this.onEntityAddedObservers.notify(entity);
|
|
52
127
|
}
|
|
53
|
-
;
|
|
54
128
|
}
|
|
55
129
|
exports.AppObjectEntityRepo = AppObjectEntityRepo;
|
|
56
130
|
//# sourceMappingURL=AppObjectEntityRepo.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AppObjectEntityRepo.js","sourceRoot":"","sources":["../../../src/AppObject/AppObjectEntityRepo.ts"],"names":[],"mappings":";;;AAAA,0CAA2C;AAC3C,uDAAoD;AAEpD,MAAa,mBAEX,SAAQ,iCAAe;IAFzB;;
|
|
1
|
+
{"version":3,"file":"AppObjectEntityRepo.js","sourceRoot":"","sources":["../../../src/AppObject/AppObjectEntityRepo.ts"],"names":[],"mappings":";;;AAAA,0CAA2C;AAC3C,uDAAoD;AAEpD;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAa,mBAEX,SAAQ,iC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wBAAwB,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;QACjD,CAAC,CAAC;QAEF;;;;;WAKG;QACH,oBAAe,GAAG,CAAC,WAAmB,EAAiB,EAAE;YACvD,OAAO,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;QAC5C,CAAC,CAAC;QAEF;;;;WAIG;QACH,WAAM,GAAG,GAAQ,EAAE;YACjB,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,MAAM,EAAE,CAAC,CAAC;QAChD,CAAC,CAAC;IACJ,CAAC;IAvDC;;;;;;;OAOG;IACH,GAAG,CAAC,MAAS;QACX,MAAM,QAAQ,GAAG,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,MAAM,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC;QAC5D,IAAI,QAAQ,EAAE,CAAC;YACb,QAAQ,CAAC,oBAAoB,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;QACrD,CAAC;QAED,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,MAAM,CAAC,SAAS,CAAC,EAAE,EAAE,MAAM,CAAC,CAAC;QACnD,MAAM,CAAC,iBAAiB,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;QAC9C,IAAI,CAAC,cAAc,EAAE,CAAC;QACtB,IAAI,CAAC,sBAAsB,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IAC7C,CAAC;CAqCF;AA9GD,kDA8GC","sourcesContent":["import { ObserverList } from \"../Entities\";\r\nimport { AppObjectEntity } from \"./AppObjectEntity\";\r\n\r\n/**\r\n * A repository for managing collections of AppObjectEntity instances.\r\n *\r\n * This generic class provides a centralized way to store, retrieve, and manage\r\n * entities that are associated with specific AppObjects. It implements the observer\r\n * pattern to notify listeners when entities are added or removed.\r\n *\r\n * @template T - The type of entities managed by this repository, must extend AppObjectEntity\r\n * @extends AppObjectEntity\r\n *\r\n * @example\r\n * ```typescript\r\n * // Create a repository for player entities\r\n * const playerRepo = new AppObjectEntityRepo<PlayerEntity>();\r\n *\r\n * // Add a new player\r\n * const player = new PlayerEntity(appObject);\r\n * playerRepo.add(player);\r\n *\r\n * // Get a player by its AppObject ID\r\n * const retrievedPlayer = playerRepo.getForAppObject(\"player1\");\r\n * ```\r\n */\r\nexport class AppObjectEntityRepo<\r\n T extends AppObjectEntity,\r\n> extends AppObjectEntity {\r\n private entityLookup = new Map<string, T>();\r\n\r\n private onEntityAddedObservers = new ObserverList<T>();\r\n /**\r\n * Registers an observer to be notified when an entity is added to the repository.\r\n *\r\n * @param {(addedEntity: T) => void} observer - The callback function to invoke when an entity is added\r\n */\r\n addEntityAddedObserver = (observer: (addedEntity: T) => void) => {\r\n this.onEntityAddedObservers.add(observer);\r\n };\r\n\r\n /**\r\n * Removes an observer previously registered for entity addition notifications.\r\n *\r\n * @param {(addedEntity: T) => void} observer - The callback function to remove\r\n */\r\n removeEntityAddedObserver = (observer: (addedEntity: T) => void): void => {\r\n this.onEntityAddedObservers.remove(observer);\r\n };\r\n\r\n private onEntityRemovedObservers = new ObserverList<T>();\r\n /**\r\n * Registers an observer to be notified when an entity is removed from the repository.\r\n *\r\n * @param {(removedEntity: T) => void} observer - The callback function to invoke when an entity is removed\r\n */\r\n addEntityRemovedObserver = (observer: (removedEntity: T) => void) => {\r\n this.onEntityRemovedObservers.add(observer);\r\n };\r\n\r\n /**\r\n * Removes an observer previously registered for entity removal notifications.\r\n *\r\n * @param {(removedEntity: T) => void} observer - The callback function to remove\r\n */\r\n removeEntityRemovedObserver = (\r\n observer: (removedEntity: T) => void\r\n ): void => {\r\n this.onEntityRemovedObservers.remove(observer);\r\n };\r\n\r\n /**\r\n * Checks if an entity exists for the given AppObject ID.\r\n *\r\n * @param {string} appObjectID - The ID of the AppObject\r\n * @returns {boolean} True if an entity exists for the given AppObject ID, false otherwise\r\n */\r\n hasForAppObject = (appObjectID: string): boolean => {\r\n return this.entityLookup.has(appObjectID);\r\n };\r\n\r\n /**\r\n * Adds an entity to the repository.\r\n *\r\n * If an entity with the same AppObject ID already exists, it is replaced.\r\n * Notifies all registered observers after the entity is added.\r\n *\r\n * @param {T} entity - The entity to add\r\n */\r\n add(entity: T) {\r\n const existing = this.entityLookup.get(entity.appObject.id);\r\n if (existing) {\r\n existing.removeChangeObserver(this.notifyOnChange);\r\n }\r\n\r\n this.entityLookup.set(entity.appObject.id, entity);\r\n entity.addChangeObserver(this.notifyOnChange);\r\n this.notifyOnChange();\r\n this.onEntityAddedObservers.notify(entity);\r\n }\r\n\r\n /**\r\n * Removes the entity associated with the specified AppObject ID.\r\n *\r\n * Notifies all registered observers after the entity is removed.\r\n *\r\n * @param {string} id - The ID of the AppObject whose entity should be removed\r\n */\r\n removeForAppObject = (id: string) => {\r\n const existing = this.entityLookup.get(id);\r\n if (!existing) return;\r\n\r\n this.entityLookup.delete(id);\r\n existing.removeChangeObserver(this.notifyOnChange);\r\n this.notifyOnChange();\r\n this.onEntityRemovedObservers.notify(existing);\r\n };\r\n\r\n /**\r\n * Gets the entity associated with the specified AppObject ID.\r\n *\r\n * @param {string} appObjectID - The ID of the AppObject\r\n * @returns {T | undefined} The entity if found, undefined otherwise\r\n */\r\n getForAppObject = (appObjectID: string): T | undefined => {\r\n return this.entityLookup.get(appObjectID);\r\n };\r\n\r\n /**\r\n * Gets all entities in the repository.\r\n *\r\n * @returns {T[]} An array of all entities\r\n */\r\n getAll = (): T[] => {\r\n return Array.from(this.entityLookup.values());\r\n };\r\n}\r\n"]}
|
|
@@ -3,31 +3,77 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.AppObjectPM = void 0;
|
|
4
4
|
const Entities_1 = require("../Entities");
|
|
5
5
|
const AppObjectComponent_1 = require("./AppObjectComponent");
|
|
6
|
+
/**
|
|
7
|
+
* Presentation Manager (PM) component that transforms application state into view models
|
|
8
|
+
*
|
|
9
|
+
* AppObjectPM acts as a mediator between application state (entities) and views.
|
|
10
|
+
* It transforms raw application data into a format that's optimized for presentation,
|
|
11
|
+
* implementing the presentation model or MVVM pattern.
|
|
12
|
+
*
|
|
13
|
+
* A PM typically:
|
|
14
|
+
* 1. Observes entity changes
|
|
15
|
+
* 2. Transforms entity data into view models
|
|
16
|
+
* 3. Notifies attached views when view models change
|
|
17
|
+
* 4. Handles view model caching and optimization
|
|
18
|
+
*
|
|
19
|
+
* @typeparam T The view model type this PM produces
|
|
20
|
+
*/
|
|
6
21
|
class AppObjectPM extends AppObjectComponent_1.AppObjectComponent {
|
|
7
22
|
constructor() {
|
|
8
23
|
super(...arguments);
|
|
24
|
+
/** Identifies this as a Presentation Manager component */
|
|
9
25
|
this.componentType = AppObjectComponent_1.AppObjectComponentType.PM;
|
|
26
|
+
/** List of view update functions to notify when the view model changes */
|
|
10
27
|
this.observerList = new Entities_1.ObserverList();
|
|
11
28
|
}
|
|
29
|
+
/**
|
|
30
|
+
* Gets the most recently generated view model
|
|
31
|
+
* @returns The last view model or undefined if none has been generated
|
|
32
|
+
*/
|
|
12
33
|
get lastVM() {
|
|
13
34
|
return this._lastVM;
|
|
14
35
|
}
|
|
36
|
+
/**
|
|
37
|
+
* Registers a view update function to be called when the view model changes
|
|
38
|
+
* If a view model already exists, the provided function is called immediately with that model
|
|
39
|
+
*
|
|
40
|
+
* @param updateView Function to call with updated view models
|
|
41
|
+
*/
|
|
15
42
|
addView(updateView) {
|
|
16
43
|
this.observerList.add(updateView);
|
|
44
|
+
// Immediately update the view with current view model if one exists
|
|
17
45
|
if (this._lastVM !== undefined) {
|
|
18
46
|
updateView(this._lastVM);
|
|
19
47
|
}
|
|
20
48
|
}
|
|
49
|
+
/**
|
|
50
|
+
* Unregisters a previously added view update function
|
|
51
|
+
*
|
|
52
|
+
* @param updateView The view update function to remove
|
|
53
|
+
*/
|
|
21
54
|
removeView(updateView) {
|
|
22
55
|
this.observerList.remove(updateView);
|
|
23
56
|
}
|
|
57
|
+
/**
|
|
58
|
+
* Updates the view model and notifies all registered views if the model has changed
|
|
59
|
+
* This method should be called by derived classes when the view model needs to be updated
|
|
60
|
+
*
|
|
61
|
+
* The method performs equality checking to prevent unnecessary updates when
|
|
62
|
+
* the new view model is equivalent to the previous one
|
|
63
|
+
*
|
|
64
|
+
* @param vm The new view model
|
|
65
|
+
*/
|
|
24
66
|
doUpdateView(vm) {
|
|
67
|
+
// Skip update if the view model hasn't changed
|
|
25
68
|
if (this._lastVM && this.vmsAreEqual(this._lastVM, vm)) {
|
|
26
69
|
return;
|
|
27
70
|
}
|
|
28
71
|
this._lastVM = vm;
|
|
29
72
|
this.observerList.notify(vm);
|
|
30
73
|
}
|
|
74
|
+
/**
|
|
75
|
+
* Cleans up resources and detaches this PM from its parent AppObject
|
|
76
|
+
*/
|
|
31
77
|
dispose() {
|
|
32
78
|
this.observerList.clear();
|
|
33
79
|
if (this.appObject.getComponent(this.type) === this) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AppObjectPM.js","sourceRoot":"","sources":["../../../src/AppObject/AppObjectPM.ts"],"names":[],"mappings":";;;AAAA,0CAA2C;AAC3C,6DAAkF;AAElF,MAAsB,WAAe,SAAQ,uCAAkB;IAA/D;;
|
|
1
|
+
{"version":3,"file":"AppObjectPM.js","sourceRoot":"","sources":["../../../src/AppObject/AppObjectPM.ts"],"names":[],"mappings":";;;AAAA,0CAA2C;AAC3C,6DAAkF;AAElF;;;;;;;;;;;;;;GAcG;AACH,MAAsB,WAAe,SAAQ,uCAAkB;IAA/D;;QACE,0DAA0D;QACjD,kBAAa,GAAG,2CAAsB,CAAC,EAAE,CAAC;QAuBnD,0EAA0E;QAClE,iBAAY,GAAG,IAAI,uBAAY,EAAK,CAAC;IAuD/C,CAAC;IAhEC;;;OAGG;IACH,IAAI,MAAM;QACR,OAAO,IAAI,CAAC,OAAO,CAAC;IACtB,CAAC;IAKD;;;;;OAKG;IACH,OAAO,CAAC,UAA2B;QACjC,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;QAElC,oEAAoE;QACpE,IAAI,IAAI,CAAC,OAAO,KAAK,SAAS,EAAE,CAAC;YAC/B,UAAU,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QAC3B,CAAC;IACH,CAAC;IAED;;;;OAIG;IACH,UAAU,CAAC,UAA2B;QACpC,IAAI,CAAC,YAAY,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;IACvC,CAAC;IAED;;;;;;;;OAQG;IACH,YAAY,CAAC,EAAK;QAChB,+CAA+C;QAC/C,IAAI,IAAI,CAAC,OAAO,IAAI,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,OAAO,EAAE,EAAE,CAAC,EAAE,CAAC;YACvD,OAAO;QACT,CAAC;QAED,IAAI,CAAC,OAAO,GAAG,EAAE,CAAC;QAClB,IAAI,CAAC,YAAY,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;IAC/B,CAAC;IAED;;OAEG;IACH,OAAO;QACL,IAAI,CAAC,YAAY,CAAC,KAAK,EAAE,CAAC;QAC1B,IAAI,IAAI,CAAC,SAAS,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,IAAI,EAAE,CAAC;YACpD,IAAI,CAAC,SAAS,CAAC,eAAe,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAC5C,CAAC;QACD,KAAK,CAAC,OAAO,EAAE,CAAC;IAClB,CAAC;CACF;AAjFD,kCAiFC","sourcesContent":["import { ObserverList } from \"../Entities\";\r\nimport { AppObjectComponent, AppObjectComponentType } from \"./AppObjectComponent\";\r\n\r\n/**\r\n * Presentation Manager (PM) component that transforms application state into view models\r\n * \r\n * AppObjectPM acts as a mediator between application state (entities) and views.\r\n * It transforms raw application data into a format that's optimized for presentation,\r\n * implementing the presentation model or MVVM pattern.\r\n * \r\n * A PM typically:\r\n * 1. Observes entity changes\r\n * 2. Transforms entity data into view models\r\n * 3. Notifies attached views when view models change\r\n * 4. Handles view model caching and optimization\r\n * \r\n * @typeparam T The view model type this PM produces\r\n */\r\nexport abstract class AppObjectPM<T> extends AppObjectComponent {\r\n /** Identifies this as a Presentation Manager component */\r\n readonly componentType = AppObjectComponentType.PM;\r\n \r\n /**\r\n * Compares two view models to determine if they're equivalent\r\n * Used to prevent unnecessary view updates when the view model hasn't changed\r\n * \r\n * @param a First view model to compare\r\n * @param b Second view model to compare\r\n * @returns True if the view models are considered equal, false otherwise\r\n */\r\n abstract vmsAreEqual(a: T, b: T): boolean;\r\n\r\n /** The most recently generated view model */\r\n private _lastVM?: T;\r\n \r\n /**\r\n * Gets the most recently generated view model\r\n * @returns The last view model or undefined if none has been generated\r\n */\r\n get lastVM(): T | undefined {\r\n return this._lastVM;\r\n }\r\n\r\n /** List of view update functions to notify when the view model changes */\r\n private observerList = new ObserverList<T>();\r\n\r\n /**\r\n * Registers a view update function to be called when the view model changes\r\n * If a view model already exists, the provided function is called immediately with that model\r\n * \r\n * @param updateView Function to call with updated view models\r\n */\r\n addView(updateView: (vm: T) => void): void {\r\n this.observerList.add(updateView);\r\n\r\n // Immediately update the view with current view model if one exists\r\n if (this._lastVM !== undefined) {\r\n updateView(this._lastVM);\r\n }\r\n }\r\n\r\n /**\r\n * Unregisters a previously added view update function\r\n * \r\n * @param updateView The view update function to remove\r\n */\r\n removeView(updateView: (vm: T) => void): void {\r\n this.observerList.remove(updateView);\r\n }\r\n\r\n /**\r\n * Updates the view model and notifies all registered views if the model has changed\r\n * This method should be called by derived classes when the view model needs to be updated\r\n * \r\n * The method performs equality checking to prevent unnecessary updates when\r\n * the new view model is equivalent to the previous one\r\n * \r\n * @param vm The new view model\r\n */\r\n doUpdateView(vm: T) {\r\n // Skip update if the view model hasn't changed\r\n if (this._lastVM && this.vmsAreEqual(this._lastVM, vm)) {\r\n return;\r\n }\r\n\r\n this._lastVM = vm;\r\n this.observerList.notify(vm);\r\n }\r\n\r\n /**\r\n * Cleans up resources and detaches this PM from its parent AppObject\r\n */\r\n dispose() {\r\n this.observerList.clear();\r\n if (this.appObject.getComponent(this.type) === this) {\r\n this.appObject.removeComponent(this.type);\r\n }\r\n super.dispose();\r\n }\r\n}\r\n"]}
|
|
@@ -4,12 +4,32 @@ exports.AppObjectRepo = void 0;
|
|
|
4
4
|
exports.makeAppObjectRepo = makeAppObjectRepo;
|
|
5
5
|
const Entities_1 = require("../Entities");
|
|
6
6
|
const AppObject_1 = require("./AppObject");
|
|
7
|
+
/**
|
|
8
|
+
* Abstract repository class for managing AppObjects and their components.
|
|
9
|
+
*
|
|
10
|
+
* This class provides the interface for storing, retrieving, and managing application
|
|
11
|
+
* objects, their components, and singletons. It also includes logging functionality
|
|
12
|
+
* and observer pattern implementation for tracking changes to the repository.
|
|
13
|
+
*
|
|
14
|
+
* @extends ObservableEntity
|
|
15
|
+
*/
|
|
7
16
|
class AppObjectRepo extends Entities_1.ObservableEntity {
|
|
8
17
|
}
|
|
9
18
|
exports.AppObjectRepo = AppObjectRepo;
|
|
19
|
+
/**
|
|
20
|
+
* Creates and returns a new AppObjectRepo instance.
|
|
21
|
+
*
|
|
22
|
+
* @returns {AppObjectRepo} A new AppObjectRepo instance
|
|
23
|
+
*/
|
|
10
24
|
function makeAppObjectRepo() {
|
|
11
25
|
return new AppObjectRepoImp();
|
|
12
26
|
}
|
|
27
|
+
/**
|
|
28
|
+
* Implementation of the AppObjectRepo abstract class.
|
|
29
|
+
*
|
|
30
|
+
* @private
|
|
31
|
+
* @extends AppObjectRepo
|
|
32
|
+
*/
|
|
13
33
|
class AppObjectRepoImp extends AppObjectRepo {
|
|
14
34
|
constructor() {
|
|
15
35
|
super(...arguments);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AppObjectRepo.js","sourceRoot":"","sources":["../../../src/AppObject/AppObjectRepo.ts"],"names":[],"mappings":";;;AA4CA,8CAEC;AA9CD,0CAA6D;AAC7D,2CAAuD;AAGvD,MAAsB,aAAc,SAAQ,2BAAgB;CAsC3D;AAtCD,sCAsCC;AAED,SAAgB,iBAAiB;IAC/B,OAAO,IAAI,gBAAgB,E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} from \"../Entities\";\r\nimport { AppObject, makeAppObject } from \"./AppObject\";\r\nimport { AppObjectComponent } from \"./AppObjectComponent\";\r\n\r\nexport abstract class AppObjectRepo extends ObservableEntity {\r\n abstract has(appObjectID: string): boolean;\r\n abstract add(appObject: AppObject): void;\r\n abstract remove(appObjectID: string): void;\r\n abstract get(appObjectID: string): AppObject | undefined;\r\n abstract getOrCreate(appObjectID: string): AppObject;\r\n abstract getAll(): AppObject[];\r\n\r\n abstract submitLog(sender: string, message: string): void;\r\n abstract submitWarning(sender: string, message: string): void;\r\n abstract submitError(sender: string, message: string): void;\r\n abstract submitFatal(sender: string, message: string): void;\r\n\r\n abstract registerSingleton(component: AppObjectComponent): void;\r\n abstract getSingleton<T extends AppObjectComponent>(\r\n type: string\r\n ): T | undefined;\r\n\r\n abstract getAppObjectComponent<T extends AppObjectComponent>(\r\n appObjectID: string,\r\n type: string\r\n ): T | undefined;\r\n abstract getAllAppObjectsWithComponent(componentType: string): AppObject[];\r\n abstract getAllComponents<T extends AppObjectComponent>(type: string): T[];\r\n\r\n abstract addAppObjectAddedObserver: (\r\n observer: (addedEntity: AppObject) => void\r\n ) => void;\r\n abstract removeAppObjectAddedObserver: (\r\n observer: (addedEntity: AppObject) => void\r\n ) => void;\r\n\r\n abstract addAppObjectRemovedObserver: (\r\n observer: (addedEntity: AppObject) => void\r\n ) => void;\r\n abstract removedAppObjectRemovedObserver: (\r\n observer: (addedEntity: AppObject) => void\r\n ) => void;\r\n}\r\n\r\nexport function makeAppObjectRepo(): AppObjectRepo {\r\n return new AppObjectRepoImp();\r\n}\r\n\r\nclass AppObjectRepoImp extends AppObjectRepo {\r\n private appObjectLookup = new Map<string, AppObject>();\r\n private singletons = new Map<string, AppObjectComponent>();\r\n\r\n private onAppObjectAddedObserver = new ObserverList<AppObject>();\r\n addAppObjectAddedObserver = (observer: (addedEntity: AppObject) => void) => {\r\n this.onAppObjectAddedObserver.add(observer);\r\n };\r\n removeAppObjectAddedObserver = (\r\n observer: (addedEntity: AppObject) => void\r\n ): void => {\r\n this.onAppObjectAddedObserver.remove(observer);\r\n };\r\n\r\n private onAppObjectRemovedObservers = new ObserverList<AppObject>();\r\n addAppObjectRemovedObserver = (\r\n observer: (removedEntity: AppObject) => void\r\n ) => {\r\n this.onAppObjectRemovedObservers.add(observer);\r\n };\r\n removedAppObjectRemovedObserver = (\r\n observer: (removedEntity: AppObject) => void\r\n ): void => {\r\n this.onAppObjectRemovedObservers.remove(observer);\r\n };\r\n\r\n has = (id: string): boolean => {\r\n return this.appObjectLookup.has(id);\r\n };\r\n\r\n add = (appObject: AppObject) => {\r\n const existing = this.appObjectLookup.get(appObject.id);\r\n if (existing) {\r\n existing.removeObserver(this.notify);\r\n }\r\n\r\n this.appObjectLookup.set(appObject.id, appObject);\r\n appObject.addObserver(this.notify);\r\n this.notify();\r\n this.onAppObjectAddedObserver.notify(appObject);\r\n };\r\n\r\n remove = (id: string) => {\r\n const existing = this.appObjectLookup.get(id);\r\n if (!existing) return;\r\n\r\n this.appObjectLookup.delete(id);\r\n existing.removeObserver(this.notify);\r\n this.notify();\r\n this.onAppObjectRemovedObservers.notify(existing);\r\n };\r\n\r\n get = (id: string): AppObject | undefined => {\r\n return this.appObjectLookup.get(id);\r\n };\r\n\r\n getOrCreate = (id: string): AppObject => {\r\n const existing = this.appObjectLookup.get(id);\r\n\r\n if (!existing) {\r\n return makeAppObject(id, this);\r\n } else {\r\n return existing;\r\n }\r\n };\r\n\r\n getAll = (): AppObject[] => {\r\n return Array.from(this.appObjectLookup.values());\r\n };\r\n\r\n getAllAppObjectsWithComponent(componentType: string): AppObject[] {\r\n const rArray: AppObject[] = [];\r\n\r\n this.appObjectLookup.forEach((appObj) => {\r\n if (appObj.hasComponent(componentType)) {\r\n rArray.push(appObj);\r\n }\r\n });\r\n\r\n return rArray;\r\n }\r\n\r\n getAllComponents<T extends AppObjectComponent>(type: string): T[] {\r\n const rArray: T[] = [];\r\n\r\n this.appObjectLookup.forEach((appObj) => {\r\n const aoEntity = appObj.getComponent(type);\r\n if (aoEntity) {\r\n rArray.push(aoEntity as T);\r\n }\r\n });\r\n\r\n return rArray;\r\n }\r\n\r\n getAppObjectComponent<T extends AppObjectComponent>(\r\n id: string,\r\n entityType: string\r\n ): T | undefined {\r\n const ao = this.appObjectLookup.get(id);\r\n if (!ao) {\r\n return undefined;\r\n }\r\n\r\n return ao.getComponent(entityType) as T;\r\n }\r\n\r\n submitLog(sender: string, message: string): void {\r\n console.log(`[${sender}]: ${message}`);\r\n }\r\n submitWarning(sender: string, message: string): void {\r\n console.warn(`[${sender}]: ${message}`);\r\n }\r\n submitError(sender: string, message: string): void {\r\n console.error(`[${sender}]: ${message}`);\r\n }\r\n submitFatal(sender: string, message: string): void {\r\n console.error(`FATAL ERROR - [${sender}]: ${message}`);\r\n }\r\n\r\n registerSingleton(component: AppObjectComponent): void {\r\n if (this.singletons.has(component.type)) {\r\n this.submitWarning(\r\n \"AppObjectRepo\",\r\n `Singleton for type ${component.type} already exists. Relpacing`\r\n );\r\n }\r\n\r\n this.singletons.set(component.type, component);\r\n }\r\n\r\n getSingleton<T extends AppObjectComponent>(type: string): T | undefined {\r\n if (this.singletons.has(type)) {\r\n return this.singletons.get(type) as T;\r\n }\r\n\r\n const components = this.getAllComponents<AppObjectComponent>(type);\r\n if (components.length === 1) {\r\n this.singletons.set(components[0].type, components[0]);\r\n return components[0] as T;\r\n } else if (components.length === 0) {\r\n this.submitWarning(\r\n \"AppObjectRepo\",\r\n `Unable to find a singleton for ${type}`\r\n );\r\n return undefined;\r\n } else if (components.length > 1) {\r\n this.submitWarning(\r\n \"AppObjectRepo\",\r\n `Multiple ${type} found. There should only be one if it truly a singleton. Using the first one`\r\n );\r\n return components[0] as T;\r\n }\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"AppObjectRepo.js","sourceRoot":"","sources":["../../../src/AppObject/AppObjectRepo.ts"],"names":[],"mappings":";;;AAqLA,8CAEC;AAvLD,0CAA6D;AAC7D,2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,IAAI,CAAC,aAAa,CAChB,eAAe,EACf,YAAY,IAAI,+EAA+E,CAChG,CAAC;YACF,OAAO,UAAU,CAAC,CAAC,CAAM,CAAC;QAC5B,CAAC;IACH,CAAC;CACF","sourcesContent":["import { ObservableEntity, ObserverList } from \"../Entities\";\r\nimport { AppObject, makeAppObject } from \"./AppObject\";\r\nimport { AppObjectComponent } from \"./AppObjectComponent\";\r\n\r\n/**\r\n * Abstract repository class for managing AppObjects and their components.\r\n *\r\n * This class provides the interface for storing, retrieving, and managing application\r\n * objects, their components, and singletons. It also includes logging functionality\r\n * and observer pattern implementation for tracking changes to the repository.\r\n *\r\n * @extends ObservableEntity\r\n */\r\nexport abstract class AppObjectRepo extends ObservableEntity {\r\n /**\r\n * Checks if an AppObject with the specified ID exists in the repository.\r\n *\r\n * @param {string} appObjectID - The ID of the AppObject to check\r\n * @returns {boolean} True if the AppObject exists, false otherwise\r\n */\r\n abstract has(appObjectID: string): boolean;\r\n\r\n /**\r\n * Adds an AppObject to the repository.\r\n *\r\n * @param {AppObject} appObject - The AppObject to add\r\n */\r\n abstract add(appObject: AppObject): void;\r\n\r\n /**\r\n * Removes an AppObject with the specified ID from the repository.\r\n *\r\n * @param {string} appObjectID - The ID of the AppObject to remove\r\n */\r\n abstract remove(appObjectID: string): void;\r\n\r\n /**\r\n * Gets an AppObject by its ID.\r\n *\r\n * @param {string} appObjectID - The ID of the AppObject to retrieve\r\n * @returns {AppObject | undefined} The AppObject if found, undefined otherwise\r\n */\r\n abstract get(appObjectID: string): AppObject | undefined;\r\n\r\n /**\r\n * Gets an AppObject by its ID, or creates a new one if it doesn't exist.\r\n *\r\n * @param {string} appObjectID - The ID of the AppObject to retrieve or create\r\n * @returns {AppObject} The existing or newly created AppObject\r\n */\r\n abstract getOrCreate(appObjectID: string): AppObject;\r\n\r\n /**\r\n * Gets all AppObjects in the repository.\r\n *\r\n * @returns {AppObject[]} An array of all AppObjects\r\n */\r\n abstract getAll(): AppObject[];\r\n\r\n /**\r\n * Logs an informational message.\r\n *\r\n * @param {string} sender - The identifier of the message sender\r\n * @param {string} message - The message to log\r\n */\r\n abstract submitLog(sender: string, message: string): void;\r\n\r\n /**\r\n * Logs a warning message.\r\n *\r\n * @param {string} sender - The identifier of the message sender\r\n * @param {string} message - The warning message to log\r\n */\r\n abstract submitWarning(sender: string, message: string): void;\r\n\r\n /**\r\n * Logs an error message.\r\n *\r\n * @param {string} sender - The identifier of the message sender\r\n * @param {string} message - The error message to log\r\n */\r\n abstract submitError(sender: string, message: string): void;\r\n\r\n /**\r\n * Logs a fatal error message.\r\n *\r\n * @param {string} sender - The identifier of the message sender\r\n * @param {string} message - The fatal error message to log\r\n */\r\n abstract submitFatal(sender: string, message: string): void;\r\n\r\n /**\r\n * Registers a component as a singleton in the repository.\r\n *\r\n * @param {AppObjectComponent} component - The component to register as a singleton\r\n */\r\n abstract registerSingleton(component: AppObjectComponent): void;\r\n\r\n /**\r\n * Gets a singleton component of the specified type.\r\n *\r\n * @template T - Type of the component to retrieve, must extend AppObjectComponent\r\n * @param {string} type - The type of the singleton to retrieve\r\n * @returns {T | undefined} The singleton component if found, undefined otherwise\r\n */\r\n abstract getSingleton<T extends AppObjectComponent>(\r\n type: string\r\n ): T | undefined;\r\n\r\n /**\r\n * Gets a component of the specified type from an AppObject.\r\n *\r\n * @template T - Type of the component to retrieve, must extend AppObjectComponent\r\n * @param {string} appObjectID - The ID of the AppObject containing the component\r\n * @param {string} type - The type of the component to retrieve\r\n * @returns {T | undefined} The component if found, undefined otherwise\r\n */\r\n abstract getAppObjectComponent<T extends AppObjectComponent>(\r\n appObjectID: string,\r\n type: string\r\n ): T | undefined;\r\n\r\n /**\r\n * Gets all AppObjects that have a component of the specified type.\r\n *\r\n * @param {string} componentType - The component type to filter by\r\n * @returns {AppObject[]} An array of AppObjects having the specified component type\r\n */\r\n abstract getAllAppObjectsWithComponent(componentType: string): AppObject[];\r\n\r\n /**\r\n * Gets all components of the specified type across all AppObjects.\r\n *\r\n * @template T - Type of the components to retrieve, must extend AppObjectComponent\r\n * @param {string} type - The type of components to retrieve\r\n * @returns {T[]} An array of all components of the specified type\r\n */\r\n abstract getAllComponents<T extends AppObjectComponent>(type: string): T[];\r\n\r\n /**\r\n * Adds an observer to be notified when an AppObject is added to the repository.\r\n *\r\n * @param {(addedEntity: AppObject) => void} observer - The observer function\r\n */\r\n abstract addAppObjectAddedObserver: (\r\n observer: (addedEntity: AppObject) => void\r\n ) => void;\r\n\r\n /**\r\n * Removes an observer previously registered for AppObject addition notifications.\r\n *\r\n * @param {(addedEntity: AppObject) => void} observer - The observer function to remove\r\n */\r\n abstract removeAppObjectAddedObserver: (\r\n observer: (addedEntity: AppObject) => void\r\n ) => void;\r\n\r\n /**\r\n * Adds an observer to be notified when an AppObject is removed from the repository.\r\n *\r\n * @param {(addedEntity: AppObject) => void} observer - The observer function\r\n */\r\n abstract addAppObjectRemovedObserver: (\r\n observer: (addedEntity: AppObject) => void\r\n ) => void;\r\n\r\n /**\r\n * Removes an observer previously registered for AppObject removal notifications.\r\n *\r\n * @param {(addedEntity: AppObject) => void} observer - The observer function to remove\r\n */\r\n abstract removedAppObjectRemovedObserver: (\r\n observer: (addedEntity: AppObject) => void\r\n ) => void;\r\n}\r\n\r\n/**\r\n * Creates and returns a new AppObjectRepo instance.\r\n *\r\n * @returns {AppObjectRepo} A new AppObjectRepo instance\r\n */\r\nexport function makeAppObjectRepo(): AppObjectRepo {\r\n return new AppObjectRepoImp();\r\n}\r\n\r\n/**\r\n * Implementation of the AppObjectRepo abstract class.\r\n *\r\n * @private\r\n * @extends AppObjectRepo\r\n */\r\nclass AppObjectRepoImp extends AppObjectRepo {\r\n private appObjectLookup = new Map<string, AppObject>();\r\n private singletons = new Map<string, AppObjectComponent>();\r\n\r\n private onAppObjectAddedObserver = new ObserverList<AppObject>();\r\n addAppObjectAddedObserver = (observer: (addedEntity: AppObject) => void) => {\r\n this.onAppObjectAddedObserver.add(observer);\r\n };\r\n removeAppObjectAddedObserver = (\r\n observer: (addedEntity: AppObject) => void\r\n ): void => {\r\n this.onAppObjectAddedObserver.remove(observer);\r\n };\r\n\r\n private onAppObjectRemovedObservers = new ObserverList<AppObject>();\r\n addAppObjectRemovedObserver = (\r\n observer: (removedEntity: AppObject) => void\r\n ) => {\r\n this.onAppObjectRemovedObservers.add(observer);\r\n };\r\n removedAppObjectRemovedObserver = (\r\n observer: (removedEntity: AppObject) => void\r\n ): void => {\r\n this.onAppObjectRemovedObservers.remove(observer);\r\n };\r\n\r\n has = (id: string): boolean => {\r\n return this.appObjectLookup.has(id);\r\n };\r\n\r\n add = (appObject: AppObject) => {\r\n const existing = this.appObjectLookup.get(appObject.id);\r\n if (existing) {\r\n existing.removeObserver(this.notify);\r\n }\r\n\r\n this.appObjectLookup.set(appObject.id, appObject);\r\n appObject.addObserver(this.notify);\r\n this.notify();\r\n this.onAppObjectAddedObserver.notify(appObject);\r\n };\r\n\r\n remove = (id: string) => {\r\n const existing = this.appObjectLookup.get(id);\r\n if (!existing) return;\r\n\r\n this.appObjectLookup.delete(id);\r\n existing.removeObserver(this.notify);\r\n this.notify();\r\n this.onAppObjectRemovedObservers.notify(existing);\r\n };\r\n\r\n get = (id: string): AppObject | undefined => {\r\n return this.appObjectLookup.get(id);\r\n };\r\n\r\n getOrCreate = (id: string): AppObject => {\r\n const existing = this.appObjectLookup.get(id);\r\n\r\n if (!existing) {\r\n return makeAppObject(id, this);\r\n } else {\r\n return existing;\r\n }\r\n };\r\n\r\n getAll = (): AppObject[] => {\r\n return Array.from(this.appObjectLookup.values());\r\n };\r\n\r\n getAllAppObjectsWithComponent(componentType: string): AppObject[] {\r\n const rArray: AppObject[] = [];\r\n\r\n this.appObjectLookup.forEach((appObj) => {\r\n if (appObj.hasComponent(componentType)) {\r\n rArray.push(appObj);\r\n }\r\n });\r\n\r\n return rArray;\r\n }\r\n\r\n getAllComponents<T extends AppObjectComponent>(type: string): T[] {\r\n const rArray: T[] = [];\r\n\r\n this.appObjectLookup.forEach((appObj) => {\r\n const aoEntity = appObj.getComponent(type);\r\n if (aoEntity) {\r\n rArray.push(aoEntity as T);\r\n }\r\n });\r\n\r\n return rArray;\r\n }\r\n\r\n getAppObjectComponent<T extends AppObjectComponent>(\r\n id: string,\r\n entityType: string\r\n ): T | undefined {\r\n const ao = this.appObjectLookup.get(id);\r\n if (!ao) {\r\n return undefined;\r\n }\r\n\r\n return ao.getComponent(entityType) as T;\r\n }\r\n\r\n submitLog(sender: string, message: string): void {\r\n console.log(`[${sender}]: ${message}`);\r\n }\r\n submitWarning(sender: string, message: string): void {\r\n console.warn(`[${sender}]: ${message}`);\r\n }\r\n submitError(sender: string, message: string): void {\r\n console.error(`[${sender}]: ${message}`);\r\n }\r\n submitFatal(sender: string, message: string): void {\r\n console.error(`FATAL ERROR - [${sender}]: ${message}`);\r\n }\r\n\r\n registerSingleton(component: AppObjectComponent): void {\r\n if (this.singletons.has(component.type)) {\r\n this.submitWarning(\r\n \"AppObjectRepo\",\r\n `Singleton for type ${component.type} already exists. Relpacing`\r\n );\r\n }\r\n\r\n this.singletons.set(component.type, component);\r\n }\r\n\r\n getSingleton<T extends AppObjectComponent>(type: string): T | undefined {\r\n if (this.singletons.has(type)) {\r\n return this.singletons.get(type) as T;\r\n }\r\n\r\n const components = this.getAllComponents<AppObjectComponent>(type);\r\n if (components.length === 1) {\r\n this.singletons.set(components[0].type, components[0]);\r\n return components[0] as T;\r\n } else if (components.length === 0) {\r\n this.submitWarning(\r\n \"AppObjectRepo\",\r\n `Unable to find a singleton for ${type}`\r\n );\r\n return undefined;\r\n } else if (components.length > 1) {\r\n this.submitWarning(\r\n \"AppObjectRepo\",\r\n `Multiple ${type} found. There should only be one if it truly a singleton. Using the first one`\r\n );\r\n return components[0] as T;\r\n }\r\n }\r\n}\r\n"]}
|
|
@@ -2,9 +2,32 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.AppObjectUC = void 0;
|
|
4
4
|
const AppObjectComponent_1 = require("./AppObjectComponent");
|
|
5
|
+
/**
|
|
6
|
+
* AppObjectUC (Use Case) serves as a base use case class within the application framework.
|
|
7
|
+
*
|
|
8
|
+
* Use Cases are components that represent specific application operations or workflows.
|
|
9
|
+
* They encapsulate business rules and coordinate interactions between different parts
|
|
10
|
+
* of the application. Extend this class to implement specific use case scenarios.
|
|
11
|
+
*
|
|
12
|
+
* @extends AppObjectComponent
|
|
13
|
+
* @example
|
|
14
|
+
* ```typescript
|
|
15
|
+
* class PurchaseItemUC extends AppObjectUC {
|
|
16
|
+
* execute(itemId: string, quantity: number): boolean {
|
|
17
|
+
* // Implement the purchase item use case
|
|
18
|
+
* return true; // if successful
|
|
19
|
+
* }
|
|
20
|
+
* }
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
5
23
|
class AppObjectUC extends AppObjectComponent_1.AppObjectComponent {
|
|
6
24
|
constructor() {
|
|
7
25
|
super(...arguments);
|
|
26
|
+
/**
|
|
27
|
+
* The component type identifier used to categorize this component as a use case
|
|
28
|
+
* This property helps the component system identify and manage use case components.
|
|
29
|
+
* @readonly
|
|
30
|
+
*/
|
|
8
31
|
this.componentType = AppObjectComponent_1.AppObjectComponentType.UC;
|
|
9
32
|
}
|
|
10
33
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AppObjectUC.js","sourceRoot":"","sources":["../../../src/AppObject/AppObjectUC.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"AppObjectUC.js","sourceRoot":"","sources":["../../../src/AppObject/AppObjectUC.ts"],"names":[],"mappings":";;;AAAA,6DAG8B;AAE9B;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAa,WAAY,SAAQ,uCAAkB;IAAnD;;QACE;;;;WAIG;QACM,kBAAa,GAAG,2CAAsB,CAAC,EAAE,CAAC;IACrD,CAAC;CAAA;AAPD,kCAOC","sourcesContent":["import {\r\n AppObjectComponent,\r\n AppObjectComponentType,\r\n} from \"./AppObjectComponent\";\r\n\r\n/**\r\n * AppObjectUC (Use Case) serves as a base use case class within the application framework.\r\n *\r\n * Use Cases are components that represent specific application operations or workflows.\r\n * They encapsulate business rules and coordinate interactions between different parts\r\n * of the application. Extend this class to implement specific use case scenarios.\r\n *\r\n * @extends AppObjectComponent\r\n * @example\r\n * ```typescript\r\n * class PurchaseItemUC extends AppObjectUC {\r\n * execute(itemId: string, quantity: number): boolean {\r\n * // Implement the purchase item use case\r\n * return true; // if successful\r\n * }\r\n * }\r\n * ```\r\n */\r\nexport class AppObjectUC extends AppObjectComponent {\r\n /**\r\n * The component type identifier used to categorize this component as a use case\r\n * This property helps the component system identify and manage use case components.\r\n * @readonly\r\n */\r\n readonly componentType = AppObjectComponentType.UC;\r\n}\r\n"]}
|
|
@@ -2,9 +2,31 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.AppObjectView = void 0;
|
|
4
4
|
const AppObjectComponent_1 = require("./AppObjectComponent");
|
|
5
|
+
/**
|
|
6
|
+
* AppObjectView serves as a base view class within the application framework.
|
|
7
|
+
*
|
|
8
|
+
* Views are components that handle the visual representation of an AppObject,
|
|
9
|
+
* such as rendering, animations, or user interface elements. Extend this class
|
|
10
|
+
* to create custom visual representations for specific application objects.
|
|
11
|
+
*
|
|
12
|
+
* @extends AppObjectComponent
|
|
13
|
+
* @example
|
|
14
|
+
* ```typescript
|
|
15
|
+
* class PlayerView extends AppObjectView {
|
|
16
|
+
* render(renderContext: RenderContext) {
|
|
17
|
+
* // Render the player character on screen
|
|
18
|
+
* }
|
|
19
|
+
* }
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
5
22
|
class AppObjectView extends AppObjectComponent_1.AppObjectComponent {
|
|
6
23
|
constructor() {
|
|
7
24
|
super(...arguments);
|
|
25
|
+
/**
|
|
26
|
+
* The component type identifier used to categorize this component as a view
|
|
27
|
+
* This property helps the component system identify and manage view components.
|
|
28
|
+
* @readonly
|
|
29
|
+
*/
|
|
8
30
|
this.componentType = AppObjectComponent_1.AppObjectComponentType.VIEW;
|
|
9
31
|
}
|
|
10
32
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AppObjectView.js","sourceRoot":"","sources":["../../../src/AppObject/AppObjectView.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"AppObjectView.js","sourceRoot":"","sources":["../../../src/AppObject/AppObjectView.ts"],"names":[],"mappings":";;;AAAA,6DAG8B;AAE9B;;;;;;;;;;;;;;;;GAgBG;AACH,MAAa,aAAc,SAAQ,uCAAkB;IAArD;;QACE;;;;WAIG;QACM,kBAAa,GAAG,2CAAsB,CAAC,IAAI,CAAC;IACvD,CAAC;CAAA;AAPD,sCAOC","sourcesContent":["import {\r\n AppObjectComponent,\r\n AppObjectComponentType,\r\n} from \"./AppObjectComponent\";\r\n\r\n/**\r\n * AppObjectView serves as a base view class within the application framework.\r\n *\r\n * Views are components that handle the visual representation of an AppObject,\r\n * such as rendering, animations, or user interface elements. Extend this class\r\n * to create custom visual representations for specific application objects.\r\n *\r\n * @extends AppObjectComponent\r\n * @example\r\n * ```typescript\r\n * class PlayerView extends AppObjectView {\r\n * render(renderContext: RenderContext) {\r\n * // Render the player character on screen\r\n * }\r\n * }\r\n * ```\r\n */\r\nexport class AppObjectView extends AppObjectComponent {\r\n /**\r\n * The component type identifier used to categorize this component as a view\r\n * This property helps the component system identify and manage view components.\r\n * @readonly\r\n */\r\n readonly componentType = AppObjectComponentType.VIEW;\r\n}\r\n"]}
|
|
@@ -1,6 +1,25 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getSingletonComponent = getSingletonComponent;
|
|
4
|
+
/**
|
|
5
|
+
* Retrieves a singleton component of the specified type from the application objects repository.
|
|
6
|
+
*
|
|
7
|
+
* This utility function provides a convenient way to access singleton components that should
|
|
8
|
+
* have only one instance across the entire application.
|
|
9
|
+
*
|
|
10
|
+
* @template T - Type of the component to retrieve, must extend AppObjectComponent
|
|
11
|
+
* @param {string} type - The type identifier of the component to retrieve
|
|
12
|
+
* @param {AppObjectRepo} appObjects - The repository containing all application objects
|
|
13
|
+
* @returns {T | undefined} The singleton component instance if found, otherwise undefined
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```typescript
|
|
17
|
+
* const cameraController = getSingletonComponent<CameraController>(CameraController.type, appObjectRepo);
|
|
18
|
+
* if (cameraController) {
|
|
19
|
+
* cameraController.focusOn(targetObject);
|
|
20
|
+
* }
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
4
23
|
function getSingletonComponent(type, appObjects) {
|
|
5
24
|
return appObjects.getSingleton(type);
|
|
6
25
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getSingletonComponent.js","sourceRoot":"","sources":["../../../src/AppObject/getSingletonComponent.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"getSingletonComponent.js","sourceRoot":"","sources":["../../../src/AppObject/getSingletonComponent.ts"],"names":[],"mappings":";;AAsBA,sDAKC;AAxBD;;;;;;;;;;;;;;;;;;GAkBG;AACH,SAAgB,qBAAqB,CACnC,IAAY,EACZ,UAAyB;IAEzB,OAAO,UAAU,CAAC,YAAY,CAAI,IAAI,CAAC,CAAC;AAC1C,CAAC","sourcesContent":["import { AppObjectComponent } from \"./AppObjectComponent\";\r\nimport { AppObjectRepo } from \"./AppObjectRepo\";\r\n\r\n/**\r\n * Retrieves a singleton component of the specified type from the application objects repository.\r\n *\r\n * This utility function provides a convenient way to access singleton components that should\r\n * have only one instance across the entire application.\r\n *\r\n * @template T - Type of the component to retrieve, must extend AppObjectComponent\r\n * @param {string} type - The type identifier of the component to retrieve\r\n * @param {AppObjectRepo} appObjects - The repository containing all application objects\r\n * @returns {T | undefined} The singleton component instance if found, otherwise undefined\r\n *\r\n * @example\r\n * ```typescript\r\n * const cameraController = getSingletonComponent<CameraController>(CameraController.type, appObjectRepo);\r\n * if (cameraController) {\r\n * cameraController.focusOn(targetObject);\r\n * }\r\n * ```\r\n */\r\nexport function getSingletonComponent<T extends AppObjectComponent>(\r\n type: string,\r\n appObjects: AppObjectRepo\r\n): T | undefined {\r\n return appObjects.getSingleton<T>(type);\r\n}\r\n"]}
|
|
@@ -1,19 +1,40 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.MemoizedAngle = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* A wrapper class for Angle objects that tracks changes and triggers callbacks.
|
|
6
|
+
* Only triggers the callback when the angle value actually changes.
|
|
7
|
+
*/
|
|
4
8
|
class MemoizedAngle {
|
|
9
|
+
/**
|
|
10
|
+
* Gets the current angle value
|
|
11
|
+
*/
|
|
5
12
|
get val() {
|
|
6
13
|
return this._val;
|
|
7
14
|
}
|
|
15
|
+
/**
|
|
16
|
+
* Sets the angle value and triggers the onChange callback if the value changed
|
|
17
|
+
* @param b - The new Angle value
|
|
18
|
+
*/
|
|
8
19
|
set val(b) {
|
|
9
20
|
if (this._val.degrees === b.degrees)
|
|
10
21
|
return;
|
|
11
22
|
this._val = b;
|
|
12
23
|
this.onChangeCallback();
|
|
13
24
|
}
|
|
25
|
+
/**
|
|
26
|
+
* Sets the value without triggering the onChange callback
|
|
27
|
+
* @param val - The new Angle value
|
|
28
|
+
*/
|
|
14
29
|
setValQuietly(val) {
|
|
15
30
|
this._val = val;
|
|
16
31
|
}
|
|
32
|
+
/**
|
|
33
|
+
* Creates a new MemoizedAngle instance
|
|
34
|
+
*
|
|
35
|
+
* @param initialValue - The initial Angle value
|
|
36
|
+
* @param onChangeCallback - Function to call when the value changes
|
|
37
|
+
*/
|
|
17
38
|
constructor(initialValue, onChangeCallback) {
|
|
18
39
|
this._val = initialValue;
|
|
19
40
|
this.onChangeCallback = onChangeCallback;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MemoizedAngle.js","sourceRoot":"","sources":["../../../src/Entities/MemoizedAngle.ts"],"names":[],"mappings":";;;AAEA,MAAa,aAAa;
|
|
1
|
+
{"version":3,"file":"MemoizedAngle.js","sourceRoot":"","sources":["../../../src/Entities/MemoizedAngle.ts"],"names":[],"mappings":";;;AAEA;;;GAGG;AACH,MAAa,aAAa;IAGxB;;OAEG;IACH,IAAI,GAAG;QACL,OAAO,IAAI,CAAC,IAAI,CAAC;IACnB,CAAC;IAED;;;OAGG;IACH,IAAI,GAAG,CAAC,CAAQ;QACd,IAAI,IAAI,CAAC,IAAI,CAAC,OAAO,KAAK,CAAC,CAAC,OAAO;YAAE,OAAO;QAE5C,IAAI,CAAC,IAAI,GAAG,CAAC,CAAC;QACd,IAAI,CAAC,gBAAgB,EAAE,CAAC;IAC1B,CAAC;IAED;;;OAGG;IACI,aAAa,CAAC,GAAU;QAC7B,IAAI,CAAC,IAAI,GAAG,GAAG,CAAC;IAClB,CAAC;IAID;;;;;OAKG;IACH,YAAY,YAAmB,EAAE,gBAA4B;QAC3D,IAAI,CAAC,IAAI,GAAG,YAAY,CAAC;QACzB,IAAI,CAAC,gBAAgB,GAAG,gBAAgB,CAAC;IAC3C,CAAC;CACF;AAzCD,sCAyCC","sourcesContent":["import { Angle } from \"../ValueObjects\";\r\n\r\n/**\r\n * A wrapper class for Angle objects that tracks changes and triggers callbacks.\r\n * Only triggers the callback when the angle value actually changes.\r\n */\r\nexport class MemoizedAngle {\r\n private _val: Angle;\r\n\r\n /**\r\n * Gets the current angle value\r\n */\r\n get val(): Angle {\r\n return this._val;\r\n }\r\n\r\n /**\r\n * Sets the angle value and triggers the onChange callback if the value changed\r\n * @param b - The new Angle value\r\n */\r\n set val(b: Angle) {\r\n if (this._val.degrees === b.degrees) return;\r\n\r\n this._val = b;\r\n this.onChangeCallback();\r\n }\r\n\r\n /**\r\n * Sets the value without triggering the onChange callback\r\n * @param val - The new Angle value\r\n */\r\n public setValQuietly(val: Angle) {\r\n this._val = val;\r\n }\r\n\r\n private onChangeCallback: () => void;\r\n\r\n /**\r\n * Creates a new MemoizedAngle instance\r\n *\r\n * @param initialValue - The initial Angle value\r\n * @param onChangeCallback - Function to call when the value changes\r\n */\r\n constructor(initialValue: Angle, onChangeCallback: () => void) {\r\n this._val = initialValue;\r\n this.onChangeCallback = onChangeCallback;\r\n }\r\n}\r\n"]}
|
|
@@ -1,19 +1,40 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.MemoizedBoolean = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* A wrapper class for boolean values that tracks changes and triggers callbacks.
|
|
6
|
+
* Only triggers the callback when the value actually changes.
|
|
7
|
+
*/
|
|
4
8
|
class MemoizedBoolean {
|
|
9
|
+
/**
|
|
10
|
+
* Gets the current boolean value
|
|
11
|
+
*/
|
|
5
12
|
get val() {
|
|
6
13
|
return this._val;
|
|
7
14
|
}
|
|
15
|
+
/**
|
|
16
|
+
* Sets the boolean value and triggers the onChange callback if the value changed
|
|
17
|
+
* @param b - The new boolean value
|
|
18
|
+
*/
|
|
8
19
|
set val(b) {
|
|
9
20
|
if (this._val === b)
|
|
10
21
|
return;
|
|
11
22
|
this._val = b;
|
|
12
23
|
this.onChangeCallback();
|
|
13
24
|
}
|
|
25
|
+
/**
|
|
26
|
+
* Sets the value without triggering the onChange callback
|
|
27
|
+
* @param val - The new boolean value
|
|
28
|
+
*/
|
|
14
29
|
setValQuietly(val) {
|
|
15
30
|
this._val = val;
|
|
16
31
|
}
|
|
32
|
+
/**
|
|
33
|
+
* Creates a new MemoizedBoolean instance
|
|
34
|
+
*
|
|
35
|
+
* @param initialValue - The initial boolean value
|
|
36
|
+
* @param onChangeCallback - Function to call when the value changes
|
|
37
|
+
*/
|
|
17
38
|
constructor(initialValue, onChangeCallback) {
|
|
18
39
|
this._val = initialValue;
|
|
19
40
|
this.onChangeCallback = onChangeCallback;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MemoizedBoolean.js","sourceRoot":"","sources":["../../../src/Entities/MemoizedBoolean.ts"],"names":[],"mappings":";;;AAAA,MAAa,eAAe;
|
|
1
|
+
{"version":3,"file":"MemoizedBoolean.js","sourceRoot":"","sources":["../../../src/Entities/MemoizedBoolean.ts"],"names":[],"mappings":";;;AAAA;;;GAGG;AACH,MAAa,eAAe;IAG1B;;OAEG;IACH,IAAI,GAAG;QACL,OAAO,IAAI,CAAC,IAAI,CAAC;IACnB,CAAC;IAED;;;OAGG;IACH,IAAI,GAAG,CAAC,CAAU;QAChB,IAAI,IAAI,CAAC,IAAI,KAAK,CAAC;YAAE,OAAO;QAE5B,IAAI,CAAC,IAAI,GAAG,CAAC,CAAC;QACd,IAAI,CAAC,gBAAgB,EAAE,CAAC;IAC1B,CAAC;IAED;;;OAGG;IACI,aAAa,CAAC,GAAY;QAC/B,IAAI,CAAC,IAAI,GAAG,GAAG,CAAC;IAClB,CAAC;IAID;;;;;OAKG;IACH,YAAY,YAAqB,EAAE,gBAA4B;QAC7D,IAAI,CAAC,IAAI,GAAG,YAAY,CAAC;QACzB,IAAI,CAAC,gBAAgB,GAAG,gBAAgB,CAAC;IAC3C,CAAC;CACF;AAzCD,0CAyCC","sourcesContent":["/**\r\n * A wrapper class for boolean values that tracks changes and triggers callbacks.\r\n * Only triggers the callback when the value actually changes.\r\n */\r\nexport class MemoizedBoolean {\r\n private _val: boolean;\r\n\r\n /**\r\n * Gets the current boolean value\r\n */\r\n get val(): boolean {\r\n return this._val;\r\n }\r\n\r\n /**\r\n * Sets the boolean value and triggers the onChange callback if the value changed\r\n * @param b - The new boolean value\r\n */\r\n set val(b: boolean) {\r\n if (this._val === b) return;\r\n\r\n this._val = b;\r\n this.onChangeCallback();\r\n }\r\n\r\n /**\r\n * Sets the value without triggering the onChange callback\r\n * @param val - The new boolean value\r\n */\r\n public setValQuietly(val: boolean) {\r\n this._val = val;\r\n }\r\n\r\n private onChangeCallback: () => void;\r\n\r\n /**\r\n * Creates a new MemoizedBoolean instance\r\n *\r\n * @param initialValue - The initial boolean value\r\n * @param onChangeCallback - Function to call when the value changes\r\n */\r\n constructor(initialValue: boolean, onChangeCallback: () => void) {\r\n this._val = initialValue;\r\n this.onChangeCallback = onChangeCallback;\r\n }\r\n}\r\n"]}
|
|
@@ -2,19 +2,40 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.MemoizedColor = void 0;
|
|
4
4
|
const ValueObjects_1 = require("../ValueObjects");
|
|
5
|
+
/**
|
|
6
|
+
* A wrapper class for Color objects that tracks changes and triggers callbacks.
|
|
7
|
+
* Only triggers the callback when the color value actually changes.
|
|
8
|
+
*/
|
|
5
9
|
class MemoizedColor {
|
|
10
|
+
/**
|
|
11
|
+
* Gets the current Color value
|
|
12
|
+
*/
|
|
6
13
|
get val() {
|
|
7
14
|
return this._val;
|
|
8
15
|
}
|
|
16
|
+
/**
|
|
17
|
+
* Sets the Color value and triggers the onChange callback if the value changed
|
|
18
|
+
* @param v - The new Color value
|
|
19
|
+
*/
|
|
9
20
|
set val(v) {
|
|
10
21
|
if (ValueObjects_1.Color.Equal(v, this._val))
|
|
11
22
|
return;
|
|
12
23
|
this._val = v;
|
|
13
24
|
this.onChangeCallback();
|
|
14
25
|
}
|
|
26
|
+
/**
|
|
27
|
+
* Sets the value without triggering the onChange callback
|
|
28
|
+
* @param val - The new Color value
|
|
29
|
+
*/
|
|
15
30
|
setValQuietly(val) {
|
|
16
31
|
this._val = val;
|
|
17
32
|
}
|
|
33
|
+
/**
|
|
34
|
+
* Creates a new MemoizedColor instance
|
|
35
|
+
*
|
|
36
|
+
* @param initialValue - The initial Color value
|
|
37
|
+
* @param onChangeCallback - Function to call when the value changes
|
|
38
|
+
*/
|
|
18
39
|
constructor(initialValue, onChangeCallback) {
|
|
19
40
|
this._val = initialValue;
|
|
20
41
|
this.onChangeCallback = onChangeCallback;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MemoizedColor.js","sourceRoot":"","sources":["../../../src/Entities/MemoizedColor.ts"],"names":[],"mappings":";;;AAAA,kDAAwC;AAExC,MAAa,aAAa;IAGxB,IAAI,GAAG;QACL,OAAO,IAAI,CAAC,IAAI,CAAC;IACnB,CAAC;IAED,IAAI,GAAG,CAAC,CAAQ;QACd,IAAI,oBAAK,CAAC,KAAK,CAAC,CAAC,EAAE,IAAI,CAAC,IAAI,CAAC;YAAE,OAAO;QAEtC,IAAI,CAAC,IAAI,GAAG,CAAC,CAAC;QACd,IAAI,CAAC,gBAAgB,EAAE,CAAC;IAC1B,CAAC;
|
|
1
|
+
{"version":3,"file":"MemoizedColor.js","sourceRoot":"","sources":["../../../src/Entities/MemoizedColor.ts"],"names":[],"mappings":";;;AAAA,kDAAwC;AAExC;;;GAGG;AACH,MAAa,aAAa;IAGxB;;OAEG;IACH,IAAI,GAAG;QACL,OAAO,IAAI,CAAC,IAAI,CAAC;IACnB,CAAC;IAED;;;OAGG;IACH,IAAI,GAAG,CAAC,CAAQ;QACd,IAAI,oBAAK,CAAC,KAAK,CAAC,CAAC,EAAE,IAAI,CAAC,IAAI,CAAC;YAAE,OAAO;QAEtC,IAAI,CAAC,IAAI,GAAG,CAAC,CAAC;QACd,IAAI,CAAC,gBAAgB,EAAE,CAAC;IAC1B,CAAC;IAED;;;OAGG;IACI,aAAa,CAAC,GAAU;QAC7B,IAAI,CAAC,IAAI,GAAG,GAAG,CAAC;IAClB,CAAC;IAID;;;;;OAKG;IACH,YAAY,YAAmB,EAAE,gBAA4B;QAC3D,IAAI,CAAC,IAAI,GAAG,YAAY,CAAC;QACzB,IAAI,CAAC,gBAAgB,GAAG,gBAAgB,CAAC;IAC3C,CAAC;CACF;AAzCD,sCAyCC","sourcesContent":["import { Color } from \"../ValueObjects\";\r\n\r\n/**\r\n * A wrapper class for Color objects that tracks changes and triggers callbacks.\r\n * Only triggers the callback when the color value actually changes.\r\n */\r\nexport class MemoizedColor {\r\n private _val: Color;\r\n\r\n /**\r\n * Gets the current Color value\r\n */\r\n get val(): Color {\r\n return this._val;\r\n }\r\n\r\n /**\r\n * Sets the Color value and triggers the onChange callback if the value changed\r\n * @param v - The new Color value\r\n */\r\n set val(v: Color) {\r\n if (Color.Equal(v, this._val)) return;\r\n\r\n this._val = v;\r\n this.onChangeCallback();\r\n }\r\n\r\n /**\r\n * Sets the value without triggering the onChange callback\r\n * @param val - The new Color value\r\n */\r\n public setValQuietly(val: Color) {\r\n this._val = val;\r\n }\r\n\r\n private onChangeCallback: () => void;\r\n\r\n /**\r\n * Creates a new MemoizedColor instance\r\n *\r\n * @param initialValue - The initial Color value\r\n * @param onChangeCallback - Function to call when the value changes\r\n */\r\n constructor(initialValue: Color, onChangeCallback: () => void) {\r\n this._val = initialValue;\r\n this.onChangeCallback = onChangeCallback;\r\n }\r\n}\r\n"]}
|