@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,5 +1,5 @@
1
1
  import React, { useEffect, useState } from "react";
2
- import { ChevronRight, ChevronLeft, Replay, QuestionMark } from "@mui/icons-material";
2
+ import { ChevronRight, ChevronLeft, Replay } from "@mui/icons-material";
3
3
  import { Box, Stack } from "@mui/material";
4
4
  import BottomBarButton from "./BottomBarButton";
5
5
  import { useGameTheme } from "../hooks/useGameTheme";
@@ -7,23 +7,64 @@ import BottomBarBreak from "./BottomBarBreak";
7
7
  import { useEventChannelState } from "../hooks/useEventChannelState";
8
8
  import { useAnimationSpeedMultiplier, useClientPrompts, useTimeState } from "../hooks/useTimeController";
9
9
  import { usePlayerId } from "../hooks/usePlayer";
10
- import GameDialog from "./GameDialog";
11
- import Markdown from "react-markdown";
12
10
  import { ZINDEX_PROMPT_CONTROLS } from "../utilities/zIndex";
13
11
  import { GameButton, ToggleGalleryButton } from "../game/GameButton";
14
12
  import { useModalState } from "../hooks/useModalState";
15
13
  import { ContextGalleryDisplay } from "./ContextGalleryDisplay";
16
14
  import { NoValidMovesPrompt } from "../game/Prompt";
15
+ import { useButtonGalleriesOptions } from "../hooks/useButtonGalleriesOptions";
16
+
17
+ function SimpleToggle({ checked }: { checked: boolean }) {
18
+ const gameTheme = useGameTheme();
19
+ const trackWidth = 28;
20
+ const trackHeight = 10;
21
+ const thumbSize = 6;
22
+
23
+ return (
24
+ <Box
25
+ sx={{
26
+ width: trackWidth,
27
+ height: trackHeight,
28
+ borderRadius: trackHeight / 2,
29
+ backgroundColor: checked ? gameTheme.actionBarToggleSelectedColor : "rgba(0,0,0,.25)",
30
+ position: "relative",
31
+ transition: "background-color 0.2s ease",
32
+ }}
33
+ >
34
+ <Box
35
+ sx={{
36
+ width: thumbSize,
37
+ height: thumbSize,
38
+ borderRadius: "50%",
39
+ backgroundColor: gameTheme.barTextColor,
40
+ boxShadow: "0 2px 4px 0 rgb(0 35 11 / 20%)",
41
+ position: "absolute",
42
+ top: (trackHeight - thumbSize) / 2,
43
+ left: checked ? trackWidth - thumbSize - 2 : 2,
44
+ transition: "left 0.2s ease",
45
+ }}
46
+ />
47
+ </Box>
48
+ );
49
+ }
17
50
 
