@guilhermebkel/scenec 0.1.2 → 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,178 @@
1
+ import { ColorUtil } from "../Utils/ColorUtil.js";
2
+ import { IdUtil } from "../Utils/IdUtil.js";
3
+ const HORIZONTAL_NAMES = ["left", "center", "right"];
4
+ class TextService {
5
+ static FONT = "Poppins";
6
+ static TITLE_SIZE = 0.075;
7
+ static SUBTITLE_SIZE = 0.036;
8
+ static LABEL_SIZE = 0.028;
9
+ static BODY_SIZE = 0.032;
10
+ static ROLE_TO_SIZE = {
11
+ title: TextService.TITLE_SIZE,
12
+ subtitle: TextService.SUBTITLE_SIZE,
13
+ label: TextService.LABEL_SIZE,
14
+ body: TextService.BODY_SIZE
15
+ };
16
+ static BOLD_WEIGHT = 700;
17
+ static REGULAR_WEIGHT = 400;
18
+ static ROLE_TO_WEIGHT = {
19
+ title: TextService.BOLD_WEIGHT,
20
+ body: TextService.REGULAR_WEIGHT
21
+ };
22
+ static ROLE_TO_IS_BOLD = { title: true };
23
+ static HORIZONTAL_TO_ALIGNMENT = {
24
+ left: { anchor: "start", startX: (_width, margin) => margin, leftOf: (anchorX) => anchorX },
25
+ center: {
26
+ anchor: "middle",
27
+ startX: (width) => width / 2,
28
+ leftOf: (anchorX, textWidth) => anchorX - textWidth / 2
29
+ },
30
+ right: {
31
+ anchor: "end",
32
+ startX: (width, margin) => width - margin,
33
+ leftOf: (anchorX, textWidth) => anchorX - textWidth
34
+ }
35
+ };
36
+ static DEFAULT_SIZE = 0.04;
37
+ static DEFAULT_WEIGHT = 500;
38
+ static MARGIN = 0.06;
39
+ static BOTTOM_MARGIN = 0.7;
40
+ static BASELINE_ASCENT = 0.9;
41
+ static SUBTITLE_GAP = 0.8;
42
+ static LINE_HEIGHT = 1.2;
43
+ static BOLD_CHAR_WIDTH = 0.6;
44
+ static REGULAR_CHAR_WIDTH = 0.565;
45
+ static MIN_CONTRAST = 4.5;
46
+ static SELF_COVER = 0.06;
47
+ static OBJECT_COVER = 0.12;
48
+ static DESCENT = 0.25;
49
+ static RECT_DESCENT = 0.75;
50
+ static DEFAULT_PAD = 0.45;
51
+ static DEFAULT_RADIUS = 0.35;
52
+ static BOX_ASCENT = 1.05;
53
+ static BOX_TOP_PAD = 0.3;
54
+ static BOX_BOTTOM_EXTRA = 0.45;
55
+ static BOX_BOTTOM_PAD = 0.6;
56
+ static render(texts, context, list, backdrop) {
57
+ const rects = [];
58
+ let svg = "";
59
+ for (const text of texts) {
60
+ const layout = TextService.layoutOf(text, texts, context);
61
+ const { left, y, fontSize, estimatedWidth, blockHeight } = layout;
62
+ rects.push({
63
+ x0: left,
64
+ y0: y - fontSize,
65
+ x1: left + estimatedWidth,
66
+ y1: y + blockHeight - fontSize * TextService.RECT_DESCENT,
67
+ hasBox: Boolean(text.box)
68
+ });
69
+ svg += TextService.boxOf(text, layout, context, backdrop) + TextService.element(layout);
70
+ TextService.warnCovered(layout, list, context);
71
+ }
72
+ return { svg, rects };
73
+ }
74
+ static themeColor(context, name) {
75
+ const value = context.theme[name];
76
+ return typeof value === "string" ? value : name;
77
+ }
78
+ static isRole(text, role) {
79
+ return (text.role ?? "title") === role;
80
+ }
81
+ static layoutOf(text, texts, context) {
82
+ const { width, height, theme } = context;
83
+ const role = text.role ?? "title";
84
+ const roleSize = IdUtil.lookup(TextService.ROLE_TO_SIZE, role) ?? TextService.DEFAULT_SIZE;
85
+ const fontSize = text.size ? text.size * height : roleSize * height;
86
+ const [vertical = "top", horizontalText] = (text.at ?? "top-left").split("-");
87
+ const horizontal = IdUtil.isOneOf(HORIZONTAL_NAMES, horizontalText) ? horizontalText : "left";
88
+ const alignment = TextService.HORIZONTAL_TO_ALIGNMENT[horizontal];
89
+ const margin = width * TextService.MARGIN;
90
+ const defaultX = alignment.startX(width, margin);
91
+ const anchorX = text.x != null ? text.x * width : defaultX;
92
+ const lines = String(text.content).split("\n");
93
+ const lineHeight = fontSize * TextService.LINE_HEIGHT;
94
+ const weight = text.weight ?? IdUtil.lookup(TextService.ROLE_TO_WEIGHT, role) ?? TextService.DEFAULT_WEIGHT;
95
+ const isBold = weight >= TextService.BOLD_WEIGHT || IdUtil.lookup(TextService.ROLE_TO_IS_BOLD, role) === true;
96
+ const charWidth = isBold ? TextService.BOLD_CHAR_WIDTH : TextService.REGULAR_CHAR_WIDTH;
97
+ const estimatedWidth = Math.max(...lines.map((line) => line.length)) * fontSize * charWidth;
98
+ const metrics = { isBottom: vertical === "bottom", margin, fontSize, lineHeight, lineCount: lines.length };
99
+ return {
100
+ role,
101
+ fontSize,
102
+ anchor: alignment.anchor,
103
+ x: anchorX,
104
+ lines,
105
+ lineHeight,
106
+ weight,
107
+ estimatedWidth,
108
+ left: alignment.leftOf(anchorX, estimatedWidth),
109
+ y: TextService.baseline(text, texts, metrics, context),
110
+ color: text.color ? TextService.themeColor(context, text.color) : theme.text,
111
+ blockHeight: fontSize + (lines.length - 1) * lineHeight
112
+ };
113
+ }
114
+ static baseline(text, texts, metrics, context) {
115
+ const { isBottom, margin, fontSize, lineHeight, lineCount } = metrics;
116
+ if (text.y != null) {
117
+ return text.y * context.height;
118
+ }
119
+ const bottomBase = context.height - margin * TextService.BOTTOM_MARGIN - (lineCount - 1) * lineHeight;
120
+ const base = isBottom ? bottomBase : margin + fontSize * TextService.BASELINE_ASCENT;
121
+ const hasTitleAbove = TextService.isRole(text, "subtitle") && texts.some((other) => TextService.isRole(other, "title") && other.at === text.at && other.y == null);
122
+ const shift = context.height * TextService.TITLE_SIZE * TextService.BASELINE_ASCENT + fontSize * TextService.SUBTITLE_GAP;
123
+ return hasTitleAbove ? base + shift : base;
124
+ }
125
+ static boxOf(text, layout, context, backdrop) {
126
+ const { fontSize, left, estimatedWidth, blockHeight, y, color, lines } = layout;
127
+ const fill = text.box ? TextService.themeColor(context, text.box) : backdrop;
128
+ const ratio = ColorUtil.contrast(color, fill);
129
+ if (ratio < TextService.MIN_CONTRAST) {
130
+ context.warnings.push(
131
+ `text "${lines[0]}" has contrast ${ratio.toFixed(1)}:1 (min. 4.5); change 'color' or use 'box'`
132
+ );
133
+ }
134
+ if (!text.box) {
135
+ return "";
136
+ }
137
+ const padding = (text.pad ?? TextService.DEFAULT_PAD) * fontSize;
138
+ const boxY = y - fontSize * TextService.BOX_ASCENT - padding * TextService.BOX_TOP_PAD;
139
+ const boxHeight = blockHeight + fontSize * TextService.BOX_BOTTOM_EXTRA + padding * TextService.BOX_BOTTOM_PAD;
140
+ const radius = (text.radius ?? TextService.DEFAULT_RADIUS) * fontSize;
141
+ return `<rect x="${(left - padding).toFixed(1)}" y="${boxY.toFixed(1)}" width="${(estimatedWidth + padding * 2).toFixed(1)}" height="${boxHeight.toFixed(1)}" rx="${radius}" fill="${fill}"/>`;
142
+ }
143
+ static warnCovered(layout, list, context) {
144
+ const { left, estimatedWidth, y, blockHeight, fontSize, lines } = layout;
145
+ for (const placement of list) {
146
+ if (placement.isBackdrop) {
147
+ continue;
148
+ }
149
+ const overlapX = Math.max(
150
+ 0,
151
+ Math.min(placement.boxRight, left + estimatedWidth) - Math.max(placement.boxLeft, left)
152
+ );
153
+ const textBottom = y + blockHeight - fontSize + fontSize * TextService.DESCENT;
154
+ const overlapY = Math.max(
155
+ 0,
156
+ Math.min(placement.boxBottom, textBottom) - Math.max(placement.boxTop, y - fontSize)
157
+ );
158
+ const covered = overlapX * overlapY;
159
+ const selfLimit = TextService.SELF_COVER * estimatedWidth * blockHeight;
160
+ const objectLimit = TextService.OBJECT_COVER * placement.width * placement.height;
161
+ if (covered > selfLimit || covered > objectLimit) {
162
+ context.warnings.push(`text "${lines[0]}" covers '${placement.id}'`);
163
+ }
164
+ }
165
+ }
166
+ static element(layout) {
167
+ const { x, y, fontSize, weight, color, anchor, lines, lineHeight } = layout;
168
+ const escape = (value) => value.replace(/&/g, "&amp;").replace(/</g, "&lt;");
169
+ const spans = lines.map((line, index) => {
170
+ const dy = index === 0 ? "" : ` dy="${lineHeight.toFixed(1)}"`;
171
+ return `<tspan x="${x.toFixed(1)}"${dy}>${escape(line)}</tspan>`;
172
+ });
173
+ return `<text x="${x.toFixed(1)}" y="${y.toFixed(1)}" font-family="${TextService.FONT}" font-size="${fontSize.toFixed(1)}" font-weight="${weight}" fill="${color}" text-anchor="${anchor}">${spans.join("")}</text>`;
174
+ }
175
+ }
176
+ export {
177
+ TextService
178
+ };
@@ -0,0 +1,5 @@
1
+ import type { Theme, ThemeId } from "../Protocols/ThemeProtocol.js";
2
+ export declare class ThemeService {
3
+ static readonly THEME_ID_TO_THEME: Record<ThemeId, Theme>;
4
+ static resolve(id: ThemeId): Theme;
5
+ }
@@ -0,0 +1,18 @@
1
+ import { FlatAutumnTheme } from "../Resources/Themes/FlatAutumnTheme.js";
2
+ import { FlatCoolTheme } from "../Resources/Themes/FlatCoolTheme.js";
3
+ import { NightTheme } from "../Resources/Themes/NightTheme.js";
4
+ import { WarmCafeTheme } from "../Resources/Themes/WarmCafeTheme.js";
5
+ import { BeachTheme } from "../Resources/Themes/BeachTheme.js";
6
+ import { RegistryUtil } from "../Utils/RegistryUtil.js";
7
+ class ThemeService {
8
+ static THEME_ID_TO_THEME = RegistryUtil.indexValues(
9
+ [new FlatAutumnTheme(), new FlatCoolTheme(), new NightTheme(), new WarmCafeTheme(), new BeachTheme()],
10
+ (theme) => theme.palette
11
+ );
12
+ static resolve(id) {
13
+ return ThemeService.THEME_ID_TO_THEME[id];
14
+ }
15
+ }
16
+ export {
17
+ ThemeService
18
+ };
@@ -0,0 +1,4 @@
1
+ import type { ScreenBox } from "../Protocols/PlaneProtocol.js";
2
+ export declare class BoxUtil {
3
+ static overlapArea(first: ScreenBox, second: ScreenBox): number;
4
+ }
@@ -0,0 +1,8 @@
1
+ class BoxUtil {
2
+ static overlapArea(first, second) {
3
+ return Math.max(0, Math.min(first.x1, second.x1) - Math.max(first.x0, second.x0)) * Math.max(0, Math.min(first.y1, second.y1) - Math.max(first.y0, second.y0));
4
+ }
5
+ }
6
+ export {
7
+ BoxUtil
8
+ };
@@ -0,0 +1,20 @@
1
+ export declare class ColorUtil {
2
+ private static readonly HEX_RADIX;
3
+ private static readonly CHANNEL_MAX;
4
+ private static readonly CHANNEL_STARTS;
5
+ private static readonly SRGB_KNEE;
6
+ private static readonly SRGB_LINEAR_SLOPE;
7
+ private static readonly SRGB_OFFSET;
8
+ private static readonly SRGB_GAMMA_DIVISOR;
9
+ private static readonly SRGB_GAMMA;
10
+ private static readonly RED_WEIGHT;
11
+ private static readonly GREEN_WEIGHT;
12
+ private static readonly BLUE_WEIGHT;
13
+ private static readonly CONTRAST_FLARE;
14
+ static sh(hex: string, amount: number): string;
15
+ private static expand;
16
+ private static channelsOf;
17
+ private static linearize;
18
+ static luminance(hex: string): number;
19
+ static contrast(first: string, second: string): number;
20
+ }
@@ -0,0 +1,51 @@
1
+ class ColorUtil {
2
+ static HEX_RADIX = 16;
3
+ static CHANNEL_MAX = 255;
4
+ static CHANNEL_STARTS = [0, 2, 4];
5
+ static SRGB_KNEE = 0.03928;
6
+ static SRGB_LINEAR_SLOPE = 12.92;
7
+ static SRGB_OFFSET = 0.055;
8
+ static SRGB_GAMMA_DIVISOR = 1.055;
9
+ static SRGB_GAMMA = 2.4;
10
+ static RED_WEIGHT = 0.2126;
11
+ static GREEN_WEIGHT = 0.7152;
12
+ static BLUE_WEIGHT = 0.0722;
13
+ static CONTRAST_FLARE = 0.05;
14
+ static sh(hex, amount) {
15
+ if (!hex.startsWith("#")) {
16
+ return hex;
17
+ }
18
+ const channels = ColorUtil.channelsOf(hex.slice(1));
19
+ const target = amount < 0 ? 0 : ColorUtil.CHANNEL_MAX;
20
+ const strength = Math.abs(amount);
21
+ const mixed = channels.map((value) => Math.round(value + (target - value) * strength));
22
+ return `#${mixed.map((value) => value.toString(ColorUtil.HEX_RADIX).padStart(2, "0")).join("")}`;
23
+ }
24
+ static expand(digits) {
25
+ return digits.length === 3 ? Array.from(digits, (char) => char + char).join("") : digits;
26
+ }
27
+ static channelsOf(digits) {
28
+ const full = ColorUtil.expand(digits);
29
+ return ColorUtil.CHANNEL_STARTS.map((start) => parseInt(full.slice(start, start + 2), ColorUtil.HEX_RADIX));
30
+ }
31
+ static linearize(channel) {
32
+ return channel <= ColorUtil.SRGB_KNEE ? channel / ColorUtil.SRGB_LINEAR_SLOPE : ((channel + ColorUtil.SRGB_OFFSET) / ColorUtil.SRGB_GAMMA_DIVISOR) ** ColorUtil.SRGB_GAMMA;
33
+ }
34
+ static luminance(hex) {
35
+ const digits = ColorUtil.expand(hex.replace("#", ""));
36
+ if (!/^[0-9a-f]{6}$/i.test(digits)) {
37
+ return 1;
38
+ }
39
+ const linear = ColorUtil.channelsOf(digits).map((value) => ColorUtil.linearize(value / ColorUtil.CHANNEL_MAX));
40
+ const [red = 0, green = 0, blue = 0] = linear;
41
+ return ColorUtil.RED_WEIGHT * red + ColorUtil.GREEN_WEIGHT * green + ColorUtil.BLUE_WEIGHT * blue;
42
+ }
43
+ static contrast(first, second) {
44
+ const luminances = [ColorUtil.luminance(first), ColorUtil.luminance(second)];
45
+ const [lighter = 0, darker = 0] = luminances.sort((left, right) => right - left);
46
+ return (lighter + ColorUtil.CONTRAST_FLARE) / (darker + ColorUtil.CONTRAST_FLARE);
47
+ }
48
+ }
49
+ export {
50
+ ColorUtil
51
+ };
@@ -0,0 +1,6 @@
1
+ export type CurvePoint = readonly [number, number];
2
+ export declare class CurveUtil {
3
+ private static readonly DEFAULT_SAMPLES;
4
+ static catmullRom(points: readonly CurvePoint[], samplesPerSegment?: number): CurvePoint[];
5
+ private static spline;
6
+ }
@@ -0,0 +1,35 @@
1
+ class CurveUtil {
2
+ static DEFAULT_SAMPLES = 48;
3
+ static catmullRom(points, samplesPerSegment = CurveUtil.DEFAULT_SAMPLES) {
4
+ const first = points[0];
5
+ const last = points.at(-1);
6
+ if (points.length < 2 || first === void 0 || last === void 0) {
7
+ return points.slice();
8
+ }
9
+ const padded = [first, ...points, last];
10
+ const curve = [];
11
+ for (let index = 1; index < padded.length - 2; index++) {
12
+ const [before, from, to, after] = [padded[index - 1], padded[index], padded[index + 1], padded[index + 2]];
13
+ if (before === void 0 || from === void 0 || to === void 0 || after === void 0) {
14
+ continue;
15
+ }
16
+ for (let step = 0; step < samplesPerSegment; step++) {
17
+ const progress = step / samplesPerSegment;
18
+ curve.push([
19
+ CurveUtil.spline(before[0], from[0], to[0], after[0], progress),
20
+ CurveUtil.spline(before[1], from[1], to[1], after[1], progress)
21
+ ]);
22
+ }
23
+ }
24
+ curve.push(last);
25
+ return curve;
26
+ }
27
+ static spline(before, from, to, after, progress) {
28
+ const squared = progress * progress;
29
+ const cubed = squared * progress;
30
+ return 0.5 * (2 * from + (-before + to) * progress + (2 * before - 5 * from + 4 * to - after) * squared + (-before + 3 * from - 3 * to + after) * cubed);
31
+ }
32
+ }
33
+ export {
34
+ CurveUtil
35
+ };
@@ -0,0 +1,3 @@
1
+ export declare class FallbackUtil {
2
+ static nonEmpty(value: string | undefined, fallback: string): string;
3
+ }
@@ -0,0 +1,8 @@
1
+ class FallbackUtil {
2
+ static nonEmpty(value, fallback) {
3
+ return value === void 0 || value === "" ? fallback : value;
4
+ }
5
+ }
6
+ export {
7
+ FallbackUtil
8
+ };
@@ -0,0 +1,4 @@
1
+ export declare class FormatUtil {
2
+ static readonly oneDecimal: (value: number) => string;
3
+ static percent(fraction: number): string;
4
+ }
@@ -0,0 +1,9 @@
1
+ class FormatUtil {
2
+ static oneDecimal = (value) => value.toFixed(1);
3
+ static percent(fraction) {
4
+ return `${Math.round(fraction * 100)}%`;
5
+ }
6
+ }
7
+ export {
8
+ FormatUtil
9
+ };
@@ -0,0 +1,4 @@
1
+ export declare class IdUtil {
2
+ static isOneOf<Id extends string>(ids: readonly Id[], value: unknown): value is Id;
3
+ static lookup<Key extends string, Value>(keyToValue: Partial<Record<Key, Value>>, key: unknown): Value | undefined;
4
+ }
@@ -0,0 +1,11 @@
1
+ class IdUtil {
2
+ static isOneOf(ids, value) {
3
+ return typeof value === "string" && ids.includes(value);
4
+ }
5
+ static lookup(keyToValue, key) {
6
+ return typeof key === "string" && Object.hasOwn(keyToValue, key) ? keyToValue[key] : void 0;
7
+ }
8
+ }
9
+ export {
10
+ IdUtil
11
+ };
@@ -0,0 +1,4 @@
1
+ export declare class NormalizeUtil {
2
+ private static readonly COMBINING_MARKS;
3
+ static key(text: string): string;
4
+ }
@@ -0,0 +1,9 @@
1
+ class NormalizeUtil {
2
+ static COMBINING_MARKS = /[̀-ͯ]/g;
3
+ static key(text) {
4
+ return text.toLowerCase().normalize("NFD").replace(NormalizeUtil.COMBINING_MARKS, "").trim();
5
+ }
6
+ }
7
+ export {
8
+ NormalizeUtil
9
+ };
@@ -0,0 +1,23 @@
1
+ export type Lab = readonly [number, number, number];
2
+ export type Rgb = readonly [number, number, number];
3
+ export declare class OklabUtil {
4
+ private static readonly CHANNEL_MAX;
5
+ private static readonly GAMMA_KNEE;
6
+ private static readonly GAMMA_LINEAR_DIVISOR;
7
+ private static readonly GAMMA_OFFSET;
8
+ private static readonly GAMMA_DIVISOR;
9
+ private static readonly GAMMA_EXPONENT;
10
+ private static readonly HEX_RADIX;
11
+ private static readonly HEX_DIGITS;
12
+ private static readonly HEX_CHANNEL_STARTS;
13
+ private static readonly RGB_TO_CONE;
14
+ private static readonly CONE_TO_LAB;
15
+ private static readonly CHANNEL_TO_LINEAR;
16
+ static fromRgb(red: number, green: number, blue: number): Lab;
17
+ static distance(first: Lab, second: Lab): number;
18
+ static toHex(red: number, green: number, blue: number): string;
19
+ static rgbOfHex(hex: string): Rgb;
20
+ private static dot;
21
+ private static linear;
22
+ private static linearOf;
23
+ }
@@ -0,0 +1,62 @@
1
+ class OklabUtil {
2
+ static CHANNEL_MAX = 255;
3
+ static GAMMA_KNEE = 0.04045;
4
+ static GAMMA_LINEAR_DIVISOR = 12.92;
5
+ static GAMMA_OFFSET = 0.055;
6
+ static GAMMA_DIVISOR = 1.055;
7
+ static GAMMA_EXPONENT = 2.4;
8
+ static HEX_RADIX = 16;
9
+ static HEX_DIGITS = 2;
10
+ static HEX_CHANNEL_STARTS = [1, 3, 5];
11
+ static RGB_TO_CONE = [
12
+ [0.4122214708, 0.5363325363, 0.0514459929],
13
+ [0.2119034982, 0.6806995451, 0.1073969566],
14
+ [0.0883024619, 0.2817188376, 0.6299787005]
15
+ ];
16
+ static CONE_TO_LAB = [
17
+ [0.2104542553, 0.793617785, -0.0040720468],
18
+ [1.9779984951, -2.428592205, 0.4505937099],
19
+ [0.0259040371, 0.7827717662, -0.808675766]
20
+ ];
21
+ static CHANNEL_TO_LINEAR = Float32Array.from(
22
+ { length: OklabUtil.CHANNEL_MAX + 1 },
23
+ (_, channel) => OklabUtil.linearOf(channel)
24
+ );
25
+ static fromRgb(red, green, blue) {
26
+ const linear = [OklabUtil.linear(red), OklabUtil.linear(green), OklabUtil.linear(blue)];
27
+ const [longCone = 0, mediumCone = 0, shortCone = 0] = OklabUtil.RGB_TO_CONE.map(
28
+ (row) => Math.cbrt(OklabUtil.dot(row, linear))
29
+ );
30
+ const cones = [longCone, mediumCone, shortCone];
31
+ const [lightness = 0, greenRed = 0, blueYellow = 0] = OklabUtil.CONE_TO_LAB.map((row) => OklabUtil.dot(row, cones));
32
+ return [lightness, greenRed, blueYellow];
33
+ }
34
+ static distance(first, second) {
35
+ return Math.hypot(first[0] - second[0], first[1] - second[1], first[2] - second[2]);
36
+ }
37
+ static toHex(red, green, blue) {
38
+ const digits = [red, green, blue].map(
39
+ (channel) => Math.round(channel).toString(OklabUtil.HEX_RADIX).padStart(OklabUtil.HEX_DIGITS, "0")
40
+ );
41
+ return `#${digits.join("").toUpperCase()}`;
42
+ }
43
+ static rgbOfHex(hex) {
44
+ const [red = 0, green = 0, blue = 0] = OklabUtil.HEX_CHANNEL_STARTS.map(
45
+ (start) => Number.parseInt(hex.slice(start, start + OklabUtil.HEX_DIGITS), OklabUtil.HEX_RADIX)
46
+ );
47
+ return [red, green, blue];
48
+ }
49
+ static dot(row, vector) {
50
+ return row[0] * vector[0] + row[1] * vector[1] + row[2] * vector[2];
51
+ }
52
+ static linear(channel) {
53
+ return OklabUtil.CHANNEL_TO_LINEAR[channel] ?? 0;
54
+ }
55
+ static linearOf(channel) {
56
+ const unit = channel / OklabUtil.CHANNEL_MAX;
57
+ return unit <= OklabUtil.GAMMA_KNEE ? unit / OklabUtil.GAMMA_LINEAR_DIVISOR : ((unit + OklabUtil.GAMMA_OFFSET) / OklabUtil.GAMMA_DIVISOR) ** OklabUtil.GAMMA_EXPONENT;
58
+ }
59
+ }
60
+ export {
61
+ OklabUtil
62
+ };
@@ -0,0 +1,19 @@
1
+ import type { Arm, BendName, Point } from "../Protocols/PersonProtocol.js";
2
+ export declare class PersonArmUtil {
3
+ private static readonly UPPER_ARM;
4
+ private static readonly FOREARM;
5
+ private static readonly REACH_MARGIN;
6
+ private static readonly MIN_REACH_MARGIN;
7
+ private static readonly FINGER_ANGLES;
8
+ private static readonly FINGER_LENGTHS;
9
+ private static readonly SHORT_SLEEVE_SPLIT;
10
+ private static readonly HALF_TURN_DEGREES;
11
+ private static readonly BODY_CENTER_Y;
12
+ static round(value: number): number;
13
+ static ik(shoulder: Point, target: Point, side: number, bend?: BendName): Arm;
14
+ static hand(position: Point, skin: string, isOpen: boolean, elbow: Point): string;
15
+ static armPath(shoulder: Point, arm: Arm, colors: {
16
+ sleeve: string;
17
+ skin: string;
18
+ }, isShortSleeve: boolean): string;
19
+ }
@@ -0,0 +1,84 @@
1
+ import { ColorUtil } from "./ColorUtil.js";
2
+ class PersonArmUtil {
3
+ static UPPER_ARM = 17;
4
+ static FOREARM = 16;
5
+ static REACH_MARGIN = 0.01;
6
+ static MIN_REACH_MARGIN = 0.5;
7
+ static FINGER_ANGLES = [-27, -9, 9, 27];
8
+ static FINGER_LENGTHS = [2.4, 3.1, 2.9, 2.1];
9
+ static SHORT_SLEEVE_SPLIT = 0.6;
10
+ static HALF_TURN_DEGREES = 180;
11
+ static BODY_CENTER_Y = -60;
12
+ static round(value) {
13
+ return Math.round(value * 100) / 100;
14
+ }
15
+ static ik(shoulder, target, side, bend = "out") {
16
+ const upperArm = PersonArmUtil.UPPER_ARM;
17
+ const forearm = PersonArmUtil.FOREARM;
18
+ let deltaX = target[0] - shoulder[0];
19
+ let deltaY = target[1] - shoulder[1];
20
+ let distance = Math.hypot(deltaX, deltaY);
21
+ const maxReach = upperArm + forearm - PersonArmUtil.REACH_MARGIN;
22
+ const minReach = Math.abs(upperArm - forearm) + PersonArmUtil.MIN_REACH_MARGIN;
23
+ if (distance > maxReach) {
24
+ deltaX *= maxReach / distance;
25
+ deltaY *= maxReach / distance;
26
+ distance = maxReach;
27
+ }
28
+ if (distance < minReach) {
29
+ distance = minReach;
30
+ }
31
+ const spread = Math.acos((upperArm ** 2 + distance ** 2 - forearm ** 2) / (2 * upperArm * distance));
32
+ const direction = Math.atan2(deltaY, deltaX);
33
+ const first = [
34
+ shoulder[0] + upperArm * Math.cos(direction + spread),
35
+ shoulder[1] + upperArm * Math.sin(direction + spread)
36
+ ];
37
+ const second = [
38
+ shoulder[0] + upperArm * Math.cos(direction - spread),
39
+ shoulder[1] + upperArm * Math.sin(direction - spread)
40
+ ];
41
+ const elbowDown = first[1] > second[1] ? first : second;
42
+ const elbowOut = side * first[0] > side * second[0] ? first : second;
43
+ const bendToElbow = { down: elbowDown, out: elbowOut };
44
+ return { elbow: bendToElbow[bend], hand: [shoulder[0] + deltaX, shoulder[1] + deltaY] };
45
+ }
46
+ static hand(position, skin, isOpen, elbow) {
47
+ const round = (value) => PersonArmUtil.round(value);
48
+ const deltaX = position[0] - elbow[0];
49
+ const deltaY = position[1] - elbow[1];
50
+ const angle = Math.atan2(deltaY, deltaX) * PersonArmUtil.HALF_TURN_DEGREES / Math.PI;
51
+ const normal = [-deltaY, deltaX];
52
+ const toBody = [-position[0], PersonArmUtil.BODY_CENTER_Y - position[1]];
53
+ const thumbSide = (normal[0] ?? 0) * (toBody[0] ?? 0) + (normal[1] ?? 0) * (toBody[1] ?? 0) >= 0 ? 1 : -1;
54
+ const shade = ColorUtil.sh(skin, -0.12);
55
+ const placement = `translate(${round(position[0])} ${round(position[1])}) rotate(${round(angle)})`;
56
+ const wrap = (inner) => `<g transform="${placement}">${inner}</g>`;
57
+ if (!isOpen) {
58
+ return wrap(`<ellipse cx="1.2" cy="${0.9 * thumbSide}" rx="1.9" ry="1.3" fill="${shade}" transform="rotate(${-30 * thumbSide} 1.2 ${0.9 * thumbSide})"/><rect x="-1.2" y="-3.1" width="6.4" height="6.2" rx="3" fill="${skin}"/><ellipse cx="2.4" cy="${2.6 * thumbSide}" rx="2.2" ry="1.25" fill="${skin}" transform="rotate(${-20 * thumbSide} 2.4 ${2.6 * thumbSide})"/><path d="M4.2 -1.6 L4.2 1.6" stroke="${shade}" stroke-width="0.6" stroke-linecap="round"/>`);
59
+ }
60
+ const fingers = PersonArmUtil.FINGER_ANGLES.map((fingerAngle, index) => {
61
+ const length = PersonArmUtil.FINGER_LENGTHS[index] ?? 0;
62
+ const radians = fingerAngle * Math.PI / PersonArmUtil.HALF_TURN_DEGREES;
63
+ return `<path d="M3 ${round(Math.sin(radians) * 1.9)} L${round(3 + Math.cos(radians) * length)} ${round(Math.sin(radians) * (1.9 + length))}" stroke="${skin}" stroke-width="2.25" stroke-linecap="round"/>`;
64
+ }).join("");
65
+ return wrap(`<ellipse cx="1.3" cy="0" rx="3.7" ry="3.5" fill="${skin}"/>${fingers}<path d="M0.6 ${2.2 * thumbSide} L1.8 ${5 * thumbSide}" stroke="${skin}" stroke-width="2.3" stroke-linecap="round"/>`);
66
+ }
67
+ static armPath(shoulder, arm, colors, isShortSleeve) {
68
+ const round = (value) => PersonArmUtil.round(value);
69
+ const { elbow, hand } = arm;
70
+ const stroke = 'fill="none" stroke-linecap="round" stroke-linejoin="round"';
71
+ if (!isShortSleeve) {
72
+ return `<path d="M${round(shoulder[0])} ${round(shoulder[1])} L${round(elbow[0])} ${round(elbow[1])} L${round(hand[0])} ${round(hand[1])}" stroke="${colors.sleeve}" ${stroke} stroke-width="7"/>`;
73
+ }
74
+ const split = PersonArmUtil.SHORT_SLEEVE_SPLIT;
75
+ const middle = [
76
+ shoulder[0] + (elbow[0] - shoulder[0]) * split,
77
+ shoulder[1] + (elbow[1] - shoulder[1]) * split
78
+ ];
79
+ return `<path d="M${round(middle[0])} ${round(middle[1])} L${round(elbow[0])} ${round(elbow[1])} L${round(hand[0])} ${round(hand[1])}" stroke="${colors.skin}" ${stroke} stroke-width="6"/><path d="M${round(shoulder[0])} ${round(shoulder[1])} L${round(middle[0])} ${round(middle[1])}" stroke="${colors.sleeve}" ${stroke} stroke-width="8"/>`;
80
+ }
81
+ }
82
+ export {
83
+ PersonArmUtil
84
+ };
@@ -0,0 +1,31 @@
1
+ import type { HairColorName, PersonParams, Point, SkinName } from "../Protocols/PersonProtocol.js";
2
+ import type { Theme } from "../Protocols/ThemeProtocol.js";
3
+ interface Face {
4
+ side: number;
5
+ isBack: boolean;
6
+ gaze: Point;
7
+ }
8
+ export declare class PersonHeadUtil {
9
+ static readonly SKIN_NAME_TO_COLOR: Record<SkinName, string>;
10
+ static readonly HAIR_NAME_TO_COLOR: Record<HairColorName, string>;
11
+ private static readonly AGE_TO_HAIR_COLOR;
12
+ private static readonly STYLE_TO_BACK_EXTRA;
13
+ private static readonly CENTER_Y;
14
+ private static readonly CURL_OFFSETS;
15
+ private static readonly STYLE_TO_HAIR;
16
+ private static readonly EXPRESSION_TO_MOUTH;
17
+ private static readonly EXPRESSION_TO_BROWS;
18
+ private static shortFront;
19
+ private static fringe;
20
+ private static frown;
21
+ private static smile;
22
+ private static raisedBrows;
23
+ static skinOf(name: string | undefined): string;
24
+ private static hairColorOf;
25
+ static head(params: PersonParams, theme: Theme, face: Face): string;
26
+ private static backOfHead;
27
+ private static faceFeatures;
28
+ private static ageLines;
29
+ private static eyes;
30
+ }
31
+ export {};