@pretty-chitty/core 1.1.2 → 1.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (351) hide show
  1. package/dist/components/BottomBarButton.d.ts +2 -1
  2. package/dist/components/BottomBarButton.d.ts.map +1 -1
  3. package/dist/components/BottomBarButton.js +2 -1
  4. package/dist/components/BottomBarButton.js.map +1 -1
  5. package/dist/components/ClientTrustMatchViewer.d.ts +4 -1
  6. package/dist/components/ClientTrustMatchViewer.d.ts.map +1 -1
  7. package/dist/components/ClientTrustMatchViewer.js +11 -4
  8. package/dist/components/ClientTrustMatchViewer.js.map +1 -1
  9. package/dist/components/ContextGalleryDisplay.js +1 -1
  10. package/dist/components/ContextGalleryDisplay.js.map +1 -1
  11. package/dist/components/DemoWrapper.d.ts +9 -0
  12. package/dist/components/DemoWrapper.d.ts.map +1 -0
  13. package/dist/components/DemoWrapper.js +76 -0
  14. package/dist/components/DemoWrapper.js.map +1 -0
  15. package/dist/components/FullScreenGalleryDisplay.d.ts +2 -0
  16. package/dist/components/FullScreenGalleryDisplay.d.ts.map +1 -0
  17. package/dist/components/FullScreenGalleryDisplay.js +56 -0
  18. package/dist/components/FullScreenGalleryDisplay.js.map +1 -0
  19. package/dist/components/Gallery/AnimationController.d.ts +19 -0
  20. package/dist/components/Gallery/AnimationController.d.ts.map +1 -0
  21. package/dist/components/Gallery/AnimationController.js +82 -0
  22. package/dist/components/Gallery/AnimationController.js.map +1 -0
  23. package/dist/components/Gallery/BuiltItem.d.ts +58 -0
  24. package/dist/components/Gallery/BuiltItem.d.ts.map +1 -0
  25. package/dist/components/Gallery/BuiltItem.js +313 -0
  26. package/dist/components/Gallery/BuiltItem.js.map +1 -0
  27. package/dist/components/Gallery/CameraManager.d.ts +14 -0
  28. package/dist/components/Gallery/CameraManager.d.ts.map +1 -0
  29. package/dist/components/Gallery/CameraManager.js +43 -0
  30. package/dist/components/Gallery/CameraManager.js.map +1 -0
  31. package/dist/components/Gallery/GalleryController.d.ts +30 -0
  32. package/dist/components/Gallery/GalleryController.d.ts.map +1 -0
  33. package/dist/components/Gallery/GalleryController.js +137 -0
  34. package/dist/components/Gallery/GalleryController.js.map +1 -0
  35. package/dist/components/Gallery/GalleryViewer.d.ts +18 -0
  36. package/dist/components/Gallery/GalleryViewer.d.ts.map +1 -0
  37. package/dist/components/Gallery/GalleryViewer.js +141 -0
  38. package/dist/components/Gallery/GalleryViewer.js.map +1 -0
  39. package/dist/components/Gallery/LayoutManager.d.ts +49 -0
  40. package/dist/components/Gallery/LayoutManager.d.ts.map +1 -0
  41. package/dist/components/Gallery/LayoutManager.js +132 -0
  42. package/dist/components/Gallery/LayoutManager.js.map +1 -0
  43. package/dist/components/Gallery/constants.d.ts +13 -0
  44. package/dist/components/Gallery/constants.d.ts.map +1 -0
  45. package/dist/components/Gallery/constants.js +13 -0
  46. package/dist/components/Gallery/constants.js.map +1 -0
  47. package/dist/components/Gallery/index.d.ts +3 -0
  48. package/dist/components/Gallery/index.d.ts.map +1 -0
  49. package/dist/components/Gallery/index.js +2 -0
  50. package/dist/components/Gallery/index.js.map +1 -0
  51. package/dist/components/Gallery/types.d.ts +45 -0
  52. package/dist/components/Gallery/types.d.ts.map +1 -0
  53. package/dist/components/Gallery/types.js +2 -0
  54. package/dist/components/Gallery/types.js.map +1 -0
  55. package/dist/components/GalleryPlayground.js +1 -1
  56. package/dist/components/GalleryPlayground.js.map +1 -1
  57. package/dist/components/GalleryViewer.d.ts +2 -47
  58. package/dist/components/GalleryViewer.d.ts.map +1 -1
  59. package/dist/components/GalleryViewer.js +3 -569
  60. package/dist/components/GalleryViewer.js.map +1 -1
  61. package/dist/components/GameDesigner.d.ts.map +1 -1
  62. package/dist/components/GameDesigner.js +13 -2
  63. package/dist/components/GameDesigner.js.map +1 -1
  64. package/dist/components/InlineGalleryDisplay.d.ts +2 -0
  65. package/dist/components/InlineGalleryDisplay.d.ts.map +1 -0
  66. package/dist/components/InlineGalleryDisplay.js +69 -0
  67. package/dist/components/InlineGalleryDisplay.js.map +1 -0
  68. package/dist/components/LiveButton.d.ts.map +1 -1
  69. package/dist/components/LiveButton.js +1 -1
  70. package/dist/components/LiveButton.js.map +1 -1
  71. package/dist/components/MatchViewer.d.ts +0 -1
  72. package/dist/components/MatchViewer.d.ts.map +1 -1
  73. package/dist/components/MatchViewer.js +20 -10
  74. package/dist/components/MatchViewer.js.map +1 -1
  75. package/dist/components/Panel/MultiPanel.d.ts.map +1 -1
  76. package/dist/components/Panel/MultiPanel.js +14 -7
  77. package/dist/components/Panel/MultiPanel.js.map +1 -1
  78. package/dist/components/Panel/PanelContents.d.ts +2 -1
  79. package/dist/components/Panel/PanelContents.d.ts.map +1 -1
  80. package/dist/components/Panel/PanelContents.js +16 -11
  81. package/dist/components/Panel/PanelContents.js.map +1 -1
  82. package/dist/components/Panel/SinglePanel.d.ts.map +1 -1
  83. package/dist/components/Panel/SinglePanel.js +4 -3
  84. package/dist/components/Panel/SinglePanel.js.map +1 -1
  85. package/dist/components/Panel/ViewerWrapper.d.ts +1 -3
  86. package/dist/components/Panel/ViewerWrapper.d.ts.map +1 -1
  87. package/dist/components/Panel/ViewerWrapper.js +2 -3
  88. package/dist/components/Panel/ViewerWrapper.js.map +1 -1
  89. package/dist/components/Playground.d.ts.map +1 -1
  90. package/dist/components/Playground.js +353 -50
  91. package/dist/components/Playground.js.map +1 -1
  92. package/dist/components/PromptControls.d.ts.map +1 -1
  93. package/dist/components/PromptControls.js +39 -6
  94. package/dist/components/PromptControls.js.map +1 -1
  95. package/dist/components/ServerTrustMatchViewer.d.ts +11 -0
  96. package/dist/components/ServerTrustMatchViewer.d.ts.map +1 -0
  97. package/dist/components/ServerTrustMatchViewer.js +26 -0
  98. package/dist/components/ServerTrustMatchViewer.js.map +1 -0
  99. package/dist/components/Viewer.d.ts.map +1 -1
  100. package/dist/components/Viewer.js +54 -14
  101. package/dist/components/Viewer.js.map +1 -1
  102. package/dist/game/Chit.d.ts +6 -2
  103. package/dist/game/Chit.d.ts.map +1 -1
  104. package/dist/game/Chit.js +50 -6
  105. package/dist/game/Chit.js.map +1 -1
  106. package/dist/game/ClientTimeState.d.ts +1 -0
  107. package/dist/game/ClientTimeState.d.ts.map +1 -1
  108. package/dist/game/ClientTimeState.js +4 -1
  109. package/dist/game/ClientTimeState.js.map +1 -1
  110. package/dist/game/GalleryItemChitChildrenSource.d.ts +1 -0
  111. package/dist/game/GalleryItemChitChildrenSource.d.ts.map +1 -1
  112. package/dist/game/GalleryItemChitChildrenSource.js +1 -0
  113. package/dist/game/GalleryItemChitChildrenSource.js.map +1 -1
  114. package/dist/game/GalleryItemRawSource.d.ts +1 -0
  115. package/dist/game/GalleryItemRawSource.d.ts.map +1 -1
  116. package/dist/game/GalleryItemRawSource.js +1 -0
  117. package/dist/game/GalleryItemRawSource.js.map +1 -1
  118. package/dist/game/Game.d.ts +2 -1
  119. package/dist/game/Game.d.ts.map +1 -1
  120. package/dist/game/GameButton.d.ts +1 -0
  121. package/dist/game/GameButton.d.ts.map +1 -1
  122. package/dist/game/GameButton.js +2 -0
  123. package/dist/game/GameButton.js.map +1 -1
  124. package/dist/game/GameDeckChit.d.ts +6 -0
  125. package/dist/game/GameDeckChit.d.ts.map +1 -1
  126. package/dist/game/GameDeckChit.js +32 -5
  127. package/dist/game/GameDeckChit.js.map +1 -1
  128. package/dist/game/GameMetaData.d.ts +18 -0
  129. package/dist/game/GameMetaData.d.ts.map +1 -0
  130. package/dist/game/GameMetaData.js +2 -0
  131. package/dist/game/GameMetaData.js.map +1 -0
  132. package/dist/game/GameTheme.d.ts +11 -0
  133. package/dist/game/GameTheme.d.ts.map +1 -1
  134. package/dist/game/GameTheme.js +19 -4
  135. package/dist/game/GameTheme.js.map +1 -1
  136. package/dist/game/Match.d.ts +2 -1
  137. package/dist/game/Match.d.ts.map +1 -1
  138. package/dist/game/Match.js +4 -3
  139. package/dist/game/Match.js.map +1 -1
  140. package/dist/game/MatchStorage.d.ts +10 -0
  141. package/dist/game/MatchStorage.d.ts.map +1 -1
  142. package/dist/game/MatchStorage.js +29 -0
  143. package/dist/game/MatchStorage.js.map +1 -1
  144. package/dist/game/ModalState.d.ts +1 -0
  145. package/dist/game/ModalState.d.ts.map +1 -1
  146. package/dist/game/ModalState.js +1 -0
  147. package/dist/game/ModalState.js.map +1 -1
  148. package/dist/game/OrderedOutlet.d.ts.map +1 -1
  149. package/dist/game/OrderedOutlet.js +6 -6
  150. package/dist/game/OrderedOutlet.js.map +1 -1
  151. package/dist/game/Pick.d.ts +11 -1
  152. package/dist/game/Pick.d.ts.map +1 -1
  153. package/dist/game/Pick.js +83 -1
  154. package/dist/game/Pick.js.map +1 -1
  155. package/dist/game/PlayerChit.d.ts +2 -1
  156. package/dist/game/PlayerChit.d.ts.map +1 -1
  157. package/dist/game/PlayerChit.js +13 -1
  158. package/dist/game/PlayerChit.js.map +1 -1
  159. package/dist/game/PlayerInfo.d.ts +2 -1
  160. package/dist/game/PlayerInfo.d.ts.map +1 -1
  161. package/dist/game/PlayerInfo.js +20 -3
  162. package/dist/game/PlayerInfo.js.map +1 -1
  163. package/dist/game/Prompt.d.ts +1 -11
  164. package/dist/game/Prompt.d.ts.map +1 -1
  165. package/dist/game/Prompt.js +0 -32
  166. package/dist/game/Prompt.js.map +1 -1
  167. package/dist/game/RootChit.d.ts +4 -0
  168. package/dist/game/RootChit.d.ts.map +1 -1
  169. package/dist/game/RootChit.js +36 -1
  170. package/dist/game/RootChit.js.map +1 -1
  171. package/dist/game/Turn.d.ts +9 -8
  172. package/dist/game/Turn.d.ts.map +1 -1
  173. package/dist/game/Turn.js +34 -34
  174. package/dist/game/Turn.js.map +1 -1
  175. package/dist/game/TurnState.d.ts +3 -2
  176. package/dist/game/TurnState.d.ts.map +1 -1
  177. package/dist/game/TurnState.js +22 -2
  178. package/dist/game/TurnState.js.map +1 -1
  179. package/dist/game/badAiTransport/BadAIClientPrompts.d.ts +14 -0
  180. package/dist/game/badAiTransport/BadAIClientPrompts.d.ts.map +1 -0
  181. package/dist/game/badAiTransport/BadAIClientPrompts.js +50 -0
  182. package/dist/game/badAiTransport/BadAIClientPrompts.js.map +1 -0
  183. package/dist/game/clientTransport/ClientTime.js +1 -1
  184. package/dist/game/clientTransport/ClientTime.js.map +1 -1
  185. package/dist/game/serverTransport/ServerTime.d.ts.map +1 -1
  186. package/dist/game/serverTransport/ServerTime.js +1 -1
  187. package/dist/game/serverTransport/ServerTime.js.map +1 -1
  188. package/dist/hooks/useButtonGalleriesOptions.d.ts +4 -0
  189. package/dist/hooks/useButtonGalleriesOptions.d.ts.map +1 -0
  190. package/dist/hooks/useButtonGalleriesOptions.js +7 -0
  191. package/dist/hooks/useButtonGalleriesOptions.js.map +1 -0
  192. package/dist/hooks/useEventChannelState.js +1 -1
  193. package/dist/hooks/useEventChannelState.js.map +1 -1
  194. package/dist/hooks/useLoadingStates.d.ts +17 -0
  195. package/dist/hooks/useLoadingStates.d.ts.map +1 -0
  196. package/dist/hooks/useLoadingStates.js +44 -0
  197. package/dist/hooks/useLoadingStates.js.map +1 -0
  198. package/dist/hooks/useModalState.d.ts +2 -1
  199. package/dist/hooks/useModalState.d.ts.map +1 -1
  200. package/dist/hooks/useModalState.js +2 -2
  201. package/dist/hooks/useModalState.js.map +1 -1
  202. package/dist/hooks/usePanelPositioning.d.ts +0 -1
  203. package/dist/hooks/usePanelPositioning.d.ts.map +1 -1
  204. package/dist/hooks/usePanelPositioning.js.map +1 -1
  205. package/dist/index.d.ts +7 -5
  206. package/dist/index.d.ts.map +1 -1
  207. package/dist/index.js +17 -1
  208. package/dist/index.js.map +1 -1
  209. package/dist/rendering/CameraWrapperPerspective.d.ts.map +1 -1
  210. package/dist/rendering/CameraWrapperPerspective.js +1 -1
  211. package/dist/rendering/CameraWrapperPerspective.js.map +1 -1
  212. package/dist/rendering/ChitGalleryItemInstance.d.ts +2 -0
  213. package/dist/rendering/ChitGalleryItemInstance.d.ts.map +1 -1
  214. package/dist/rendering/ChitGalleryItemInstance.js +2 -0
  215. package/dist/rendering/ChitGalleryItemInstance.js.map +1 -1
  216. package/dist/rendering/ChitRenderInstance.d.ts +13 -2
  217. package/dist/rendering/ChitRenderInstance.d.ts.map +1 -1
  218. package/dist/rendering/ChitRenderInstance.js +95 -47
  219. package/dist/rendering/ChitRenderInstance.js.map +1 -1
  220. package/dist/rendering/ChitRenderSpec.d.ts +3 -0
  221. package/dist/rendering/ChitRenderSpec.d.ts.map +1 -1
  222. package/dist/rendering/ChitRenderSpec.js +3 -0
  223. package/dist/rendering/ChitRenderSpec.js.map +1 -1
  224. package/dist/rendering/RootChitRenderInstance.d.ts +5 -2
  225. package/dist/rendering/RootChitRenderInstance.d.ts.map +1 -1
  226. package/dist/rendering/RootChitRenderInstance.js +76 -13
  227. package/dist/rendering/RootChitRenderInstance.js.map +1 -1
  228. package/dist/rendering/SplayCounter.d.ts.map +1 -1
  229. package/dist/rendering/SplayCounter.js +1 -1
  230. package/dist/rendering/SplayCounter.js.map +1 -1
  231. package/dist/rendering/TextureReferenceCounter.d.ts +1 -1
  232. package/dist/rendering/TextureReferenceCounter.d.ts.map +1 -1
  233. package/dist/rendering/TextureReferenceCounter.js +10 -10
  234. package/dist/rendering/TextureReferenceCounter.js.map +1 -1
  235. package/dist/rendering/outline/passes/DepthOcclusionPass.js +1 -1
  236. package/dist/rendering/outline/passes/DepthOcclusionPass.js.map +1 -1
  237. package/dist/utilities/Annotations.d.ts +59 -0
  238. package/dist/utilities/Annotations.d.ts.map +1 -1
  239. package/dist/utilities/Annotations.js +63 -0
  240. package/dist/utilities/Annotations.js.map +1 -1
  241. package/dist/utilities/CanvasStack/CanvasOperations.d.ts +10 -1
  242. package/dist/utilities/CanvasStack/CanvasOperations.d.ts.map +1 -1
  243. package/dist/utilities/CanvasStack/CanvasOperations.js +8 -0
  244. package/dist/utilities/CanvasStack/CanvasOperations.js.map +1 -1
  245. package/dist/utilities/CanvasStack/ReactCanvas.d.ts +4 -2
  246. package/dist/utilities/CanvasStack/ReactCanvas.d.ts.map +1 -1
  247. package/dist/utilities/CanvasStack/ReactCanvas.js +5 -2
  248. package/dist/utilities/CanvasStack/ReactCanvas.js.map +1 -1
  249. package/dist/utilities/CanvasStack/RichTextRenderer.d.ts.map +1 -1
  250. package/dist/utilities/CanvasStack/RichTextRenderer.js +12 -4
  251. package/dist/utilities/CanvasStack/RichTextRenderer.js.map +1 -1
  252. package/dist/utilities/EventChannel.d.ts.map +1 -1
  253. package/dist/utilities/EventChannel.js +2 -3
  254. package/dist/utilities/EventChannel.js.map +1 -1
  255. package/dist/utilities/GlbLoader.d.ts +15 -0
  256. package/dist/utilities/GlbLoader.d.ts.map +1 -0
  257. package/dist/utilities/GlbLoader.js +212 -0
  258. package/dist/utilities/GlbLoader.js.map +1 -0
  259. package/dist/utilities/LayoutHelper.js +23 -2
  260. package/dist/utilities/LayoutHelper.js.map +1 -1
  261. package/dist/utilities/ObjectWithProps.d.ts.map +1 -1
  262. package/dist/utilities/ObjectWithProps.js +32 -3
  263. package/dist/utilities/ObjectWithProps.js.map +1 -1
  264. package/package.json +6 -5
  265. package/src/library/components/BottomBarButton.tsx +3 -0
  266. package/src/library/components/ClientTrustMatchViewer.tsx +23 -8
  267. package/src/library/components/ContextGalleryDisplay.tsx +2 -2
  268. package/src/library/components/DemoWrapper.tsx +113 -0
  269. package/src/library/components/{GalleryDisplay.tsx → FullScreenGalleryDisplay.tsx} +28 -2
  270. package/src/library/components/Gallery/AnimationController.ts +110 -0
  271. package/src/library/components/Gallery/BuiltItem.ts +385 -0
  272. package/src/library/components/Gallery/CameraManager.ts +54 -0
  273. package/src/library/components/Gallery/GalleryController.ts +193 -0
  274. package/src/library/components/Gallery/GalleryViewer.tsx +211 -0
  275. package/src/library/components/Gallery/LayoutManager.ts +166 -0
  276. package/src/library/components/Gallery/constants.ts +12 -0
  277. package/src/library/components/Gallery/index.ts +2 -0
  278. package/src/library/components/Gallery/types.ts +55 -0
  279. package/src/library/components/GalleryPlayground.tsx +1 -1
  280. package/src/library/components/GalleryViewer.tsx +4 -773
  281. package/src/library/components/GameDesigner.tsx +21 -4
  282. package/src/library/components/InlineGalleryDisplay.tsx +101 -0
  283. package/src/library/components/LiveButton.tsx +2 -1
  284. package/src/library/components/MatchViewer.tsx +32 -14
  285. package/src/library/components/Panel/MultiPanel.tsx +20 -8
  286. package/src/library/components/Panel/PanelContents.tsx +17 -12
  287. package/src/library/components/Panel/SinglePanel.tsx +5 -4
  288. package/src/library/components/Panel/ViewerWrapper.tsx +0 -5
  289. package/src/library/components/Playground.tsx +692 -119
  290. package/src/library/components/PromptControls.tsx +61 -8
  291. package/src/library/components/ServerTrustMatchViewer.tsx +53 -0
  292. package/src/library/components/Viewer.tsx +60 -20
  293. package/src/library/game/Chit.ts +53 -6
  294. package/src/library/game/ClientTimeState.ts +5 -1
  295. package/src/library/game/GalleryItemChitChildrenSource.ts +2 -0
  296. package/src/library/game/GalleryItemRawSource.ts +2 -0
  297. package/src/library/game/Game.ts +3 -1
  298. package/src/library/game/GameButton.ts +3 -0
  299. package/src/library/game/GameDeckChit.ts +36 -5
  300. package/src/library/game/GameMetaData.ts +19 -0
  301. package/src/library/game/GameTheme.ts +23 -5
  302. package/src/library/game/Match.ts +4 -3
  303. package/src/library/game/MatchStorage.ts +37 -0
  304. package/src/library/game/ModalState.ts +1 -0
  305. package/src/library/game/OrderedOutlet.ts +6 -6
  306. package/src/library/game/Pick.ts +98 -2
  307. package/src/library/game/PlayerChit.ts +13 -1
  308. package/src/library/game/PlayerInfo.ts +22 -3
  309. package/src/library/game/Prompt.ts +1 -36
  310. package/src/library/game/RootChit.ts +41 -1
  311. package/src/library/game/Turn.ts +37 -40
  312. package/src/library/game/TurnState.ts +22 -3
  313. package/src/library/game/badAiTransport/BadAIClientPrompts.ts +60 -0
  314. package/src/library/game/clientTransport/ClientTime.ts +1 -1
  315. package/src/library/game/serverTransport/ServerTime.ts +2 -2
  316. package/src/library/hooks/useButtonGalleriesOptions.tsx +9 -0
  317. package/src/library/hooks/useEventChannelState.ts +1 -1
  318. package/src/library/hooks/useLoadingStates.tsx +55 -0
  319. package/src/library/hooks/useModalState.tsx +2 -2
  320. package/src/library/hooks/usePanelPositioning.tsx +0 -1
  321. package/src/library/index.ts +21 -1
  322. package/src/library/rendering/CameraWrapperPerspective.ts +10 -12
  323. package/src/library/rendering/ChitGalleryItemInstance.ts +2 -0
  324. package/src/library/rendering/ChitRenderInstance.ts +119 -61
  325. package/src/library/rendering/ChitRenderSpec.ts +4 -0
  326. package/src/library/rendering/RootChitRenderInstance.ts +87 -13
  327. package/src/library/rendering/SplayCounter.tsx +2 -1
  328. package/src/library/rendering/TextureReferenceCounter.ts +9 -9
  329. package/src/library/rendering/outline/passes/DepthOcclusionPass.ts +1 -1
  330. package/src/library/utilities/Annotations.ts +99 -0
  331. package/src/library/utilities/CanvasStack/CanvasOperations.tsx +19 -1
  332. package/src/library/utilities/CanvasStack/ReactCanvas.tsx +10 -3
  333. package/src/library/utilities/CanvasStack/RichTextRenderer.ts +14 -4
  334. package/src/library/utilities/EventChannel.ts +2 -4
  335. package/src/library/utilities/GlbLoader.ts +292 -0
  336. package/src/library/utilities/LayoutHelper.ts +28 -2
  337. package/src/library/utilities/ObjectWithProps.ts +27 -3
  338. package/dist/components/GalleryDisplay.d.ts +0 -2
  339. package/dist/components/GalleryDisplay.d.ts.map +0 -1
  340. package/dist/components/GalleryDisplay.js +0 -42
  341. package/dist/components/GalleryDisplay.js.map +0 -1
  342. package/dist/utilities/OutlineCanvas.d.ts +0 -12
  343. package/dist/utilities/OutlineCanvas.d.ts.map +0 -1
  344. package/dist/utilities/OutlineCanvas.js +0 -31
  345. package/dist/utilities/OutlineCanvas.js.map +0 -1
  346. package/dist/utilities/OutlineGeometry.d.ts +0 -3
  347. package/dist/utilities/OutlineGeometry.d.ts.map +0 -1
  348. package/dist/utilities/OutlineGeometry.js +0 -57
  349. package/dist/utilities/OutlineGeometry.js.map +0 -1
  350. package/src/library/utilities/OutlineCanvas.tsx +0 -45
  351. package/src/library/utilities/OutlineGeometry.ts +0 -69
