@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,74 @@
|
|
|
1
|
+
import { Connection } from "../Connection";
|
|
2
|
+
import { ConnectionObject } from "../ConnectionObject";
|
|
3
|
+
import { Match } from "../Match";
|
|
4
|
+
import { PlayerChit } from "../PlayerChit";
|
|
5
|
+
import { RootChit } from "../RootChit";
|
|
6
|
+
import { ClientTime } from "../clientTransport/ClientTime";
|
|
7
|
+
import { Chit } from "../Chit";
|
|
8
|
+
|
|
9
|
+
export class ServerTime<P extends PlayerChit, R extends RootChit<P>> extends ConnectionObject {
|
|
10
|
+
private clientTime: ClientTime;
|
|
11
|
+
private hasSentLastActionTime = false;
|
|
12
|
+
constructor(
|
|
13
|
+
private match: Match<P, R>,
|
|
14
|
+
private playerId: string,
|
|
15
|
+
private connection: Connection,
|
|
16
|
+
) {
|
|
17
|
+
super();
|
|
18
|
+
|
|
19
|
+
this.clientTime = connection.get<ClientTime>("ClientTime");
|
|
20
|
+
this.register(
|
|
21
|
+
match.onChange(() => {
|
|
22
|
+
if (match.turn.value) {
|
|
23
|
+
this.clientTime.newMaxClock(match.turn.value.clockDetails(this.playerId));
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
if (!this.hasSentLastActionTime) {
|
|
27
|
+
this.hasSentLastActionTime = true;
|
|
28
|
+
|
|
29
|
+
const player = match.turn.value?.rootChit.players.find((p) => p.id === playerId);
|
|
30
|
+
if (player) {
|
|
31
|
+
this.clientTime.setStartTime(player.promptStatus.latestPromptResponseTime);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}),
|
|
35
|
+
);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
private stateCounter = 0;
|
|
39
|
+
private stateLookups: { [chitId: string]: number } = {};
|
|
40
|
+
async serializeDelta(to: number) {
|
|
41
|
+
if (this.match.turn.value) {
|
|
42
|
+
const result = this.match.turn.value.serialize(this.playerId, to);
|
|
43
|
+
|
|
44
|
+
const newStates: { [stateId: number]: string } = {};
|
|
45
|
+
const chitIdToStateCounter: { [chitId: string]: number } = {};
|
|
46
|
+
Object.entries(result.chits).forEach(([key, value]: [string, string]) => {
|
|
47
|
+
let state = this.stateLookups[value];
|
|
48
|
+
if (state === undefined) {
|
|
49
|
+
state = this.stateLookups[key] = ++this.stateCounter;
|
|
50
|
+
newStates[this.stateCounter] = Chit.fixVisibility(value, this.playerId);
|
|
51
|
+
}
|
|
52
|
+
chitIdToStateCounter[key] = state;
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
return {
|
|
56
|
+
clockDetails: result.clockDetails,
|
|
57
|
+
newStates,
|
|
58
|
+
chits: chitIdToStateCounter,
|
|
59
|
+
log: result.log,
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
throw new Error("No match or match hasn't started");
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
async chitHistory(ids: string[]) {
|
|
66
|
+
return this.match.turn.value!.chitsHistory(this.playerId, ids);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
async gameLog() {
|
|
70
|
+
if (this.match.turn.value) {
|
|
71
|
+
return this.match.turn.value.gameLog(this.playerId);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { useEffect, useState } from "react";
|
|
2
|
+
import { Chit } from "../game/Chit";
|
|
3
|
+
import { useTimeController } from "./useTimeController";
|
|
4
|
+
|
|
5
|
+
export function useChits<C extends Chit>(ids: string[]) {
|
|
6
|
+
const time = useTimeController();
|
|
7
|
+
const [result, setResult] = useState<C[]>([]);
|
|
8
|
+
|
|
9
|
+
const idString = ids.join("___");
|
|
10
|
+
|
|
11
|
+
useEffect(() => {
|
|
12
|
+
const resultVersions = result.map((r) => r.version);
|
|
13
|
+
return time.currentClock.on(() => {
|
|
14
|
+
const chits = ids.map((id) => time.findChitUnsafe(id) as C).filter((c) => c);
|
|
15
|
+
if (
|
|
16
|
+
result.length !== chits.length ||
|
|
17
|
+
chits.find((el, i) => el !== result[i] || el.version !== resultVersions[i])
|
|
18
|
+
) {
|
|
19
|
+
setResult(chits);
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
24
|
+
}, [time, idString, result]);
|
|
25
|
+
|
|
26
|
+
return result;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export function useChit<C extends Chit>(id: string): C | undefined {
|
|
30
|
+
const chits = useChits<C>([id]);
|
|
31
|
+
return chits[0];
|
|
32
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import React, { useContext, createContext, ReactNode } from "react";
|
|
2
|
+
import { Connection } from "../game/Connection";
|
|
3
|
+
|
|
4
|
+
const ConnectionContext = createContext<Connection | undefined>(undefined);
|
|
5
|
+
|
|
6
|
+
export function useConnection(): Connection {
|
|
7
|
+
const result = useContext(ConnectionContext);
|
|
8
|
+
if (!result) {
|
|
9
|
+
throw new Error("Connection is required");
|
|
10
|
+
}
|
|
11
|
+
return result;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export function ConnectionProvider({ connection, children }: { connection: Connection; children: ReactNode }) {
|
|
15
|
+
return <ConnectionContext.Provider value={connection}>{children}</ConnectionContext.Provider>;
|
|
16
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { useCallback, useEffect, useState } from "react";
|
|
2
|
+
import { EventChannel } from "../utilities/EventChannel";
|
|
3
|
+
|
|
4
|
+
export function useEventChannelState<T>(e: EventChannel<T>): [T, (a: T) => void] {
|
|
5
|
+
const [v, setV] = useState<T>(e.value);
|
|
6
|
+
|
|
7
|
+
useEffect(() => {
|
|
8
|
+
// calling explicitly here saves a `nextTick` scheduling and fixes the problem where a value
|
|
9
|
+
// changes between when this is invoked and when useEffect is invoked.
|
|
10
|
+
setV(e.value);
|
|
11
|
+
e.on(setV, false);
|
|
12
|
+
}, [e]);
|
|
13
|
+
|
|
14
|
+
const setter = useCallback(
|
|
15
|
+
(newValue: T) => {
|
|
16
|
+
e.value = newValue;
|
|
17
|
+
},
|
|
18
|
+
[e],
|
|
19
|
+
);
|
|
20
|
+
return [v, setter];
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export function useMultiEventChannelState<T, Z>(list: Z[], mapper: (arg: Z) => EventChannel<T>): T[] {
|
|
24
|
+
const eventChannels = list.map(mapper);
|
|
25
|
+
const [v, setV] = useState<T[]>(eventChannels.map((d) => d.value));
|
|
26
|
+
|
|
27
|
+
useEffect(() => {
|
|
28
|
+
const cbs = eventChannels.map((z) => z.on(() => setV(eventChannels.map((d) => d.value)), false));
|
|
29
|
+
return () => cbs.forEach((cb) => cb());
|
|
30
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
31
|
+
}, [...list, mapper]);
|
|
32
|
+
return v;
|
|
33
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import React, { useContext, createContext, ReactNode } from "react";
|
|
2
|
+
import { Game } from "../game/Game";
|
|
3
|
+
|
|
4
|
+
const GameContext = createContext<Game<any, any> | undefined>(undefined);
|
|
5
|
+
|
|
6
|
+
export function useGame(): Game<any, any> {
|
|
7
|
+
const result = useContext(GameContext);
|
|
8
|
+
if (!result) {
|
|
9
|
+
throw new Error("Game is required");
|
|
10
|
+
}
|
|
11
|
+
return result;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export function GameProvider({ game, children }: { game: Game<any, any>; children: ReactNode }) {
|
|
15
|
+
return <GameContext.Provider value={game}>{children}</GameContext.Provider>;
|
|
16
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React, { useContext, createContext, ReactNode } from "react";
|
|
2
|
+
import { GameTheme as Theme } from "../game/GameTheme";
|
|
3
|
+
|
|
4
|
+
const ThemeContext = createContext<Theme>(new Theme());
|
|
5
|
+
|
|
6
|
+
export function useGameTheme(): Theme {
|
|
7
|
+
return useContext(ThemeContext);
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export function GameThemeProvider({ theme, children }: { theme: Theme; children: ReactNode }) {
|
|
11
|
+
return <ThemeContext.Provider value={theme}>{children}</ThemeContext.Provider>;
|
|
12
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React, { useContext, createContext, ReactNode } from "react";
|
|
2
|
+
import { ModalState } from "../game/ModalState";
|
|
3
|
+
|
|
4
|
+
const ModalContext = createContext<ModalState>(new ModalState());
|
|
5
|
+
|
|
6
|
+
export function useModalState(): ModalState {
|
|
7
|
+
const result = useContext(ModalContext);
|
|
8
|
+
return result;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export function ModalProvider({ children }: { children: ReactNode }) {
|
|
12
|
+
return <ModalContext.Provider value={new ModalState()}>{children}</ModalContext.Provider>;
|
|
13
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { createContext, useContext } from "react";
|
|
2
|
+
|
|
3
|
+
export interface ViewerPosition {
|
|
4
|
+
chitId: string;
|
|
5
|
+
x: number;
|
|
6
|
+
y: number;
|
|
7
|
+
w: number;
|
|
8
|
+
h: number;
|
|
9
|
+
paused: boolean;
|
|
10
|
+
refContainer: React.RefObject<HTMLElement> | null;
|
|
11
|
+
front: boolean;
|
|
12
|
+
panCallback?: (direction: "left" | "right") => void;
|
|
13
|
+
visible: boolean; // For MultiPanel sliding animations
|
|
14
|
+
transition?: string | null; // CSS transition for animated position changes
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
interface PanelPositioningContextValue {
|
|
18
|
+
positions: Map<string, ViewerPosition>;
|
|
19
|
+
registerPosition: (chitId: string, position: ViewerPosition) => void;
|
|
20
|
+
unregisterPosition: (chitId: string) => void;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export const PanelPositioningContext = createContext<PanelPositioningContextValue | null>(null);
|
|
24
|
+
|
|
25
|
+
export function usePanelPositioning() {
|
|
26
|
+
const context = useContext(PanelPositioningContext);
|
|
27
|
+
if (!context) {
|
|
28
|
+
throw new Error("usePanelPositioning must be used within PanelPositioningContext.Provider");
|
|
29
|
+
}
|
|
30
|
+
return context;
|
|
31
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import React, { useContext, createContext, ReactNode, useState } from "react";
|
|
2
|
+
|
|
3
|
+
const PanelScaleContext = createContext<{ scale: number; setScale: (n: number) => void }>({
|
|
4
|
+
scale: 1,
|
|
5
|
+
setScale: () => {},
|
|
6
|
+
});
|
|
7
|
+
|
|
8
|
+
export function usePanelScale(): number {
|
|
9
|
+
return useContext(PanelScaleContext).scale;
|
|
10
|
+
}
|
|
11
|
+
export function usePanelSetScale(): (n: number) => void {
|
|
12
|
+
return useContext(PanelScaleContext).setScale;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export function PanelScaleProvider({ children }: { children: ReactNode }) {
|
|
16
|
+
const initialScale = parseFloat(localStorage["panelScale"] ?? "1") || 1; // should this be game specific?
|
|
17
|
+
const [scale, setScaleState] = useState<number>(initialScale);
|
|
18
|
+
const setScale = (n: number) => {
|
|
19
|
+
localStorage["panelScale"] = n;
|
|
20
|
+
setScaleState(n);
|
|
21
|
+
};
|
|
22
|
+
return <PanelScaleContext.Provider value={{ scale, setScale }}>{children}</PanelScaleContext.Provider>;
|
|
23
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { useEffect, useState } from "react";
|
|
2
|
+
import { AnimationState, RootChitRenderInstance } from "../rendering/RootChitRenderInstance";
|
|
3
|
+
|
|
4
|
+
type PanelState = {
|
|
5
|
+
panel?: RootChitRenderInstance;
|
|
6
|
+
paused?: boolean;
|
|
7
|
+
state?: AnimationState;
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
export function usePanelStates(rootChitInstances: (undefined | RootChitRenderInstance)[]): PanelState[] {
|
|
11
|
+
const [states, setStates] = useState<PanelState[]>([]);
|
|
12
|
+
|
|
13
|
+
useEffect(() => {
|
|
14
|
+
const updateStates = () => {
|
|
15
|
+
setStates(
|
|
16
|
+
rootChitInstances.map((panel) => ({
|
|
17
|
+
panel,
|
|
18
|
+
paused: panel?.paused,
|
|
19
|
+
state: panel?.animationState,
|
|
20
|
+
})),
|
|
21
|
+
);
|
|
22
|
+
};
|
|
23
|
+
updateStates();
|
|
24
|
+
const cbs = rootChitInstances.map((panel) => panel?.onPanelStatusChange(updateStates));
|
|
25
|
+
return () => cbs.forEach((cb) => cb && cb());
|
|
26
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
27
|
+
}, [rootChitInstances.map((r) => r?.id).join("-")]);
|
|
28
|
+
|
|
29
|
+
return states;
|
|
30
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React, { useContext, createContext, ReactNode } from "react";
|
|
2
|
+
|
|
3
|
+
const PlayerContext = createContext<string | undefined>(undefined);
|
|
4
|
+
|
|
5
|
+
export function usePlayerId(): string {
|
|
6
|
+
const result = useContext(PlayerContext);
|
|
7
|
+
if (!result) {
|
|
8
|
+
throw new Error("Player is required");
|
|
9
|
+
}
|
|
10
|
+
return result;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export function PlayerProvider({ playerId, children }: { playerId: string; children: ReactNode }) {
|
|
14
|
+
return <PlayerContext.Provider value={playerId}>{children}</PlayerContext.Provider>;
|
|
15
|
+
}
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
import { useCallback, useEffect, useRef, useState } from "react";
|
|
2
|
+
|
|
3
|
+
type Equality<T> = (a: T, b: T) => boolean;
|
|
4
|
+
|
|
5
|
+
export interface UseSmartDebouncedStateOptions<T> {
|
|
6
|
+
/** Fixed cooldown after a commit; calls inside fire once at lastCommit + interval */
|
|
7
|
+
interval: number;
|
|
8
|
+
/** Mini debounce when idle; 0 => commit immediately */
|
|
9
|
+
immediate?: number;
|
|
10
|
+
/** Custom equality; defaults to Object.is */
|
|
11
|
+
isEqual?: Equality<T>;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export interface SmartDebouncedMeta {
|
|
15
|
+
flush: () => void;
|
|
16
|
+
cancel: () => void;
|
|
17
|
+
pending: boolean;
|
|
18
|
+
/** Epoch ms when the next commit is scheduled (or undefined if none) */
|
|
19
|
+
nextCommitAt?: number;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export interface SetOptions {
|
|
23
|
+
/**
|
|
24
|
+
* If true, this call starts (or refreshes) the immediate mini-window and
|
|
25
|
+
* LOCKS it so subsequent calls during that immediate window cannot reschedule/extend it.
|
|
26
|
+
* Later calls still coalesce the value, but the deadline stays fixed.
|
|
27
|
+
*/
|
|
28
|
+
noImmediateInterrupt?: boolean;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
type Mode = "immediate" | "cooldown" | null;
|
|
32
|
+
|
|
33
|
+
export function useSmartDebouncedState<T>(
|
|
34
|
+
initial: T,
|
|
35
|
+
options: UseSmartDebouncedStateOptions<T>,
|
|
36
|
+
): [T, (next: T, opts?: SetOptions) => void, SmartDebouncedMeta] {
|
|
37
|
+
const { interval, immediate = 0, isEqual = Object.is } = options;
|
|
38
|
+
|
|
39
|
+
const [value, setValue] = useState<T>(initial);
|
|
40
|
+
|
|
41
|
+
const lastCommitRef = useRef<number>(Number.NEGATIVE_INFINITY);
|
|
42
|
+
const timerRef = useRef<ReturnType<typeof setTimeout> | null>(null);
|
|
43
|
+
const modeRef = useRef<Mode>(null);
|
|
44
|
+
const pendingRef = useRef<T | undefined>(undefined);
|
|
45
|
+
const lastRequestedRef = useRef<T>(initial);
|
|
46
|
+
const nextCommitAtRef = useRef<number | undefined>(undefined);
|
|
47
|
+
const immediateLockUntilRef = useRef<number | undefined>(undefined); // <-- NEW
|
|
48
|
+
|
|
49
|
+
const clearTimer = useCallback(() => {
|
|
50
|
+
if (timerRef.current) {
|
|
51
|
+
clearTimeout(timerRef.current);
|
|
52
|
+
timerRef.current = null;
|
|
53
|
+
}
|
|
54
|
+
modeRef.current = null;
|
|
55
|
+
nextCommitAtRef.current = undefined;
|
|
56
|
+
immediateLockUntilRef.current = undefined; // clear lock on timer clear
|
|
57
|
+
}, []);
|
|
58
|
+
|
|
59
|
+
const commit = useCallback(
|
|
60
|
+
(next: T, at: number = Date.now()) => {
|
|
61
|
+
clearTimer();
|
|
62
|
+
pendingRef.current = undefined;
|
|
63
|
+
if (!isEqual(value, next)) setValue(next);
|
|
64
|
+
lastCommitRef.current = at;
|
|
65
|
+
},
|
|
66
|
+
[clearTimer, isEqual, value],
|
|
67
|
+
);
|
|
68
|
+
|
|
69
|
+
const scheduleAt = useCallback(
|
|
70
|
+
(deadlineMs: number, asMode: Mode) => {
|
|
71
|
+
clearTimer();
|
|
72
|
+
modeRef.current = asMode;
|
|
73
|
+
nextCommitAtRef.current = deadlineMs;
|
|
74
|
+
const delay = Math.max(0, deadlineMs - Date.now());
|
|
75
|
+
timerRef.current = setTimeout(() => {
|
|
76
|
+
timerRef.current = null;
|
|
77
|
+
modeRef.current = null;
|
|
78
|
+
const pv = pendingRef.current;
|
|
79
|
+
nextCommitAtRef.current = undefined;
|
|
80
|
+
immediateLockUntilRef.current = undefined; // unlock at fire
|
|
81
|
+
if (pv !== undefined) commit(pv, deadlineMs);
|
|
82
|
+
}, delay);
|
|
83
|
+
},
|
|
84
|
+
[clearTimer, commit],
|
|
85
|
+
);
|
|
86
|
+
|
|
87
|
+
const set = useCallback(
|
|
88
|
+
(next: T, opts?: SetOptions) => {
|
|
89
|
+
// (5) No-op if same as previous *request* input
|
|
90
|
+
if (isEqual(next, value)) return;
|
|
91
|
+
lastRequestedRef.current = next;
|
|
92
|
+
|
|
93
|
+
const now = Date.now();
|
|
94
|
+
const cooldownDeadline = lastCommitRef.current + interval;
|
|
95
|
+
const idle = now >= cooldownDeadline;
|
|
96
|
+
|
|
97
|
+
// Always coalesce to the latest requested value
|
|
98
|
+
pendingRef.current = next;
|
|
99
|
+
|
|
100
|
+
if (idle) {
|
|
101
|
+
if (immediate <= 0) {
|
|
102
|
+
// No mini-window → commit immediately (unless same as state)
|
|
103
|
+
if (!isEqual(value, next)) commit(next, now);
|
|
104
|
+
else pendingRef.current = undefined;
|
|
105
|
+
return;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
// Immediate mini-window path
|
|
109
|
+
const inImmediate = timerRef.current != null && modeRef.current === "immediate";
|
|
110
|
+
const lockActive =
|
|
111
|
+
inImmediate && immediateLockUntilRef.current !== undefined && now < immediateLockUntilRef.current;
|
|
112
|
+
|
|
113
|
+
if (inImmediate && lockActive) {
|
|
114
|
+
// A locked immediate window is running → DO NOT reschedule.
|
|
115
|
+
// We only update the pending value (already done above).
|
|
116
|
+
return;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
const deadline = now + immediate;
|
|
120
|
+
|
|
121
|
+
// Start/refresh immediate. If this call requests a lock, set/refresh the lock to this deadline.
|
|
122
|
+
scheduleAt(deadline, "immediate");
|
|
123
|
+
if (opts?.noImmediateInterrupt) {
|
|
124
|
+
immediateLockUntilRef.current = deadline + (interval - immediate); // lock until end of cooldown after immediate
|
|
125
|
+
} else {
|
|
126
|
+
// If caller didn't request a lock, we clear any prior lock so future calls may reschedule
|
|
127
|
+
immediateLockUntilRef.current = undefined;
|
|
128
|
+
}
|
|
129
|
+
} else {
|
|
130
|
+
// Cooldown → fixed deadline (never extended)
|
|
131
|
+
scheduleAt(cooldownDeadline, "cooldown");
|
|
132
|
+
// Cooldown ignores immediate lock
|
|
133
|
+
immediateLockUntilRef.current = undefined;
|
|
134
|
+
}
|
|
135
|
+
},
|
|
136
|
+
[commit, immediate, interval, isEqual, scheduleAt, value],
|
|
137
|
+
);
|
|
138
|
+
|
|
139
|
+
const flush = useCallback(() => {
|
|
140
|
+
const pv = pendingRef.current;
|
|
141
|
+
if (pv !== undefined) commit(pv);
|
|
142
|
+
}, [commit]);
|
|
143
|
+
|
|
144
|
+
const cancel = useCallback(() => {
|
|
145
|
+
pendingRef.current = undefined;
|
|
146
|
+
clearTimer();
|
|
147
|
+
}, [clearTimer]);
|
|
148
|
+
|
|
149
|
+
useEffect(() => clearTimer, [clearTimer]);
|
|
150
|
+
|
|
151
|
+
return [
|
|
152
|
+
value,
|
|
153
|
+
set,
|
|
154
|
+
{
|
|
155
|
+
flush,
|
|
156
|
+
cancel,
|
|
157
|
+
pending: timerRef.current != null,
|
|
158
|
+
nextCommitAt: nextCommitAtRef.current,
|
|
159
|
+
},
|
|
160
|
+
];
|
|
161
|
+
}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import React, { useContext, createContext, ReactNode, useEffect, useState } from "react";
|
|
2
|
+
import { ClockDetails } from "../game/ClockDetails";
|
|
3
|
+
import { Chit } from "../game/Chit";
|
|
4
|
+
import { useConnection } from "./useConnection";
|
|
5
|
+
import { ClientTime } from "../game/clientTransport/ClientTime";
|
|
6
|
+
import { ClientTimeState } from "../game/ClientTimeState";
|
|
7
|
+
import { ClientPrompts } from "../game/clientTransport/ClientPrompts";
|
|
8
|
+
import { usePlayerId } from "./usePlayer";
|
|
9
|
+
import { ClientStatus } from "../game/clientTransport/ClientStatus";
|
|
10
|
+
import { useGame } from "./useGame";
|
|
11
|
+
import { useEventChannelState } from "./useEventChannelState";
|
|
12
|
+
|
|
13
|
+
export class TimeState {
|
|
14
|
+
public targetClock: number = 1;
|
|
15
|
+
public currentClock: ClockDetails = { clock: 0, pass: -1 };
|
|
16
|
+
public maxClock: ClockDetails = { clock: 0, pass: -1 };
|
|
17
|
+
public rootChit: Chit = new Chit();
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const TimeControllerContext = createContext<{
|
|
21
|
+
clientPrompts?: ClientPrompts<any, any>;
|
|
22
|
+
clientTimeState: ClientTimeState;
|
|
23
|
+
clientTime?: ClientTime;
|
|
24
|
+
clientStatus?: ClientStatus<any, any>;
|
|
25
|
+
}>({ clientTimeState: new ClientTimeState() });
|
|
26
|
+
|
|
27
|
+
export function useTimeController() {
|
|
28
|
+
const result = useContext(TimeControllerContext);
|
|
29
|
+
if (!result.clientTime) {
|
|
30
|
+
throw new Error("Connection is required");
|
|
31
|
+
}
|
|
32
|
+
return result.clientTime;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export function useTimeState() {
|
|
36
|
+
const result = useContext(TimeControllerContext);
|
|
37
|
+
return result.clientTimeState;
|
|
38
|
+
}
|
|
39
|
+
export function useClientPrompts() {
|
|
40
|
+
const result = useContext(TimeControllerContext);
|
|
41
|
+
if (!result.clientPrompts) {
|
|
42
|
+
throw new Error("Connection is required");
|
|
43
|
+
}
|
|
44
|
+
return result.clientPrompts;
|
|
45
|
+
}
|
|
46
|
+
export function useClientStatus() {
|
|
47
|
+
const result = useContext(TimeControllerContext);
|
|
48
|
+
if (!result.clientStatus) {
|
|
49
|
+
throw new Error("Connection is required");
|
|
50
|
+
}
|
|
51
|
+
return result.clientStatus;
|
|
52
|
+
}
|
|
53
|
+
export function useAnimationSpeedMultiplier() {
|
|
54
|
+
const result = useContext(TimeControllerContext);
|
|
55
|
+
const [speed] = useEventChannelState(result.clientTimeState.animationSpeedMultiplier);
|
|
56
|
+
const [override] = useEventChannelState(result.clientTimeState.animationSpeedOverrideMultiplier);
|
|
57
|
+
if (override) {
|
|
58
|
+
return override;
|
|
59
|
+
}
|
|
60
|
+
return speed;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export function TimeControllerProvider({ children }: { children: ReactNode }) {
|
|
64
|
+
const connection = useConnection();
|
|
65
|
+
const playerId = usePlayerId();
|
|
66
|
+
const game = useGame();
|
|
67
|
+
const [clientTimeState] = useState<ClientTimeState>(new ClientTimeState());
|
|
68
|
+
const [clientTime, setClientTime] = useState<ClientTime | null>(null);
|
|
69
|
+
const [clientPrompts, setClientPrompts] = useState<ClientPrompts<any, any> | undefined>(undefined);
|
|
70
|
+
const [clientStatus, setClientStatus] = useState<ClientStatus<any, any> | undefined>(undefined);
|
|
71
|
+
|
|
72
|
+
useEffect(() => {
|
|
73
|
+
if (!connection) {
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
if (!clientTime || clientTime.connection !== connection) {
|
|
78
|
+
clientTime?.dispose();
|
|
79
|
+
|
|
80
|
+
const newClientTime = new ClientTime(connection, game, clientTimeState);
|
|
81
|
+
connection.register(newClientTime);
|
|
82
|
+
|
|
83
|
+
const cp = new ClientPrompts(playerId, connection, newClientTime);
|
|
84
|
+
connection.register(cp);
|
|
85
|
+
newClientTime.clientPrompt = cp; // circular reference. ugly.
|
|
86
|
+
|
|
87
|
+
const cs = new ClientStatus(connection);
|
|
88
|
+
connection.register(cs);
|
|
89
|
+
|
|
90
|
+
if (clientTime) {
|
|
91
|
+
newClientTime.maxClock.value = clientTime.maxClock.value;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
setClientTime(newClientTime);
|
|
95
|
+
setClientPrompts(cp);
|
|
96
|
+
setClientStatus(cs);
|
|
97
|
+
}
|
|
98
|
+
}, [connection, clientTime, game, clientTimeState, playerId]);
|
|
99
|
+
|
|
100
|
+
if (!clientTime) {
|
|
101
|
+
return null;
|
|
102
|
+
}
|
|
103
|
+
return (
|
|
104
|
+
<TimeControllerContext.Provider value={{ clientPrompts, clientTime, clientTimeState, clientStatus }}>
|
|
105
|
+
{children}
|
|
106
|
+
</TimeControllerContext.Provider>
|
|
107
|
+
);
|
|
108
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { useChit, useChits } from "../hooks/useChits";
|
|
2
|
+
import { PlayerChit } from "../game/PlayerChit";
|
|
3
|
+
import { RootChit } from "../game/RootChit";
|
|
4
|
+
import { TokenDefinition } from "../components/TokenizedMessage";
|
|
5
|
+
import { useGameTheme } from "./useGameTheme";
|
|
6
|
+
import { useGame } from "./useGame";
|
|
7
|
+
|
|
8
|
+
export function useTokenMap() {
|
|
9
|
+
const theme = useGameTheme();
|
|
10
|
+
const game = useGame();
|
|
11
|
+
const root = useChit<RootChit<PlayerChit>>("root");
|
|
12
|
+
const playerChits = useChits<PlayerChit>(root?.players.map((p) => p.id ?? "") ?? []);
|
|
13
|
+
|
|
14
|
+
const tokenMap: { [key: string]: TokenDefinition } = { ...(game.tokenMap ?? {}) };
|
|
15
|
+
playerChits?.forEach((p) => {
|
|
16
|
+
tokenMap[p.playerId] = { label: p.name ?? "??", color: p.color ?? theme.actionLogTextColor, image: p.imageUrl };
|
|
17
|
+
});
|
|
18
|
+
tokenMap["warning"] = { label: "⚠️" };
|
|
19
|
+
return tokenMap;
|
|
20
|
+
}
|