@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,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* setExampleText.ts
|
|
4
|
+
*
|
|
5
|
+
* This file demonstrates how to implement a Controller function.
|
|
6
|
+
* Controllers are simple functions that provide a simplified API for UI components
|
|
7
|
+
* to interact with Use Cases (UCs). They handle the details of finding the right
|
|
8
|
+
* UC and calling its methods with the appropriate parameters.
|
|
9
|
+
*
|
|
10
|
+
* Key concepts:
|
|
11
|
+
* - Controllers are functions that take parameters from UI components
|
|
12
|
+
* - They find the appropriate UC and call its methods
|
|
13
|
+
* - They handle error cases and provide appropriate feedback
|
|
14
|
+
* - They simplify the API for UI components
|
|
15
|
+
*
|
|
16
|
+
* Usage pattern (React example):
|
|
17
|
+
* ```typescript
|
|
18
|
+
* // In a React component
|
|
19
|
+
* function ExampleTextInput({ id, appObjects }) {
|
|
20
|
+
* const handleChange = (e) => {
|
|
21
|
+
* setExampleText(e.target.value, id, appObjects);
|
|
22
|
+
* };
|
|
23
|
+
* return <input onChange={handleChange} />;
|
|
24
|
+
* }
|
|
25
|
+
* ```
|
|
26
|
+
*/
|
|
27
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
28
|
+
exports.setExampleText = setExampleText;
|
|
29
|
+
const EditExampleStringUC_1 = require("../UCs/EditExampleStringUC");
|
|
30
|
+
/**
|
|
31
|
+
* Controller function to update the text of an ExampleEntity
|
|
32
|
+
*
|
|
33
|
+
* @param text The new text to set
|
|
34
|
+
* @param id The ID of the AppObject containing the EditExampleStringUC
|
|
35
|
+
* @param appObjects The application's AppObjectRepo
|
|
36
|
+
*/
|
|
37
|
+
function setExampleText(text, id, appObjects) {
|
|
38
|
+
// Find the Use Case using the provided ID
|
|
39
|
+
const uc = EditExampleStringUC_1.EditExampleStringUC.getById(id, appObjects);
|
|
40
|
+
// Handle the case where the UC doesn't exist
|
|
41
|
+
if (!uc) {
|
|
42
|
+
appObjects.submitWarning("setExampleText", "Unable to find EditExampleStringUC");
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
// Call the UC method to perform the operation
|
|
46
|
+
uc.editExampleString(text);
|
|
47
|
+
}
|
|
48
|
+
//# sourceMappingURL=setExampleText.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"setExampleText.js","sourceRoot":"","sources":["../../../../src/ExampleFeature/Controllers/setExampleText.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;;AAYH,wCAmBC;AA5BD,oEAAiE;AAEjE;;;;;;GAMG;AACH,SAAgB,cAAc,CAC5B,IAAY,EACZ,EAAU,EACV,UAAyB;IAEzB,0CAA0C;IAC1C,MAAM,EAAE,GAAG,yCAAmB,CAAC,OAAO,CAAC,EAAE,EAAE,UAAU,CAAC,CAAC;IAEvD,6CAA6C;IAC7C,IAAI,CAAC,EAAE,EAAE,CAAC;QACR,UAAU,CAAC,aAAa,CACtB,gBAAgB,EAChB,oCAAoC,CACrC,CAAC;QACF,OAAO;IACT,CAAC;IAED,8CAA8C;IAC9C,EAAE,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAC;AAC7B,CAAC","sourcesContent":["/**\r\n * setExampleText.ts\r\n * \r\n * This file demonstrates how to implement a Controller function.\r\n * Controllers are simple functions that provide a simplified API for UI components\r\n * to interact with Use Cases (UCs). They handle the details of finding the right\r\n * UC and calling its methods with the appropriate parameters.\r\n * \r\n * Key concepts:\r\n * - Controllers are functions that take parameters from UI components\r\n * - They find the appropriate UC and call its methods\r\n * - They handle error cases and provide appropriate feedback\r\n * - They simplify the API for UI components\r\n * \r\n * Usage pattern (React example):\r\n * ```typescript\r\n * // In a React component\r\n * function ExampleTextInput({ id, appObjects }) {\r\n * const handleChange = (e) => {\r\n * setExampleText(e.target.value, id, appObjects);\r\n * };\r\n * return <input onChange={handleChange} />;\r\n * }\r\n * ```\r\n */\r\n\r\nimport { AppObjectRepo } from \"../../AppObject\";\r\nimport { EditExampleStringUC } from \"../UCs/EditExampleStringUC\";\r\n\r\n/**\r\n * Controller function to update the text of an ExampleEntity\r\n * \r\n * @param text The new text to set\r\n * @param id The ID of the AppObject containing the EditExampleStringUC\r\n * @param appObjects The application's AppObjectRepo\r\n */\r\nexport function setExampleText(\r\n text: string,\r\n id: string,\r\n appObjects: AppObjectRepo\r\n) {\r\n // Find the Use Case using the provided ID\r\n const uc = EditExampleStringUC.getById(id, appObjects);\r\n \r\n // Handle the case where the UC doesn't exist\r\n if (!uc) {\r\n appObjects.submitWarning(\r\n \"setExampleText\",\r\n \"Unable to find EditExampleStringUC\"\r\n );\r\n return;\r\n }\r\n\r\n // Call the UC method to perform the operation\r\n uc.editExampleString(text);\r\n}\r\n"]}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* toggleExampleBoolean.ts
|
|
4
|
+
*
|
|
5
|
+
* This file demonstrates how to implement a Controller function for a singleton UC.
|
|
6
|
+
* This controller provides a simplified API for UI components to interact with
|
|
7
|
+
* the ToggleExampleBooleanUC singleton, handling the details of finding the UC
|
|
8
|
+
* and calling its method.
|
|
9
|
+
*
|
|
10
|
+
* Key concepts:
|
|
11
|
+
* - Controllers for singleton UCs don't need an ID parameter
|
|
12
|
+
* - They access the singleton UC using its static get() method
|
|
13
|
+
* - They handle error cases and provide appropriate feedback
|
|
14
|
+
* - They simplify the API for UI components
|
|
15
|
+
*
|
|
16
|
+
* Usage pattern (React example):
|
|
17
|
+
* ```typescript
|
|
18
|
+
* // In a React component
|
|
19
|
+
* function ToggleButton({ appObjects }) {
|
|
20
|
+
* return (
|
|
21
|
+
* <button onClick={() => toggleExampleBoolean(appObjects)}>
|
|
22
|
+
* Toggle
|
|
23
|
+
* </button>
|
|
24
|
+
* );
|
|
25
|
+
* }
|
|
26
|
+
* ```
|
|
27
|
+
*/
|
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
exports.toggleExampleBoolean = toggleExampleBoolean;
|
|
30
|
+
const ToggleExampleBooleanUC_1 = require("../UCs/ToggleExampleBooleanUC");
|
|
31
|
+
/**
|
|
32
|
+
* Controller function to toggle the boolean property of the SingletonEntityExample
|
|
33
|
+
*
|
|
34
|
+
* @param appObjects The application's AppObjectRepo
|
|
35
|
+
*/
|
|
36
|
+
function toggleExampleBoolean(appObjects) {
|
|
37
|
+
// Access the singleton UC using its static get method
|
|
38
|
+
const uc = ToggleExampleBooleanUC_1.ToggleExampleBooleanUC.get(appObjects);
|
|
39
|
+
// Handle the case where the UC doesn't exist yet
|
|
40
|
+
if (!uc) {
|
|
41
|
+
appObjects.submitWarning("toggleExampleBoolean", "Unable to find ToggleExampleBooleanUC");
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
// Call the UC method to perform the operation
|
|
45
|
+
uc.toggleExampleBoolean();
|
|
46
|
+
}
|
|
47
|
+
//# sourceMappingURL=toggleExampleBoolean.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toggleExampleBoolean.js","sourceRoot":"","sources":["../../../../src/ExampleFeature/Controllers/toggleExampleBoolean.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;;AAUH,oDAeC;AAtBD,0EAAuE;AAEvE;;;;GAIG;AACH,SAAgB,oBAAoB,CAAC,UAAyB;IAC5D,sDAAsD;IACtD,MAAM,EAAE,GAAG,+CAAsB,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;IAElD,iDAAiD;IACjD,IAAI,CAAC,EAAE,EAAE,CAAC;QACR,UAAU,CAAC,aAAa,CACtB,sBAAsB,EACtB,uCAAuC,CACxC,CAAC;QACF,OAAO;IACT,CAAC;IAED,8CAA8C;IAC9C,EAAE,CAAC,oBAAoB,EAAE,CAAC;AAC5B,CAAC","sourcesContent":["/**\r\n * toggleExampleBoolean.ts\r\n * \r\n * This file demonstrates how to implement a Controller function for a singleton UC.\r\n * This controller provides a simplified API for UI components to interact with \r\n * the ToggleExampleBooleanUC singleton, handling the details of finding the UC\r\n * and calling its method.\r\n * \r\n * Key concepts:\r\n * - Controllers for singleton UCs don't need an ID parameter\r\n * - They access the singleton UC using its static get() method\r\n * - They handle error cases and provide appropriate feedback\r\n * - They simplify the API for UI components\r\n * \r\n * Usage pattern (React example):\r\n * ```typescript\r\n * // In a React component\r\n * function ToggleButton({ appObjects }) {\r\n * return (\r\n * <button onClick={() => toggleExampleBoolean(appObjects)}>\r\n * Toggle\r\n * </button>\r\n * );\r\n * }\r\n * ```\r\n */\r\n\r\nimport { AppObjectRepo } from \"../../AppObject\";\r\nimport { ToggleExampleBooleanUC } from \"../UCs/ToggleExampleBooleanUC\";\r\n\r\n/**\r\n * Controller function to toggle the boolean property of the SingletonEntityExample\r\n * \r\n * @param appObjects The application's AppObjectRepo\r\n */\r\nexport function toggleExampleBoolean(appObjects: AppObjectRepo) {\r\n // Access the singleton UC using its static get method\r\n const uc = ToggleExampleBooleanUC.get(appObjects);\r\n \r\n // Handle the case where the UC doesn't exist yet\r\n if (!uc) {\r\n appObjects.submitWarning(\r\n \"toggleExampleBoolean\",\r\n \"Unable to find ToggleExampleBooleanUC\"\r\n );\r\n return;\r\n }\r\n\r\n // Call the UC method to perform the operation\r\n uc.toggleExampleBoolean();\r\n}\r\n"]}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* ExampleEntity.ts
|
|
4
|
+
*
|
|
5
|
+
* This file demonstrates how to implement a standard (non-singleton) entity in the application.
|
|
6
|
+
* Entities store and manage data, track state changes, and notify observers when changes occur.
|
|
7
|
+
*
|
|
8
|
+
* Key concepts:
|
|
9
|
+
* - Entity classes extend AppObjectEntity
|
|
10
|
+
* - They provide access to data properties
|
|
11
|
+
* - They use Memoized types (MemoizedString, MemoizedBoolean, etc.) to track changes
|
|
12
|
+
* - They notify observers when properties change
|
|
13
|
+
*
|
|
14
|
+
* Usage pattern:
|
|
15
|
+
* 1. Get or create an entity instance using getById, get, or addIfMissing
|
|
16
|
+
* 2. Access or modify properties via getters/setters
|
|
17
|
+
* 3. Register change observers to react to property updates
|
|
18
|
+
*/
|
|
19
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
|
+
exports.ExampleEntity = void 0;
|
|
21
|
+
exports.makeExampleEntity = makeExampleEntity;
|
|
22
|
+
const AppObject_1 = require("../../AppObject");
|
|
23
|
+
const MemoizedString_1 = require("../../Entities/MemoizedString");
|
|
24
|
+
/**
|
|
25
|
+
* ExampleEntity represents a basic entity with a string property.
|
|
26
|
+
* Abstract class provides the interface and static helper methods.
|
|
27
|
+
*/
|
|
28
|
+
class ExampleEntity extends AppObject_1.AppObjectEntity {
|
|
29
|
+
/**
|
|
30
|
+
* Retrieves an ExampleEntity component from an AppObject
|
|
31
|
+
* @param appObj The AppObject to get the component from
|
|
32
|
+
* @returns The ExampleEntity component or undefined if not found
|
|
33
|
+
*/
|
|
34
|
+
static get(appObj) {
|
|
35
|
+
return appObj.getComponent(this.type);
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Retrieves an ExampleEntity by its parent AppObject's ID
|
|
39
|
+
* @param id The ID of the parent AppObject
|
|
40
|
+
* @param appObjects The AppObjectRepo to search in
|
|
41
|
+
* @returns The ExampleEntity component or undefined if not found
|
|
42
|
+
*/
|
|
43
|
+
static getById(id, appObjects) {
|
|
44
|
+
return appObjects.get(id)?.getComponent(this.type);
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Ensures an ExampleEntity exists on the AppObject, creating one if needed
|
|
48
|
+
* @param appObj The AppObject to check/add the component to
|
|
49
|
+
* @returns The existing or newly created ExampleEntity
|
|
50
|
+
*/
|
|
51
|
+
static addIfMissing(appObj) {
|
|
52
|
+
const existing = appObj.getComponent(this.type);
|
|
53
|
+
if (existing) {
|
|
54
|
+
return existing;
|
|
55
|
+
}
|
|
56
|
+
else {
|
|
57
|
+
return makeExampleEntity(appObj);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
exports.ExampleEntity = ExampleEntity;
|
|
62
|
+
/** Unique type identifier for this component */
|
|
63
|
+
ExampleEntity.type = "ExampleEntityType";
|
|
64
|
+
/**
|
|
65
|
+
* Factory function to create a new ExampleEntity
|
|
66
|
+
* @param appObject The AppObject to attach the entity to
|
|
67
|
+
* @returns A new ExampleEntity instance
|
|
68
|
+
*/
|
|
69
|
+
function makeExampleEntity(appObject) {
|
|
70
|
+
return new ExampleEntityImp(appObject);
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Concrete implementation of ExampleEntity
|
|
74
|
+
* This private class handles the actual implementation details
|
|
75
|
+
*/
|
|
76
|
+
class ExampleEntityImp extends ExampleEntity {
|
|
77
|
+
// Property accessors that use the memoized value
|
|
78
|
+
get aStringProperty() {
|
|
79
|
+
return this.memoizedIsAuthoring.val;
|
|
80
|
+
}
|
|
81
|
+
set aStringProperty(val) {
|
|
82
|
+
this.memoizedIsAuthoring.val = val;
|
|
83
|
+
}
|
|
84
|
+
constructor(appObject) {
|
|
85
|
+
super(appObject, ExampleEntity.type);
|
|
86
|
+
// MemoizedString tracks changes to the string value and calls notifyOnChange when updated
|
|
87
|
+
this.memoizedIsAuthoring = new MemoizedString_1.MemoizedString("", this.notifyOnChange);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
//# sourceMappingURL=ExampleEntity.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ExampleEntity.js","sourceRoot":"","sources":["../../../../src/ExampleFeature/Entities/ExampleEntity.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;GAgBG;;;AA+DH,8CAIC;AAjED,+CAIyB;AACzB,kEAA+D;AAE/D;;;GAGG;AACH,MAAsB,aAAc,SAAQ,2BAAe;IAQzD;;;;OAIG;IACH,MAAM,CAAC,GAAG,CAAC,MAAiB;QAC1B,OAAO,MAAM,CAAC,YAAY,CAAgB,IAAI,CAAC,IAAI,CAAC,CAAC;IACvD,CAAC;IAED;;;;;OAKG;IACH,MAAM,CAAC,OAAO,CACZ,EAAU,EACV,UAAyB;QAEzB,OAAO,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,YAAY,CAAgB,IAAI,CAAC,IAAI,CAAC,CAAC;IACpE,CAAC;IAED;;;;OAIG;IACH,MAAM,CAAC,YAAY,CAAC,MAAiB;QACnC,MAAM,QAAQ,GAAG,MAAM,CAAC,YAAY,CAAgB,IAAI,CAAC,IAAI,CAAC,CAAC;QAC/D,IAAI,QAAQ,EAAE,CAAC;YACb,OAAO,QAAQ,CAAC;QAClB,CAAC;aAAM,CAAC;YACN,OAAO,iBAAiB,CAAC,MAAM,CAAC,CAAC;QACnC,CAAC;IACH,CAAC;;AA1CH,sCA2CC;AA1CC,gDAAgD;AAChC,kBAAI,GAAG,mBAAmB,CAAC;AA2C7C;;;;GAIG;AACH,SAAgB,iBAAiB,CAC/B,SAAoB;IAEpB,OAAO,IAAI,gBAAgB,CAAC,SAAS,CAAC,CAAC;AACzC,CAAC;AAED;;;GAGG;AACH,MAAM,gBAAiB,SAAQ,aAAa;IAI1C,iDAAiD;IACjD,IAAI,eAAe;QACjB,OAAO,IAAI,CAAC,mBAAmB,CAAC,GAAG,CAAC;IACtC,CAAC;IAED,IAAI,eAAe,CAAC,GAAW;QAC7B,IAAI,CAAC,mBAAmB,CAAC,GAAG,GAAG,GAAG,CAAC;IACrC,CAAC;IAED,YAAY,SAAoB;QAC9B,KAAK,CAAC,SAAS,EAAE,aAAa,CAAC,IAAI,CAAC,CAAC;QAbvC,0FAA0F;QAClF,wBAAmB,GAAG,IAAI,+BAAc,CAAC,EAAE,EAAE,IAAI,CAAC,cAAc,CAAC,CAAC;IAa1E,CAAC;CACF","sourcesContent":["/**\r\n * ExampleEntity.ts\r\n * \r\n * This file demonstrates how to implement a standard (non-singleton) entity in the application.\r\n * Entities store and manage data, track state changes, and notify observers when changes occur.\r\n * \r\n * Key concepts:\r\n * - Entity classes extend AppObjectEntity\r\n * - They provide access to data properties\r\n * - They use Memoized types (MemoizedString, MemoizedBoolean, etc.) to track changes\r\n * - They notify observers when properties change\r\n * \r\n * Usage pattern:\r\n * 1. Get or create an entity instance using getById, get, or addIfMissing\r\n * 2. Access or modify properties via getters/setters\r\n * 3. Register change observers to react to property updates\r\n */\r\n\r\nimport {\r\n AppObject,\r\n AppObjectEntity,\r\n AppObjectRepo\r\n} from \"../../AppObject\";\r\nimport { MemoizedString } from \"../../Entities/MemoizedString\";\r\n\r\n/**\r\n * ExampleEntity represents a basic entity with a string property.\r\n * Abstract class provides the interface and static helper methods.\r\n */\r\nexport abstract class ExampleEntity extends AppObjectEntity {\r\n /** Unique type identifier for this component */\r\n static readonly type = \"ExampleEntityType\";\r\n\r\n /** String property accessor methods that must be implemented */\r\n abstract get aStringProperty(): string;\r\n abstract set aStringProperty(val: string);\r\n\r\n /**\r\n * Retrieves an ExampleEntity component from an AppObject\r\n * @param appObj The AppObject to get the component from\r\n * @returns The ExampleEntity component or undefined if not found\r\n */\r\n static get(appObj: AppObject): ExampleEntity | undefined {\r\n return appObj.getComponent<ExampleEntity>(this.type);\r\n }\r\n\r\n /**\r\n * Retrieves an ExampleEntity 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 ExampleEntity component or undefined if not found\r\n */\r\n static getById(\r\n id: string,\r\n appObjects: AppObjectRepo\r\n ): ExampleEntity | undefined {\r\n return appObjects.get(id)?.getComponent<ExampleEntity>(this.type);\r\n }\r\n\r\n /**\r\n * Ensures an ExampleEntity exists on the AppObject, creating one if needed\r\n * @param appObj The AppObject to check/add the component to\r\n * @returns The existing or newly created ExampleEntity\r\n */\r\n static addIfMissing(appObj: AppObject): ExampleEntity {\r\n const existing = appObj.getComponent<ExampleEntity>(this.type);\r\n if (existing) {\r\n return existing;\r\n } else {\r\n return makeExampleEntity(appObj);\r\n }\r\n }\r\n}\r\n\r\n/**\r\n * Factory function to create a new ExampleEntity\r\n * @param appObject The AppObject to attach the entity to\r\n * @returns A new ExampleEntity instance\r\n */\r\nexport function makeExampleEntity(\r\n appObject: AppObject\r\n): ExampleEntity {\r\n return new ExampleEntityImp(appObject);\r\n}\r\n\r\n/**\r\n * Concrete implementation of ExampleEntity\r\n * This private class handles the actual implementation details\r\n */\r\nclass ExampleEntityImp extends ExampleEntity {\r\n // MemoizedString tracks changes to the string value and calls notifyOnChange when updated\r\n private memoizedIsAuthoring = new MemoizedString(\"\", this.notifyOnChange);\r\n \r\n // Property accessors that use the memoized value\r\n get aStringProperty() {\r\n return this.memoizedIsAuthoring.val;\r\n }\r\n \r\n set aStringProperty(val: string) {\r\n this.memoizedIsAuthoring.val = val;\r\n }\r\n\r\n constructor(appObject: AppObject) {\r\n super(appObject, ExampleEntity.type);\r\n }\r\n}\r\n"]}
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* ExampleRepo.ts
|
|
4
|
+
*
|
|
5
|
+
* This file demonstrates how to implement a repository to manage collections of entities.
|
|
6
|
+
* Repositories are responsible for creating, retrieving, and deleting entities.
|
|
7
|
+
*
|
|
8
|
+
* Key concepts:
|
|
9
|
+
* - Repositories extend AppObjectEntityRepo<T> where T is the entity type
|
|
10
|
+
* - They provide methods to create and delete entities
|
|
11
|
+
* - They manage collections of entities and provide access to them
|
|
12
|
+
* - They can use custom entity factories to create specialized entities
|
|
13
|
+
*
|
|
14
|
+
* Usage pattern:
|
|
15
|
+
* 1. Get or create a repository using getById, get, or addIfMissing
|
|
16
|
+
* 2. Use the repository to create new entities
|
|
17
|
+
* 3. Access entities through the repository's getters
|
|
18
|
+
* 4. Delete entities through the repository when they're no longer needed
|
|
19
|
+
*/
|
|
20
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
+
exports.ExampleRepo = void 0;
|
|
22
|
+
exports.makeExampleRepo = makeExampleRepo;
|
|
23
|
+
const AppObject_1 = require("../../AppObject");
|
|
24
|
+
const generateUniqueID_1 = require("../../Utilities/generateUniqueID");
|
|
25
|
+
const ExampleEntity_1 = require("./ExampleEntity");
|
|
26
|
+
/**
|
|
27
|
+
* ExampleRepo manages a collection of ExampleEntity instances.
|
|
28
|
+
* Abstract class provides the interface and static helper methods.
|
|
29
|
+
*/
|
|
30
|
+
class ExampleRepo extends AppObject_1.AppObjectEntityRepo {
|
|
31
|
+
/**
|
|
32
|
+
* Retrieves an ExampleRepo component from an AppObject
|
|
33
|
+
* @param appObj The AppObject to get the component from
|
|
34
|
+
* @returns The ExampleRepo component or undefined if not found
|
|
35
|
+
*/
|
|
36
|
+
static get(appObj) {
|
|
37
|
+
return appObj.getComponent(this.type);
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Retrieves an ExampleRepo by its parent AppObject's ID
|
|
41
|
+
* @param id The ID of the parent AppObject
|
|
42
|
+
* @param appObjects The AppObjectRepo to search in
|
|
43
|
+
* @returns The ExampleRepo component or undefined if not found
|
|
44
|
+
*/
|
|
45
|
+
static getById(id, appObjects) {
|
|
46
|
+
return appObjects.get(id)?.getComponent(this.type);
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Ensures an ExampleRepo exists on the AppObject, creating one if needed
|
|
50
|
+
* @param appObject The AppObject to check/add the component to
|
|
51
|
+
* @returns The existing or newly created ExampleRepo
|
|
52
|
+
*/
|
|
53
|
+
static addIfMissing(appObject) {
|
|
54
|
+
const existing = appObject.getComponent(ExampleRepo.type);
|
|
55
|
+
if (existing) {
|
|
56
|
+
return existing;
|
|
57
|
+
}
|
|
58
|
+
else {
|
|
59
|
+
return makeExampleRepo(appObject);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
exports.ExampleRepo = ExampleRepo;
|
|
64
|
+
/** Unique type identifier for this component */
|
|
65
|
+
ExampleRepo.type = "ExampleRepoType";
|
|
66
|
+
/**
|
|
67
|
+
* Factory function to create a new ExampleRepo
|
|
68
|
+
* @param appObject The AppObject to attach the repo to
|
|
69
|
+
* @returns A new ExampleRepo instance
|
|
70
|
+
*/
|
|
71
|
+
function makeExampleRepo(appObject) {
|
|
72
|
+
return new ExampleRepoImp(appObject);
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Concrete implementation of ExampleRepo
|
|
76
|
+
* This private class handles the actual implementation details
|
|
77
|
+
*/
|
|
78
|
+
class ExampleRepoImp extends ExampleRepo {
|
|
79
|
+
/**
|
|
80
|
+
* Deletes an ExampleEntity from the repository by its AppObject ID
|
|
81
|
+
* @param id The ID of the entity's AppObject
|
|
82
|
+
*/
|
|
83
|
+
deleteExampleEntity(id) {
|
|
84
|
+
const entity = this.getForAppObject(id);
|
|
85
|
+
if (!entity)
|
|
86
|
+
return;
|
|
87
|
+
entity.appObject.dispose();
|
|
88
|
+
this.removeForAppObject(id);
|
|
89
|
+
}
|
|
90
|
+
constructor(appObject) {
|
|
91
|
+
super(appObject, ExampleRepo.type);
|
|
92
|
+
/**
|
|
93
|
+
* Creates a new ExampleEntity and adds it to the repository
|
|
94
|
+
* @param id Optional ID for the entity's AppObject (generates one if not provided)
|
|
95
|
+
* @returns The newly created ExampleEntity
|
|
96
|
+
*/
|
|
97
|
+
this.createExampleEntity = (id) => {
|
|
98
|
+
const idToUse = id ?? (0, generateUniqueID_1.generateUniqueID)();
|
|
99
|
+
const entity = this.exampleEntityFactory(idToUse);
|
|
100
|
+
this.add(entity);
|
|
101
|
+
return entity;
|
|
102
|
+
};
|
|
103
|
+
/**
|
|
104
|
+
* Default factory implementation for creating ExampleEntity instances
|
|
105
|
+
* Can be overridden to create specialized entities
|
|
106
|
+
*/
|
|
107
|
+
this.exampleEntityFactory = (id) => {
|
|
108
|
+
const ao = this.appObjects.getOrCreate(id);
|
|
109
|
+
return (0, ExampleEntity_1.makeExampleEntity)(ao);
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
//# sourceMappingURL=ExampleRepo.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ExampleRepo.js","sourceRoot":"","sources":["../../../../src/ExampleFeature/Entities/ExampleRepo.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;GAiBG;;;AAwEH,0CAEC;AAxED,+CAIyB;AACzB,uEAAoE;AACpE,mDAAmE;AAKnE;;;GAGG;AACH,MAAsB,WAAY,SAAQ,+BAAkC;IAa1E;;;;OAIG;IACH,MAAM,CAAC,GAAG,CAAC,MAAiB;QAC1B,OAAO,MAAM,CAAC,YAAY,CAAc,IAAI,CAAC,IAAI,CAAC,CAAC;IACrD,CAAC;IAED;;;;;OAKG;IACH,MAAM,CAAC,OAAO,CACZ,EAAU,EACV,UAAyB;QAEzB,OAAO,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,YAAY,CAAc,IAAI,CAAC,IAAI,CAAC,CAAC;IAClE,CAAC;IAED;;;;OAIG;IACH,MAAM,CAAC,YAAY,CAAC,SAAoB;QACtC,MAAM,QAAQ,GAAG,SAAS,CAAC,YAAY,CAAc,WAAW,CAAC,IAAI,CAAC,CAAC;QACvE,IAAI,QAAQ,EAAE,CAAC;YACb,OAAO,QAAQ,CAAC;QAClB,CAAC;aAAM,CAAC;YACN,OAAO,eAAe,CAAC,SAAS,CAAC,CAAC;QACpC,CAAC;IACH,CAAC;;AA/CH,kCAgDC;AA/CC,gDAAgD;AAChC,gBAAI,GAAG,iBAAiB,CAAC;AAgD3C;;;;GAIG;AACH,SAAgB,eAAe,CAAC,SAAoB;IAClD,OAAO,IAAI,cAAc,CAAC,SAAS,CAAC,CAAC;AACvC,CAAC;AAED;;;GAGG;AACH,MAAM,cAAe,SAAQ,WAAW;IAatC;;;OAGG;IACH,mBAAmB,CAAC,EAAU;QAC5B,MAAM,MAAM,GAAG,IAAI,CAAC,eAAe,CAAC,EAAE,CAAC,CAAC;QACxC,IAAI,CAAC,MAAM;YAAE,OAAO;QAEpB,MAAM,CAAC,SAAS,CAAC,OAAO,EAAE,CAAC;QAC3B,IAAI,CAAC,kBAAkB,CAAC,EAAE,CAAC,CAAC;IAC9B,CAAC;IAWD,YAAY,SAAoB;QAC9B,KAAK,CAAC,SAAS,EAAE,WAAW,CAAC,IAAI,CAAC,CAAC;QAlCrC;;;;WAIG;QACH,wBAAmB,GAAG,CAAC,EAAsB,EAAiB,EAAE;YAC9D,MAAM,OAAO,GAAG,EAAE,IAAI,IAAA,mCAAgB,GAAE,CAAC;YACzC,MAAM,MAAM,GAAG,IAAI,CAAC,oBAAoB,CAAC,OAAO,CAAC,CAAC;YAClD,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;YACjB,OAAO,MAAM,CAAC;QAChB,CAAC,CAAC;QAcF;;;WAGG;QACH,yBAAoB,GAAG,CAAC,EAAU,EAAiB,EAAE;YACnD,MAAM,EAAE,GAAG,IAAI,CAAC,UAAU,CAAC,WAAW,CAAC,EAAE,CAAC,CAAC;YAC3C,OAAO,IAAA,iCAAiB,EAAC,EAAE,CAAC,CAAC;QAC/B,CAAC,CAAC;IAIF,CAAC;CACF","sourcesContent":["/**\r\n * ExampleRepo.ts\r\n * \r\n * This file demonstrates how to implement a repository to manage collections of entities.\r\n * Repositories are responsible for creating, retrieving, and deleting entities.\r\n * \r\n * Key concepts:\r\n * - Repositories extend AppObjectEntityRepo<T> where T is the entity type\r\n * - They provide methods to create and delete entities\r\n * - They manage collections of entities and provide access to them\r\n * - They can use custom entity factories to create specialized entities\r\n * \r\n * Usage pattern:\r\n * 1. Get or create a repository using getById, get, or addIfMissing\r\n * 2. Use the repository to create new entities\r\n * 3. Access entities through the repository's getters\r\n * 4. Delete entities through the repository when they're no longer needed\r\n */\r\n\r\nimport {\r\n AppObject,\r\n AppObjectEntityRepo,\r\n AppObjectRepo\r\n} from \"../../AppObject\";\r\nimport { generateUniqueID } from \"../../Utilities/generateUniqueID\";\r\nimport { ExampleEntity, makeExampleEntity } from \"./ExampleEntity\";\r\n\r\n/** Type definition for a factory function that creates ExampleEntity instances */\r\nexport type ExampleEntityFactory = (id: string) => ExampleEntity;\r\n\r\n/**\r\n * ExampleRepo manages a collection of ExampleEntity instances.\r\n * Abstract class provides the interface and static helper methods.\r\n */\r\nexport abstract class ExampleRepo extends AppObjectEntityRepo<ExampleEntity> {\r\n /** Unique type identifier for this component */\r\n static readonly type = \"ExampleRepoType\";\r\n\r\n /** Factory function used to create new entities */\r\n abstract exampleEntityFactory: ExampleEntityFactory;\r\n\r\n /** Creates a new entity with an optional ID */\r\n abstract createExampleEntity(id?: string): ExampleEntity;\r\n \r\n /** Deletes an entity by its AppObject ID */\r\n abstract deleteExampleEntity(id: string): void;\r\n\r\n /**\r\n * Retrieves an ExampleRepo component from an AppObject\r\n * @param appObj The AppObject to get the component from\r\n * @returns The ExampleRepo component or undefined if not found\r\n */\r\n static get(appObj: AppObject): ExampleRepo | undefined {\r\n return appObj.getComponent<ExampleRepo>(this.type);\r\n }\r\n\r\n /**\r\n * Retrieves an ExampleRepo 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 ExampleRepo component or undefined if not found\r\n */\r\n static getById(\r\n id: string,\r\n appObjects: AppObjectRepo\r\n ): ExampleRepo | undefined {\r\n return appObjects.get(id)?.getComponent<ExampleRepo>(this.type);\r\n }\r\n\r\n /**\r\n * Ensures an ExampleRepo exists on the AppObject, creating one if needed\r\n * @param appObject The AppObject to check/add the component to\r\n * @returns The existing or newly created ExampleRepo\r\n */\r\n static addIfMissing(appObject: AppObject): ExampleRepo {\r\n const existing = appObject.getComponent<ExampleRepo>(ExampleRepo.type);\r\n if (existing) {\r\n return existing;\r\n } else {\r\n return makeExampleRepo(appObject);\r\n }\r\n }\r\n}\r\n\r\n/**\r\n * Factory function to create a new ExampleRepo\r\n * @param appObject The AppObject to attach the repo to\r\n * @returns A new ExampleRepo instance\r\n */\r\nexport function makeExampleRepo(appObject: AppObject): ExampleRepo {\r\n return new ExampleRepoImp(appObject);\r\n}\r\n\r\n/**\r\n * Concrete implementation of ExampleRepo\r\n * This private class handles the actual implementation details\r\n */\r\nclass ExampleRepoImp extends ExampleRepo {\r\n /**\r\n * Creates a new ExampleEntity and adds it to the repository\r\n * @param id Optional ID for the entity's AppObject (generates one if not provided)\r\n * @returns The newly created ExampleEntity\r\n */\r\n createExampleEntity = (id: string | undefined): ExampleEntity => {\r\n const idToUse = id ?? generateUniqueID();\r\n const entity = this.exampleEntityFactory(idToUse);\r\n this.add(entity);\r\n return entity;\r\n };\r\n\r\n /**\r\n * Deletes an ExampleEntity from the repository by its AppObject ID\r\n * @param id The ID of the entity's AppObject\r\n */\r\n deleteExampleEntity(id: string): void {\r\n const entity = this.getForAppObject(id);\r\n if (!entity) return;\r\n\r\n entity.appObject.dispose();\r\n this.removeForAppObject(id);\r\n }\r\n\r\n /**\r\n * Default factory implementation for creating ExampleEntity instances\r\n * Can be overridden to create specialized entities\r\n */\r\n exampleEntityFactory = (id: string): ExampleEntity => {\r\n const ao = this.appObjects.getOrCreate(id);\r\n return makeExampleEntity(ao);\r\n };\r\n\r\n constructor(appObject: AppObject) {\r\n super(appObject, ExampleRepo.type);\r\n }\r\n}\r\n"]}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* ExampleSingletonEntity.ts
|
|
4
|
+
*
|
|
5
|
+
* This file demonstrates how to implement a singleton entity in the application.
|
|
6
|
+
* Singleton entities are special entities that exist only once in the application
|
|
7
|
+
* and can be accessed globally from anywhere.
|
|
8
|
+
*
|
|
9
|
+
* Key concepts:
|
|
10
|
+
* - Singleton entities extend AppObjectEntity like regular entities
|
|
11
|
+
* - They register themselves as singletons with appObjects.registerSingleton()
|
|
12
|
+
* - They're accessed through a static get() method using getSingletonComponent()
|
|
13
|
+
* - There's only one instance of a singleton entity in the entire application
|
|
14
|
+
*
|
|
15
|
+
* Usage pattern:
|
|
16
|
+
* 1. Access the singleton entity using the static get() method
|
|
17
|
+
* 2. Access or modify properties via getters/setters
|
|
18
|
+
* 3. Register change observers to react to property updates
|
|
19
|
+
*/
|
|
20
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
+
exports.SingletonEntityExample = void 0;
|
|
22
|
+
exports.makeSingletonEntityExample = makeSingletonEntityExample;
|
|
23
|
+
const AppObject_1 = require("../../AppObject");
|
|
24
|
+
const getSingletonComponent_1 = require("../../AppObject/getSingletonComponent");
|
|
25
|
+
const MemoizedBoolean_1 = require("../../Entities/MemoizedBoolean");
|
|
26
|
+
/**
|
|
27
|
+
* SingletonEntityExample represents a global entity with a boolean property.
|
|
28
|
+
* As a singleton, only one instance exists in the application.
|
|
29
|
+
*/
|
|
30
|
+
class SingletonEntityExample extends AppObject_1.AppObjectEntity {
|
|
31
|
+
}
|
|
32
|
+
exports.SingletonEntityExample = SingletonEntityExample;
|
|
33
|
+
/** Unique type identifier for this component */
|
|
34
|
+
SingletonEntityExample.type = "SingletonEntityExampleType";
|
|
35
|
+
/**
|
|
36
|
+
* Global accessor for the singleton entity
|
|
37
|
+
* @param appObjects The AppObjectRepo to search in
|
|
38
|
+
* @returns The singleton entity or undefined if not created yet
|
|
39
|
+
*/
|
|
40
|
+
SingletonEntityExample.get = (appObjects) => (0, getSingletonComponent_1.getSingletonComponent)(SingletonEntityExample.type, appObjects);
|
|
41
|
+
/**
|
|
42
|
+
* Factory function to create a new SingletonEntityExample
|
|
43
|
+
* @param appObject The AppObject to attach the entity to
|
|
44
|
+
* @returns A new SingletonEntityExample instance
|
|
45
|
+
*/
|
|
46
|
+
function makeSingletonEntityExample(appObject) {
|
|
47
|
+
return new SingletonEntityExampleImp(appObject);
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Concrete implementation of SingletonEntityExample
|
|
51
|
+
* This private class handles the actual implementation details
|
|
52
|
+
*/
|
|
53
|
+
class SingletonEntityExampleImp extends SingletonEntityExample {
|
|
54
|
+
// Property accessors that use the memoized value
|
|
55
|
+
get aBoolProperty() {
|
|
56
|
+
return this.memoizedIsAuthoring.val;
|
|
57
|
+
}
|
|
58
|
+
set aBoolProperty(val) {
|
|
59
|
+
this.memoizedIsAuthoring.val = val;
|
|
60
|
+
}
|
|
61
|
+
constructor(appObject) {
|
|
62
|
+
super(appObject, SingletonEntityExample.type);
|
|
63
|
+
// MemoizedBoolean tracks changes to the boolean value and calls notifyOnChange when updated
|
|
64
|
+
this.memoizedIsAuthoring = new MemoizedBoolean_1.MemoizedBoolean(false, this.notifyOnChange);
|
|
65
|
+
// Register this entity as a singleton so it can be accessed globally
|
|
66
|
+
this.appObjects.registerSingleton(this);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
//# sourceMappingURL=ExampleSingletonEntity.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ExampleSingletonEntity.js","sourceRoot":"","sources":["../../../../src/ExampleFeature/Entities/ExampleSingletonEntity.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;GAiBG;;;AAsCH,gEAIC;AAxCD,+CAIyB;AACzB,iFAA8E;AAC9E,oEAAiE;AAEjE;;;GAGG;AACH,MAAsB,sBAAuB,SAAQ,2BAAe;;AAApE,wDAiBC;AAhBC,gDAAgD;AAChC,2BAAI,GAAG,4BAA4B,CAAC;AAMpD;;;;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;IAI5D,iDAAiD;IACjD,IAAI,aAAa;QACf,OAAO,IAAI,CAAC,mBAAmB,CAAC,GAAG,CAAC;IACtC,CAAC;IAED,IAAI,aAAa,CAAC,GAAY;QAC5B,IAAI,CAAC,mBAAmB,CAAC,GAAG,GAAG,GAAG,CAAC;IACrC,CAAC;IAED,YAAY,SAAoB;QAC9B,KAAK,CAAC,SAAS,EAAE,sBAAsB,CAAC,IAAI,CAAC,CAAC;QAbhD,4FAA4F;QACpF,wBAAmB,GAAG,IAAI,iCAAe,CAAC,KAAK,EAAE,IAAI,CAAC,cAAc,CAAC,CAAC;QAa5E,qEAAqE;QACrE,IAAI,CAAC,UAAU,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAC;IAC1C,CAAC;CACF","sourcesContent":["/**\r\n * ExampleSingletonEntity.ts\r\n * \r\n * This file demonstrates how to implement a singleton entity in the application.\r\n * Singleton entities are special entities that exist only once in the application\r\n * and can be accessed globally from anywhere.\r\n * \r\n * Key concepts:\r\n * - Singleton entities extend AppObjectEntity like regular entities\r\n * - They register themselves as singletons with appObjects.registerSingleton()\r\n * - They're accessed through a static get() method using getSingletonComponent()\r\n * - There's only one instance of a singleton entity in the entire application\r\n * \r\n * Usage pattern:\r\n * 1. Access the singleton entity using the static get() method\r\n * 2. Access or modify properties via getters/setters\r\n * 3. Register change observers to react to property updates\r\n */\r\n\r\nimport {\r\n AppObject,\r\n AppObjectEntity,\r\n AppObjectRepo\r\n} from \"../../AppObject\";\r\nimport { getSingletonComponent } from \"../../AppObject/getSingletonComponent\";\r\nimport { MemoizedBoolean } from \"../../Entities/MemoizedBoolean\";\r\n\r\n/**\r\n * SingletonEntityExample represents a global entity with a boolean property.\r\n * As a singleton, only one instance exists in the application.\r\n */\r\nexport abstract class SingletonEntityExample extends AppObjectEntity {\r\n /** Unique type identifier for this component */\r\n static readonly type = \"SingletonEntityExampleType\";\r\n\r\n /** Boolean property accessor methods that must be implemented */\r\n abstract get aBoolProperty(): boolean;\r\n abstract set aBoolProperty(val: boolean);\r\n\r\n /**\r\n * Global accessor for the singleton entity\r\n * @param appObjects The AppObjectRepo to search in\r\n * @returns The singleton entity or undefined if not created yet\r\n */\r\n static get = (\r\n appObjects: AppObjectRepo\r\n ): SingletonEntityExample | undefined =>\r\n getSingletonComponent(SingletonEntityExample.type, appObjects);\r\n}\r\n\r\n/**\r\n * Factory function to create a new SingletonEntityExample\r\n * @param appObject The AppObject to attach the entity to\r\n * @returns A new SingletonEntityExample instance\r\n */\r\nexport function makeSingletonEntityExample(\r\n appObject: AppObject\r\n): SingletonEntityExample {\r\n return new SingletonEntityExampleImp(appObject);\r\n}\r\n\r\n/**\r\n * Concrete implementation of SingletonEntityExample\r\n * This private class handles the actual implementation details\r\n */\r\nclass SingletonEntityExampleImp extends SingletonEntityExample {\r\n // MemoizedBoolean tracks changes to the boolean value and calls notifyOnChange when updated\r\n private memoizedIsAuthoring = new MemoizedBoolean(false, this.notifyOnChange);\r\n \r\n // Property accessors that use the memoized value\r\n get aBoolProperty() {\r\n return this.memoizedIsAuthoring.val;\r\n }\r\n \r\n set aBoolProperty(val: boolean) {\r\n this.memoizedIsAuthoring.val = val;\r\n }\r\n\r\n constructor(appObject: AppObject) {\r\n super(appObject, SingletonEntityExample.type);\r\n // Register this entity as a singleton so it can be accessed globally\r\n this.appObjects.registerSingleton(this);\r\n }\r\n}\r\n"]}
|
|
@@ -0,0 +1,20 @@
|
|
|
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("./ExampleEntity"), exports);
|
|
18
|
+
__exportStar(require("./ExampleRepo"), exports);
|
|
19
|
+
__exportStar(require("./ExampleSingletonEntity"), exports);
|
|
20
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/ExampleFeature/Entities/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,kDAAgC;AAChC,gDAA8B;AAC9B,2DAAyC","sourcesContent":["export * from \"./ExampleEntity\";\r\nexport * from \"./ExampleRepo\";\r\nexport * from \"./ExampleSingletonEntity\";\r\n"]}
|
|
@@ -0,0 +1,18 @@
|
|
|
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("./setupExampleFeature"), exports);
|
|
18
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/ExampleFeature/Factory/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,wDAAsC","sourcesContent":["export * from \"./setupExampleFeature\";"]}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* setupExampleFeature.ts
|
|
4
|
+
*
|
|
5
|
+
* This file provides a setup function to initialize the ExampleFeature components.
|
|
6
|
+
* It creates a dedicated AppObject for ExampleFeature and adds all required
|
|
7
|
+
* singleton components to it.
|
|
8
|
+
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.setupExampleFeature = setupExampleFeature;
|
|
11
|
+
const ExampleSingletonEntity_1 = require("../Entities/ExampleSingletonEntity");
|
|
12
|
+
const ExampleSingletonPM_1 = require("../PMs/ExampleSingletonPM");
|
|
13
|
+
const ToggleExampleBooleanUC_1 = require("../UCs/ToggleExampleBooleanUC");
|
|
14
|
+
/**
|
|
15
|
+
* Sets up the ExampleFeature by creating an AppObject and attaching required components.
|
|
16
|
+
*
|
|
17
|
+
* @param appObjects - Repository of AppObjects to use for creating the feature
|
|
18
|
+
* @returns The singleton entity instance
|
|
19
|
+
*/
|
|
20
|
+
function setupExampleFeature(appObjects) {
|
|
21
|
+
// Create a dedicated AppObject for ExampleFeature
|
|
22
|
+
const appObject = appObjects.getOrCreate("ExampleFeature");
|
|
23
|
+
// Add singleton components to the AppObject
|
|
24
|
+
const entity = (0, ExampleSingletonEntity_1.makeSingletonEntityExample)(appObject);
|
|
25
|
+
(0, ExampleSingletonPM_1.makeExampleSingletonPM)(appObject);
|
|
26
|
+
(0, ToggleExampleBooleanUC_1.makeToggleExampleBooleanUC)(appObject);
|
|
27
|
+
return entity;
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=setupExampleFeature.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"setupExampleFeature.js","sourceRoot":"","sources":["../../../../src/ExampleFeature/Factory/setupExampleFeature.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;AAaH,kDAUC;AApBD,+EAAwG;AACxG,kEAAmE;AACnE,0EAA2E;AAE3E;;;;;GAKG;AACH,SAAgB,mBAAmB,CAAC,UAAyB;IAC3D,kDAAkD;IAClD,MAAM,SAAS,GAAG,UAAU,CAAC,WAAW,CAAC,gBAAgB,CAAC,CAAC;IAE3D,4CAA4C;IAC5C,MAAM,MAAM,GAAG,IAAA,mDAA0B,EAAC,SAAS,CAAC,CAAC;IACrD,IAAA,2CAAsB,EAAC,SAAS,CAAC,CAAC;IAClC,IAAA,mDAA0B,EAAC,SAAS,CAAC,CAAC;IAEtC,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["/**\r\n * setupExampleFeature.ts\r\n * \r\n * This file provides a setup function to initialize the ExampleFeature components.\r\n * It creates a dedicated AppObject for ExampleFeature and adds all required\r\n * singleton components to it.\r\n */\r\n\r\nimport { AppObjectRepo } from \"../../AppObject\";\r\nimport { makeSingletonEntityExample, SingletonEntityExample } from \"../Entities/ExampleSingletonEntity\";\r\nimport { makeExampleSingletonPM } from \"../PMs/ExampleSingletonPM\";\r\nimport { makeToggleExampleBooleanUC } from \"../UCs/ToggleExampleBooleanUC\";\r\n\r\n/**\r\n * Sets up the ExampleFeature by creating an AppObject and attaching required components.\r\n * \r\n * @param appObjects - Repository of AppObjects to use for creating the feature\r\n * @returns The singleton entity instance\r\n */\r\nexport function setupExampleFeature(appObjects: AppObjectRepo): SingletonEntityExample {\r\n // Create a dedicated AppObject for ExampleFeature\r\n const appObject = appObjects.getOrCreate(\"ExampleFeature\");\r\n \r\n // Add singleton components to the AppObject\r\n const entity = makeSingletonEntityExample(appObject);\r\n makeExampleSingletonPM(appObject);\r\n makeToggleExampleBooleanUC(appObject);\r\n \r\n return entity;\r\n}"]}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* MockEditExampleStringUC.ts
|
|
4
|
+
*
|
|
5
|
+
* This file demonstrates how to implement a mock UC for testing.
|
|
6
|
+
* Mock UCs extend the real UC classes but override their methods with test implementations.
|
|
7
|
+
* This allows tests to verify that the UC methods are called correctly without
|
|
8
|
+
* actually modifying entities or performing real operations.
|
|
9
|
+
*
|
|
10
|
+
* Key concepts:
|
|
11
|
+
* - Mock UCs extend the real UC classes
|
|
12
|
+
* - They override methods with test implementations (often empty or spy functions)
|
|
13
|
+
* - They're used in unit tests to isolate components from their dependencies
|
|
14
|
+
* - They help verify that methods are called with the correct parameters
|
|
15
|
+
*
|
|
16
|
+
* Usage pattern (in tests):
|
|
17
|
+
* ```typescript
|
|
18
|
+
* // In a test file
|
|
19
|
+
* const mockUC = new MockEditExampleStringUC(appObject);
|
|
20
|
+
* const spy = jest.spyOn(mockUC, 'editExampleString');
|
|
21
|
+
*
|
|
22
|
+
* // Call the function that should use the UC
|
|
23
|
+
* someFunction(appObject);
|
|
24
|
+
*
|
|
25
|
+
* // Verify the UC method was called correctly
|
|
26
|
+
* expect(spy).toHaveBeenCalledWith('expected value');
|
|
27
|
+
* ```
|
|
28
|
+
*/
|
|
29
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
30
|
+
exports.MockEditExampleStringUC = void 0;
|
|
31
|
+
const EditExampleStringUC_1 = require("../UCs/EditExampleStringUC");
|
|
32
|
+
/**
|
|
33
|
+
* Mock implementation of EditExampleStringUC for testing
|
|
34
|
+
* Provides a no-op implementation of editExampleString that can be spied on in tests
|
|
35
|
+
*/
|
|
36
|
+
class MockEditExampleStringUC extends EditExampleStringUC_1.EditExampleStringUC {
|
|
37
|
+
constructor(appObject) {
|
|
38
|
+
super(appObject, EditExampleStringUC_1.EditExampleStringUC.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.editExampleString = (text) => { };
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
exports.MockEditExampleStringUC = MockEditExampleStringUC;
|
|
47
|
+
//# sourceMappingURL=MockEditExampleStringUC.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MockEditExampleStringUC.js","sourceRoot":"","sources":["../../../../src/ExampleFeature/Mocks/MockEditExampleStringUC.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;;;AAGH,oEAAiE;AAEjE;;;GAGG;AACH,MAAa,uBAAwB,SAAQ,yCAAmB;IAO9D,YAAY,SAAoB;QAC9B,KAAK,CAAC,SAAS,EAAE,yCAAmB,CAAC,IAAI,CAAC,CAAC;QAP7C;;;WAGG;QACH,sBAAiB,GAAG,CAAC,IAAY,EAAQ,EAAE,GAAE,CAAC,CAAC;IAI/C,CAAC;CACF;AAVD,0DAUC","sourcesContent":["/**\r\n * MockEditExampleStringUC.ts\r\n * \r\n * This file demonstrates how to implement a mock UC for testing.\r\n * Mock UCs extend the real UC classes but override their methods with test implementations.\r\n * This allows tests to verify that the UC methods are called correctly without\r\n * actually modifying entities or performing real operations.\r\n * \r\n * Key concepts:\r\n * - Mock UCs extend the real UC classes\r\n * - They override methods with test implementations (often empty or spy functions)\r\n * - They're used in unit tests to isolate components from their dependencies\r\n * - They help verify that methods are called with the correct parameters\r\n * \r\n * Usage pattern (in tests):\r\n * ```typescript\r\n * // In a test file\r\n * const mockUC = new MockEditExampleStringUC(appObject);\r\n * const spy = jest.spyOn(mockUC, 'editExampleString');\r\n * \r\n * // Call the function that should use the UC\r\n * someFunction(appObject);\r\n * \r\n * // Verify the UC method was called correctly\r\n * expect(spy).toHaveBeenCalledWith('expected value');\r\n * ```\r\n */\r\n\r\nimport { AppObject } from \"../../AppObject\";\r\nimport { EditExampleStringUC } from \"../UCs/EditExampleStringUC\";\r\n\r\n/**\r\n * Mock implementation of EditExampleStringUC for testing\r\n * Provides a no-op implementation of editExampleString that can be spied on in tests\r\n */\r\nexport class MockEditExampleStringUC extends EditExampleStringUC {\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 editExampleString = (text: string): void => {};\r\n\r\n constructor(appObject: AppObject) {\r\n super(appObject, EditExampleStringUC.type);\r\n }\r\n}\r\n"]}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* MockExamplePM.ts
|
|
4
|
+
*
|
|
5
|
+
* This file demonstrates how to implement a mock PM for testing.
|
|
6
|
+
* Mock PMs extend the real PM classes but override their methods with test implementations.
|
|
7
|
+
* This allows tests to verify PM behavior without depending on real entities.
|
|
8
|
+
*
|
|
9
|
+
* Key concepts:
|
|
10
|
+
* - Mock PMs extend the real PM classes
|
|
11
|
+
* - They override methods with test implementations
|
|
12
|
+
* - They're used in unit tests to isolate components from their dependencies
|
|
13
|
+
* - They help test adapters and other components that use PMs
|
|
14
|
+
*
|
|
15
|
+
* Usage pattern (in tests):
|
|
16
|
+
* ```typescript
|
|
17
|
+
* // In a test file
|
|
18
|
+
* const mockPM = new MockExamplePM(appObject);
|
|
19
|
+
* const addViewSpy = jest.spyOn(mockPM, 'addView');
|
|
20
|
+
*
|
|
21
|
+
* // Test the component that uses the PM
|
|
22
|
+
* adapter.subscribe(id, 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.MockExamplePM = void 0;
|
|
30
|
+
const ExamplePM_1 = require("../PMs/ExamplePM");
|
|
31
|
+
/**
|
|
32
|
+
* Mock implementation of ExamplePM for testing
|
|
33
|
+
* Provides simplified implementations of required methods
|
|
34
|
+
*/
|
|
35
|
+
class MockExamplePM extends ExamplePM_1.ExamplePM {
|
|
36
|
+
constructor(appObject) {
|
|
37
|
+
super(appObject, ExamplePM_1.ExamplePM.type);
|
|
38
|
+
/**
|
|
39
|
+
* Simplified implementation that always returns true
|
|
40
|
+
* This avoids the need to implement real comparison logic in tests
|
|
41
|
+
*/
|
|
42
|
+
this.vmsAreEqual = () => {
|
|
43
|
+
return true;
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
exports.MockExamplePM = MockExamplePM;
|
|
48
|
+
//# sourceMappingURL=MockExamplePM.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MockExamplePM.js","sourceRoot":"","sources":["../../../../src/ExampleFeature/Mocks/MockExamplePM.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;;;AAGH,gDAA6C;AAE7C;;;GAGG;AACH,MAAa,aAAc,SAAQ,qBAAS;IAS1C,YAAY,SAAoB;QAC9B,KAAK,CAAC,SAAS,EAAE,qBAAS,CAAC,IAAI,CAAC,CAAC;QATnC;;;WAGG;QACH,gBAAW,GAAG,GAAG,EAAE;YACjB,OAAO,IAAI,CAAC;QACd,CAAC,CAAC;IAIF,CAAC;CACF;AAZD,sCAYC","sourcesContent":["/**\r\n * MockExamplePM.ts\r\n * \r\n * This file demonstrates how to implement a mock PM for testing.\r\n * Mock PMs extend the real PM classes but override their methods with test implementations.\r\n * This allows tests to verify PM behavior without depending on real entities.\r\n * \r\n * Key concepts:\r\n * - Mock PMs extend the real PM classes\r\n * - They override methods with test implementations\r\n * - They're used in unit tests to isolate components from their dependencies\r\n * - They help test adapters and other components that use PMs\r\n * \r\n * Usage pattern (in tests):\r\n * ```typescript\r\n * // In a test file\r\n * const mockPM = new MockExamplePM(appObject);\r\n * const addViewSpy = jest.spyOn(mockPM, 'addView');\r\n * \r\n * // Test the component that uses the PM\r\n * adapter.subscribe(id, 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 } from \"../../AppObject\";\r\nimport { ExamplePM } from \"../PMs/ExamplePM\";\r\n\r\n/**\r\n * Mock implementation of ExamplePM for testing\r\n * Provides simplified implementations of required methods\r\n */\r\nexport class MockExamplePM extends ExamplePM {\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, ExamplePM.type);\r\n }\r\n}\r\n"]}
|