@pretty-chitty/core 1.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +51 -0
- package/README.md +152 -0
- package/dist/0e0a96423fd742218c61.woff2 +0 -0
- package/dist/1e28c9f184923aacc181.woff +0 -0
- package/dist/37f3b2ddcbe588b2aaa5.jpg +0 -0
- package/dist/3f0fb9058a03e14ad2fa.jpg +0 -0
- package/dist/4482e08504d544757971.woff2 +0 -0
- package/dist/5212361bfd059a27e2da.woff2 +0 -0
- package/dist/699b459f21e39ca4b8df.woff2 +0 -0
- package/dist/7e339dfbea59fe54f2e3.png +0 -0
- package/dist/a3e6d4ebd8f859f0f1dc.woff +0 -0
- package/dist/b8b0d3bc0d26444e4a5a.woff2 +0 -0
- package/dist/bce9a6fcc5b3da9a086a.woff +0 -0
- package/dist/components/ActionLogDisplay.d.ts +4 -0
- package/dist/components/ActionLogDisplay.d.ts.map +1 -0
- package/dist/components/ActionLogDisplay.js +144 -0
- package/dist/components/ActionLogDisplay.js.map +1 -0
- package/dist/components/ActionLogHistory.d.ts +6 -0
- package/dist/components/ActionLogHistory.d.ts.map +1 -0
- package/dist/components/ActionLogHistory.js +81 -0
- package/dist/components/ActionLogHistory.js.map +1 -0
- package/dist/components/ActionLogHistoryDisplay.d.ts +2 -0
- package/dist/components/ActionLogHistoryDisplay.d.ts.map +1 -0
- package/dist/components/ActionLogHistoryDisplay.js +17 -0
- package/dist/components/ActionLogHistoryDisplay.js.map +1 -0
- package/dist/components/ActionLogSidebar.d.ts +2 -0
- package/dist/components/ActionLogSidebar.d.ts.map +1 -0
- package/dist/components/ActionLogSidebar.js +9 -0
- package/dist/components/ActionLogSidebar.js.map +1 -0
- package/dist/components/BottomBar.d.ts +2 -0
- package/dist/components/BottomBar.d.ts.map +1 -0
- package/dist/components/BottomBar.js +33 -0
- package/dist/components/BottomBar.js.map +1 -0
- package/dist/components/BottomBarBreak.d.ts +2 -0
- package/dist/components/BottomBarBreak.d.ts.map +1 -0
- package/dist/components/BottomBarBreak.js +8 -0
- package/dist/components/BottomBarBreak.js.map +1 -0
- package/dist/components/BottomBarButton.d.ts +16 -0
- package/dist/components/BottomBarButton.d.ts.map +1 -0
- package/dist/components/BottomBarButton.js +123 -0
- package/dist/components/BottomBarButton.js.map +1 -0
- package/dist/components/CanvasLibraryViewer.d.ts +8 -0
- package/dist/components/CanvasLibraryViewer.d.ts.map +1 -0
- package/dist/components/CanvasLibraryViewer.js +29 -0
- package/dist/components/CanvasLibraryViewer.js.map +1 -0
- package/dist/components/ChitLibraryViewer.d.ts +8 -0
- package/dist/components/ChitLibraryViewer.d.ts.map +1 -0
- package/dist/components/ChitLibraryViewer.js +101 -0
- package/dist/components/ChitLibraryViewer.js.map +1 -0
- package/dist/components/ClientTrustMatchViewer.d.ts +11 -0
- package/dist/components/ClientTrustMatchViewer.d.ts.map +1 -0
- package/dist/components/ClientTrustMatchViewer.js +53 -0
- package/dist/components/ClientTrustMatchViewer.js.map +1 -0
- package/dist/components/ContextGalleryDisplay.d.ts +4 -0
- package/dist/components/ContextGalleryDisplay.d.ts.map +1 -0
- package/dist/components/ContextGalleryDisplay.js +49 -0
- package/dist/components/ContextGalleryDisplay.js.map +1 -0
- package/dist/components/GalleryDisplay.d.ts +2 -0
- package/dist/components/GalleryDisplay.d.ts.map +1 -0
- package/dist/components/GalleryDisplay.js +42 -0
- package/dist/components/GalleryDisplay.js.map +1 -0
- package/dist/components/GalleryPlayground.d.ts +14 -0
- package/dist/components/GalleryPlayground.d.ts.map +1 -0
- package/dist/components/GalleryPlayground.js +36 -0
- package/dist/components/GalleryPlayground.js.map +1 -0
- package/dist/components/GalleryViewer.d.ts +48 -0
- package/dist/components/GalleryViewer.d.ts.map +1 -0
- package/dist/components/GalleryViewer.js +567 -0
- package/dist/components/GalleryViewer.js.map +1 -0
- package/dist/components/GameDesigner.d.ts +5 -0
- package/dist/components/GameDesigner.d.ts.map +1 -0
- package/dist/components/GameDesigner.js +14 -0
- package/dist/components/GameDesigner.js.map +1 -0
- package/dist/components/GameDialog.d.ts +7 -0
- package/dist/components/GameDialog.d.ts.map +1 -0
- package/dist/components/GameDialog.js +24 -0
- package/dist/components/GameDialog.js.map +1 -0
- package/dist/components/GameModalBackdrop.d.ts +10 -0
- package/dist/components/GameModalBackdrop.d.ts.map +1 -0
- package/dist/components/GameModalBackdrop.js +33 -0
- package/dist/components/GameModalBackdrop.js.map +1 -0
- package/dist/components/GameModalDialog.d.ts +11 -0
- package/dist/components/GameModalDialog.d.ts.map +1 -0
- package/dist/components/GameModalDialog.js +42 -0
- package/dist/components/GameModalDialog.js.map +1 -0
- package/dist/components/LiveButton.d.ts +4 -0
- package/dist/components/LiveButton.d.ts.map +1 -0
- package/dist/components/LiveButton.js +17 -0
- package/dist/components/LiveButton.js.map +1 -0
- package/dist/components/MatchEndDisplay.d.ts +2 -0
- package/dist/components/MatchEndDisplay.d.ts.map +1 -0
- package/dist/components/MatchEndDisplay.js +67 -0
- package/dist/components/MatchEndDisplay.js.map +1 -0
- package/dist/components/MatchViewer.d.ts +5 -0
- package/dist/components/MatchViewer.d.ts.map +1 -0
- package/dist/components/MatchViewer.js +59 -0
- package/dist/components/MatchViewer.js.map +1 -0
- package/dist/components/ObjectWithPropsEditor.d.ts +5 -0
- package/dist/components/ObjectWithPropsEditor.d.ts.map +1 -0
- package/dist/components/ObjectWithPropsEditor.js +88 -0
- package/dist/components/ObjectWithPropsEditor.js.map +1 -0
- package/dist/components/Panel/MultiPanel.d.ts +13 -0
- package/dist/components/Panel/MultiPanel.d.ts.map +1 -0
- package/dist/components/Panel/MultiPanel.js +196 -0
- package/dist/components/Panel/MultiPanel.js.map +1 -0
- package/dist/components/Panel/PanelContents.d.ts +27 -0
- package/dist/components/Panel/PanelContents.d.ts.map +1 -0
- package/dist/components/Panel/PanelContents.js +202 -0
- package/dist/components/Panel/PanelContents.js.map +1 -0
- package/dist/components/Panel/PanelTabStack.d.ts +9 -0
- package/dist/components/Panel/PanelTabStack.d.ts.map +1 -0
- package/dist/components/Panel/PanelTabStack.js +56 -0
- package/dist/components/Panel/PanelTabStack.js.map +1 -0
- package/dist/components/Panel/SinglePanel.d.ts +13 -0
- package/dist/components/Panel/SinglePanel.d.ts.map +1 -0
- package/dist/components/Panel/SinglePanel.js +44 -0
- package/dist/components/Panel/SinglePanel.js.map +1 -0
- package/dist/components/Panel/ViewerWrapper.d.ts +17 -0
- package/dist/components/Panel/ViewerWrapper.d.ts.map +1 -0
- package/dist/components/Panel/ViewerWrapper.js +70 -0
- package/dist/components/Panel/ViewerWrapper.js.map +1 -0
- package/dist/components/Panel/ViewerZoomControls.d.ts +8 -0
- package/dist/components/Panel/ViewerZoomControls.d.ts.map +1 -0
- package/dist/components/Panel/ViewerZoomControls.js +152 -0
- package/dist/components/Panel/ViewerZoomControls.js.map +1 -0
- package/dist/components/Panel/util.d.ts +3 -0
- package/dist/components/Panel/util.d.ts.map +1 -0
- package/dist/components/Panel/util.js +5 -0
- package/dist/components/Panel/util.js.map +1 -0
- package/dist/components/PanelSpark.d.ts +7 -0
- package/dist/components/PanelSpark.d.ts.map +1 -0
- package/dist/components/PanelSpark.js +84 -0
- package/dist/components/PanelSpark.js.map +1 -0
- package/dist/components/PersistentCanvas.d.ts +12 -0
- package/dist/components/PersistentCanvas.d.ts.map +1 -0
- package/dist/components/PersistentCanvas.js +44 -0
- package/dist/components/PersistentCanvas.js.map +1 -0
- package/dist/components/PlayerImage.d.ts +9 -0
- package/dist/components/PlayerImage.d.ts.map +1 -0
- package/dist/components/PlayerImage.js +21 -0
- package/dist/components/PlayerImage.js.map +1 -0
- package/dist/components/Playground.d.ts +9 -0
- package/dist/components/Playground.d.ts.map +1 -0
- package/dist/components/Playground.js +129 -0
- package/dist/components/Playground.js.map +1 -0
- package/dist/components/PromptControls.d.ts +4 -0
- package/dist/components/PromptControls.d.ts.map +1 -0
- package/dist/components/PromptControls.js +87 -0
- package/dist/components/PromptControls.js.map +1 -0
- package/dist/components/SelectableItemAndStage.d.ts +8 -0
- package/dist/components/SelectableItemAndStage.d.ts.map +1 -0
- package/dist/components/SelectableItemAndStage.js +16 -0
- package/dist/components/SelectableItemAndStage.js.map +1 -0
- package/dist/components/SettingsDisplay.d.ts +2 -0
- package/dist/components/SettingsDisplay.d.ts.map +1 -0
- package/dist/components/SettingsDisplay.js +62 -0
- package/dist/components/SettingsDisplay.js.map +1 -0
- package/dist/components/SparkLineChart.d.ts +21 -0
- package/dist/components/SparkLineChart.d.ts.map +1 -0
- package/dist/components/SparkLineChart.js +143 -0
- package/dist/components/SparkLineChart.js.map +1 -0
- package/dist/components/StageAndEditor.d.ts +5 -0
- package/dist/components/StageAndEditor.d.ts.map +1 -0
- package/dist/components/StageAndEditor.js +12 -0
- package/dist/components/StageAndEditor.js.map +1 -0
- package/dist/components/TimeControlBar.d.ts +5 -0
- package/dist/components/TimeControlBar.d.ts.map +1 -0
- package/dist/components/TimeControlBar.js +38 -0
- package/dist/components/TimeControlBar.js.map +1 -0
- package/dist/components/TokenizedMessage.d.ts +13 -0
- package/dist/components/TokenizedMessage.d.ts.map +1 -0
- package/dist/components/TokenizedMessage.js +102 -0
- package/dist/components/TokenizedMessage.js.map +1 -0
- package/dist/components/TopBar.d.ts +4 -0
- package/dist/components/TopBar.d.ts.map +1 -0
- package/dist/components/TopBar.js +47 -0
- package/dist/components/TopBar.js.map +1 -0
- package/dist/components/TopBarDropdown.d.ts +6 -0
- package/dist/components/TopBarDropdown.d.ts.map +1 -0
- package/dist/components/TopBarDropdown.js +69 -0
- package/dist/components/TopBarDropdown.js.map +1 -0
- package/dist/components/TopBarPlayers.d.ts +2 -0
- package/dist/components/TopBarPlayers.d.ts.map +1 -0
- package/dist/components/TopBarPlayers.js +70 -0
- package/dist/components/TopBarPlayers.js.map +1 -0
- package/dist/components/UpdatingCanvasImage.d.ts +7 -0
- package/dist/components/UpdatingCanvasImage.d.ts.map +1 -0
- package/dist/components/UpdatingCanvasImage.js +22 -0
- package/dist/components/UpdatingCanvasImage.js.map +1 -0
- package/dist/components/UpdatingCanvasViewer.d.ts +7 -0
- package/dist/components/UpdatingCanvasViewer.d.ts.map +1 -0
- package/dist/components/UpdatingCanvasViewer.js +50 -0
- package/dist/components/UpdatingCanvasViewer.js.map +1 -0
- package/dist/components/Viewer.d.ts +16 -0
- package/dist/components/Viewer.d.ts.map +1 -0
- package/dist/components/Viewer.js +289 -0
- package/dist/components/Viewer.js.map +1 -0
- package/dist/components/index.d.ts +1 -0
- package/dist/components/index.d.ts.map +1 -0
- package/dist/components/index.js +2 -0
- package/dist/components/index.js.map +1 -0
- package/dist/e085acb5e467d8e85d21.woff +0 -0
- package/dist/e65dff62134b8879e792.woff +0 -0
- package/dist/game/Chit.d.ts +64 -0
- package/dist/game/Chit.d.ts.map +1 -0
- package/dist/game/Chit.js +524 -0
- package/dist/game/Chit.js.map +1 -0
- package/dist/game/ClientTimeState.d.ts +16 -0
- package/dist/game/ClientTimeState.d.ts.map +1 -0
- package/dist/game/ClientTimeState.js +38 -0
- package/dist/game/ClientTimeState.js.map +1 -0
- package/dist/game/ClockDetails.d.ts +9 -0
- package/dist/game/ClockDetails.d.ts.map +1 -0
- package/dist/game/ClockDetails.js +19 -0
- package/dist/game/ClockDetails.js.map +1 -0
- package/dist/game/Connection.d.ts +26 -0
- package/dist/game/Connection.d.ts.map +1 -0
- package/dist/game/Connection.js +99 -0
- package/dist/game/Connection.js.map +1 -0
- package/dist/game/ConnectionObject.d.ts +7 -0
- package/dist/game/ConnectionObject.d.ts.map +1 -0
- package/dist/game/ConnectionObject.js +16 -0
- package/dist/game/ConnectionObject.js.map +1 -0
- package/dist/game/ConnectionTransport.d.ts +17 -0
- package/dist/game/ConnectionTransport.d.ts.map +1 -0
- package/dist/game/ConnectionTransport.js +39 -0
- package/dist/game/ConnectionTransport.js.map +1 -0
- package/dist/game/DropdownChit.d.ts +7 -0
- package/dist/game/DropdownChit.d.ts.map +1 -0
- package/dist/game/DropdownChit.js +29 -0
- package/dist/game/DropdownChit.js.map +1 -0
- package/dist/game/GalleryItemChitChildrenSource.d.ts +12 -0
- package/dist/game/GalleryItemChitChildrenSource.d.ts.map +1 -0
- package/dist/game/GalleryItemChitChildrenSource.js +25 -0
- package/dist/game/GalleryItemChitChildrenSource.js.map +1 -0
- package/dist/game/GalleryItemRawSource.d.ts +9 -0
- package/dist/game/GalleryItemRawSource.d.ts.map +1 -0
- package/dist/game/GalleryItemRawSource.js +13 -0
- package/dist/game/GalleryItemRawSource.js.map +1 -0
- package/dist/game/Game.d.ts +51 -0
- package/dist/game/Game.d.ts.map +1 -0
- package/dist/game/Game.js +2 -0
- package/dist/game/Game.js.map +1 -0
- package/dist/game/GameBagChit.d.ts +16 -0
- package/dist/game/GameBagChit.d.ts.map +1 -0
- package/dist/game/GameBagChit.js +51 -0
- package/dist/game/GameBagChit.js.map +1 -0
- package/dist/game/GameButton.d.ts +30 -0
- package/dist/game/GameButton.d.ts.map +1 -0
- package/dist/game/GameButton.js +115 -0
- package/dist/game/GameButton.js.map +1 -0
- package/dist/game/GameDeckChit.d.ts +23 -0
- package/dist/game/GameDeckChit.d.ts.map +1 -0
- package/dist/game/GameDeckChit.js +79 -0
- package/dist/game/GameDeckChit.js.map +1 -0
- package/dist/game/GameTheme.d.ts +75 -0
- package/dist/game/GameTheme.d.ts.map +1 -0
- package/dist/game/GameTheme.js +103 -0
- package/dist/game/GameTheme.js.map +1 -0
- package/dist/game/Match.d.ts +34 -0
- package/dist/game/Match.d.ts.map +1 -0
- package/dist/game/Match.js +151 -0
- package/dist/game/Match.js.map +1 -0
- package/dist/game/MatchConnection.d.ts +8 -0
- package/dist/game/MatchConnection.d.ts.map +1 -0
- package/dist/game/MatchConnection.js +6 -0
- package/dist/game/MatchConnection.js.map +1 -0
- package/dist/game/MatchStorage.d.ts +17 -0
- package/dist/game/MatchStorage.d.ts.map +1 -0
- package/dist/game/MatchStorage.js +32 -0
- package/dist/game/MatchStorage.js.map +1 -0
- package/dist/game/ModalState.d.ts +9 -0
- package/dist/game/ModalState.d.ts.map +1 -0
- package/dist/game/ModalState.js +27 -0
- package/dist/game/ModalState.js.map +1 -0
- package/dist/game/OrderedOutlet.d.ts +50 -0
- package/dist/game/OrderedOutlet.d.ts.map +1 -0
- package/dist/game/OrderedOutlet.js +164 -0
- package/dist/game/OrderedOutlet.js.map +1 -0
- package/dist/game/Pick.d.ts +26 -0
- package/dist/game/Pick.d.ts.map +1 -0
- package/dist/game/Pick.js +239 -0
- package/dist/game/Pick.js.map +1 -0
- package/dist/game/PlayerChit.d.ts +16 -0
- package/dist/game/PlayerChit.d.ts.map +1 -0
- package/dist/game/PlayerChit.js +56 -0
- package/dist/game/PlayerChit.js.map +1 -0
- package/dist/game/PlayerInfo.d.ts +12 -0
- package/dist/game/PlayerInfo.d.ts.map +1 -0
- package/dist/game/PlayerInfo.js +20 -0
- package/dist/game/PlayerInfo.js.map +1 -0
- package/dist/game/PlayerPromptStatusChit.d.ts +5 -0
- package/dist/game/PlayerPromptStatusChit.d.ts.map +1 -0
- package/dist/game/PlayerPromptStatusChit.js +35 -0
- package/dist/game/PlayerPromptStatusChit.js.map +1 -0
- package/dist/game/Prompt.d.ts +94 -0
- package/dist/game/Prompt.d.ts.map +1 -0
- package/dist/game/Prompt.js +229 -0
- package/dist/game/Prompt.js.map +1 -0
- package/dist/game/RootChit.d.ts +15 -0
- package/dist/game/RootChit.d.ts.map +1 -0
- package/dist/game/RootChit.js +62 -0
- package/dist/game/RootChit.js.map +1 -0
- package/dist/game/SparkChit.d.ts +27 -0
- package/dist/game/SparkChit.d.ts.map +1 -0
- package/dist/game/SparkChit.js +97 -0
- package/dist/game/SparkChit.js.map +1 -0
- package/dist/game/StaticChitTypeRegistry.d.ts +5 -0
- package/dist/game/StaticChitTypeRegistry.d.ts.map +1 -0
- package/dist/game/StaticChitTypeRegistry.js +3 -0
- package/dist/game/StaticChitTypeRegistry.js.map +1 -0
- package/dist/game/Turn.d.ts +169 -0
- package/dist/game/Turn.d.ts.map +1 -0
- package/dist/game/Turn.js +1031 -0
- package/dist/game/Turn.js.map +1 -0
- package/dist/game/TurnState.d.ts +30 -0
- package/dist/game/TurnState.d.ts.map +1 -0
- package/dist/game/TurnState.js +170 -0
- package/dist/game/TurnState.js.map +1 -0
- package/dist/game/clientTransport/ClientPrompts.d.ts +23 -0
- package/dist/game/clientTransport/ClientPrompts.d.ts.map +1 -0
- package/dist/game/clientTransport/ClientPrompts.js +85 -0
- package/dist/game/clientTransport/ClientPrompts.js.map +1 -0
- package/dist/game/clientTransport/ClientStatus.d.ts +19 -0
- package/dist/game/clientTransport/ClientStatus.d.ts.map +1 -0
- package/dist/game/clientTransport/ClientStatus.js +25 -0
- package/dist/game/clientTransport/ClientStatus.js.map +1 -0
- package/dist/game/clientTransport/ClientTime.d.ts +42 -0
- package/dist/game/clientTransport/ClientTime.d.ts.map +1 -0
- package/dist/game/clientTransport/ClientTime.js +197 -0
- package/dist/game/clientTransport/ClientTime.js.map +1 -0
- package/dist/game/index.d.ts +1 -0
- package/dist/game/index.d.ts.map +1 -0
- package/dist/game/index.js +2 -0
- package/dist/game/index.js.map +1 -0
- package/dist/game/serverTransport/ServerPrompts.d.ts +17 -0
- package/dist/game/serverTransport/ServerPrompts.d.ts.map +1 -0
- package/dist/game/serverTransport/ServerPrompts.js +51 -0
- package/dist/game/serverTransport/ServerPrompts.js.map +1 -0
- package/dist/game/serverTransport/ServerStatus.d.ts +12 -0
- package/dist/game/serverTransport/ServerStatus.d.ts.map +1 -0
- package/dist/game/serverTransport/ServerStatus.js +16 -0
- package/dist/game/serverTransport/ServerStatus.js.map +1 -0
- package/dist/game/serverTransport/ServerTime.d.ts +39 -0
- package/dist/game/serverTransport/ServerTime.d.ts.map +1 -0
- package/dist/game/serverTransport/ServerTime.js +57 -0
- package/dist/game/serverTransport/ServerTime.js.map +1 -0
- package/dist/hooks/useChits.d.ts +4 -0
- package/dist/hooks/useChits.d.ts.map +1 -0
- package/dist/hooks/useChits.js +24 -0
- package/dist/hooks/useChits.js.map +1 -0
- package/dist/hooks/useConnection.d.ts +8 -0
- package/dist/hooks/useConnection.d.ts.map +1 -0
- package/dist/hooks/useConnection.js +14 -0
- package/dist/hooks/useConnection.js.map +1 -0
- package/dist/hooks/useEventChannelState.d.ts +4 -0
- package/dist/hooks/useEventChannelState.d.ts.map +1 -0
- package/dist/hooks/useEventChannelState.js +25 -0
- package/dist/hooks/useEventChannelState.js.map +1 -0
- package/dist/hooks/useGame.d.ts +8 -0
- package/dist/hooks/useGame.d.ts.map +1 -0
- package/dist/hooks/useGame.js +14 -0
- package/dist/hooks/useGame.js.map +1 -0
- package/dist/hooks/useGameTheme.d.ts +8 -0
- package/dist/hooks/useGameTheme.d.ts.map +1 -0
- package/dist/hooks/useGameTheme.js +11 -0
- package/dist/hooks/useGameTheme.js.map +1 -0
- package/dist/hooks/useModalState.d.ts +7 -0
- package/dist/hooks/useModalState.d.ts.map +1 -0
- package/dist/hooks/useModalState.js +12 -0
- package/dist/hooks/useModalState.js.map +1 -0
- package/dist/hooks/usePanelPositioning.d.ts +22 -0
- package/dist/hooks/usePanelPositioning.d.ts.map +1 -0
- package/dist/hooks/usePanelPositioning.js +10 -0
- package/dist/hooks/usePanelPositioning.js.map +1 -0
- package/dist/hooks/usePanelScale.d.ts +7 -0
- package/dist/hooks/usePanelScale.d.ts.map +1 -0
- package/dist/hooks/usePanelScale.js +22 -0
- package/dist/hooks/usePanelScale.js.map +1 -0
- package/dist/hooks/usePanelStates.d.ts +9 -0
- package/dist/hooks/usePanelStates.d.ts.map +1 -0
- package/dist/hooks/usePanelStates.js +19 -0
- package/dist/hooks/usePanelStates.js.map +1 -0
- package/dist/hooks/usePlayer.d.ts +7 -0
- package/dist/hooks/usePlayer.d.ts.map +1 -0
- package/dist/hooks/usePlayer.js +14 -0
- package/dist/hooks/usePlayer.js.map +1 -0
- package/dist/hooks/useSmartDebouncedState.d.ts +27 -0
- package/dist/hooks/useSmartDebouncedState.d.ts.map +1 -0
- package/dist/hooks/useSmartDebouncedState.js +109 -0
- package/dist/hooks/useSmartDebouncedState.js.map +1 -0
- package/dist/hooks/useTimeController.d.ts +22 -0
- package/dist/hooks/useTimeController.d.ts.map +1 -0
- package/dist/hooks/useTimeController.js +89 -0
- package/dist/hooks/useTimeController.js.map +1 -0
- package/dist/hooks/useTokenMap.d.ts +5 -0
- package/dist/hooks/useTokenMap.d.ts.map +1 -0
- package/dist/hooks/useTokenMap.js +16 -0
- package/dist/hooks/useTokenMap.js.map +1 -0
- package/dist/hooks/useWebGlRenderer.d.ts +34 -0
- package/dist/hooks/useWebGlRenderer.d.ts.map +1 -0
- package/dist/hooks/useWebGlRenderer.js +167 -0
- package/dist/hooks/useWebGlRenderer.js.map +1 -0
- package/dist/index.d.ts +97 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.html +12 -0
- package/dist/index.js +62 -0
- package/dist/index.js.map +1 -0
- package/dist/pretty-chitty.js +190767 -0
- package/dist/pretty-chitty.js.map +1 -0
- package/dist/rendering/CameraSpec.d.ts +22 -0
- package/dist/rendering/CameraSpec.d.ts.map +1 -0
- package/dist/rendering/CameraSpec.js +25 -0
- package/dist/rendering/CameraSpec.js.map +1 -0
- package/dist/rendering/CameraWrapperPerspective.d.ts +44 -0
- package/dist/rendering/CameraWrapperPerspective.d.ts.map +1 -0
- package/dist/rendering/CameraWrapperPerspective.js +481 -0
- package/dist/rendering/CameraWrapperPerspective.js.map +1 -0
- package/dist/rendering/ChitGalleryItemInstance.d.ts +31 -0
- package/dist/rendering/ChitGalleryItemInstance.d.ts.map +1 -0
- package/dist/rendering/ChitGalleryItemInstance.js +75 -0
- package/dist/rendering/ChitGalleryItemInstance.js.map +1 -0
- package/dist/rendering/ChitRenderInstance.d.ts +104 -0
- package/dist/rendering/ChitRenderInstance.d.ts.map +1 -0
- package/dist/rendering/ChitRenderInstance.js +902 -0
- package/dist/rendering/ChitRenderInstance.js.map +1 -0
- package/dist/rendering/ChitRenderSpec.d.ts +80 -0
- package/dist/rendering/ChitRenderSpec.d.ts.map +1 -0
- package/dist/rendering/ChitRenderSpec.js +152 -0
- package/dist/rendering/ChitRenderSpec.js.map +1 -0
- package/dist/rendering/HighlightSpec.d.ts +6 -0
- package/dist/rendering/HighlightSpec.d.ts.map +1 -0
- package/dist/rendering/HighlightSpec.js +6 -0
- package/dist/rendering/HighlightSpec.js.map +1 -0
- package/dist/rendering/LightSpec.d.ts +17 -0
- package/dist/rendering/LightSpec.d.ts.map +1 -0
- package/dist/rendering/LightSpec.js +37 -0
- package/dist/rendering/LightSpec.js.map +1 -0
- package/dist/rendering/LightWrapper.d.ts +19 -0
- package/dist/rendering/LightWrapper.d.ts.map +1 -0
- package/dist/rendering/LightWrapper.js +114 -0
- package/dist/rendering/LightWrapper.js.map +1 -0
- package/dist/rendering/RootChitRenderInstance.d.ts +81 -0
- package/dist/rendering/RootChitRenderInstance.d.ts.map +1 -0
- package/dist/rendering/RootChitRenderInstance.js +372 -0
- package/dist/rendering/RootChitRenderInstance.js.map +1 -0
- package/dist/rendering/Splay.d.ts +23 -0
- package/dist/rendering/Splay.d.ts.map +1 -0
- package/dist/rendering/Splay.js +89 -0
- package/dist/rendering/Splay.js.map +1 -0
- package/dist/rendering/SplayCounter.d.ts +19 -0
- package/dist/rendering/SplayCounter.d.ts.map +1 -0
- package/dist/rendering/SplayCounter.js +18 -0
- package/dist/rendering/SplayCounter.js.map +1 -0
- package/dist/rendering/TextureReferenceCounter.d.ts +12 -0
- package/dist/rendering/TextureReferenceCounter.d.ts.map +1 -0
- package/dist/rendering/TextureReferenceCounter.js +76 -0
- package/dist/rendering/TextureReferenceCounter.js.map +1 -0
- package/dist/rendering/index.d.ts +1 -0
- package/dist/rendering/index.d.ts.map +1 -0
- package/dist/rendering/index.js +2 -0
- package/dist/rendering/index.js.map +1 -0
- package/dist/rendering/outline/DepthVisualizationPass.d.ts +12 -0
- package/dist/rendering/outline/DepthVisualizationPass.d.ts.map +1 -0
- package/dist/rendering/outline/DepthVisualizationPass.js +93 -0
- package/dist/rendering/outline/DepthVisualizationPass.js.map +1 -0
- package/dist/rendering/outline/EffectComposer.d.ts +24 -0
- package/dist/rendering/outline/EffectComposer.d.ts.map +1 -0
- package/dist/rendering/outline/EffectComposer.js +118 -0
- package/dist/rendering/outline/EffectComposer.js.map +1 -0
- package/dist/rendering/outline/FullScreenQuad.d.ts +12 -0
- package/dist/rendering/outline/FullScreenQuad.d.ts.map +1 -0
- package/dist/rendering/outline/FullScreenQuad.js +21 -0
- package/dist/rendering/outline/FullScreenQuad.js.map +1 -0
- package/dist/rendering/outline/IDBasedOutlinePass.d.ts +49 -0
- package/dist/rendering/outline/IDBasedOutlinePass.d.ts.map +1 -0
- package/dist/rendering/outline/IDBasedOutlinePass.js +597 -0
- package/dist/rendering/outline/IDBasedOutlinePass.js.map +1 -0
- package/dist/rendering/outline/OutputPass.d.ts +13 -0
- package/dist/rendering/outline/OutputPass.d.ts.map +1 -0
- package/dist/rendering/outline/OutputPass.js +57 -0
- package/dist/rendering/outline/OutputPass.js.map +1 -0
- package/dist/rendering/outline/RenderPass.d.ts +13 -0
- package/dist/rendering/outline/RenderPass.d.ts.map +1 -0
- package/dist/rendering/outline/RenderPass.js +54 -0
- package/dist/rendering/outline/RenderPass.js.map +1 -0
- package/dist/rendering/outline/SceneWrapper.d.ts +39 -0
- package/dist/rendering/outline/SceneWrapper.d.ts.map +1 -0
- package/dist/rendering/outline/SceneWrapper.js +522 -0
- package/dist/rendering/outline/SceneWrapper.js.map +1 -0
- package/dist/rendering/outline/ShaderPass.d.ts +12 -0
- package/dist/rendering/outline/ShaderPass.d.ts.map +1 -0
- package/dist/rendering/outline/ShaderPass.js +43 -0
- package/dist/rendering/outline/ShaderPass.js.map +1 -0
- package/dist/rendering/outline/index.d.ts +8 -0
- package/dist/rendering/outline/index.d.ts.map +1 -0
- package/dist/rendering/outline/index.js +8 -0
- package/dist/rendering/outline/index.js.map +1 -0
- package/dist/rendering/outline/passes/DebugIDMappingPass.d.ts +20 -0
- package/dist/rendering/outline/passes/DebugIDMappingPass.d.ts.map +1 -0
- package/dist/rendering/outline/passes/DebugIDMappingPass.js +131 -0
- package/dist/rendering/outline/passes/DebugIDMappingPass.js.map +1 -0
- package/dist/rendering/outline/passes/DepthOcclusionPass.d.ts +24 -0
- package/dist/rendering/outline/passes/DepthOcclusionPass.d.ts.map +1 -0
- package/dist/rendering/outline/passes/DepthOcclusionPass.js +95 -0
- package/dist/rendering/outline/passes/DepthOcclusionPass.js.map +1 -0
- package/dist/rendering/outline/passes/InterMeshEdgeDetectionPass.d.ts +32 -0
- package/dist/rendering/outline/passes/InterMeshEdgeDetectionPass.d.ts.map +1 -0
- package/dist/rendering/outline/passes/InterMeshEdgeDetectionPass.js +208 -0
- package/dist/rendering/outline/passes/InterMeshEdgeDetectionPass.js.map +1 -0
- package/dist/rendering/outline/shaders.d.ts +20 -0
- package/dist/rendering/outline/shaders.d.ts.map +1 -0
- package/dist/rendering/outline/shaders.js +103 -0
- package/dist/rendering/outline/shaders.js.map +1 -0
- package/dist/rendering/outline/types.d.ts +14 -0
- package/dist/rendering/outline/types.d.ts.map +1 -0
- package/dist/rendering/outline/types.js +16 -0
- package/dist/rendering/outline/types.js.map +1 -0
- package/dist/utilities/Annotations.d.ts +60 -0
- package/dist/utilities/Annotations.d.ts.map +1 -0
- package/dist/utilities/Annotations.js +171 -0
- package/dist/utilities/Annotations.js.map +1 -0
- package/dist/utilities/BaseTable.d.ts +8 -0
- package/dist/utilities/BaseTable.d.ts.map +1 -0
- package/dist/utilities/BaseTable.js +35 -0
- package/dist/utilities/BaseTable.js.map +1 -0
- package/dist/utilities/BboxUtils.d.ts +3 -0
- package/dist/utilities/BboxUtils.d.ts.map +1 -0
- package/dist/utilities/BboxUtils.js +19 -0
- package/dist/utilities/BboxUtils.js.map +1 -0
- package/dist/utilities/CanvasStack/CanvasOperations.d.ts +140 -0
- package/dist/utilities/CanvasStack/CanvasOperations.d.ts.map +1 -0
- package/dist/utilities/CanvasStack/CanvasOperations.js +403 -0
- package/dist/utilities/CanvasStack/CanvasOperations.js.map +1 -0
- package/dist/utilities/CanvasStack/CanvasStack.d.ts +42 -0
- package/dist/utilities/CanvasStack/CanvasStack.d.ts.map +1 -0
- package/dist/utilities/CanvasStack/CanvasStack.js +128 -0
- package/dist/utilities/CanvasStack/CanvasStack.js.map +1 -0
- package/dist/utilities/CanvasStack/IconCanvas.d.ts +10 -0
- package/dist/utilities/CanvasStack/IconCanvas.d.ts.map +1 -0
- package/dist/utilities/CanvasStack/IconCanvas.js +15 -0
- package/dist/utilities/CanvasStack/IconCanvas.js.map +1 -0
- package/dist/utilities/CanvasStack/ImageCache.d.ts +8 -0
- package/dist/utilities/CanvasStack/ImageCache.d.ts.map +1 -0
- package/dist/utilities/CanvasStack/ImageCache.js +29 -0
- package/dist/utilities/CanvasStack/ImageCache.js.map +1 -0
- package/dist/utilities/CanvasStack/ImageColorOverlayer.d.ts +2 -0
- package/dist/utilities/CanvasStack/ImageColorOverlayer.d.ts.map +1 -0
- package/dist/utilities/CanvasStack/ImageColorOverlayer.js +31 -0
- package/dist/utilities/CanvasStack/ImageColorOverlayer.js.map +1 -0
- package/dist/utilities/CanvasStack/PlayerCanvas.d.ts +10 -0
- package/dist/utilities/CanvasStack/PlayerCanvas.d.ts.map +1 -0
- package/dist/utilities/CanvasStack/PlayerCanvas.js +15 -0
- package/dist/utilities/CanvasStack/PlayerCanvas.js.map +1 -0
- package/dist/utilities/CanvasStack/ReactCanvas.d.ts +133 -0
- package/dist/utilities/CanvasStack/ReactCanvas.d.ts.map +1 -0
- package/dist/utilities/CanvasStack/ReactCanvas.js +161 -0
- package/dist/utilities/CanvasStack/ReactCanvas.js.map +1 -0
- package/dist/utilities/CanvasStack/RichTextRenderer.d.ts +63 -0
- package/dist/utilities/CanvasStack/RichTextRenderer.d.ts.map +1 -0
- package/dist/utilities/CanvasStack/RichTextRenderer.js +523 -0
- package/dist/utilities/CanvasStack/RichTextRenderer.js.map +1 -0
- package/dist/utilities/CardMesh.d.ts +17 -0
- package/dist/utilities/CardMesh.d.ts.map +1 -0
- package/dist/utilities/CardMesh.js +44 -0
- package/dist/utilities/CardMesh.js.map +1 -0
- package/dist/utilities/Dice.d.ts +24 -0
- package/dist/utilities/Dice.d.ts.map +1 -0
- package/dist/utilities/Dice.js +148 -0
- package/dist/utilities/Dice.js.map +1 -0
- package/dist/utilities/EventChannel.d.ts +13 -0
- package/dist/utilities/EventChannel.d.ts.map +1 -0
- package/dist/utilities/EventChannel.js +47 -0
- package/dist/utilities/EventChannel.js.map +1 -0
- package/dist/utilities/GalleryItemConversion.d.ts +4 -0
- package/dist/utilities/GalleryItemConversion.d.ts.map +1 -0
- package/dist/utilities/GalleryItemConversion.js +28 -0
- package/dist/utilities/GalleryItemConversion.js.map +1 -0
- package/dist/utilities/IUpdatingCanvas.d.ts +19 -0
- package/dist/utilities/IUpdatingCanvas.d.ts.map +1 -0
- package/dist/utilities/IUpdatingCanvas.js +2 -0
- package/dist/utilities/IUpdatingCanvas.js.map +1 -0
- package/dist/utilities/LayoutHelper.d.ts +34 -0
- package/dist/utilities/LayoutHelper.d.ts.map +1 -0
- package/dist/utilities/LayoutHelper.js +451 -0
- package/dist/utilities/LayoutHelper.js.map +1 -0
- package/dist/utilities/ObjectWithProps.d.ts +5 -0
- package/dist/utilities/ObjectWithProps.d.ts.map +1 -0
- package/dist/utilities/ObjectWithProps.js +65 -0
- package/dist/utilities/ObjectWithProps.js.map +1 -0
- package/dist/utilities/OutlineCanvas.d.ts +12 -0
- package/dist/utilities/OutlineCanvas.d.ts.map +1 -0
- package/dist/utilities/OutlineCanvas.js +31 -0
- package/dist/utilities/OutlineCanvas.js.map +1 -0
- package/dist/utilities/OutlineGeometry.d.ts +3 -0
- package/dist/utilities/OutlineGeometry.d.ts.map +1 -0
- package/dist/utilities/OutlineGeometry.js +57 -0
- package/dist/utilities/OutlineGeometry.js.map +1 -0
- package/dist/utilities/ParameterizedCanvas.d.ts +13 -0
- package/dist/utilities/ParameterizedCanvas.d.ts.map +1 -0
- package/dist/utilities/ParameterizedCanvas.js +85 -0
- package/dist/utilities/ParameterizedCanvas.js.map +1 -0
- package/dist/utilities/RequestSharedAnimationFrame.d.ts +2 -0
- package/dist/utilities/RequestSharedAnimationFrame.d.ts.map +1 -0
- package/dist/utilities/RequestSharedAnimationFrame.js +16 -0
- package/dist/utilities/RequestSharedAnimationFrame.js.map +1 -0
- package/dist/utilities/StaticImage.d.ts +19 -0
- package/dist/utilities/StaticImage.d.ts.map +1 -0
- package/dist/utilities/StaticImage.js +38 -0
- package/dist/utilities/StaticImage.js.map +1 -0
- package/dist/utilities/SvgExtruder.d.ts +20 -0
- package/dist/utilities/SvgExtruder.d.ts.map +1 -0
- package/dist/utilities/SvgExtruder.js +238 -0
- package/dist/utilities/SvgExtruder.js.map +1 -0
- package/dist/utilities/ThreeDisposer.d.ts +11 -0
- package/dist/utilities/ThreeDisposer.d.ts.map +1 -0
- package/dist/utilities/ThreeDisposer.js +53 -0
- package/dist/utilities/ThreeDisposer.js.map +1 -0
- package/dist/utilities/zIndex.d.ts +14 -0
- package/dist/utilities/zIndex.d.ts.map +1 -0
- package/dist/utilities/zIndex.js +14 -0
- package/dist/utilities/zIndex.js.map +1 -0
- package/package.json +138 -0
- package/src/library/assets/checker.svg +4 -0
- package/src/library/assets/cutout.svg +22 -0
- package/src/library/components/ActionLogDisplay.tsx +183 -0
- package/src/library/components/ActionLogHistory.tsx +127 -0
- package/src/library/components/ActionLogHistoryDisplay.tsx +21 -0
- package/src/library/components/ActionLogSidebar.tsx +17 -0
- package/src/library/components/BottomBar.tsx +78 -0
- package/src/library/components/BottomBarBreak.tsx +12 -0
- package/src/library/components/BottomBarButton.tsx +181 -0
- package/src/library/components/CanvasLibraryViewer.tsx +86 -0
- package/src/library/components/ChitLibraryViewer.tsx +168 -0
- package/src/library/components/ClientTrustMatchViewer.tsx +83 -0
- package/src/library/components/ContextGalleryDisplay.tsx +72 -0
- package/src/library/components/GalleryDisplay.tsx +57 -0
- package/src/library/components/GalleryPlayground.tsx +50 -0
- package/src/library/components/GalleryViewer.tsx +773 -0
- package/src/library/components/GameDesigner.tsx +39 -0
- package/src/library/components/GameDialog.tsx +43 -0
- package/src/library/components/GameModalBackdrop.tsx +47 -0
- package/src/library/components/GameModalDialog.tsx +77 -0
- package/src/library/components/LiveButton.tsx +26 -0
- package/src/library/components/MatchEndDisplay.tsx +120 -0
- package/src/library/components/MatchViewer.tsx +111 -0
- package/src/library/components/ObjectWithPropsEditor.tsx +169 -0
- package/src/library/components/Panel/MultiPanel.tsx +276 -0
- package/src/library/components/Panel/PanelContents.tsx +359 -0
- package/src/library/components/Panel/PanelTabStack.tsx +103 -0
- package/src/library/components/Panel/SinglePanel.tsx +75 -0
- package/src/library/components/Panel/ViewerWrapper.tsx +131 -0
- package/src/library/components/Panel/ViewerZoomControls.tsx +216 -0
- package/src/library/components/Panel/util.ts +7 -0
- package/src/library/components/PanelSpark.tsx +112 -0
- package/src/library/components/PersistentCanvas.tsx +81 -0
- package/src/library/components/PlayerImage.tsx +40 -0
- package/src/library/components/Playground.tsx +285 -0
- package/src/library/components/PromptControls.tsx +132 -0
- package/src/library/components/SelectableItemAndStage.tsx +49 -0
- package/src/library/components/SettingsDisplay.tsx +142 -0
- package/src/library/components/SparkLineChart.tsx +307 -0
- package/src/library/components/StageAndEditor.tsx +28 -0
- package/src/library/components/TimeControlBar.tsx +71 -0
- package/src/library/components/TokenizedMessage.tsx +206 -0
- package/src/library/components/TopBar.tsx +90 -0
- package/src/library/components/TopBarDropdown.tsx +94 -0
- package/src/library/components/TopBarPlayers.tsx +163 -0
- package/src/library/components/UpdatingCanvasImage.tsx +25 -0
- package/src/library/components/UpdatingCanvasViewer.tsx +62 -0
- package/src/library/components/Viewer.tsx +360 -0
- package/src/library/components/index.ts +0 -0
- package/src/library/game/Chit.test.ts +66 -0
- package/src/library/game/Chit.ts +575 -0
- package/src/library/game/ClientTimeState.ts +42 -0
- package/src/library/game/ClockDetails.ts +24 -0
- package/src/library/game/Connection.test.ts +50 -0
- package/src/library/game/Connection.ts +122 -0
- package/src/library/game/ConnectionObject.ts +13 -0
- package/src/library/game/ConnectionTransport.ts +52 -0
- package/src/library/game/DropdownChit.tsx +17 -0
- package/src/library/game/GalleryItemChitChildrenSource.ts +31 -0
- package/src/library/game/GalleryItemRawSource.ts +15 -0
- package/src/library/game/Game.ts +55 -0
- package/src/library/game/GameBagChit.ts +42 -0
- package/src/library/game/GameButton.ts +127 -0
- package/src/library/game/GameDeckChit.ts +77 -0
- package/src/library/game/GameTheme.ts +122 -0
- package/src/library/game/Match.ts +187 -0
- package/src/library/game/MatchConnection.ts +5 -0
- package/src/library/game/MatchStorage.ts +51 -0
- package/src/library/game/ModalState.ts +29 -0
- package/src/library/game/OrderedOutlet.ts +198 -0
- package/src/library/game/Pick.ts +314 -0
- package/src/library/game/PlayerChit.ts +43 -0
- package/src/library/game/PlayerInfo.ts +30 -0
- package/src/library/game/PlayerPromptStatusChit.ts +20 -0
- package/src/library/game/Prompt.ts +292 -0
- package/src/library/game/RootChit.ts +54 -0
- package/src/library/game/SparkChit.ts +97 -0
- package/src/library/game/StaticChitTypeRegistry.ts +3 -0
- package/src/library/game/Turn.test.ts +611 -0
- package/src/library/game/Turn.ts +1249 -0
- package/src/library/game/TurnState.ts +187 -0
- package/src/library/game/clientTransport/ClientPrompts.ts +102 -0
- package/src/library/game/clientTransport/ClientStatus.ts +36 -0
- package/src/library/game/clientTransport/ClientTime.ts +256 -0
- package/src/library/game/index.ts +0 -0
- package/src/library/game/serverTransport/ServerPrompts.ts +76 -0
- package/src/library/game/serverTransport/ServerStatus.ts +31 -0
- package/src/library/game/serverTransport/ServerTime.ts +74 -0
- package/src/library/hooks/useChits.ts +32 -0
- package/src/library/hooks/useConnection.tsx +16 -0
- package/src/library/hooks/useEventChannelState.ts +33 -0
- package/src/library/hooks/useGame.tsx +16 -0
- package/src/library/hooks/useGameTheme.tsx +12 -0
- package/src/library/hooks/useModalState.tsx +13 -0
- package/src/library/hooks/usePanelPositioning.tsx +31 -0
- package/src/library/hooks/usePanelScale.tsx +23 -0
- package/src/library/hooks/usePanelStates.ts +30 -0
- package/src/library/hooks/usePlayer.tsx +15 -0
- package/src/library/hooks/useSmartDebouncedState.ts +161 -0
- package/src/library/hooks/useTimeController.tsx +108 -0
- package/src/library/hooks/useTokenMap.ts +20 -0
- package/src/library/hooks/useWebGlRenderer.tsx +227 -0
- package/src/library/index.ts +116 -0
- package/src/library/rendering/CameraSpec.ts +25 -0
- package/src/library/rendering/CameraWrapperPerspective.ts +612 -0
- package/src/library/rendering/ChitGalleryItemInstance.ts +108 -0
- package/src/library/rendering/ChitRenderInstance.ts +1141 -0
- package/src/library/rendering/ChitRenderSpec.ts +213 -0
- package/src/library/rendering/HighlightSpec.ts +5 -0
- package/src/library/rendering/LightSpec.ts +41 -0
- package/src/library/rendering/LightWrapper.ts +152 -0
- package/src/library/rendering/RootChitRenderInstance.ts +460 -0
- package/src/library/rendering/Splay.ts +118 -0
- package/src/library/rendering/SplayCounter.tsx +37 -0
- package/src/library/rendering/TextureReferenceCounter.ts +86 -0
- package/src/library/rendering/index.ts +0 -0
- package/src/library/rendering/outline/DepthVisualizationPass.ts +117 -0
- package/src/library/rendering/outline/EffectComposer.ts +187 -0
- package/src/library/rendering/outline/FullScreenQuad.ts +32 -0
- package/src/library/rendering/outline/IDBasedOutlinePass.ts +741 -0
- package/src/library/rendering/outline/OutputPass.ts +88 -0
- package/src/library/rendering/outline/RenderPass.ts +72 -0
- package/src/library/rendering/outline/SceneWrapper.ts +617 -0
- package/src/library/rendering/outline/ShaderPass.ts +50 -0
- package/src/library/rendering/outline/index.ts +8 -0
- package/src/library/rendering/outline/passes/DebugIDMappingPass.ts +154 -0
- package/src/library/rendering/outline/passes/DepthOcclusionPass.ts +106 -0
- package/src/library/rendering/outline/passes/InterMeshEdgeDetectionPass.ts +244 -0
- package/src/library/rendering/outline/shaders.ts +110 -0
- package/src/library/rendering/outline/types.ts +25 -0
- package/src/library/utilities/Annotations.ts +188 -0
- package/src/library/utilities/BaseTable.tsx +58 -0
- package/src/library/utilities/BboxUtils.ts +23 -0
- package/src/library/utilities/CanvasStack/CanvasOperations.tsx +630 -0
- package/src/library/utilities/CanvasStack/CanvasStack.ts +191 -0
- package/src/library/utilities/CanvasStack/IconCanvas.tsx +17 -0
- package/src/library/utilities/CanvasStack/ImageCache.ts +38 -0
- package/src/library/utilities/CanvasStack/ImageColorOverlayer.ts +36 -0
- package/src/library/utilities/CanvasStack/PlayerCanvas.tsx +17 -0
- package/src/library/utilities/CanvasStack/ReactCanvas.tsx +293 -0
- package/src/library/utilities/CanvasStack/RichTextRenderer.ts +719 -0
- package/src/library/utilities/CardMesh.ts +55 -0
- package/src/library/utilities/Dice.tsx +183 -0
- package/src/library/utilities/EventChannel.ts +52 -0
- package/src/library/utilities/GalleryItemConversion.ts +30 -0
- package/src/library/utilities/IUpdatingCanvas.ts +14 -0
- package/src/library/utilities/LayoutHelper.ts +586 -0
- package/src/library/utilities/ObjectWithProps.ts +52 -0
- package/src/library/utilities/OutlineCanvas.tsx +45 -0
- package/src/library/utilities/OutlineGeometry.ts +69 -0
- package/src/library/utilities/ParameterizedCanvas.ts +78 -0
- package/src/library/utilities/RequestSharedAnimationFrame.ts +16 -0
- package/src/library/utilities/StaticImage.tsx +58 -0
- package/src/library/utilities/SvgExtruder.ts +330 -0
- package/src/library/utilities/ThreeDisposer.ts +66 -0
- package/src/library/utilities/zIndex.ts +15 -0
|
@@ -0,0 +1,575 @@
|
|
|
1
|
+
import { ChitRenderInstance } from "../rendering/ChitRenderInstance";
|
|
2
|
+
import { ChitRenderSpec } from "../rendering/ChitRenderSpec";
|
|
3
|
+
import { Turn } from "./Turn";
|
|
4
|
+
import { FixChildOutlets, NonEditable, Ordered } from "../utilities/Annotations";
|
|
5
|
+
import { ObjectWithProps } from "../utilities/ObjectWithProps";
|
|
6
|
+
import { ChitPick } from "./Pick";
|
|
7
|
+
import { Vector2 } from "three";
|
|
8
|
+
import { OrderedOutlet } from "./OrderedOutlet";
|
|
9
|
+
import { SparkChit } from "./SparkChit";
|
|
10
|
+
import StaticChitTypeRegistry from "./StaticChitTypeRegistry";
|
|
11
|
+
import type { Game } from "./Game";
|
|
12
|
+
import { IUpdatingCanvas } from "../utilities/IUpdatingCanvas";
|
|
13
|
+
import { ImageSpec } from "../utilities/CanvasStack/CanvasOperations";
|
|
14
|
+
|
|
15
|
+
export const ORDERED_CHILDREN = "orderedChildren";
|
|
16
|
+
|
|
17
|
+
export type ChitClick = () => void;
|
|
18
|
+
|
|
19
|
+
export type HiddenPropertySerializationRule = {
|
|
20
|
+
fields: "all" | string[];
|
|
21
|
+
playerIds: string[];
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export type PanelTab = {
|
|
25
|
+
color: string;
|
|
26
|
+
icon: IUpdatingCanvas | ImageSpec;
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
let CHIT_CREATED_ORDER = 0;
|
|
30
|
+
export class Chit extends ObjectWithProps {
|
|
31
|
+
/** @internal */
|
|
32
|
+
@NonEditable public type: string = "chit";
|
|
33
|
+
|
|
34
|
+
@NonEditable public id?: string;
|
|
35
|
+
|
|
36
|
+
constructor() {
|
|
37
|
+
super();
|
|
38
|
+
FixChildOutlets(this);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
@Ordered
|
|
42
|
+
public orderedChildren = new OrderedOutlet<Chit>();
|
|
43
|
+
|
|
44
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
45
|
+
public render(spec: ChitRenderSpec) {}
|
|
46
|
+
|
|
47
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
48
|
+
public shouldRenderChild(childChit: Chit): boolean {
|
|
49
|
+
return true;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
// used if this chit is the root of a panel
|
|
53
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
54
|
+
getSparks(context: "panel" | "dropdown" | "endgame"): SparkChit[] {
|
|
55
|
+
return [];
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
public add<T extends Chit>(chit: T, outlet?: string): T {
|
|
59
|
+
if (!outlet) {
|
|
60
|
+
this.orderedChildren.add(chit);
|
|
61
|
+
} else {
|
|
62
|
+
chit.setParent(this, outlet);
|
|
63
|
+
}
|
|
64
|
+
return chit;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
public remove(chit: Chit) {
|
|
68
|
+
if (chit.parent !== this) {
|
|
69
|
+
throw new Error("Cannot remove child that isnt mine");
|
|
70
|
+
}
|
|
71
|
+
chit.setParent();
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
public removeFromParent() {
|
|
75
|
+
this.setParent();
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
@NonEditable private _parentOutletIndex?: number;
|
|
79
|
+
public get parentOutletIndex(): number | undefined {
|
|
80
|
+
return this._parentOutletIndex;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
@NonEditable private _parentOutlet?: string;
|
|
84
|
+
public get parentOutlet(): string | undefined {
|
|
85
|
+
return this._parentOutlet;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
@NonEditable private _parent?: Chit;
|
|
89
|
+
public get parent(): Chit | undefined {
|
|
90
|
+
return this._parent;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
// if a chit comes from a "bag" or something, this will be the "parent" that it should effectively go to or come from
|
|
94
|
+
/** @internal */
|
|
95
|
+
@NonEditable private _parentFallback?: Chit;
|
|
96
|
+
public get parentFallback(): Chit | undefined {
|
|
97
|
+
return this._parentFallback;
|
|
98
|
+
}
|
|
99
|
+
public set parentFallback(newValue: Chit | undefined) {
|
|
100
|
+
this._parentFallback = newValue;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
@NonEditable private _lastParent?: Chit;
|
|
104
|
+
|
|
105
|
+
/** @internal */
|
|
106
|
+
public get lastParent(): Chit | undefined {
|
|
107
|
+
return this._lastParent;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
public get panelTab(): PanelTab | undefined {
|
|
111
|
+
return undefined;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
toJSON() {
|
|
115
|
+
if (!this.id) {
|
|
116
|
+
throw new Error("Attempting toJSON on a chit without an ID");
|
|
117
|
+
}
|
|
118
|
+
return {
|
|
119
|
+
__chit_id: this.id,
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
toString() {
|
|
124
|
+
return `${this.chitTypeName()} ${this.id}`;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
/** @internal */
|
|
128
|
+
chitTypeName() {
|
|
129
|
+
const result = Object.getPrototypeOf(this).constructor.name;
|
|
130
|
+
if (this.parentFallback) {
|
|
131
|
+
return `${result}-${this.parentFallback.id}-`;
|
|
132
|
+
}
|
|
133
|
+
return result;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
//
|
|
137
|
+
//
|
|
138
|
+
// Private or "protected"
|
|
139
|
+
// I can't safely mark stuff as "protected" and make it visible to other parts of the system and not visible to games that extend Chit
|
|
140
|
+
// so anything that should not be used by a game is prefixed with "" which should put it at the bottom of the autocomplete list
|
|
141
|
+
// and make it clear that it shouldn't be touched
|
|
142
|
+
//
|
|
143
|
+
//
|
|
144
|
+
|
|
145
|
+
/** @internal */
|
|
146
|
+
@NonEditable public renderInstance?: ChitRenderInstance;
|
|
147
|
+
@NonEditable private _version = 0;
|
|
148
|
+
@NonEditable private _createdOrder = ++CHIT_CREATED_ORDER;
|
|
149
|
+
|
|
150
|
+
/** @internal */
|
|
151
|
+
public get version() {
|
|
152
|
+
return this._version;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
/** @internal */
|
|
156
|
+
public get createdOrder() {
|
|
157
|
+
return this._createdOrder;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
@NonEditable private _game?: Game<any, any>;
|
|
161
|
+
|
|
162
|
+
/** @internal */
|
|
163
|
+
public get game(): Game<any, any> | undefined {
|
|
164
|
+
if (!this._game) {
|
|
165
|
+
this._game = this.parent?.game;
|
|
166
|
+
}
|
|
167
|
+
return this._game;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
/** @internal */
|
|
171
|
+
public set game(newGame: Game<any, any>) {
|
|
172
|
+
this._game = newGame;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
@NonEditable
|
|
176
|
+
private _onClick?: ChitClick;
|
|
177
|
+
|
|
178
|
+
/** @internal */
|
|
179
|
+
public get onClick(): undefined | ChitClick {
|
|
180
|
+
return this._onClick;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
/** @internal */
|
|
184
|
+
public set onClick(newValue: undefined | ChitClick) {
|
|
185
|
+
this._onClick = newValue;
|
|
186
|
+
this.notifyChange("onClick");
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
/**
|
|
190
|
+
* Returns true if the chit is currently clickable
|
|
191
|
+
*/
|
|
192
|
+
public get isClickable(): boolean {
|
|
193
|
+
return !!this.onClick;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
@NonEditable private _lockedBy?: Turn<any, any, any>;
|
|
197
|
+
|
|
198
|
+
public get currentTurn(): Turn<any, any, any> {
|
|
199
|
+
if (this._lockedBy) {
|
|
200
|
+
return this._lockedBy;
|
|
201
|
+
}
|
|
202
|
+
if (this.parent) {
|
|
203
|
+
return this.parent.currentTurn;
|
|
204
|
+
}
|
|
205
|
+
throw "No current turn";
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
public functionallyIdentical(other: Chit) {
|
|
209
|
+
const myProto = Object.getPrototypeOf(this);
|
|
210
|
+
const otherProto = Object.getPrototypeOf(other);
|
|
211
|
+
if (myProto !== otherProto) {
|
|
212
|
+
return false;
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
const compare = (a: any, b: any): boolean => {
|
|
216
|
+
if (a === b) {
|
|
217
|
+
return true;
|
|
218
|
+
}
|
|
219
|
+
if ((a && !b) || (!b && a)) {
|
|
220
|
+
return false;
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
const aIsArray = Array.isArray(a);
|
|
224
|
+
const bIsArray = Array.isArray(b);
|
|
225
|
+
if (aIsArray && bIsArray) {
|
|
226
|
+
if (a.length !== b.length) {
|
|
227
|
+
return false;
|
|
228
|
+
}
|
|
229
|
+
return !a.find((item, index) => !compare(item, b[index]));
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
const aIsChit = a instanceof Chit;
|
|
233
|
+
const bIsChit = b instanceof Chit;
|
|
234
|
+
if (aIsChit && bIsChit) {
|
|
235
|
+
return a.functionallyIdentical(b);
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
const aIsOrderedOutlet = a instanceof OrderedOutlet;
|
|
239
|
+
const bIsOrderedOutlet = b instanceof OrderedOutlet;
|
|
240
|
+
if (aIsOrderedOutlet && bIsOrderedOutlet) {
|
|
241
|
+
return compare(a.copy(), b.copy());
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
const aIsObject = a instanceof Object;
|
|
245
|
+
const bIsObject = b instanceof Object;
|
|
246
|
+
if (aIsObject && bIsObject) {
|
|
247
|
+
const aKeys = Object.keys(a);
|
|
248
|
+
const bKeys = Object.keys(b);
|
|
249
|
+
if (aKeys.length !== bKeys.length) {
|
|
250
|
+
return false;
|
|
251
|
+
}
|
|
252
|
+
return !aKeys.find((key) => !compare(a[key], b[key]));
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
return a === b;
|
|
256
|
+
};
|
|
257
|
+
|
|
258
|
+
const myProps = this.serializationProps;
|
|
259
|
+
const otherProps = other.serializationProps;
|
|
260
|
+
if (myProps.length !== otherProps.length || JSON.stringify(myProps) !== JSON.stringify(otherProps)) {
|
|
261
|
+
return false;
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
// find a prop that isn't the same
|
|
265
|
+
return !this.serializationProps.find((prop) => {
|
|
266
|
+
// indexes will of course be different... no need to stress on these
|
|
267
|
+
if (prop.startsWith("_") || prop === "id") {
|
|
268
|
+
return false;
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
const myValue = (this as any)[prop];
|
|
272
|
+
const otherValue = (other as any)[prop];
|
|
273
|
+
return !compare(myValue, otherValue);
|
|
274
|
+
});
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
/** @internal */
|
|
278
|
+
public get lockedBy() {
|
|
279
|
+
return this._lockedBy;
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
/** @internal */
|
|
283
|
+
public lock(turn: Turn<any, any, any>): void {
|
|
284
|
+
if (this._lockedBy && this._lockedBy !== turn) {
|
|
285
|
+
throw new Error("Chit is already locked");
|
|
286
|
+
}
|
|
287
|
+
this._lockedBy = turn;
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
/** @internal */
|
|
291
|
+
public confirmLock(turn: Turn<any, any, any>): void {
|
|
292
|
+
if (this._lockedBy && this._lockedBy !== turn) {
|
|
293
|
+
throw new Error("Chit is already locked");
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
/** @internal */
|
|
298
|
+
public unlock(turn: Turn<any, any, any>): void {
|
|
299
|
+
if (this._lockedBy && this._lockedBy !== turn) {
|
|
300
|
+
throw new Error("Chit is locked by someone else?");
|
|
301
|
+
}
|
|
302
|
+
this._lockedBy = undefined;
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
/** @internal */
|
|
306
|
+
public removeChild(child: Chit, parentOutlet?: string) {
|
|
307
|
+
if (parentOutlet) {
|
|
308
|
+
const existingParentOutletValue = (this as unknown as any)[parentOutlet];
|
|
309
|
+
if (existingParentOutletValue === this) {
|
|
310
|
+
(this as unknown as any)[parentOutlet] = undefined;
|
|
311
|
+
} else if (existingParentOutletValue instanceof OrderedOutlet) {
|
|
312
|
+
existingParentOutletValue.remove(this);
|
|
313
|
+
} else {
|
|
314
|
+
(this as any).children = (this as any).children.filter((c: Chit) => c !== child);
|
|
315
|
+
}
|
|
316
|
+
} else {
|
|
317
|
+
(this as any).children = (this as any).children.filter((c: Chit) => c !== child);
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
public setParent(newValue?: Chit, parentOutlet?: string, parentOutletIndex?: number) {
|
|
322
|
+
if (this._parent === newValue && this._parentOutlet === parentOutlet) {
|
|
323
|
+
this._parentOutletIndex = parentOutletIndex;
|
|
324
|
+
return;
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
if (this._parent !== newValue) {
|
|
328
|
+
this._lastParent = this._parent;
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
if (this._parent) {
|
|
332
|
+
if (!this._parentOutlet) {
|
|
333
|
+
throw new Error("Cannot have a parent without a parent outlet");
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
const oldParent = this._parent as unknown as any,
|
|
337
|
+
oldOutlet = this._parentOutlet;
|
|
338
|
+
|
|
339
|
+
this._parent = undefined;
|
|
340
|
+
this._parentOutlet = undefined;
|
|
341
|
+
this._parentOutletIndex = undefined;
|
|
342
|
+
|
|
343
|
+
oldParent.children = oldParent.children.filter((c: Chit) => c !== this);
|
|
344
|
+
|
|
345
|
+
const existingParentOutletValue = oldParent[oldOutlet];
|
|
346
|
+
if (existingParentOutletValue === this) {
|
|
347
|
+
oldParent[oldOutlet] = undefined;
|
|
348
|
+
} else if (existingParentOutletValue instanceof OrderedOutlet) {
|
|
349
|
+
existingParentOutletValue.remove(this);
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
if (newValue) {
|
|
354
|
+
this._parent = newValue;
|
|
355
|
+
this._parentOutlet = parentOutlet;
|
|
356
|
+
this._parentOutletIndex = parentOutletIndex;
|
|
357
|
+
newValue.children.push(this);
|
|
358
|
+
|
|
359
|
+
if (newValue.renderInstance) {
|
|
360
|
+
newValue.renderInstance.childAdded(this, this.renderInstance);
|
|
361
|
+
} else {
|
|
362
|
+
this.renderInstance = undefined;
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
this.notifyChange("parent");
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
/** @internal */
|
|
370
|
+
@NonEditable public children: Chit[] = [];
|
|
371
|
+
|
|
372
|
+
/** @internal */
|
|
373
|
+
public walk(fn: (c: Chit) => boolean | void) {
|
|
374
|
+
if (fn(this) === false) {
|
|
375
|
+
return;
|
|
376
|
+
}
|
|
377
|
+
this.children.forEach((child) => child.walk(fn));
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
private get serializationProps() {
|
|
381
|
+
return [...this.props, "id", "_parent", "_parentOutlet", "_parentOutletIndex", "_parentFallback"];
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
/** @internal */
|
|
385
|
+
public screenCoordinates(): Vector2 | undefined {
|
|
386
|
+
return this.renderInstance?.screenCoordinates() ?? this.parent?.screenCoordinates();
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
/** @internal */
|
|
390
|
+
public canRender() {
|
|
391
|
+
return true;
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
/** @internal */
|
|
395
|
+
@NonEditable public isDeserializing = false;
|
|
396
|
+
|
|
397
|
+
/** @internal */
|
|
398
|
+
public doneDeserializing() {
|
|
399
|
+
if (this.isDeserializing) {
|
|
400
|
+
this.isDeserializing = false;
|
|
401
|
+
this.notifyChange("deserialized");
|
|
402
|
+
}
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
/** @internal */
|
|
406
|
+
public beginDeserializing() {
|
|
407
|
+
this.isDeserializing = true;
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
/** @internal */
|
|
411
|
+
public deserialize(serialized: string, findChit: (id: string) => Chit) {
|
|
412
|
+
this._version++;
|
|
413
|
+
const j = JSON.parse(serialized);
|
|
414
|
+
if (j.____deleted) {
|
|
415
|
+
this.setParent();
|
|
416
|
+
return;
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
const inflateValue = (value: any): any => {
|
|
420
|
+
if (!value) {
|
|
421
|
+
return value;
|
|
422
|
+
}
|
|
423
|
+
if (Array.isArray(value)) {
|
|
424
|
+
return value.map(inflateValue);
|
|
425
|
+
} else if (Object.getPrototypeOf(value).constructor.name === "Object") {
|
|
426
|
+
// only want to do this for vanilla objects
|
|
427
|
+
if (value.__chit_id) {
|
|
428
|
+
return findChit(value.__chit_id);
|
|
429
|
+
}
|
|
430
|
+
|
|
431
|
+
return Object.entries(value).reduce((acc, [key, value]) => {
|
|
432
|
+
(acc as any)[key] = inflateValue(value);
|
|
433
|
+
return acc;
|
|
434
|
+
}, {});
|
|
435
|
+
} else {
|
|
436
|
+
return value;
|
|
437
|
+
}
|
|
438
|
+
};
|
|
439
|
+
|
|
440
|
+
this.props.forEach((key) => {
|
|
441
|
+
const value = j[key];
|
|
442
|
+
|
|
443
|
+
if (value?.___orderedOutlet) {
|
|
444
|
+
(this as any)[key].deserialize(value.___orderedOutlet.map(inflateValue));
|
|
445
|
+
} else {
|
|
446
|
+
(this as any)[key] = inflateValue(value);
|
|
447
|
+
}
|
|
448
|
+
});
|
|
449
|
+
|
|
450
|
+
this.id = j.id;
|
|
451
|
+
this._parentFallback = inflateValue(j._parentFallback);
|
|
452
|
+
|
|
453
|
+
if (this._version === 1 && this._parentFallback) {
|
|
454
|
+
this.setParent(this._parentFallback, j._parentOutlet ?? "graveyard");
|
|
455
|
+
}
|
|
456
|
+
|
|
457
|
+
this.setParent(inflateValue(j._parent), j._parentOutlet, j._parentOutletIndex);
|
|
458
|
+
}
|
|
459
|
+
|
|
460
|
+
/**
|
|
461
|
+
* Let chits decide who can see what. (Allow privacy of chits)
|
|
462
|
+
* @param _playerIds
|
|
463
|
+
* @returns
|
|
464
|
+
*/
|
|
465
|
+
public hiddenPropertiesForSerialization(_playerIds: string[]): HiddenPropertySerializationRule[] | undefined {
|
|
466
|
+
return undefined;
|
|
467
|
+
}
|
|
468
|
+
|
|
469
|
+
/** @internal */
|
|
470
|
+
public serialize(playerIds?: string[]): string {
|
|
471
|
+
return JSON.stringify(
|
|
472
|
+
this.serializationProps.reduce(
|
|
473
|
+
(acc, key) => {
|
|
474
|
+
const value = (this as any)[key];
|
|
475
|
+
acc[key] = value;
|
|
476
|
+
return acc;
|
|
477
|
+
},
|
|
478
|
+
{
|
|
479
|
+
__chitType: Object.getPrototypeOf(this).constructor.name,
|
|
480
|
+
__hiddenProps: playerIds ? this.hiddenPropertiesForSerialization(playerIds) : undefined,
|
|
481
|
+
} as { [key: string]: any },
|
|
482
|
+
),
|
|
483
|
+
);
|
|
484
|
+
}
|
|
485
|
+
|
|
486
|
+
//
|
|
487
|
+
//
|
|
488
|
+
// Static methods
|
|
489
|
+
//
|
|
490
|
+
//
|
|
491
|
+
|
|
492
|
+
/** @internal */
|
|
493
|
+
public static fixVisibility(serialized: string, playerId: string) {
|
|
494
|
+
const data = JSON.parse(serialized);
|
|
495
|
+
if (data.__hiddenProps) {
|
|
496
|
+
const hiddenPropRules = data.__hiddenProps as HiddenPropertySerializationRule[];
|
|
497
|
+
const rule = hiddenPropRules.find((rule) => rule.playerIds.indexOf(playerId) !== -1);
|
|
498
|
+
if (rule) {
|
|
499
|
+
if (rule.fields === "all") {
|
|
500
|
+
Object.keys(data)
|
|
501
|
+
.filter((a) => a !== "id" && !a.startsWith("_") && !data[a].___orderedOutlet)
|
|
502
|
+
.forEach((key) => {
|
|
503
|
+
delete data[key];
|
|
504
|
+
});
|
|
505
|
+
} else {
|
|
506
|
+
rule.fields
|
|
507
|
+
.filter((k) => {
|
|
508
|
+
if (data[k].___orderedOutlet) {
|
|
509
|
+
throw new Error("Cannot mask ordered outlets");
|
|
510
|
+
}
|
|
511
|
+
return true;
|
|
512
|
+
})
|
|
513
|
+
.forEach((key) => {
|
|
514
|
+
delete data[key];
|
|
515
|
+
});
|
|
516
|
+
}
|
|
517
|
+
delete data.__hiddenProps;
|
|
518
|
+
return JSON.stringify(data);
|
|
519
|
+
}
|
|
520
|
+
}
|
|
521
|
+
return serialized;
|
|
522
|
+
}
|
|
523
|
+
|
|
524
|
+
/*
|
|
525
|
+
* Creates a new chit from the serialized spec.
|
|
526
|
+
*/
|
|
527
|
+
/** @internal */
|
|
528
|
+
public static deflate(serialized: string, game: Game<any, any>) {
|
|
529
|
+
const { __chitType, ____deleted } = JSON.parse(serialized);
|
|
530
|
+
if (____deleted) {
|
|
531
|
+
return undefined;
|
|
532
|
+
}
|
|
533
|
+
const ChitType = game.chitLibrary[__chitType] ?? StaticChitTypeRegistry[__chitType];
|
|
534
|
+
if (!ChitType) {
|
|
535
|
+
throw new Error(`Chit Type ${__chitType} not found`);
|
|
536
|
+
}
|
|
537
|
+
const result = new ChitType();
|
|
538
|
+
result.game = game;
|
|
539
|
+
return result;
|
|
540
|
+
}
|
|
541
|
+
|
|
542
|
+
/** @internal */
|
|
543
|
+
public static walk(chits: Chit[], fn: (c: Chit) => boolean | void) {
|
|
544
|
+
const seenIds = new Set();
|
|
545
|
+
chits.forEach((chit) =>
|
|
546
|
+
chit.walk((chit) => {
|
|
547
|
+
if (chit.id) {
|
|
548
|
+
if (seenIds.has(chit.id)) {
|
|
549
|
+
return false;
|
|
550
|
+
}
|
|
551
|
+
seenIds.add(chit.id);
|
|
552
|
+
}
|
|
553
|
+
return fn(chit);
|
|
554
|
+
}),
|
|
555
|
+
);
|
|
556
|
+
}
|
|
557
|
+
|
|
558
|
+
public static pick<T extends Chit>(
|
|
559
|
+
chit: T | (T | undefined | null | false)[] | OrderedOutlet<T>,
|
|
560
|
+
cb: (chit: T) => void | Promise<void>,
|
|
561
|
+
) {
|
|
562
|
+
const result = new ChitPick<T>();
|
|
563
|
+
result.chits =
|
|
564
|
+
chit instanceof OrderedOutlet ? chit.copy() : Array.isArray(chit) ? (chit.filter((c) => c) as T[]) : [chit];
|
|
565
|
+
result.cb = cb;
|
|
566
|
+
return result;
|
|
567
|
+
}
|
|
568
|
+
|
|
569
|
+
/** @internal */
|
|
570
|
+
public static deletedIfSerialized(): string {
|
|
571
|
+
return JSON.stringify({
|
|
572
|
+
____deleted: true,
|
|
573
|
+
});
|
|
574
|
+
}
|
|
575
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { EventChannel } from "../utilities/EventChannel";
|
|
2
|
+
|
|
3
|
+
export class ClientTimeState {
|
|
4
|
+
public live = new EventChannel<boolean>(true);
|
|
5
|
+
public isWaitingOnAnimations = new EventChannel<boolean>(true);
|
|
6
|
+
public targetClock = new EventChannel<number>(1, 250);
|
|
7
|
+
|
|
8
|
+
public skipReplay = new EventChannel<boolean>(false);
|
|
9
|
+
public showLog = new EventChannel<boolean>(false);
|
|
10
|
+
public animationSpeedMultiplier = new EventChannel<number>(1);
|
|
11
|
+
public animationSpeedOverrideMultiplier = new EventChannel<number | undefined>(undefined);
|
|
12
|
+
public isLoading = new EventChannel<boolean>(true);
|
|
13
|
+
|
|
14
|
+
private currentlyAnimating = new Set<string>();
|
|
15
|
+
public setAnimationState(key: string, isAnimating: boolean) {
|
|
16
|
+
if (isAnimating) {
|
|
17
|
+
this.currentlyAnimating.add(key);
|
|
18
|
+
|
|
19
|
+
if (this.currentlyAnimating.size === 1) {
|
|
20
|
+
this.isWaitingOnAnimations.value = true;
|
|
21
|
+
}
|
|
22
|
+
} else {
|
|
23
|
+
this.currentlyAnimating.delete(key);
|
|
24
|
+
|
|
25
|
+
if (this.currentlyAnimating.size === 0) {
|
|
26
|
+
this.isWaitingOnAnimations.value = false;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
_animationOverrideTimeout: NodeJS.Timeout | undefined;
|
|
32
|
+
|
|
33
|
+
public goLive(clock: number) {
|
|
34
|
+
this.live.value = true;
|
|
35
|
+
this.targetClock.value = clock;
|
|
36
|
+
clearTimeout(this._animationOverrideTimeout);
|
|
37
|
+
this.animationSpeedOverrideMultiplier.value = 0.075;
|
|
38
|
+
this._animationOverrideTimeout = setTimeout(() => {
|
|
39
|
+
this.animationSpeedOverrideMultiplier.value = undefined;
|
|
40
|
+
}, 250);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export type ClockDetails = {
|
|
2
|
+
pass: number;
|
|
3
|
+
clock: number;
|
|
4
|
+
subTurns?: { [turnId: string]: ClockDetails };
|
|
5
|
+
};
|
|
6
|
+
|
|
7
|
+
export function samePasses(a?: ClockDetails, b?: ClockDetails) {
|
|
8
|
+
if (!a || !b) {
|
|
9
|
+
return true;
|
|
10
|
+
}
|
|
11
|
+
if (a.pass !== b.pass) {
|
|
12
|
+
return false;
|
|
13
|
+
}
|
|
14
|
+
if (a.subTurns && b.subTurns) {
|
|
15
|
+
const aTurns = a.subTurns;
|
|
16
|
+
const bTurns = b.subTurns;
|
|
17
|
+
const aTurnIds = Object.keys(a.subTurns);
|
|
18
|
+
const nonSamePass = aTurnIds.find((id: string) => !samePasses(aTurns[id], bTurns[id]));
|
|
19
|
+
if (nonSamePass) {
|
|
20
|
+
return false;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
return true;
|
|
24
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { expect, test } from "vitest";
|
|
2
|
+
import { Connection } from "./Connection";
|
|
3
|
+
import { LocalConnectionTransport } from "./ConnectionTransport";
|
|
4
|
+
import { ConnectionObject } from "./ConnectionObject";
|
|
5
|
+
|
|
6
|
+
class ClientClass extends ConnectionObject {
|
|
7
|
+
async doThing(a: number, b: number, shouldFail: boolean): Promise<number> {
|
|
8
|
+
await new Promise((resolve) => setTimeout(resolve, 10));
|
|
9
|
+
if (shouldFail) {
|
|
10
|
+
throw new Error("Failed");
|
|
11
|
+
}
|
|
12
|
+
return a + b;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
class RemoteClass extends ConnectionObject {
|
|
17
|
+
async doOtherThing(a: number, b: number, shouldFail: boolean): Promise<number> {
|
|
18
|
+
await new Promise((resolve) => setTimeout(resolve, 10));
|
|
19
|
+
if (shouldFail) {
|
|
20
|
+
throw new Error("Failed");
|
|
21
|
+
}
|
|
22
|
+
return a * b;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
test("basic invocation", async () => {
|
|
27
|
+
const localTransport1 = new LocalConnectionTransport();
|
|
28
|
+
const c1 = new Connection(localTransport1);
|
|
29
|
+
c1.register(new ClientClass());
|
|
30
|
+
|
|
31
|
+
const remoteTransport1 = new LocalConnectionTransport();
|
|
32
|
+
const c2 = new Connection(remoteTransport1);
|
|
33
|
+
c2.register(new RemoteClass());
|
|
34
|
+
|
|
35
|
+
localTransport1.connect(remoteTransport1);
|
|
36
|
+
|
|
37
|
+
// try a local call
|
|
38
|
+
const localRef = c1.get<ClientClass>("ClientClass");
|
|
39
|
+
await expect(localRef.doThing(2, 3, false)).resolves.toBe(5);
|
|
40
|
+
|
|
41
|
+
// try a remote call
|
|
42
|
+
const remoteRef = c1.get<RemoteClass>("RemoteClass");
|
|
43
|
+
await expect(remoteRef.doOtherThing(2, 3, false)).resolves.toBe(6);
|
|
44
|
+
|
|
45
|
+
// try a failing local call
|
|
46
|
+
await expect(localRef.doThing(2, 3, true)).rejects.toThrowError(/Failed/);
|
|
47
|
+
|
|
48
|
+
// try a remote call
|
|
49
|
+
await expect(remoteRef.doOtherThing(2, 3, true)).rejects.toThrowError(/Failed/);
|
|
50
|
+
});
|