@guilhermebkel/scenec 0.1.1 → 0.2.0

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.
Files changed (483) hide show
  1. package/README.md +15 -22
  2. package/dist/Adapters/FileReaderAdapter.d.ts +4 -0
  3. package/dist/Adapters/FileReaderAdapter.js +21 -0
  4. package/dist/Adapters/FontAdapter.d.ts +5 -0
  5. package/dist/Adapters/FontAdapter.js +9 -0
  6. package/dist/Adapters/ResvgAdapter.d.ts +11 -0
  7. package/dist/Adapters/ResvgAdapter.js +18 -0
  8. package/dist/Commands/BaseCommand.d.ts +11 -0
  9. package/dist/Commands/BaseCommand.js +13 -0
  10. package/dist/Commands/CatalogCommand.d.ts +6 -0
  11. package/dist/Commands/CatalogCommand.js +24 -0
  12. package/dist/Commands/CheckCommand.d.ts +5 -0
  13. package/dist/Commands/CheckCommand.js +8 -0
  14. package/dist/Commands/RenderCommand.d.ts +5 -0
  15. package/dist/Commands/RenderCommand.js +8 -0
  16. package/dist/Commands/SceneCommand.d.ts +11 -0
  17. package/dist/Commands/SceneCommand.js +70 -0
  18. package/dist/Commands/SchemaCommand.d.ts +5 -0
  19. package/dist/Commands/SchemaCommand.js +12 -0
  20. package/dist/Data/cities.json +312 -0
  21. package/dist/Data/europe.json +1 -0
  22. package/dist/Errors/SceneError.d.ts +4 -0
  23. package/dist/Errors/SceneError.js +11 -0
  24. package/dist/Errors/UnsafeSvgError.d.ts +3 -0
  25. package/dist/Errors/UnsafeSvgError.js +9 -0
  26. package/dist/Modules/CheckModule.d.ts +8 -0
  27. package/dist/Modules/CheckModule.js +16 -0
  28. package/dist/Modules/CompilationModule.d.ts +18 -0
  29. package/dist/Modules/CompilationModule.js +137 -0
  30. package/dist/Modules/CritiqueModule.d.ts +6 -0
  31. package/dist/Modules/CritiqueModule.js +43 -0
  32. package/dist/Modules/MapModule.d.ts +24 -0
  33. package/dist/Modules/MapModule.js +99 -0
  34. package/dist/Modules/ParsingModule.d.ts +17 -0
  35. package/dist/Modules/ParsingModule.js +88 -0
  36. package/dist/Modules/PlaneModule.d.ts +19 -0
  37. package/dist/Modules/PlaneModule.js +98 -0
  38. package/dist/Protocols/AssetProtocol.d.ts +62 -0
  39. package/dist/Protocols/AssetProtocol.js +93 -0
  40. package/dist/Protocols/CommandProtocol.d.ts +6 -0
  41. package/dist/Protocols/CommandProtocol.js +0 -0
  42. package/dist/Protocols/CompilationProtocol.d.ts +110 -0
  43. package/dist/Protocols/CompilationProtocol.js +0 -0
  44. package/dist/Protocols/CritiqueProtocol.d.ts +42 -0
  45. package/dist/Protocols/CritiqueProtocol.js +4 -0
  46. package/dist/Protocols/CustomAssetProtocol.d.ts +24 -0
  47. package/dist/Protocols/CustomAssetProtocol.js +0 -0
  48. package/dist/Protocols/GroupProtocol.d.ts +17 -0
  49. package/dist/Protocols/GroupProtocol.js +12 -0
  50. package/dist/Protocols/KitProtocol.d.ts +26 -0
  51. package/dist/Protocols/KitProtocol.js +17 -0
  52. package/dist/Protocols/MapProtocol.d.ts +77 -0
  53. package/dist/Protocols/MapProtocol.js +4 -0
  54. package/dist/Protocols/OptionsProtocol.js +0 -0
  55. package/dist/Protocols/PersonProtocol.d.ts +64 -0
  56. package/dist/Protocols/PersonProtocol.js +40 -0
  57. package/dist/Protocols/PlaneProtocol.d.ts +140 -0
  58. package/dist/Protocols/PlaneProtocol.js +4 -0
  59. package/dist/{pipeline/index.d.ts → Protocols/ResultProtocol.d.ts} +0 -2
  60. package/dist/Protocols/ResultProtocol.js +0 -0
  61. package/dist/Protocols/SceneProtocol.d.ts +625 -0
  62. package/dist/Protocols/SceneProtocol.js +304 -0
  63. package/dist/{protocols/theme.d.ts → Protocols/ThemeProtocol.d.ts} +4 -0
  64. package/dist/Protocols/ThemeProtocol.js +28 -0
  65. package/dist/Resources/Assets/BackpackAsset.d.ts +10 -0
  66. package/dist/Resources/Assets/BackpackAsset.js +31 -0
  67. package/dist/Resources/Assets/BallAsset.d.ts +10 -0
  68. package/dist/Resources/Assets/BallAsset.js +15 -0
  69. package/dist/Resources/Assets/BalloonsAsset.d.ts +10 -0
  70. package/dist/Resources/Assets/BalloonsAsset.js +26 -0
  71. package/dist/Resources/Assets/BaseAsset.d.ts +16 -0
  72. package/dist/Resources/Assets/BaseAsset.js +10 -0
  73. package/dist/Resources/Assets/BeachTowelAsset.d.ts +10 -0
  74. package/dist/Resources/Assets/BeachTowelAsset.js +14 -0
  75. package/dist/Resources/Assets/BedAsset.d.ts +12 -0
  76. package/dist/Resources/Assets/BedAsset.js +25 -0
  77. package/dist/Resources/Assets/BenchAsset.d.ts +11 -0
  78. package/dist/Resources/Assets/BenchAsset.js +24 -0
  79. package/dist/Resources/Assets/BicycleAsset.d.ts +10 -0
  80. package/dist/Resources/Assets/BicycleAsset.js +18 -0
  81. package/dist/Resources/Assets/BigPlantAsset.d.ts +10 -0
  82. package/dist/Resources/Assets/BigPlantAsset.js +19 -0
  83. package/dist/Resources/Assets/BirdAsset.d.ts +10 -0
  84. package/dist/Resources/Assets/BirdAsset.js +14 -0
  85. package/dist/Resources/Assets/BoardAsset.d.ts +12 -0
  86. package/dist/Resources/Assets/BoardAsset.js +44 -0
  87. package/dist/Resources/Assets/BoatAsset.d.ts +10 -0
  88. package/dist/Resources/Assets/BoatAsset.js +15 -0
  89. package/dist/Resources/Assets/BooksAsset.d.ts +10 -0
  90. package/dist/Resources/Assets/BooksAsset.js +35 -0
  91. package/dist/Resources/Assets/BookshelfAsset.d.ts +10 -0
  92. package/dist/Resources/Assets/BookshelfAsset.js +33 -0
  93. package/dist/Resources/Assets/BuildingAsset.d.ts +14 -0
  94. package/dist/Resources/Assets/BuildingAsset.js +34 -0
  95. package/dist/Resources/Assets/BurgerAsset.d.ts +9 -0
  96. package/dist/Resources/Assets/BurgerAsset.js +23 -0
  97. package/dist/Resources/Assets/BushAsset.d.ts +10 -0
  98. package/dist/Resources/Assets/BushAsset.js +17 -0
  99. package/dist/Resources/Assets/CabinetAsset.d.ts +14 -0
  100. package/dist/Resources/Assets/CabinetAsset.js +49 -0
  101. package/dist/Resources/Assets/CablesAsset.d.ts +10 -0
  102. package/dist/Resources/Assets/CablesAsset.js +16 -0
  103. package/dist/Resources/Assets/CakeAsset.d.ts +10 -0
  104. package/dist/Resources/Assets/CakeAsset.js +29 -0
  105. package/dist/Resources/Assets/CapAsset.d.ts +10 -0
  106. package/dist/Resources/Assets/CapAsset.js +18 -0
  107. package/dist/Resources/Assets/CarAsset.d.ts +10 -0
  108. package/dist/Resources/Assets/CarAsset.js +29 -0
  109. package/dist/Resources/Assets/CatAsset.d.ts +10 -0
  110. package/dist/Resources/Assets/CatAsset.js +17 -0
  111. package/dist/Resources/Assets/ChairAsset.d.ts +11 -0
  112. package/dist/Resources/Assets/ChairAsset.js +32 -0
  113. package/dist/Resources/Assets/ClockAsset.d.ts +11 -0
  114. package/dist/Resources/Assets/ClockAsset.js +22 -0
  115. package/dist/Resources/Assets/CloudAsset.d.ts +10 -0
  116. package/dist/Resources/Assets/CloudAsset.js +15 -0
  117. package/dist/Resources/Assets/CoffeeMachineAsset.d.ts +10 -0
  118. package/dist/Resources/Assets/CoffeeMachineAsset.js +23 -0
  119. package/dist/Resources/Assets/CounterAsset.d.ts +11 -0
  120. package/dist/Resources/Assets/CounterAsset.js +29 -0
  121. package/dist/Resources/Assets/CupAsset.d.ts +10 -0
  122. package/dist/Resources/Assets/CupAsset.js +17 -0
  123. package/dist/Resources/Assets/CustomAsset.d.ts +25 -0
  124. package/dist/Resources/Assets/CustomAsset.js +58 -0
  125. package/dist/Resources/Assets/DeskAsset.d.ts +11 -0
  126. package/dist/Resources/Assets/DeskAsset.js +35 -0
  127. package/dist/Resources/Assets/DeskSlabAsset.d.ts +18 -0
  128. package/dist/Resources/Assets/DeskSlabAsset.js +43 -0
  129. package/dist/Resources/Assets/DiplomaAsset.d.ts +10 -0
  130. package/dist/Resources/Assets/DiplomaAsset.js +23 -0
  131. package/dist/Resources/Assets/DogAsset.d.ts +10 -0
  132. package/dist/Resources/Assets/DogAsset.js +24 -0
  133. package/dist/Resources/Assets/DrawerUnitAsset.d.ts +14 -0
  134. package/dist/Resources/Assets/DrawerUnitAsset.js +35 -0
  135. package/dist/Resources/Assets/FenceAsset.d.ts +10 -0
  136. package/dist/Resources/Assets/FenceAsset.js +26 -0
  137. package/dist/Resources/Assets/FigurineAsset.d.ts +10 -0
  138. package/dist/Resources/Assets/FigurineAsset.js +24 -0
  139. package/dist/Resources/Assets/FinishFlagAsset.d.ts +10 -0
  140. package/dist/Resources/Assets/FinishFlagAsset.js +21 -0
  141. package/dist/Resources/Assets/FloorLampAsset.d.ts +10 -0
  142. package/dist/Resources/Assets/FloorLampAsset.js +22 -0
  143. package/dist/Resources/Assets/FlowersAsset.d.ts +10 -0
  144. package/dist/Resources/Assets/FlowersAsset.js +37 -0
  145. package/dist/Resources/Assets/FrameAsset.d.ts +11 -0
  146. package/dist/Resources/Assets/FrameAsset.js +24 -0
  147. package/dist/Resources/Assets/FruitBowlAsset.d.ts +10 -0
  148. package/dist/Resources/Assets/FruitBowlAsset.js +16 -0
  149. package/dist/Resources/Assets/GlassShelfAsset.d.ts +17 -0
  150. package/dist/Resources/Assets/GlassShelfAsset.js +25 -0
  151. package/dist/Resources/Assets/HeadphonesAsset.d.ts +10 -0
  152. package/dist/Resources/Assets/HeadphonesAsset.js +23 -0
  153. package/dist/Resources/Assets/HouseAsset.d.ts +10 -0
  154. package/dist/Resources/Assets/HouseAsset.js +42 -0
  155. package/dist/Resources/Assets/LabAsset.d.ts +10 -0
  156. package/dist/Resources/Assets/LabAsset.js +52 -0
  157. package/dist/Resources/Assets/LampAsset.d.ts +10 -0
  158. package/dist/Resources/Assets/LampAsset.js +16 -0
  159. package/dist/Resources/Assets/LaptopAsset.d.ts +10 -0
  160. package/dist/Resources/Assets/LaptopAsset.js +23 -0
  161. package/dist/Resources/Assets/LaptopOpenAsset.d.ts +10 -0
  162. package/dist/Resources/Assets/LaptopOpenAsset.js +29 -0
  163. package/dist/Resources/Assets/LightSwitchAsset.d.ts +11 -0
  164. package/dist/Resources/Assets/LightSwitchAsset.js +24 -0
  165. package/dist/Resources/Assets/MonitorAsset.d.ts +10 -0
  166. package/dist/Resources/Assets/MonitorAsset.js +40 -0
  167. package/dist/Resources/Assets/MoonAsset.d.ts +10 -0
  168. package/dist/Resources/Assets/MoonAsset.js +16 -0
  169. package/dist/Resources/Assets/MountainAsset.d.ts +10 -0
  170. package/dist/Resources/Assets/MountainAsset.js +15 -0
  171. package/dist/Resources/Assets/OfficeChairAsset.d.ts +10 -0
  172. package/dist/Resources/Assets/OfficeChairAsset.js +45 -0
  173. package/dist/Resources/Assets/PalmAsset.d.ts +10 -0
  174. package/dist/Resources/Assets/PalmAsset.js +32 -0
  175. package/dist/Resources/Assets/PaperCupAsset.d.ts +10 -0
  176. package/dist/Resources/Assets/PaperCupAsset.js +17 -0
  177. package/dist/Resources/Assets/PendantLampAsset.d.ts +10 -0
  178. package/dist/Resources/Assets/PendantLampAsset.js +16 -0
  179. package/dist/Resources/Assets/PennantAsset.d.ts +10 -0
  180. package/dist/Resources/Assets/PennantAsset.js +15 -0
  181. package/dist/Resources/Assets/PersonAsset.d.ts +10 -0
  182. package/dist/Resources/Assets/PersonAsset.js +15 -0
  183. package/dist/Resources/Assets/PhotoFrameAsset.d.ts +15 -0
  184. package/dist/Resources/Assets/PhotoFrameAsset.js +68 -0
  185. package/dist/Resources/Assets/PineAsset.d.ts +10 -0
  186. package/dist/Resources/Assets/PineAsset.js +21 -0
  187. package/dist/Resources/Assets/PizzaAsset.d.ts +10 -0
  188. package/dist/Resources/Assets/PizzaAsset.js +17 -0
  189. package/dist/Resources/Assets/PlantAsset.d.ts +10 -0
  190. package/dist/Resources/Assets/PlantAsset.js +17 -0
  191. package/dist/Resources/Assets/PlasticBagAsset.d.ts +10 -0
  192. package/dist/Resources/Assets/PlasticBagAsset.js +15 -0
  193. package/dist/Resources/Assets/PlateAsset.d.ts +10 -0
  194. package/dist/Resources/Assets/PlateAsset.js +17 -0
  195. package/dist/Resources/Assets/RollingCartAsset.d.ts +11 -0
  196. package/dist/Resources/Assets/RollingCartAsset.js +34 -0
  197. package/dist/Resources/Assets/RugAsset.d.ts +10 -0
  198. package/dist/Resources/Assets/RugAsset.js +19 -0
  199. package/dist/Resources/Assets/SandcastleAsset.d.ts +10 -0
  200. package/dist/Resources/Assets/SandcastleAsset.js +30 -0
  201. package/dist/Resources/Assets/SchoolAsset.d.ts +10 -0
  202. package/dist/Resources/Assets/SchoolAsset.js +32 -0
  203. package/dist/Resources/Assets/ShelfWallAsset.d.ts +11 -0
  204. package/dist/Resources/Assets/ShelfWallAsset.js +23 -0
  205. package/dist/Resources/Assets/SofaAsset.d.ts +11 -0
  206. package/dist/Resources/Assets/SofaAsset.js +38 -0
  207. package/dist/Resources/Assets/StageAsset.d.ts +10 -0
  208. package/dist/Resources/Assets/StageAsset.js +44 -0
  209. package/dist/Resources/Assets/StarAsset.d.ts +10 -0
  210. package/dist/Resources/Assets/StarAsset.js +14 -0
  211. package/dist/Resources/Assets/StarsAsset.d.ts +11 -0
  212. package/dist/Resources/Assets/StarsAsset.js +42 -0
  213. package/dist/Resources/Assets/StreetlightAsset.d.ts +10 -0
  214. package/dist/Resources/Assets/StreetlightAsset.js +20 -0
  215. package/dist/Resources/Assets/SuitcaseAsset.d.ts +10 -0
  216. package/dist/Resources/Assets/SuitcaseAsset.js +42 -0
  217. package/dist/Resources/Assets/SunAsset.d.ts +10 -0
  218. package/dist/Resources/Assets/SunAsset.js +22 -0
  219. package/dist/Resources/Assets/TableAsset.d.ts +15 -0
  220. package/dist/Resources/Assets/TableAsset.js +21 -0
  221. package/dist/Resources/Assets/TrashCanAsset.d.ts +10 -0
  222. package/dist/Resources/Assets/TrashCanAsset.js +31 -0
  223. package/dist/Resources/Assets/TreeAsset.d.ts +10 -0
  224. package/dist/Resources/Assets/TreeAsset.js +23 -0
  225. package/dist/Resources/Assets/TrophyAsset.d.ts +10 -0
  226. package/dist/Resources/Assets/TrophyAsset.js +16 -0
  227. package/dist/Resources/Assets/TumblerAsset.d.ts +10 -0
  228. package/dist/Resources/Assets/TumblerAsset.js +17 -0
  229. package/dist/Resources/Assets/TvAsset.d.ts +10 -0
  230. package/dist/Resources/Assets/TvAsset.js +29 -0
  231. package/dist/Resources/Assets/TvStandAsset.d.ts +11 -0
  232. package/dist/Resources/Assets/TvStandAsset.js +34 -0
  233. package/dist/Resources/Assets/UmbrellaAsset.d.ts +10 -0
  234. package/dist/Resources/Assets/UmbrellaAsset.js +17 -0
  235. package/dist/Resources/Assets/UniversityAsset.d.ts +10 -0
  236. package/dist/Resources/Assets/UniversityAsset.js +22 -0
  237. package/dist/Resources/Assets/VaseFlowersAsset.d.ts +10 -0
  238. package/dist/Resources/Assets/VaseFlowersAsset.js +16 -0
  239. package/dist/Resources/Assets/WindowAsset.d.ts +11 -0
  240. package/dist/Resources/Assets/WindowAsset.js +32 -0
  241. package/dist/Resources/Groups/BaseGroup.d.ts +7 -0
  242. package/dist/Resources/Groups/BaseGroup.js +5 -0
  243. package/dist/Resources/Groups/CelebrationGroup.d.ts +8 -0
  244. package/dist/Resources/Groups/CelebrationGroup.js +19 -0
  245. package/dist/Resources/Groups/ConversationGroup.d.ts +9 -0
  246. package/dist/Resources/Groups/ConversationGroup.js +17 -0
  247. package/dist/Resources/Groups/DiningGroup.d.ts +8 -0
  248. package/dist/Resources/Groups/DiningGroup.js +21 -0
  249. package/dist/Resources/Groups/MeetingGroup.d.ts +8 -0
  250. package/dist/Resources/Groups/MeetingGroup.js +22 -0
  251. package/dist/Resources/Groups/ParkBenchGroup.d.ts +8 -0
  252. package/dist/Resources/Groups/ParkBenchGroup.js +17 -0
  253. package/dist/Resources/Groups/ReadingCornerGroup.d.ts +8 -0
  254. package/dist/Resources/Groups/ReadingCornerGroup.js +17 -0
  255. package/dist/Resources/Groups/WorkspaceGroup.d.ts +10 -0
  256. package/dist/Resources/Groups/WorkspaceGroup.js +25 -0
  257. package/dist/Resources/Kits/BaseKit.d.ts +12 -0
  258. package/dist/Resources/Kits/BaseKit.js +11 -0
  259. package/dist/Resources/Kits/FlatKit.d.ts +5 -0
  260. package/dist/Resources/Kits/FlatKit.js +8 -0
  261. package/dist/Resources/Kits/HatchKit.d.ts +15 -0
  262. package/dist/Resources/Kits/HatchKit.js +12 -0
  263. package/dist/Resources/Kits/OutlineKit.d.ts +12 -0
  264. package/dist/Resources/Kits/OutlineKit.js +10 -0
  265. package/dist/Resources/Kits/PaperKit.d.ts +11 -0
  266. package/dist/Resources/Kits/PaperKit.js +11 -0
  267. package/dist/Resources/Kits/RisoKit.d.ts +16 -0
  268. package/dist/Resources/Kits/RisoKit.js +11 -0
  269. package/dist/Resources/Kits/SketchKit.d.ts +9 -0
  270. package/dist/Resources/Kits/SketchKit.js +11 -0
  271. package/dist/Resources/Themes/BaseTheme.d.ts +5 -0
  272. package/dist/Resources/Themes/BaseTheme.js +5 -0
  273. package/dist/Resources/Themes/BeachTheme.d.ts +6 -0
  274. package/dist/Resources/Themes/BeachTheme.js +31 -0
  275. package/dist/Resources/Themes/FlatAutumnTheme.d.ts +6 -0
  276. package/dist/Resources/Themes/FlatAutumnTheme.js +29 -0
  277. package/dist/Resources/Themes/FlatCoolTheme.d.ts +6 -0
  278. package/dist/Resources/Themes/FlatCoolTheme.js +29 -0
  279. package/dist/Resources/Themes/NightTheme.d.ts +6 -0
  280. package/dist/Resources/Themes/NightTheme.js +29 -0
  281. package/dist/Resources/Themes/WarmCafeTheme.d.ts +6 -0
  282. package/dist/Resources/Themes/WarmCafeTheme.js +29 -0
  283. package/dist/Services/AssetService.d.ts +12 -0
  284. package/dist/Services/AssetService.js +204 -0
  285. package/dist/Services/BackgroundService.d.ts +33 -0
  286. package/dist/Services/BackgroundService.js +136 -0
  287. package/dist/Services/BalanceCritiqueService.d.ts +13 -0
  288. package/dist/Services/BalanceCritiqueService.js +64 -0
  289. package/dist/Services/CameraService.d.ts +21 -0
  290. package/dist/Services/CameraService.js +121 -0
  291. package/dist/Services/CatalogService.d.ts +29 -0
  292. package/dist/Services/CatalogService.js +51 -0
  293. package/dist/Services/ContactCritiqueService.d.ts +19 -0
  294. package/dist/Services/ContactCritiqueService.js +101 -0
  295. package/dist/Services/ContextService.d.ts +21 -0
  296. package/dist/Services/ContextService.js +94 -0
  297. package/dist/Services/CoverageCritiqueService.d.ts +16 -0
  298. package/dist/Services/CoverageCritiqueService.js +84 -0
  299. package/dist/Services/CustomAssetService.d.ts +31 -0
  300. package/dist/Services/CustomAssetService.js +184 -0
  301. package/dist/Services/DependencyOrderService.d.ts +12 -0
  302. package/dist/Services/DependencyOrderService.js +73 -0
  303. package/dist/Services/DescriptionService.d.ts +9 -0
  304. package/dist/Services/DescriptionService.js +27 -0
  305. package/dist/Services/FramingCheckService.d.ts +15 -0
  306. package/dist/Services/FramingCheckService.js +93 -0
  307. package/dist/Services/GazeService.d.ts +6 -0
  308. package/dist/Services/GazeService.js +43 -0
  309. package/dist/Services/GroupService.d.ts +17 -0
  310. package/dist/Services/GroupService.js +152 -0
  311. package/dist/Services/KitService.d.ts +23 -0
  312. package/dist/Services/KitService.js +96 -0
  313. package/dist/Services/LightingService.d.ts +24 -0
  314. package/dist/Services/LightingService.js +119 -0
  315. package/dist/Services/MapBaseService.d.ts +24 -0
  316. package/dist/Services/MapBaseService.js +104 -0
  317. package/dist/Services/MapLabelService.d.ts +26 -0
  318. package/dist/Services/MapLabelService.js +185 -0
  319. package/dist/Services/MapLegService.d.ts +23 -0
  320. package/dist/Services/MapLegService.js +87 -0
  321. package/dist/Services/MapPanelService.d.ts +16 -0
  322. package/dist/Services/MapPanelService.js +89 -0
  323. package/dist/Services/MapPinService.d.ts +11 -0
  324. package/dist/Services/MapPinService.js +56 -0
  325. package/dist/Services/MapProjectionService.d.ts +14 -0
  326. package/dist/Services/MapProjectionService.js +70 -0
  327. package/dist/Services/MapRouteService.d.ts +17 -0
  328. package/dist/Services/MapRouteService.js +79 -0
  329. package/dist/Services/PieceService.d.ts +43 -0
  330. package/dist/Services/PieceService.js +154 -0
  331. package/dist/Services/PlacementService.d.ts +60 -0
  332. package/dist/Services/PlacementService.js +415 -0
  333. package/dist/Services/PlaneBackgroundService.d.ts +24 -0
  334. package/dist/Services/PlaneBackgroundService.js +170 -0
  335. package/dist/Services/PlaneBoxService.d.ts +27 -0
  336. package/dist/Services/PlaneBoxService.js +209 -0
  337. package/dist/Services/PlaneDepthService.d.ts +18 -0
  338. package/dist/Services/PlaneDepthService.js +146 -0
  339. package/dist/Services/PlaneLabelService.d.ts +13 -0
  340. package/dist/Services/PlaneLabelService.js +115 -0
  341. package/dist/Services/PlaneObjectService.d.ts +17 -0
  342. package/dist/Services/PlaneObjectService.js +147 -0
  343. package/dist/Services/PlanePathService.d.ts +15 -0
  344. package/dist/Services/PlanePathService.js +98 -0
  345. package/dist/Services/PlaneProjectionService.d.ts +16 -0
  346. package/dist/Services/PlaneProjectionService.js +90 -0
  347. package/dist/Services/PlaneRoadService.d.ts +13 -0
  348. package/dist/Services/PlaneRoadService.js +105 -0
  349. package/dist/Services/PlaneScatterService.d.ts +11 -0
  350. package/dist/Services/PlaneScatterService.js +48 -0
  351. package/dist/Services/PlaneSpaceService.d.ts +27 -0
  352. package/dist/Services/PlaneSpaceService.js +96 -0
  353. package/dist/Services/PlaneSpriteService.d.ts +29 -0
  354. package/dist/Services/PlaneSpriteService.js +95 -0
  355. package/dist/Services/PlaneTitleService.d.ts +17 -0
  356. package/dist/Services/PlaneTitleService.js +126 -0
  357. package/dist/Services/PlaneZoneService.d.ts +20 -0
  358. package/dist/Services/PlaneZoneService.js +121 -0
  359. package/dist/Services/RasterService.d.ts +10 -0
  360. package/dist/Services/RasterService.js +68 -0
  361. package/dist/Services/SchemaService.d.ts +3 -0
  362. package/dist/Services/SchemaService.js +10 -0
  363. package/dist/Services/SilhouetteCritiqueService.d.ts +32 -0
  364. package/dist/Services/SilhouetteCritiqueService.js +155 -0
  365. package/dist/Services/TextService.d.ts +47 -0
  366. package/dist/Services/TextService.js +178 -0
  367. package/dist/Services/ThemeService.d.ts +5 -0
  368. package/dist/Services/ThemeService.js +18 -0
  369. package/dist/Utils/BoxUtil.d.ts +4 -0
  370. package/dist/Utils/BoxUtil.js +8 -0
  371. package/dist/Utils/ColorUtil.d.ts +20 -0
  372. package/dist/Utils/ColorUtil.js +51 -0
  373. package/dist/Utils/CurveUtil.d.ts +6 -0
  374. package/dist/Utils/CurveUtil.js +35 -0
  375. package/dist/Utils/FallbackUtil.d.ts +3 -0
  376. package/dist/Utils/FallbackUtil.js +8 -0
  377. package/dist/Utils/FormatUtil.d.ts +4 -0
  378. package/dist/Utils/FormatUtil.js +9 -0
  379. package/dist/Utils/IdUtil.d.ts +4 -0
  380. package/dist/Utils/IdUtil.js +11 -0
  381. package/dist/Utils/NormalizeUtil.d.ts +4 -0
  382. package/dist/Utils/NormalizeUtil.js +9 -0
  383. package/dist/Utils/OklabUtil.d.ts +23 -0
  384. package/dist/Utils/OklabUtil.js +62 -0
  385. package/dist/Utils/PersonArmUtil.d.ts +19 -0
  386. package/dist/Utils/PersonArmUtil.js +84 -0
  387. package/dist/Utils/PersonHeadUtil.d.ts +31 -0
  388. package/dist/Utils/PersonHeadUtil.js +154 -0
  389. package/dist/Utils/PersonOutfitUtil.d.ts +48 -0
  390. package/dist/Utils/PersonOutfitUtil.js +178 -0
  391. package/dist/Utils/PersonUtil.d.ts +39 -0
  392. package/dist/Utils/PersonUtil.js +206 -0
  393. package/dist/Utils/PixelUtil.d.ts +3 -0
  394. package/dist/Utils/PixelUtil.js +8 -0
  395. package/dist/Utils/RecolorUtil.d.ts +40 -0
  396. package/dist/Utils/RecolorUtil.js +155 -0
  397. package/dist/Utils/RegistryUtil.d.ts +8 -0
  398. package/dist/Utils/RegistryUtil.js +19 -0
  399. package/dist/Utils/RequireUtil.d.ts +3 -0
  400. package/dist/Utils/RequireUtil.js +11 -0
  401. package/dist/Utils/SanitizeUtil.d.ts +25 -0
  402. package/dist/Utils/SanitizeUtil.js +210 -0
  403. package/dist/Utils/SeedUtil.d.ts +6 -0
  404. package/dist/Utils/SeedUtil.js +15 -0
  405. package/dist/Utils/ShapeUtil.d.ts +31 -0
  406. package/dist/Utils/ShapeUtil.js +47 -0
  407. package/dist/Utils/SuggestUtil.d.ts +7 -0
  408. package/dist/Utils/SuggestUtil.js +25 -0
  409. package/dist/Utils/SvgUtil.d.ts +9 -0
  410. package/dist/Utils/SvgUtil.js +21 -0
  411. package/dist/Utils/ThemeUtil.d.ts +4 -0
  412. package/dist/Utils/ThemeUtil.js +13 -0
  413. package/dist/Utils/TransportUtil.d.ts +24 -0
  414. package/dist/Utils/TransportUtil.js +108 -0
  415. package/dist/cli.js +24 -97
  416. package/dist/index.d.ts +10 -6
  417. package/dist/index.js +14 -2
  418. package/dist/render.d.ts +8 -5
  419. package/dist/render.js +21 -3
  420. package/dist/schema.d.ts +9 -2
  421. package/dist/schema.js +29 -5
  422. package/package.json +3 -2
  423. package/skills/{scenec → draw-scene}/SKILL.md +15 -19
  424. package/skills/{scenec → draw-scene}/references/catalog.md +14 -14
  425. package/skills/{scenec → draw-scene}/references/dsl.md +9 -3
  426. package/dist/catalog.d.ts +0 -21
  427. package/dist/catalog.js +0 -35
  428. package/dist/data/europe.json +0 -1
  429. package/dist/drawing/assets.d.ts +0 -8
  430. package/dist/drawing/assets.js +0 -612
  431. package/dist/drawing/kits.d.ts +0 -7
  432. package/dist/drawing/kits.js +0 -92
  433. package/dist/drawing/person.d.ts +0 -18
  434. package/dist/drawing/person.js +0 -287
  435. package/dist/drawing/themes.d.ts +0 -4
  436. package/dist/drawing/themes.js +0 -45
  437. package/dist/modes/map.d.ts +0 -5
  438. package/dist/modes/map.js +0 -365
  439. package/dist/modes/plane.d.ts +0 -5
  440. package/dist/modes/plane.js +0 -716
  441. package/dist/pipeline/compile.d.ts +0 -2
  442. package/dist/pipeline/compile.js +0 -581
  443. package/dist/pipeline/custom.d.ts +0 -2
  444. package/dist/pipeline/custom.js +0 -120
  445. package/dist/pipeline/groups.d.ts +0 -2
  446. package/dist/pipeline/groups.js +0 -189
  447. package/dist/pipeline/index.js +0 -7
  448. package/dist/pipeline/parse.d.ts +0 -10
  449. package/dist/pipeline/parse.js +0 -80
  450. package/dist/protocols/options.js +0 -1
  451. package/dist/protocols/scene.d.ts +0 -299
  452. package/dist/protocols/scene.js +0 -118
  453. package/dist/protocols/theme.js +0 -1
  454. package/dist/render/check.d.ts +0 -6
  455. package/dist/render/check.js +0 -10
  456. package/dist/render/critic.d.ts +0 -1
  457. package/dist/render/critic.js +0 -235
  458. package/dist/render/files.d.ts +0 -2
  459. package/dist/render/files.js +0 -16
  460. package/dist/render/fonts.d.ts +0 -2
  461. package/dist/render/fonts.js +0 -4
  462. package/dist/render/png.d.ts +0 -9
  463. package/dist/render/png.js +0 -13
  464. package/dist/utils/color.d.ts +0 -5
  465. package/dist/utils/color.js +0 -35
  466. package/dist/utils/recolor.d.ts +0 -1
  467. package/dist/utils/recolor.js +0 -56
  468. package/dist/utils/sanitize.d.ts +0 -5
  469. package/dist/utils/sanitize.js +0 -169
  470. package/dist/utils/suggest.d.ts +0 -1
  471. package/dist/utils/suggest.js +0 -22
  472. package/dist/utils/svg.d.ts +0 -2
  473. package/dist/utils/svg.js +0 -11
  474. package/skills/scenec/references/fontes.md +0 -8
  475. /package/dist/{protocols/options.d.ts → Protocols/OptionsProtocol.d.ts} +0 -0
  476. /package/skills/{scenec/recipes/anuncios-variacoes.yaml → draw-scene/recipes/ad-variations.yaml} +0 -0
  477. /package/skills/{scenec/recipes/carrossel.yaml → draw-scene/recipes/carousel.yaml} +0 -0
  478. /package/skills/{scenec/recipes/elearning.yaml → draw-scene/recipes/e-learning.yaml} +0 -0
  479. /package/skills/{scenec/recipes/reels-explicativo.yaml → draw-scene/recipes/explainer-reel.yaml} +0 -0
  480. /package/skills/{scenec/recipes/historia-ilustrada.yaml → draw-scene/recipes/illustrated-story.yaml} +0 -0
  481. /package/skills/{scenec/recipes/mapas-jornadas.yaml → draw-scene/recipes/journey-map.yaml} +0 -0
  482. /package/skills/{scenec/recipes/wrapped-personalizado.yaml → draw-scene/recipes/personalized-wrapped.yaml} +0 -0
  483. /package/skills/{scenec/recipes/ilustracoes-produto.yaml → draw-scene/recipes/product-illustration.yaml} +0 -0