18
51
  function GameButtonWrapper({ button }: { button: GameButton }) {
19
52
  const modalState = useModalState();
20
53
  const [source, setSource] = useEventChannelState(modalState.gallerySource);
21
-
22
- let highlight = false;
23
- let cb = button.cb;
54
+ const [inlineSource, setInlineSource] = useEventChannelState(modalState.inlineGallerySource);
55
+ const [galleryDisplayMode] = useButtonGalleriesOptions();
24
56
 
25
57
  if (button instanceof ToggleGalleryButton) {
58
+ let highlight = false;
59
+ let cb = button.cb;
60
+
26
61
  if (
62
+ (button.galleryItemSource === inlineSource && inlineSource) ||
63
+ (inlineSource?.backingObject && button.galleryItemSource?.backingObject === inlineSource.backingObject)
64
+ ) {
65
+ highlight = true;
66
+ cb = () => setInlineSource(undefined);
67
+ } else if (
27
68
  (button.galleryItemSource === source && source) ||
28
69
  (source?.backingObject && button.galleryItemSource?.backingObject === source.backingObject)
29
70
  ) {
@@ -31,11 +72,23 @@ function GameButtonWrapper({ button }: { button: GameButton }) {
31
72
  cb = () => setSource(undefined);
32
73
  } else if (button.galleryItemSource) {
33
74
  const source = button.galleryItemSource;
34
- cb = () => setSource(source);
75
+ cb = () => (galleryDisplayMode === "inline" ? setInlineSource(source) : setSource(source));
35
76
  }
77
+
78
+ return (
79
+ <Box sx={{ position: "relative" }}>
80
+ <BottomBarButton icon={button.icon} label={button.label} onClick={cb} />
81
+
82
+ <Stack direction={"row"} sx={{ fontSize: 5, zIndex: -1, position: "absolute", bottom: 4, left: 0, right: 0 }}>
83
+ <Box flex={1} />
84
+ <SimpleToggle checked={highlight} />
85
+ <Box flex={1} />
86
+ </Stack>
87
+ </Box>
88
+ );
36
89
  }
37
90
 
38
- return <BottomBarButton highlight={highlight} icon={button.icon} label={button.label} onClick={cb} />;
91
+ return <BottomBarButton icon={button.icon} label={button.label} onClick={button.cb} />;
39
92
  }
40
93
 
41
94
  export default function PromptControls({ collapsible }: { collapsible?: boolean }) {
@@ -0,0 +1,53 @@
1
+ import React, { useEffect, useState } from "react";
2
+ import { Game } from "../game/Game";
3
+ import { ConnectionProvider } from "../hooks/useConnection";
4
+ import { GameProvider } from "../hooks/useGame";
5
+ import { PlayerProvider } from "../hooks/usePlayer";
6
+ import { MatchViewer } from "./MatchViewer";
7
+ import { Connection } from "../game/Connection";
8
+ import { ConnectionTransport } from "../game/ConnectionTransport";
9
+ import { LoadingStateProvider, LoadingStates, LoadingStatesCallback } from "../hooks/useLoadingStates";
10
+
11
+ export function ServerTrustMatchViewer({
12
+ playerId,
13
+ game,
14
+ transport,
15
+ onBack,
16
+ onLoadProgress,
17
+ }: {
18
+ playerId: string;
19
+ game: Game<any, any>;
20
+ transport: ConnectionTransport;
21
+ onBack?: () => void;
22
+ onLoadProgress?: LoadingStatesCallback;
23
+ }) {
24
+ const [loadingStates] = useState<LoadingStates>(new LoadingStates());
25
+ const [localConnection, setLocalConnection] = useState<Connection | undefined>();
26
+
27
+ useEffect(() => {
28
+ const newConnection = new Connection(transport);
29
+ setLocalConnection(newConnection);
30
+ }, [transport]);
31
+
32
+ useEffect(() => {
33
+ if (onLoadProgress) {
34
+ return loadingStates.onChange(onLoadProgress);
35
+ }
36
+ }, [loadingStates, onLoadProgress]);
37
+
38
+ if (!localConnection) {
39
+ return null; // loading...
40
+ }
41
+
42
+ return (
43
+ <LoadingStateProvider loadingStates={loadingStates}>
44
+ <GameProvider game={game}>
45
+ <ConnectionProvider connection={localConnection}>
46
+ <PlayerProvider playerId={playerId}>
47
+ <MatchViewer onBack={onBack} />
48
+ </PlayerProvider>
49
+ </ConnectionProvider>
50
+ </GameProvider>
51
+ </LoadingStateProvider>
52
+ );
53
+ }
@@ -13,6 +13,8 @@ import { useGameTheme } from "../hooks/useGameTheme";
13
13
  import { requestSharedAnimationFrame } from "../utilities/RequestSharedAnimationFrame";
14
14
  import PersistentCanvas from "./PersistentCanvas";
15
15
  import { useGestureContext, ViewerGestureHandlers } from "./Panel/PanelContents";
16
+ import { useLoadingState } from "../hooks/useLoadingStates";
17
+ import { DragHandler } from "../rendering/ChitRenderInstance";
16
18
 
17
19
  let ID_COUNTER = 1;
18
20
 
@@ -41,6 +43,7 @@ export default function Viewer({
41
43
  refContainer?: React.RefObject<HTMLElement> | null;
42
44
  enableGestures?: boolean;
43
45
  }) {
46
+ const loadingState = useLoadingState();
44
47
  const playerId = usePlayerId();
45
48
  const [id] = useState(`Viewer${ID_COUNTER++}`);
46
49
  const timeState = useTimeState();
@@ -50,6 +53,10 @@ export default function Viewer({
50
53
  const rendererWrapper = useWebGlRenderer();
51
54
  const theme = useGameTheme();
52
55
 
56
+ useEffect(() => {
57
+ loadingState.setLoading(id, true);
58
+ }, [id, loadingState]);
59
+
53
60
  const modalState = useModalState();
54
61
  const [chitRenderInstance, setChitRenderInstance] = useState<RootChitRenderInstance | null>(null);
55
62
 
@@ -134,6 +141,8 @@ export default function Viewer({
134
141
  return;
135
142
  }
136
143
 
144
+ loadingState.setLoading(id, true);
145
+
137
146
  const context = canvas.getContext("2d");
138
147
  if (!context) {
139
148
  return;
@@ -160,18 +169,17 @@ export default function Viewer({
160
169
  ) {
161
170
  if (!hardPaused) {
162
171
  // Clear canvas and render
163
- rendererWrapper.render(
164
- chitRenderInstance.sceneWrapper,
165
- chitRenderInstance.camera,
166
- context,
167
- theme,
168
- );
172
+ rendererWrapper.render(chitRenderInstance.sceneWrapper, chitRenderInstance.camera, context, theme);
173
+
174
+ loadingState.setLoading(id, false);
169
175
 
170
176
  // Clear snapshot after first render at new size
171
177
  const canvasEl = canvas as any;
172
178
  if (canvasEl.clearSnapshot) {
173
179
  canvasEl.clearSnapshot();
174
180
  }
181
+ } else {
182
+ loadingState.setLoading(id, false);
175
183
  }
176
184
 
177
185
  chitRenderInstance.resetDirty();
@@ -180,6 +188,7 @@ export default function Viewer({
180
188
  }
181
189
  } else {
182
190
  timeState.setAnimationState(id, false);
191
+ loadingState.setLoading(id, false);
183
192
  }
184
193
  } catch (e) {
185
194
  console.error(e);
@@ -192,7 +201,18 @@ export default function Viewer({
192
201
  timeState.setAnimationState(id, false);
193
202
  cancelled = true;
194
203
  };
195
- }, [id, timeState, hardPaused, rendererWrapper, chitRenderInstance, paused, actualRef, myRefContainer, theme]);
204
+ }, [
205
+ id,
206
+ timeState,
207
+ hardPaused,
208
+ rendererWrapper,
209
+ chitRenderInstance,
210
+ paused,
211
+ actualRef,
212
+ myRefContainer,
213
+ theme,
214
+ loadingState,
215
+ ]);
196
216
 
197
217
  useEffect(() => {
198
218
  if (chitRenderInstance) {
@@ -241,6 +261,7 @@ export default function Viewer({
241
261
  let pinchEndedRecently = false;
242
262
  let pinchScale = 1;
243
263
  let pinchCancelled = false;
264
+ let dragHandler: DragHandler | undefined;
244
265
 
245
266
  const handlers: ViewerGestureHandlers = {
246
267
  onSingleTap: (x, y, isMouse) => {
@@ -257,18 +278,28 @@ export default function Viewer({
257
278
  onLongTap: (x, y, isMouse) => {
258
279
  chitRenderInstance.handleLongClick(x, y, isMouse ? 3 : 6, isMouse ? 1.5 : 3);
259
280
  },
260
- onPanStart: () => {
281
+ onPanStart: (x, y, isMouse) => {
261
282
  if (pinchEndedRecently) {
262
283
  cancelled = true;
263
284
  return;
264
285
  }
265
286
  cancelled = false;
287
+
288
+ const draggingChit = chitRenderInstance.handleBeginDrag(x, y, isMouse ? 3 : 6, isMouse ? 1.5 : 3);
289
+ if (draggingChit) {
290
+ dragHandler = draggingChit.renderInstance!.executeDrag(x, y);
291
+ }
266
292
  },
267
293
  onPan: (dx, dy, ev) => {
268
294
  if (cancelled) {
269
295
  return;
270
296
  }
271
297
 
298
+ if (dragHandler) {
299
+ dragHandler.duringDrag(dx, dy);
300
+ return;
301
+ }
302
+
272
303
  if (panCallback) {
273
304
  const isMouse = ev.pointerType === "mouse";
274
305
  const neededVelocity = chitRenderInstance.cameraZoom <= 1.1 ? 0.3 : isMouse ? 7.5 : 2.5;
@@ -279,21 +310,30 @@ export default function Viewer({
279
310
  return;
280
311
  }
281
312
  }
282
- if (zoomCallback) {
283
- const isMouse = ev.pointerType === "mouse";
284
- const neededVelocity = chitRenderInstance.cameraZoom <= 1.1 ? 0.3 : isMouse ? 7.5 : 2.5;
285
- if (Math.abs(ev.velocityY) > neededVelocity && ev.distance > 20 && Math.abs(ev.velocityX) < 0.2) {
286
- const prev = chitRenderInstance.cameraZoom;
287
- chitRenderInstance.handleZoom(0, 0, chitRenderInstance.cameraZoom <= 1 ? 0.0001 : -20, !!zoomCallback);
288
- zoomCallback(chitRenderInstance.cameraZoom, prev);
289
- setTimeout(() => chitRenderInstance.handleZoom(0, 0, 0, false), 100);
290
- cancelled = true;
291
- return;
292
- }
293
- }
313
+ // if (zoomCallback) {
314
+ // const isMouse = ev.pointerType === "mouse";
315
+ // const neededVelocity = chitRenderInstance.cameraZoom <= 1.1 ? 0.3 : isMouse ? 7.5 : 2.5;
316
+ // if (Math.abs(ev.velocityY) > neededVelocity && ev.distance > 20 && Math.abs(ev.velocityX) < 0.2) {
317
+ // const prev = chitRenderInstance.cameraZoom;
318
+ // chitRenderInstance.handleZoom(0, 0, chitRenderInstance.cameraZoom <= 1 ? 0.0001 : -20, !!zoomCallback);
319
+ // zoomCallback(chitRenderInstance.cameraZoom, prev);
320
+ // setTimeout(() => chitRenderInstance.handleZoom(0, 0, 0, false), 100);
321
+ // cancelled = true;
322
+ // return;
323
+ // }
324
+ // }
294
325
 
295
326
  chitRenderInstance.handlePan(dx, dy);
296
327
  },
328
+ onPanEnd: () => {
329
+ if (cancelled) {
330
+ return;
331
+ }
332
+ if (dragHandler) {
333
+ dragHandler.finishDrag();
334
+ dragHandler = undefined;
335
+ }
336
+ },
297
337
  onPinchStart: () => {
298
338
  pinchScale = chitRenderInstance.cameraZoom;
299
339
  pinchCancelled = false;
@@ -1,9 +1,9 @@
1
1
  import { ChitRenderInstance } from "../rendering/ChitRenderInstance";
2
2
  import { ChitRenderSpec } from "../rendering/ChitRenderSpec";
3
- import { Turn } from "./Turn";
3
+ import type { Turn } from "./Turn";
4
4
  import { FixChildOutlets, NonEditable, Ordered } from "../utilities/Annotations";
5
5
  import { ObjectWithProps } from "../utilities/ObjectWithProps";
6
- import { ChitPick } from "./Pick";
6
+ import { ChitPick, DragPick, DragTarget } from "./Pick";
7
7
  import { Vector2 } from "three";
8
8
  import { OrderedOutlet } from "./OrderedOutlet";
9
9
  import { SparkChit } from "./SparkChit";
@@ -14,7 +14,18 @@ import { ImageSpec } from "../utilities/CanvasStack/CanvasOperations";
14
14
 
15
15
  export const ORDERED_CHILDREN = "orderedChildren";
16
16
 
17
+ const EXTRA_SERIALIZATION_PROPS_ARRAY = [
18
+ "id",
19
+ "_parent",
20
+ "_parentOutlet",
21
+ "_parentOutletIndex",
22
+ "_parentFallback",
23
+ "__hiddenProps",
24
+ ];
25
+ const EXTRA_SERIALIZATION_PROPS_SET = new Set(EXTRA_SERIALIZATION_PROPS_ARRAY);
26
+
17
27
  export type ChitClick = () => void;
28
+ export type ChitDrag = (dropOn: Chit) => void;
18
29
 
19
30
  export type HiddenPropertySerializationRule = {
20
31
  fields: "all" | string[];
@@ -186,11 +197,32 @@ export class Chit extends ObjectWithProps {
186
197
  this.notifyChange("onClick");
187
198
  }
188
199
 
200
+ @NonEditable
201
+ private _onDrag?: ChitDrag;
202
+
203
+ /** @internal */
204
+ @NonEditable
205
+ public dropTargets?: Chit[];
206
+
207
+ @NonEditable
208
+ public isDropTarget = false;
209
+
210
+ /** @internal */
211
+ public set onDrag(newValue: undefined | ChitDrag) {
212
+ this._onDrag = newValue;
213
+ this.notifyChange("onClick");
214
+ }
215
+
216
+ /** @internal */
217
+ public get onDrag(): undefined | ChitDrag {
218
+ return this._onDrag;
219
+ }
220
+
189
221
  /**
190
222
  * Returns true if the chit is currently clickable
191
223
  */
192
224
  public get isClickable(): boolean {
193
- return !!this.onClick;
225
+ return !!this.onClick || !!this.onDrag;
194
226
  }
195
227
 
196
228
  @NonEditable private _lockedBy?: Turn<any, any, any>;
@@ -378,7 +410,7 @@ export class Chit extends ObjectWithProps {
378
410
  }
379
411
 
380
412
  private get serializationProps() {
381
- return [...this.props, "id", "_parent", "_parentOutlet", "_parentOutletIndex", "_parentFallback"];
413
+ return [...this.props, ...EXTRA_SERIALIZATION_PROPS_ARRAY];
382
414
  }
383
415
 
384
416
  /** @internal */
@@ -437,9 +469,13 @@ export class Chit extends ObjectWithProps {
437
469
  }
438
470
  };
439
471
 
440
- this.props.forEach((key) => {
441
- const value = j[key];
472
+ // expanded props will introduce undefined for things that used to be there but aren't
473
+ this.expandedPropsFromJson(j).forEach((key) => {
474
+ if (EXTRA_SERIALIZATION_PROPS_SET.has(key)) {
475
+ return;
476
+ }
442
477
 
478
+ const value = (j as any)[key];
443
479
  if (value?.___orderedOutlet) {
444
480
  (this as any)[key].deserialize(value.___orderedOutlet.map(inflateValue));
445
481
  } else {
@@ -566,6 +602,17 @@ export class Chit extends ObjectWithProps {
566
602
  return result;
567
603
  }
568
604
 
605
+ public static dragPick<T extends Chit>(
606
+ chit: T | (T | undefined | null | false)[] | OrderedOutlet<T>,
607
+ targets: DragTarget<any, T>[],
608
+ ) {
609
+ const result = new DragPick<T>();
610
+ result.chits =
611
+ chit instanceof OrderedOutlet ? chit.copy() : Array.isArray(chit) ? (chit.filter((c) => c) as T[]) : [chit];
612
+ result.dropTargets = targets;
613
+ return result;
614
+ }
615
+
569
616
  /** @internal */
570
617
  public static deletedIfSerialized(): string {
571
618
  return JSON.stringify({
@@ -33,10 +33,14 @@ export class ClientTimeState {
33
33
  public goLive(clock: number) {
34
34
  this.live.value = true;
35
35
  this.targetClock.value = clock;
36
+ this.killAnimations();
37
+ }
38
+
39
+ public killAnimations() {
36
40
  clearTimeout(this._animationOverrideTimeout);
37
41
  this.animationSpeedOverrideMultiplier.value = 0.075;
38
42
  this._animationOverrideTimeout = setTimeout(() => {
39
43
  this.animationSpeedOverrideMultiplier.value = undefined;
40
- }, 250);
44
+ }, 400);
41
45
  }
42
46
  }
@@ -5,6 +5,8 @@ import { Chit } from "./Chit";
5
5
  export class GalleryItemChitChildrenSource implements GalleryItemSource {
6
6
  private unSub: () => void;
7
7
 
8
+ public inlineGallerySize?: number | undefined = undefined;
9
+
8
10
  constructor(public backingObject: Chit) {
9
11
  this.unSub = backingObject.onChange("deserialized", () => {
10
12
  this.cbs.forEach((cb) => cb());
@@ -3,6 +3,8 @@ import { GalleryItem, GalleryItemSource } from "../components/GalleryViewer";
3
3
  export class GalleryItemRawSource implements GalleryItemSource {
4
4
  constructor(private galleryItems: GalleryItem[]) {}
5
5
 
6
+ public inlineGallerySize?: number | undefined = undefined;
7
+
6
8
  get items() {
7
9
  return this.galleryItems;
8
10
  }
@@ -7,6 +7,7 @@ import { PlayerChit } from "./PlayerChit";
7
7
  import { RootChit } from "./RootChit";
8
8
  import { ChitRenderSpec } from "../rendering/ChitRenderSpec";
9
9
  import { TokenDefinition } from "../components/TokenizedMessage";
10
+ import { GameMetaData } from "./GameMetaData";
10
11
 
11
12
  export interface IChitLibrary<P extends PlayerChit, R extends RootChit<P>> {
12
13
  [key: string]: new () => Chit;
@@ -39,10 +40,11 @@ export type GameResult<P extends PlayerChit> = {
39
40
  */
40
41
  export interface Game<P extends PlayerChit, R extends RootChit<P>> {
41
42
  get theme(): GameTheme;
42
- get name(): string;
43
43
  get chitLibrary(): IChitLibrary<P, R>;
44
44
  get canvasLibrary(): ICanvasLibrary;
45
45
  get buttonLibrary(): IButtonLibrary;
46
+ get metadata(): GameMetaData;
47
+
46
48
  tokenMap?: { [key: string]: TokenDefinition };
47
49
 
48
50
  run(setup: Turn<GameResult<P>, P, R>, rootChit: R): Promise<GameResult<P>>;
@@ -52,6 +52,8 @@ export class GameButton {
52
52
  export class ToggleGalleryButton extends GameButton {
53
53
  autoShow = true;
54
54
 
55
+ toggleSmallSize?: number = 125;
56
+
55
57
  /** @internal */
56
58
  parentChit?: Chit;
57
59
 
@@ -86,6 +88,7 @@ export class ToggleGalleryButton extends GameButton {
86
88
  } else {
87
89
  this.galleryItemSource = new GalleryItemRawSource(chitsToGalleryItems(chitPick.chits));
88
90
  }
91
+ this.galleryItemSource.inlineGallerySize = this.toggleSmallSize;
89
92
  }
90
93
  }
91
94
 
@@ -16,6 +16,12 @@ export type Stage<T> = {
16
16
  export class GameDeckChit<T extends Chit> extends Chit {
17
17
  @NonEditable type = "deck";
18
18
 
19
+ /**
20
+ * If true, the contents of chits are shuffled as they are drawn. This should only be used if
21
+ * all chits are of the same class type
22
+ */
23
+ public protectSecrets = true;
24
+
19
25
  public chitGenerator?: () => T;
20
26
  public stages: Stage<T>[] = [];
21
27
 
@@ -33,11 +39,32 @@ export class GameDeckChit<T extends Chit> extends Chit {
33
39
  if (stage) {
34
40
  switch (stage.type) {
35
41
  case "draw": {
36
- const index = Math.floor(stage.chits.length * (await this.currentTurn.rng(message)));
37
- const selected = stage.chits[index];
38
- stage.chits.splice(index, 1);
39
- selected.setParent();
40
- return selected;
42
+ if (this.protectSecrets) {
43
+ const rngs = await this.currentTurn.takeRng(2, message);
44
+ const resultIndex = Math.floor(stage.chits.length * rngs());
45
+ const swapIndex = Math.floor(stage.chits.length * rngs());
46
+ const selected = stage.chits[resultIndex];
47
+ const swap = stage.chits[swapIndex];
48
+
49
+ if (selected.id) {
50
+ const selectedSerialized = selected.serialize();
51
+ const swapSerialized = swap.serialize();
52
+
53
+ selected.deserialize(swapSerialized, this.currentTurn.findChit);
54
+ swap.deserialize(selectedSerialized, this.currentTurn.findChit);
55
+ }
56
+
57
+ stage.chits.splice(resultIndex, 1);
58
+ selected.setParent();
59
+ return selected;
60
+ } else {
61
+ const rng = await this.currentTurn.rng();
62
+ const resultIndex = Math.floor(stage.chits.length * rng);
63
+ const selected = stage.chits[resultIndex];
64
+ stage.chits.splice(resultIndex, 1);
65
+ selected.setParent();
66
+ return selected;
67
+ }
41
68
  }
42
69
  case "discard": {
43
70
  stage.type = "draw";
@@ -51,6 +78,10 @@ export class GameDeckChit<T extends Chit> extends Chit {
51
78
  }
52
79
  }
53
80
 
81
+ public shuffle() {
82
+ this.stages = [{ type: "draw", chits: this.stages.map((stage) => stage.chits).flat() }];
83
+ }
84
+
54
85
  private isEmpty(stage?: Stage<T>) {
55
86
  return stage?.chits.length === 0;
56
87
  }
@@ -0,0 +1,19 @@
1
+ export type GameMetaData = {
2
+ name: string;
3
+ description: string;
4
+ licenseInformation?: string;
5
+ implementationNotes?: string;
6
+ publisher?: string;
7
+ designer?: string;
8
+ artist?: string;
9
+
10
+ tutorialVideoUrl?: string;
11
+ rulesPdfUrl?: string;
12
+ purchaseUrl?: string;
13
+ publisherUrl?: string;
14
+ repositoryUrl?: string;
15
+ bugReportUrl?: string;
16
+
17
+ boxArt: string;
18
+ screenshot: string;
19
+ };
@@ -1,5 +1,7 @@
1
1
  import Color from "color";
2
2
 
3
+ export const DEFAULT_FONT_FAMILY = "Quicksand, sans-serif";
4
+
3
5
  /**
4
6
  * Controls color scheme and layout options for all things in a pretty-chitty game. Much of
5
7
  * this can be overridden per chit, but some cannot. For example, the background color of the game
@@ -11,6 +13,17 @@ import Color from "color";
11
13
  * @group Core Game Elements
12
14
  */
13
15
  export class GameTheme {
16
+ public static defaultFontFamily = DEFAULT_FONT_FAMILY;
17
+
18
+ private _fontFamily = DEFAULT_FONT_FAMILY;
19
+ public get fontFamily() {
20
+ return this._fontFamily;
21
+ }
22
+ public set fontFamily(value: string) {
23
+ this._fontFamily = value;
24
+ GameTheme.defaultFontFamily = value;
25
+ }
26
+
14
27
  public backgroundColor = "#0f0119";
15
28
 
16
29
  public spacing = 8;
@@ -28,13 +41,14 @@ export class GameTheme {
28
41
  public actionBarContextColor = "#3a1957";
29
42
  public actionBarContextAnimationDuration = 0.3;
30
43
  public actionBarContextShadow = "rgba(0,0,0,0.2)";
44
+ public actionBarToggleSelectedColor = "rgba(255,255,255,0.6)";
31
45
 
32
46
  public barTextColor = "rgba(255,255,255,0.6)";
33
47
  public barTextHighlightColor = "rgba(255,255,255,0.6)";
34
48
  public barBreak = "rgba(255,255,255,0.3)";
35
49
  public barActiveTextColor = "rgba(255,255,255,0.9)";
36
50
  public barHighlightTextColor = "#66d5c1";
37
- public barDisabledTextColor = "rgba(255,255,255,0.2)";
51
+ public barDisabledTextColor = "rgba(255,255,255,0.3)";
38
52
  public panelSlotColor = "#858b99";
39
53
  public panelSlotSelectedColor = "#66d5c1";
40
54
  public fullResetColor = "#66d5c1";
@@ -69,6 +83,8 @@ export class GameTheme {
69
83
  public galleryItemWidth = 150;
70
84
  public galleryItemHeight: number | undefined;
71
85
  public galleryItemSpacing = 20;
86
+ public galleryItemMinimumWidth = 75;
87
+ public galleryItemMinimumHeight = 50;
72
88
 
73
89
  public gallerySummaryBackgroundColor = "#000000";
74
90
  public gallerySummaryBackgroundOpacity = 0.7;
@@ -79,6 +95,9 @@ export class GameTheme {
79
95
  public actionLogTextColor = "#ffffff";
80
96
  public actionBarWidth = 600;
81
97
  public actionBarLinesToShow = 2;
98
+ public inlineGalleryBackgroundColor = "rgba(255,255,255,0.1)";
99
+ public inlineGalleryButtonBackgroundColor = "#000000";
100
+ public inlineGalleryButtonForegroundColor = "rgba(255,255,255,0.5)";
82
101
 
83
102
  /** Reference to .png or .jpg file to show as box art in advertising the game */
84
103
  public boxArt = "";
@@ -96,6 +115,9 @@ export class GameTheme {
96
115
  result.barHighlightTextColor = highlight;
97
116
  result.barTopDropdownColor = Color(primaryColor).mix(Color(highlight), 0.1).alpha(0.9).hexa();
98
117
  result.barTextHighlightColor = highlight;
118
+ result.actionBarToggleSelectedColor = primaryColor;
119
+
120
+ result.inlineGalleryButtonBackgroundColor = primaryColor;
99
121
 
100
122
  result.endGameBackgroundColor = result.barTopDropdownColor;
101
123
 
@@ -106,10 +128,6 @@ export class GameTheme {
106
128
  result.barTopLineColor = Color(textColor).alpha(0.1).hexa();
107
129
  result.endGameTextColor = Color(textColor).alpha(1).hexa();
108
130
 
109
- result.barDisabledTextColor = Color(result.barColor).isLight()
110
- ? Color(result.barColor).darken(0.75).hexa()
111
- : Color(result.barColor).lighten(0.75).hexa();
112
-
113
131
  result.actionLogTextColor = result.barActiveTextColor;
114
132
  result.actionLogDialogBackgroundColor = result.backgroundColor;
115
133