@@ -1,7 +1,7 @@
1
1
  import { Tween, Group as TweenGroup } from "@tweenjs/tween.js";
2
2
  import { ChitRenderInstance } from "./ChitRenderInstance";
3
3
  import { Chit } from "../game/Chit";
4
- import { Box3, Group, Object3D, Raycaster, Vector2, Vector3 } from "three";
4
+ import { Box3, Group, Object3D, Plane, Raycaster, Vector2, Vector3 } from "three";
5
5
  import { CameraWrapperPerspective } from "./CameraWrapperPerspective";
6
6
  import { LightWrapper } from "./LightWrapper";
7
7
  import { ModalState } from "../game/ModalState";
@@ -10,7 +10,7 @@ import { chitsToGalleryItems } from "../utilities/GalleryItemConversion";
10
10
  import { GalleryItemRawSource } from "../game/GalleryItemRawSource";
11
11
  import { CameraSpec } from "./CameraSpec";
12
12
  import { SceneWrapper } from "./outline";
13
- import { TextureReferenaceCounter, TextureReferenceCounterRootGroup } from "./TextureReferenceCounter";
13
+ import { TextureReferenceCounter, TextureReferenceCounterRootGroup } from "./TextureReferenceCounter";
14
14
 
15
15
  export type AnimationState = "leaving" | "entering" | "pending" | "inactive";
