@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,586 @@
|
|
|
1
|
+
import { Chit } from "../game/Chit";
|
|
2
|
+
|
|
3
|
+
export type PanelLayoutResult = {
|
|
4
|
+
w: number;
|
|
5
|
+
h: number;
|
|
6
|
+
x: number;
|
|
7
|
+
y: number;
|
|
8
|
+
id?: string;
|
|
9
|
+
chit: Chit | Chit[];
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export type LayoutDirection =
|
|
13
|
+
| "horizontal"
|
|
14
|
+
| "vertical"
|
|
15
|
+
| "optimize"
|
|
16
|
+
| "optimizePreferVertical"
|
|
17
|
+
| "optimizePreferHorizontal"
|
|
18
|
+
| "optimizeGrid";
|
|
19
|
+
|
|
20
|
+
//
|
|
21
|
+
// Input parameters
|
|
22
|
+
//
|
|
23
|
+
export interface PanelNode {
|
|
24
|
+
chit: Chit;
|
|
25
|
+
minWidth: number;
|
|
26
|
+
minHeight: number;
|
|
27
|
+
order?: number;
|
|
28
|
+
}
|
|
29
|
+
export interface ContainerNode {
|
|
30
|
+
direction: LayoutDirection;
|
|
31
|
+
splits: LayoutNode[];
|
|
32
|
+
collapseOrder?: number;
|
|
33
|
+
reversedIfVertical?: boolean;
|
|
34
|
+
reversedIfHorizontal?: boolean;
|
|
35
|
+
}
|
|
36
|
+
export interface CollapsedNode {
|
|
37
|
+
panels: PanelNode[];
|
|
38
|
+
minWidth: number;
|
|
39
|
+
minHeight: number;
|
|
40
|
+
}
|
|
41
|
+
export type LayoutNode = PanelNode | ContainerNode | CollapsedNode;
|
|
42
|
+
|
|
43
|
+
//
|
|
44
|
+
// Interim concrete panel nodes
|
|
45
|
+
//
|
|
46
|
+
type ConcreteDirection = "horizontal" | "vertical";
|
|
47
|
+
|
|
48
|
+
interface ConcretePanelNode extends PanelNode {
|
|
49
|
+
width: number;
|
|
50
|
+
height: number;
|
|
51
|
+
}
|
|
52
|
+
interface ConcreteContainerNode {
|
|
53
|
+
width: number;
|
|
54
|
+
height: number;
|
|
55
|
+
direction: ConcreteDirection;
|
|
56
|
+
splits: ConcreteLayoutNode[];
|
|
57
|
+
collapseOrder?: number;
|
|
58
|
+
}
|
|
59
|
+
interface ConcreteCollapsedNode extends CollapsedNode {
|
|
60
|
+
width: number;
|
|
61
|
+
height: number;
|
|
62
|
+
}
|
|
63
|
+
type ConcreteLayoutNode = ConcretePanelNode | ConcreteContainerNode | ConcreteCollapsedNode;
|
|
64
|
+
|
|
65
|
+
// Type guard helpers
|
|
66
|
+
function isPanelNode(node: LayoutNode | ConcreteLayoutNode): node is PanelNode | ConcretePanelNode {
|
|
67
|
+
return "chit" in node;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
function isCollapsedNode(node: LayoutNode | ConcreteLayoutNode): node is CollapsedNode | ConcreteCollapsedNode {
|
|
71
|
+
return "panels" in node;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
function isContainerNode(node: LayoutNode | ConcreteLayoutNode): node is ContainerNode | ConcreteContainerNode {
|
|
75
|
+
return "splits" in node;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Recursively fixes nodes where minWidth/minHeight exceed available dimensions
|
|
80
|
+
*/
|
|
81
|
+
function fixInvalidNodeDimensions(tree: LayoutNode, availableWidth: number, availableHeight: number): LayoutNode {
|
|
82
|
+
if (isPanelNode(tree)) {
|
|
83
|
+
// Fix panel node dimensions if they exceed available space
|
|
84
|
+
return {
|
|
85
|
+
...tree,
|
|
86
|
+
minWidth: Math.min(tree.minWidth, availableWidth),
|
|
87
|
+
minHeight: Math.min(tree.minHeight, availableHeight),
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
if (isCollapsedNode(tree)) {
|
|
92
|
+
// Fix collapsed node dimensions if they exceed available space
|
|
93
|
+
return {
|
|
94
|
+
...tree,
|
|
95
|
+
minWidth: Math.min(tree.minWidth, availableWidth),
|
|
96
|
+
minHeight: Math.min(tree.minHeight, availableHeight),
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
const container = tree as ContainerNode;
|
|
101
|
+
return {
|
|
102
|
+
...container,
|
|
103
|
+
splits: container.splits.map((split) => fixInvalidNodeDimensions(split, availableWidth, availableHeight)),
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* Main entry point: creates layout from tree specification
|
|
109
|
+
*/
|
|
110
|
+
export function createLayoutFromTree(
|
|
111
|
+
tree: LayoutNode,
|
|
112
|
+
availableWidth: number,
|
|
113
|
+
availableHeight: number,
|
|
114
|
+
): PanelLayoutResult[] {
|
|
115
|
+
// Step 0: Fix invalid nodes in tree
|
|
116
|
+
const fixedTree = fixInvalidNodeDimensions(tree, availableWidth, availableHeight);
|
|
117
|
+
|
|
118
|
+
// Step 1: Build valid LayoutNode tree (with collapses applied)
|
|
119
|
+
const validTree = buildValidTree(fixedTree, availableWidth, availableHeight);
|
|
120
|
+
|
|
121
|
+
const rebalancedTree = rebalanceTree(validTree);
|
|
122
|
+
|
|
123
|
+
// Step 2: Convert the valid tree to PanelLayoutResult[]
|
|
124
|
+
const res = flattenTreeToResults(rebalancedTree, 0, 0, availableWidth, availableHeight);
|
|
125
|
+
|
|
126
|
+
return res;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
function rebalanceTree(tree: ConcreteLayoutNode): ConcreteLayoutNode {
|
|
130
|
+
if (isPanelNode(tree) || isCollapsedNode(tree)) {
|
|
131
|
+
return tree;
|
|
132
|
+
}
|
|
133
|
+
if (tree.direction === "horizontal") {
|
|
134
|
+
return createHorizontalLayout(tree, tree.width, tree.height);
|
|
135
|
+
} else if (tree.direction === "vertical") {
|
|
136
|
+
return createVerticalLayout(tree, tree.width, tree.height);
|
|
137
|
+
} else return tree;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* Builds a valid LayoutNode tree by applying collapses until everything fits
|
|
142
|
+
* Returns a NEW tree - does not modify the input
|
|
143
|
+
*/
|
|
144
|
+
function buildValidTree(tree: LayoutNode, width: number, height: number): ConcreteLayoutNode {
|
|
145
|
+
if (width === 0) {
|
|
146
|
+
width = 1;
|
|
147
|
+
}
|
|
148
|
+
if (height === 0) {
|
|
149
|
+
height = 1;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
// Step 1: Attempt to layout - resolves all optimize* into concrete horizontal/vertical/grid
|
|
153
|
+
const concreteTree = createConcreteLayout(tree, width, height);
|
|
154
|
+
|
|
155
|
+
// Step 2: Check if the concrete layout has ANY violations
|
|
156
|
+
const hasViolations = checkConcreteViolations(concreteTree);
|
|
157
|
+
|
|
158
|
+
// If no violations, the original tree is valid!
|
|
159
|
+
if (!hasViolations) {
|
|
160
|
+
return concreteTree;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
// Step 3: Scan ENTIRE tree for the container with smallest collapseOrder
|
|
164
|
+
const toCollapse = findSmallestCollapseOrder(concreteTree);
|
|
165
|
+
|
|
166
|
+
if (!toCollapse) {
|
|
167
|
+
return concreteTree;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
// Step 4: Collapse that container to create NEW tree
|
|
171
|
+
const newTree = collapseContainer(tree, toCollapse.collapseOrder!);
|
|
172
|
+
|
|
173
|
+
// Step 5: Recursively build valid tree from the new tree
|
|
174
|
+
return buildValidTree(newTree, width, height);
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
function createHorizontalLayout(node: ContainerNode, width: number, height: number): ConcreteLayoutNode {
|
|
178
|
+
const widths = node.splits.map((split) => getMinWidth(split));
|
|
179
|
+
const totalUsedWidth = widths.reduce((sum, w) => sum + w, 0);
|
|
180
|
+
const scale = width / totalUsedWidth;
|
|
181
|
+
const splits = node.splits.map((split, i) => createConcreteLayout(split, widths[i] * scale, height));
|
|
182
|
+
|
|
183
|
+
if (node.reversedIfHorizontal) {
|
|
184
|
+
splits.reverse();
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
return {
|
|
188
|
+
width,
|
|
189
|
+
height,
|
|
190
|
+
collapseOrder: node.collapseOrder,
|
|
191
|
+
direction: "horizontal",
|
|
192
|
+
splits,
|
|
193
|
+
};
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
function createVerticalLayout(node: ContainerNode, width: number, height: number): ConcreteLayoutNode {
|
|
197
|
+
const heights = node.splits.map((split) => getMinHeight(split));
|
|
198
|
+
const totalUsedHeight = heights.reduce((sum, h) => sum + h, 0);
|
|
199
|
+
const scale = height / totalUsedHeight;
|
|
200
|
+
const splits = node.splits.map((split, i) => createConcreteLayout(split, width, heights[i] * scale));
|
|
201
|
+
|
|
202
|
+
if (node.reversedIfVertical) {
|
|
203
|
+
splits.reverse();
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
return {
|
|
207
|
+
collapseOrder: node.collapseOrder,
|
|
208
|
+
direction: "vertical",
|
|
209
|
+
splits,
|
|
210
|
+
width,
|
|
211
|
+
height,
|
|
212
|
+
};
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
/**
|
|
216
|
+
* Attempts to layout the tree - resolves all optimize* directions into concrete layouts
|
|
217
|
+
* Returns a ConcreteLayoutNode tree
|
|
218
|
+
*/
|
|
219
|
+
function createConcreteLayout(node: LayoutNode, width: number, height: number): ConcreteLayoutNode {
|
|
220
|
+
if (isPanelNode(node)) {
|
|
221
|
+
return {
|
|
222
|
+
...node,
|
|
223
|
+
width,
|
|
224
|
+
height,
|
|
225
|
+
};
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
if (isCollapsedNode(node)) {
|
|
229
|
+
return {
|
|
230
|
+
...node,
|
|
231
|
+
width,
|
|
232
|
+
height,
|
|
233
|
+
};
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
const container = node as ContainerNode;
|
|
237
|
+
|
|
238
|
+
// general "optimize"
|
|
239
|
+
if (container.direction === "optimize") {
|
|
240
|
+
const horizontalLayout = createHorizontalLayout(container, width, height);
|
|
241
|
+
const verticalLayout = createVerticalLayout(container, width, height);
|
|
242
|
+
|
|
243
|
+
const horizontalIsOkay = !checkConcreteViolations(horizontalLayout);
|
|
244
|
+
const verticalIsOkay = !checkConcreteViolations(verticalLayout);
|
|
245
|
+
|
|
246
|
+
if (horizontalIsOkay && verticalIsOkay) {
|
|
247
|
+
if (width >= height) {
|
|
248
|
+
return horizontalLayout;
|
|
249
|
+
} else {
|
|
250
|
+
return verticalLayout;
|
|
251
|
+
}
|
|
252
|
+
} else if (horizontalIsOkay) {
|
|
253
|
+
return horizontalLayout;
|
|
254
|
+
} else if (verticalIsOkay) {
|
|
255
|
+
return verticalLayout;
|
|
256
|
+
} else {
|
|
257
|
+
return horizontalLayout;
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
// "optimize" with a preference
|
|
261
|
+
else if (container.direction === "optimizePreferVertical" || container.direction === "optimizePreferHorizontal") {
|
|
262
|
+
const horizontalLayout = createHorizontalLayout(container, width, height);
|
|
263
|
+
const verticalLayout = createVerticalLayout(container, width, height);
|
|
264
|
+
|
|
265
|
+
const horizontalIsOkay = !checkConcreteViolations(horizontalLayout);
|
|
266
|
+
const verticalIsOkay = !checkConcreteViolations(verticalLayout);
|
|
267
|
+
|
|
268
|
+
if (
|
|
269
|
+
container.direction === "optimizePreferHorizontal" &&
|
|
270
|
+
(horizontalIsOkay || (!verticalIsOkay && !horizontalIsOkay))
|
|
271
|
+
) {
|
|
272
|
+
return horizontalLayout;
|
|
273
|
+
} else if (
|
|
274
|
+
container.direction === "optimizePreferVertical" &&
|
|
275
|
+
(verticalIsOkay || (!verticalIsOkay && !horizontalIsOkay))
|
|
276
|
+
) {
|
|
277
|
+
return verticalLayout;
|
|
278
|
+
} else if (verticalIsOkay) {
|
|
279
|
+
return verticalLayout;
|
|
280
|
+
} else if (horizontalIsOkay) {
|
|
281
|
+
return horizontalLayout;
|
|
282
|
+
} else {
|
|
283
|
+
return verticalLayout; // fallback, shouldn't happen.
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
// grid layout
|
|
287
|
+
else if (container.direction === "optimizeGrid") {
|
|
288
|
+
// Grid is just an optimization - resolve to actual horizontal or vertical layout
|
|
289
|
+
const bestConfig = findBestGridConfig(container.splits, width, height);
|
|
290
|
+
|
|
291
|
+
const result: ConcreteContainerNode[] = [];
|
|
292
|
+
for (let row = 0; row < bestConfig.rows; row++) {
|
|
293
|
+
const rowInfo: ConcreteContainerNode = {
|
|
294
|
+
direction: "horizontal",
|
|
295
|
+
width: width,
|
|
296
|
+
height: height / bestConfig.rows,
|
|
297
|
+
splits: container.splits
|
|
298
|
+
.slice(row * bestConfig.cols, (row + 1) * bestConfig.cols)
|
|
299
|
+
.map((d) => createConcreteLayout(d, width / bestConfig.cols, height / bestConfig.rows)),
|
|
300
|
+
};
|
|
301
|
+
result.push(rowInfo);
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
return {
|
|
305
|
+
direction: "vertical",
|
|
306
|
+
width,
|
|
307
|
+
height,
|
|
308
|
+
splits: result,
|
|
309
|
+
};
|
|
310
|
+
} else if (container.direction === "horizontal") {
|
|
311
|
+
return createHorizontalLayout(container, width, height);
|
|
312
|
+
} else {
|
|
313
|
+
return createVerticalLayout(container, width, height);
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
/**
|
|
318
|
+
* Check if a concrete layout has violations
|
|
319
|
+
*/
|
|
320
|
+
function checkConcreteViolations(node: ConcreteLayoutNode): boolean {
|
|
321
|
+
if (isPanelNode(node)) {
|
|
322
|
+
return node.minWidth > node.width || node.minHeight > node.height;
|
|
323
|
+
}
|
|
324
|
+
if (isCollapsedNode(node)) {
|
|
325
|
+
return node.minWidth > node.width || node.minHeight > node.height;
|
|
326
|
+
}
|
|
327
|
+
for (let i = 0; i < node.splits.length; i++) {
|
|
328
|
+
if (checkConcreteViolations(node.splits[i])) {
|
|
329
|
+
return true;
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
return false;
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
/**
|
|
336
|
+
* Scans entire tree for the container with smallest collapseOrder
|
|
337
|
+
*/
|
|
338
|
+
function findSmallestCollapseOrder(node: ConcreteLayoutNode): ContainerNode | null {
|
|
339
|
+
if (isPanelNode(node) || isCollapsedNode(node)) {
|
|
340
|
+
return null;
|
|
341
|
+
}
|
|
342
|
+
// no point in collapsing anything that thinks it is all good
|
|
343
|
+
if (!checkConcreteViolations(node) && node.collapseOrder !== undefined) {
|
|
344
|
+
return null;
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
const container = node as ConcreteContainerNode;
|
|
348
|
+
let smallest: ContainerNode | null = container.collapseOrder !== undefined ? container : null;
|
|
349
|
+
|
|
350
|
+
for (const split of container.splits) {
|
|
351
|
+
const childSmallest = findSmallestCollapseOrder(split);
|
|
352
|
+
if (childSmallest) {
|
|
353
|
+
const childOrder = childSmallest.collapseOrder ?? Number.MAX_SAFE_INTEGER;
|
|
354
|
+
const currentOrder = smallest?.collapseOrder ?? Number.MAX_SAFE_INTEGER;
|
|
355
|
+
|
|
356
|
+
if (childOrder < currentOrder) {
|
|
357
|
+
smallest = childSmallest;
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
return smallest;
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
/**
|
|
366
|
+
* Flattens a valid ConcreteLayoutNode tree into PanelLayoutResult[]
|
|
367
|
+
*/
|
|
368
|
+
function flattenTreeToResults(
|
|
369
|
+
node: ConcreteLayoutNode,
|
|
370
|
+
x: number,
|
|
371
|
+
y: number,
|
|
372
|
+
w: number,
|
|
373
|
+
h: number,
|
|
374
|
+
): PanelLayoutResult[] {
|
|
375
|
+
// Handle leaf node (panel or panel array)
|
|
376
|
+
if (isPanelNode(node)) {
|
|
377
|
+
return [
|
|
378
|
+
{
|
|
379
|
+
x,
|
|
380
|
+
y,
|
|
381
|
+
w,
|
|
382
|
+
h,
|
|
383
|
+
id: node.chit.id ?? "no_id",
|
|
384
|
+
chit: node.chit,
|
|
385
|
+
},
|
|
386
|
+
];
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
// Handle collapsed node (array of panels as chits)
|
|
390
|
+
if (isCollapsedNode(node)) {
|
|
391
|
+
return [
|
|
392
|
+
{
|
|
393
|
+
x,
|
|
394
|
+
y,
|
|
395
|
+
w,
|
|
396
|
+
h,
|
|
397
|
+
id: node.panels[0].chit.id ?? "no_id",
|
|
398
|
+
chit: node.panels.map((p) => p.chit),
|
|
399
|
+
},
|
|
400
|
+
];
|
|
401
|
+
}
|
|
402
|
+
|
|
403
|
+
const container = node as ConcreteContainerNode;
|
|
404
|
+
|
|
405
|
+
// Handle horizontal split
|
|
406
|
+
if (container.direction === "horizontal") {
|
|
407
|
+
let currentX = x;
|
|
408
|
+
return container.splits
|
|
409
|
+
.map((split) => {
|
|
410
|
+
const splitWidth = (split.width / container.width) * w;
|
|
411
|
+
const result = flattenTreeToResults(split, currentX, y, splitWidth, h);
|
|
412
|
+
currentX += splitWidth;
|
|
413
|
+
return result;
|
|
414
|
+
})
|
|
415
|
+
.flat();
|
|
416
|
+
}
|
|
417
|
+
|
|
418
|
+
// Handle vertical split
|
|
419
|
+
let currentY = y;
|
|
420
|
+
return container.splits
|
|
421
|
+
.map((split) => {
|
|
422
|
+
const splitHeight = (split.height / container.height) * h;
|
|
423
|
+
const result = flattenTreeToResults(split, x, currentY, w, splitHeight);
|
|
424
|
+
currentY += splitHeight;
|
|
425
|
+
return result;
|
|
426
|
+
})
|
|
427
|
+
.flat();
|
|
428
|
+
}
|
|
429
|
+
|
|
430
|
+
function findBestGridConfig(splits: LayoutNode[], width: number, height: number): { rows: number; cols: number } {
|
|
431
|
+
if (splits.length <= 1) {
|
|
432
|
+
return { rows: 1, cols: 1 };
|
|
433
|
+
}
|
|
434
|
+
|
|
435
|
+
const cellWidth = getMinWidth(splits[0]);
|
|
436
|
+
const cellHeight = getMinHeight(splits[0]);
|
|
437
|
+
|
|
438
|
+
let cols = Math.ceil(width / cellWidth);
|
|
439
|
+
let rows = Math.ceil(height / cellHeight);
|
|
440
|
+
let lastValidCols = cols;
|
|
441
|
+
let lastValidRows = rows;
|
|
442
|
+
|
|
443
|
+
// eslint-disable-next-line no-constant-condition
|
|
444
|
+
while (splits.length > 0) {
|
|
445
|
+
let canReduceRows = rows > 1 && cols * (rows - 1) >= splits.length;
|
|
446
|
+
let canReduceCols = cols > 1 && (cols - 1) * rows >= splits.length;
|
|
447
|
+
|
|
448
|
+
if (!canReduceRows && !canReduceCols) {
|
|
449
|
+
break;
|
|
450
|
+
}
|
|
451
|
+
|
|
452
|
+
if (canReduceRows && canReduceCols) {
|
|
453
|
+
const cellAspectRatio = cellWidth / cellHeight;
|
|
454
|
+
|
|
455
|
+
// Prefer reducing the dimension that brings cellAspectRatio closer to aspectRatio
|
|
456
|
+
const reduceRowsScore = Math.abs(cellAspectRatio - cellWidth / (height / (rows - 1)));
|
|
457
|
+
const reduceColsScore = Math.abs(cellAspectRatio - width / (cols - 1) / cellHeight);
|
|
458
|
+
|
|
459
|
+
if (reduceRowsScore < reduceColsScore) {
|
|
460
|
+
canReduceRows = false;
|
|
461
|
+
} else {
|
|
462
|
+
canReduceCols = false;
|
|
463
|
+
}
|
|
464
|
+
}
|
|
465
|
+
|
|
466
|
+
if (canReduceRows) {
|
|
467
|
+
rows--;
|
|
468
|
+
lastValidCols = cols;
|
|
469
|
+
lastValidRows = rows;
|
|
470
|
+
} else if (canReduceCols) {
|
|
471
|
+
cols--;
|
|
472
|
+
lastValidCols = cols;
|
|
473
|
+
lastValidRows = rows;
|
|
474
|
+
}
|
|
475
|
+
}
|
|
476
|
+
|
|
477
|
+
return {
|
|
478
|
+
rows: lastValidRows,
|
|
479
|
+
cols: lastValidCols,
|
|
480
|
+
};
|
|
481
|
+
}
|
|
482
|
+
|
|
483
|
+
/**
|
|
484
|
+
* Collapse a container - replaces it with a CollapsedNode (tabs) and removes collapseOrder
|
|
485
|
+
*/
|
|
486
|
+
function collapseContainer(tree: LayoutNode, targetCollapseOrder: number): LayoutNode {
|
|
487
|
+
if (isContainerNode(tree) && tree.collapseOrder === targetCollapseOrder) {
|
|
488
|
+
// This is the container to collapse
|
|
489
|
+
const panels: PanelNode[] = [];
|
|
490
|
+
collectPanels(tree, panels);
|
|
491
|
+
|
|
492
|
+
// Sort panels by collapseOrder (stable sort)
|
|
493
|
+
// Panels without collapseOrder go to the end
|
|
494
|
+
const sortedPanels = panels.flat().sort((a, b) => {
|
|
495
|
+
const orderA = a.order ?? Number.MAX_SAFE_INTEGER;
|
|
496
|
+
const orderB = b.order ?? Number.MAX_SAFE_INTEGER;
|
|
497
|
+
return orderA - orderB;
|
|
498
|
+
});
|
|
499
|
+
|
|
500
|
+
const maxWidth = Math.max(...sortedPanels.map((s) => s.minWidth));
|
|
501
|
+
const maxHeight = Math.max(...sortedPanels.map((s) => s.minHeight));
|
|
502
|
+
|
|
503
|
+
// Return CollapsedNode with array of single chits (each panel becomes a single chit)
|
|
504
|
+
return {
|
|
505
|
+
panels: sortedPanels,
|
|
506
|
+
minWidth: maxWidth,
|
|
507
|
+
minHeight: maxHeight,
|
|
508
|
+
};
|
|
509
|
+
}
|
|
510
|
+
|
|
511
|
+
if (isPanelNode(tree) || isCollapsedNode(tree)) {
|
|
512
|
+
return tree;
|
|
513
|
+
}
|
|
514
|
+
|
|
515
|
+
// Recurse through container
|
|
516
|
+
const container = tree as ContainerNode;
|
|
517
|
+
return {
|
|
518
|
+
...container,
|
|
519
|
+
splits: container.splits.map((split) => collapseContainer(split, targetCollapseOrder)),
|
|
520
|
+
};
|
|
521
|
+
}
|
|
522
|
+
|
|
523
|
+
function collectPanels(node: LayoutNode, panels: PanelNode[]): void {
|
|
524
|
+
if (isPanelNode(node)) {
|
|
525
|
+
panels.push(node);
|
|
526
|
+
} else if (isCollapsedNode(node)) {
|
|
527
|
+
panels.push(...node.panels);
|
|
528
|
+
} else {
|
|
529
|
+
for (const split of (node as ContainerNode).splits) {
|
|
530
|
+
collectPanels(split, panels);
|
|
531
|
+
}
|
|
532
|
+
}
|
|
533
|
+
}
|
|
534
|
+
|
|
535
|
+
/**
|
|
536
|
+
* Get minWidth for a node (without resolving - for estimating)
|
|
537
|
+
*/
|
|
538
|
+
function getMinWidth(node: LayoutNode | ConcreteLayoutNode): number {
|
|
539
|
+
if (isPanelNode(node)) {
|
|
540
|
+
return node.minWidth;
|
|
541
|
+
}
|
|
542
|
+
|
|
543
|
+
if (isCollapsedNode(node)) {
|
|
544
|
+
return node.minWidth;
|
|
545
|
+
}
|
|
546
|
+
|
|
547
|
+
const container = node as ContainerNode | ConcreteContainerNode;
|
|
548
|
+
|
|
549
|
+
// ConcreteLayoutNode - direction is already resolved
|
|
550
|
+
if (container.direction === "horizontal" || container.direction === "optimizePreferHorizontal") {
|
|
551
|
+
return container.splits.reduce((sum, split) => sum + getMinWidth(split), 0);
|
|
552
|
+
}
|
|
553
|
+
|
|
554
|
+
// LayoutNode - need to estimate based on direction type
|
|
555
|
+
if (container.direction === "optimizeGrid") {
|
|
556
|
+
const w = getMinWidth(container.splits[0]);
|
|
557
|
+
return Math.sqrt(container.splits.length) * w;
|
|
558
|
+
}
|
|
559
|
+
|
|
560
|
+
return Math.max(...container.splits.map((split) => getMinWidth(split)));
|
|
561
|
+
}
|
|
562
|
+
|
|
563
|
+
function getMinHeight(node: LayoutNode | ConcreteLayoutNode): number {
|
|
564
|
+
if (isPanelNode(node)) {
|
|
565
|
+
return node.minHeight;
|
|
566
|
+
}
|
|
567
|
+
|
|
568
|
+
if (isCollapsedNode(node)) {
|
|
569
|
+
return node.minHeight;
|
|
570
|
+
}
|
|
571
|
+
|
|
572
|
+
const container = node as ContainerNode | ConcreteContainerNode;
|
|
573
|
+
|
|
574
|
+
// ConcreteLayoutNode - direction is already resolved
|
|
575
|
+
if (container.direction === "vertical" || container.direction === "optimizePreferVertical") {
|
|
576
|
+
return container.splits.reduce((sum, split) => sum + getMinHeight(split), 0);
|
|
577
|
+
}
|
|
578
|
+
|
|
579
|
+
// LayoutNode - need to estimate based on direction type
|
|
580
|
+
if (container.direction === "optimizeGrid") {
|
|
581
|
+
const h = getMinHeight(container.splits[0]);
|
|
582
|
+
return Math.sqrt(container.splits.length) * h;
|
|
583
|
+
}
|
|
584
|
+
|
|
585
|
+
return Math.max(...container.splits.map((split) => getMinHeight(split)));
|
|
586
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import "reflect-metadata";
|
|
2
|
+
import nextTick from "next-tick";
|
|
3
|
+
import { checkAnnotation, NonEditable } from "./Annotations";
|
|
4
|
+
|
|
5
|
+
const CATCH_ALL = "[[null]]";
|
|
6
|
+
export class ObjectWithProps {
|
|
7
|
+
/** @internal */
|
|
8
|
+
public get props(): string[] {
|
|
9
|
+
return Object.keys(this).filter((key) => !checkAnnotation(this, key, NonEditable));
|
|
10
|
+
}
|
|
11
|
+
/** @internal */
|
|
12
|
+
@NonEditable private _cbs: { [key: string]: Array<() => void> } = {};
|
|
13
|
+
|
|
14
|
+
/** @internal */
|
|
15
|
+
@NonEditable private _keysThatChanged = new Set<string>();
|
|
16
|
+
|
|
17
|
+
public set(cb: (chit: this) => void): this {
|
|
18
|
+
cb(this);
|
|
19
|
+
return this;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/** @internal */
|
|
23
|
+
public notifyChange(key: string): void {
|
|
24
|
+
if (this._keysThatChanged.size === 0) {
|
|
25
|
+
nextTick(() => {
|
|
26
|
+
this._keysThatChanged.forEach((key) => this._cbs[key]?.forEach((cb) => cb()));
|
|
27
|
+
this._cbs[CATCH_ALL]?.forEach((cb) => cb());
|
|
28
|
+
this._keysThatChanged.clear();
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
this._keysThatChanged.add(key);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/** @internal */
|
|
35
|
+
public onChange(key: string | null, cb: () => void): () => void {
|
|
36
|
+
const keysToUse = (key ?? CATCH_ALL).split(/\s/g);
|
|
37
|
+
|
|
38
|
+
keysToUse.forEach((keyToUse) => {
|
|
39
|
+
let arr = this._cbs[keyToUse];
|
|
40
|
+
if (arr === undefined) {
|
|
41
|
+
this._cbs[keyToUse] = arr = [];
|
|
42
|
+
}
|
|
43
|
+
arr.push(cb);
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
return () => {
|
|
47
|
+
keysToUse.forEach((keyToUse) => {
|
|
48
|
+
this._cbs[keyToUse] = this._cbs[keyToUse].filter((c) => c !== cb);
|
|
49
|
+
});
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { Raw } from "./CanvasStack/ReactCanvas";
|
|
3
|
+
import { ParameterizedCanvas } from "./ParameterizedCanvas";
|
|
4
|
+
|
|
5
|
+
export class OutlineCanvas extends ParameterizedCanvas {
|
|
6
|
+
radius = 6;
|
|
7
|
+
lineWidth = 6;
|
|
8
|
+
innerLineWidth = 2;
|
|
9
|
+
outerColor = "#f00";
|
|
10
|
+
innerColor = "#ff0";
|
|
11
|
+
width = 100;
|
|
12
|
+
height = 100;
|
|
13
|
+
render() {
|
|
14
|
+
return (
|
|
15
|
+
<Raw
|
|
16
|
+
cb={(ctx, x, y, w, h) => {
|
|
17
|
+
ctx.imageSmoothingEnabled = false;
|
|
18
|
+
ctx.strokeStyle = this.outerColor;
|
|
19
|
+
ctx.lineWidth = this.lineWidth;
|
|
20
|
+
ctx.beginPath();
|
|
21
|
+
ctx.roundRect(
|
|
22
|
+
x + this.lineWidth / 2,
|
|
23
|
+
y + this.lineWidth / 2,
|
|
24
|
+
w - this.lineWidth,
|
|
25
|
+
h - this.lineWidth,
|
|
26
|
+
this.radius,
|
|
27
|
+
);
|
|
28
|
+
ctx.stroke();
|
|
29
|
+
|
|
30
|
+
ctx.strokeStyle = this.innerColor;
|
|
31
|
+
ctx.lineWidth = this.innerLineWidth;
|
|
32
|
+
ctx.beginPath();
|
|
33
|
+
ctx.roundRect(
|
|
34
|
+
x + this.lineWidth / 2,
|
|
35
|
+
y + this.lineWidth / 2,
|
|
36
|
+
w - this.lineWidth,
|
|
37
|
+
h - this.lineWidth,
|
|
38
|
+
this.radius,
|
|
39
|
+
);
|
|
40
|
+
ctx.stroke();
|
|
41
|
+
}}
|
|
42
|
+
/>
|
|
43
|
+
);
|
|
44
|
+
}
|
|
45
|
+
}
|