@guilhermebkel/scenec 0.1.2 → 0.2.1
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 +34 -31
- package/dist/Adapters/FileReaderAdapter.d.ts +4 -0
- package/dist/Adapters/FileReaderAdapter.js +21 -0
- package/dist/Adapters/FontAdapter.d.ts +5 -0
- package/dist/Adapters/FontAdapter.js +13 -0
- package/dist/Adapters/ResvgAdapter.d.ts +11 -0
- package/dist/Adapters/ResvgAdapter.js +18 -0
- package/dist/Commands/BaseCommand.d.ts +11 -0
- package/dist/Commands/BaseCommand.js +13 -0
- package/dist/Commands/BestCommand.d.ts +11 -0
- package/dist/Commands/BestCommand.js +73 -0
- package/dist/Commands/CatalogCommand.d.ts +6 -0
- package/dist/Commands/CatalogCommand.js +24 -0
- package/dist/Commands/CheckCommand.d.ts +5 -0
- package/dist/Commands/CheckCommand.js +8 -0
- package/dist/Commands/RenderCommand.d.ts +7 -0
- package/dist/Commands/RenderCommand.js +15 -0
- package/dist/Commands/SceneCommand.d.ts +11 -0
- package/dist/Commands/SceneCommand.js +70 -0
- package/dist/Commands/SchemaCommand.d.ts +5 -0
- package/dist/Commands/SchemaCommand.js +12 -0
- package/dist/Data/cities.json +312 -0
- package/dist/Data/europe.json +1 -0
- package/dist/Errors/SceneError.d.ts +4 -0
- package/dist/Errors/SceneError.js +11 -0
- package/dist/Errors/UnsafeSvgError.d.ts +3 -0
- package/dist/Errors/UnsafeSvgError.js +9 -0
- package/dist/Modules/BestModule.d.ts +41 -0
- package/dist/Modules/BestModule.js +159 -0
- package/dist/Modules/CheckModule.d.ts +8 -0
- package/dist/Modules/CheckModule.js +16 -0
- package/dist/Modules/CompilationModule.d.ts +23 -0
- package/dist/Modules/CompilationModule.js +210 -0
- package/dist/Modules/CritiqueModule.d.ts +9 -0
- package/dist/Modules/CritiqueModule.js +98 -0
- package/dist/Modules/MapModule.d.ts +24 -0
- package/dist/Modules/MapModule.js +99 -0
- package/dist/Modules/ParsingModule.d.ts +17 -0
- package/dist/Modules/ParsingModule.js +88 -0
- package/dist/Modules/PlaneModule.d.ts +19 -0
- package/dist/Modules/PlaneModule.js +98 -0
- package/dist/Protocols/AssetProtocol.d.ts +67 -0
- package/dist/Protocols/AssetProtocol.js +109 -0
- package/dist/Protocols/CommandProtocol.d.ts +8 -0
- package/dist/Protocols/CommandProtocol.js +0 -0
- package/dist/Protocols/CompilationProtocol.d.ts +136 -0
- package/dist/Protocols/CompilationProtocol.js +0 -0
- package/dist/Protocols/CritiqueProtocol.d.ts +58 -0
- package/dist/Protocols/CritiqueProtocol.js +14 -0
- package/dist/Protocols/CustomAssetProtocol.d.ts +24 -0
- package/dist/Protocols/CustomAssetProtocol.js +0 -0
- package/dist/Protocols/GroupProtocol.d.ts +17 -0
- package/dist/Protocols/GroupProtocol.js +12 -0
- package/dist/Protocols/KitProtocol.d.ts +32 -0
- package/dist/Protocols/KitProtocol.js +23 -0
- package/dist/Protocols/MapProtocol.d.ts +77 -0
- package/dist/Protocols/MapProtocol.js +4 -0
- package/dist/Protocols/OptionsProtocol.js +0 -0
- package/dist/Protocols/PersonProtocol.d.ts +68 -0
- package/dist/Protocols/PersonProtocol.js +42 -0
- package/dist/Protocols/PlaneProtocol.d.ts +140 -0
- package/dist/Protocols/PlaneProtocol.js +4 -0
- package/dist/{pipeline/index.d.ts → Protocols/ResultProtocol.d.ts} +0 -2
- package/dist/Protocols/ResultProtocol.js +0 -0
- package/dist/Protocols/SceneProtocol.d.ts +824 -0
- package/dist/Protocols/SceneProtocol.js +357 -0
- package/dist/{protocols/theme.d.ts → Protocols/ThemeProtocol.d.ts} +4 -0
- package/dist/Protocols/ThemeProtocol.js +28 -0
- package/dist/Resources/Assets/BackpackAsset.d.ts +10 -0
- package/dist/Resources/Assets/BackpackAsset.js +31 -0
- package/dist/Resources/Assets/BallAsset.d.ts +10 -0
- package/dist/Resources/Assets/BallAsset.js +15 -0
- package/dist/Resources/Assets/BalloonsAsset.d.ts +10 -0
- package/dist/Resources/Assets/BalloonsAsset.js +26 -0
- package/dist/Resources/Assets/BaseAsset.d.ts +17 -0
- package/dist/Resources/Assets/BaseAsset.js +11 -0
- package/dist/Resources/Assets/BeachTowelAsset.d.ts +10 -0
- package/dist/Resources/Assets/BeachTowelAsset.js +14 -0
- package/dist/Resources/Assets/BedAsset.d.ts +12 -0
- package/dist/Resources/Assets/BedAsset.js +25 -0
- package/dist/Resources/Assets/BenchAsset.d.ts +11 -0
- package/dist/Resources/Assets/BenchAsset.js +24 -0
- package/dist/Resources/Assets/BicycleAsset.d.ts +10 -0
- package/dist/Resources/Assets/BicycleAsset.js +18 -0
- package/dist/Resources/Assets/BigPlantAsset.d.ts +10 -0
- package/dist/Resources/Assets/BigPlantAsset.js +26 -0
- package/dist/Resources/Assets/BirdAsset.d.ts +10 -0
- package/dist/Resources/Assets/BirdAsset.js +14 -0
- package/dist/Resources/Assets/BlackboardAsset.d.ts +11 -0
- package/dist/Resources/Assets/BlackboardAsset.js +20 -0
- package/dist/Resources/Assets/BoardAsset.d.ts +12 -0
- package/dist/Resources/Assets/BoardAsset.js +44 -0
- package/dist/Resources/Assets/BoatAsset.d.ts +10 -0
- package/dist/Resources/Assets/BoatAsset.js +15 -0
- package/dist/Resources/Assets/BooksAsset.d.ts +10 -0
- package/dist/Resources/Assets/BooksAsset.js +35 -0
- package/dist/Resources/Assets/BookshelfAsset.d.ts +10 -0
- package/dist/Resources/Assets/BookshelfAsset.js +33 -0
- package/dist/Resources/Assets/BuildingAsset.d.ts +14 -0
- package/dist/Resources/Assets/BuildingAsset.js +34 -0
- package/dist/Resources/Assets/BurgerAsset.d.ts +9 -0
- package/dist/Resources/Assets/BurgerAsset.js +23 -0
- package/dist/Resources/Assets/BushAsset.d.ts +10 -0
- package/dist/Resources/Assets/BushAsset.js +17 -0
- package/dist/Resources/Assets/CabinetAsset.d.ts +14 -0
- package/dist/Resources/Assets/CabinetAsset.js +49 -0
- package/dist/Resources/Assets/CablesAsset.d.ts +10 -0
- package/dist/Resources/Assets/CablesAsset.js +16 -0
- package/dist/Resources/Assets/CakeAsset.d.ts +10 -0
- package/dist/Resources/Assets/CakeAsset.js +29 -0
- package/dist/Resources/Assets/CapAsset.d.ts +10 -0
- package/dist/Resources/Assets/CapAsset.js +18 -0
- package/dist/Resources/Assets/CarAsset.d.ts +10 -0
- package/dist/Resources/Assets/CarAsset.js +29 -0
- package/dist/Resources/Assets/CatAsset.d.ts +10 -0
- package/dist/Resources/Assets/CatAsset.js +17 -0
- package/dist/Resources/Assets/ChairAsset.d.ts +16 -0
- package/dist/Resources/Assets/ChairAsset.js +55 -0
- package/dist/Resources/Assets/ChatBubbleAsset.d.ts +11 -0
- package/dist/Resources/Assets/ChatBubbleAsset.js +18 -0
- package/dist/Resources/Assets/ClockAsset.d.ts +11 -0
- package/dist/Resources/Assets/ClockAsset.js +22 -0
- package/dist/Resources/Assets/CloudAsset.d.ts +10 -0
- package/dist/Resources/Assets/CloudAsset.js +17 -0
- package/dist/Resources/Assets/CoffeeMachineAsset.d.ts +10 -0
- package/dist/Resources/Assets/CoffeeMachineAsset.js +23 -0
- package/dist/Resources/Assets/ConfettiAsset.d.ts +10 -0
- package/dist/Resources/Assets/ConfettiAsset.js +18 -0
- package/dist/Resources/Assets/CounterAsset.d.ts +11 -0
- package/dist/Resources/Assets/CounterAsset.js +29 -0
- package/dist/Resources/Assets/CupAsset.d.ts +10 -0
- package/dist/Resources/Assets/CupAsset.js +17 -0
- package/dist/Resources/Assets/CursorAsset.d.ts +11 -0
- package/dist/Resources/Assets/CursorAsset.js +17 -0
- package/dist/Resources/Assets/CustomAsset.d.ts +25 -0
- package/dist/Resources/Assets/CustomAsset.js +58 -0
- package/dist/Resources/Assets/DeskAsset.d.ts +11 -0
- package/dist/Resources/Assets/DeskAsset.js +40 -0
- package/dist/Resources/Assets/DeskSlabAsset.d.ts +18 -0
- package/dist/Resources/Assets/DeskSlabAsset.js +43 -0
- package/dist/Resources/Assets/DiplomaAsset.d.ts +10 -0
- package/dist/Resources/Assets/DiplomaAsset.js +23 -0
- package/dist/Resources/Assets/DogAsset.d.ts +10 -0
- package/dist/Resources/Assets/DogAsset.js +24 -0
- package/dist/Resources/Assets/DrawerUnitAsset.d.ts +14 -0
- package/dist/Resources/Assets/DrawerUnitAsset.js +35 -0
- package/dist/Resources/Assets/FenceAsset.d.ts +10 -0
- package/dist/Resources/Assets/FenceAsset.js +26 -0
- package/dist/Resources/Assets/FigurineAsset.d.ts +10 -0
- package/dist/Resources/Assets/FigurineAsset.js +24 -0
- package/dist/Resources/Assets/FinishFlagAsset.d.ts +10 -0
- package/dist/Resources/Assets/FinishFlagAsset.js +21 -0
- package/dist/Resources/Assets/FirstAidKitAsset.d.ts +10 -0
- package/dist/Resources/Assets/FirstAidKitAsset.js +19 -0
- package/dist/Resources/Assets/FloorLampAsset.d.ts +10 -0
- package/dist/Resources/Assets/FloorLampAsset.js +22 -0
- package/dist/Resources/Assets/FlowersAsset.d.ts +10 -0
- package/dist/Resources/Assets/FlowersAsset.js +37 -0
- package/dist/Resources/Assets/FrameAsset.d.ts +11 -0
- package/dist/Resources/Assets/FrameAsset.js +24 -0
- package/dist/Resources/Assets/FruitBowlAsset.d.ts +10 -0
- package/dist/Resources/Assets/FruitBowlAsset.js +16 -0
- package/dist/Resources/Assets/GlassShelfAsset.d.ts +17 -0
- package/dist/Resources/Assets/GlassShelfAsset.js +25 -0
- package/dist/Resources/Assets/GlobeAsset.d.ts +10 -0
- package/dist/Resources/Assets/GlobeAsset.js +18 -0
- package/dist/Resources/Assets/HeadphonesAsset.d.ts +10 -0
- package/dist/Resources/Assets/HeadphonesAsset.js +23 -0
- package/dist/Resources/Assets/HouseAsset.d.ts +10 -0
- package/dist/Resources/Assets/HouseAsset.js +58 -0
- package/dist/Resources/Assets/LabAsset.d.ts +10 -0
- package/dist/Resources/Assets/LabAsset.js +52 -0
- package/dist/Resources/Assets/LampAsset.d.ts +10 -0
- package/dist/Resources/Assets/LampAsset.js +16 -0
- package/dist/Resources/Assets/LaptopAsset.d.ts +10 -0
- package/dist/Resources/Assets/LaptopAsset.js +27 -0
- package/dist/Resources/Assets/LaptopOpenAsset.d.ts +10 -0
- package/dist/Resources/Assets/LaptopOpenAsset.js +29 -0
- package/dist/Resources/Assets/LightSwitchAsset.d.ts +11 -0
- package/dist/Resources/Assets/LightSwitchAsset.js +24 -0
- package/dist/Resources/Assets/MonitorAsset.d.ts +10 -0
- package/dist/Resources/Assets/MonitorAsset.js +40 -0
- package/dist/Resources/Assets/MoonAsset.d.ts +10 -0
- package/dist/Resources/Assets/MoonAsset.js +16 -0
- package/dist/Resources/Assets/MountainAsset.d.ts +10 -0
- package/dist/Resources/Assets/MountainAsset.js +15 -0
- package/dist/Resources/Assets/OfficeChairAsset.d.ts +10 -0
- package/dist/Resources/Assets/OfficeChairAsset.js +45 -0
- package/dist/Resources/Assets/PalmAsset.d.ts +10 -0
- package/dist/Resources/Assets/PalmAsset.js +32 -0
- package/dist/Resources/Assets/PaperCupAsset.d.ts +10 -0
- package/dist/Resources/Assets/PaperCupAsset.js +17 -0
- package/dist/Resources/Assets/PendantLampAsset.d.ts +10 -0
- package/dist/Resources/Assets/PendantLampAsset.js +16 -0
- package/dist/Resources/Assets/PennantAsset.d.ts +10 -0
- package/dist/Resources/Assets/PennantAsset.js +15 -0
- package/dist/Resources/Assets/PersonAsset.d.ts +10 -0
- package/dist/Resources/Assets/PersonAsset.js +15 -0
- package/dist/Resources/Assets/PhotoFrameAsset.d.ts +15 -0
- package/dist/Resources/Assets/PhotoFrameAsset.js +68 -0
- package/dist/Resources/Assets/PineAsset.d.ts +10 -0
- package/dist/Resources/Assets/PineAsset.js +21 -0
- package/dist/Resources/Assets/PizzaAsset.d.ts +10 -0
- package/dist/Resources/Assets/PizzaAsset.js +17 -0
- package/dist/Resources/Assets/PlantAsset.d.ts +10 -0
- package/dist/Resources/Assets/PlantAsset.js +17 -0
- package/dist/Resources/Assets/PlasticBagAsset.d.ts +10 -0
- package/dist/Resources/Assets/PlasticBagAsset.js +15 -0
- package/dist/Resources/Assets/PlateAsset.d.ts +10 -0
- package/dist/Resources/Assets/PlateAsset.js +17 -0
- package/dist/Resources/Assets/PodiumAsset.d.ts +11 -0
- package/dist/Resources/Assets/PodiumAsset.js +20 -0
- package/dist/Resources/Assets/RefrigeratorAsset.d.ts +11 -0
- package/dist/Resources/Assets/RefrigeratorAsset.js +21 -0
- package/dist/Resources/Assets/RollingCartAsset.d.ts +11 -0
- package/dist/Resources/Assets/RollingCartAsset.js +34 -0
- package/dist/Resources/Assets/RugAsset.d.ts +10 -0
- package/dist/Resources/Assets/RugAsset.js +19 -0
- package/dist/Resources/Assets/SandcastleAsset.d.ts +10 -0
- package/dist/Resources/Assets/SandcastleAsset.js +30 -0
- package/dist/Resources/Assets/SchoolAsset.d.ts +10 -0
- package/dist/Resources/Assets/SchoolAsset.js +32 -0
- package/dist/Resources/Assets/ShelfWallAsset.d.ts +11 -0
- package/dist/Resources/Assets/ShelfWallAsset.js +23 -0
- package/dist/Resources/Assets/SinkAsset.d.ts +11 -0
- package/dist/Resources/Assets/SinkAsset.js +21 -0
- package/dist/Resources/Assets/SofaAsset.d.ts +16 -0
- package/dist/Resources/Assets/SofaAsset.js +66 -0
- package/dist/Resources/Assets/StageAsset.d.ts +10 -0
- package/dist/Resources/Assets/StageAsset.js +44 -0
- package/dist/Resources/Assets/StarAsset.d.ts +10 -0
- package/dist/Resources/Assets/StarAsset.js +14 -0
- package/dist/Resources/Assets/StarsAsset.d.ts +17 -0
- package/dist/Resources/Assets/StarsAsset.js +55 -0
- package/dist/Resources/Assets/StethoscopeAsset.d.ts +10 -0
- package/dist/Resources/Assets/StethoscopeAsset.js +18 -0
- package/dist/Resources/Assets/StoveAsset.d.ts +11 -0
- package/dist/Resources/Assets/StoveAsset.js +20 -0
- package/dist/Resources/Assets/StreetlightAsset.d.ts +10 -0
- package/dist/Resources/Assets/StreetlightAsset.js +20 -0
- package/dist/Resources/Assets/SuitcaseAsset.d.ts +10 -0
- package/dist/Resources/Assets/SuitcaseAsset.js +42 -0
- package/dist/Resources/Assets/SunAsset.d.ts +10 -0
- package/dist/Resources/Assets/SunAsset.js +22 -0
- package/dist/Resources/Assets/TableAsset.d.ts +15 -0
- package/dist/Resources/Assets/TableAsset.js +21 -0
- package/dist/Resources/Assets/ToggleAsset.d.ts +11 -0
- package/dist/Resources/Assets/ToggleAsset.js +21 -0
- package/dist/Resources/Assets/TrashCanAsset.d.ts +10 -0
- package/dist/Resources/Assets/TrashCanAsset.js +31 -0
- package/dist/Resources/Assets/TreeAsset.d.ts +15 -0
- package/dist/Resources/Assets/TreeAsset.js +48 -0
- package/dist/Resources/Assets/TrophyAsset.d.ts +10 -0
- package/dist/Resources/Assets/TrophyAsset.js +16 -0
- package/dist/Resources/Assets/TumblerAsset.d.ts +10 -0
- package/dist/Resources/Assets/TumblerAsset.js +17 -0
- package/dist/Resources/Assets/TvAsset.d.ts +10 -0
- package/dist/Resources/Assets/TvAsset.js +29 -0
- package/dist/Resources/Assets/TvStandAsset.d.ts +11 -0
- package/dist/Resources/Assets/TvStandAsset.js +34 -0
- package/dist/Resources/Assets/UmbrellaAsset.d.ts +10 -0
- package/dist/Resources/Assets/UmbrellaAsset.js +17 -0
- package/dist/Resources/Assets/UniversityAsset.d.ts +10 -0
- package/dist/Resources/Assets/UniversityAsset.js +22 -0
- package/dist/Resources/Assets/VaseFlowersAsset.d.ts +10 -0
- package/dist/Resources/Assets/VaseFlowersAsset.js +16 -0
- package/dist/Resources/Assets/WaterCoolerAsset.d.ts +11 -0
- package/dist/Resources/Assets/WaterCoolerAsset.js +20 -0
- package/dist/Resources/Assets/WhiteboardAsset.d.ts +10 -0
- package/dist/Resources/Assets/WhiteboardAsset.js +18 -0
- package/dist/Resources/Assets/WindowAsset.d.ts +11 -0
- package/dist/Resources/Assets/WindowAsset.js +32 -0
- package/dist/Resources/Groups/BaseGroup.d.ts +7 -0
- package/dist/Resources/Groups/BaseGroup.js +5 -0
- package/dist/Resources/Groups/CelebrationGroup.d.ts +8 -0
- package/dist/Resources/Groups/CelebrationGroup.js +19 -0
- package/dist/Resources/Groups/ConversationGroup.d.ts +9 -0
- package/dist/Resources/Groups/ConversationGroup.js +17 -0
- package/dist/Resources/Groups/DiningGroup.d.ts +8 -0
- package/dist/Resources/Groups/DiningGroup.js +21 -0
- package/dist/Resources/Groups/MeetingGroup.d.ts +8 -0
- package/dist/Resources/Groups/MeetingGroup.js +22 -0
- package/dist/Resources/Groups/ParkBenchGroup.d.ts +8 -0
- package/dist/Resources/Groups/ParkBenchGroup.js +17 -0
- package/dist/Resources/Groups/ReadingCornerGroup.d.ts +8 -0
- package/dist/Resources/Groups/ReadingCornerGroup.js +17 -0
- package/dist/Resources/Groups/WorkspaceGroup.d.ts +10 -0
- package/dist/Resources/Groups/WorkspaceGroup.js +25 -0
- package/dist/Resources/Kits/BaseKit.d.ts +13 -0
- package/dist/Resources/Kits/BaseKit.js +12 -0
- package/dist/Resources/Kits/ClayKit.d.ts +9 -0
- package/dist/Resources/Kits/ClayKit.js +11 -0
- package/dist/Resources/Kits/DuotoneKit.d.ts +16 -0
- package/dist/Resources/Kits/DuotoneKit.js +18 -0
- package/dist/Resources/Kits/FlatKit.d.ts +5 -0
- package/dist/Resources/Kits/FlatKit.js +8 -0
- package/dist/Resources/Kits/HatchKit.d.ts +15 -0
- package/dist/Resources/Kits/HatchKit.js +12 -0
- package/dist/Resources/Kits/IsometricKit.d.ts +8 -0
- package/dist/Resources/Kits/IsometricKit.js +10 -0
- package/dist/Resources/Kits/OutlineKit.d.ts +15 -0
- package/dist/Resources/Kits/OutlineKit.js +10 -0
- package/dist/Resources/Kits/PaperKit.d.ts +13 -0
- package/dist/Resources/Kits/PaperKit.js +12 -0
- package/dist/Resources/Kits/PosterKit.d.ts +14 -0
- package/dist/Resources/Kits/PosterKit.js +16 -0
- package/dist/Resources/Kits/RisoKit.d.ts +16 -0
- package/dist/Resources/Kits/RisoKit.js +11 -0
- package/dist/Resources/Kits/SketchKit.d.ts +10 -0
- package/dist/Resources/Kits/SketchKit.js +12 -0
- package/dist/Resources/Themes/BaseTheme.d.ts +5 -0
- package/dist/Resources/Themes/BaseTheme.js +5 -0
- package/dist/Resources/Themes/BeachTheme.d.ts +6 -0
- package/dist/Resources/Themes/BeachTheme.js +31 -0
- package/dist/Resources/Themes/FlatAutumnTheme.d.ts +6 -0
- package/dist/Resources/Themes/FlatAutumnTheme.js +29 -0
- package/dist/Resources/Themes/FlatCoolTheme.d.ts +6 -0
- package/dist/Resources/Themes/FlatCoolTheme.js +29 -0
- package/dist/Resources/Themes/NightTheme.d.ts +6 -0
- package/dist/Resources/Themes/NightTheme.js +29 -0
- package/dist/Resources/Themes/WarmCafeTheme.d.ts +6 -0
- package/dist/Resources/Themes/WarmCafeTheme.js +29 -0
- package/dist/Services/AssetService.d.ts +12 -0
- package/dist/Services/AssetService.js +232 -0
- package/dist/Services/BackgroundService.d.ts +41 -0
- package/dist/Services/BackgroundService.js +177 -0
- package/dist/Services/BalanceCritiqueService.d.ts +13 -0
- package/dist/Services/BalanceCritiqueService.js +64 -0
- package/dist/Services/CameraService.d.ts +21 -0
- package/dist/Services/CameraService.js +121 -0
- package/dist/Services/CatalogService.d.ts +30 -0
- package/dist/Services/CatalogService.js +56 -0
- package/dist/Services/ColorCritiqueService.d.ts +42 -0
- package/dist/Services/ColorCritiqueService.js +232 -0
- package/dist/Services/ContextService.d.ts +21 -0
- package/dist/Services/ContextService.js +98 -0
- package/dist/Services/CoverageCritiqueService.d.ts +16 -0
- package/dist/Services/CoverageCritiqueService.js +84 -0
- package/dist/Services/CustomAssetService.d.ts +31 -0
- package/dist/Services/CustomAssetService.js +184 -0
- package/dist/Services/DependencyOrderService.d.ts +12 -0
- package/dist/Services/DependencyOrderService.js +73 -0
- package/dist/Services/DescriptionService.d.ts +10 -0
- package/dist/Services/DescriptionService.js +33 -0
- package/dist/Services/DetailService.d.ts +7 -0
- package/dist/Services/DetailService.js +18 -0
- package/dist/Services/FocusCritiqueService.d.ts +23 -0
- package/dist/Services/FocusCritiqueService.js +166 -0
- package/dist/Services/FramingCheckService.d.ts +15 -0
- package/dist/Services/FramingCheckService.js +93 -0
- package/dist/Services/FramingService.d.ts +31 -0
- package/dist/Services/FramingService.js +108 -0
- package/dist/Services/GazeService.d.ts +6 -0
- package/dist/Services/GazeService.js +45 -0
- package/dist/Services/GroundDetailService.d.ts +50 -0
- package/dist/Services/GroundDetailService.js +115 -0
- package/dist/Services/GroupService.d.ts +17 -0
- package/dist/Services/GroupService.js +152 -0
- package/dist/Services/KitService.d.ts +32 -0
- package/dist/Services/KitService.js +131 -0
- package/dist/Services/LightingService.d.ts +39 -0
- package/dist/Services/LightingService.js +237 -0
- package/dist/Services/MapBaseService.d.ts +24 -0
- package/dist/Services/MapBaseService.js +104 -0
- package/dist/Services/MapLabelService.d.ts +26 -0
- package/dist/Services/MapLabelService.js +185 -0
- package/dist/Services/MapLegService.d.ts +23 -0
- package/dist/Services/MapLegService.js +87 -0
- package/dist/Services/MapPanelService.d.ts +16 -0
- package/dist/Services/MapPanelService.js +89 -0
- package/dist/Services/MapPinService.d.ts +11 -0
- package/dist/Services/MapPinService.js +56 -0
- package/dist/Services/MapProjectionService.d.ts +14 -0
- package/dist/Services/MapProjectionService.js +70 -0
- package/dist/Services/MapRouteService.d.ts +17 -0
- package/dist/Services/MapRouteService.js +79 -0
- package/dist/Services/PaletteService.d.ts +108 -0
- package/dist/Services/PaletteService.js +282 -0
- package/dist/Services/PieceService.d.ts +47 -0
- package/dist/Services/PieceService.js +175 -0
- package/dist/Services/PlacementService.d.ts +60 -0
- package/dist/Services/PlacementService.js +421 -0
- package/dist/Services/PlaneBackgroundService.d.ts +28 -0
- package/dist/Services/PlaneBackgroundService.js +209 -0
- package/dist/Services/PlaneBoxService.d.ts +27 -0
- package/dist/Services/PlaneBoxService.js +209 -0
- package/dist/Services/PlaneDepthService.d.ts +18 -0
- package/dist/Services/PlaneDepthService.js +146 -0
- package/dist/Services/PlaneLabelService.d.ts +13 -0
- package/dist/Services/PlaneLabelService.js +115 -0
- package/dist/Services/PlaneObjectService.d.ts +17 -0
- package/dist/Services/PlaneObjectService.js +147 -0
- package/dist/Services/PlanePathService.d.ts +15 -0
- package/dist/Services/PlanePathService.js +98 -0
- package/dist/Services/PlaneProjectionService.d.ts +20 -0
- package/dist/Services/PlaneProjectionService.js +119 -0
- package/dist/Services/PlaneRoadService.d.ts +13 -0
- package/dist/Services/PlaneRoadService.js +105 -0
- package/dist/Services/PlaneScatterService.d.ts +11 -0
- package/dist/Services/PlaneScatterService.js +48 -0
- package/dist/Services/PlaneSpaceService.d.ts +27 -0
- package/dist/Services/PlaneSpaceService.js +96 -0
- package/dist/Services/PlaneSpriteService.d.ts +29 -0
- package/dist/Services/PlaneSpriteService.js +95 -0
- package/dist/Services/PlaneTitleService.d.ts +17 -0
- package/dist/Services/PlaneTitleService.js +126 -0
- package/dist/Services/PlaneZoneService.d.ts +20 -0
- package/dist/Services/PlaneZoneService.js +121 -0
- package/dist/Services/RasterService.d.ts +10 -0
- package/dist/Services/RasterService.js +85 -0
- package/dist/Services/RidgeService.d.ts +31 -0
- package/dist/Services/RidgeService.js +85 -0
- package/dist/Services/ScaleCritiqueService.d.ts +11 -0
- package/dist/Services/ScaleCritiqueService.js +57 -0
- package/dist/Services/SchemaService.d.ts +3 -0
- package/dist/Services/SchemaService.js +10 -0
- package/dist/Services/SilhouetteCritiqueService.d.ts +32 -0
- package/dist/Services/SilhouetteCritiqueService.js +155 -0
- package/dist/Services/SkyDetailService.d.ts +39 -0
- package/dist/Services/SkyDetailService.js +95 -0
- package/dist/Services/TangentCritiqueService.d.ts +23 -0
- package/dist/Services/TangentCritiqueService.js +136 -0
- package/dist/Services/TextService.d.ts +87 -0
- package/dist/Services/TextService.js +434 -0
- package/dist/Services/ThemeService.d.ts +5 -0
- package/dist/Services/ThemeService.js +18 -0
- package/dist/Services/ThumbnailCritiqueService.d.ts +30 -0
- package/dist/Services/ThumbnailCritiqueService.js +130 -0
- package/dist/Utils/BoxUtil.d.ts +4 -0
- package/dist/Utils/BoxUtil.js +8 -0
- package/dist/Utils/ColorUtil.d.ts +34 -0
- package/dist/Utils/ColorUtil.js +114 -0
- package/dist/Utils/CurveUtil.d.ts +6 -0
- package/dist/Utils/CurveUtil.js +35 -0
- package/dist/Utils/DetailUtil.d.ts +7 -0
- package/dist/Utils/DetailUtil.js +15 -0
- package/dist/Utils/FallbackUtil.d.ts +3 -0
- package/dist/Utils/FallbackUtil.js +8 -0
- package/dist/Utils/FontMetricsUtil.d.ts +7 -0
- package/dist/Utils/FontMetricsUtil.js +694 -0
- package/dist/Utils/FormatUtil.d.ts +4 -0
- package/dist/Utils/FormatUtil.js +9 -0
- package/dist/Utils/IdUtil.d.ts +4 -0
- package/dist/Utils/IdUtil.js +11 -0
- package/dist/Utils/NormalizeUtil.d.ts +4 -0
- package/dist/Utils/NormalizeUtil.js +9 -0
- package/dist/Utils/OklabUtil.d.ts +41 -0
- package/dist/Utils/OklabUtil.js +151 -0
- package/dist/Utils/PersonArmUtil.d.ts +31 -0
- package/dist/Utils/PersonArmUtil.js +132 -0
- package/dist/Utils/PersonHeadUtil.d.ts +31 -0
- package/dist/Utils/PersonHeadUtil.js +156 -0
- package/dist/Utils/PersonOutfitUtil.d.ts +64 -0
- package/dist/Utils/PersonOutfitUtil.js +254 -0
- package/dist/Utils/PersonUtil.d.ts +41 -0
- package/dist/Utils/PersonUtil.js +216 -0
- package/dist/Utils/PixelUtil.d.ts +3 -0
- package/dist/Utils/PixelUtil.js +8 -0
- package/dist/Utils/RecolorUtil.d.ts +40 -0
- package/dist/Utils/RecolorUtil.js +155 -0
- package/dist/Utils/RegistryUtil.d.ts +8 -0
- package/dist/Utils/RegistryUtil.js +19 -0
- package/dist/Utils/RequireUtil.d.ts +3 -0
- package/dist/Utils/RequireUtil.js +11 -0
- package/dist/Utils/SanitizeUtil.d.ts +25 -0
- package/dist/Utils/SanitizeUtil.js +211 -0
- package/dist/Utils/SeedUtil.d.ts +6 -0
- package/dist/Utils/SeedUtil.js +15 -0
- package/dist/Utils/ShapeUtil.d.ts +40 -0
- package/dist/Utils/ShapeUtil.js +73 -0
- package/dist/Utils/SuggestUtil.d.ts +7 -0
- package/dist/Utils/SuggestUtil.js +25 -0
- package/dist/Utils/SvgUtil.d.ts +9 -0
- package/dist/Utils/SvgUtil.js +21 -0
- package/dist/Utils/ThemeUtil.d.ts +4 -0
- package/dist/Utils/ThemeUtil.js +13 -0
- package/dist/Utils/TransportUtil.d.ts +24 -0
- package/dist/Utils/TransportUtil.js +108 -0
- package/dist/Utils/TypesettingUtil.d.ts +17 -0
- package/dist/Utils/TypesettingUtil.js +92 -0
- package/dist/cli.js +52 -96
- package/dist/index.d.ts +10 -6
- package/dist/index.js +14 -2
- package/dist/render.d.ts +10 -5
- package/dist/render.js +26 -3
- package/dist/schema.d.ts +9 -2
- package/dist/schema.js +29 -5
- package/fonts/DMSerifDisplay-Regular.ttf +0 -0
- package/fonts/OFL.txt +2 -0
- package/fonts/PatrickHand-Regular.ttf +0 -0
- package/package.json +3 -2
- package/skills/{scenec → draw-scene}/SKILL.md +17 -20
- package/skills/{scenec/recipes/carrossel.yaml → draw-scene/recipes/carousel.yaml} +1 -1
- package/skills/draw-scene/recipes/conference-keynote.yaml +43 -0
- package/skills/draw-scene/recipes/product-feature.yaml +41 -0
- package/skills/{scenec/recipes/ilustracoes-produto.yaml → draw-scene/recipes/product-illustration.yaml} +2 -1
- package/skills/{scenec → draw-scene}/references/catalog.md +33 -15
- package/skills/{scenec → draw-scene}/references/dsl.md +32 -8
- package/dist/catalog.d.ts +0 -21
- package/dist/catalog.js +0 -35
- package/dist/data/europe.json +0 -1
- package/dist/drawing/assets.d.ts +0 -8
- package/dist/drawing/assets.js +0 -612
- package/dist/drawing/kits.d.ts +0 -7
- package/dist/drawing/kits.js +0 -92
- package/dist/drawing/person.d.ts +0 -18
- package/dist/drawing/person.js +0 -287
- package/dist/drawing/themes.d.ts +0 -4
- package/dist/drawing/themes.js +0 -45
- package/dist/modes/map.d.ts +0 -5
- package/dist/modes/map.js +0 -365
- package/dist/modes/plane.d.ts +0 -5
- package/dist/modes/plane.js +0 -716
- package/dist/pipeline/compile.d.ts +0 -2
- package/dist/pipeline/compile.js +0 -581
- package/dist/pipeline/custom.d.ts +0 -2
- package/dist/pipeline/custom.js +0 -120
- package/dist/pipeline/groups.d.ts +0 -2
- package/dist/pipeline/groups.js +0 -189
- package/dist/pipeline/index.js +0 -7
- package/dist/pipeline/parse.d.ts +0 -10
- package/dist/pipeline/parse.js +0 -80
- package/dist/protocols/options.js +0 -1
- package/dist/protocols/scene.d.ts +0 -299
- package/dist/protocols/scene.js +0 -118
- package/dist/protocols/theme.js +0 -1
- package/dist/render/check.d.ts +0 -6
- package/dist/render/check.js +0 -10
- package/dist/render/critic.d.ts +0 -1
- package/dist/render/critic.js +0 -235
- package/dist/render/files.d.ts +0 -2
- package/dist/render/files.js +0 -16
- package/dist/render/fonts.d.ts +0 -2
- package/dist/render/fonts.js +0 -4
- package/dist/render/png.d.ts +0 -9
- package/dist/render/png.js +0 -13
- package/dist/utils/color.d.ts +0 -5
- package/dist/utils/color.js +0 -35
- package/dist/utils/recolor.d.ts +0 -1
- package/dist/utils/recolor.js +0 -56
- package/dist/utils/sanitize.d.ts +0 -5
- package/dist/utils/sanitize.js +0 -169
- package/dist/utils/suggest.d.ts +0 -1
- package/dist/utils/suggest.js +0 -22
- package/dist/utils/svg.d.ts +0 -2
- package/dist/utils/svg.js +0 -11
- package/skills/scenec/references/fontes.md +0 -8
- /package/dist/{protocols/options.d.ts → Protocols/OptionsProtocol.d.ts} +0 -0
- /package/skills/{scenec/recipes/anuncios-variacoes.yaml → draw-scene/recipes/ad-variations.yaml} +0 -0
- /package/skills/{scenec/recipes/elearning.yaml → draw-scene/recipes/e-learning.yaml} +0 -0
- /package/skills/{scenec/recipes/reels-explicativo.yaml → draw-scene/recipes/explainer-reel.yaml} +0 -0
- /package/skills/{scenec/recipes/historia-ilustrada.yaml → draw-scene/recipes/illustrated-story.yaml} +0 -0
- /package/skills/{scenec/recipes/mapas-jornadas.yaml → draw-scene/recipes/journey-map.yaml} +0 -0
- /package/skills/{scenec/recipes/wrapped-personalizado.yaml → draw-scene/recipes/personalized-wrapped.yaml} +0 -0
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { SETTING_NAMES } from "../Protocols/SceneProtocol.js";
|
|
2
|
+
import { KIT_IDS } from "../Protocols/KitProtocol.js";
|
|
3
|
+
import { THEME_IDS } from "../Protocols/ThemeProtocol.js";
|
|
4
|
+
import { IdUtil } from "../Utils/IdUtil.js";
|
|
5
|
+
import { AssetService } from "./AssetService.js";
|
|
6
|
+
import { CustomAssetService } from "./CustomAssetService.js";
|
|
7
|
+
import { KitService } from "./KitService.js";
|
|
8
|
+
import { PaletteService } from "./PaletteService.js";
|
|
9
|
+
import { ThemeService } from "./ThemeService.js";
|
|
10
|
+
class ContextService {
|
|
11
|
+
static DEFAULT_THEME = "flat-cool";
|
|
12
|
+
static DEFAULT_KIT = "flat";
|
|
13
|
+
static DEFAULT_SETTING = "outdoor";
|
|
14
|
+
static DEFAULT_WIDTH = 1200;
|
|
15
|
+
static CLASSIC_HEIGHT = 630;
|
|
16
|
+
static TALL_HEIGHT = 900;
|
|
17
|
+
static TALL_MODES = ["2.5d", "board"];
|
|
18
|
+
// Why: the unit is the pixel size of one asset unit, where a person is 100 units tall.
|
|
19
|
+
static UNIT_PER_HEIGHT = 34e-4;
|
|
20
|
+
static MID_BASE_FOLLOW = 0.6;
|
|
21
|
+
static FAR_BASE_FOLLOW = 0.3;
|
|
22
|
+
static SETTING_TO_LINES = {
|
|
23
|
+
outdoor: { horizon: 0.64, depthToBase: { near: 0.92, mid: 0.8, far: 0.69 } },
|
|
24
|
+
indoor: { horizon: 0.68, depthToBase: { near: 0.93, mid: 0.84, far: 0.74 } },
|
|
25
|
+
beach: { horizon: 0.5, sea: 0.62, depthToBase: { near: 0.93, mid: 0.82, far: 0.71 } },
|
|
26
|
+
city: { horizon: 0.7, depthToBase: { near: 0.94, mid: 0.84, far: 0.74 } }
|
|
27
|
+
};
|
|
28
|
+
static create(scene, options, warnings) {
|
|
29
|
+
const canvas = scene.canvas ?? {};
|
|
30
|
+
const width = canvas.width ?? ContextService.DEFAULT_WIDTH;
|
|
31
|
+
const isTall = IdUtil.isOneOf(ContextService.TALL_MODES, canvas.mode);
|
|
32
|
+
const height = canvas.height ?? (isTall ? ContextService.TALL_HEIGHT : ContextService.CLASSIC_HEIGHT);
|
|
33
|
+
const kit = ContextService.kitOf(canvas.kit, warnings);
|
|
34
|
+
const base = ContextService.themeOf(canvas.theme, warnings);
|
|
35
|
+
const theme = { ...base, ...kit.themeColorToColor ?? {}, ...canvas.colors ?? {} };
|
|
36
|
+
const setting = canvas.setting ?? ContextService.DEFAULT_SETTING;
|
|
37
|
+
const lines = ContextService.linesOf(setting, canvas, warnings);
|
|
38
|
+
const failedAssets = /* @__PURE__ */ new Set();
|
|
39
|
+
const library = ContextService.libraryOf(scene, options, warnings, failedAssets);
|
|
40
|
+
const unit = height * ContextService.UNIT_PER_HEIGHT * (canvas.scale ?? 1);
|
|
41
|
+
return { canvas, kit, idToObject: {}, library, failedAssets, theme, warnings, width, height, setting, lines, unit };
|
|
42
|
+
}
|
|
43
|
+
static themeOf(themeOrName, warnings) {
|
|
44
|
+
if (themeOrName === void 0) {
|
|
45
|
+
return ThemeService.THEME_ID_TO_THEME[ContextService.DEFAULT_THEME];
|
|
46
|
+
}
|
|
47
|
+
if (typeof themeOrName === "object") {
|
|
48
|
+
return PaletteService.generate(themeOrName);
|
|
49
|
+
}
|
|
50
|
+
if (IdUtil.isOneOf(THEME_IDS, themeOrName)) {
|
|
51
|
+
return ThemeService.THEME_ID_TO_THEME[themeOrName];
|
|
52
|
+
}
|
|
53
|
+
warnings.push(`theme '${themeOrName}' does not exist; using '${ContextService.DEFAULT_THEME}'. Available: ${THEME_IDS.join(", ")}`);
|
|
54
|
+
return ThemeService.THEME_ID_TO_THEME[ContextService.DEFAULT_THEME];
|
|
55
|
+
}
|
|
56
|
+
static kitOf(name, warnings) {
|
|
57
|
+
if (name === void 0) {
|
|
58
|
+
return KitService.KIT_ID_TO_KIT[ContextService.DEFAULT_KIT];
|
|
59
|
+
}
|
|
60
|
+
if (IdUtil.isOneOf(KIT_IDS, name)) {
|
|
61
|
+
return KitService.KIT_ID_TO_KIT[name];
|
|
62
|
+
}
|
|
63
|
+
warnings.push(`kit '${name}' does not exist; available: ${KIT_IDS.join(", ")}`);
|
|
64
|
+
return KitService.KIT_ID_TO_KIT[ContextService.DEFAULT_KIT];
|
|
65
|
+
}
|
|
66
|
+
static linesOf(setting, canvas, warnings) {
|
|
67
|
+
const isKnown = IdUtil.isOneOf(SETTING_NAMES, setting);
|
|
68
|
+
if (!isKnown) {
|
|
69
|
+
warnings.push(`setting '${setting}' is invalid; use outdoor, indoor, beach or city`);
|
|
70
|
+
}
|
|
71
|
+
const lines = structuredClone(ContextService.SETTING_TO_LINES[isKnown ? setting : ContextService.DEFAULT_SETTING]);
|
|
72
|
+
if (canvas.horizon != null) {
|
|
73
|
+
lines.horizon = canvas.horizon;
|
|
74
|
+
}
|
|
75
|
+
if (canvas.base != null) {
|
|
76
|
+
const shift = canvas.base - lines.depthToBase.near;
|
|
77
|
+
lines.depthToBase = {
|
|
78
|
+
near: canvas.base,
|
|
79
|
+
mid: lines.depthToBase.mid + shift * ContextService.MID_BASE_FOLLOW,
|
|
80
|
+
far: lines.depthToBase.far + shift * ContextService.FAR_BASE_FOLLOW
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
return lines;
|
|
84
|
+
}
|
|
85
|
+
static libraryOf(scene, options, warnings, failed) {
|
|
86
|
+
const custom = CustomAssetService.loadCustomAssets(scene.assets, options, warnings, failed);
|
|
87
|
+
for (const id of Object.keys(custom)) {
|
|
88
|
+
if (id in AssetService.ASSET_ID_TO_ASSET) {
|
|
89
|
+
warnings.push(`custom asset '${id}' replaces the library asset with the same name`);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
const builtIn = AssetService.ASSET_ID_TO_ASSET;
|
|
93
|
+
return Object.keys(custom).length > 0 ? { ...builtIn, ...custom } : builtIn;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
export {
|
|
97
|
+
ContextService
|
|
98
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { TextRect } from "../Protocols/CompilationProtocol.js";
|
|
2
|
+
import type { Raster } from "../Protocols/CritiqueProtocol.js";
|
|
3
|
+
export declare class CoverageCritiqueService {
|
|
4
|
+
private static readonly MIN_COVERAGE;
|
|
5
|
+
private static readonly TARGET_COVERAGE;
|
|
6
|
+
private static readonly COVERAGE_FLOOR;
|
|
7
|
+
private static readonly MAX_SUGGESTED_SCALE;
|
|
8
|
+
private static readonly EMPTY_ROW_SHARE;
|
|
9
|
+
private static readonly MIN_BAND_SHARE;
|
|
10
|
+
private static readonly SCALE_DECIMALS;
|
|
11
|
+
private static readonly UNCOUNTED_KINDS;
|
|
12
|
+
static critique(raster: Raster, textRects: readonly TextRect[], scale: number): string[];
|
|
13
|
+
private static coverageOf;
|
|
14
|
+
private static occupancy;
|
|
15
|
+
private static emptyBand;
|
|
16
|
+
}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { FormatUtil } from "../Utils/FormatUtil.js";
|
|
2
|
+
import { PixelUtil } from "../Utils/PixelUtil.js";
|
|
3
|
+
class CoverageCritiqueService {
|
|
4
|
+
static MIN_COVERAGE = 0.05;
|
|
5
|
+
static TARGET_COVERAGE = 0.08;
|
|
6
|
+
static COVERAGE_FLOOR = 0.01;
|
|
7
|
+
static MAX_SUGGESTED_SCALE = 2.5;
|
|
8
|
+
static EMPTY_ROW_SHARE = 0.02;
|
|
9
|
+
static MIN_BAND_SHARE = 0.3;
|
|
10
|
+
static SCALE_DECIMALS = 2;
|
|
11
|
+
static UNCOUNTED_KINDS = ["sky"];
|
|
12
|
+
static critique(raster, textRects, scale) {
|
|
13
|
+
const messages = [];
|
|
14
|
+
const coverage = CoverageCritiqueService.coverageOf(raster);
|
|
15
|
+
if (coverage < CoverageCritiqueService.MIN_COVERAGE && raster.objects.length > 0) {
|
|
16
|
+
const suggested = Math.min(
|
|
17
|
+
CoverageCritiqueService.MAX_SUGGESTED_SCALE,
|
|
18
|
+
scale * Math.sqrt(
|
|
19
|
+
CoverageCritiqueService.TARGET_COVERAGE / Math.max(coverage, CoverageCritiqueService.COVERAGE_FLOOR)
|
|
20
|
+
)
|
|
21
|
+
);
|
|
22
|
+
messages.push(
|
|
23
|
+
`empty scene: objects cover only ${FormatUtil.percent(coverage)} of the frame; move the camera closer (canvas.scale \u2248 ${suggested.toFixed(CoverageCritiqueService.SCALE_DECIMALS)}) or use larger objects`
|
|
24
|
+
);
|
|
25
|
+
}
|
|
26
|
+
const band = CoverageCritiqueService.emptyBand(CoverageCritiqueService.occupancy(raster, textRects), raster);
|
|
27
|
+
if (band.rows > raster.height * CoverageCritiqueService.MIN_BAND_SHARE) {
|
|
28
|
+
const start = (band.lastRow - band.rows + 1) / raster.height;
|
|
29
|
+
const end = (band.lastRow + 1) / raster.height;
|
|
30
|
+
messages.push(
|
|
31
|
+
`empty band of ${FormatUtil.percent(band.rows / raster.height)} of the height (from y=${FormatUtil.percent(start)} to y=${FormatUtil.percent(end)}); raise the main group, increase the scale or fill the band (text, wall object, sky element)`
|
|
32
|
+
);
|
|
33
|
+
}
|
|
34
|
+
return messages;
|
|
35
|
+
}
|
|
36
|
+
static coverageOf(raster) {
|
|
37
|
+
let covered = 0;
|
|
38
|
+
for (let index = 0; index < raster.pixelCount; index++) {
|
|
39
|
+
const object = raster.objects[PixelUtil.read(raster.owner, index)];
|
|
40
|
+
if (object && !CoverageCritiqueService.UNCOUNTED_KINDS.includes(object.kind)) {
|
|
41
|
+
covered++;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
return covered / raster.pixelCount;
|
|
45
|
+
}
|
|
46
|
+
static occupancy(raster, textRects) {
|
|
47
|
+
const occupied = new Uint8Array(raster.pixelCount);
|
|
48
|
+
for (let index = 0; index < raster.pixelCount; index++) {
|
|
49
|
+
if (PixelUtil.read(raster.owner, index) >= 0) {
|
|
50
|
+
occupied[index] = 1;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
for (const rect of textRects) {
|
|
54
|
+
const firstRow = Math.max(0, Math.floor(rect.y0 * raster.factor));
|
|
55
|
+
const endRow = Math.min(raster.height, Math.ceil(rect.y1 * raster.factor));
|
|
56
|
+
const firstColumn = Math.max(0, Math.floor(rect.x0 * raster.factor));
|
|
57
|
+
const endColumn = Math.min(raster.width, Math.ceil(rect.x1 * raster.factor));
|
|
58
|
+
for (let row = firstRow; row < endRow; row++) {
|
|
59
|
+
occupied.fill(1, row * raster.width + firstColumn, row * raster.width + Math.max(firstColumn, endColumn));
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
return occupied;
|
|
63
|
+
}
|
|
64
|
+
static emptyBand(occupied, raster) {
|
|
65
|
+
let run = 0;
|
|
66
|
+
let best = { rows: 0, lastRow: 0 };
|
|
67
|
+
for (let row = 0; row < raster.height; row++) {
|
|
68
|
+
let filled = 0;
|
|
69
|
+
for (let column = 0; column < raster.width; column++) {
|
|
70
|
+
filled += PixelUtil.read(occupied, row * raster.width + column);
|
|
71
|
+
}
|
|
72
|
+
if (filled < raster.width * CoverageCritiqueService.EMPTY_ROW_SHARE) {
|
|
73
|
+
run++;
|
|
74
|
+
best = run > best.rows ? { rows: run, lastRow: row } : best;
|
|
75
|
+
} else {
|
|
76
|
+
run = 0;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
return best;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
export {
|
|
83
|
+
CoverageCritiqueService
|
|
84
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { CompileOptions } from "../Protocols/OptionsProtocol.js";
|
|
2
|
+
import { CustomAsset } from "../Resources/Assets/CustomAsset.js";
|
|
3
|
+
export declare class CustomAssetService {
|
|
4
|
+
private static readonly KIND_TO_HEIGHT;
|
|
5
|
+
private static readonly EXTENSION_TO_MIME;
|
|
6
|
+
private static readonly EXTENSION_TO_SIZE_READER;
|
|
7
|
+
private static readonly DEFAULT_SVG_SIZE;
|
|
8
|
+
private static readonly BASE64_CHUNK;
|
|
9
|
+
private static readonly PNG_WIDTH_OFFSET;
|
|
10
|
+
private static readonly PNG_HEIGHT_OFFSET;
|
|
11
|
+
private static readonly JPEG_FIRST_MARKER;
|
|
12
|
+
private static readonly JPEG_FRAME_FIRST;
|
|
13
|
+
private static readonly JPEG_FRAME_LAST;
|
|
14
|
+
private static readonly JPEG_HEIGHT_OFFSET;
|
|
15
|
+
private static readonly JPEG_WIDTH_OFFSET;
|
|
16
|
+
static loadCustomAssets(definitions?: Record<string, unknown>, options?: CompileOptions, warnings?: string[], failed?: Set<string>): Record<string, CustomAsset>;
|
|
17
|
+
private static validKindOf;
|
|
18
|
+
private static build;
|
|
19
|
+
private static describeFailure;
|
|
20
|
+
private static readText;
|
|
21
|
+
private static readBytes;
|
|
22
|
+
private static loadSvg;
|
|
23
|
+
private static viewBoxOf;
|
|
24
|
+
private static prefixIds;
|
|
25
|
+
private static loadImage;
|
|
26
|
+
private static extensionOf;
|
|
27
|
+
private static toBase64;
|
|
28
|
+
private static rasterSize;
|
|
29
|
+
private static pngSize;
|
|
30
|
+
private static jpegSize;
|
|
31
|
+
}
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
import { ASSET_KINDS } from "../Protocols/AssetProtocol.js";
|
|
2
|
+
import { FallbackUtil } from "../Utils/FallbackUtil.js";
|
|
3
|
+
import { IdUtil } from "../Utils/IdUtil.js";
|
|
4
|
+
import { CustomAsset } from "../Resources/Assets/CustomAsset.js";
|
|
5
|
+
import { SanitizeUtil } from "../Utils/SanitizeUtil.js";
|
|
6
|
+
class CustomAssetService {
|
|
7
|
+
static KIND_TO_HEIGHT = {
|
|
8
|
+
ground: 60,
|
|
9
|
+
surface: 18,
|
|
10
|
+
any: 40,
|
|
11
|
+
wall: 50,
|
|
12
|
+
sky: 50,
|
|
13
|
+
ceiling: 30,
|
|
14
|
+
floor: 10,
|
|
15
|
+
water: 60
|
|
16
|
+
};
|
|
17
|
+
static EXTENSION_TO_MIME = {
|
|
18
|
+
".png": "image/png",
|
|
19
|
+
".jpg": "image/jpeg",
|
|
20
|
+
".jpeg": "image/jpeg",
|
|
21
|
+
".webp": "image/webp"
|
|
22
|
+
};
|
|
23
|
+
static EXTENSION_TO_SIZE_READER = {
|
|
24
|
+
".png": (_bytes, view) => CustomAssetService.pngSize(view),
|
|
25
|
+
".jpg": (bytes, view) => CustomAssetService.jpegSize(bytes, view),
|
|
26
|
+
".jpeg": (bytes, view) => CustomAssetService.jpegSize(bytes, view)
|
|
27
|
+
};
|
|
28
|
+
static DEFAULT_SVG_SIZE = 100;
|
|
29
|
+
static BASE64_CHUNK = 32768;
|
|
30
|
+
static PNG_WIDTH_OFFSET = 16;
|
|
31
|
+
static PNG_HEIGHT_OFFSET = 20;
|
|
32
|
+
static JPEG_FIRST_MARKER = 2;
|
|
33
|
+
static JPEG_FRAME_FIRST = 192;
|
|
34
|
+
static JPEG_FRAME_LAST = 195;
|
|
35
|
+
static JPEG_HEIGHT_OFFSET = 5;
|
|
36
|
+
static JPEG_WIDTH_OFFSET = 7;
|
|
37
|
+
static loadCustomAssets(definitions = {}, options = {}, warnings = [], failed = /* @__PURE__ */ new Set()) {
|
|
38
|
+
const idToAsset = {};
|
|
39
|
+
let position = 0;
|
|
40
|
+
for (const [id, raw] of Object.entries(definitions)) {
|
|
41
|
+
position++;
|
|
42
|
+
const definition = raw;
|
|
43
|
+
const kind = CustomAssetService.validKindOf(id, definition, warnings);
|
|
44
|
+
if (kind === null) {
|
|
45
|
+
continue;
|
|
46
|
+
}
|
|
47
|
+
try {
|
|
48
|
+
idToAsset[id] = CustomAssetService.build(kind, definition, options, position);
|
|
49
|
+
} catch (error) {
|
|
50
|
+
warnings.push(`custom asset '${id}': ${CustomAssetService.describeFailure(error, definition)}`);
|
|
51
|
+
failed.add(id);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
return idToAsset;
|
|
55
|
+
}
|
|
56
|
+
static validKindOf(id, definition, warnings) {
|
|
57
|
+
const kind = FallbackUtil.nonEmpty(definition.kind, "any");
|
|
58
|
+
if (!IdUtil.isOneOf(ASSET_KINDS, kind)) {
|
|
59
|
+
warnings.push(`custom asset '${id}': kind '${kind}' is invalid (use ${ASSET_KINDS.join(", ")})`);
|
|
60
|
+
return null;
|
|
61
|
+
}
|
|
62
|
+
if (!definition.svg && !definition.image) {
|
|
63
|
+
warnings.push(`custom asset '${id}': provide 'svg' (a file or inline) or 'image'`);
|
|
64
|
+
return null;
|
|
65
|
+
}
|
|
66
|
+
return kind;
|
|
67
|
+
}
|
|
68
|
+
static build(kind, definition, options, position) {
|
|
69
|
+
const artwork = definition.svg ? CustomAssetService.loadSvg(definition, options, position) : CustomAssetService.loadImage(definition, options);
|
|
70
|
+
const height = definition.height ?? CustomAssetService.KIND_TO_HEIGHT[kind];
|
|
71
|
+
return new CustomAsset(kind, height, definition, artwork);
|
|
72
|
+
}
|
|
73
|
+
static describeFailure(error, definition) {
|
|
74
|
+
const isMissing = error instanceof Error && error.code === "ENOENT";
|
|
75
|
+
if (isMissing) {
|
|
76
|
+
const file = FallbackUtil.nonEmpty(definition.svg, definition.image ?? "");
|
|
77
|
+
return `file '${file}' not found (path is relative to the scene file)`;
|
|
78
|
+
}
|
|
79
|
+
return String(error instanceof Error ? error.message : error);
|
|
80
|
+
}
|
|
81
|
+
static readText(options, file) {
|
|
82
|
+
if (!options.files) {
|
|
83
|
+
throw new Error("this call does not read files; pass the SVG inline or use the CLI");
|
|
84
|
+
}
|
|
85
|
+
return options.files.readText(file);
|
|
86
|
+
}
|
|
87
|
+
static readBytes(options, file) {
|
|
88
|
+
if (!options.files) {
|
|
89
|
+
throw new Error("this call does not read files; pass the image through a file reader or use the CLI");
|
|
90
|
+
}
|
|
91
|
+
return options.files.readBytes(file);
|
|
92
|
+
}
|
|
93
|
+
static loadSvg(definition, options, position) {
|
|
94
|
+
const raw = definition.svg ?? "";
|
|
95
|
+
const source = SanitizeUtil.sanitizeSvg(raw.trim().startsWith("<") ? raw : CustomAssetService.readText(options, raw));
|
|
96
|
+
const open = /<svg[^>]*>/i.exec(source)?.[0];
|
|
97
|
+
if (!open) {
|
|
98
|
+
throw new Error("does not look like an SVG");
|
|
99
|
+
}
|
|
100
|
+
const [minX = 0, minY = 0, width = 0, height = 0] = CustomAssetService.viewBoxOf(open);
|
|
101
|
+
const body = source.slice(source.indexOf(open) + open.length, source.lastIndexOf("</svg>"));
|
|
102
|
+
const inner = CustomAssetService.prefixIds(body, `c${position}-`);
|
|
103
|
+
const viewBox = [minX, minY, width, height].join(" ");
|
|
104
|
+
const probe = `<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="${viewBox}" width="${width}" height="${height}">${inner}</svg>`;
|
|
105
|
+
const declared = { x: minX, y: minY, width, height };
|
|
106
|
+
const measured = options.measure ? options.measure(probe) : declared;
|
|
107
|
+
if (!measured?.width) {
|
|
108
|
+
throw new Error("the drawing is empty");
|
|
109
|
+
}
|
|
110
|
+
return { inner, box: definition.trim === false ? declared : measured };
|
|
111
|
+
}
|
|
112
|
+
static viewBoxOf(open) {
|
|
113
|
+
const viewBox = /viewBox="([^"]+)"/i.exec(open)?.[1];
|
|
114
|
+
if (viewBox) {
|
|
115
|
+
return viewBox.split(/[\s,]+/).map(Number);
|
|
116
|
+
}
|
|
117
|
+
const width = Number(/\swidth="([\d.]+)/.exec(open)?.[1] ?? CustomAssetService.DEFAULT_SVG_SIZE);
|
|
118
|
+
const height = Number(/\sheight="([\d.]+)/.exec(open)?.[1] ?? CustomAssetService.DEFAULT_SVG_SIZE);
|
|
119
|
+
return [0, 0, width, height];
|
|
120
|
+
}
|
|
121
|
+
static prefixIds(svg, prefix) {
|
|
122
|
+
let prefixed = svg;
|
|
123
|
+
for (const match of svg.matchAll(/\sid="([^"]+)"/g)) {
|
|
124
|
+
const id = match[1] ?? "";
|
|
125
|
+
const escaped = id.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
126
|
+
prefixed = prefixed.replace(new RegExp(`id="${escaped}"`, "g"), `id="${prefix}${id}"`).replace(new RegExp(`url\\(#${escaped}\\)`, "g"), `url(#${prefix}${id})`).replace(new RegExp(`href="#${escaped}"`, "g"), `href="#${prefix}${id}"`);
|
|
127
|
+
}
|
|
128
|
+
return prefixed;
|
|
129
|
+
}
|
|
130
|
+
static loadImage(definition, options) {
|
|
131
|
+
const file = definition.image ?? "";
|
|
132
|
+
const extension = CustomAssetService.extensionOf(file);
|
|
133
|
+
const bytes = CustomAssetService.readBytes(options, file);
|
|
134
|
+
const mime = IdUtil.lookup(CustomAssetService.EXTENSION_TO_MIME, extension);
|
|
135
|
+
if (!mime) {
|
|
136
|
+
throw new Error(`format ${extension} is not supported (use png, jpg or webp)`);
|
|
137
|
+
}
|
|
138
|
+
const declared = definition.size_px ? [definition.size_px[0] ?? 0, definition.size_px[1] ?? 0] : CustomAssetService.rasterSize(bytes, extension);
|
|
139
|
+
if (!declared) {
|
|
140
|
+
throw new Error("could not read the dimensions; set size_px: [width, height]");
|
|
141
|
+
}
|
|
142
|
+
const [width = 0, height = 0] = declared;
|
|
143
|
+
return {
|
|
144
|
+
inner: `<image width="${width}" height="${height}" href="data:${mime};base64,${CustomAssetService.toBase64(bytes)}"/>`,
|
|
145
|
+
box: { x: 0, y: 0, width, height }
|
|
146
|
+
};
|
|
147
|
+
}
|
|
148
|
+
static extensionOf(file) {
|
|
149
|
+
const dot = file.lastIndexOf(".");
|
|
150
|
+
return dot < 0 ? "" : file.slice(dot).toLowerCase();
|
|
151
|
+
}
|
|
152
|
+
static toBase64(bytes) {
|
|
153
|
+
let binary = "";
|
|
154
|
+
for (let start = 0; start < bytes.length; start += CustomAssetService.BASE64_CHUNK) {
|
|
155
|
+
binary += String.fromCharCode(...bytes.subarray(start, start + CustomAssetService.BASE64_CHUNK));
|
|
156
|
+
}
|
|
157
|
+
return btoa(binary);
|
|
158
|
+
}
|
|
159
|
+
static rasterSize(bytes, extension) {
|
|
160
|
+
const view = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
|
|
161
|
+
const read = IdUtil.lookup(CustomAssetService.EXTENSION_TO_SIZE_READER, extension);
|
|
162
|
+
return read ? read(bytes, view) : null;
|
|
163
|
+
}
|
|
164
|
+
static pngSize(view) {
|
|
165
|
+
return [view.getUint32(CustomAssetService.PNG_WIDTH_OFFSET), view.getUint32(CustomAssetService.PNG_HEIGHT_OFFSET)];
|
|
166
|
+
}
|
|
167
|
+
static jpegSize(bytes, view) {
|
|
168
|
+
let offset = CustomAssetService.JPEG_FIRST_MARKER;
|
|
169
|
+
while (offset < bytes.length) {
|
|
170
|
+
const marker = bytes[offset + 1] ?? 0;
|
|
171
|
+
if (marker >= CustomAssetService.JPEG_FRAME_FIRST && marker <= CustomAssetService.JPEG_FRAME_LAST) {
|
|
172
|
+
return [
|
|
173
|
+
view.getUint16(offset + CustomAssetService.JPEG_WIDTH_OFFSET),
|
|
174
|
+
view.getUint16(offset + CustomAssetService.JPEG_HEIGHT_OFFSET)
|
|
175
|
+
];
|
|
176
|
+
}
|
|
177
|
+
offset += 2 + view.getUint16(offset + 2);
|
|
178
|
+
}
|
|
179
|
+
return null;
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
export {
|
|
183
|
+
CustomAssetService
|
|
184
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { SceneObject } from "../Protocols/SceneProtocol.js";
|
|
2
|
+
export interface ResolutionOrder {
|
|
3
|
+
order: string[];
|
|
4
|
+
heldToHolder: Record<string, string>;
|
|
5
|
+
}
|
|
6
|
+
export declare class DependencyOrderService {
|
|
7
|
+
private static readonly DEPENDENCY_KEYS;
|
|
8
|
+
static dependenciesOf(object: SceneObject): string[];
|
|
9
|
+
static resolve(idToObject: Record<string, SceneObject>, warnings: string[]): ResolutionOrder;
|
|
10
|
+
private static findHolders;
|
|
11
|
+
private static placeHeldAfterHolders;
|
|
12
|
+
}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
class DependencyOrderService {
|
|
2
|
+
static DEPENDENCY_KEYS = [
|
|
3
|
+
"left_of",
|
|
4
|
+
"right_of",
|
|
5
|
+
"behind",
|
|
6
|
+
"in_front_of",
|
|
7
|
+
"on",
|
|
8
|
+
"under",
|
|
9
|
+
"above"
|
|
10
|
+
];
|
|
11
|
+
static dependenciesOf(object) {
|
|
12
|
+
return DependencyOrderService.DEPENDENCY_KEYS.map((key) => object[key]).filter((id) => Boolean(id));
|
|
13
|
+
}
|
|
14
|
+
static resolve(idToObject, warnings) {
|
|
15
|
+
const visited = [];
|
|
16
|
+
const seen = /* @__PURE__ */ new Set();
|
|
17
|
+
const visiting = /* @__PURE__ */ new Set();
|
|
18
|
+
const visit = (id) => {
|
|
19
|
+
if (seen.has(id)) {
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
if (visiting.has(id)) {
|
|
23
|
+
warnings.push(`circular dependency involving '${id}'`);
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
visiting.add(id);
|
|
27
|
+
const object = idToObject[id];
|
|
28
|
+
if (!object) {
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
for (const dependency of DependencyOrderService.dependenciesOf(object)) {
|
|
32
|
+
if (idToObject[dependency]) {
|
|
33
|
+
visit(dependency);
|
|
34
|
+
} else {
|
|
35
|
+
warnings.push(`'${id}' references '${dependency}', which does not exist in the scene`);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
visiting.delete(id);
|
|
39
|
+
seen.add(id);
|
|
40
|
+
visited.push(id);
|
|
41
|
+
};
|
|
42
|
+
Object.keys(idToObject).forEach(visit);
|
|
43
|
+
const heldToHolder = DependencyOrderService.findHolders(idToObject, warnings);
|
|
44
|
+
return { order: DependencyOrderService.placeHeldAfterHolders(visited, heldToHolder), heldToHolder };
|
|
45
|
+
}
|
|
46
|
+
static findHolders(idToObject, warnings) {
|
|
47
|
+
const heldToHolder = {};
|
|
48
|
+
for (const [id, object] of Object.entries(idToObject)) {
|
|
49
|
+
if (!object.holds) {
|
|
50
|
+
continue;
|
|
51
|
+
}
|
|
52
|
+
if (idToObject[object.holds]) {
|
|
53
|
+
heldToHolder[object.holds] = id;
|
|
54
|
+
} else {
|
|
55
|
+
warnings.push(`'${id}' holds '${object.holds}', which does not exist`);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
return heldToHolder;
|
|
59
|
+
}
|
|
60
|
+
static placeHeldAfterHolders(visited, heldToHolder) {
|
|
61
|
+
const order = visited.filter((id) => !heldToHolder[id]);
|
|
62
|
+
for (const id of visited) {
|
|
63
|
+
const holder = heldToHolder[id];
|
|
64
|
+
if (holder) {
|
|
65
|
+
order.splice(order.indexOf(holder) + 1, 0, id);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
return order;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
export {
|
|
72
|
+
DependencyOrderService
|
|
73
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { CompilationContext, Placement } from "../Protocols/CompilationProtocol.js";
|
|
2
|
+
import type { LayoutEntry } from "../Protocols/ResultProtocol.js";
|
|
3
|
+
export declare class DescriptionService {
|
|
4
|
+
private static readonly PERCENT;
|
|
5
|
+
private static percentOf;
|
|
6
|
+
private static roundedPercentOf;
|
|
7
|
+
private static readonly FRAMING_NAMES;
|
|
8
|
+
static describe(ordered: Placement[], context: CompilationContext, framingCorner?: string): string;
|
|
9
|
+
static layout(ordered: Placement[], context: CompilationContext): LayoutEntry[];
|
|
10
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
class DescriptionService {
|
|
2
|
+
static PERCENT = 100;
|
|
3
|
+
static percentOf(value, total) {
|
|
4
|
+
return Math.round(value / total * DescriptionService.PERCENT);
|
|
5
|
+
}
|
|
6
|
+
static roundedPercentOf(value, total) {
|
|
7
|
+
return Number((value / total * DescriptionService.PERCENT).toFixed(1));
|
|
8
|
+
}
|
|
9
|
+
static FRAMING_NAMES = /* @__PURE__ */ new Set(["foliage", "curtain", "plants"]);
|
|
10
|
+
static describe(ordered, context, framingCorner) {
|
|
11
|
+
const { width, height } = context;
|
|
12
|
+
const lines = ordered.map((placement) => `${placement.id} (${placement.asset}): x=${DescriptionService.percentOf(placement.x, width)}%, base=${DescriptionService.percentOf(placement.y, height)}%, ${DescriptionService.percentOf(placement.width, width)}%\xD7${DescriptionService.percentOf(placement.height, height)}% of the frame${placement.depth ? `, ${placement.depth}` : ""}`);
|
|
13
|
+
const framingKind = context.canvas.framing ?? context.canvas.frame_elements;
|
|
14
|
+
if (framingCorner && framingKind && DescriptionService.FRAMING_NAMES.has(framingKind)) {
|
|
15
|
+
lines.push(`framing (${framingKind}): foreground framing in the ${framingCorner} corner`);
|
|
16
|
+
}
|
|
17
|
+
return lines.join("\n");
|
|
18
|
+
}
|
|
19
|
+
static layout(ordered, context) {
|
|
20
|
+
const { width, height } = context;
|
|
21
|
+
return ordered.map((placement) => ({
|
|
22
|
+
id: placement.id,
|
|
23
|
+
asset: placement.asset,
|
|
24
|
+
x: DescriptionService.roundedPercentOf(placement.x, width),
|
|
25
|
+
base: DescriptionService.roundedPercentOf(placement.y, height),
|
|
26
|
+
w: DescriptionService.roundedPercentOf(placement.width, width),
|
|
27
|
+
h: DescriptionService.roundedPercentOf(placement.height, height)
|
|
28
|
+
}));
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
export {
|
|
32
|
+
DescriptionService
|
|
33
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { DetailName } from "../Protocols/AssetProtocol.js";
|
|
2
|
+
import type { CompilationContext } from "../Protocols/CompilationProtocol.js";
|
|
3
|
+
import type { SceneObject } from "../Protocols/SceneProtocol.js";
|
|
4
|
+
export declare class DetailService {
|
|
5
|
+
private static readonly DEPTH_TO_DETAIL;
|
|
6
|
+
static resolve(id: string, object: SceneObject, context: CompilationContext): DetailName;
|
|
7
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { DetailUtil } from "../Utils/DetailUtil.js";
|
|
2
|
+
import { IdUtil } from "../Utils/IdUtil.js";
|
|
3
|
+
class DetailService {
|
|
4
|
+
static DEPTH_TO_DETAIL = { far: "low" };
|
|
5
|
+
static resolve(id, object, context) {
|
|
6
|
+
if (DetailUtil.isDetail(object.detail)) {
|
|
7
|
+
return object.detail;
|
|
8
|
+
}
|
|
9
|
+
const focus = [].concat(context.canvas.focus ?? []);
|
|
10
|
+
if (focus.some((focused) => id === focused || id.startsWith(`${focused}_`))) {
|
|
11
|
+
return "high";
|
|
12
|
+
}
|
|
13
|
+
return IdUtil.lookup(DetailService.DEPTH_TO_DETAIL, object.depth) ?? "mid";
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
export {
|
|
17
|
+
DetailService
|
|
18
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { Raster } from "../Protocols/CritiqueProtocol.js";
|
|
2
|
+
export declare class FocusCritiqueService {
|
|
3
|
+
private static readonly OPAQUE_ALPHA;
|
|
4
|
+
private static readonly SURROUND_DILATION_PX;
|
|
5
|
+
private static readonly MIN_AREA;
|
|
6
|
+
private static readonly CHROMA_MARGIN;
|
|
7
|
+
private static readonly MIN_PROMINENT_CHROMA;
|
|
8
|
+
private static readonly CONTRAST_MARGIN;
|
|
9
|
+
private static readonly MAX_FOCUS_CONTRAST_TO_WARN;
|
|
10
|
+
private static readonly HIGH_CHROMA_THRESHOLD;
|
|
11
|
+
private static readonly MAX_SATURATION_AREA_SHARE;
|
|
12
|
+
private static readonly LAB_A_OFFSET;
|
|
13
|
+
private static readonly LAB_B_OFFSET;
|
|
14
|
+
private static readonly LAB_CHANNELS;
|
|
15
|
+
static critique(raster: Raster, focusId?: string): string[];
|
|
16
|
+
private static isIgnoredCandidate;
|
|
17
|
+
private static findFocus;
|
|
18
|
+
private static metricsOf;
|
|
19
|
+
private static contrastAgainstSurround;
|
|
20
|
+
private static compare;
|
|
21
|
+
private static saturationBudget;
|
|
22
|
+
private static dilate;
|
|
23
|
+
}
|