16
16
 
@@ -56,7 +56,7 @@ export class RootChitRenderInstance extends ChitRenderInstance implements Textur
56
56
 
57
57
  constructor(chit: Chit) {
58
58
  super(chit);
59
- TextureReferenaceCounter.registerInstance(this);
59
+ TextureReferenceCounter.registerInstance(this);
60
60
  this._sceneWrapper.scene.add(this.rootGroup);
61
61
  this.id = chit.id ?? `${Date.now()}_${Math.random()}`;
62
62
  this.bboxGroup.visible = false;
@@ -101,7 +101,7 @@ export class RootChitRenderInstance extends ChitRenderInstance implements Textur
101
101
 
102
102
  resetDirty() {
103
103
  if (this.dirty) {
104
- TextureReferenaceCounter.update();
104
+ TextureReferenceCounter.update();
105
105
  this.dirty = false;
106
106
  }
107
107
  }
@@ -181,9 +181,12 @@ export class RootChitRenderInstance extends ChitRenderInstance implements Textur
181
181
  }
182
182
 
183
183
  public resetMarks() {
184
- this._hasPendingChanges = false;
185
- this._hasChitsEntering = false;
186
- this._hasChitsLeaving = false;
184
+ if (this._hasChitsEntering || this._hasChitsLeaving || this._hasPendingChanges) {
185
+ this._hasPendingChanges = false;
186
+ this._hasChitsEntering = false;
187
+ this._hasChitsLeaving = false;
188
+ this.notifyPanelStatusChange();
189
+ }
187
190
  }
