@vived/core 1.4.2 → 1.4.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/README.md +142 -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/ExampleFeature/Adapters/examplePmAdapter.js +64 -0
- package/dist/cjs/ExampleFeature/Adapters/examplePmAdapter.js.map +1 -0
- package/dist/cjs/ExampleFeature/Adapters/exampleSingletonPmAdapter.js +60 -0
- package/dist/cjs/ExampleFeature/Adapters/exampleSingletonPmAdapter.js.map +1 -0
- package/dist/cjs/ExampleFeature/Adapters/index.js +19 -0
- package/dist/cjs/ExampleFeature/Adapters/index.js.map +1 -0
- package/dist/cjs/ExampleFeature/Controllers/index.js +19 -0
- package/dist/cjs/ExampleFeature/Controllers/index.js.map +1 -0
- package/dist/cjs/ExampleFeature/Controllers/setExampleText.js +48 -0
- package/dist/cjs/ExampleFeature/Controllers/setExampleText.js.map +1 -0
- package/dist/cjs/ExampleFeature/Controllers/toggleExampleBoolean.js +47 -0
- package/dist/cjs/ExampleFeature/Controllers/toggleExampleBoolean.js.map +1 -0
- package/dist/cjs/ExampleFeature/Entities/ExampleEntity.js +90 -0
- package/dist/cjs/ExampleFeature/Entities/ExampleEntity.js.map +1 -0
- package/dist/cjs/ExampleFeature/Entities/ExampleRepo.js +113 -0
- package/dist/cjs/ExampleFeature/Entities/ExampleRepo.js.map +1 -0
- package/dist/cjs/ExampleFeature/Entities/ExampleSingletonEntity.js +69 -0
- package/dist/cjs/ExampleFeature/Entities/ExampleSingletonEntity.js.map +1 -0
- package/dist/cjs/ExampleFeature/Entities/index.js +20 -0
- package/dist/cjs/ExampleFeature/Entities/index.js.map +1 -0
- package/dist/cjs/ExampleFeature/Factory/index.js +18 -0
- package/dist/cjs/ExampleFeature/Factory/index.js.map +1 -0
- package/dist/cjs/ExampleFeature/Factory/setupExampleFeature.js +29 -0
- package/dist/cjs/ExampleFeature/Factory/setupExampleFeature.js.map +1 -0
- package/dist/cjs/ExampleFeature/Mocks/MockEditExampleStringUC.js +47 -0
- package/dist/cjs/ExampleFeature/Mocks/MockEditExampleStringUC.js.map +1 -0
- package/dist/cjs/ExampleFeature/Mocks/MockExamplePM.js +48 -0
- package/dist/cjs/ExampleFeature/Mocks/MockExamplePM.js.map +1 -0
- package/dist/cjs/ExampleFeature/Mocks/MockExampleSingletonPM.js +59 -0
- package/dist/cjs/ExampleFeature/Mocks/MockExampleSingletonPM.js.map +1 -0
- package/dist/cjs/ExampleFeature/Mocks/MockToggleExampleBooleanUC.js +57 -0
- package/dist/cjs/ExampleFeature/Mocks/MockToggleExampleBooleanUC.js.map +1 -0
- package/dist/cjs/ExampleFeature/Mocks/index.js +21 -0
- package/dist/cjs/ExampleFeature/Mocks/index.js.map +1 -0
- package/dist/cjs/ExampleFeature/PMs/ExamplePM.js +97 -0
- package/dist/cjs/ExampleFeature/PMs/ExamplePM.js.map +1 -0
- package/dist/cjs/ExampleFeature/PMs/ExampleSingletonPM.js +102 -0
- package/dist/cjs/ExampleFeature/PMs/ExampleSingletonPM.js.map +1 -0
- package/dist/cjs/ExampleFeature/PMs/index.js +19 -0
- package/dist/cjs/ExampleFeature/PMs/index.js.map +1 -0
- package/dist/cjs/ExampleFeature/UCs/EditExampleStringUC.js +87 -0
- package/dist/cjs/ExampleFeature/UCs/EditExampleStringUC.js.map +1 -0
- package/dist/cjs/ExampleFeature/UCs/ToggleExampleBooleanUC.js +79 -0
- package/dist/cjs/ExampleFeature/UCs/ToggleExampleBooleanUC.js.map +1 -0
- package/dist/cjs/ExampleFeature/UCs/index.js +19 -0
- package/dist/cjs/ExampleFeature/UCs/index.js.map +1 -0
- package/dist/cjs/ExampleFeature/index.js +24 -0
- package/dist/cjs/ExampleFeature/index.js.map +1 -0
- 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/cjs/index.js +1 -0
- package/dist/cjs/index.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/ExampleFeature/Adapters/examplePmAdapter.js +61 -0
- package/dist/esm/ExampleFeature/Adapters/examplePmAdapter.js.map +1 -0
- package/dist/esm/ExampleFeature/Adapters/exampleSingletonPmAdapter.js +57 -0
- package/dist/esm/ExampleFeature/Adapters/exampleSingletonPmAdapter.js.map +1 -0
- package/dist/esm/ExampleFeature/Adapters/index.js +3 -0
- package/dist/esm/ExampleFeature/Adapters/index.js.map +1 -0
- package/dist/esm/ExampleFeature/Controllers/index.js +3 -0
- package/dist/esm/ExampleFeature/Controllers/index.js.map +1 -0
- package/dist/esm/ExampleFeature/Controllers/setExampleText.js +45 -0
- package/dist/esm/ExampleFeature/Controllers/setExampleText.js.map +1 -0
- package/dist/esm/ExampleFeature/Controllers/toggleExampleBoolean.js +44 -0
- package/dist/esm/ExampleFeature/Controllers/toggleExampleBoolean.js.map +1 -0
- package/dist/esm/ExampleFeature/Entities/ExampleEntity.js +85 -0
- package/dist/esm/ExampleFeature/Entities/ExampleEntity.js.map +1 -0
- package/dist/esm/ExampleFeature/Entities/ExampleRepo.js +108 -0
- package/dist/esm/ExampleFeature/Entities/ExampleRepo.js.map +1 -0
- package/dist/esm/ExampleFeature/Entities/ExampleSingletonEntity.js +64 -0
- package/dist/esm/ExampleFeature/Entities/ExampleSingletonEntity.js.map +1 -0
- package/dist/esm/ExampleFeature/Entities/index.js +4 -0
- package/dist/esm/ExampleFeature/Entities/index.js.map +1 -0
- package/dist/esm/ExampleFeature/Factory/index.js +2 -0
- package/dist/esm/ExampleFeature/Factory/index.js.map +1 -0
- package/dist/esm/ExampleFeature/Factory/setupExampleFeature.js +26 -0
- package/dist/esm/ExampleFeature/Factory/setupExampleFeature.js.map +1 -0
- package/dist/esm/ExampleFeature/Mocks/MockEditExampleStringUC.js +43 -0
- package/dist/esm/ExampleFeature/Mocks/MockEditExampleStringUC.js.map +1 -0
- package/dist/esm/ExampleFeature/Mocks/MockExamplePM.js +44 -0
- package/dist/esm/ExampleFeature/Mocks/MockExamplePM.js.map +1 -0
- package/dist/esm/ExampleFeature/Mocks/MockExampleSingletonPM.js +54 -0
- package/dist/esm/ExampleFeature/Mocks/MockExampleSingletonPM.js.map +1 -0
- package/dist/esm/ExampleFeature/Mocks/MockToggleExampleBooleanUC.js +52 -0
- package/dist/esm/ExampleFeature/Mocks/MockToggleExampleBooleanUC.js.map +1 -0
- package/dist/esm/ExampleFeature/Mocks/index.js +5 -0
- package/dist/esm/ExampleFeature/Mocks/index.js.map +1 -0
- package/dist/esm/ExampleFeature/PMs/ExamplePM.js +92 -0
- package/dist/esm/ExampleFeature/PMs/ExamplePM.js.map +1 -0
- package/dist/esm/ExampleFeature/PMs/ExampleSingletonPM.js +97 -0
- package/dist/esm/ExampleFeature/PMs/ExampleSingletonPM.js.map +1 -0
- package/dist/esm/ExampleFeature/PMs/index.js +3 -0
- package/dist/esm/ExampleFeature/PMs/index.js.map +1 -0
- package/dist/esm/ExampleFeature/UCs/EditExampleStringUC.js +82 -0
- package/dist/esm/ExampleFeature/UCs/EditExampleStringUC.js.map +1 -0
- package/dist/esm/ExampleFeature/UCs/ToggleExampleBooleanUC.js +74 -0
- package/dist/esm/ExampleFeature/UCs/ToggleExampleBooleanUC.js.map +1 -0
- package/dist/esm/ExampleFeature/UCs/index.js +3 -0
- package/dist/esm/ExampleFeature/UCs/index.js.map +1 -0
- package/dist/esm/ExampleFeature/index.js +8 -0
- package/dist/esm/ExampleFeature/index.js.map +1 -0
- 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/esm/index.js +1 -0
- package/dist/esm/index.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/ExampleFeature/Adapters/examplePmAdapter.d.ts +29 -0
- package/dist/types/ExampleFeature/Adapters/examplePmAdapter.d.ts.map +1 -0
- package/dist/types/ExampleFeature/Adapters/exampleSingletonPmAdapter.d.ts +31 -0
- package/dist/types/ExampleFeature/Adapters/exampleSingletonPmAdapter.d.ts.map +1 -0
- package/dist/types/ExampleFeature/Adapters/index.d.ts +3 -0
- package/dist/types/ExampleFeature/Adapters/index.d.ts.map +1 -0
- package/dist/types/ExampleFeature/Controllers/index.d.ts +3 -0
- package/dist/types/ExampleFeature/Controllers/index.d.ts.map +1 -0
- package/dist/types/ExampleFeature/Controllers/setExampleText.d.ts +35 -0
- package/dist/types/ExampleFeature/Controllers/setExampleText.d.ts.map +1 -0
- package/dist/types/ExampleFeature/Controllers/toggleExampleBoolean.d.ts +34 -0
- package/dist/types/ExampleFeature/Controllers/toggleExampleBoolean.d.ts.map +1 -0
- package/dist/types/ExampleFeature/Entities/ExampleEntity.d.ts +55 -0
- package/dist/types/ExampleFeature/Entities/ExampleEntity.d.ts.map +1 -0
- package/dist/types/ExampleFeature/Entities/ExampleRepo.d.ts +62 -0
- package/dist/types/ExampleFeature/Entities/ExampleRepo.d.ts.map +1 -0
- package/dist/types/ExampleFeature/Entities/ExampleSingletonEntity.d.ts +43 -0
- package/dist/types/ExampleFeature/Entities/ExampleSingletonEntity.d.ts.map +1 -0
- package/dist/types/ExampleFeature/Entities/index.d.ts +4 -0
- package/dist/types/ExampleFeature/Entities/index.d.ts.map +1 -0
- package/dist/types/ExampleFeature/Factory/index.d.ts +2 -0
- package/dist/types/ExampleFeature/Factory/index.d.ts.map +1 -0
- package/dist/types/ExampleFeature/Factory/setupExampleFeature.d.ts +17 -0
- package/dist/types/ExampleFeature/Factory/setupExampleFeature.d.ts.map +1 -0
- package/dist/types/ExampleFeature/Mocks/MockEditExampleStringUC.d.ts +42 -0
- package/dist/types/ExampleFeature/Mocks/MockEditExampleStringUC.d.ts.map +1 -0
- package/dist/types/ExampleFeature/Mocks/MockExamplePM.d.ts +41 -0
- package/dist/types/ExampleFeature/Mocks/MockExamplePM.d.ts.map +1 -0
- package/dist/types/ExampleFeature/Mocks/MockExampleSingletonPM.d.ts +49 -0
- package/dist/types/ExampleFeature/Mocks/MockExampleSingletonPM.d.ts.map +1 -0
- package/dist/types/ExampleFeature/Mocks/MockToggleExampleBooleanUC.d.ts +47 -0
- package/dist/types/ExampleFeature/Mocks/MockToggleExampleBooleanUC.d.ts.map +1 -0
- package/dist/types/ExampleFeature/Mocks/index.d.ts +5 -0
- package/dist/types/ExampleFeature/Mocks/index.d.ts.map +1 -0
- package/dist/types/ExampleFeature/PMs/ExamplePM.d.ts +42 -0
- package/dist/types/ExampleFeature/PMs/ExamplePM.d.ts.map +1 -0
- package/dist/types/ExampleFeature/PMs/ExampleSingletonPM.d.ts +52 -0
- package/dist/types/ExampleFeature/PMs/ExampleSingletonPM.d.ts.map +1 -0
- package/dist/types/ExampleFeature/PMs/index.d.ts +3 -0
- package/dist/types/ExampleFeature/PMs/index.d.ts.map +1 -0
- package/dist/types/ExampleFeature/UCs/EditExampleStringUC.d.ts +52 -0
- package/dist/types/ExampleFeature/UCs/EditExampleStringUC.d.ts.map +1 -0
- package/dist/types/ExampleFeature/UCs/ToggleExampleBooleanUC.d.ts +44 -0
- package/dist/types/ExampleFeature/UCs/ToggleExampleBooleanUC.d.ts.map +1 -0
- package/dist/types/ExampleFeature/UCs/index.d.ts +3 -0
- package/dist/types/ExampleFeature/UCs/index.d.ts.map +1 -0
- package/dist/types/ExampleFeature/index.d.ts +8 -0
- package/dist/types/ExampleFeature/index.d.ts.map +1 -0
- 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/dist/types/index.d.ts +1 -0
- package/dist/types/index.d.ts.map +1 -1
- package/package.json +6 -4
- 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
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* MockExampleSingletonPM.ts
|
|
4
|
+
*
|
|
5
|
+
* This file demonstrates how to implement a mock singleton PM for testing.
|
|
6
|
+
* Mock singleton PMs extend the real singleton PM classes and provide helper
|
|
7
|
+
* functions to create and access them in tests.
|
|
8
|
+
*
|
|
9
|
+
* Key concepts:
|
|
10
|
+
* - Mock singleton PMs extend the real singleton PM classes
|
|
11
|
+
* - They override methods with test implementations
|
|
12
|
+
* - They include helper functions to create and access them in tests
|
|
13
|
+
* - They're used to test adapters and controllers that depend on singleton PMs
|
|
14
|
+
*
|
|
15
|
+
* Usage pattern (in tests):
|
|
16
|
+
* ```typescript
|
|
17
|
+
* // In a test file
|
|
18
|
+
* const mockPM = makeMockExampleSingletonPM(appObjects);
|
|
19
|
+
* const addViewSpy = jest.spyOn(mockPM, 'addView');
|
|
20
|
+
*
|
|
21
|
+
* // Test the component that uses the singleton PM
|
|
22
|
+
* adapter.subscribe(appObjects, setVM);
|
|
23
|
+
*
|
|
24
|
+
* // Verify the PM method was called correctly
|
|
25
|
+
* expect(addViewSpy).toHaveBeenCalledWith(setVM);
|
|
26
|
+
* ```
|
|
27
|
+
*/
|
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
exports.MockExampleSingletonPM = void 0;
|
|
30
|
+
exports.makeMockExampleSingletonPM = makeMockExampleSingletonPM;
|
|
31
|
+
const ExampleSingletonPM_1 = require("../PMs/ExampleSingletonPM");
|
|
32
|
+
/**
|
|
33
|
+
* Mock implementation of ExampleSingletonPM for testing
|
|
34
|
+
* Provides simplified implementations of required methods
|
|
35
|
+
*/
|
|
36
|
+
class MockExampleSingletonPM extends ExampleSingletonPM_1.ExampleSingletonPM {
|
|
37
|
+
constructor(appObject) {
|
|
38
|
+
super(appObject, ExampleSingletonPM_1.ExampleSingletonPM.type);
|
|
39
|
+
/**
|
|
40
|
+
* Simplified implementation that always returns true
|
|
41
|
+
* This avoids the need to implement real comparison logic in tests
|
|
42
|
+
*/
|
|
43
|
+
this.vmsAreEqual = () => {
|
|
44
|
+
return true;
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
exports.MockExampleSingletonPM = MockExampleSingletonPM;
|
|
49
|
+
/**
|
|
50
|
+
* Helper function to create and register a MockExampleSingletonPM
|
|
51
|
+
* Returns the created mock for use in tests
|
|
52
|
+
*
|
|
53
|
+
* @param appObjects The AppObjectRepo to register the mock with
|
|
54
|
+
* @returns A new MockExampleSingletonPM instance
|
|
55
|
+
*/
|
|
56
|
+
function makeMockExampleSingletonPM(appObjects) {
|
|
57
|
+
return new MockExampleSingletonPM(appObjects.getOrCreate("MockExampleSingletonPM"));
|
|
58
|
+
}
|
|
59
|
+
//# sourceMappingURL=MockExampleSingletonPM.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MockExampleSingletonPM.js","sourceRoot":"","sources":["../../../../src/ExampleFeature/Mocks/MockExampleSingletonPM.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;;;AA8BH,gEAIC;AA/BD,kEAA+D;AAE/D;;;GAGG;AACH,MAAa,sBAAuB,SAAQ,uCAAkB;IAS5D,YAAY,SAAoB;QAC9B,KAAK,CAAC,SAAS,EAAE,uCAAkB,CAAC,IAAI,CAAC,CAAC;QAT5C;;;WAGG;QACH,gBAAW,GAAG,GAAG,EAAE;YACjB,OAAO,IAAI,CAAC;QACd,CAAC,CAAC;IAIF,CAAC;CACF;AAZD,wDAYC;AAED;;;;;;GAMG;AACH,SAAgB,0BAA0B,CAAC,UAAyB;IAClE,OAAO,IAAI,sBAAsB,CAC/B,UAAU,CAAC,WAAW,CAAC,wBAAwB,CAAC,CACjD,CAAC;AACJ,CAAC","sourcesContent":["/**\r\n * MockExampleSingletonPM.ts\r\n * \r\n * This file demonstrates how to implement a mock singleton PM for testing.\r\n * Mock singleton PMs extend the real singleton PM classes and provide helper\r\n * functions to create and access them in tests.\r\n * \r\n * Key concepts:\r\n * - Mock singleton PMs extend the real singleton PM classes\r\n * - They override methods with test implementations\r\n * - They include helper functions to create and access them in tests\r\n * - They're used to test adapters and controllers that depend on singleton PMs\r\n * \r\n * Usage pattern (in tests):\r\n * ```typescript\r\n * // In a test file\r\n * const mockPM = makeMockExampleSingletonPM(appObjects);\r\n * const addViewSpy = jest.spyOn(mockPM, 'addView');\r\n * \r\n * // Test the component that uses the singleton PM\r\n * adapter.subscribe(appObjects, setVM);\r\n * \r\n * // Verify the PM method was called correctly\r\n * expect(addViewSpy).toHaveBeenCalledWith(setVM);\r\n * ```\r\n */\r\n\r\nimport { AppObject, AppObjectRepo } from \"../../AppObject\";\r\nimport { ExampleSingletonPM } from \"../PMs/ExampleSingletonPM\";\r\n\r\n/**\r\n * Mock implementation of ExampleSingletonPM for testing\r\n * Provides simplified implementations of required methods\r\n */\r\nexport class MockExampleSingletonPM extends ExampleSingletonPM {\r\n /**\r\n * Simplified implementation that always returns true\r\n * This avoids the need to implement real comparison logic in tests\r\n */\r\n vmsAreEqual = () => {\r\n return true;\r\n };\r\n\r\n constructor(appObject: AppObject) {\r\n super(appObject, ExampleSingletonPM.type);\r\n }\r\n}\r\n\r\n/**\r\n * Helper function to create and register a MockExampleSingletonPM\r\n * Returns the created mock for use in tests\r\n * \r\n * @param appObjects The AppObjectRepo to register the mock with\r\n * @returns A new MockExampleSingletonPM instance\r\n */\r\nexport function makeMockExampleSingletonPM(appObjects: AppObjectRepo) {\r\n return new MockExampleSingletonPM(\r\n appObjects.getOrCreate(\"MockExampleSingletonPM\")\r\n );\r\n}\r\n"]}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* MockToggleExampleBooleanUC.ts
|
|
4
|
+
*
|
|
5
|
+
* This file demonstrates how to implement a mock singleton UC for testing.
|
|
6
|
+
* Mock singleton UCs extend the real UC classes and provide helper functions
|
|
7
|
+
* to create and register them as singletons for tests.
|
|
8
|
+
*
|
|
9
|
+
* Key concepts:
|
|
10
|
+
* - Mock singleton UCs extend the real UC classes
|
|
11
|
+
* - They override methods with test implementations
|
|
12
|
+
* - They register themselves as singletons just like the real UCs
|
|
13
|
+
* - They include helper functions to create them in tests
|
|
14
|
+
*
|
|
15
|
+
* Usage pattern (in tests):
|
|
16
|
+
* ```typescript
|
|
17
|
+
* // In a test file
|
|
18
|
+
* const mockUC = makeMockToggleExampleBooleanUC(appObject);
|
|
19
|
+
* const spy = jest.spyOn(mockUC, 'toggleExampleBoolean');
|
|
20
|
+
*
|
|
21
|
+
* // Call the function that should use the UC
|
|
22
|
+
* toggleExampleBoolean(appObjects);
|
|
23
|
+
*
|
|
24
|
+
* // Verify the UC method was called correctly
|
|
25
|
+
* expect(spy).toHaveBeenCalled();
|
|
26
|
+
* ```
|
|
27
|
+
*/
|
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
exports.MockToggleExampleBooleanUC = void 0;
|
|
30
|
+
exports.makeMockToggleExampleBooleanUC = makeMockToggleExampleBooleanUC;
|
|
31
|
+
const ToggleExampleBooleanUC_1 = require("../UCs/ToggleExampleBooleanUC");
|
|
32
|
+
/**
|
|
33
|
+
* Mock implementation of ToggleExampleBooleanUC for testing
|
|
34
|
+
* Provides a no-op implementation of toggleExampleBoolean that can be spied on in tests
|
|
35
|
+
*/
|
|
36
|
+
class MockToggleExampleBooleanUC extends ToggleExampleBooleanUC_1.ToggleExampleBooleanUC {
|
|
37
|
+
constructor(appObject) {
|
|
38
|
+
super(appObject, ToggleExampleBooleanUC_1.ToggleExampleBooleanUC.type);
|
|
39
|
+
/**
|
|
40
|
+
* Mock implementation that does nothing
|
|
41
|
+
* In tests, this can be replaced with a Jest spy to track calls
|
|
42
|
+
*/
|
|
43
|
+
this.toggleExampleBoolean = () => { };
|
|
44
|
+
// Register as a singleton just like the real UC
|
|
45
|
+
this.appObjects.registerSingleton(this);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
exports.MockToggleExampleBooleanUC = MockToggleExampleBooleanUC;
|
|
49
|
+
/**
|
|
50
|
+
* Helper factory function to create a mock ToggleExampleBooleanUC
|
|
51
|
+
* @param appObject The AppObject to attach the UC to
|
|
52
|
+
* @returns A new MockToggleExampleBooleanUC instance
|
|
53
|
+
*/
|
|
54
|
+
function makeMockToggleExampleBooleanUC(appObject) {
|
|
55
|
+
return new MockToggleExampleBooleanUC(appObject);
|
|
56
|
+
}
|
|
57
|
+
//# sourceMappingURL=MockToggleExampleBooleanUC.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MockToggleExampleBooleanUC.js","sourceRoot":"","sources":["../../../../src/ExampleFeature/Mocks/MockToggleExampleBooleanUC.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;;;AA4BH,wEAIC;AA7BD,0EAAuE;AAEvE;;;GAGG;AACH,MAAa,0BAA2B,SAAQ,+CAAsB;IAOpE,YAAY,SAAoB;QAC9B,KAAK,CAAC,SAAS,EAAE,+CAAsB,CAAC,IAAI,CAAC,CAAC;QAPhD;;;WAGG;QACH,yBAAoB,GAAG,GAAS,EAAE,GAAE,CAAC,CAAC;QAIpC,gDAAgD;QAChD,IAAI,CAAC,UAAU,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAC;IAC1C,CAAC;CACF;AAZD,gEAYC;AAED;;;;GAIG;AACH,SAAgB,8BAA8B,CAC5C,SAAoB;IAEpB,OAAO,IAAI,0BAA0B,CAAC,SAAS,CAAC,CAAC;AACnD,CAAC","sourcesContent":["/**\r\n * MockToggleExampleBooleanUC.ts\r\n * \r\n * This file demonstrates how to implement a mock singleton UC for testing.\r\n * Mock singleton UCs extend the real UC classes and provide helper functions\r\n * to create and register them as singletons for tests.\r\n * \r\n * Key concepts:\r\n * - Mock singleton UCs extend the real UC classes\r\n * - They override methods with test implementations\r\n * - They register themselves as singletons just like the real UCs\r\n * - They include helper functions to create them in tests\r\n * \r\n * Usage pattern (in tests):\r\n * ```typescript\r\n * // In a test file\r\n * const mockUC = makeMockToggleExampleBooleanUC(appObject);\r\n * const spy = jest.spyOn(mockUC, 'toggleExampleBoolean');\r\n * \r\n * // Call the function that should use the UC\r\n * toggleExampleBoolean(appObjects);\r\n * \r\n * // Verify the UC method was called correctly\r\n * expect(spy).toHaveBeenCalled();\r\n * ```\r\n */\r\n\r\nimport { AppObject } from \"../../AppObject\";\r\nimport { ToggleExampleBooleanUC } from \"../UCs/ToggleExampleBooleanUC\";\r\n\r\n/**\r\n * Mock implementation of ToggleExampleBooleanUC for testing\r\n * Provides a no-op implementation of toggleExampleBoolean that can be spied on in tests\r\n */\r\nexport class MockToggleExampleBooleanUC extends ToggleExampleBooleanUC {\r\n /**\r\n * Mock implementation that does nothing\r\n * In tests, this can be replaced with a Jest spy to track calls\r\n */\r\n toggleExampleBoolean = (): void => {};\r\n\r\n constructor(appObject: AppObject) {\r\n super(appObject, ToggleExampleBooleanUC.type);\r\n // Register as a singleton just like the real UC\r\n this.appObjects.registerSingleton(this);\r\n }\r\n}\r\n\r\n/**\r\n * Helper factory function to create a mock ToggleExampleBooleanUC\r\n * @param appObject The AppObject to attach the UC to\r\n * @returns A new MockToggleExampleBooleanUC instance\r\n */\r\nexport function makeMockToggleExampleBooleanUC(\r\n appObject: AppObject\r\n): MockToggleExampleBooleanUC {\r\n return new MockToggleExampleBooleanUC(appObject);\r\n}\r\n"]}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./MockEditExampleStringUC"), exports);
|
|
18
|
+
__exportStar(require("./MockExamplePM"), exports);
|
|
19
|
+
__exportStar(require("./MockExampleSingletonPM"), exports);
|
|
20
|
+
__exportStar(require("./MockToggleExampleBooleanUC"), exports);
|
|
21
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/ExampleFeature/Mocks/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,4DAA0C;AAC1C,kDAAgC;AAChC,2DAAyC;AACzC,+DAA6C","sourcesContent":["export * from \"./MockEditExampleStringUC\";\r\nexport * from \"./MockExamplePM\";\r\nexport * from \"./MockExampleSingletonPM\";\r\nexport * from \"./MockToggleExampleBooleanUC\";\r\n"]}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* ExamplePM.ts
|
|
4
|
+
*
|
|
5
|
+
* This file demonstrates how to implement a Presentation Manager (PM) component.
|
|
6
|
+
* PMs are responsible for transforming entity data into view models (VMs) for the UI.
|
|
7
|
+
* They observe entities for changes and update their views when data changes.
|
|
8
|
+
*
|
|
9
|
+
* Key concepts:
|
|
10
|
+
* - PMs extend AppObjectPM<VM> where VM is the view model type
|
|
11
|
+
* - They observe entities and transform entity data into view models
|
|
12
|
+
* - They notify UI components (views) when view models change
|
|
13
|
+
* - Each PM instance is associated with a specific AppObject
|
|
14
|
+
*
|
|
15
|
+
* Usage pattern:
|
|
16
|
+
* 1. Get a PM instance using getById
|
|
17
|
+
* 2. Register UI components as views using addView(callback)
|
|
18
|
+
* 3. PM will call the view callbacks with updated view models when entities change
|
|
19
|
+
* 4. Remove UI components with removeView(callback) when they're unmounted
|
|
20
|
+
*/
|
|
21
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
|
+
exports.ExamplePM = void 0;
|
|
23
|
+
exports.makeExamplePM = makeExamplePM;
|
|
24
|
+
const AppObject_1 = require("../../AppObject");
|
|
25
|
+
const ExampleEntity_1 = require("../Entities/ExampleEntity");
|
|
26
|
+
/**
|
|
27
|
+
* ExamplePM transforms ExampleEntity data into a simple string view model.
|
|
28
|
+
* Abstract class provides the interface and static helper methods.
|
|
29
|
+
*/
|
|
30
|
+
class ExamplePM extends AppObject_1.AppObjectPM {
|
|
31
|
+
/**
|
|
32
|
+
* Retrieves an ExamplePM by its parent AppObject's ID
|
|
33
|
+
* @param id The ID of the parent AppObject
|
|
34
|
+
* @param appObjects The AppObjectRepo to search in
|
|
35
|
+
* @returns The ExamplePM component or undefined if not found
|
|
36
|
+
*/
|
|
37
|
+
static getById(id, appObjects) {
|
|
38
|
+
return appObjects.get(id)?.getComponent(ExamplePM.type);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
exports.ExamplePM = ExamplePM;
|
|
42
|
+
/** Unique type identifier for this component */
|
|
43
|
+
ExamplePM.type = "ExamplePMType";
|
|
44
|
+
/**
|
|
45
|
+
* Factory function to create a new ExamplePM
|
|
46
|
+
* @param appObject The AppObject to attach the PM to
|
|
47
|
+
* @returns A new ExamplePM instance
|
|
48
|
+
*/
|
|
49
|
+
function makeExamplePM(appObject) {
|
|
50
|
+
return new ExamplePMImp(appObject);
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Concrete implementation of ExamplePM
|
|
54
|
+
* This private class handles the actual implementation details
|
|
55
|
+
*/
|
|
56
|
+
class ExamplePMImp extends ExamplePM {
|
|
57
|
+
/**
|
|
58
|
+
* Gets the ExampleEntity from the same AppObject
|
|
59
|
+
* Uses getCachedLocalComponent for efficient repeated access
|
|
60
|
+
*/
|
|
61
|
+
get exampleEntity() {
|
|
62
|
+
return this.getCachedLocalComponent(ExampleEntity_1.ExampleEntity.type);
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Compares two view models to determine if they're equal
|
|
66
|
+
* Used to avoid unnecessary view updates when values haven't changed
|
|
67
|
+
*/
|
|
68
|
+
vmsAreEqual(a, b) {
|
|
69
|
+
return a === b;
|
|
70
|
+
}
|
|
71
|
+
constructor(appObject) {
|
|
72
|
+
super(appObject, ExamplePM.type);
|
|
73
|
+
/**
|
|
74
|
+
* Handler for entity change events
|
|
75
|
+
* Transforms entity data into a view model and updates views
|
|
76
|
+
*/
|
|
77
|
+
this.onEntityChange = () => {
|
|
78
|
+
if (!this.exampleEntity)
|
|
79
|
+
return;
|
|
80
|
+
// In this simple case, our view model is just the string property value
|
|
81
|
+
this.doUpdateView(this.exampleEntity.aStringProperty);
|
|
82
|
+
};
|
|
83
|
+
/**
|
|
84
|
+
* Cleanup method called when the PM is being disposed
|
|
85
|
+
* Removes any observers to prevent memory leaks
|
|
86
|
+
*/
|
|
87
|
+
this.dispose = () => {
|
|
88
|
+
super.dispose();
|
|
89
|
+
this.exampleEntity?.removeChangeObserver(this.onEntityChange);
|
|
90
|
+
};
|
|
91
|
+
// Register as an observer of the entity to receive change notifications
|
|
92
|
+
this.exampleEntity?.addChangeObserver(this.onEntityChange);
|
|
93
|
+
// Call the change handler initially to set up the initial view model
|
|
94
|
+
this.onEntityChange();
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
//# sourceMappingURL=ExamplePM.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ExamplePM.js","sourceRoot":"","sources":["../../../../src/ExampleFeature/PMs/ExamplePM.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;GAkBG;;;AA6BH,sCAEC;AA7BD,+CAAwE;AACxE,6DAA0D;AAE1D;;;GAGG;AACH,MAAsB,SAAU,SAAQ,uBAAmB;IAIzD;;;;;OAKG;IACH,MAAM,CAAC,OAAO,CAAC,EAAU,EAAE,UAAyB;QAClD,OAAO,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,YAAY,CAAY,SAAS,CAAC,IAAI,CAAC,CAAC;IACrE,CAAC;;AAZH,8BAaC;AAZC,gDAAgD;AAChC,cAAI,GAAG,eAAe,CAAC;AAazC;;;;GAIG;AACH,SAAgB,aAAa,CAAC,SAAoB;IAChD,OAAO,IAAI,YAAY,CAAC,SAAS,CAAC,CAAC;AACrC,CAAC;AAED;;;GAGG;AACH,MAAM,YAAa,SAAQ,SAAS;IAClC;;;OAGG;IACH,IAAY,aAAa;QACvB,OAAO,IAAI,CAAC,uBAAuB,CAAgB,6BAAa,CAAC,IAAI,CAAC,CAAC;IACzE,CAAC;IAED;;;OAGG;IACH,WAAW,CAAC,CAAS,EAAE,CAAS;QAC9B,OAAO,CAAC,KAAK,CAAC,CAAC;IACjB,CAAC;IAsBD,YAAY,SAAoB;QAC9B,KAAK,CAAC,SAAS,EAAE,SAAS,CAAC,IAAI,CAAC,CAAC;QArBnC;;;WAGG;QACH,mBAAc,GAAG,GAAG,EAAE;YACpB,IAAI,CAAC,IAAI,CAAC,aAAa;gBAAE,OAAO;YAEhC,wEAAwE;YACxE,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,aAAa,CAAC,eAAe,CAAC,CAAC;QACxD,CAAC,CAAC;QAEF;;;WAGG;QACH,YAAO,GAAG,GAAS,EAAE;YACnB,KAAK,CAAC,OAAO,EAAE,CAAC;YAChB,IAAI,CAAC,aAAa,EAAE,oBAAoB,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;QAChE,CAAC,CAAC;QAKA,wEAAwE;QACxE,IAAI,CAAC,aAAa,EAAE,iBAAiB,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;QAE3D,qEAAqE;QACrE,IAAI,CAAC,cAAc,EAAE,CAAC;IACxB,CAAC;CACF","sourcesContent":["/**\r\n * ExamplePM.ts\r\n * \r\n * This file demonstrates how to implement a Presentation Manager (PM) component.\r\n * PMs are responsible for transforming entity data into view models (VMs) for the UI.\r\n * They observe entities for changes and update their views when data changes.\r\n * \r\n * Key concepts:\r\n * - PMs extend AppObjectPM<VM> where VM is the view model type\r\n * - They observe entities and transform entity data into view models\r\n * - They notify UI components (views) when view models change\r\n * - Each PM instance is associated with a specific AppObject\r\n * \r\n * Usage pattern:\r\n * 1. Get a PM instance using getById\r\n * 2. Register UI components as views using addView(callback)\r\n * 3. PM will call the view callbacks with updated view models when entities change\r\n * 4. Remove UI components with removeView(callback) when they're unmounted\r\n */\r\n\r\nimport { AppObject, AppObjectPM, AppObjectRepo } from \"../../AppObject\";\r\nimport { ExampleEntity } from \"../Entities/ExampleEntity\";\r\n\r\n/**\r\n * ExamplePM transforms ExampleEntity data into a simple string view model.\r\n * Abstract class provides the interface and static helper methods.\r\n */\r\nexport abstract class ExamplePM extends AppObjectPM<string> {\r\n /** Unique type identifier for this component */\r\n static readonly type = \"ExamplePMType\";\r\n\r\n /**\r\n * Retrieves an ExamplePM by its parent AppObject's ID\r\n * @param id The ID of the parent AppObject\r\n * @param appObjects The AppObjectRepo to search in\r\n * @returns The ExamplePM component or undefined if not found\r\n */\r\n static getById(id: string, appObjects: AppObjectRepo) {\r\n return appObjects.get(id)?.getComponent<ExamplePM>(ExamplePM.type);\r\n }\r\n}\r\n\r\n/**\r\n * Factory function to create a new ExamplePM\r\n * @param appObject The AppObject to attach the PM to\r\n * @returns A new ExamplePM instance\r\n */\r\nexport function makeExamplePM(appObject: AppObject): ExamplePM {\r\n return new ExamplePMImp(appObject);\r\n}\r\n\r\n/**\r\n * Concrete implementation of ExamplePM\r\n * This private class handles the actual implementation details\r\n */\r\nclass ExamplePMImp extends ExamplePM {\r\n /**\r\n * Gets the ExampleEntity from the same AppObject\r\n * Uses getCachedLocalComponent for efficient repeated access\r\n */\r\n private get exampleEntity() {\r\n return this.getCachedLocalComponent<ExampleEntity>(ExampleEntity.type);\r\n }\r\n\r\n /**\r\n * Compares two view models to determine if they're equal\r\n * Used to avoid unnecessary view updates when values haven't changed\r\n */\r\n vmsAreEqual(a: string, b: string): boolean {\r\n return a === b;\r\n }\r\n\r\n /**\r\n * Handler for entity change events\r\n * Transforms entity data into a view model and updates views\r\n */\r\n onEntityChange = () => {\r\n if (!this.exampleEntity) return;\r\n\r\n // In this simple case, our view model is just the string property value\r\n this.doUpdateView(this.exampleEntity.aStringProperty);\r\n };\r\n\r\n /**\r\n * Cleanup method called when the PM is being disposed\r\n * Removes any observers to prevent memory leaks\r\n */\r\n dispose = (): void => {\r\n super.dispose();\r\n this.exampleEntity?.removeChangeObserver(this.onEntityChange);\r\n };\r\n\r\n constructor(appObject: AppObject) {\r\n super(appObject, ExamplePM.type);\r\n\r\n // Register as an observer of the entity to receive change notifications\r\n this.exampleEntity?.addChangeObserver(this.onEntityChange);\r\n \r\n // Call the change handler initially to set up the initial view model\r\n this.onEntityChange();\r\n }\r\n}\r\n"]}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* ExampleSingletonPM.ts
|
|
4
|
+
*
|
|
5
|
+
* This file demonstrates how to implement a Singleton Presentation Manager (PM).
|
|
6
|
+
* Singleton PMs are special PMs that exist only once in the application and can be
|
|
7
|
+
* accessed globally. They transform data from singleton entities into view models.
|
|
8
|
+
*
|
|
9
|
+
* Key concepts:
|
|
10
|
+
* - Singleton PMs extend AppObjectPM<VM> like regular PMs
|
|
11
|
+
* - They register themselves as singletons with appObjects.registerSingleton()
|
|
12
|
+
* - They're accessed through a static get() method using getSingletonComponent()
|
|
13
|
+
* - They typically observe singleton entities and provide data to multiple UI components
|
|
14
|
+
*
|
|
15
|
+
* Usage pattern:
|
|
16
|
+
* 1. Access the singleton PM using the static get() method
|
|
17
|
+
* 2. Register UI components as views using addView(callback)
|
|
18
|
+
* 3. PM will call the view callbacks with updated view models when entities change
|
|
19
|
+
* 4. Remove UI components with removeView(callback) when they're unmounted
|
|
20
|
+
*/
|
|
21
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
|
+
exports.defaultSlideNavigationVM = exports.ExampleSingletonPM = void 0;
|
|
23
|
+
exports.makeExampleSingletonPM = makeExampleSingletonPM;
|
|
24
|
+
const AppObject_1 = require("../../AppObject");
|
|
25
|
+
const getSingletonComponent_1 = require("../../AppObject/getSingletonComponent");
|
|
26
|
+
const ExampleSingletonEntity_1 = require("../Entities/ExampleSingletonEntity");
|
|
27
|
+
/**
|
|
28
|
+
* ExampleSingletonPM transforms SingletonEntityExample data into an ExampleVM.
|
|
29
|
+
* As a singleton, only one instance exists in the application.
|
|
30
|
+
*/
|
|
31
|
+
class ExampleSingletonPM extends AppObject_1.AppObjectPM {
|
|
32
|
+
}
|
|
33
|
+
exports.ExampleSingletonPM = ExampleSingletonPM;
|
|
34
|
+
/** Unique type identifier for this component */
|
|
35
|
+
ExampleSingletonPM.type = "ExampleSingletonPMType";
|
|
36
|
+
/**
|
|
37
|
+
* Global accessor for the singleton PM
|
|
38
|
+
* @param appObjects The AppObjectRepo to search in
|
|
39
|
+
* @returns The singleton PM or undefined if not created yet
|
|
40
|
+
*/
|
|
41
|
+
ExampleSingletonPM.get = (appObjects) => (0, getSingletonComponent_1.getSingletonComponent)(ExampleSingletonPM.type, appObjects);
|
|
42
|
+
/**
|
|
43
|
+
* Default view model used when no data is available
|
|
44
|
+
* UI components can use this initially or when the PM is not found
|
|
45
|
+
*/
|
|
46
|
+
exports.defaultSlideNavigationVM = {
|
|
47
|
+
aBoolProperty: true
|
|
48
|
+
};
|
|
49
|
+
/**
|
|
50
|
+
* Factory function to create a new ExampleSingletonPM
|
|
51
|
+
* @param appObject The AppObject to attach the PM to
|
|
52
|
+
* @returns A new ExampleSingletonPM instance
|
|
53
|
+
*/
|
|
54
|
+
function makeExampleSingletonPM(appObject) {
|
|
55
|
+
return new ExampleSingletonPMImp(appObject);
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Concrete implementation of ExampleSingletonPM
|
|
59
|
+
* This private class handles the actual implementation details
|
|
60
|
+
*/
|
|
61
|
+
class ExampleSingletonPMImp extends ExampleSingletonPM {
|
|
62
|
+
/**
|
|
63
|
+
* Gets the SingletonEntityExample from the application
|
|
64
|
+
* Uses getCachedSingleton for efficient repeated access
|
|
65
|
+
*/
|
|
66
|
+
get exampleEntity() {
|
|
67
|
+
return this.getCachedSingleton(ExampleSingletonEntity_1.SingletonEntityExample.type);
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Compares two view models to determine if they're equal
|
|
71
|
+
* Used to avoid unnecessary view updates when values haven't changed
|
|
72
|
+
*/
|
|
73
|
+
vmsAreEqual(a, b) {
|
|
74
|
+
if (a.aBoolProperty !== b.aBoolProperty)
|
|
75
|
+
return false;
|
|
76
|
+
return true;
|
|
77
|
+
}
|
|
78
|
+
constructor(appObject) {
|
|
79
|
+
super(appObject, ExampleSingletonPM.type);
|
|
80
|
+
/**
|
|
81
|
+
* Handler for entity change events
|
|
82
|
+
* Transforms entity data into a view model and updates views
|
|
83
|
+
*/
|
|
84
|
+
this.onEntityChange = () => {
|
|
85
|
+
if (!this.exampleEntity)
|
|
86
|
+
return;
|
|
87
|
+
// Extract the boolean property from the entity
|
|
88
|
+
const aBoolProperty = this.exampleEntity.aBoolProperty;
|
|
89
|
+
// Create a view model with the extracted data
|
|
90
|
+
const vm = { aBoolProperty };
|
|
91
|
+
// Update all registered views with the new view model
|
|
92
|
+
this.doUpdateView(vm);
|
|
93
|
+
};
|
|
94
|
+
// Register as an observer of the entity to receive change notifications
|
|
95
|
+
this.exampleEntity?.addChangeObserver(this.onEntityChange);
|
|
96
|
+
// Call the change handler initially to set up the initial view model
|
|
97
|
+
this.onEntityChange();
|
|
98
|
+
// Register this PM as a singleton so it can be accessed globally
|
|
99
|
+
this.appObjects.registerSingleton(this);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
//# sourceMappingURL=ExampleSingletonPM.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ExampleSingletonPM.js","sourceRoot":"","sources":["../../../../src/ExampleFeature/PMs/ExampleSingletonPM.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;GAkBG;;;AA+CH,wDAIC;AAjDD,+CAIyB;AACzB,iFAA8E;AAC9E,+EAA4E;AAS5E;;;GAGG;AACH,MAAsB,kBAAmB,SAAQ,uBAAsB;;AAAvE,gDAWC;AAVC,gDAAgD;AAChC,uBAAI,GAAG,wBAAwB,CAAC;AAEhD;;;;GAIG;AACI,sBAAG,GAAG,CAAC,UAAyB,EAAkC,EAAE,CACzE,IAAA,6CAAqB,EAAC,kBAAkB,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC;AAG/D;;;GAGG;AACU,QAAA,wBAAwB,GAAc;IACjD,aAAa,EAAE,IAAI;CACpB,CAAC;AAEF;;;;GAIG;AACH,SAAgB,sBAAsB,CACpC,SAAoB;IAEpB,OAAO,IAAI,qBAAqB,CAAC,SAAS,CAAC,CAAC;AAC9C,CAAC;AAED;;;GAGG;AACH,MAAM,qBAAsB,SAAQ,kBAAkB;IACpD;;;OAGG;IACH,IAAY,aAAa;QACvB,OAAO,IAAI,CAAC,kBAAkB,CAC5B,+CAAsB,CAAC,IAAI,CAC5B,CAAC;IACJ,CAAC;IAmBD;;;OAGG;IACH,WAAW,CAAC,CAAY,EAAE,CAAY;QACpC,IAAI,CAAC,CAAC,aAAa,KAAK,CAAC,CAAC,aAAa;YAAE,OAAO,KAAK,CAAC;QACtD,OAAO,IAAI,CAAC;IACd,CAAC;IAED,YAAY,SAAoB;QAC9B,KAAK,CAAC,SAAS,EAAE,kBAAkB,CAAC,IAAI,CAAC,CAAC;QA3B5C;;;WAGG;QACH,mBAAc,GAAG,GAAG,EAAE;YACpB,IAAI,CAAC,IAAI,CAAC,aAAa;gBAAE,OAAO;YAEhC,+CAA+C;YAC/C,MAAM,aAAa,GAAG,IAAI,CAAC,aAAa,CAAC,aAAa,CAAC;YAEvD,8CAA8C;YAC9C,MAAM,EAAE,GAAG,EAAE,aAAa,EAAE,CAAC;YAE7B,sDAAsD;YACtD,IAAI,CAAC,YAAY,CAAC,EAAE,CAAC,CAAC;QACxB,CAAC,CAAC;QAcA,wEAAwE;QACxE,IAAI,CAAC,aAAa,EAAE,iBAAiB,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;QAE3D,qEAAqE;QACrE,IAAI,CAAC,cAAc,EAAE,CAAC;QAEtB,iEAAiE;QACjE,IAAI,CAAC,UAAU,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAC;IAC1C,CAAC;CACF","sourcesContent":["/**\r\n * ExampleSingletonPM.ts\r\n * \r\n * This file demonstrates how to implement a Singleton Presentation Manager (PM).\r\n * Singleton PMs are special PMs that exist only once in the application and can be\r\n * accessed globally. They transform data from singleton entities into view models.\r\n * \r\n * Key concepts:\r\n * - Singleton PMs extend AppObjectPM<VM> like regular PMs\r\n * - They register themselves as singletons with appObjects.registerSingleton()\r\n * - They're accessed through a static get() method using getSingletonComponent()\r\n * - They typically observe singleton entities and provide data to multiple UI components\r\n * \r\n * Usage pattern:\r\n * 1. Access the singleton PM using the static get() method\r\n * 2. Register UI components as views using addView(callback)\r\n * 3. PM will call the view callbacks with updated view models when entities change\r\n * 4. Remove UI components with removeView(callback) when they're unmounted\r\n */\r\n\r\nimport {\r\n AppObject,\r\n AppObjectPM,\r\n AppObjectRepo,\r\n} from \"../../AppObject\";\r\nimport { getSingletonComponent } from \"../../AppObject/getSingletonComponent\";\r\nimport { SingletonEntityExample } from \"../Entities/ExampleSingletonEntity\";\r\n\r\n/**\r\n * Interface defining the structure of the view model provided by ExampleSingletonPM\r\n */\r\nexport interface ExampleVM {\r\n aBoolProperty: boolean;\r\n}\r\n\r\n/**\r\n * ExampleSingletonPM transforms SingletonEntityExample data into an ExampleVM.\r\n * As a singleton, only one instance exists in the application.\r\n */\r\nexport abstract class ExampleSingletonPM extends AppObjectPM<ExampleVM> {\r\n /** Unique type identifier for this component */\r\n static readonly type = \"ExampleSingletonPMType\";\r\n\r\n /**\r\n * Global accessor for the singleton PM\r\n * @param appObjects The AppObjectRepo to search in\r\n * @returns The singleton PM or undefined if not created yet\r\n */\r\n static get = (appObjects: AppObjectRepo): ExampleSingletonPM | undefined =>\r\n getSingletonComponent(ExampleSingletonPM.type, appObjects);\r\n}\r\n\r\n/**\r\n * Default view model used when no data is available\r\n * UI components can use this initially or when the PM is not found\r\n */\r\nexport const defaultSlideNavigationVM: ExampleVM = {\r\n aBoolProperty: true\r\n};\r\n\r\n/**\r\n * Factory function to create a new ExampleSingletonPM\r\n * @param appObject The AppObject to attach the PM to\r\n * @returns A new ExampleSingletonPM instance\r\n */\r\nexport function makeExampleSingletonPM(\r\n appObject: AppObject\r\n): ExampleSingletonPM {\r\n return new ExampleSingletonPMImp(appObject);\r\n}\r\n\r\n/**\r\n * Concrete implementation of ExampleSingletonPM\r\n * This private class handles the actual implementation details\r\n */\r\nclass ExampleSingletonPMImp extends ExampleSingletonPM {\r\n /**\r\n * Gets the SingletonEntityExample from the application\r\n * Uses getCachedSingleton for efficient repeated access\r\n */\r\n private get exampleEntity() {\r\n return this.getCachedSingleton<SingletonEntityExample>(\r\n SingletonEntityExample.type\r\n );\r\n }\r\n\r\n /**\r\n * Handler for entity change events\r\n * Transforms entity data into a view model and updates views\r\n */\r\n onEntityChange = () => {\r\n if (!this.exampleEntity) return;\r\n\r\n // Extract the boolean property from the entity\r\n const aBoolProperty = this.exampleEntity.aBoolProperty;\r\n\r\n // Create a view model with the extracted data\r\n const vm = { aBoolProperty };\r\n\r\n // Update all registered views with the new view model\r\n this.doUpdateView(vm);\r\n };\r\n\r\n /**\r\n * Compares two view models to determine if they're equal\r\n * Used to avoid unnecessary view updates when values haven't changed\r\n */\r\n vmsAreEqual(a: ExampleVM, b: ExampleVM): boolean {\r\n if (a.aBoolProperty !== b.aBoolProperty) return false;\r\n return true;\r\n }\r\n\r\n constructor(appObject: AppObject) {\r\n super(appObject, ExampleSingletonPM.type);\r\n\r\n // Register as an observer of the entity to receive change notifications\r\n this.exampleEntity?.addChangeObserver(this.onEntityChange);\r\n \r\n // Call the change handler initially to set up the initial view model\r\n this.onEntityChange();\r\n \r\n // Register this PM as a singleton so it can be accessed globally\r\n this.appObjects.registerSingleton(this);\r\n }\r\n}\r\n"]}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./ExamplePM"), exports);
|
|
18
|
+
__exportStar(require("./ExampleSingletonPM"), exports);
|
|
19
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/ExampleFeature/PMs/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,8CAA4B;AAC5B,uDAAqC","sourcesContent":["export * from \"./ExamplePM\";\r\nexport * from \"./ExampleSingletonPM\";\r\n"]}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* EditExampleStringUC.ts
|
|
4
|
+
*
|
|
5
|
+
* This file demonstrates how to implement a Use Case (UC) component.
|
|
6
|
+
* UCs handle business logic and operations that modify entities.
|
|
7
|
+
* They encapsulate specific actions that can be performed in the application.
|
|
8
|
+
*
|
|
9
|
+
* Key concepts:
|
|
10
|
+
* - UCs extend AppObjectUC and provide methods for specific operations
|
|
11
|
+
* - They implement business logic for modifying entities
|
|
12
|
+
* - They validate inputs and handle errors
|
|
13
|
+
* - Each UC instance is associated with a specific AppObject
|
|
14
|
+
*
|
|
15
|
+
* Usage pattern:
|
|
16
|
+
* 1. Get a UC instance using getById or get
|
|
17
|
+
* 2. Call the UC's methods to perform operations
|
|
18
|
+
* 3. The UC will update entities, which will trigger PM updates and UI refreshes
|
|
19
|
+
*/
|
|
20
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
+
exports.EditExampleStringUC = void 0;
|
|
22
|
+
exports.makeEditSlideTextUC = makeEditSlideTextUC;
|
|
23
|
+
const AppObject_1 = require("../../AppObject");
|
|
24
|
+
const ExampleEntity_1 = require("../Entities/ExampleEntity");
|
|
25
|
+
/**
|
|
26
|
+
* EditExampleStringUC provides functionality to update the string property of an ExampleEntity.
|
|
27
|
+
* Abstract class provides the interface and static helper methods.
|
|
28
|
+
*/
|
|
29
|
+
class EditExampleStringUC extends AppObject_1.AppObjectUC {
|
|
30
|
+
/**
|
|
31
|
+
* Retrieves an EditExampleStringUC component from an AppObject
|
|
32
|
+
* @param appObj The AppObject to get the component from
|
|
33
|
+
* @returns The EditExampleStringUC component or undefined if not found
|
|
34
|
+
*/
|
|
35
|
+
static get(appObj) {
|
|
36
|
+
return appObj.getComponent(this.type);
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Retrieves an EditExampleStringUC by its parent AppObject's ID
|
|
40
|
+
* @param id The ID of the parent AppObject
|
|
41
|
+
* @param appObjects The AppObjectRepo to search in
|
|
42
|
+
* @returns The EditExampleStringUC component or undefined if not found
|
|
43
|
+
*/
|
|
44
|
+
static getById(id, appObjects) {
|
|
45
|
+
return appObjects.get(id)?.getComponent(this.type);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
exports.EditExampleStringUC = EditExampleStringUC;
|
|
49
|
+
/** Unique type identifier for this component */
|
|
50
|
+
EditExampleStringUC.type = "EditExampleStringUCType";
|
|
51
|
+
/**
|
|
52
|
+
* Factory function to create a new EditExampleStringUC
|
|
53
|
+
* @param appObject The AppObject to attach the UC to
|
|
54
|
+
* @returns A new EditExampleStringUC instance
|
|
55
|
+
*/
|
|
56
|
+
function makeEditSlideTextUC(appObject) {
|
|
57
|
+
return new EditSlideTextUCImp(appObject);
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Concrete implementation of EditExampleStringUC
|
|
61
|
+
* This private class handles the actual implementation details
|
|
62
|
+
*/
|
|
63
|
+
class EditSlideTextUCImp extends EditExampleStringUC {
|
|
64
|
+
/**
|
|
65
|
+
* Gets the ExampleEntity from the same AppObject
|
|
66
|
+
* Uses getCachedLocalComponent for efficient repeated access
|
|
67
|
+
*/
|
|
68
|
+
get exampleEntity() {
|
|
69
|
+
return this.getCachedLocalComponent(ExampleEntity_1.ExampleEntity.type);
|
|
70
|
+
}
|
|
71
|
+
constructor(appObject) {
|
|
72
|
+
super(appObject, EditExampleStringUC.type);
|
|
73
|
+
/**
|
|
74
|
+
* Implements the editExampleString method to update the entity's string property
|
|
75
|
+
* @param text The new string value to set
|
|
76
|
+
*/
|
|
77
|
+
this.editExampleString = (text) => {
|
|
78
|
+
if (!this.exampleEntity) {
|
|
79
|
+
this.warn("Unable to find AppState");
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
// Update the entity property, which will trigger PM updates and UI refreshes
|
|
83
|
+
this.exampleEntity.aStringProperty = text;
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
//# sourceMappingURL=EditExampleStringUC.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EditExampleStringUC.js","sourceRoot":"","sources":["../../../../src/ExampleFeature/UCs/EditExampleStringUC.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;GAiBG;;;AA+CH,kDAEC;AA/CD,+CAAwE;AACxE,6DAA0D;AAE1D;;;GAGG;AACH,MAAsB,mBAAoB,SAAQ,uBAAW;IAU3D;;;;OAIG;IACH,MAAM,CAAC,GAAG,CAAC,MAAiB;QAC1B,OAAO,MAAM,CAAC,YAAY,CAAsB,IAAI,CAAC,IAAI,CAAC,CAAC;IAC7D,CAAC;IAED;;;;;OAKG;IACH,MAAM,CAAC,OAAO,CACZ,EAAU,EACV,UAAyB;QAEzB,OAAO,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,YAAY,CAAsB,IAAI,CAAC,IAAI,CAAC,CAAC;IAC1E,CAAC;;AA9BH,kDA+BC;AA9BC,gDAAgD;AAChC,wBAAI,GAAG,yBAAyB,CAAC;AA+BnD;;;;GAIG;AACH,SAAgB,mBAAmB,CAAC,SAAoB;IACtD,OAAO,IAAI,kBAAkB,CAAC,SAAS,CAAC,CAAC;AAC3C,CAAC;AAED;;;GAGG;AACH,MAAM,kBAAmB,SAAQ,mBAAmB;IAClD;;;OAGG;IACH,IAAY,aAAa;QACvB,OAAO,IAAI,CAAC,uBAAuB,CAAgB,6BAAa,CAAC,IAAI,CAAC,CAAC;IACzE,CAAC;IAgBD,YAAY,SAAoB;QAC9B,KAAK,CAAC,SAAS,EAAE,mBAAmB,CAAC,IAAI,CAAC,CAAC;QAf7C;;;WAGG;QACH,sBAAiB,GAAG,CAAC,IAAY,EAAE,EAAE;YACnC,IAAI,CAAC,IAAI,CAAC,aAAa,EAAE,CAAC;gBACxB,IAAI,CAAC,IAAI,CAAC,yBAAyB,CAAC,CAAC;gBACrC,OAAO;YACT,CAAC;YAED,6EAA6E;YAC7E,IAAI,CAAC,aAAa,CAAC,eAAe,GAAG,IAAI,CAAC;QAC5C,CAAC,CAAC;IAIF,CAAC;CACF","sourcesContent":["/**\r\n * EditExampleStringUC.ts\r\n * \r\n * This file demonstrates how to implement a Use Case (UC) component.\r\n * UCs handle business logic and operations that modify entities.\r\n * They encapsulate specific actions that can be performed in the application.\r\n * \r\n * Key concepts:\r\n * - UCs extend AppObjectUC and provide methods for specific operations\r\n * - They implement business logic for modifying entities\r\n * - They validate inputs and handle errors\r\n * - Each UC instance is associated with a specific AppObject\r\n * \r\n * Usage pattern:\r\n * 1. Get a UC instance using getById or get\r\n * 2. Call the UC's methods to perform operations\r\n * 3. The UC will update entities, which will trigger PM updates and UI refreshes\r\n */\r\n\r\nimport { AppObject, AppObjectRepo, AppObjectUC } from \"../../AppObject\";\r\nimport { ExampleEntity } from \"../Entities/ExampleEntity\";\r\n\r\n/**\r\n * EditExampleStringUC provides functionality to update the string property of an ExampleEntity.\r\n * Abstract class provides the interface and static helper methods.\r\n */\r\nexport abstract class EditExampleStringUC extends AppObjectUC {\r\n /** Unique type identifier for this component */\r\n static readonly type = \"EditExampleStringUCType\";\r\n\r\n /**\r\n * Updates the string property of the associated ExampleEntity\r\n * @param text The new string value to set\r\n */\r\n abstract editExampleString(text: string): void;\r\n\r\n /**\r\n * Retrieves an EditExampleStringUC component from an AppObject\r\n * @param appObj The AppObject to get the component from\r\n * @returns The EditExampleStringUC component or undefined if not found\r\n */\r\n static get(appObj: AppObject): EditExampleStringUC | undefined {\r\n return appObj.getComponent<EditExampleStringUC>(this.type);\r\n }\r\n\r\n /**\r\n * Retrieves an EditExampleStringUC by its parent AppObject's ID\r\n * @param id The ID of the parent AppObject\r\n * @param appObjects The AppObjectRepo to search in\r\n * @returns The EditExampleStringUC component or undefined if not found\r\n */\r\n static getById(\r\n id: string,\r\n appObjects: AppObjectRepo\r\n ): EditExampleStringUC | undefined {\r\n return appObjects.get(id)?.getComponent<EditExampleStringUC>(this.type);\r\n }\r\n}\r\n\r\n/**\r\n * Factory function to create a new EditExampleStringUC\r\n * @param appObject The AppObject to attach the UC to\r\n * @returns A new EditExampleStringUC instance\r\n */\r\nexport function makeEditSlideTextUC(appObject: AppObject): EditExampleStringUC {\r\n return new EditSlideTextUCImp(appObject);\r\n}\r\n\r\n/**\r\n * Concrete implementation of EditExampleStringUC\r\n * This private class handles the actual implementation details\r\n */\r\nclass EditSlideTextUCImp extends EditExampleStringUC {\r\n /**\r\n * Gets the ExampleEntity from the same AppObject\r\n * Uses getCachedLocalComponent for efficient repeated access\r\n */\r\n private get exampleEntity() {\r\n return this.getCachedLocalComponent<ExampleEntity>(ExampleEntity.type);\r\n }\r\n\r\n /**\r\n * Implements the editExampleString method to update the entity's string property\r\n * @param text The new string value to set\r\n */\r\n editExampleString = (text: string) => {\r\n if (!this.exampleEntity) {\r\n this.warn(\"Unable to find AppState\");\r\n return;\r\n }\r\n\r\n // Update the entity property, which will trigger PM updates and UI refreshes\r\n this.exampleEntity.aStringProperty = text;\r\n };\r\n\r\n constructor(appObject: AppObject) {\r\n super(appObject, EditExampleStringUC.type);\r\n }\r\n}\r\n"]}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* ToggleExampleBooleanUC.ts
|
|
4
|
+
*
|
|
5
|
+
* This file demonstrates how to implement a Singleton Use Case (UC) component.
|
|
6
|
+
* Singleton UCs are special UCs that exist only once in the application and can be
|
|
7
|
+
* accessed globally. They handle business logic and operations that modify singleton entities.
|
|
8
|
+
*
|
|
9
|
+
* Key concepts:
|
|
10
|
+
* - Singleton UCs extend AppObjectUC like regular UCs
|
|
11
|
+
* - They register themselves as singletons with appObjects.registerSingleton()
|
|
12
|
+
* - They're accessed through a static get() method using getSingletonComponent()
|
|
13
|
+
* - They typically operate on singleton entities
|
|
14
|
+
*
|
|
15
|
+
* Usage pattern:
|
|
16
|
+
* 1. Access the singleton UC using the static get() method
|
|
17
|
+
* 2. Call the UC's methods to perform operations
|
|
18
|
+
* 3. The UC will update entities, which will trigger PM updates and UI refreshes
|
|
19
|
+
*/
|
|
20
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
+
exports.ToggleExampleBooleanUC = void 0;
|
|
22
|
+
exports.makeToggleExampleBooleanUC = makeToggleExampleBooleanUC;
|
|
23
|
+
const AppObject_1 = require("../../AppObject");
|
|
24
|
+
const getSingletonComponent_1 = require("../../AppObject/getSingletonComponent");
|
|
25
|
+
const ExampleSingletonEntity_1 = require("../Entities/ExampleSingletonEntity");
|
|
26
|
+
/**
|
|
27
|
+
* ToggleExampleBooleanUC provides functionality to toggle the boolean property
|
|
28
|
+
* of the SingletonEntityExample. As a singleton, only one instance exists in the application.
|
|
29
|
+
*/
|
|
30
|
+
class ToggleExampleBooleanUC extends AppObject_1.AppObjectUC {
|
|
31
|
+
}
|
|
32
|
+
exports.ToggleExampleBooleanUC = ToggleExampleBooleanUC;
|
|
33
|
+
/** Unique type identifier for this component */
|
|
34
|
+
ToggleExampleBooleanUC.type = "ToggleExampleBooleanUCType";
|
|
35
|
+
/**
|
|
36
|
+
* Global accessor for the singleton UC
|
|
37
|
+
* @param appObjects The AppObjectRepo to search in
|
|
38
|
+
* @returns The singleton UC or undefined if not created yet
|
|
39
|
+
*/
|
|
40
|
+
ToggleExampleBooleanUC.get = (appObjects) => (0, getSingletonComponent_1.getSingletonComponent)(ToggleExampleBooleanUC.type, appObjects);
|
|
41
|
+
/**
|
|
42
|
+
* Factory function to create a new ToggleExampleBooleanUC
|
|
43
|
+
* @param appObject The AppObject to attach the UC to
|
|
44
|
+
* @returns A new ToggleExampleBooleanUC instance
|
|
45
|
+
*/
|
|
46
|
+
function makeToggleExampleBooleanUC(appObject) {
|
|
47
|
+
return new ToggleExampleBooleanUCImp(appObject);
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Concrete implementation of ToggleExampleBooleanUC
|
|
51
|
+
* This private class handles the actual implementation details
|
|
52
|
+
*/
|
|
53
|
+
class ToggleExampleBooleanUCImp extends ToggleExampleBooleanUC {
|
|
54
|
+
/**
|
|
55
|
+
* Gets the SingletonEntityExample from the application
|
|
56
|
+
* Uses getCachedSingleton for efficient repeated access
|
|
57
|
+
*/
|
|
58
|
+
get singletonEntityExample() {
|
|
59
|
+
return this.getCachedSingleton(ExampleSingletonEntity_1.SingletonEntityExample.type);
|
|
60
|
+
}
|
|
61
|
+
constructor(appObject) {
|
|
62
|
+
super(appObject, ToggleExampleBooleanUC.type);
|
|
63
|
+
/**
|
|
64
|
+
* Implements the toggleExampleBoolean method to invert the entity's boolean property
|
|
65
|
+
*/
|
|
66
|
+
this.toggleExampleBoolean = () => {
|
|
67
|
+
if (!this.singletonEntityExample) {
|
|
68
|
+
this.warn("Unable to find SingletonEntityExample");
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
// Toggle the boolean property by inverting its current value
|
|
72
|
+
this.singletonEntityExample.aBoolProperty =
|
|
73
|
+
!this.singletonEntityExample?.aBoolProperty;
|
|
74
|
+
};
|
|
75
|
+
// Register this UC as a singleton so it can be accessed globally
|
|
76
|
+
this.appObjects.registerSingleton(this);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
//# sourceMappingURL=ToggleExampleBooleanUC.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ToggleExampleBooleanUC.js","sourceRoot":"","sources":["../../../../src/ExampleFeature/UCs/ToggleExampleBooleanUC.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;GAiBG;;;AAuCH,gEAIC;AAzCD,+CAIyB;AACzB,iFAA8E;AAC9E,+EAA4E;AAE5E;;;GAGG;AACH,MAAsB,sBAAuB,SAAQ,uBAAW;;AAAhE,wDAkBC;AAjBC,gDAAgD;AAChC,2BAAI,GAAG,4BAA4B,CAAC;AAOpD;;;;GAIG;AACI,0BAAG,GAAG,CACX,UAAyB,EACW,EAAE,CACtC,IAAA,6CAAqB,EAAC,sBAAsB,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC;AAGnE;;;;GAIG;AACH,SAAgB,0BAA0B,CACxC,SAAoB;IAEpB,OAAO,IAAI,yBAAyB,CAAC,SAAS,CAAC,CAAC;AAClD,CAAC;AAED;;;GAGG;AACH,MAAM,yBAA0B,SAAQ,sBAAsB;IAC5D;;;OAGG;IACH,IAAY,sBAAsB;QAChC,OAAO,IAAI,CAAC,kBAAkB,CAC5B,+CAAsB,CAAC,IAAI,CAC5B,CAAC;IACJ,CAAC;IAgBD,YAAY,SAAoB;QAC9B,KAAK,CAAC,SAAS,EAAE,sBAAsB,CAAC,IAAI,CAAC,CAAC;QAfhD;;WAEG;QACH,yBAAoB,GAAG,GAAG,EAAE;YAC1B,IAAI,CAAC,IAAI,CAAC,sBAAsB,EAAE,CAAC;gBACjC,IAAI,CAAC,IAAI,CAAC,uCAAuC,CAAC,CAAC;gBACnD,OAAO;YACT,CAAC;YAED,6DAA6D;YAC7D,IAAI,CAAC,sBAAsB,CAAC,aAAa;gBACvC,CAAC,IAAI,CAAC,sBAAsB,EAAE,aAAa,CAAC;QAChD,CAAC,CAAC;QAIA,iEAAiE;QACjE,IAAI,CAAC,UAAU,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAC;IAC1C,CAAC;CACF","sourcesContent":["/**\r\n * ToggleExampleBooleanUC.ts\r\n * \r\n * This file demonstrates how to implement a Singleton Use Case (UC) component.\r\n * Singleton UCs are special UCs that exist only once in the application and can be\r\n * accessed globally. They handle business logic and operations that modify singleton entities.\r\n * \r\n * Key concepts:\r\n * - Singleton UCs extend AppObjectUC like regular UCs\r\n * - They register themselves as singletons with appObjects.registerSingleton()\r\n * - They're accessed through a static get() method using getSingletonComponent()\r\n * - They typically operate on singleton entities\r\n * \r\n * Usage pattern:\r\n * 1. Access the singleton UC using the static get() method\r\n * 2. Call the UC's methods to perform operations\r\n * 3. The UC will update entities, which will trigger PM updates and UI refreshes\r\n */\r\n\r\nimport {\r\n AppObject,\r\n AppObjectRepo,\r\n AppObjectUC\r\n} from \"../../AppObject\";\r\nimport { getSingletonComponent } from \"../../AppObject/getSingletonComponent\";\r\nimport { SingletonEntityExample } from \"../Entities/ExampleSingletonEntity\";\r\n\r\n/**\r\n * ToggleExampleBooleanUC provides functionality to toggle the boolean property\r\n * of the SingletonEntityExample. As a singleton, only one instance exists in the application.\r\n */\r\nexport abstract class ToggleExampleBooleanUC extends AppObjectUC {\r\n /** Unique type identifier for this component */\r\n static readonly type = \"ToggleExampleBooleanUCType\";\r\n\r\n /**\r\n * Toggles the boolean property of the SingletonEntityExample\r\n */\r\n abstract toggleExampleBoolean(): void;\r\n\r\n /**\r\n * Global accessor for the singleton UC\r\n * @param appObjects The AppObjectRepo to search in\r\n * @returns The singleton UC or undefined if not created yet\r\n */\r\n static get = (\r\n appObjects: AppObjectRepo\r\n ): ToggleExampleBooleanUC | undefined =>\r\n getSingletonComponent(ToggleExampleBooleanUC.type, appObjects);\r\n}\r\n\r\n/**\r\n * Factory function to create a new ToggleExampleBooleanUC\r\n * @param appObject The AppObject to attach the UC to\r\n * @returns A new ToggleExampleBooleanUC instance\r\n */\r\nexport function makeToggleExampleBooleanUC(\r\n appObject: AppObject\r\n): ToggleExampleBooleanUC {\r\n return new ToggleExampleBooleanUCImp(appObject);\r\n}\r\n\r\n/**\r\n * Concrete implementation of ToggleExampleBooleanUC\r\n * This private class handles the actual implementation details\r\n */\r\nclass ToggleExampleBooleanUCImp extends ToggleExampleBooleanUC {\r\n /**\r\n * Gets the SingletonEntityExample from the application\r\n * Uses getCachedSingleton for efficient repeated access\r\n */\r\n private get singletonEntityExample() {\r\n return this.getCachedSingleton<SingletonEntityExample>(\r\n SingletonEntityExample.type\r\n );\r\n }\r\n\r\n /**\r\n * Implements the toggleExampleBoolean method to invert the entity's boolean property\r\n */\r\n toggleExampleBoolean = () => {\r\n if (!this.singletonEntityExample) {\r\n this.warn(\"Unable to find SingletonEntityExample\");\r\n return;\r\n }\r\n\r\n // Toggle the boolean property by inverting its current value\r\n this.singletonEntityExample.aBoolProperty =\r\n !this.singletonEntityExample?.aBoolProperty;\r\n };\r\n\r\n constructor(appObject: AppObject) {\r\n super(appObject, ToggleExampleBooleanUC.type);\r\n // Register this UC as a singleton so it can be accessed globally\r\n this.appObjects.registerSingleton(this);\r\n }\r\n}\r\n"]}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./EditExampleStringUC"), exports);
|
|
18
|
+
__exportStar(require("./ToggleExampleBooleanUC"), exports);
|
|
19
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/ExampleFeature/UCs/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,wDAAsC;AACtC,2DAAyC","sourcesContent":["export * from \"./EditExampleStringUC\";\r\nexport * from \"./ToggleExampleBooleanUC\";\r\n"]}
|