@pretty-chitty/core 2.0.0 → 2.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +8 -0
- package/dist/components/ActionLogDisplay.d.ts.map +1 -1
- package/dist/components/ActionLogDisplay.js +1 -1
- package/dist/components/ActionLogDisplay.js.map +1 -1
- package/dist/components/BottomBarButton.d.ts +3 -1
- package/dist/components/BottomBarButton.d.ts.map +1 -1
- package/dist/components/BottomBarButton.js +3 -2
- package/dist/components/BottomBarButton.js.map +1 -1
- package/dist/components/ContextGalleryDisplay.d.ts.map +1 -1
- package/dist/components/ContextGalleryDisplay.js +1 -1
- package/dist/components/ContextGalleryDisplay.js.map +1 -1
- package/dist/components/DemoWrapper.d.ts +33 -2
- package/dist/components/DemoWrapper.d.ts.map +1 -1
- package/dist/components/DemoWrapper.js +77 -36
- package/dist/components/DemoWrapper.js.map +1 -1
- package/dist/components/FullScreenGalleryDisplay.d.ts.map +1 -1
- package/dist/components/FullScreenGalleryDisplay.js +2 -2
- package/dist/components/FullScreenGalleryDisplay.js.map +1 -1
- package/dist/components/Gallery/BuiltItem.d.ts +16 -2
- package/dist/components/Gallery/BuiltItem.d.ts.map +1 -1
- package/dist/components/Gallery/BuiltItem.js +92 -16
- package/dist/components/Gallery/BuiltItem.js.map +1 -1
- package/dist/components/Gallery/GalleryController.d.ts +26 -0
- package/dist/components/Gallery/GalleryController.d.ts.map +1 -1
- package/dist/components/Gallery/GalleryController.js +106 -6
- package/dist/components/Gallery/GalleryController.js.map +1 -1
- package/dist/components/Gallery/GalleryViewer.d.ts +6 -1
- package/dist/components/Gallery/GalleryViewer.d.ts.map +1 -1
- package/dist/components/Gallery/GalleryViewer.js +139 -12
- package/dist/components/Gallery/GalleryViewer.js.map +1 -1
- package/dist/components/Gallery/LayoutManager.d.ts +10 -0
- package/dist/components/Gallery/LayoutManager.d.ts.map +1 -1
- package/dist/components/Gallery/LayoutManager.js +49 -3
- package/dist/components/Gallery/LayoutManager.js.map +1 -1
- package/dist/components/Gallery/constants.d.ts +6 -0
- package/dist/components/Gallery/constants.d.ts.map +1 -1
- package/dist/components/Gallery/constants.js +6 -0
- package/dist/components/Gallery/constants.js.map +1 -1
- package/dist/components/Gallery/registry.d.ts +34 -0
- package/dist/components/Gallery/registry.d.ts.map +1 -0
- package/dist/components/Gallery/registry.js +17 -0
- package/dist/components/Gallery/registry.js.map +1 -0
- package/dist/components/Gallery/types.d.ts +5 -0
- package/dist/components/Gallery/types.d.ts.map +1 -1
- package/dist/components/GameDesigner.d.ts.map +1 -1
- package/dist/components/GameDesigner.js +84 -10
- package/dist/components/GameDesigner.js.map +1 -1
- package/dist/components/InlineGalleryDisplay.d.ts.map +1 -1
- package/dist/components/InlineGalleryDisplay.js +35 -8
- package/dist/components/InlineGalleryDisplay.js.map +1 -1
- package/dist/components/LiveButton.d.ts.map +1 -1
- package/dist/components/LiveButton.js +5 -2
- package/dist/components/LiveButton.js.map +1 -1
- package/dist/components/MatchViewer.d.ts +6 -1
- package/dist/components/MatchViewer.d.ts.map +1 -1
- package/dist/components/MatchViewer.js +9 -3
- package/dist/components/MatchViewer.js.map +1 -1
- package/dist/components/Panel/ExternalDrag.d.ts +30 -0
- package/dist/components/Panel/ExternalDrag.d.ts.map +1 -0
- package/dist/components/Panel/ExternalDrag.js +87 -0
- package/dist/components/Panel/ExternalDrag.js.map +1 -0
- package/dist/components/Panel/MultiPanel.d.ts.map +1 -1
- package/dist/components/Panel/MultiPanel.js +18 -0
- package/dist/components/Panel/MultiPanel.js.map +1 -1
- package/dist/components/Panel/PanelContents.d.ts +3 -0
- package/dist/components/Panel/PanelContents.d.ts.map +1 -1
- package/dist/components/Panel/PanelContents.js +116 -23
- package/dist/components/Panel/PanelContents.js.map +1 -1
- package/dist/components/Panel/PanelTabStack.d.ts.map +1 -1
- package/dist/components/Panel/PanelTabStack.js +1 -1
- package/dist/components/Panel/PanelTabStack.js.map +1 -1
- package/dist/components/PanelSpark.d.ts.map +1 -1
- package/dist/components/PanelSpark.js +6 -3
- package/dist/components/PanelSpark.js.map +1 -1
- package/dist/components/Playground.d.ts.map +1 -1
- package/dist/components/Playground.js +10 -4
- package/dist/components/Playground.js.map +1 -1
- package/dist/components/PromptControls.d.ts.map +1 -1
- package/dist/components/PromptControls.js +4 -2
- package/dist/components/PromptControls.js.map +1 -1
- package/dist/components/SparkLineChart.d.ts.map +1 -1
- package/dist/components/SparkLineChart.js +22 -26
- package/dist/components/SparkLineChart.js.map +1 -1
- package/dist/components/TimeControlBar.d.ts.map +1 -1
- package/dist/components/TimeControlBar.js +5 -3
- package/dist/components/TimeControlBar.js.map +1 -1
- package/dist/components/TokenizedMarkdown.d.ts +23 -0
- package/dist/components/TokenizedMarkdown.d.ts.map +1 -0
- package/dist/components/TokenizedMarkdown.js +144 -0
- package/dist/components/TokenizedMarkdown.js.map +1 -0
- package/dist/components/TokenizedMessage.d.ts +6 -0
- package/dist/components/TokenizedMessage.d.ts.map +1 -1
- package/dist/components/TokenizedMessage.js +20 -19
- package/dist/components/TokenizedMessage.js.map +1 -1
- package/dist/components/TopBar.d.ts.map +1 -1
- package/dist/components/TopBar.js +3 -1
- package/dist/components/TopBar.js.map +1 -1
- package/dist/components/TopBarPlayers.d.ts.map +1 -1
- package/dist/components/TopBarPlayers.js +2 -2
- package/dist/components/TopBarPlayers.js.map +1 -1
- package/dist/components/Tutorial/BrowserNarration.d.ts +55 -0
- package/dist/components/Tutorial/BrowserNarration.d.ts.map +1 -0
- package/dist/components/Tutorial/BrowserNarration.js +240 -0
- package/dist/components/Tutorial/BrowserNarration.js.map +1 -0
- package/dist/components/Tutorial/TutorialBox.d.ts +26 -0
- package/dist/components/Tutorial/TutorialBox.d.ts.map +1 -0
- package/dist/components/Tutorial/TutorialBox.js +239 -0
- package/dist/components/Tutorial/TutorialBox.js.map +1 -0
- package/dist/components/Tutorial/TutorialDevPanel.d.ts +9 -0
- package/dist/components/Tutorial/TutorialDevPanel.d.ts.map +1 -0
- package/dist/components/Tutorial/TutorialDevPanel.js +92 -0
- package/dist/components/Tutorial/TutorialDevPanel.js.map +1 -0
- package/dist/components/Tutorial/TutorialOverlay.d.ts +7 -0
- package/dist/components/Tutorial/TutorialOverlay.d.ts.map +1 -0
- package/dist/components/Tutorial/TutorialOverlay.js +1147 -0
- package/dist/components/Tutorial/TutorialOverlay.js.map +1 -0
- package/dist/components/Tutorial/targetRects.d.ts +67 -0
- package/dist/components/Tutorial/targetRects.d.ts.map +1 -0
- package/dist/components/Tutorial/targetRects.js +241 -0
- package/dist/components/Tutorial/targetRects.js.map +1 -0
- package/dist/components/Viewer.d.ts.map +1 -1
- package/dist/components/Viewer.js +1 -0
- package/dist/components/Viewer.js.map +1 -1
- package/dist/game/Chit.d.ts +10 -1
- package/dist/game/Chit.d.ts.map +1 -1
- package/dist/game/Chit.js +24 -6
- package/dist/game/Chit.js.map +1 -1
- package/dist/game/ClientTimeState.d.ts +14 -0
- package/dist/game/ClientTimeState.d.ts.map +1 -1
- package/dist/game/ClientTimeState.js +17 -0
- package/dist/game/ClientTimeState.js.map +1 -1
- package/dist/game/GalleryItemChitChildrenSource.d.ts +1 -0
- package/dist/game/GalleryItemChitChildrenSource.d.ts.map +1 -1
- package/dist/game/GalleryItemChitChildrenSource.js +1 -0
- package/dist/game/GalleryItemChitChildrenSource.js.map +1 -1
- package/dist/game/GalleryItemRawSource.d.ts +1 -0
- package/dist/game/GalleryItemRawSource.d.ts.map +1 -1
- package/dist/game/GalleryItemRawSource.js +1 -0
- package/dist/game/GalleryItemRawSource.js.map +1 -1
- package/dist/game/Game.d.ts +6 -0
- package/dist/game/Game.d.ts.map +1 -1
- package/dist/game/GameButton.d.ts +8 -0
- package/dist/game/GameButton.d.ts.map +1 -1
- package/dist/game/GameButton.js +13 -1
- package/dist/game/GameButton.js.map +1 -1
- package/dist/game/GameTheme.d.ts +3 -0
- package/dist/game/GameTheme.d.ts.map +1 -1
- package/dist/game/GameTheme.js +2 -0
- package/dist/game/GameTheme.js.map +1 -1
- package/dist/game/Match.d.ts +8 -2
- package/dist/game/Match.d.ts.map +1 -1
- package/dist/game/Match.js +4 -1
- package/dist/game/Match.js.map +1 -1
- package/dist/game/ModalState.d.ts +3 -0
- package/dist/game/ModalState.d.ts.map +1 -1
- package/dist/game/ModalState.js +2 -0
- package/dist/game/ModalState.js.map +1 -1
- package/dist/game/Pick.d.ts +2 -0
- package/dist/game/Pick.d.ts.map +1 -1
- package/dist/game/Pick.js +18 -4
- package/dist/game/Pick.js.map +1 -1
- package/dist/game/PlayerPromptStatusChit.d.ts +8 -0
- package/dist/game/PlayerPromptStatusChit.d.ts.map +1 -1
- package/dist/game/PlayerPromptStatusChit.js +6 -4
- package/dist/game/PlayerPromptStatusChit.js.map +1 -1
- package/dist/game/Prompt.d.ts +18 -1
- package/dist/game/Prompt.d.ts.map +1 -1
- package/dist/game/Prompt.js +29 -1
- package/dist/game/Prompt.js.map +1 -1
- package/dist/game/SparkChit.d.ts +6 -0
- package/dist/game/SparkChit.d.ts.map +1 -1
- package/dist/game/SparkChit.js +8 -0
- package/dist/game/SparkChit.js.map +1 -1
- package/dist/game/Turn.d.ts +17 -6
- package/dist/game/Turn.d.ts.map +1 -1
- package/dist/game/Turn.js +179 -69
- package/dist/game/Turn.js.map +1 -1
- package/dist/game/TurnState.d.ts +12 -1
- package/dist/game/TurnState.d.ts.map +1 -1
- package/dist/game/TurnState.js +15 -3
- package/dist/game/TurnState.js.map +1 -1
- package/dist/game/ai/AiClientPrompts.d.ts +20 -3
- package/dist/game/ai/AiClientPrompts.d.ts.map +1 -1
- package/dist/game/ai/AiClientPrompts.js +42 -6
- package/dist/game/ai/AiClientPrompts.js.map +1 -1
- package/dist/game/ai/AiPlayerView.js +2 -0
- package/dist/game/ai/AiPlayerView.js.map +1 -1
- package/dist/game/clientTransport/ClientPrompts.d.ts +22 -1
- package/dist/game/clientTransport/ClientPrompts.d.ts.map +1 -1
- package/dist/game/clientTransport/ClientPrompts.js +72 -5
- package/dist/game/clientTransport/ClientPrompts.js.map +1 -1
- package/dist/game/clientTransport/ClientTime.d.ts +13 -0
- package/dist/game/clientTransport/ClientTime.d.ts.map +1 -1
- package/dist/game/clientTransport/ClientTime.js +71 -12
- package/dist/game/clientTransport/ClientTime.js.map +1 -1
- package/dist/game/tutorial/TutorialController.d.ts +308 -0
- package/dist/game/tutorial/TutorialController.d.ts.map +1 -0
- package/dist/game/tutorial/TutorialController.js +1195 -0
- package/dist/game/tutorial/TutorialController.js.map +1 -0
- package/dist/game/tutorial/TutorialRuntime.d.ts +89 -0
- package/dist/game/tutorial/TutorialRuntime.d.ts.map +1 -0
- package/dist/game/tutorial/TutorialRuntime.js +261 -0
- package/dist/game/tutorial/TutorialRuntime.js.map +1 -0
- package/dist/game/tutorial/TutorialTheme.d.ts +28 -0
- package/dist/game/tutorial/TutorialTheme.d.ts.map +1 -0
- package/dist/game/tutorial/TutorialTheme.js +39 -0
- package/dist/game/tutorial/TutorialTheme.js.map +1 -0
- package/dist/game/tutorial/allowed.d.ts +2 -0
- package/dist/game/tutorial/allowed.d.ts.map +1 -0
- package/dist/game/tutorial/allowed.js +119 -0
- package/dist/game/tutorial/allowed.js.map +1 -0
- package/dist/game/tutorial/checks.d.ts +58 -0
- package/dist/game/tutorial/checks.d.ts.map +1 -0
- package/dist/game/tutorial/checks.js +144 -0
- package/dist/game/tutorial/checks.js.map +1 -0
- package/dist/game/tutorial/createDemoMatch.d.ts +47 -0
- package/dist/game/tutorial/createDemoMatch.d.ts.map +1 -0
- package/dist/game/tutorial/createDemoMatch.js +67 -0
- package/dist/game/tutorial/createDemoMatch.js.map +1 -0
- package/dist/game/tutorial/defineTutorial.d.ts +353 -0
- package/dist/game/tutorial/defineTutorial.d.ts.map +1 -0
- package/dist/game/tutorial/defineTutorial.js +86 -0
- package/dist/game/tutorial/defineTutorial.js.map +1 -0
- package/dist/game/tutorial/runTutorial.d.ts +64 -0
- package/dist/game/tutorial/runTutorial.d.ts.map +1 -0
- package/dist/game/tutorial/runTutorial.js +293 -0
- package/dist/game/tutorial/runTutorial.js.map +1 -0
- package/dist/hooks/usePanelNavigation.d.ts +28 -0
- package/dist/hooks/usePanelNavigation.d.ts.map +1 -0
- package/dist/hooks/usePanelNavigation.js +36 -0
- package/dist/hooks/usePanelNavigation.js.map +1 -0
- package/dist/hooks/useTimeController.d.ts +4 -1
- package/dist/hooks/useTimeController.d.ts.map +1 -1
- package/dist/hooks/useTimeController.js +10 -2
- package/dist/hooks/useTimeController.js.map +1 -1
- package/dist/hooks/useTutorial.d.ts +51 -0
- package/dist/hooks/useTutorial.d.ts.map +1 -0
- package/dist/hooks/useTutorial.js +16 -0
- package/dist/hooks/useTutorial.js.map +1 -0
- package/dist/index.d.ts +37 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +19 -2
- package/dist/index.js.map +1 -1
- package/dist/rendering/CameraWrapperPerspective.d.ts +5 -0
- package/dist/rendering/CameraWrapperPerspective.d.ts.map +1 -1
- package/dist/rendering/CameraWrapperPerspective.js +16 -0
- package/dist/rendering/CameraWrapperPerspective.js.map +1 -1
- package/dist/rendering/ChitGalleryItemInstance.d.ts +14 -3
- package/dist/rendering/ChitGalleryItemInstance.d.ts.map +1 -1
- package/dist/rendering/ChitGalleryItemInstance.js +29 -1
- package/dist/rendering/ChitGalleryItemInstance.js.map +1 -1
- package/dist/rendering/ChitRenderInstance.d.ts +15 -1
- package/dist/rendering/ChitRenderInstance.d.ts.map +1 -1
- package/dist/rendering/ChitRenderInstance.js +49 -4
- package/dist/rendering/ChitRenderInstance.js.map +1 -1
- package/dist/rendering/LightWrapper.d.ts.map +1 -1
- package/dist/rendering/LightWrapper.js +10 -1
- package/dist/rendering/LightWrapper.js.map +1 -1
- package/dist/rendering/RootChitRenderInstance.d.ts +2 -0
- package/dist/rendering/RootChitRenderInstance.d.ts.map +1 -1
- package/dist/rendering/RootChitRenderInstance.js +29 -0
- package/dist/rendering/RootChitRenderInstance.js.map +1 -1
- package/dist/rendering/Splay.d.ts +11 -0
- package/dist/rendering/Splay.d.ts.map +1 -1
- package/dist/rendering/Splay.js +20 -10
- package/dist/rendering/Splay.js.map +1 -1
- package/dist/utilities/Annotations.d.ts +15 -0
- package/dist/utilities/Annotations.d.ts.map +1 -1
- package/dist/utilities/Annotations.js +31 -7
- package/dist/utilities/Annotations.js.map +1 -1
- package/dist/utilities/CanvasStack/CanvasStack.d.ts +2 -0
- package/dist/utilities/CanvasStack/CanvasStack.d.ts.map +1 -1
- package/dist/utilities/CanvasStack/CanvasStack.js +4 -0
- package/dist/utilities/CanvasStack/CanvasStack.js.map +1 -1
- package/dist/utilities/CanvasStack/RichTextRenderer.d.ts.map +1 -1
- package/dist/utilities/CanvasStack/RichTextRenderer.js +12 -0
- package/dist/utilities/CanvasStack/RichTextRenderer.js.map +1 -1
- package/dist/utilities/Dice.d.ts +2 -0
- package/dist/utilities/Dice.d.ts.map +1 -1
- package/dist/utilities/Dice.js +5 -1
- package/dist/utilities/Dice.js.map +1 -1
- package/dist/utilities/GalleryItemConversion.d.ts.map +1 -1
- package/dist/utilities/GalleryItemConversion.js +5 -7
- package/dist/utilities/GalleryItemConversion.js.map +1 -1
- package/dist/utilities/TokenizedText.d.ts +6 -0
- package/dist/utilities/TokenizedText.d.ts.map +1 -1
- package/dist/utilities/TokenizedText.js.map +1 -1
- package/dist/utilities/zIndex.d.ts +1 -0
- package/dist/utilities/zIndex.d.ts.map +1 -1
- package/dist/utilities/zIndex.js +1 -0
- package/dist/utilities/zIndex.js.map +1 -1
- package/package.json +3 -2
- package/src/library/components/ActionLogDisplay.tsx +1 -0
- package/src/library/components/BottomBarButton.tsx +5 -0
- package/src/library/components/ContextGalleryDisplay.tsx +2 -0
- package/src/library/components/DemoWrapper.tsx +150 -44
- package/src/library/components/FullScreenGalleryDisplay.tsx +3 -0
- package/src/library/components/Gallery/BuiltItem.ts +92 -16
- package/src/library/components/Gallery/GalleryController.ts +111 -10
- package/src/library/components/Gallery/GalleryViewer.tsx +144 -12
- package/src/library/components/Gallery/LayoutManager.ts +55 -6
- package/src/library/components/Gallery/constants.ts +6 -0
- package/src/library/components/Gallery/registry.ts +44 -0
- package/src/library/components/Gallery/types.ts +6 -0
- package/src/library/components/GameDesigner.tsx +165 -12
- package/src/library/components/InlineGalleryDisplay.tsx +41 -6
- package/src/library/components/LiveButton.tsx +8 -5
- package/src/library/components/MatchViewer.tsx +14 -3
- package/src/library/components/Panel/ExternalDrag.ts +122 -0
- package/src/library/components/Panel/MultiPanel.tsx +21 -0
- package/src/library/components/Panel/PanelContents.tsx +96 -1
- package/src/library/components/Panel/PanelTabStack.tsx +1 -0
- package/src/library/components/PanelSpark.tsx +12 -5
- package/src/library/components/Playground.tsx +48 -21
- package/src/library/components/PromptControls.tsx +7 -3
- package/src/library/components/SparkLineChart.tsx +23 -27
- package/src/library/components/TimeControlBar.tsx +5 -3
- package/src/library/components/TokenizedMarkdown.tsx +224 -0
- package/src/library/components/TokenizedMessage.tsx +28 -32
- package/src/library/components/TopBar.tsx +2 -1
- package/src/library/components/TopBarPlayers.tsx +13 -15
- package/src/library/components/Tutorial/BrowserNarration.ts +233 -0
- package/src/library/components/Tutorial/TutorialBox.tsx +506 -0
- package/src/library/components/Tutorial/TutorialDevPanel.tsx +297 -0
- package/src/library/components/Tutorial/TutorialOverlay.tsx +1316 -0
- package/src/library/components/Tutorial/targetRects.ts +273 -0
- package/src/library/components/Viewer.tsx +1 -0
- package/src/library/game/Chit.ts +28 -7
- package/src/library/game/ClientTimeState.ts +18 -0
- package/src/library/game/GalleryItemChitChildrenSource.ts +1 -0
- package/src/library/game/GalleryItemRawSource.ts +1 -0
- package/src/library/game/Game.ts +7 -0
- package/src/library/game/GameButton.ts +13 -1
- package/src/library/game/GameTheme.ts +4 -0
- package/src/library/game/Match.ts +12 -2
- package/src/library/game/ModalState.ts +3 -0
- package/src/library/game/Pick.ts +17 -4
- package/src/library/game/PlayerPromptStatusChit.ts +6 -4
- package/src/library/game/Prompt.ts +33 -2
- package/src/library/game/SparkChit.ts +9 -0
- package/src/library/game/Turn.ts +185 -70
- package/src/library/game/TurnState.ts +26 -3
- package/src/library/game/ai/AI_GUIDE.md +10 -0
- package/src/library/game/ai/AiClientPrompts.ts +60 -11
- package/src/library/game/ai/AiPlayerView.ts +2 -0
- package/src/library/game/clientTransport/ClientPrompts.ts +76 -5
- package/src/library/game/clientTransport/ClientTime.ts +75 -14
- package/src/library/game/serialize.test.ts +275 -0
- package/src/library/game/tutorial/TUTORIAL_GUIDE.md +416 -0
- package/src/library/game/tutorial/TutorialController.test.ts +731 -0
- package/src/library/game/tutorial/TutorialController.ts +1299 -0
- package/src/library/game/tutorial/TutorialRuntime.ts +311 -0
- package/src/library/game/tutorial/TutorialTheme.ts +67 -0
- package/src/library/game/tutorial/allowed.ts +145 -0
- package/src/library/game/tutorial/checks.ts +186 -0
- package/src/library/game/tutorial/createDemoMatch.ts +115 -0
- package/src/library/game/tutorial/defineTutorial.ts +414 -0
- package/src/library/game/tutorial/runTutorial.ts +350 -0
- package/src/library/game/undo.test.ts +282 -0
- package/src/library/hooks/usePanelNavigation.tsx +65 -0
- package/src/library/hooks/useTimeController.tsx +10 -2
- package/src/library/hooks/useTutorial.tsx +80 -0
- package/src/library/index.ts +58 -2
- package/src/library/rendering/CameraWrapperPerspective.ts +17 -0
- package/src/library/rendering/ChitGalleryItemInstance.ts +30 -1
- package/src/library/rendering/ChitRenderInstance.ts +57 -4
- package/src/library/rendering/LightWrapper.ts +10 -1
- package/src/library/rendering/RootChitRenderInstance.ts +30 -1
- package/src/library/rendering/Splay.test.ts +60 -0
- package/src/library/rendering/Splay.ts +30 -9
- package/src/library/utilities/Annotations.ts +35 -7
- package/src/library/utilities/CanvasStack/CanvasStack.ts +6 -1
- package/src/library/utilities/CanvasStack/RichTextRenderer.ts +13 -0
- package/src/library/utilities/Dice.tsx +5 -1
- package/src/library/utilities/GalleryItemConversion.ts +5 -6
- package/src/library/utilities/TokenizedText.ts +6 -0
- package/src/library/utilities/zIndex.ts +1 -0
|
@@ -4,7 +4,9 @@ import { useEventChannelState } from "../hooks/useEventChannelState";
|
|
|
4
4
|
import { useModalState } from "../hooks/useModalState";
|
|
5
5
|
import { GalleryItem, GalleryViewer } from "./GalleryViewer";
|
|
6
6
|
import useSize from "@react-hook/size";
|
|
7
|
-
import { useAnimationSpeedMultiplier } from "../hooks/useTimeController";
|
|
7
|
+
import { useAnimationSpeedMultiplier, useOptionalClientPrompts } from "../hooks/useTimeController";
|
|
8
|
+
import { EventChannel } from "../utilities/EventChannel";
|
|
9
|
+
import { Prompt } from "../game/Prompt";
|
|
8
10
|
import { useGameTheme } from "../hooks/useGameTheme";
|
|
9
11
|
import { ScreenshotMonitor } from "@mui/icons-material";
|
|
10
12
|
import { useButtonGalleriesOptions } from "../hooks/useButtonGalleriesOptions";
|
|
@@ -24,9 +26,19 @@ export function InlineGalleryDisplay() {
|
|
|
24
26
|
const inlineGallerySize = inlineSource ? (inlineSource.inlineGallerySize ?? DEFAULT_INLINE_GALLERY_SIZE) : 0;
|
|
25
27
|
const [displaySize, setDisplaySize] = useState(0);
|
|
26
28
|
const [_galleryDisplayMode, setGalleryDisplayMode] = useButtonGalleriesOptions();
|
|
29
|
+
// A closed source that opted in to holdOnCloseMs leaves its items and height up for a while,
|
|
30
|
+
// so a gallery that opens right after swaps in place instead of animating out and back.
|
|
31
|
+
const lastSource = useRef<{ size: number; holdMs: number } | undefined>(undefined);
|
|
32
|
+
const [heldSize, setHeldSize] = useState<number | undefined>(undefined);
|
|
33
|
+
const shownSize = inlineGallerySize || heldSize || 0;
|
|
34
|
+
const clientPrompts = useOptionalClientPrompts();
|
|
35
|
+
const [noPrompts] = useState(() => new EventChannel<Prompt | undefined>(undefined));
|
|
36
|
+
const [prompt] = useEventChannelState(clientPrompts?.currentPrompt ?? noPrompts);
|
|
27
37
|
|
|
28
38
|
useEffect(() => {
|
|
29
39
|
if (inlineSource) {
|
|
40
|
+
lastSource.current = { size: inlineGallerySize, holdMs: inlineSource.inlineHoldOnCloseMs ?? 0 };
|
|
41
|
+
setHeldSize(undefined);
|
|
30
42
|
setItems(inlineSource.items);
|
|
31
43
|
const unSub = inlineSource.registerUpdateHandler(() => {
|
|
32
44
|
setItems(inlineSource.items);
|
|
@@ -35,21 +47,39 @@ export function InlineGalleryDisplay() {
|
|
|
35
47
|
inlineSource.close();
|
|
36
48
|
unSub();
|
|
37
49
|
};
|
|
38
|
-
} else {
|
|
39
|
-
setItems(undefined);
|
|
40
50
|
}
|
|
51
|
+
const last = lastSource.current;
|
|
52
|
+
lastSource.current = undefined;
|
|
53
|
+
if (last && last.holdMs > 0) {
|
|
54
|
+
setHeldSize(last.size);
|
|
55
|
+
const to = setTimeout(() => {
|
|
56
|
+
setHeldSize(undefined);
|
|
57
|
+
setItems(undefined);
|
|
58
|
+
}, last.holdMs);
|
|
59
|
+
return () => clearTimeout(to);
|
|
60
|
+
}
|
|
61
|
+
setItems(undefined);
|
|
41
62
|
}, [inlineSource, setItems, inlineGallerySize]);
|
|
42
63
|
|
|
64
|
+
// The hold only bridges a wait for the next prompt: a prompt showing with no inline gallery
|
|
65
|
+
// (or the gallery toggled shut on the same prompt) ends it at once.
|
|
66
|
+
useEffect(() => {
|
|
67
|
+
if (prompt && !inlineSource) {
|
|
68
|
+
setHeldSize(undefined);
|
|
69
|
+
setItems(undefined);
|
|
70
|
+
}
|
|
71
|
+
}, [prompt, inlineSource, setItems]);
|
|
72
|
+
|
|
43
73
|
useEffect(() => {
|
|
44
|
-
if (items && items.length > 0 &&
|
|
45
|
-
setDisplaySize(
|
|
74
|
+
if (items && items.length > 0 && shownSize > 0) {
|
|
75
|
+
setDisplaySize(shownSize);
|
|
46
76
|
} else {
|
|
47
77
|
const to = setTimeout(() => {
|
|
48
78
|
setDisplaySize(0);
|
|
49
79
|
}, 250);
|
|
50
80
|
return () => clearTimeout(to);
|
|
51
81
|
}
|
|
52
|
-
}, [
|
|
82
|
+
}, [shownSize, items, setDisplaySize]);
|
|
53
83
|
|
|
54
84
|
return (
|
|
55
85
|
<Box
|
|
@@ -63,7 +93,9 @@ export function InlineGalleryDisplay() {
|
|
|
63
93
|
>
|
|
64
94
|
{
|
|
65
95
|
<>
|
|
96
|
+
{inlineSource && (
|
|
66
97
|
<IconButton
|
|
98
|
+
data-tutorial-target="gallery:toFullscreen"
|
|
67
99
|
sx={{
|
|
68
100
|
backgroundColor: theme.inlineGalleryButtonBackgroundColor,
|
|
69
101
|
position: "absolute",
|
|
@@ -80,8 +112,11 @@ export function InlineGalleryDisplay() {
|
|
|
80
112
|
>
|
|
81
113
|
<ScreenshotMonitor sx={{ color: theme.inlineGalleryButtonForegroundColor }} />
|
|
82
114
|
</IconButton>
|
|
115
|
+
)}
|
|
83
116
|
|
|
84
117
|
<GalleryViewer
|
|
118
|
+
kind="inline"
|
|
119
|
+
tutorialTarget="gallery:inline"
|
|
85
120
|
zFactor={0}
|
|
86
121
|
onClose={() => {}}
|
|
87
122
|
onLongPress={() => {
|
|
@@ -10,18 +10,21 @@ export default function LiveButton({ hideIfLive = true }: { hideIfLive?: boolean
|
|
|
10
10
|
const [targetClock] = useEventChannelState(timeState.targetClock);
|
|
11
11
|
const [maxClock] = useEventChannelState(timeController.maxClock);
|
|
12
12
|
const [live] = useEventChannelState(timeState.live);
|
|
13
|
+
// A tutorial holding the board counts as the end: there is nothing to skip to past it
|
|
14
|
+
const [hold] = useEventChannelState(timeState.timelineHold);
|
|
15
|
+
const end = hold === undefined ? maxClock.clock : Math.min(hold, maxClock.clock);
|
|
13
16
|
|
|
14
|
-
if (hideIfLive && targetClock >=
|
|
17
|
+
if (hideIfLive && targetClock >= end) {
|
|
15
18
|
return null;
|
|
16
19
|
}
|
|
17
20
|
|
|
18
21
|
return (
|
|
19
22
|
<BottomBarButton
|
|
20
|
-
disabled={targetClock >=
|
|
23
|
+
disabled={targetClock >= end && live}
|
|
21
24
|
icon={SkipNext}
|
|
22
|
-
label={live && targetClock <
|
|
23
|
-
invisible={live && targetClock >=
|
|
24
|
-
onClick={() => timeState.goLive(
|
|
25
|
+
label={live && targetClock < end ? "Skip" : "Live"}
|
|
26
|
+
invisible={live && targetClock >= end}
|
|
27
|
+
onClick={() => timeState.goLive(end)}
|
|
25
28
|
/>
|
|
26
29
|
);
|
|
27
30
|
}
|
|
@@ -13,6 +13,7 @@ import { FullScreenGalleryDisplay } from "./FullScreenGalleryDisplay";
|
|
|
13
13
|
import { ActionLogDisplay } from "./ActionLogDisplay";
|
|
14
14
|
import { ActionLogHistoryDisplay } from "./ActionLogHistoryDisplay";
|
|
15
15
|
import { PanelContents } from "./Panel/PanelContents";
|
|
16
|
+
import { PanelNavigationHolder } from "../hooks/usePanelNavigation";
|
|
16
17
|
import useSize from "@react-hook/size";
|
|
17
18
|
import { SettingsDisplay } from "./SettingsDisplay";
|
|
18
19
|
import { ActionLogSidebar } from "./ActionLogSidebar";
|
|
@@ -20,6 +21,7 @@ import { InlineGalleryDisplay } from "./InlineGalleryDisplay";
|
|
|
20
21
|
import { useLoadingState } from "../hooks/useLoadingStates";
|
|
21
22
|
import { GameTheme } from "../game/GameTheme";
|
|
22
23
|
import { ModalState } from "../game/ModalState";
|
|
24
|
+
import { TutorialOverlay } from "./Tutorial/TutorialOverlay";
|
|
23
25
|
|
|
24
26
|
function createMuiTheme(gameTheme: GameTheme) {
|
|
25
27
|
return createTheme({
|
|
@@ -104,22 +106,31 @@ function InnerMatchViewer({ onBack }: { onBack?: () => void }) {
|
|
|
104
106
|
</Stack>
|
|
105
107
|
|
|
106
108
|
{largeEnoughToShowLogSidebar && showLog && <ActionLogSidebar />}
|
|
109
|
+
|
|
110
|
+
<TutorialOverlay />
|
|
107
111
|
</Stack>
|
|
108
112
|
);
|
|
109
113
|
}
|
|
110
114
|
|
|
111
|
-
|
|
115
|
+
/**
|
|
116
|
+
* @param skipReplay Open live instead of replaying the moves since the player's last answer (a
|
|
117
|
+
* tutorial uses it after rebuilding the match for Back)
|
|
118
|
+
*/
|
|
119
|
+
export function MatchViewer({ onBack, skipReplay = false }: { onBack?: () => void; skipReplay?: boolean }) {
|
|
112
120
|
const game = useGame();
|
|
113
121
|
const [modalState] = useState<ModalState>(new ModalState());
|
|
114
122
|
const muiTheme = useMemo(() => createMuiTheme(game.theme), [game.theme]);
|
|
115
123
|
return (
|
|
116
|
-
<TimeControllerProvider>
|
|
124
|
+
<TimeControllerProvider skipReplay={skipReplay}>
|
|
117
125
|
<PanelScaleProvider>
|
|
118
126
|
<ModalProvider modalState={modalState}>
|
|
119
127
|
<GameThemeProvider theme={game.theme}>
|
|
120
128
|
<ThemeProvider theme={muiTheme}>
|
|
121
129
|
<CssBaseline />
|
|
122
|
-
|
|
130
|
+
{/* the tutorial overlay sits beside the panels and switches them through this */}
|
|
131
|
+
<PanelNavigationHolder>
|
|
132
|
+
<InnerMatchViewer onBack={onBack} />
|
|
133
|
+
</PanelNavigationHolder>
|
|
123
134
|
</ThemeProvider>
|
|
124
135
|
</GameThemeProvider>
|
|
125
136
|
</ModalProvider>
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import { Box3, Object3D, Vector3 } from "three";
|
|
2
|
+
import { Chit } from "../../game/Chit";
|
|
3
|
+
import { GalleryItem } from "../Gallery/types";
|
|
4
|
+
import { RootChitRenderInstance } from "../../rendering/RootChitRenderInstance";
|
|
5
|
+
import { ChitGalleryItemInstance } from "../../rendering/ChitGalleryItemInstance";
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* A drag that starts outside the board, for now only in the inline gallery strip: a chit
|
|
9
|
+
* shown there with a live DragPick is pulled up onto the panel that holds its drop targets.
|
|
10
|
+
* Coordinates are client (page) pixels.
|
|
11
|
+
*/
|
|
12
|
+
export interface ExternalDrag {
|
|
13
|
+
move(clientX: number, clientY: number): void;
|
|
14
|
+
/** Drops on the target under the pointer, if any; off the board it does nothing. */
|
|
15
|
+
end(): void;
|
|
16
|
+
cancel(): void;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export interface ExternalDragHost {
|
|
20
|
+
/** Undefined when the chit can't be dragged now, or its targets aren't on a visible panel. */
|
|
21
|
+
begin(chit: Chit, item: GalleryItem, clientX: number, clientY: number): ExternalDrag | undefined;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
// How long the set-down copy stays after a drop, covering the round trip to the game.
|
|
25
|
+
const SETTLE_MS = 600;
|
|
26
|
+
|
|
27
|
+
export interface ExternalDragViewer {
|
|
28
|
+
getBounds: () => DOMRect | null;
|
|
29
|
+
renderInstance: RootChitRenderInstance;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Draws a copy of the chit under the pointer on the target panel, lifted like a normal drag,
|
|
34
|
+
* and outlines the nearest drop target, exactly as `ChitRenderInstance.executeDrag` does on
|
|
35
|
+
* the table. Dropping calls the chit's `onDrag`, so the DragPick resolves as if the chit had
|
|
36
|
+
* been dragged there; the chit itself is not moved on the client (it lives in the gallery).
|
|
37
|
+
*/
|
|
38
|
+
export function startExternalDrag(
|
|
39
|
+
chit: Chit,
|
|
40
|
+
item: GalleryItem,
|
|
41
|
+
viewer: ExternalDragViewer,
|
|
42
|
+
clientX: number,
|
|
43
|
+
clientY: number,
|
|
44
|
+
): ExternalDrag {
|
|
45
|
+
const root = viewer.renderInstance;
|
|
46
|
+
// cloneMesh, not createMesh: createMesh would bind the gallery's item to the board's scene, so
|
|
47
|
+
// after a cancelled drag its updates would redraw the board instead of the strip
|
|
48
|
+
const ghost: Object3D = item instanceof ChitGalleryItemInstance ? item.cloneMesh() : item.createMesh(root.sceneWrapper);
|
|
49
|
+
ghost.visible = false;
|
|
50
|
+
root.sceneWrapper.scene.add(ghost);
|
|
51
|
+
const lift = chit.renderInstance?.dragLift ?? 1;
|
|
52
|
+
const targets = (chit.dropTargets ?? [])
|
|
53
|
+
.filter((t) => t.renderInstance && t.renderInstance.rootRenderInstance === root)
|
|
54
|
+
.map((t) => ({ chit: t, at: t.renderInstance!.worldCenter() }));
|
|
55
|
+
|
|
56
|
+
let dropTarget: Chit | undefined;
|
|
57
|
+
const setTarget = (t: Chit | undefined) => {
|
|
58
|
+
if (dropTarget === t) return;
|
|
59
|
+
dropTarget?.renderInstance?.markAsDropTarget(false);
|
|
60
|
+
dropTarget = t;
|
|
61
|
+
t?.renderInstance?.markAsDropTarget(true);
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
const move = (x: number, y: number) => {
|
|
65
|
+
const b = viewer.getBounds();
|
|
66
|
+
const inside = !!b && x >= b.left && x <= b.right && y >= b.top && y <= b.bottom;
|
|
67
|
+
const p = inside ? root.attemptToFindPlaneZ0OfCanvasPoints(x - b!.left, y - b!.top) : undefined;
|
|
68
|
+
if (!p || targets.length === 0) {
|
|
69
|
+
ghost.visible = false;
|
|
70
|
+
setTarget(undefined);
|
|
71
|
+
root.markDirty();
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
let nearest = targets[0];
|
|
75
|
+
let best = Number.MAX_VALUE;
|
|
76
|
+
for (const t of targets) {
|
|
77
|
+
const d = (t.at.x - p.x) * (t.at.x - p.x) + (t.at.y - p.y) * (t.at.y - p.y);
|
|
78
|
+
if (d < best) {
|
|
79
|
+
best = d;
|
|
80
|
+
nearest = t;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
ghost.position.set(p.x, p.y, nearest.at.z + lift);
|
|
84
|
+
ghost.visible = true;
|
|
85
|
+
setTarget(nearest.chit);
|
|
86
|
+
root.markDirty();
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
const removeGhost = () => {
|
|
90
|
+
ghost.removeFromParent();
|
|
91
|
+
root.markDirty();
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
move(clientX, clientY);
|
|
95
|
+
return {
|
|
96
|
+
move,
|
|
97
|
+
end: () => {
|
|
98
|
+
const t = dropTarget;
|
|
99
|
+
const at = targets.find((x) => x.chit === t)?.at;
|
|
100
|
+
setTarget(undefined);
|
|
101
|
+
if (!t || !at || !chit.onDrag) {
|
|
102
|
+
removeGhost();
|
|
103
|
+
return;
|
|
104
|
+
}
|
|
105
|
+
// Set the copy down on the spot and keep it there while the move goes to the game: the
|
|
106
|
+
// chit the game creates appears under it, so the piece doesn't blink out and fly back in.
|
|
107
|
+
// Resting on the target, not centred on it (half of it would sink into whatever is there).
|
|
108
|
+
ghost.position.set(at.x, at.y, at.z + new Box3().setFromObject(ghost).getSize(new Vector3()).z / 2);
|
|
109
|
+
root.markDirty();
|
|
110
|
+
// A refused drop (a tutorial's guard) creates nothing: take the copy away at once
|
|
111
|
+
if (chit.onDrag(t) === false) {
|
|
112
|
+
removeGhost();
|
|
113
|
+
return;
|
|
114
|
+
}
|
|
115
|
+
setTimeout(removeGhost, SETTLE_MS);
|
|
116
|
+
},
|
|
117
|
+
cancel: () => {
|
|
118
|
+
setTarget(undefined);
|
|
119
|
+
removeGhost();
|
|
120
|
+
},
|
|
121
|
+
};
|
|
122
|
+
}
|
|
@@ -16,6 +16,7 @@ import { PanelTabStack, TAB_HEIGHT } from "./PanelTabStack";
|
|
|
16
16
|
import { usePanelPositioning } from "../../hooks/usePanelPositioning";
|
|
17
17
|
import { useSmartDebouncedState } from "../../hooks/useSmartDebouncedState";
|
|
18
18
|
import { ViewerZoomControls } from "./ViewerZoomControls";
|
|
19
|
+
import { usePanelNavigation } from "../../hooks/usePanelNavigation";
|
|
19
20
|
|
|
20
21
|
const ANIMATION_DURATION = 0.125;
|
|
21
22
|
|
|
@@ -240,6 +241,26 @@ export function MultiPanel({
|
|
|
240
241
|
|
|
241
242
|
const focusedRoot = focusedPanel?.renderInstance as RootChitRenderInstance;
|
|
242
243
|
|
|
244
|
+
// Let the tutorial overlay bring any of our panels to the front
|
|
245
|
+
const navigation = usePanelNavigation();
|
|
246
|
+
const selectRef = useRef(manuallyChangeSelectedIndex);
|
|
247
|
+
selectRef.current = manuallyChangeSelectedIndex;
|
|
248
|
+
useEffect(() => {
|
|
249
|
+
if (!navigation || !enabled) {
|
|
250
|
+
return;
|
|
251
|
+
}
|
|
252
|
+
const unregisters = chits.map((chit, index) =>
|
|
253
|
+
navigation.registerSelector(chit.id ?? "", () => {
|
|
254
|
+
selectRef.current(index);
|
|
255
|
+
// A tutorial asked for this panel: hold it against the automatic "show where something
|
|
256
|
+
// changed" switching for a while, prompt or not
|
|
257
|
+
setIgnoreChangesBefore(Date.now() + PANEL_ADJUST_IGNORE_DURATION);
|
|
258
|
+
}),
|
|
259
|
+
);
|
|
260
|
+
return () => unregisters.forEach((u) => u());
|
|
261
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
262
|
+
}, [navigation, chitIdsString, enabled]);
|
|
263
|
+
|
|
243
264
|
return (
|
|
244
265
|
<Stack
|
|
245
266
|
sx={{
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { useRef, useState, useEffect, useCallback, createContext, useContext } from "react";
|
|
1
|
+
import React, { useRef, useState, useEffect, useCallback, createContext, useContext, useMemo } from "react";
|
|
2
2
|
import { Box } from "@mui/material";
|
|
3
3
|
import useSize from "@react-hook/size";
|
|
4
4
|
import { useGameTheme } from "../../hooks/useGameTheme";
|
|
@@ -11,6 +11,10 @@ import { Chit } from "../../game/Chit";
|
|
|
11
11
|
import Hammer from "@egjs/hammerjs";
|
|
12
12
|
import { PanelPositioningContext, ViewerPosition } from "../../hooks/usePanelPositioning";
|
|
13
13
|
import { ViewerWrapper } from "./ViewerWrapper";
|
|
14
|
+
import { PanelNavigation, PanelNavigationContext, usePublishPanelNavigation } from "../../hooks/usePanelNavigation";
|
|
15
|
+
import { RootChitRenderInstance } from "../../rendering/RootChitRenderInstance";
|
|
16
|
+
import { useModalState } from "../../hooks/useModalState";
|
|
17
|
+
import { startExternalDrag } from "./ExternalDrag";
|
|
14
18
|
|
|
15
19
|
// Types for gesture handling
|
|
16
20
|
export interface ViewerGestureHandlers {
|
|
@@ -29,6 +33,8 @@ export interface ViewerRegistration {
|
|
|
29
33
|
id: string;
|
|
30
34
|
getBounds: () => DOMRect | null;
|
|
31
35
|
handlers: ViewerGestureHandlers;
|
|
36
|
+
/** The viewer's renderer, so a drag from outside (the inline gallery) can draw on it. */
|
|
37
|
+
renderInstance?: RootChitRenderInstance;
|
|
32
38
|
}
|
|
33
39
|
|
|
34
40
|
interface GestureContextValue {
|
|
@@ -75,6 +81,27 @@ export function PanelContents({
|
|
|
75
81
|
};
|
|
76
82
|
}, []);
|
|
77
83
|
|
|
84
|
+
// A drag from the inline gallery lands on the viewer that renders the chit's drop targets.
|
|
85
|
+
const modalState = useModalState();
|
|
86
|
+
useEffect(() => {
|
|
87
|
+
modalState.externalDragHost = {
|
|
88
|
+
begin: (chit, item, clientX, clientY) => {
|
|
89
|
+
if (!chit.onDrag || !chit.dropTargets?.length) return undefined;
|
|
90
|
+
const root = chit.dropTargets.find((t) => t.renderInstance)?.renderInstance?.rootRenderInstance;
|
|
91
|
+
if (!root) return undefined;
|
|
92
|
+
for (const registration of viewerRegistrationsRef.current.values()) {
|
|
93
|
+
if (registration.renderInstance === root && registration.getBounds()) {
|
|
94
|
+
return startExternalDrag(chit, item, { getBounds: registration.getBounds, renderInstance: root }, clientX, clientY);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
return undefined;
|
|
98
|
+
},
|
|
99
|
+
};
|
|
100
|
+
return () => {
|
|
101
|
+
modalState.externalDragHost = undefined;
|
|
102
|
+
};
|
|
103
|
+
}, [modalState]);
|
|
104
|
+
|
|
78
105
|
// Panel positioning system
|
|
79
106
|
const positionsRef = useRef<Map<string, ViewerPosition>>(
|
|
80
107
|
new Map([["root", { chitId: "root", x: -40, y: 0, w: 30, h: 30, front: true, visible: true, paused: true }]]),
|
|
@@ -252,9 +279,76 @@ export function PanelContents({
|
|
|
252
279
|
fullChitList.push(rootChit);
|
|
253
280
|
}
|
|
254
281
|
|
|
282
|
+
// Panel navigation (used by the tutorial overlay to bring a chit's panel to the front)
|
|
283
|
+
const selectorsRef = useRef<Map<string, () => void>>(new Map());
|
|
284
|
+
const panelRootsRef = useRef<Chit[]>(tabChitList);
|
|
285
|
+
panelRootsRef.current = tabChitList;
|
|
286
|
+
const focusedPanelRef = useRef(focusedPanel);
|
|
287
|
+
focusedPanelRef.current = focusedPanel;
|
|
288
|
+
/** The panel root (a chit with its own viewer) that shows `chit` */
|
|
289
|
+
const panelOf = (chit: Chit): Chit | undefined => {
|
|
290
|
+
const roots = new Set(panelRootsRef.current.map((c) => c.id));
|
|
291
|
+
let panel: Chit | undefined = chit;
|
|
292
|
+
while (panel && !roots.has(panel.id)) {
|
|
293
|
+
panel = panel.parent;
|
|
294
|
+
}
|
|
295
|
+
return panel;
|
|
296
|
+
};
|
|
297
|
+
const navigation = useMemo<PanelNavigation>(
|
|
298
|
+
() => ({
|
|
299
|
+
registerSelector: (chitId, select) => {
|
|
300
|
+
selectorsRef.current.set(chitId, select);
|
|
301
|
+
return () => {
|
|
302
|
+
if (selectorsRef.current.get(chitId) === select) selectorsRef.current.delete(chitId);
|
|
303
|
+
};
|
|
304
|
+
},
|
|
305
|
+
panelRoots: () => panelRootsRef.current,
|
|
306
|
+
isFront: (chitId) => positionsRef.current.get(chitId)?.front ?? false,
|
|
307
|
+
revealChit: async (chit) => {
|
|
308
|
+
const panel = panelOf(chit);
|
|
309
|
+
if (!panel?.id) {
|
|
310
|
+
return false;
|
|
311
|
+
}
|
|
312
|
+
// Showing a panel full screen (the player zoomed in, or a tutorial focused it): that layout
|
|
313
|
+
// has every panel as a tab, so switch tabs there rather than leave it
|
|
314
|
+
const select = selectorsRef.current.get(panel.id);
|
|
315
|
+
if (select && !(positionsRef.current.get(panel.id)?.front ?? false)) {
|
|
316
|
+
select();
|
|
317
|
+
await new Promise((resolve) => setTimeout(resolve, 400));
|
|
318
|
+
}
|
|
319
|
+
return true;
|
|
320
|
+
},
|
|
321
|
+
keepFront: (chit) => {
|
|
322
|
+
// Selecting the tab already in front changes nothing but re-arms its hold against the
|
|
323
|
+
// automatic "show where something changed" switching
|
|
324
|
+
const panel = panelOf(chit);
|
|
325
|
+
if (panel?.id && (positionsRef.current.get(panel.id)?.front ?? false)) selectorsRef.current.get(panel.id)?.();
|
|
326
|
+
},
|
|
327
|
+
focusedPanel: () => focusedPanelRef.current,
|
|
328
|
+
focusPanelOf: async (chit) => {
|
|
329
|
+
const panel = chit ? panelOf(chit) : undefined;
|
|
330
|
+
if (chit && !panel?.id) return false;
|
|
331
|
+
if (focusedPanelRef.current === panel) return true;
|
|
332
|
+
if (!panel) {
|
|
333
|
+
setFocusedPanel(undefined);
|
|
334
|
+
} else if (focusedPanelRef.current) {
|
|
335
|
+
selectorsRef.current.get(panel.id!)?.(); // already full screen: switch to its tab
|
|
336
|
+
} else {
|
|
337
|
+
setFocusedPanel(panel);
|
|
338
|
+
}
|
|
339
|
+
await new Promise((resolve) => setTimeout(resolve, 400));
|
|
340
|
+
return true;
|
|
341
|
+
},
|
|
342
|
+
}),
|
|
343
|
+
[],
|
|
344
|
+
);
|
|
345
|
+
// The tutorial overlay is outside these panels: it reaches the navigation through the viewer
|
|
346
|
+
usePublishPanelNavigation(navigation);
|
|
347
|
+
|
|
255
348
|
return (
|
|
256
349
|
<GestureContext.Provider value={gestureContextValue}>
|
|
257
350
|
<PanelPositioningContext.Provider value={positioningContextValue}>
|
|
351
|
+
<PanelNavigationContext.Provider value={navigation}>
|
|
258
352
|
<Box
|
|
259
353
|
sx={{
|
|
260
354
|
position: "relative",
|
|
@@ -358,6 +452,7 @@ export function PanelContents({
|
|
|
358
452
|
})}
|
|
359
453
|
</Box>
|
|
360
454
|
</Box>
|
|
455
|
+
</PanelNavigationContext.Provider>
|
|
361
456
|
</PanelPositioningContext.Provider>
|
|
362
457
|
</GestureContext.Provider>
|
|
363
458
|
);
|
|
@@ -35,6 +35,7 @@ function PanelTab({ chit, onClick, selected }: { selected?: boolean; chit: Chit;
|
|
|
35
35
|
return (
|
|
36
36
|
<Box
|
|
37
37
|
onMouseDown={onClick}
|
|
38
|
+
data-tutorial-target={`panelTab:${chit.id}`}
|
|
38
39
|
sx={{ pt: 1, pb: 1, mt: -1, mb: -1, position: "relative", zIndex: ZINDEX_PANEL_CUTOUTS }}
|
|
39
40
|
>
|
|
40
41
|
<Box
|
|
@@ -33,7 +33,9 @@ export default function PanelSpark({ chit, paused, zIndex }: { zIndex: number; c
|
|
|
33
33
|
useEffect(() => {
|
|
34
34
|
if (targetValue !== value) {
|
|
35
35
|
if (paused && value !== Number.MIN_SAFE_INTEGER) {
|
|
36
|
-
chit.
|
|
36
|
+
if (chit.worthSlidingToPanelToShowChange) {
|
|
37
|
+
chit.parent?.renderInstance?.rootRenderInstance.markHasPendingChange();
|
|
38
|
+
}
|
|
37
39
|
return;
|
|
38
40
|
}
|
|
39
41
|
|
|
@@ -42,10 +44,14 @@ export default function PanelSpark({ chit, paused, zIndex }: { zIndex: number; c
|
|
|
42
44
|
const key = `spark${chit.id ?? "no id"}`;
|
|
43
45
|
timeState.setAnimationState(key, true);
|
|
44
46
|
setFlashed(true);
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
47
|
+
// As fast as the board's other animations when they are hurried (going live, skipping ahead)
|
|
48
|
+
setTimeout(
|
|
49
|
+
() => {
|
|
50
|
+
setFlashed(false);
|
|
51
|
+
timeState.setAnimationState(key, false);
|
|
52
|
+
},
|
|
53
|
+
DURATION * (timeState.animationSpeedOverrideMultiplier.value ?? 1),
|
|
54
|
+
);
|
|
49
55
|
}
|
|
50
56
|
}
|
|
51
57
|
}, [chit, timeState, paused, value, targetValue, DURATION]);
|
|
@@ -80,6 +86,7 @@ export default function PanelSpark({ chit, paused, zIndex }: { zIndex: number; c
|
|
|
80
86
|
return (
|
|
81
87
|
<Box
|
|
82
88
|
ref={ref}
|
|
89
|
+
data-tutorial-target={`spark:${chit.id}`}
|
|
83
90
|
sx={{
|
|
84
91
|
position: "relative",
|
|
85
92
|
background: flashed ? theme.sparkFlashColor : backgroundColor,
|
|
@@ -209,27 +209,54 @@ function NewMatchDialog({
|
|
|
209
209
|
))}
|
|
210
210
|
</FormGroup>
|
|
211
211
|
</FormControl>
|
|
212
|
-
{configOptions.map((option) =>
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
212
|
+
{configOptions.map((option) => {
|
|
213
|
+
const setOption = (value: unknown) =>
|
|
214
|
+
setMatchOptions((prev: any) => ({ ...prev, [option.fieldName]: value }));
|
|
215
|
+
if (option.config.multiple) {
|
|
216
|
+
const selected: string[] = matchOptions[option.fieldName] ?? option.currentValue ?? [];
|
|
217
|
+
return (
|
|
218
|
+
<FormControl key={option.fieldName} component="fieldset">
|
|
219
|
+
<FormLabel component="legend">{option.config.label}</FormLabel>
|
|
220
|
+
<FormGroup>
|
|
221
|
+
{option.config.choices.map((choice) => (
|
|
222
|
+
<FormControlLabel
|
|
223
|
+
key={choice.id}
|
|
224
|
+
label={choice.label ?? choice.id}
|
|
225
|
+
control={
|
|
226
|
+
<Checkbox
|
|
227
|
+
checked={selected.includes(choice.id)}
|
|
228
|
+
onChange={(e) =>
|
|
229
|
+
setOption(
|
|
230
|
+
e.target.checked
|
|
231
|
+
? [...selected, choice.id]
|
|
232
|
+
: selected.filter((id) => id !== choice.id),
|
|
233
|
+
)
|
|
234
|
+
}
|
|
235
|
+
/>
|
|
236
|
+
}
|
|
237
|
+
/>
|
|
238
|
+
))}
|
|
239
|
+
</FormGroup>
|
|
240
|
+
</FormControl>
|
|
241
|
+
);
|
|
242
|
+
}
|
|
243
|
+
return (
|
|
244
|
+
<FormControl key={option.fieldName} fullWidth>
|
|
245
|
+
<InputLabel>{option.config.label}</InputLabel>
|
|
246
|
+
<Select
|
|
247
|
+
value={matchOptions[option.fieldName] ?? option.currentValue}
|
|
248
|
+
label={option.config.label}
|
|
249
|
+
onChange={(e) => setOption(e.target.value)}
|
|
250
|
+
>
|
|
251
|
+
{option.config.choices.map((choice) => (
|
|
252
|
+
<MenuItem key={choice.id} value={choice.id}>
|
|
253
|
+
{choice.label ?? choice.id}
|
|
254
|
+
</MenuItem>
|
|
255
|
+
))}
|
|
256
|
+
</Select>
|
|
257
|
+
</FormControl>
|
|
258
|
+
);
|
|
259
|
+
})}
|
|
233
260
|
</Stack>
|
|
234
261
|
</DialogContent>
|
|
235
262
|
<DialogActions>
|
|
@@ -99,6 +99,8 @@ export default function PromptControls({ collapsible }: { collapsible?: boolean
|
|
|
99
99
|
const speed = useAnimationSpeedMultiplier();
|
|
100
100
|
const clientPrompt = useClientPrompts();
|
|
101
101
|
const [prompt] = useEventChannelState(clientPrompt.currentPrompt);
|
|
102
|
+
const [undoOverride] = useEventChannelState(clientPrompt.undoOverride);
|
|
103
|
+
const canUndo = !!prompt?.canReset;
|
|
102
104
|
const [promptSpec] = useEventChannelState(clientPrompt.getPromptEventChannelForPlayer(playerId));
|
|
103
105
|
const [expandedBecauseOfPrompt, setExpandedBecauseOfPrompt] = useState(!!prompt);
|
|
104
106
|
const [live] = useEventChannelState(timeState.live);
|
|
@@ -127,6 +129,7 @@ export default function PromptControls({ collapsible }: { collapsible?: boolean
|
|
|
127
129
|
return (
|
|
128
130
|
<Stack
|
|
129
131
|
direction="row"
|
|
132
|
+
data-tutorial-target="prompt"
|
|
130
133
|
sx={{
|
|
131
134
|
position: collapsible ? "absolute" : "static",
|
|
132
135
|
overflow: "hidden",
|
|
@@ -167,12 +170,13 @@ export default function PromptControls({ collapsible }: { collapsible?: boolean
|
|
|
167
170
|
</GameDialog>
|
|
168
171
|
)} */}
|
|
169
172
|
|
|
170
|
-
{prompt
|
|
173
|
+
{prompt && canUndo && (
|
|
171
174
|
<BottomBarButton
|
|
172
175
|
icon={Replay}
|
|
173
176
|
label="Undo"
|
|
174
|
-
|
|
175
|
-
|
|
177
|
+
tutorialTarget="undo"
|
|
178
|
+
onClick={() => (undoOverride ? undoOverride.undo() : prompt.stepBack())}
|
|
179
|
+
onLongClick={() => (undoOverride ? undoOverride.undo() : prompt.stepBack(true))}
|
|
176
180
|
/>
|
|
177
181
|
)}
|
|
178
182
|
<Box flex={1} />
|