188
191
 
189
192
  public markHasPendingChange() {
@@ -246,7 +249,7 @@ export class RootChitRenderInstance extends ChitRenderInstance implements Textur
246
249
  }
247
250
 
248
251
  public override destroy() {
249
- TextureReferenaceCounter.unregisterInstance(this);
252
+ TextureReferenceCounter.unregisterInstance(this);
250
253
  this.lightWrapper.destroy();
251
254
  this.cameraWrapper.destroy();
252
255
  clearTimeout(this._notifyTimeout);
@@ -349,7 +352,7 @@ export class RootChitRenderInstance extends ChitRenderInstance implements Textur
349
352
  const circumference = PI2 * r;
350
353
 
351
354
  for (let steps = 0; steps <= circumference; steps += precision) {
352
- const angle = (steps / circumference) * PI2;
355
+ const angle = (steps / (circumference + 0.0001)) * PI2;
353
356
  let vector = new Vector3(
354
357
  ((x + r * Math.cos(angle)) / this._width) * 2 - 1,
355
358
  -((y + r * Math.sin(angle)) / this._height) * 2 + 1,
@@ -389,6 +392,7 @@ export class RootChitRenderInstance extends ChitRenderInstance implements Textur
389
392
  orig();
390
393
  if (this.modalState) {
391
394
  this.modalState.gallerySource.value = undefined;
395
+ this.modalState.inlineGallerySource.value = undefined;
392
396
  }
393
397
  };
394
398
  }
@@ -405,6 +409,14 @@ export class RootChitRenderInstance extends ChitRenderInstance implements Textur
405
409
  }