@@ -0,0 +1,154 @@
1
+ import { ColorUtil } from "./ColorUtil.js";
2
+ import { FallbackUtil } from "./FallbackUtil.js";
3
+ import { IdUtil } from "./IdUtil.js";
4
+ import { PersonArmUtil } from "./PersonArmUtil.js";
5
+ class PersonHeadUtil {
6
+ static SKIN_NAME_TO_COLOR = {
7
+ light: "#F2C9A5",
8
+ medium: "#D19A6E",
9
+ tan: "#B87A50",
10
+ dark: "#7A4B30",
11
+ deep: "#5A3522"
12
+ };
13
+ static HAIR_NAME_TO_COLOR = {
14
+ black: "#1E1A1A",
15
+ brown: "#5A3825",
16
+ blonde: "#E2B45A",
17
+ red: "#B0462A",
18
+ gray: "#9C9C9C"
19
+ };
20
+ static AGE_TO_HAIR_COLOR = { elder: "gray" };
21
+ static STYLE_TO_BACK_EXTRA = {
22
+ long: (hair) => `<path d="M-11 -90 Q-13 -70 -9 -68 L9 -68 Q13 -70 11 -90 Z" fill="${hair}"/>`,
23
+ bun: (hair) => `<circle cx="0" cy="-104" r="6" fill="${hair}"/>`
24
+ };
25
+ static CENTER_Y = -91;
26
+ static CURL_OFFSETS = [[-9, -6], [-4, -10], [2, -11], [8, -8], [11, -2], [-11, 0]];
27
+ static STYLE_TO_HAIR = {
28
+ long: (hair) => ({
29
+ backHair: `<path d="M-12 -93 Q-15 -70 -10 -68 L10 -68 Q15 -70 12 -93 Z" fill="${hair}"/>`,
30
+ front: `<path d="M-12 -92 Q-11 -105 0 -104 Q11 -105 12 -92 Q4 -99 -12 -92 Z" fill="${hair}"/>`
31
+ }),
32
+ bun: (hair) => ({
33
+ backHair: `<circle cx="0" cy="-105" r="6" fill="${hair}"/>`,
34
+ front: PersonHeadUtil.fringe(hair)
35
+ }),
36
+ curly: (hair) => ({
37
+ backHair: "",
38
+ front: PersonHeadUtil.CURL_OFFSETS.map(([offsetX, offsetY]) => `<circle cx="${0 + offsetX}" cy="${PersonHeadUtil.CENTER_Y + offsetY}" r="5" fill="${hair}"/>`).join("")
39
+ }),
40
+ ponytail: (hair, side) => {
41
+ const flat = side ? 0 : 1;
42
+ return {
43
+ backHair: `<path d="M${-side * 9 - flat * 9} -96 Q${-side * 22 - flat * 14} -86 ${-side * 15 - flat * 12} -72" stroke="${hair}" stroke-width="6" fill="none" stroke-linecap="round"/>`,
44
+ front: PersonHeadUtil.fringe(hair)
45
+ };
46
+ },
47
+ short: (hair) => ({ backHair: "", front: PersonHeadUtil.shortFront(hair) }),
48
+ bald: () => ({ backHair: "", front: "" })
49
+ };
50
+ static EXPRESSION_TO_MOUTH = {
51
+ surprised: (centerX, centerY, ink) => `<ellipse cx="${centerX}" cy="${centerY + 5.5}" rx="1.6" ry="2" fill="${ink}"/>`,
52
+ neutral: (centerX, centerY, ink) => `<path d="M${centerX - 2.5} ${centerY + 5.5} L${centerX + 2.5} ${centerY + 5.5}" stroke="${ink}" stroke-width="1.2" stroke-linecap="round"/>`,
53
+ sad: (centerX, centerY, ink) => PersonHeadUtil.frown(centerX, centerY, ink),
54
+ worried: (centerX, centerY, ink) => PersonHeadUtil.frown(centerX, centerY, ink),
55
+ angry: (centerX, centerY, ink) => PersonHeadUtil.frown(centerX, centerY, ink),
56
+ laughing: (centerX, centerY, ink) => `<path d="M${centerX - 3.5} ${centerY + 4} Q${centerX} ${centerY + 9.5} ${centerX + 3.5} ${centerY + 4} Z" fill="${ink}"/>`
57
+ };
58
+ static EXPRESSION_TO_BROWS = {
59
+ thinking: (centerX, centerY, hair) => PersonHeadUtil.raisedBrows(centerX, centerY, hair),
60
+ surprised: (centerX, centerY, hair) => PersonHeadUtil.raisedBrows(centerX, centerY, hair),
61
+ worried: (centerX, centerY, hair) => `<path d="M${-6 + centerX} ${centerY - 4.2} L${-2 + centerX} ${centerY - 5.6} M${2 + centerX} ${centerY - 5.6} L${6 + centerX} ${centerY - 4.2}" stroke="${hair}" stroke-width="1.1" stroke-linecap="round"/>`,
62
+ angry: (centerX, centerY, hair) => `<path d="M${-6 + centerX} ${centerY - 5.6} L${-2 + centerX} ${centerY - 4} M${2 + centerX} ${centerY - 4} L${6 + centerX} ${centerY - 5.6}" stroke="${hair}" stroke-width="1.3" stroke-linecap="round"/>`
63
+ };
64
+ static shortFront(hair) {
65
+ return `<path d="M-11 -93 Q-10 -104 1 -103 Q11 -102 11 -94 Q6 -98 -2 -97 Q-7 -96 -11 -93 Z" fill="${hair}"/>`;
66
+ }
67
+ static fringe(hair) {
68
+ return `<path d="M-11.5 -92 Q-11 -104 0 -103.5 Q11 -104 11.5 -92 Q2 -100 -11.5 -92 Z" fill="${hair}"/>`;
69
+ }
70
+ static frown(centerX, centerY, ink) {
71
+ return `<path d="M${centerX - 3} ${centerY + 6.5} Q${centerX} ${centerY + 3.8} ${centerX + 3} ${centerY + 6.5}" stroke="${ink}" stroke-width="1.2" fill="none" stroke-linecap="round"/>`;
72
+ }
73
+ static smile(centerX, centerY, ink) {
74
+ return `<path d="M${centerX - 3} ${centerY + 4.5} Q${centerX} ${centerY + 7.5} ${centerX + 3} ${centerY + 4.5}" stroke="${ink}" stroke-width="1.2" fill="none" stroke-linecap="round"/>`;
75
+ }
76
+ static raisedBrows(centerX, centerY, hair) {
77
+ return `<path d="M${-6 + centerX} ${centerY - 4.5} L${-2 + centerX} ${centerY - 5.2} M${2 + centerX} ${centerY - 5.2} L${6 + centerX} ${centerY - 4.5}" stroke="${hair}" stroke-width="1.1" stroke-linecap="round"/>`;
78
+ }
79
+ static skinOf(name) {
80
+ return IdUtil.lookup(PersonHeadUtil.SKIN_NAME_TO_COLOR, name) ?? PersonHeadUtil.SKIN_NAME_TO_COLOR.medium;
81
+ }
82
+ static hairColorOf(params) {
83
+ const named = IdUtil.lookup(PersonHeadUtil.HAIR_NAME_TO_COLOR, params.hair_color);
84
+ const defaultName = IdUtil.lookup(PersonHeadUtil.AGE_TO_HAIR_COLOR, params.age) ?? "brown";
85
+ const fallback = PersonHeadUtil.HAIR_NAME_TO_COLOR[defaultName];
86
+ return named ?? FallbackUtil.nonEmpty(params.hair_color, fallback);
87
+ }
88
+ static head(params, theme, face) {
89
+ const { side, isBack, gaze } = face;
90
+ const skin = PersonHeadUtil.skinOf(params.skin);
91
+ const hair = PersonHeadUtil.hairColorOf(params);
92
+ const style = FallbackUtil.nonEmpty(params.hair, "short");
93
+ const builder = IdUtil.lookup(PersonHeadUtil.STYLE_TO_HAIR, style);
94
+ const { backHair, front } = builder?.(hair, side) ?? { backHair: "", front: "" };
95
+ const neck = `<rect x="-3" y="-85" width="6" height="7" fill="${ColorUtil.sh(skin, -0.12)}"/>`;
96
+ if (isBack) {
97
+ return neck + backHair + PersonHeadUtil.backOfHead(style, skin, hair);
98
+ }
99
+ const cy = PersonHeadUtil.CENTER_Y;
100
+ const earColor = ColorUtil.sh(skin, -0.08);
101
+ const ear = side ? `<ellipse cx="${-side * 10}" cy="${cy + 1}" rx="2" ry="3" fill="${earColor}"/>` : "";
102
+ return neck + backHair + ear + `<circle cx="0" cy="${cy}" r="11" fill="${skin}"/>` + front + PersonHeadUtil.faceFeatures(params, theme, { side, gaze, hair, skin });
103
+ }
104
+ static backOfHead(style, skin, hair) {
105
+ const cy = PersonHeadUtil.CENTER_Y;
106
+ const scalp = `<circle cx="0" cy="${cy}" r="11" fill="${skin}"/>`;
107
+ if (style === "bald") {
108
+ return scalp;
109
+ }
110
+ const extra = IdUtil.lookup(PersonHeadUtil.STYLE_TO_BACK_EXTRA, style)?.(hair) ?? "";
111
+ const cap = `<path d="M-11.3 -88 Q-12 -103 0 -103 Q12 -103 11.3 -88 Q0 -84 -11.3 -88 Z" fill="${hair}"/>`;
112
+ return `${scalp}${cap}${extra}`;
113
+ }
114
+ static faceFeatures(params, theme, look) {
115
+ const { side, gaze, hair, skin } = look;
116
+ const cy = PersonHeadUtil.CENTER_Y;
117
+ const expression = FallbackUtil.nonEmpty(params.expr, "happy");
118
+ const shiftX = side * 1.8 + (side ? 0 : gaze[0] * 1.3);
119
+ const mouthX = side * 2 + (side ? 0 : gaze[0] * 1.3);
120
+ const drawMouth = IdUtil.lookup(PersonHeadUtil.EXPRESSION_TO_MOUTH, expression);
121
+ const mouth = drawMouth ? drawMouth(mouthX, cy, theme.ink) : PersonHeadUtil.smile(mouthX, cy, theme.ink);
122
+ const brows = IdUtil.lookup(PersonHeadUtil.EXPRESSION_TO_BROWS, expression)?.(shiftX, cy, hair) ?? "";
123
+ const blush = `<circle cx="${-6.5 + shiftX}" cy="${cy + 3.5}" r="2" fill="#E9806E" opacity="0.35"/><circle cx="${6.5 + shiftX}" cy="${cy + 3.5}" r="2" fill="#E9806E" opacity="0.35"/>`;
124
+ const glasses = params.glasses ? `<g stroke="${theme.ink}" stroke-width="1" fill="none"><circle cx="${-4 + shiftX}" cy="${cy}" r="3.2"/><circle cx="${4 + shiftX}" cy="${cy}" r="3.2"/><path d="M${-0.8 + shiftX} ${cy} L${0.8 + shiftX} ${cy}"/></g>` : "";
125
+ const beard = params.beard ? `<path d="M-10 -89 Q-10 -76 0 -76 Q10 -76 10 -89 Q8 -83 ${mouthX + 4} ${cy + 3} L${mouthX - 4} ${cy + 3} Q-8 -83 -10 -89 Z" fill="${hair}"/>` : "";
126
+ const lines = PersonHeadUtil.ageLines(params, skin, shiftX);
127
+ const eyes = PersonHeadUtil.eyes(expression, theme, { shiftX, gaze });
128
+ return beard + lines + eyes + brows + mouth + blush + glasses;
129
+ }
130
+ static ageLines(params, skin, shiftX) {
131
+ if (params.age !== "elder") {
132
+ return "";
133
+ }
134
+ const round = (value) => PersonArmUtil.round(value);
135
+ const cy = PersonHeadUtil.CENTER_Y;
136
+ const stroke = ColorUtil.sh(skin, -0.25);
137
+ return `<path d="M${round(-8.2 + shiftX)} ${cy - 1.5} l-1.4 -0.6 M${round(8.2 + shiftX)} ${cy - 1.5} l1.4 -0.6 M${round(-5 + shiftX)} ${cy - 7.5} L${round(5 + shiftX)} ${cy - 7.5}" stroke="${stroke}" stroke-width="0.6" stroke-linecap="round"/>`;
138
+ }
139
+ static eyes(expression, theme, look) {
140
+ const round = (value) => PersonArmUtil.round(value);
141
+ const { shiftX, gaze } = look;
142
+ const cy = PersonHeadUtil.CENTER_Y;
143
+ const pupilX = gaze[0] * 1.1;
144
+ const pupilY = gaze[1] * 1.1;
145
+ const eye = (column) => `<circle cx="${round(column + pupilX)}" cy="${round(cy + pupilY)}" r="1.45" fill="${theme.ink}"/><circle cx="${round(column + pupilX + 0.45)}" cy="${round(cy + pupilY - 0.5)}" r="0.42" fill="#FFFFFF" opacity="0.85"/>`;
146
+ if (expression === "wink") {
147
+ return eye(-4 + shiftX) + `<path d="M${round(2.4 + shiftX)} ${cy} Q${round(4 + shiftX)} ${cy - 1.6} ${round(5.6 + shiftX)} ${cy}" stroke="${theme.ink}" stroke-width="1.1" fill="none" stroke-linecap="round"/>`;
148
+ }
149
+ return eye(-4 + shiftX) + eye(4 + shiftX);
150
+ }
151
+ }
152
+ export {
153
+ PersonHeadUtil
154
+ };
@@ -0,0 +1,48 @@
1
+ import type { BottomName, OutfitName, PersonParams } from "../Protocols/PersonProtocol.js";
2
+ import type { Theme } from "../Protocols/ThemeProtocol.js";
3
+ export interface PersonLook {
4
+ theme: Theme;
5
+ skin: string;
6
+ top: string;
7
+ bottomColor: string;
8
+ jacket: string | null;
9
+ outfit: OutfitName | null;
10
+ bottom: BottomName | null;
11
+ shoes: string;
12
+ gown: string | null;
13
+ sleeve: string;
14
+ isShortSleeve: boolean;
15
+ }
16
+ export declare class PersonOutfitUtil {
17
+ private static readonly LAB_COAT;
18
+ private static readonly HAT_NAME_TO_BUILDER;
19
+ private static readonly OUTFIT_TO_TRAITS;
20
+ private static readonly BOTTOM_TO_LEG_SHAPE;
21
+ private static readonly UNKNOWN_LEG_SHAPE;
22
+ private static readonly OUTFIT_TO_NECKLINE;
23
+ private static readonly BOTTOM_TO_SEATED_OVERLAY;
24
+ private static readonly BOTTOM_TO_STANDING_OVERLAY;
25
+ private static colorOf;
26
+ private static themeColorOnly;
27
+ static lookOf(params: PersonParams, theme: Theme): PersonLook;
28
+ private static legShapeOf;
29
+ private static legColorOf;
30
+ static seatedLegs(look: PersonLook, facing: number): string;
31
+ private static seatedSkirt;
32
+ static seatedTorso(look: PersonLook, facing: number): string;
33
+ static standingLegs(look: PersonLook, isWalking: boolean): string;
34
+ private static walkingLegs;
35
+ private static restingLegs;
36
+ static standingTorso(look: PersonLook, params: PersonParams, isBack: boolean): string;
37
+ private static baseTorso;
38
+ private static upperLayers;
39
+ private static gownLayer;
40
+ private static labCoatLayer;
41
+ static backpack(look: PersonLook, params: PersonParams, isBack: boolean): {
42
+ behind: string;
43
+ onTorso: string;
44
+ };
45
+ static hat(look: PersonLook, params: PersonParams, side: number): string;
46
+ private static graduationCap;
47
+ private static cap;
48
+ }
@@ -0,0 +1,178 @@
1
+ import { BOTTOM_NAMES, OUTFIT_NAMES } from "../Protocols/PersonProtocol.js";
2
+ import { ColorUtil } from "./ColorUtil.js";
3
+ import { FallbackUtil } from "./FallbackUtil.js";
4
+ import { IdUtil } from "./IdUtil.js";
5
+ import { PersonHeadUtil } from "./PersonHeadUtil.js";
6
+ class PersonOutfitUtil {
7
+ static LAB_COAT = "#FBFBF8";
8
+ static HAT_NAME_TO_BUILDER = {
9
+ grad_cap: (look) => PersonOutfitUtil.graduationCap(look),
10
+ cap: (look, params, side) => PersonOutfitUtil.cap(look, params, side)
11
+ };
12
+ static OUTFIT_TO_TRAITS = {
13
+ tshirt: { hasGown: false, isDress: false, isLabCoat: false, isTshirt: true },
14
+ sweater: { hasGown: false, isDress: false, isLabCoat: false, isTshirt: false },
15
+ labcoat: { hasGown: false, isDress: false, isLabCoat: true, isTshirt: false },
16
+ gown: { hasGown: true, isDress: false, isLabCoat: false, isTshirt: false },
17
+ dress: { hasGown: false, isDress: true, isLabCoat: false, isTshirt: false }
18
+ };
19
+ static BOTTOM_TO_LEG_SHAPE = {
20
+ pants: { width: 8, isCovered: true },
21
+ shorts: { width: 6.5, isCovered: false },
22
+ skirt: { width: 6.5, isCovered: false },
23
+ dress: { width: 6.5, isCovered: false }
24
+ };
25
+ static UNKNOWN_LEG_SHAPE = { width: 6.5, isCovered: false };
26
+ static OUTFIT_TO_NECKLINE = {
27
+ sweater: (look) => `<path d="M-6 -81 Q0 -76 6 -81" stroke="${ColorUtil.sh(look.top, -0.25)}" stroke-width="1.5" fill="none"/>`,
28
+ tshirt: (look) => `<path d="M-5 -81 Q0 -77 5 -81" fill="${ColorUtil.sh(look.skin, -0.12)}"/>`
29
+ };
30
+ static BOTTOM_TO_SEATED_OVERLAY = {
31
+ shorts: (look, facing) => `<path d="M0 -45 L${facing * 14} -45" stroke="${look.bottomColor}" stroke-width="12" stroke-linecap="butt"/>`,
32
+ skirt: (look, facing) => PersonOutfitUtil.seatedSkirt(look, facing, look.bottomColor),
33
+ dress: (look, facing) => PersonOutfitUtil.seatedSkirt(look, facing, look.top)
34
+ };
35
+ static BOTTOM_TO_STANDING_OVERLAY = {
36
+ shorts: (look) => `<path d="M-11 -47 L11 -47 L12 -30 L1 -30 L0 -36 L-1 -30 L-12 -30 Z" fill="${look.bottomColor}"/><path d="M4 -47 L11 -47 L12 -30 L5 -30 Z" fill="${ColorUtil.sh(look.bottomColor, -0.12)}"/>`,
37
+ skirt: (look) => `<path d="M-12 -48 L12 -48 L17 -27 L-17 -27 Z" fill="${look.bottomColor}"/><path d="M4 -48 L12 -48 L17 -27 L7 -27 Z" fill="${ColorUtil.sh(look.bottomColor, -0.12)}"/>`,
38
+ dress: (look) => `<path d="M-12 -48 L12 -48 L18 -24 L-18 -24 Z" fill="${look.top}"/><path d="M4 -48 L12 -48 L18 -24 L7 -24 Z" fill="${ColorUtil.sh(look.top, -0.12)}"/>`
39
+ };
40
+ static colorOf(theme, name, fallback) {
41
+ if (!name) {
42
+ return fallback;
43
+ }
44
+ const value = theme[name];
45
+ return typeof value === "string" && value ? value : name;
46
+ }
47
+ static themeColorOnly(theme, name, fallback) {
48
+ const value = name ? theme[name] : void 0;
49
+ return typeof value === "string" && value ? value : fallback;
50
+ }
51
+ static lookOf(params, theme) {
52
+ const top = PersonOutfitUtil.colorOf(theme, params.shirt, theme.primary);
53
+ const jacket = params.jacket ? PersonOutfitUtil.colorOf(theme, params.jacket, "") : null;
54
+ const outfitText = FallbackUtil.nonEmpty(params.outfit, "tshirt");
55
+ const outfit = IdUtil.isOneOf(OUTFIT_NAMES, outfitText) ? outfitText : null;
56
+ const traits = IdUtil.lookup(PersonOutfitUtil.OUTFIT_TO_TRAITS, outfit);
57
+ const gown = traits?.hasGown ? PersonOutfitUtil.colorOf(theme, params.gown, theme.ink) : null;
58
+ const bottomText = traits?.isDress ? "dress" : FallbackUtil.nonEmpty(params.bottom, "pants");
59
+ return {
60
+ theme,
61
+ skin: PersonHeadUtil.skinOf(params.skin),
62
+ top,
63
+ bottomColor: PersonOutfitUtil.colorOf(theme, params.pants, theme.secondary),
64
+ jacket,
65
+ outfit,
66
+ bottom: IdUtil.isOneOf(BOTTOM_NAMES, bottomText) ? bottomText : null,
67
+ shoes: PersonOutfitUtil.colorOf(theme, params.shoes, theme.ink),
68
+ gown,
69
+ sleeve: traits?.isLabCoat ? PersonOutfitUtil.LAB_COAT : gown ?? jacket ?? top,
70
+ isShortSleeve: !jacket && traits?.isTshirt === true
71
+ };
72
+ }
73
+ static legShapeOf(look) {
74
+ return IdUtil.lookup(PersonOutfitUtil.BOTTOM_TO_LEG_SHAPE, look.bottom) ?? PersonOutfitUtil.UNKNOWN_LEG_SHAPE;
75
+ }
76
+ static legColorOf(look) {
77
+ return PersonOutfitUtil.legShapeOf(look).isCovered ? look.bottomColor : look.skin;
78
+ }
79
+ static seatedLegs(look, facing) {
80
+ const { shoes } = look;
81
+ const legColor = PersonOutfitUtil.legColorOf(look);
82
+ const legs = `<path d="M0 -45 L${facing * 24} -45 L${facing * 24} -4" stroke="${legColor}" stroke-width="11" fill="none" stroke-linejoin="round"/><path d="M${facing * 2} -41 L${facing * 24} -41" stroke="${ColorUtil.sh(legColor, -0.12)}" stroke-width="3" fill="none"/><path d="M${facing * 21} -3 L${facing * 32} -3 Q${facing * 32} -8 ${facing * 25} -8 L${facing * 21} -8 Z" fill="${shoes}"/>`;
83
+ return legs + (IdUtil.lookup(PersonOutfitUtil.BOTTOM_TO_SEATED_OVERLAY, look.bottom)?.(look, facing) ?? "");
84
+ }
85
+ static seatedSkirt(look, facing, fill) {
86
+ return `<path d="M${-facing * 6} -52 L${facing * 18} -50 L${facing * 20} -39 L${-facing * 7} -40 Z" fill="${fill}"/>`;
87
+ }
88
+ static seatedTorso(look, facing) {
89
+ const { jacket, top } = look;
90
+ const torsoColor = jacket ?? top;
91
+ return `<rect x="-10" y="-81" width="20" height="40" rx="7" fill="${torsoColor}"/><path d="M${-facing * 10} -74 Q${-facing * 10} -81 ${-facing * 4} -81 L${-facing * 3} -81 L${-facing * 3} -41 L${-facing * 10} -41 Z" fill="${ColorUtil.sh(torsoColor, -0.13)}"/>` + (jacket ? `<path d="M${facing * 5} -80 L${facing * 9} -76 L${facing * 9} -44 L${facing * 4} -44 Z" fill="${top}"/>` : "");
92
+ }
93
+ static standingLegs(look, isWalking) {
94
+ const { shoes } = look;
95
+ const legColor = PersonOutfitUtil.legColorOf(look);
96
+ const legWidth = PersonOutfitUtil.legShapeOf(look).width;
97
+ const legs = isWalking ? PersonOutfitUtil.walkingLegs(legColor, shoes) : PersonOutfitUtil.restingLegs(legColor, shoes, legWidth);
98
+ return legs + (IdUtil.lookup(PersonOutfitUtil.BOTTOM_TO_STANDING_OVERLAY, look.bottom)?.(look) ?? "");
99
+ }
100
+ static walkingLegs(legColor, shoes) {
101
+ return `<path d="M-3 -45 L-12 -3" stroke="${legColor}" stroke-width="8" stroke-linecap="round"/><path d="M3 -45 L11 -3" stroke="${ColorUtil.sh(legColor, -0.12)}" stroke-width="8" stroke-linecap="round"/><ellipse cx="-14" cy="-2.5" rx="5.5" ry="2.8" fill="${shoes}"/><ellipse cx="14" cy="-2.5" rx="5.5" ry="2.8" fill="${shoes}"/>`;
102
+ }
103
+ static restingLegs(legColor, shoes, legWidth) {
104
+ return `<rect x="${-1 - legWidth}" y="-47" width="${legWidth}" height="45" rx="3" fill="${legColor}"/><rect x="1" y="-47" width="${legWidth}" height="45" rx="3" fill="${legColor}"/><rect x="${1 + legWidth * 0.45}" y="-47" width="${legWidth * 0.55}" height="45" rx="2" fill="${ColorUtil.sh(legColor, -0.12)}"/><ellipse cx="-5.5" cy="-2.5" rx="5.5" ry="2.8" fill="${shoes}"/><ellipse cx="5.5" cy="-2.5" rx="5.5" ry="2.8" fill="${shoes}"/>`;
105
+ }
106
+ static standingTorso(look, params, isBack) {
107
+ return PersonOutfitUtil.baseTorso(look, params.build === "heavy") + PersonOutfitUtil.upperLayers(look, isBack) + PersonOutfitUtil.gownLayer(look, params, isBack) + PersonOutfitUtil.labCoatLayer(look, isBack);
108
+ }
109
+ static baseTorso(look, isHeavy) {
110
+ const torsoColor = look.jacket ?? look.top;
111
+ const shade = ColorUtil.sh(torsoColor, -0.13);
112
+ if (isHeavy) {
113
+ return `<path d="M-13 -74 Q-13 -81 -6 -81 L6 -81 Q13 -81 13 -74 Q18 -58 13 -44 L-13 -44 Q-18 -58 -13 -74 Z" fill="${torsoColor}"/><path d="M5 -81 L6 -81 Q13 -81 13 -74 Q18 -58 13 -44 L5 -44 Z" fill="${shade}"/>`;
114
+ }
115
+ return `<path d="M-13 -74 Q-13 -81 -6 -81 L6 -81 Q13 -81 13 -74 L12 -44 L-12 -44 Z" fill="${torsoColor}"/><path d="M5 -81 L6 -81 Q13 -81 13 -74 L12 -44 L5 -44 Z" fill="${shade}"/>`;
116
+ }
117
+ static upperLayers(look, isBack) {
118
+ const { jacket, top } = look;
119
+ if (isBack) {
120
+ return "";
121
+ }
122
+ if (jacket) {
123
+ return `<path d="M-5 -81 L5 -81 L3 -45 L-3 -45 Z" fill="${top}"/><path d="M-5 -81 L-1 -70 L-4 -60 M5 -81 L1 -70 L4 -60" stroke="${ColorUtil.sh(jacket, -0.25)}" stroke-width="1.2" fill="none"/>`;
124
+ }
125
+ return IdUtil.lookup(PersonOutfitUtil.OUTFIT_TO_NECKLINE, look.outfit)?.(look) ?? "";
126
+ }
127
+ static gownLayer(look, params, isBack) {
128
+ const { gown, theme, skin } = look;
129
+ if (!gown) {
130
+ return "";
131
+ }
132
+ const stole = PersonOutfitUtil.themeColorOnly(theme, params.stole, theme.accent);
133
+ const front = `<path d="M-6 -81 L-3 -81 L-4 -46 L-7 -46 Z M3 -81 L6 -81 L7 -46 L4 -46 Z" fill="${stole}"/><path d="M-5 -81 Q0 -74 5 -81" fill="${ColorUtil.sh(skin, -0.12)}"/>`;
134
+ return `<path d="M-13 -76 Q-13 -81 -6 -81 L6 -81 Q13 -81 13 -76 L18 -14 L-18 -14 Z" fill="${gown}"/><path d="M5 -81 L6 -81 Q13 -81 13 -76 L18 -14 L6 -14 Z" fill="${ColorUtil.sh(gown, -0.15)}"/>` + (isBack ? "" : front);
135
+ }
136
+ static labCoatLayer(look, isBack) {
137
+ if (look.outfit !== "labcoat") {
138
+ return "";
139
+ }
140
+ const coat = PersonOutfitUtil.LAB_COAT;
141
+ const { top, theme } = look;
142
+ const seam = ColorUtil.sh(coat, -0.25);
143
+ const front = `<path d="M-5 -81 L5 -81 L1 -60 L-1 -60 Z" fill="${top}"/><path d="M0 -60 L0 -27" stroke="${seam}" stroke-width="1"/><rect x="-11" y="-42" width="7" height="6" rx="1" fill="none" stroke="${seam}" stroke-width="1"/><path d="M6 -72 L6 -66" stroke="${theme.primary}" stroke-width="1.6"/>`;
144
+ return `<path d="M-13 -76 Q-13 -81 -6 -81 L6 -81 Q13 -81 13 -76 L15 -27 L-15 -27 Z" fill="${coat}"/><path d="M5 -81 L6 -81 Q13 -81 13 -76 L15 -27 L5 -27 Z" fill="${ColorUtil.sh(coat, -0.1)}"/>` + (isBack ? "" : front);
145
+ }
146
+ static backpack(look, params, isBack) {
147
+ if (!params.backpack) {
148
+ return { behind: "", onTorso: "" };
149
+ }
150
+ const { theme } = look;
151
+ const color = params.backpack === true ? theme.accent : PersonOutfitUtil.colorOf(theme, params.backpack, theme.accent);
152
+ if (isBack) {
153
+ return {
154
+ behind: "",
155
+ onTorso: `<rect x="-11" y="-78" width="22" height="30" rx="7" fill="${color}"/><rect x="-7" y="-62" width="14" height="10" rx="3" fill="${ColorUtil.sh(color, -0.15)}"/>`
156
+ };
157
+ }
158
+ return {
159
+ behind: `<rect x="-16" y="-79" width="32" height="32" rx="7" fill="${ColorUtil.sh(color, -0.2)}"/>`,
160
+ onTorso: `<path d="M-8 -81 L-9 -50 M8 -81 L9 -50" stroke="${ColorUtil.sh(color, -0.1)}" stroke-width="2.5" stroke-linecap="round"/>`
161
+ };
162
+ }
163
+ static hat(look, params, side) {
164
+ return IdUtil.lookup(PersonOutfitUtil.HAT_NAME_TO_BUILDER, params.hat)?.(look, params, side) ?? "";
165
+ }
166
+ static graduationCap(look) {
167
+ const { ink, accent } = look.theme;
168
+ return `<path d="M-9 -103 L9 -103 L9 -98 Q0 -95 -9 -98 Z" fill="${ink}"/><path d="M-18 -103 L0 -110 L18 -103 L0 -96 Z" fill="${ink}"/><path d="M-18 -103 L0 -96 L18 -103 L0 -98.5 Z" fill="${ColorUtil.sh(ink, 0.15)}"/><path d="M0 -103 L13 -102 L14 -93" stroke="${accent}" stroke-width="1.3" fill="none"/><circle cx="14" cy="-92" r="1.8" fill="${accent}"/>`;
169
+ }
170
+ static cap(look, params, side) {
171
+ const color = PersonOutfitUtil.themeColorOnly(look.theme, params.hat_color, look.theme.primary);
172
+ const isFacingRight = side >= 0;
173
+ return `<path d="M-11 -97 Q-11 -108 0 -108 Q11 -108 11 -97 Z" fill="${color}"/><path d="M${isFacingRight ? 4 : -18} -98 L${isFacingRight ? 18 : -4} -98 L${isFacingRight ? 16 : -6} -95 L${isFacingRight ? 4 : -4} -95 Z" fill="${ColorUtil.sh(color, -0.2)}"/>`;
174
+ }
175
+ }
176
+ export {
177
+ PersonOutfitUtil
178
+ };
@@ -0,0 +1,39 @@
1
+ import type { AssetDrawing } from "../Protocols/AssetProtocol.js";
2
+ import { type BodyScale, type PersonParams } from "../Protocols/PersonProtocol.js";
3
+ import type { Theme } from "../Protocols/ThemeProtocol.js";
4
+ export declare class PersonUtil {
5
+ static readonly EXPRESSION_NAMES: ("angry" | "happy" | "laughing" | "neutral" | "sad" | "surprised" | "thinking" | "wink" | "worried")[];
6
+ private static readonly POSE_NAME_TO_FRONT_POSE;
7
+ private static readonly STANDING_POSE;
8
+ private static readonly POSE_NAME_TO_SIDE_HANDS;
9
+ private static readonly TYPING_HANDS;
10
+ static readonly POSE_NAMES: {
11
+ standing: ("celebrating" | "hands_on_hips" | "holding" | "phone" | "pointing" | "presenting" | "shrugging" | "standing" | "thinking" | "walking" | "waving")[];
12
+ seated: ("drinking" | "reading" | "sitting" | "typing")[];
13
+ };
14
+ private static readonly AGE_TO_SCALE;
15
+ private static readonly ADULT_SCALE;
16
+ private static readonly BUILD_TO_WIDTH;
17
+ private static readonly MIN_HEIGHT;
18
+ private static readonly MAX_HEIGHT;
19
+ private static readonly LOOK_TO_GAZE;
20
+ private static readonly POSE_TO_GAZE;
21
+ private static readonly FACING_TO_SIDE;
22
+ private static readonly POSE_TO_SEATED_PROP;
23
+ private static readonly SEATED_HEAD_TILT;
24
+ private static readonly STANDING_HEAD_TILT;
25
+ private static readonly FRONT_HEAD_TILT;
26
+ private static readonly CANE_REST_HEIGHT;
27
+ static bodyScale(params?: PersonParams): BodyScale;
28
+ private static gazeOf;
29
+ static person(params: PersonParams, theme: Theme): AssetDrawing;
30
+ private static bodyGroup;
31
+ private static headGroup;
32
+ private static seated;
33
+ private static seatedProp;
34
+ private static book;
35
+ private static cup;
36
+ private static standing;
37
+ private static cane;
38
+ private static phone;
39
+ }
@@ -0,0 +1,206 @@
1
+ import { ColorUtil } from "./ColorUtil.js";
2
+ import {
3
+ EXPRESSION_NAMES,
4
+ SEATED_POSE_NAMES,
5
+ STANDING_POSE_NAMES
6
+ } from "../Protocols/PersonProtocol.js";
7
+ import { FallbackUtil } from "./FallbackUtil.js";
8
+ import { IdUtil } from "./IdUtil.js";
9
+ import { PersonArmUtil } from "./PersonArmUtil.js";
10
+ import { PersonHeadUtil } from "./PersonHeadUtil.js";
11
+ import { PersonOutfitUtil } from "./PersonOutfitUtil.js";
12
+ class PersonUtil {
13
+ static EXPRESSION_NAMES = [...EXPRESSION_NAMES];
14
+ // Why: units are such that a standing person is 100 tall with the origin at the feet; poses only say where the hands go.
15
+ static POSE_NAME_TO_FRONT_POSE = {
16
+ standing: { left: [-15, -46], right: [15, -46] },
17
+ waving: { left: [-15, -46], right: [27, -105], isRightOpen: true },
18
+ pointing: { left: [-15, -46], right: [46, -77] },
19
+ presenting: { left: [-15, -46], right: [36, -66], isRightOpen: true, bendRight: "down" },
20
+ celebrating: { left: [-24, -108], right: [24, -108], isLeftOpen: true, isRightOpen: true },
21
+ holding: { left: [-15, -46], right: [21, -57] },
22
+ hands_on_hips: { left: [-12, -50], right: [12, -50] },
23
+ thinking: { left: [-7, -57], right: [5, -82], bendRight: "down" },
24
+ shrugging: { left: [-27, -66], right: [27, -66], isLeftOpen: true, isRightOpen: true },
25
+ walking: { left: [-8, -49], right: [19, -51] },
26
+ phone: { left: [-15, -46], right: [10, -88] }
27
+ };
28
+ static STANDING_POSE = { left: [-15, -46], right: [15, -46] };
29
+ static POSE_NAME_TO_SIDE_HANDS = {
30
+ sitting: [20, -50],
31
+ typing: [35, -55],
32
+ reading: [22, -66],
33
+ drinking: [10, -82]
34
+ };
35
+ static TYPING_HANDS = [35, -55];
36
+ static POSE_NAMES = { standing: [...STANDING_POSE_NAMES], seated: [...SEATED_POSE_NAMES] };
37
+ static AGE_TO_SCALE = {
38
+ child: { bx: 0.8, by: 0.58, hs: 0.93 },
39
+ teen: { bx: 0.9, by: 0.86, hs: 0.97 },
40
+ adult: { bx: 1, by: 1, hs: 1 },
41
+ elder: { bx: 1, by: 0.95, hs: 1 }
42
+ };
43
+ static ADULT_SCALE = { bx: 1, by: 1, hs: 1 };
44
+ static BUILD_TO_WIDTH = {
45
+ slim: 0.88,
46
+ average: 1,
47
+ broad: 1.12,
48
+ heavy: 1.16
49
+ };
50
+ static MIN_HEIGHT = 0.8;
51
+ static MAX_HEIGHT = 1.2;
52
+ static LOOK_TO_GAZE = {
53
+ "left": [-1, 0],
54
+ "right": [1, 0],
55
+ "up": [0, -1],
56
+ "down": [0, 1],
57
+ "up-left": [-0.8, -0.7],
58
+ "up-right": [0.8, -0.7],
59
+ "down-left": [-0.8, 0.7],
60
+ "down-right": [0.8, 0.7],
61
+ "camera": [0, 0],
62
+ "forward": [0, 0]
63
+ };
64
+ static POSE_TO_GAZE = {
65
+ pointing: [1, -0.3],
66
+ presenting: [0.8, 0],
67
+ thinking: [-0.5, -0.8],
68
+ celebrating: [0, -0.5],
69
+ phone: [0.5, 0.4],
70
+ holding: [0.5, 0.3],
71
+ reading: [0.5, 0.9],
72
+ typing: [1, 0.15],
73
+ drinking: [0.6, 0],
74
+ sitting: [0.6, 0]
75
+ };
76
+ static FACING_TO_SIDE = { left: -1, right: 1 };
77
+ static POSE_TO_SEATED_PROP = {
78
+ reading: (hand, facing, theme) => PersonUtil.book(hand, facing, theme),
79
+ drinking: (hand, facing, theme) => PersonUtil.cup(hand, facing, theme)
80
+ };
81
+ static SEATED_HEAD_TILT = 7;
82
+ static STANDING_HEAD_TILT = 6;
83
+ static FRONT_HEAD_TILT = 4;
84
+ static CANE_REST_HEIGHT = 6;
85
+ static bodyScale(params = {}) {
86
+ const age = IdUtil.lookup(PersonUtil.AGE_TO_SCALE, params.age) ?? PersonUtil.ADULT_SCALE;
87
+ const requested = Number(params.height) || 1;
88
+ const heightFactor = Math.max(PersonUtil.MIN_HEIGHT, Math.min(PersonUtil.MAX_HEIGHT, requested));
89
+ const width = IdUtil.lookup(PersonUtil.BUILD_TO_WIDTH, params.build) ?? 1;
90
+ return { bx: age.bx * width, by: age.by * heightFactor, hs: age.hs };
91
+ }
92
+ static gazeOf(params, pose, facing = 1) {
93
+ if (Array.isArray(params.gaze)) {
94
+ return [params.gaze[0] ?? 0, params.gaze[1] ?? 0];
95
+ }
96
+ const named = IdUtil.lookup(PersonUtil.LOOK_TO_GAZE, params.look);
97
+ if (named) {
98
+ return named;
99
+ }
100
+ const byPose = IdUtil.lookup(PersonUtil.POSE_TO_GAZE, pose);
101
+ return byPose ? [byPose[0] * facing, byPose[1]] : [0, 0];
102
+ }
103
+ static person(params, theme) {
104
+ const look = PersonOutfitUtil.lookOf(params, theme);
105
+ const scale = PersonUtil.bodyScale(params);
106
+ const pose = FallbackUtil.nonEmpty(params.pose, "standing");
107
+ const round = (value) => PersonArmUtil.round(value);
108
+ const shadow = `<ellipse cx="0" cy="0" rx="${round(20 * scale.bx)}" ry="3.2" fill="${theme.shadow}"/>`;
109
+ const isSeated = IdUtil.isOneOf(SEATED_POSE_NAMES, pose) || pose === "sitting_typing";
110
+ const drawn = isSeated ? PersonUtil.seated(params, look, scale, pose) : PersonUtil.standing(params, look, scale, pose);
111
+ return {
112
+ svg: shadow + drawn.svg,
113
+ hand: [drawn.hand[0] * scale.bx, drawn.hand[1] * scale.by],
114
+ box: { w: 40 * scale.bx, h: 81 * scale.by + 27 * scale.hs }
115
+ };
116
+ }
117
+ static bodyGroup(scale, content) {
118
+ const round = (value) => PersonArmUtil.round(value);
119
+ return `<g transform="scale(${round(scale.bx)} ${round(scale.by)})">${content}</g>`;
120
+ }
121
+ static headGroup(scale, content, tilt = 0) {
122
+ const round = (value) => PersonArmUtil.round(value);
123
+ const shift = round(-81 * scale.by + 81 * scale.hs);
124
+ return `<g transform="translate(0 ${shift}) scale(${round(scale.hs)}) rotate(${round(tilt)} 0 -82)">${content}</g>`;
125
+ }
126
+ static seated(params, look, scale, pose) {
127
+ const { theme, skin, sleeve, isShortSleeve } = look;
128
+ const facing = IdUtil.lookup(PersonUtil.FACING_TO_SIDE, params.facing) ?? 1;
129
+ const target = IdUtil.lookup(PersonUtil.POSE_NAME_TO_SIDE_HANDS, pose) ?? PersonUtil.TYPING_HANDS;
130
+ const shoulder = [facing * 2, -75];
131
+ const backArm = PersonArmUtil.ik(shoulder, [target[0] * facing - facing * 4, target[1] + 2], facing, "down");
132
+ const frontArm = PersonArmUtil.ik(shoulder, [target[0] * facing, target[1]], facing, "down");
133
+ const backSkin = ColorUtil.sh(skin, -0.15);
134
+ const backColors = { sleeve: ColorUtil.sh(sleeve, -0.18), skin: backSkin };
135
+ const armsBack = PersonArmUtil.armPath(shoulder, backArm, backColors, isShortSleeve) + PersonArmUtil.hand(backArm.hand, backSkin, false, backArm.elbow);
136
+ const armsFront = PersonArmUtil.armPath(shoulder, frontArm, { sleeve, skin }, isShortSleeve) + PersonArmUtil.hand(frontArm.hand, skin, false, frontArm.elbow);
137
+ const gaze = PersonUtil.gazeOf(params, pose, facing);
138
+ const head = PersonHeadUtil.head(params, theme, { side: facing, isBack: false, gaze });
139
+ const legs = PersonOutfitUtil.seatedLegs(look, facing);
140
+ const torso = PersonOutfitUtil.seatedTorso(look, facing);
141
+ const prop = PersonUtil.seatedProp(pose, frontArm.hand, facing, theme);
142
+ const svg = PersonUtil.bodyGroup(scale, armsBack + legs + torso) + PersonUtil.headGroup(scale, head, facing * gaze[1] * PersonUtil.SEATED_HEAD_TILT) + PersonUtil.bodyGroup(scale, armsFront + prop);
143
+ return { svg, hand: frontArm.hand };
144
+ }
145
+ static seatedProp(pose, hand, facing, theme) {
146
+ return IdUtil.lookup(PersonUtil.POSE_TO_SEATED_PROP, pose)?.(hand, facing, theme) ?? "";
147
+ }
148
+ static book(hand, facing, theme) {
149
+ const round = (value) => PersonArmUtil.round(value);
150
+ const [handX, handY] = hand;
151
+ return `<path d="M${round(handX - facing * 2)} ${round(handY - 9)} L${round(handX + facing * 8)} ${round(handY - 6)} L${round(handX + facing * 8)} ${round(handY + 4)} L${round(handX - facing * 2)} ${round(handY + 1)} Z" fill="${theme.accent}"/>`;
152
+ }
153
+ static cup(hand, facing, theme) {
154
+ const round = (value) => PersonArmUtil.round(value);
155
+ const [handX, handY] = hand;
156
+ return `<path d="M${round(handX + facing * 1)} ${round(handY - 7)} L${round(handX + facing * 9)} ${round(handY - 7)} L${round(handX + facing * 8)} ${round(handY + 3)} L${round(handX + facing * 2)} ${round(handY + 3)} Z" fill="${theme.paper}"/>`;
157
+ }
158
+ static standing(params, look, scale, pose) {
159
+ const { theme, skin, sleeve, isShortSleeve } = look;
160
+ const isBack = params.view === "back";
161
+ const targets = IdUtil.lookup(PersonUtil.POSE_NAME_TO_FRONT_POSE, pose) ?? PersonUtil.STANDING_POSE;
162
+ const side = IdUtil.lookup(PersonUtil.FACING_TO_SIDE, params.facing) ?? 0;
163
+ const legs = PersonOutfitUtil.standingLegs(look, pose === "walking");
164
+ const backpack = PersonOutfitUtil.backpack(look, params, isBack);
165
+ const torso = PersonOutfitUtil.standingTorso(look, params, isBack) + backpack.onTorso;
166
+ const hat = PersonOutfitUtil.hat(look, params, side);
167
+ const leftShoulder = [-12, -76];
168
+ const rightShoulder = [12, -76];
169
+ const left = PersonArmUtil.ik(leftShoulder, targets.left, -1, targets.bendLeft);
170
+ const right = PersonArmUtil.ik(rightShoulder, targets.right, 1, targets.bendRight);
171
+ const colors = { sleeve, skin };
172
+ const isLeftOpen = Boolean(targets.isLeftOpen);
173
+ const isRightOpen = Boolean(targets.isRightOpen);
174
+ const arms = PersonArmUtil.armPath(leftShoulder, left, colors, isShortSleeve) + PersonArmUtil.hand(left.hand, skin, isLeftOpen, left.elbow) + PersonArmUtil.armPath(rightShoulder, right, colors, isShortSleeve) + PersonArmUtil.hand(right.hand, skin, isRightOpen, right.elbow);
175
+ if (isBack) {
176
+ const head2 = PersonHeadUtil.head(params, theme, { side: 0, isBack: true, gaze: [0, 0] });
177
+ const backSvg = PersonUtil.bodyGroup(scale, legs + torso + arms) + PersonUtil.headGroup(scale, head2 + hat);
178
+ return { svg: backSvg, hand: right.hand };
179
+ }
180
+ const gaze = PersonUtil.gazeOf(params, pose, side || 1);
181
+ const tilt = side ? side * gaze[1] * PersonUtil.STANDING_HEAD_TILT : gaze[0] * PersonUtil.FRONT_HEAD_TILT;
182
+ const head = PersonHeadUtil.head(params, theme, { side, isBack: false, gaze });
183
+ const cane = PersonUtil.cane(params, targets, left.hand, theme);
184
+ const phone = PersonUtil.phone(pose, right.hand, theme);
185
+ const svg = PersonUtil.bodyGroup(scale, legs + backpack.behind + torso) + PersonUtil.headGroup(scale, head + hat, tilt) + PersonUtil.bodyGroup(scale, cane + arms + phone);
186
+ return { svg, hand: right.hand };
187
+ }
188
+ static cane(params, targets, hand, theme) {
189
+ if (!params.cane || Math.abs(targets.left[1] + 46) >= PersonUtil.CANE_REST_HEIGHT) {
190
+ return "";
191
+ }
192
+ const round = (value) => PersonArmUtil.round(value);
193
+ const wood = theme.trunk || "#6B4A33";
194
+ return `<path d="M${round(hand[0] - 1)} ${round(hand[1] + 2)} L${round(hand[0] - 4)} -1" stroke="${wood}" stroke-width="2.4" stroke-linecap="round"/><path d="M${round(hand[0] - 1)} ${round(hand[1] + 2)} Q${round(hand[0] + 1)} ${round(hand[1] - 4)} ${round(hand[0] + 5)} ${round(hand[1] - 1)}" stroke="${wood}" stroke-width="2.4" fill="none" stroke-linecap="round"/>`;
195
+ }
196
+ static phone(pose, hand, theme) {
197
+ if (pose !== "phone") {
198
+ return "";
199
+ }
200
+ const round = (value) => PersonArmUtil.round(value);
201
+ return `<rect x="${round(hand[0] - 1.5)}" y="${round(hand[1] - 8)}" width="4.6" height="8.5" rx="1.2" fill="${theme.ink}"/><rect x="${round(hand[0] - 0.8)}" y="${round(hand[1] - 7.2)}" width="3.2" height="6.4" rx="0.6" fill="${theme.glass || "#BFD7EA"}"/>`;
202
+ }
203
+ }
204
+ export {
205
+ PersonUtil
206
+ };
@@ -0,0 +1,3 @@
1
+ export declare class PixelUtil {
2
+ static read(values: ArrayLike<number>, index: number): number;
3
+ }
@@ -0,0 +1,8 @@
1
+ class PixelUtil {
2
+ static read(values, index) {
3
+ return values[index] ?? 0;
4
+ }
5
+ }
6
+ export {
7
+ PixelUtil
8
+ };