@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,69 @@
|
|
|
1
|
+
import { BufferGeometry, ExtrudeGeometry, Mesh, Shape } from "three";
|
|
2
|
+
import { CSG } from "three-csg-ts";
|
|
3
|
+
|
|
4
|
+
export function outlineGeometry(shape: Shape, height: number): BufferGeometry | ExtrudeGeometry {
|
|
5
|
+
// const extrudeSettings = {
|
|
6
|
+
// depth: height, // Extrude by 2 units
|
|
7
|
+
// bevelEnabled: false, // Disable bevel for simplicity
|
|
8
|
+
// };
|
|
9
|
+
|
|
10
|
+
const g = new ExtrudeGeometry(shape, { depth: height * 20, bevelEnabled: false });
|
|
11
|
+
g.scale(0.95, 0.95, 0.95);
|
|
12
|
+
const g2 = new ExtrudeGeometry(shape, { depth: height, bevelEnabled: false });
|
|
13
|
+
g2.scale(1.05, 1.05, 1.45);
|
|
14
|
+
const original = new Mesh(g);
|
|
15
|
+
const scaled = new Mesh(g2);
|
|
16
|
+
|
|
17
|
+
original.updateMatrix();
|
|
18
|
+
scaled.updateMatrix();
|
|
19
|
+
// scaled.scale(1.05, 1.05, 1.05);
|
|
20
|
+
|
|
21
|
+
const subRes = CSG.subtract(scaled, original);
|
|
22
|
+
|
|
23
|
+
subRes.geometry.translate(0, 0, -(subRes.geometry.boundingBox?.max.z ?? 0) / 2);
|
|
24
|
+
// return scaled.geometry;
|
|
25
|
+
return subRes.geometry;
|
|
26
|
+
|
|
27
|
+
// const stroke = extrude({ thickness: 0.05, cap: "square", join: "none", miterLimit: 10 });
|
|
28
|
+
|
|
29
|
+
// const m = stroke.build(vectors.map((v) => [v.x, v.y]));
|
|
30
|
+
|
|
31
|
+
// const vertexCount = m.positions.length;
|
|
32
|
+
// const topVertices = m.positions.map((p) => [p[0], p[1], height / 2]).flat();
|
|
33
|
+
// const bottomVertices = m.positions.map((p) => [p[0], p[1], -height / 2]).flat();
|
|
34
|
+
|
|
35
|
+
// const vertices = new Float32Array(topVertices.concat(bottomVertices));
|
|
36
|
+
// const top: number[][] = [];
|
|
37
|
+
// const bottom: number[][] = [];
|
|
38
|
+
// const sides: number[][] = [];
|
|
39
|
+
// const hasAddedTriangles = new Set<string>();
|
|
40
|
+
|
|
41
|
+
// const addSide = (a: number, b: number) => {
|
|
42
|
+
// const key = `${a}_${b}`;
|
|
43
|
+
// if (!hasAddedTriangles.has(key)) {
|
|
44
|
+
// hasAddedTriangles.add(key);
|
|
45
|
+
// sides.push([a + vertexCount, b, a]);
|
|
46
|
+
// sides.push([a + vertexCount, b + vertexCount, b]);
|
|
47
|
+
// }
|
|
48
|
+
// };
|
|
49
|
+
|
|
50
|
+
// m.cells.forEach((triangle) => {
|
|
51
|
+
// const [a, b, c] = triangle;
|
|
52
|
+
// top.push([c, b, a]);
|
|
53
|
+
// bottom.push([a + vertexCount, b + vertexCount, c + vertexCount]); // add bottom triangle
|
|
54
|
+
// addSide(a, b);
|
|
55
|
+
// addSide(c, a);
|
|
56
|
+
// addSide(c, b);
|
|
57
|
+
// });
|
|
58
|
+
|
|
59
|
+
// // const cells = new Uint16Array(triangles.flat());
|
|
60
|
+
// const geometry = new BufferGeometry();
|
|
61
|
+
// geometry.setAttribute("position", new BufferAttribute(vertices, 3));
|
|
62
|
+
// geometry.setIndex(new BufferAttribute(new Uint16Array([...top.flat(), ...bottom.flat(), ...sides.flat()]), 1));
|
|
63
|
+
|
|
64
|
+
// geometry.addGroup(0, top.length * 3, 0);
|
|
65
|
+
// geometry.addGroup(top.length * 3, bottom.length * 3, 1);
|
|
66
|
+
// geometry.addGroup(top.length * 6, 3 * sides.length, 2);
|
|
67
|
+
// geometry.computeVertexNormals();
|
|
68
|
+
// // geometry.computeTangents();
|
|
69
|
+
}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { ReactNode } from "react";
|
|
2
|
+
|
|
3
|
+
import { IUpdatingCanvas } from "./IUpdatingCanvas";
|
|
4
|
+
import { CanvasStack } from "./CanvasStack/CanvasStack";
|
|
5
|
+
import { ObjectWithProps } from "./ObjectWithProps";
|
|
6
|
+
import { NonEditable } from "./Annotations";
|
|
7
|
+
import { unwrapCanvasNode } from "./CanvasStack/ReactCanvas";
|
|
8
|
+
import { LayeredCanvasOperation } from "./CanvasStack/CanvasOperations";
|
|
9
|
+
|
|
10
|
+
export abstract class ParameterizedCanvas extends ObjectWithProps {
|
|
11
|
+
// only remove items from the lru where there is no texture built on it.
|
|
12
|
+
|
|
13
|
+
/** @internal */
|
|
14
|
+
static lu: { [key: string]: IUpdatingCanvas } = {};
|
|
15
|
+
|
|
16
|
+
/** @internal */
|
|
17
|
+
static counter = 1;
|
|
18
|
+
|
|
19
|
+
@NonEditable width = 100;
|
|
20
|
+
@NonEditable height = 100;
|
|
21
|
+
|
|
22
|
+
private signature(): string {
|
|
23
|
+
const proto = Object.getPrototypeOf(this);
|
|
24
|
+
const constructor = proto.constructor;
|
|
25
|
+
|
|
26
|
+
// handle hot reloading - or the old class instance will be cached
|
|
27
|
+
if (!proto.counter) {
|
|
28
|
+
proto.counter = ++ParameterizedCanvas.counter;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
const keySpace = constructor.name;
|
|
32
|
+
return `${keySpace}___${proto.counter}___${this.width}___${this.height}___${this.props
|
|
33
|
+
.map((prop) => {
|
|
34
|
+
const v = (this as any)[prop];
|
|
35
|
+
if (v instanceof Object) {
|
|
36
|
+
return JSON.stringify(v);
|
|
37
|
+
}
|
|
38
|
+
return v;
|
|
39
|
+
})
|
|
40
|
+
.join("___")}`;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
get(): IUpdatingCanvas {
|
|
44
|
+
const signature = this.signature();
|
|
45
|
+
let result = ParameterizedCanvas.lu[signature];
|
|
46
|
+
if (!result) {
|
|
47
|
+
ParameterizedCanvas.resize();
|
|
48
|
+
result = ParameterizedCanvas.lu[signature] = (() => {
|
|
49
|
+
try {
|
|
50
|
+
const ops = this.render();
|
|
51
|
+
return new CanvasStack(this.width, this.height, unwrapCanvasNode(ops));
|
|
52
|
+
} catch (e) {
|
|
53
|
+
console.error(e);
|
|
54
|
+
return new CanvasStack(this.width, this.height, new LayeredCanvasOperation([]));
|
|
55
|
+
}
|
|
56
|
+
})();
|
|
57
|
+
}
|
|
58
|
+
return result;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
private static resize() {
|
|
62
|
+
const entries = Object.entries(ParameterizedCanvas.lu);
|
|
63
|
+
if (entries.length % 10 === 0) {
|
|
64
|
+
entries.forEach(([sig, value]) => {
|
|
65
|
+
if (!value.hasBuiltTexture && value.createdAt < Date.now() - 5000) {
|
|
66
|
+
ParameterizedCanvas.lu[sig].dispose();
|
|
67
|
+
delete ParameterizedCanvas.lu[sig];
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
get material() {
|
|
74
|
+
return this.get().material;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
protected abstract render(): ReactNode;
|
|
78
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
let cbs:(()=>void)[] = [];
|
|
2
|
+
let hasRequestedAnimationFrame = false;
|
|
3
|
+
function frameCb() {
|
|
4
|
+
hasRequestedAnimationFrame = false;
|
|
5
|
+
const oldCbs = cbs;
|
|
6
|
+
cbs = [];
|
|
7
|
+
oldCbs.forEach(cb => cb());
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export function requestSharedAnimationFrame(cb:()=>void) {
|
|
11
|
+
cbs.push(cb);
|
|
12
|
+
if (!hasRequestedAnimationFrame) {
|
|
13
|
+
hasRequestedAnimationFrame = true;
|
|
14
|
+
requestAnimationFrame(frameCb);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { ParameterizedCanvas } from "./ParameterizedCanvas";
|
|
3
|
+
import { Color, Image, Layered } from "./CanvasStack/ReactCanvas";
|
|
4
|
+
import { RepeatWrapping } from "three";
|
|
5
|
+
import { ImageSpec } from "./CanvasStack/CanvasOperations";
|
|
6
|
+
|
|
7
|
+
export type StaticImageOptions = {
|
|
8
|
+
rx?: number;
|
|
9
|
+
ry?: number;
|
|
10
|
+
overlayColor?: string;
|
|
11
|
+
backgroundColor?: string;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export class StaticImage extends ParameterizedCanvas {
|
|
15
|
+
protected imageInfo: string;
|
|
16
|
+
|
|
17
|
+
constructor(
|
|
18
|
+
private image: ImageSpec,
|
|
19
|
+
private overlayColor?: string,
|
|
20
|
+
private backgroundColor?: string,
|
|
21
|
+
) {
|
|
22
|
+
super();
|
|
23
|
+
this.width = this.image.primary.bounds.width;
|
|
24
|
+
this.height = this.image.primary.bounds.height;
|
|
25
|
+
this.imageInfo = JSON.stringify(this.image);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
protected render() {
|
|
29
|
+
const imageNode = <Image image={this.image} fill overlayColor={this.overlayColor} />;
|
|
30
|
+
|
|
31
|
+
if (this.backgroundColor) {
|
|
32
|
+
return (
|
|
33
|
+
<Layered>
|
|
34
|
+
<Color hex={this.backgroundColor} />
|
|
35
|
+
{imageNode}
|
|
36
|
+
</Layered>
|
|
37
|
+
);
|
|
38
|
+
}
|
|
39
|
+
return imageNode;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
static material(image: ImageSpec, options?: StaticImageOptions) {
|
|
43
|
+
const result = new StaticImage(image, options?.overlayColor, options?.backgroundColor);
|
|
44
|
+
return result.get().material;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
static texture(image: ImageSpec, options?: StaticImageOptions) {
|
|
48
|
+
const result = new StaticImage(image, options?.overlayColor, options?.backgroundColor);
|
|
49
|
+
const texture = result.get().texture;
|
|
50
|
+
if (options) {
|
|
51
|
+
texture.repeat.x = options.rx ?? 1;
|
|
52
|
+
texture.repeat.y = options.ry ?? 1;
|
|
53
|
+
texture.wrapS = RepeatWrapping;
|
|
54
|
+
texture.wrapT = RepeatWrapping;
|
|
55
|
+
}
|
|
56
|
+
return texture;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
@@ -0,0 +1,330 @@
|
|
|
1
|
+
import {
|
|
2
|
+
BufferGeometry,
|
|
3
|
+
BufferAttribute,
|
|
4
|
+
Vector2,
|
|
5
|
+
Path,
|
|
6
|
+
ShapePath,
|
|
7
|
+
ExtrudeGeometryOptions,
|
|
8
|
+
ExtrudeGeometry,
|
|
9
|
+
} from "three";
|
|
10
|
+
import { SVGLoader } from "three/examples/jsm/loaders/SVGLoader.js";
|
|
11
|
+
import { mergeGeometries } from "three/examples/jsm/utils/BufferGeometryUtils.js";
|
|
12
|
+
import QuickLRU from "quick-lru";
|
|
13
|
+
|
|
14
|
+
export interface ExtrudeFromSVGOptions {
|
|
15
|
+
depth?: number;
|
|
16
|
+
curveSegments?: number;
|
|
17
|
+
bevelEnabled?: boolean;
|
|
18
|
+
bevelThickness?: number;
|
|
19
|
+
bevelSize?: number;
|
|
20
|
+
bevelOffset?: number;
|
|
21
|
+
bevelSegments?: number;
|
|
22
|
+
scale?: number;
|
|
23
|
+
center?: boolean;
|
|
24
|
+
zUp?: boolean;
|
|
25
|
+
filledPathsOnly?: boolean;
|
|
26
|
+
|
|
27
|
+
/** Pre-extrude SVG simplification tolerance (in SVG units). 0 disables. */
|
|
28
|
+
svgSimplifyTolerance?: number;
|
|
29
|
+
/** Subdivision per curve before simplifying (baseline polyline density). */
|
|
30
|
+
svgCurveDivisionsPreSimplify?: number;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/** --- NEW: module-level LRU cache (stores BufferGeometry) --- */
|
|
34
|
+
const geomCache = new QuickLRU<string, BufferGeometry>({ maxSize: 100 });
|
|
35
|
+
|
|
36
|
+
/** Stable stringify limited to our known option keys (order-insensitive). */
|
|
37
|
+
function stableOptionsKey(
|
|
38
|
+
opts: Required<
|
|
39
|
+
Pick<
|
|
40
|
+
ExtrudeFromSVGOptions,
|
|
41
|
+
| "depth"
|
|
42
|
+
| "curveSegments"
|
|
43
|
+
| "bevelEnabled"
|
|
44
|
+
| "bevelThickness"
|
|
45
|
+
| "bevelSize"
|
|
46
|
+
| "bevelOffset"
|
|
47
|
+
| "bevelSegments"
|
|
48
|
+
| "scale"
|
|
49
|
+
| "center"
|
|
50
|
+
| "zUp"
|
|
51
|
+
| "filledPathsOnly"
|
|
52
|
+
| "svgSimplifyTolerance"
|
|
53
|
+
| "svgCurveDivisionsPreSimplify"
|
|
54
|
+
>
|
|
55
|
+
>,
|
|
56
|
+
): string {
|
|
57
|
+
const entries = Object.entries(opts).sort(([a], [b]) => (a < b ? -1 : a > b ? 1 : 0));
|
|
58
|
+
return entries.map(([k, v]) => `${k}:${typeof v === "number" ? v : v ? 1 : 0}`).join("|");
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/** Tiny non-crypto hash for cache keys (djb2). */
|
|
62
|
+
function hashString(s: string): string {
|
|
63
|
+
let h = 5381;
|
|
64
|
+
for (let i = 0; i < s.length; i++) h = ((h << 5) + h) ^ s.charCodeAt(i);
|
|
65
|
+
// force uint32 and base36 to keep key short
|
|
66
|
+
return (h >>> 0).toString(36);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
export function extrudeSVGToGeometry(
|
|
70
|
+
svgString: string,
|
|
71
|
+
{
|
|
72
|
+
depth = 2,
|
|
73
|
+
curveSegments = 24,
|
|
74
|
+
bevelEnabled = false,
|
|
75
|
+
bevelThickness = 0.2,
|
|
76
|
+
bevelSize = 0.1,
|
|
77
|
+
bevelOffset = 0,
|
|
78
|
+
bevelSegments = 2,
|
|
79
|
+
scale = 0.01,
|
|
80
|
+
center = true,
|
|
81
|
+
zUp = false,
|
|
82
|
+
filledPathsOnly = true,
|
|
83
|
+
svgSimplifyTolerance = 0,
|
|
84
|
+
svgCurveDivisionsPreSimplify = 24,
|
|
85
|
+
}: ExtrudeFromSVGOptions = {},
|
|
86
|
+
): BufferGeometry {
|
|
87
|
+
// --- helpers ---
|
|
88
|
+
const decodeSvgDataUrl = (input: string): string => {
|
|
89
|
+
if (!input.startsWith("data:")) return input;
|
|
90
|
+
const firstComma = input.indexOf(",");
|
|
91
|
+
if (firstComma === -1) throw new Error("Invalid data URL");
|
|
92
|
+
const meta = input.slice(5, firstComma);
|
|
93
|
+
const data = input.slice(firstComma + 1);
|
|
94
|
+
const isBase64 = /;base64/i.test(meta);
|
|
95
|
+
if (isBase64) {
|
|
96
|
+
try {
|
|
97
|
+
return new TextDecoder().decode(Uint8Array.from(atob(data), (c) => c.charCodeAt(0)));
|
|
98
|
+
} catch {
|
|
99
|
+
return Buffer.from(data, "base64").toString("utf-8");
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
return decodeURIComponent(data);
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
const applyPlanarUV_XY = (geometry: BufferGeometry): void => {
|
|
106
|
+
geometry.computeBoundingBox();
|
|
107
|
+
const bb = geometry.boundingBox!;
|
|
108
|
+
const sx = bb.max.x - bb.min.x;
|
|
109
|
+
const sy = bb.max.y - bb.min.y;
|
|
110
|
+
const pos = geometry.getAttribute("position") as BufferAttribute;
|
|
111
|
+
const uv = new Float32Array(pos.count * 2);
|
|
112
|
+
for (let i = 0; i < pos.count; i++) {
|
|
113
|
+
const x = pos.getX(i),
|
|
114
|
+
y = pos.getY(i);
|
|
115
|
+
uv[2 * i + 0] = sx > 1e-9 ? (x - bb.min.x) / sx : 0;
|
|
116
|
+
uv[2 * i + 1] = sy > 1e-9 ? (y - bb.min.y) / sy : 0;
|
|
117
|
+
}
|
|
118
|
+
geometry.setAttribute("uv", new BufferAttribute(uv, 2));
|
|
119
|
+
geometry.attributes.uv.needsUpdate = true;
|
|
120
|
+
};
|
|
121
|
+
|
|
122
|
+
const tagGroupsFrontBackSides_Z = (geometry: BufferGeometry, eps = 1e-9): void => {
|
|
123
|
+
const pos = geometry.getAttribute("position") as BufferAttribute;
|
|
124
|
+
const index = geometry.getIndex();
|
|
125
|
+
geometry.clearGroups();
|
|
126
|
+
const readZ = (vi: number) => pos.getZ(vi);
|
|
127
|
+
|
|
128
|
+
if (index) {
|
|
129
|
+
for (let i = 0; i < index.count; i += 3) {
|
|
130
|
+
const a = index.getX(i),
|
|
131
|
+
b = index.getX(i + 1),
|
|
132
|
+
c = index.getX(i + 2);
|
|
133
|
+
const za = readZ(a),
|
|
134
|
+
zb = readZ(b),
|
|
135
|
+
zc = readZ(c);
|
|
136
|
+
const zMin = Math.min(za, zb, zc);
|
|
137
|
+
const zMax = Math.max(za, zb, zc);
|
|
138
|
+
let matIndex: number;
|
|
139
|
+
if (Math.abs(zMax - zMin) <= eps) {
|
|
140
|
+
const zAvg = (za + zb + zc) / 3;
|
|
141
|
+
matIndex = zAvg >= 0 ? 0 : 1; // 0 front, 1 back
|
|
142
|
+
} else {
|
|
143
|
+
matIndex = 2; // sides
|
|
144
|
+
}
|
|
145
|
+
geometry.addGroup(i, 3, matIndex);
|
|
146
|
+
}
|
|
147
|
+
} else {
|
|
148
|
+
for (let i = 0; i < pos.count; i += 3) {
|
|
149
|
+
const za = readZ(i),
|
|
150
|
+
zb = readZ(i + 1),
|
|
151
|
+
zc = readZ(i + 2);
|
|
152
|
+
const zMin = Math.min(za, zb, zc);
|
|
153
|
+
const zMax = Math.max(za, zb, zc);
|
|
154
|
+
let matIndex: number;
|
|
155
|
+
if (Math.abs(zMax - zMin) <= eps) {
|
|
156
|
+
const zAvg = (za + zb + zc) / 3;
|
|
157
|
+
matIndex = zAvg >= 0 ? 0 : 1;
|
|
158
|
+
} else {
|
|
159
|
+
matIndex = 2;
|
|
160
|
+
}
|
|
161
|
+
geometry.addGroup(i, 3, matIndex);
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
(geometry as any).groupsNeedUpdate = true;
|
|
165
|
+
};
|
|
166
|
+
|
|
167
|
+
// --- SVG pre-simplification utilities (RDP) ---
|
|
168
|
+
const rdp = (pts: Vector2[], eps: number): Vector2[] => {
|
|
169
|
+
if (pts.length <= 2) return pts.slice();
|
|
170
|
+
const dist = (p: Vector2, a: Vector2, b: Vector2) => {
|
|
171
|
+
const abx = b.x - a.x,
|
|
172
|
+
aby = b.y - a.y;
|
|
173
|
+
const apx = p.x - a.x,
|
|
174
|
+
apy = p.y - a.y;
|
|
175
|
+
const t = Math.max(0, Math.min(1, (apx * abx + apy * aby) / (abx * abx + aby * aby || 1)));
|
|
176
|
+
const qx = a.x + t * abx,
|
|
177
|
+
qy = a.y + t * aby;
|
|
178
|
+
return Math.hypot(p.x - qx, p.y - qy);
|
|
179
|
+
};
|
|
180
|
+
let maxD = -1,
|
|
181
|
+
idx = -1;
|
|
182
|
+
const a = pts[0],
|
|
183
|
+
b = pts[pts.length - 1];
|
|
184
|
+
for (let i = 1; i < pts.length - 1; i++) {
|
|
185
|
+
const d = dist(pts[i], a, b);
|
|
186
|
+
if (d > maxD) {
|
|
187
|
+
maxD = d;
|
|
188
|
+
idx = i;
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
if (maxD > eps) {
|
|
192
|
+
const left = rdp(pts.slice(0, idx + 1), eps);
|
|
193
|
+
const right = rdp(pts.slice(idx), eps);
|
|
194
|
+
return left.slice(0, -1).concat(right);
|
|
195
|
+
} else {
|
|
196
|
+
return [a, b];
|
|
197
|
+
}
|
|
198
|
+
};
|
|
199
|
+
|
|
200
|
+
const pathIsClosed = (p: Path, tol = 1e-6): boolean => {
|
|
201
|
+
const pts = p.getPoints(1);
|
|
202
|
+
if (pts.length < 2) return false;
|
|
203
|
+
const first = pts[0],
|
|
204
|
+
last = pts[pts.length - 1];
|
|
205
|
+
return Math.hypot(first.x - last.x, first.y - last.y) <= tol;
|
|
206
|
+
};
|
|
207
|
+
|
|
208
|
+
const simplifyShapePath = (sp: ShapePath, eps: number, divisionsPerCurve: number): ShapePath => {
|
|
209
|
+
const out = new ShapePath();
|
|
210
|
+
(out as any).color = (sp as any).color;
|
|
211
|
+
(out as any).userData = (sp as any).userData;
|
|
212
|
+
|
|
213
|
+
for (const sub of sp.subPaths) {
|
|
214
|
+
const divisions = Math.max(1, divisionsPerCurve);
|
|
215
|
+
const dense = sub.getPoints(divisions * Math.max(1, sub.curves.length));
|
|
216
|
+
if (dense.length < 2) continue;
|
|
217
|
+
|
|
218
|
+
const closed = pathIsClosed(sub);
|
|
219
|
+
let pts = dense;
|
|
220
|
+
|
|
221
|
+
if (closed) {
|
|
222
|
+
const first = dense[0],
|
|
223
|
+
last = dense[dense.length - 1];
|
|
224
|
+
if (first.distanceToSquared(last) > 1e-12) pts = dense.concat([dense[0].clone()]);
|
|
225
|
+
}
|
|
226
|
+
let simp = rdp(pts, eps);
|
|
227
|
+
|
|
228
|
+
if (closed) {
|
|
229
|
+
if (simp.length > 1 && simp[0].distanceToSquared(simp[simp.length - 1]) < 1e-12) {
|
|
230
|
+
simp = simp.slice(0, -1);
|
|
231
|
+
}
|
|
232
|
+
if (simp.length < 3) continue;
|
|
233
|
+
} else if (simp.length < 2) {
|
|
234
|
+
continue;
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
const np = new Path();
|
|
238
|
+
np.moveTo(simp[0].x, simp[0].y);
|
|
239
|
+
for (let i = 1; i < simp.length; i++) np.lineTo(simp[i].x, simp[i].y);
|
|
240
|
+
np.autoClose = closed;
|
|
241
|
+
out.subPaths.push(np);
|
|
242
|
+
}
|
|
243
|
+
return out;
|
|
244
|
+
};
|
|
245
|
+
|
|
246
|
+
// --- decode (so equivalent data-URLs normalize to same cache key) ---
|
|
247
|
+
const decodedSvg = decodeSvgDataUrl(svgString);
|
|
248
|
+
|
|
249
|
+
// --- NEW: build a cache key from decoded SVG + normalized options ---
|
|
250
|
+
const keyOptions = stableOptionsKey({
|
|
251
|
+
depth,
|
|
252
|
+
curveSegments,
|
|
253
|
+
bevelEnabled,
|
|
254
|
+
bevelThickness,
|
|
255
|
+
bevelSize,
|
|
256
|
+
bevelOffset,
|
|
257
|
+
bevelSegments,
|
|
258
|
+
scale,
|
|
259
|
+
center,
|
|
260
|
+
zUp,
|
|
261
|
+
filledPathsOnly,
|
|
262
|
+
svgSimplifyTolerance,
|
|
263
|
+
svgCurveDivisionsPreSimplify,
|
|
264
|
+
});
|
|
265
|
+
const cacheKey = `v1|${hashString(decodedSvg)}|${keyOptions}`;
|
|
266
|
+
|
|
267
|
+
// --- NEW: fast path from cache (return a clone to keep callers isolated) ---
|
|
268
|
+
const cached = geomCache.get(cacheKey);
|
|
269
|
+
if (cached) {
|
|
270
|
+
return cached;
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
// --- parse + (optional) pre-simplify SVG paths ---
|
|
274
|
+
const loader = new SVGLoader();
|
|
275
|
+
const data = loader.parse(decodedSvg);
|
|
276
|
+
|
|
277
|
+
const extrudeSettings: ExtrudeGeometryOptions = {
|
|
278
|
+
depth,
|
|
279
|
+
bevelEnabled,
|
|
280
|
+
bevelThickness,
|
|
281
|
+
bevelSize,
|
|
282
|
+
bevelOffset,
|
|
283
|
+
bevelSegments,
|
|
284
|
+
curveSegments,
|
|
285
|
+
};
|
|
286
|
+
|
|
287
|
+
const parts: BufferGeometry[] = [];
|
|
288
|
+
|
|
289
|
+
for (const path of data.paths) {
|
|
290
|
+
const style = path.userData?.style ?? {};
|
|
291
|
+
const hasFill = style.fill !== undefined && style.fill !== null && style.fill !== "none";
|
|
292
|
+
if (!filledPathsOnly || hasFill) {
|
|
293
|
+
const pathForShapes =
|
|
294
|
+
svgSimplifyTolerance > 0 ? simplifyShapePath(path, svgSimplifyTolerance, svgCurveDivisionsPreSimplify) : path;
|
|
295
|
+
|
|
296
|
+
const shapes = SVGLoader.createShapes(pathForShapes);
|
|
297
|
+
|
|
298
|
+
for (const shape of shapes) {
|
|
299
|
+
const g = new ExtrudeGeometry(shape, extrudeSettings);
|
|
300
|
+
g.scale(scale, scale, scale);
|
|
301
|
+
g.rotateX(Math.PI); // fix SVG Y-down; local Z is thickness axis
|
|
302
|
+
parts.push(g);
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
if (parts.length === 0) {
|
|
308
|
+
throw new Error("No shapes to extrude. Ensure your SVG has filled paths (or set filledPathsOnly=false).");
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
const geometry = mergeGeometries(parts, true);
|
|
312
|
+
|
|
313
|
+
if (center) {
|
|
314
|
+
geometry.computeBoundingBox();
|
|
315
|
+
const bb = geometry.boundingBox!;
|
|
316
|
+
geometry.translate(-(bb.min.x + bb.max.x) / 2, -(bb.min.y + bb.max.y) / 2, -(bb.min.z + bb.max.z) / 2);
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
geometry.computeVertexNormals();
|
|
320
|
+
tagGroupsFrontBackSides_Z(geometry);
|
|
321
|
+
applyPlanarUV_XY(geometry);
|
|
322
|
+
if (zUp) geometry.rotateX(Math.PI / 2);
|
|
323
|
+
|
|
324
|
+
console.log("Triangle count:", geometry.index ? geometry.index.count / 3 : geometry.attributes.position.count / 3);
|
|
325
|
+
|
|
326
|
+
// --- NEW: store in cache (store a clone to protect cache entry) ---
|
|
327
|
+
geomCache.set(cacheKey, geometry);
|
|
328
|
+
|
|
329
|
+
return geometry;
|
|
330
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
type References<V> = {
|
|
2
|
+
uuid: string;
|
|
3
|
+
inUse: boolean;
|
|
4
|
+
unusedSince: number;
|
|
5
|
+
ref: V;
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
export class ThreeDisposer<V> {
|
|
9
|
+
constructor(private cleanup: (v: V) => void) {}
|
|
10
|
+
|
|
11
|
+
private references: { [uuid: string]: References<V> } = {};
|
|
12
|
+
private changeCallback?: () => void;
|
|
13
|
+
|
|
14
|
+
public notifyChange(_uuid: string) {
|
|
15
|
+
if (this.changeCallback) {
|
|
16
|
+
this.changeCallback();
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
public register(uuid: string, ref: V) {
|
|
21
|
+
this.references[uuid] = {
|
|
22
|
+
uuid,
|
|
23
|
+
inUse: false,
|
|
24
|
+
unusedSince: Date.now(),
|
|
25
|
+
ref,
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
public markUsedMap(uuidMap: Map<string, V>, cb: () => void) {
|
|
30
|
+
uuidMap.forEach((ref, uuid) => {
|
|
31
|
+
if (!this.references[uuid]) {
|
|
32
|
+
this.register(uuid, ref);
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
this.markUsed(new Set(uuidMap.keys()), cb);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
public markUsed(uuids: Set<string>, cb: () => void) {
|
|
39
|
+
const now = Date.now();
|
|
40
|
+
this.changeCallback = cb;
|
|
41
|
+
|
|
42
|
+
// Mark all references as unused first
|
|
43
|
+
Object.values(this.references).forEach((ref) => {
|
|
44
|
+
if (ref.inUse) {
|
|
45
|
+
ref.inUse = false;
|
|
46
|
+
ref.unusedSince = now;
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
// Mark currently used references as used
|
|
51
|
+
uuids.forEach((uuid) => {
|
|
52
|
+
const ref = this.references[uuid];
|
|
53
|
+
if (ref) {
|
|
54
|
+
ref.inUse = true;
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
// Clean up unused references after 5 seconds
|
|
59
|
+
Object.values(this.references).forEach((ref) => {
|
|
60
|
+
if (!ref.inUse && ref.unusedSince < now - 5000) {
|
|
61
|
+
this.cleanup(ref.ref);
|
|
62
|
+
delete this.references[ref.uuid];
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export const ZINDEX_GALLERY_INVISIBLE = -1;
|
|
2
|
+
export const ZINDEX_BOTTOM_BAR_BUTTON_LONG_CLICK = 1;
|
|
3
|
+
export const ZINDEX_BOTTOM_BAR_BUTTON_LABEL = 2;
|
|
4
|
+
export const ZINDEX_PROMPT_CONTROLS = 3;
|
|
5
|
+
export const ZINDEX_SPARKS = 10;
|
|
6
|
+
export const ZINDEX_PANEL_CUTOUTS = 11;
|
|
7
|
+
|
|
8
|
+
export const ZINDEX_PINCH_OUT = 50;
|
|
9
|
+
export const ZINDEX_PINCH_OUT_FOCUSED = 51;
|
|
10
|
+
|
|
11
|
+
export const ZINDEX_CONTEXT_GALLERY_DISPLAY = 140;
|
|
12
|
+
export const ZINDEX_MATCH_END_DISPLAY = 150;
|
|
13
|
+
export const ZINDEX_GALLERY_VISIBLE = 160;
|
|
14
|
+
export const ZINDEX_TOP_BAR_HEADER = 210;
|
|
15
|
+
export const ZINDEX_TOP_BAR_BODY = 200;
|