406
410
  }
407
411
 
412
+ public handleBeginDrag(x: number, y: number, distance: number, precision: number) {
413
+ const chits = this.findEligibleRenderInstances((c) => !!c.onDrag, x, y, distance, precision);
414
+ if (chits.length > 0) {
415
+ const chit = chits[0];
416
+ return chit;
417
+ }
418
+ }
419
+
408
420
  public handleLongClick(x: number, y: number, distance: number, precision: number) {
409
421
  const chits = this.findEligibleRenderInstances(
410
422
  (c) => !!c.renderInstance?.showDetailsOnLongPress(),
@@ -419,13 +431,16 @@ export class RootChitRenderInstance extends ChitRenderInstance implements Textur
419
431
  }
420
432
  }
421
433
 
422
- public showGallery(source: GalleryItemSource) {
434
+ public showGallery(source: GalleryItemSource, inline = false) {
423
435
  if (this.modalState) {
424
- const s = this.modalState.gallerySource;
436
+ const s = inline ? this.modalState.inlineGallerySource : this.modalState.gallerySource;
425
437
  s.value = source;
426
438
  return () => {
427
- if (s.value === source) {
428
- s.value = undefined;
439
+ if (this.modalState!.inlineGallerySource.value === source) {
440
+ this.modalState!.inlineGallerySource.value = undefined;
441
+ }
442
+ if (this.modalState!.gallerySource.value === source) {
443
+ this.modalState!.gallerySource.value = undefined;
429
444
  }
430
445
  };
431
446
  }
@@ -435,6 +450,9 @@ export class RootChitRenderInstance extends ChitRenderInstance implements Textur
435
450
  if (this.modalState && this.modalState.gallerySource.value === source) {
436
451
  this.modalState.gallerySource.value = undefined;
437
452
  }
453
+ if (this.modalState && this.modalState.inlineGallerySource.value === source) {
454
+ this.modalState.inlineGallerySource.value = undefined;
455
+ }
438
456
  }
439
457
 
440
458
  public handleZoom(x: number, y: number, dz: number, animate: boolean) {
@@ -451,6 +469,62 @@ export class RootChitRenderInstance extends ChitRenderInstance implements Textur
451
469
  return this.cameraWrapper.zoom;
452
470
  }
453
471
 
472
+ public attemptToFindPlaneZ0OfScreenPoints(screenX: number, screenY: number): Vector3 | undefined {
473
+ const screenCoordsOfNewLocation = new Vector2(screenX, screenY);
474
+ if (!this.convertScreenSpaceToCameraSpace) {
475
+ return undefined;
476
+ }
477
+
478
+ // find the current screen coordinates of its new home and map it to "camera space"
479
+ const cameraSpace = this.convertScreenSpaceToCameraSpace(screenCoordsOfNewLocation.x, screenCoordsOfNewLocation.y);
480
+
481
+ if (!cameraSpace) {
482
+ return;
483
+ }
484
+
485
+ const scale = this.camera.zoom;
486
+ if (!Number.isFinite(scale) || scale === 0) {
487
+ return undefined;
488
+ }
489
+
490
+ let multiplier = scale > 1 ? 1 : 1 / scale;
491
+
492
+ // figure out what camera space means at Z=0
493
+ for (; multiplier > 0.11; multiplier *= 0.75) {
494
+ const raycaster = new Raycaster();
495
+ raycaster.setFromCamera(new Vector2(cameraSpace.x * multiplier, cameraSpace.y * multiplier), this.camera);
496
+ const planeZ = new Plane(new Vector3(0, 0, 1), 0);
497
+ const intersection = new Vector3();
498
+ const intersects = raycaster.ray.intersectPlane(planeZ, intersection);
499
+ if (intersects) {
500
+ return intersects;
501
+ }
502
+ }
503
+ }
504
+
505
+ public attemptToFindPlaneZ0OfCanvasPoints(canvasX: number, canvasY: number): Vector3 | undefined {
506
+ const cameraSpace = new Vector2((canvasX / this._width) * 2 - 1, (-canvasY / this._height) * 2 + 1);
507
+
508
+ const scale = this.camera.zoom;
509
+ if (!Number.isFinite(scale) || scale === 0) {
510
+ return undefined;
511
+ }
512
+
513
+ let multiplier = scale > 1 ? 1 : 1 / scale;
514
+
515
+ // figure out what camera space means at Z=0
516
+ for (; multiplier > 0.11; multiplier *= 0.75) {
517
+ const raycaster = new Raycaster();
518
+ raycaster.setFromCamera(new Vector2(cameraSpace.x * multiplier, cameraSpace.y * multiplier), this.camera);
519
+ const planeZ = new Plane(new Vector3(0, 0, 1), 0);
520
+ const intersection = new Vector3();
521
+ const intersects = raycaster.ray.intersectPlane(planeZ, intersection);
522
+ if (intersects) {
523
+ return intersects;
524
+ }
525
+ }
526
+ }
527
+
454
528
  // override this stuff - we are never going to a new viewer
455
529
  protected override moveToNewViewer(): void {}
456
530
  protected override detach() {}
@@ -25,7 +25,8 @@ export class SplayCounter extends ParameterizedCanvas {
25
25
  protected render() {
26
26
  return (
27
27
  <Text
28
- font={`${this.textOptions.fontSize * this.dpi}px ${this.textOptions.fontFamily ?? "sans-serif"}`}
28
+ fontSize={this.textOptions.fontSize * this.dpi}
29
+ fontFamily={this.textOptions.fontFamily}
29
30
  fill={this.textOptions.fill ?? "#000"}
30
31
  shadowColor={this.textOptions.shadow}
31
32
  shadowBlur={this.textOptions.fontSize * 0.1 * this.dpi}
@@ -6,19 +6,19 @@ export type TextureReferenceCounterRootGroup = {
6
6
  markHasChange(): void;
7
7
  };
8
8
 
9
- export class TextureReferenaceCounter {
9
+ export class TextureReferenceCounter {
10
10
  private static instances: TextureReferenceCounterRootGroup[] = [];
11
11
 
12
12
  static registerInstance(instance: TextureReferenceCounterRootGroup) {
13
- if (!TextureReferenaceCounter.instances.includes(instance)) {
14
- TextureReferenaceCounter.instances.push(instance);
13
+ if (!TextureReferenceCounter.instances.includes(instance)) {
14
+ TextureReferenceCounter.instances.push(instance);
15
15
  }
16
16
  }
17
17
 
18
18
  static unregisterInstance(instance: TextureReferenceCounterRootGroup) {
19
- const index = TextureReferenaceCounter.instances.indexOf(instance);
19
+ const index = TextureReferenceCounter.instances.indexOf(instance);
20
20
  if (index !== -1) {
21
- TextureReferenaceCounter.instances.splice(index, 1);
21
+ TextureReferenceCounter.instances.splice(index, 1);
22
22
  }
23
23
  }
24
24
 
@@ -50,7 +50,7 @@ export class TextureReferenaceCounter {
50
50
  };
51
51
 
52
52
  // Scan all active root render instances
53
- TextureReferenaceCounter.instances.forEach((instance) => {
53
+ TextureReferenceCounter.instances.forEach((instance) => {
54
54
  instance.getRootGroup().traverseVisible((obj) => {
55
55
  if (obj instanceof Mesh) {
56
56
  if (obj.geometry instanceof BufferGeometry) {
@@ -68,17 +68,17 @@ export class TextureReferenaceCounter {
68
68
  // Mark all textures as used globally
69
69
  CanvasStack.disposer.markUsed(allIdsUsed, () => {
70
70
  // Mark all instances as dirty when textures change
71
- TextureReferenaceCounter.instances.forEach((instance) => {
71
+ TextureReferenceCounter.instances.forEach((instance) => {
72
72
  instance.markHasChange();
73
73
  });
74
74
  });
75
75
  CanvasStack.materialDisposer.markUsedMap(allMaterialsUsed, () => {
76
- TextureReferenaceCounter.instances.forEach((instance) => {
76
+ TextureReferenceCounter.instances.forEach((instance) => {
77
77
  instance.markHasChange();
78
78
  });
79
79
  });
80
80
  CanvasStack.geoDisposer.markUsedMap(allGeosUsed, () => {
81
- TextureReferenaceCounter.instances.forEach((instance) => {
81
+ TextureReferenceCounter.instances.forEach((instance) => {
82
82
  instance.markHasChange();
83
83
  });
84
84
  });
@@ -51,7 +51,7 @@ export class DepthOcclusionPass extends Pass {
51
51
  inputTexture: { value: null },
52
52
  idDepthTexture: { value: null },
53
53
  sceneDepthTexture: { value: null },
54
- depthTolerance: { value: 0.0001 },
54
+ depthTolerance: { value: 0.001 },
55
55
  },
56
56
  vertexShader: `
57
57
  varying vec2 vUv;
@@ -3,6 +3,39 @@ import { Chit } from "../game/Chit";
3
3
  import { OrderedOutlet } from "../game/OrderedOutlet";
4
4
 
5
5
  const NON_EDITABLE = "NonEditable";
6
+ const SELECTABLE_KEY = "__selectableProperties";
7
+
8
+ /**
9
+ * Represents a single choice option for a Selectable property.
10
+ */
11
+ export interface SelectableChoice {
12
+ /** Unique identifier for this choice */
13
+ id: string;
14
+ /** Optional user-friendly label for this choice. If not provided, the id will be used. */
15
+ label?: string;
16
+ }
17
+
18
+ /**
19
+ * Configuration for a Selectable property.
20
+ */
21
+ export interface SelectableConfig {
22
+ /** User-friendly label for the property */
23
+ label: string;
24
+ /** List of possible choices for this property */
25
+ choices: SelectableChoice[];
26
+ }
27
+
28
+ /**
29
+ * Information about a Selectable property including its field name and configuration.
30
+ */
31
+ export interface SelectablePropertyInfo {
32
+ /** The name of the property/field */
33
+ fieldName: string;
34
+ /** The configuration for this selectable property */
35
+ config: SelectableConfig;
36
+ /** The current value of the property */
37
+ currentValue: any;
38
+ }
6
39
 
7
40
  function annotationToPropName(key: string, category: string) {
8
41
  return `__${key}__${category}`;
@@ -186,3 +219,69 @@ export function FixChildOutlets(instance: Chit) {
186
219
  }
187
220
  }
188
221
  }
222
+
223
+ /**
224
+ * Decorator that marks a property as selectable with a user-friendly label and a list of choices.
225
+ *
226
+ * @param config - Configuration object containing the label and choices for this property
227
+ *
228
+ * @example
229
+ * ```typescript
230
+ * class MyChit extends Chit {
231
+ * @Selectable({
232
+ * label: "Difficulty Level",
233
+ * choices: [
234
+ * { id: "easy", label: "Easy Mode" },
235
+ * { id: "medium", label: "Medium Mode" },
236
+ * { id: "hard", label: "Hard Mode" }
237
+ * ]
238
+ * })
239
+ * public difficulty: string = "medium";
240
+ * }
241
+ * ```
242
+ *
243
+ * @group Chit Annotations
244
+ */
245
+ export function Selectable(config: SelectableConfig) {
246
+ return function (cls: any, key: string) {
247
+ if (!Object.hasOwn(cls, SELECTABLE_KEY)) {
248
+ const parentSelectables = Object.getPrototypeOf(cls)?.[SELECTABLE_KEY];
249
+ Object.defineProperty(cls, SELECTABLE_KEY, {
250
+ enumerable: false,
251
+ value: parentSelectables ? { ...parentSelectables } : {},
252
+ });
253
+ }
254
+ cls[SELECTABLE_KEY][key] = config;
255
+ };
256
+ }
257
+
258
+ /**
259
+ * Gets all selectable properties from an object instance.
260
+ *
261
+ * @param obj - The object to get selectable properties from
262
+ * @returns An array of SelectablePropertyInfo objects
263
+ */
264
+ export function getSelectableProperties(obj: any): SelectablePropertyInfo[] {
265
+ const result: SelectablePropertyInfo[] = [];
266
+ const seenKeys = new Set<string>();
267
+
268
+ let proto = Object.getPrototypeOf(obj);
269
+ while (proto) {
270
+ const selectables = proto[SELECTABLE_KEY];
271
+ if (selectables) {
272
+ for (const [fieldName, config] of Object.entries(selectables)) {
273
+ if (!seenKeys.has(fieldName)) {
274
+ seenKeys.add(fieldName);
275
+ result.push({
276
+ fieldName,
277
+ config: config as SelectableConfig,
278
+ currentValue: obj[fieldName],
279
+ });
280
+ }
281
+ }
282
+ }
283
+ proto = Object.getPrototypeOf(proto);
284
+ }
285
+
286
+ return result;
287
+ }
@@ -2,6 +2,7 @@ import * as Colors from "color";
2
2
  import { RenderBounds } from "./CanvasStack";
3
3
  import { ImageResult } from "./ImageCache";
4
4
  import { PlayerChit } from "../../game/PlayerChit";
5
+ import { GameTheme } from "../../game/GameTheme";
5
6
  import imageColorOverlayer from "./ImageColorOverlayer";
6
7
  import { RichTextRenderOptionsParameters, RichTextRenderer } from "./RichTextRenderer";
7
8
 
@@ -164,7 +165,15 @@ export class PadCanvasOperation extends CanvasOperation {
164
165
  export type Alignment = "center" | "left" | "right";
165
166
 
166
167
  export interface TextOptions {
167
- contextOptions?: any;
168
+ contextOptions?: {
169
+ fillStyle?: string;
170
+ strokeStyle?: string;
171
+ shadowBlur?: number;
172
+ shadowColor?: string;
173
+ };
174
+ fontSize?: number;
175
+ fontFamily?: string;
176
+ fontWeight?: number | "normal" | "bold";
168
177
  align?: Alignment;
169
178
  offsetX?: number;
170
179
  offsetY?: number;
@@ -243,6 +252,13 @@ export class TextCanvasOperation extends CanvasOperation {
243
252
  super();
244
253
  }
245
254
 
255
+ private makeFont(): string {
256
+ const fontSize = this.options.fontSize ?? 16;
257
+ const fontFamily = this.options.fontFamily ?? GameTheme.defaultFontFamily;
258
+ const fontWeight = this.options.fontWeight ?? 400;
259
+ return `${fontWeight} ${fontSize}px ${fontFamily}`;
260
+ }
261
+
246
262
  override render(
247
263
  context: CanvasRenderingContext2D,
248
264
  bounds: RenderBounds,
@@ -252,6 +268,8 @@ export class TextCanvasOperation extends CanvasOperation {
252
268
  const startX = bounds.x,
253
269
  startY = bounds.y;
254
270
 
271
+ context.font = this.makeFont();
272
+
255
273
  if (this.options.contextOptions) {
256
274
  Object.keys(this.options.contextOptions).forEach(
257
275
  // @ts-expect-error -- It's okay
@@ -206,7 +206,9 @@ export function Text({
206
206
  align = "center",
207
207
  fill,
208
208
  stroke,
209
- font,
209
+ fontSize,
210
+ fontFamily,
211
+ fontWeight,
210
212
  offsetX,
211
213
  offsetY,
212
214
  shadowBlur,
@@ -218,7 +220,9 @@ export function Text({
218
220
  align?: "center" | "left" | "right";
219
221
  fill?: string;
220
222
  stroke?: string;
221
- font?: string;
223
+ fontSize?: number;
224
+ fontFamily?: string;
225
+ fontWeight?: number | "normal" | "bold";
222
226
  shadowBlur?: number;
223
227
  shadowColor?: string;
224
228
  offsetX?: number;
@@ -235,7 +239,10 @@ export function Text({
235
239
  after: after ? unwrapCanvasNode(after) : undefined,
236
240
  offsetX,
237
241
  offsetY,
238
- contextOptions: { fillStyle: fill, strokeStyle: stroke, font, shadowBlur, shadowColor },
242
+ fontSize,
243
+ fontFamily,
244
+ fontWeight,
245
+ contextOptions: { fillStyle: fill, strokeStyle: stroke, shadowBlur, shadowColor },
239
246
  })
240
247
  }
241
248
  />
@@ -1,3 +1,5 @@
1
+ import { GameTheme } from "../../game/GameTheme";
2
+
1
3
  export type Align = "left" | "center" | "right";
2
4
  export type IconBaseline = "text" | "middle" | "bottom";
3
5
  export type VerticalAlign = "top" | "middle" | "bottom";
@@ -77,7 +79,7 @@ export class RichTextRenderer {
77
79
  y = 0,
78
80
  maxWidth,
79
81
  height,
80
- fontFamily = "system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif",
82
+ fontFamily = GameTheme.defaultFontFamily,
81
83
  fontSize = 16,
82
84
  lineHeight = 1.25,
83
85
  align = "left",
@@ -110,7 +112,15 @@ export class RichTextRenderer {
110
112
  ctx.textBaseline = "alphabetic";
111
113
  ctx.fillStyle = color;
112
114
 
113
- const totalHeight = lines.length * metrics.lineHeightPx;
115
+ // Measure actual font metrics for accurate vertical positioning
116
+ ctx.font = this.makeFont({}, metrics);
117
+ const fontMetrics = ctx.measureText("Mg"); // Use chars with ascenders and descenders
118
+ // Use actual metrics if available, otherwise estimate (ascent ~80% of fontSize)
119
+ const ascent = fontMetrics.fontBoundingBoxAscent ?? metrics.fontSize * 0.8;
120
+ const descent = fontMetrics.fontBoundingBoxDescent ?? metrics.fontSize * 0.2;
121
+ const actualTextHeight = ascent + descent;
122
+
123
+ const totalHeight = (lines.length - 1) * metrics.lineHeightPx + actualTextHeight;
114
124
  // Compute initial Y based on vertical alignment if a container height was provided.
115
125
  let startY = y;
116
126
  if (verticalAlign === "middle" && typeof height === "number") {
@@ -125,7 +135,7 @@ export class RichTextRenderer {
125
135
  else if (align === "right") offsetX = maxWidth - line.width;
126
136
 
127
137
  let cursorX = x + offsetX;
128
- const baselineY = cursorY + metrics.fontSize;
138
+ const baselineY = cursorY + ascent;
129
139
 
130
140
  if (debug) {
131
141
  ctx.save();
@@ -184,7 +194,7 @@ export class RichTextRenderer {
184
194
  return {
185
195
  height: lines.length * metrics.lineHeightPx,
186
196
  lines: lines.length,
187
- lastBaselineY: startY + (lines.length - 1) * metrics.lineHeightPx + metrics.fontSize,
197
+ lastBaselineY: startY + (lines.length - 1) * metrics.lineHeightPx + ascent,
188
198
  };
189
199
  }
190
200
 
@@ -1,5 +1,3 @@
1
- import nextTick from "next-tick";
2
-
3
1
  export class EventChannel<T> {
4
2
  private cbs: ((t: T) => void)[] = [];
5
3
  public on(cb: (t: T) => void, notifyImmediate = true) {
@@ -8,7 +6,7 @@ export class EventChannel<T> {
8
6
  // it's important to stash the original value otherwise we might the same value 2x in a row to the channel
9
7
  const valueToPush = this._value;
10
8
  if (notifyImmediate) {
11
- nextTick(() => cb(valueToPush));
9
+ queueMicrotask(() => cb(valueToPush));
12
10
  }
13
11
 
14
12
  return () => {
@@ -20,7 +18,7 @@ export class EventChannel<T> {
20
18
  public trigger(force = false) {
21
19
  clearTimeout(this._triggerTimeout);
22
20
  if (force || this.latency === 0) {
23
- nextTick(() => {
21
+ queueMicrotask(() => {
24
22
  this.cbs.forEach((cb) => cb(this._value));
25
23
  });
26
24
  } else {