@spatial-elements/core 0.1.0-beta.2 → 1.0.0-beta.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +9 -3
- package/dist/catalog/CatalogGeometryFade.d.ts.map +1 -1
- package/dist/catalog/CatalogGeometryFade.js +6 -2
- package/dist/catalog/CatalogGeometryFade.js.map +1 -1
- package/dist/catalog/CatalogPreparation.d.ts +3 -3
- package/dist/catalog/CatalogPreparation.d.ts.map +1 -1
- package/dist/catalog/CatalogPreparation.js +2 -1
- package/dist/catalog/CatalogPreparation.js.map +1 -1
- package/dist/catalog/CatalogSpatialElementLayer.d.ts +1 -0
- package/dist/catalog/CatalogSpatialElementLayer.d.ts.map +1 -1
- package/dist/catalog/CatalogSpatialElementLayer.js +46 -18
- package/dist/catalog/CatalogSpatialElementLayer.js.map +1 -1
- package/dist/catalog/CatalogTransition.d.ts.map +1 -1
- package/dist/catalog/CatalogTransition.js +25 -7
- package/dist/catalog/CatalogTransition.js.map +1 -1
- package/dist/catalog/SpatialPageRegistry.d.ts +17 -0
- package/dist/catalog/SpatialPageRegistry.d.ts.map +1 -0
- package/dist/catalog/SpatialPageRegistry.js +21 -0
- package/dist/catalog/SpatialPageRegistry.js.map +1 -0
- package/dist/catalog/carouselMotion.d.ts +39 -0
- package/dist/catalog/carouselMotion.d.ts.map +1 -0
- package/dist/catalog/carouselMotion.js +104 -0
- package/dist/catalog/carouselMotion.js.map +1 -0
- package/dist/catalog/catalogPage.d.ts +7 -3
- package/dist/catalog/catalogPage.d.ts.map +1 -1
- package/dist/catalog/catalogPage.js.map +1 -1
- package/dist/catalog/spatialElementAssets.d.ts +5 -5
- package/dist/catalog/spatialElementAssets.d.ts.map +1 -1
- package/dist/catalog/spatialElementAssets.js.map +1 -1
- package/dist/catalog/spatialElementLodPair.d.ts +2 -1
- package/dist/catalog/spatialElementLodPair.d.ts.map +1 -1
- package/dist/catalog/spatialElementLodPair.js.map +1 -1
- package/dist/index.d.ts +5 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -1
- package/dist/index.js.map +1 -1
- package/dist/spatial-element/SpatialElementDockController.d.ts.map +1 -1
- package/dist/spatial-element/SpatialElementDockController.js +4 -3
- package/dist/spatial-element/SpatialElementDockController.js.map +1 -1
- package/dist/spatial-element/messages.d.ts +32 -0
- package/dist/spatial-element/messages.d.ts.map +1 -0
- package/dist/spatial-element/messages.js +34 -0
- package/dist/spatial-element/messages.js.map +1 -0
- package/dist/spatial-element/spatialElement.d.ts +16 -12
- package/dist/spatial-element/spatialElement.d.ts.map +1 -1
- package/dist/spatial-element/spatialElement.js +32 -6
- package/dist/spatial-element/spatialElement.js.map +1 -1
- package/dist/spatial-element/spatialElementGeometry.d.ts +22 -0
- package/dist/spatial-element/spatialElementGeometry.d.ts.map +1 -0
- package/dist/spatial-element/spatialElementGeometry.js +40 -0
- package/dist/spatial-element/spatialElementGeometry.js.map +1 -0
- package/dist/spatial-element/spatialElementScene.d.ts +16 -0
- package/dist/spatial-element/spatialElementScene.d.ts.map +1 -0
- package/dist/spatial-element/spatialElementScene.js +22 -0
- package/dist/spatial-element/spatialElementScene.js.map +1 -0
- package/dist/spatial-element/spatialTheme.d.ts +16 -0
- package/dist/spatial-element/spatialTheme.d.ts.map +1 -0
- package/dist/spatial-element/spatialTheme.js +53 -0
- package/dist/spatial-element/spatialTheme.js.map +1 -0
- package/dist/spatial-element/types.d.ts +63 -33
- package/dist/spatial-element/types.d.ts.map +1 -1
- package/dist/spatial-element/types.js.map +1 -1
- package/dist/stage/LiquidGlassPanel.d.ts +2 -0
- package/dist/stage/LiquidGlassPanel.d.ts.map +1 -1
- package/dist/stage/LiquidGlassPanel.js +11 -2
- package/dist/stage/LiquidGlassPanel.js.map +1 -1
- package/dist/stage/MinimapController.js +1 -1
- package/dist/stage/MinimapController.js.map +1 -1
- package/dist/stage/ModelPointerPreview.d.ts +22 -0
- package/dist/stage/ModelPointerPreview.d.ts.map +1 -0
- package/dist/stage/ModelPointerPreview.js +71 -0
- package/dist/stage/ModelPointerPreview.js.map +1 -0
- package/dist/stage/PageBindingController.d.ts.map +1 -1
- package/dist/stage/PageBindingController.js +3 -1
- package/dist/stage/PageBindingController.js.map +1 -1
- package/dist/stage/PanelPresentationController.d.ts +3 -1
- package/dist/stage/PanelPresentationController.d.ts.map +1 -1
- package/dist/stage/PanelPresentationController.js +69 -12
- package/dist/stage/PanelPresentationController.js.map +1 -1
- package/dist/stage/SpatialElementInteractionController.d.ts +10 -1
- package/dist/stage/SpatialElementInteractionController.d.ts.map +1 -1
- package/dist/stage/SpatialElementInteractionController.js +104 -10
- package/dist/stage/SpatialElementInteractionController.js.map +1 -1
- package/dist/stage/StageExperience.d.ts +22 -4
- package/dist/stage/StageExperience.d.ts.map +1 -1
- package/dist/stage/StageExperience.js +131 -57
- package/dist/stage/StageExperience.js.map +1 -1
- package/dist/stage/StagePanelRuntime.d.ts +2 -1
- package/dist/stage/StagePanelRuntime.d.ts.map +1 -1
- package/dist/stage/StagePanelRuntime.js.map +1 -1
- package/dist/stage/StageRenderPipeline.d.ts +8 -1
- package/dist/stage/StageRenderPipeline.d.ts.map +1 -1
- package/dist/stage/StageRenderPipeline.js +24 -7
- package/dist/stage/StageRenderPipeline.js.map +1 -1
- package/dist/stage/VirtualScrollController.d.ts.map +1 -1
- package/dist/stage/VirtualScrollController.js +0 -2
- package/dist/stage/VirtualScrollController.js.map +1 -1
- package/dist/stage/interactionGuidance.d.ts +22 -0
- package/dist/stage/interactionGuidance.d.ts.map +1 -0
- package/dist/stage/interactionGuidance.js +53 -0
- package/dist/stage/interactionGuidance.js.map +1 -0
- package/dist/stage/minimap/MinimapGeometry.d.ts.map +1 -1
- package/dist/stage/minimap/MinimapGeometry.js +29 -0
- package/dist/stage/minimap/MinimapGeometry.js.map +1 -1
- package/dist/stage/mouseHover.d.ts +9 -0
- package/dist/stage/mouseHover.d.ts.map +1 -0
- package/dist/stage/mouseHover.js +55 -0
- package/dist/stage/mouseHover.js.map +1 -0
- package/dist/stage/panelContext.d.ts +9 -2
- package/dist/stage/panelContext.d.ts.map +1 -1
- package/dist/stage/panelContext.js.map +1 -1
- package/dist/stage/renderSettings.d.ts +10 -0
- package/dist/stage/renderSettings.d.ts.map +1 -0
- package/dist/stage/renderSettings.js +27 -0
- package/dist/stage/renderSettings.js.map +1 -0
- package/dist/stage/renderTargetInventory.d.ts +1 -1
- package/dist/stage/renderTargetInventory.js +1 -1
- package/dist/stage/renderTargetInventory.js.map +1 -1
- package/dist/stage/scrollFrame.d.ts +2 -0
- package/dist/stage/scrollFrame.d.ts.map +1 -1
- package/dist/stage/scrollFrame.js +18 -5
- package/dist/stage/scrollFrame.js.map +1 -1
- package/dist/stage/spatialElementFrame.d.ts.map +1 -1
- package/dist/stage/spatialElementFrame.js +5 -1
- package/dist/stage/spatialElementFrame.js.map +1 -1
- package/dist/stage/stageConstants.d.ts +3 -3
- package/dist/stage/stageConstants.d.ts.map +1 -1
- package/dist/stage/stageConstants.js +3 -3
- package/dist/stage/stageConstants.js.map +1 -1
- package/dist/stage/stageMath.d.ts +6 -7
- package/dist/stage/stageMath.d.ts.map +1 -1
- package/dist/stage/stageMath.js +12 -11
- package/dist/stage/stageMath.js.map +1 -1
- package/dist/stage/stageTypes.d.ts +21 -2
- package/dist/stage/stageTypes.d.ts.map +1 -1
- package/dist/stage/stageTypes.js.map +1 -1
- package/dist/stage/stageVisualTest.d.ts +3 -1
- package/dist/stage/stageVisualTest.d.ts.map +1 -1
- package/dist/stage/stageVisualTest.js.map +1 -1
- package/package.json +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"VirtualScrollController.js","sourceRoot":"","sources":["../../src/stage/VirtualScrollController.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,qBAAqB,EACrB,4BAA4B,EAC5B,oBAAoB,EACpB,yBAAyB,EACzB,uBAAuB,EAEvB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACN,iCAAiC,EAC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BAAwB,EAAE,CAAC;YACjC,CAAC;QACF,CAAC,CAAC;QAEF,IAAI,CAAC,iBAAiB,GAAG,qBAAqB,CAAC,OAAO,CAAC,CAAC;IACzD,CAAC;IAEO,aAAa,CAAC,OAAe,EAAE,OAAe;QACrD,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,SAAS,GAAG,eAAe,CAAC,OAAO,OAAO,CAAC,OAAO,QAAQ,CAAC;QAC9E,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,WAAW,CAAC,oBAAoB,EAAE,GAAG,OAAO,IAAI,CAAC,CAAC;IACtE,CAAC;IAEO,qBAAqB;QAC5B,MAAM,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,qBAAqB,EAAE,CAAC;QAClD,MAAM,MAAM,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,YAAY,EAAE,IAAI,CAAC,MAAM,EAAE,MAAM,CAAC,WAAW,CAAC,CAAC;QACpF,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM,GAAG,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC;IACrD,CAAC;CACD","sourcesContent":["import {\n\tSTAGE_SCROLL_PRIORITY,\n\tgetStageVisualScrollPosition,\n\tmarkStageScrollInput,\n\tsubscribeStageScrollFrame,\n\tsyncStageScrollToNative,\n\ttype StageScrollFrame\n} from './scrollFrame.js';\nimport {\n\tSTAGE_ANCHOR_NAVIGATION_END_EVENT,\n\tSTAGE_ANCHOR_NAVIGATION_EVENT,\n\tSTAGE_ANCHOR_SCROLL_DURATION_MS,\n\teaseStageAnchorScroll\n} from './scrollAnimation.js';\n\nconst ACTIVE_CLASS = 'stage-virtual-scroll-active';\nconst FOCUS_VIEWPORT_MARGIN = 24;\nconst SCROLL_INTERRUPTION_KEYS = new Set([\n\t'ArrowDown',\n\t'ArrowUp',\n\t'End',\n\t'Home',\n\t'PageDown',\n\t'PageUp',\n\t' '\n]);\n\nexport type ScrollRestoreTarget = { x: number; y: number } | { hash: string };\n\nexport interface ScrollPositions {\n\tnative: { x: number; y: number };\n\tvisual: { x: number; y: number };\n}\n\n/**\n * Keeps native scrolling as the input and scrollbar source while moving the\n * complete visible DOM from the same animation frame consumed by the stage.\n */\nexport class VirtualScrollController {\n\tprivate stopScrollFrames?: () => void;\n\tprivate resizeObserver?: ResizeObserver;\n\tprivate measureFrame = 0;\n\tprivate hashFrame = 0;\n\tprivate anchorScrollFrame = 0;\n\tprivate anchorNavigationTargetId?: string;\n\tprivate scrollY = 0;\n\tprivate started = false;\n\tprivate navigation?: { token: object; interrupted: boolean };\n\tprivate historyHashUrl?: string;\n\t/** The navigation bridge supplies SvelteKit's public history writers. */\n\twriteHash?: (url: URL, replace: boolean) => void;\n\n\tconstructor(\n\t\tprivate readonly container: HTMLElement,\n\t\tprivate readonly content: HTMLElement,\n\t\tprivate readonly spacer: HTMLElement\n\t) {}\n\n\tget active() {\n\t\treturn this.started;\n\t}\n\n\treadPositions(): ScrollPositions {\n\t\tconst visual = getStageVisualScrollPosition();\n\t\treturn {\n\t\t\tnative: { x: window.scrollX, y: window.scrollY },\n\t\t\tvisual: { x: visual.scrollX, y: visual.scrollY }\n\t\t};\n\t}\n\n\tbeginNavigation(token: object) {\n\t\tthis.cancelAnchorScroll();\n\t\tif (this.hashFrame) cancelAnimationFrame(this.hashFrame);\n\t\tthis.hashFrame = 0;\n\t\tthis.navigation = { token, interrupted: false };\n\t}\n\n\tmeasureExtentNow() {\n\t\tif (!this.started) return;\n\t\tif (this.measureFrame) cancelAnimationFrame(this.measureFrame);\n\t\tthis.measureFrame = 0;\n\t\tthis.measureDocumentHeight();\n\t\treturn Number.parseFloat(this.spacer.style.height);\n\t}\n\n\trestoreTarget(target: ScrollRestoreTarget, token: object) {\n\t\tif (!this.started || this.navigation?.token !== token || this.navigation.interrupted) return;\n\t\tlet position: { x: number; y: number };\n\t\tif ('hash' in target) {\n\t\t\tconst element = this.getHashTarget(target.hash);\n\t\t\tposition = { x: 0, y: element ? this.getElementScrollTop(element) : 0 };\n\t\t} else {\n\t\t\tposition = target;\n\t\t}\n\t\twindow.scrollTo({ left: position.x, top: position.y, behavior: 'instant' });\n\t\tsyncStageScrollToNative();\n\t\treturn this.readPositions();\n\t}\n\n\tendNavigation(token: object) {\n\t\tif (this.navigation?.token === token) this.navigation = undefined;\n\t}\n\n\tstart() {\n\t\tif (this.started) return;\n\t\tthis.started = true;\n\n\t\t// Preserve the in-flow height before the content becomes viewport-fixed.\n\t\tthis.measureDocumentHeight();\n\t\tthis.container.classList.add(ACTIVE_CLASS);\n\t\tthis.applyPosition(window.scrollX, window.scrollY);\n\t\tthis.measureDocumentHeight();\n\n\t\tthis.stopScrollFrames = subscribeStageScrollFrame(\n\t\t\tthis.handleScrollFrame,\n\t\t\tSTAGE_SCROLL_PRIORITY.virtualDocument\n\t\t);\n\t\twindow.addEventListener('resize', this.handleResize, { passive: true });\n\t\t// Panel content is moved into the CSS3D renderer after enhancement. Listen\n\t\t// on the stable stage container so anchors and focus keep working there too.\n\t\tthis.container.addEventListener('click', this.handleAnchorClick);\n\t\tthis.container.addEventListener('focusin', this.handleFocusIn);\n\t\twindow.addEventListener('hashchange', this.handleHashChange);\n\t\twindow.addEventListener('popstate', this.handlePopState);\n\t\twindow.addEventListener('wheel', this.handleUserInput, { passive: true });\n\t\twindow.addEventListener('touchstart', this.handleUserInput, { passive: true });\n\t\twindow.addEventListener('pointerdown', this.handleUserInput, { passive: true });\n\t\twindow.addEventListener('keydown', this.handleScrollInterruptionKey);\n\n\t\tif ('ResizeObserver' in window) {\n\t\t\tthis.resizeObserver = new ResizeObserver(this.scheduleMeasurement);\n\t\t\tthis.resizeObserver.observe(this.content);\n\t\t}\n\n\t\tvoid document.fonts?.ready.then(() => this.scheduleMeasurement());\n\t\tif (window.location.hash) this.scheduleHashNavigation();\n\t}\n\n\tdestroy() {\n\t\tif (!this.started) return;\n\t\tthis.started = false;\n\t\tthis.stopScrollFrames?.();\n\t\tthis.stopScrollFrames = undefined;\n\t\twindow.removeEventListener('resize', this.handleResize);\n\t\tthis.container.removeEventListener('click', this.handleAnchorClick);\n\t\tthis.container.removeEventListener('focusin', this.handleFocusIn);\n\t\twindow.removeEventListener('hashchange', this.handleHashChange);\n\t\twindow.removeEventListener('popstate', this.handlePopState);\n\t\twindow.removeEventListener('wheel', this.handleUserInput);\n\t\twindow.removeEventListener('touchstart', this.handleUserInput);\n\t\twindow.removeEventListener('pointerdown', this.handleUserInput);\n\t\twindow.removeEventListener('keydown', this.handleScrollInterruptionKey);\n\t\tthis.resizeObserver?.disconnect();\n\t\tthis.resizeObserver = undefined;\n\t\tif (this.measureFrame) cancelAnimationFrame(this.measureFrame);\n\t\tif (this.hashFrame) cancelAnimationFrame(this.hashFrame);\n\t\tthis.historyHashUrl = undefined;\n\t\tthis.navigation = undefined;\n\t\tthis.cancelAnchorScroll();\n\t\tthis.measureFrame = 0;\n\t\tthis.hashFrame = 0;\n\t\tthis.content.style.removeProperty('transform');\n\t\tthis.content.style.removeProperty('--virtual-scroll-y');\n\t\tthis.spacer.style.removeProperty('height');\n\t\tthis.container.classList.remove(ACTIVE_CLASS);\n\t}\n\n\tprivate readonly handleScrollFrame = (frame: StageScrollFrame) => {\n\t\tthis.applyPosition(frame.scrollX, frame.scrollY);\n\t};\n\n\tprivate readonly handleResize = () => {\n\t\tthis.scheduleMeasurement();\n\t};\n\n\tprivate readonly handleHashChange = (event: HashChangeEvent) => {\n\t\tconst restoredByHistory = event.newURL === this.historyHashUrl;\n\t\tthis.historyHashUrl = undefined;\n\t\tif (!restoredByHistory) this.scheduleHashNavigation();\n\t};\n\tprivate readonly handlePopState = () => {\n\t\tif (!this.writeHash) return;\n\t\t// History restoration wins over a fragment, including SvelteKit shallow entries.\n\t\tif (this.hashFrame) cancelAnimationFrame(this.hashFrame);\n\t\tthis.hashFrame = 0;\n\t\tthis.historyHashUrl = window.location.href;\n\t};\n\tprivate readonly handleUserInput = () => {\n\t\tthis.cancelAnchorScroll();\n\t\tif (this.navigation) this.navigation.interrupted = true;\n\t};\n\tprivate readonly handleScrollInterruptionKey = (event: KeyboardEvent) => {\n\t\tif (SCROLL_INTERRUPTION_KEYS.has(event.key)) this.handleUserInput();\n\t};\n\n\tprivate readonly cancelAnchorScroll = () => {\n\t\tif (this.anchorScrollFrame) cancelAnimationFrame(this.anchorScrollFrame);\n\t\tthis.anchorScrollFrame = 0;\n\t\tthis.completeAnchorNavigation();\n\t};\n\n\tprivate completeAnchorNavigation() {\n\t\tconst targetId = this.anchorNavigationTargetId;\n\t\tif (!targetId) return;\n\t\tthis.anchorNavigationTargetId = undefined;\n\t\twindow.dispatchEvent(\n\t\t\tnew CustomEvent(STAGE_ANCHOR_NAVIGATION_END_EVENT, { detail: { targetId } })\n\t\t);\n\t}\n\n\tprivate readonly scheduleMeasurement = () => {\n\t\tif (!this.started || this.measureFrame) return;\n\t\tthis.measureFrame = requestAnimationFrame(() => {\n\t\t\tthis.measureFrame = 0;\n\t\t\tthis.measureDocumentHeight();\n\t\t});\n\t};\n\n\tprivate readonly handleAnchorClick = (event: MouseEvent) => {\n\t\tif (\n\t\t\tthis.navigation ||\n\t\t\tevent.defaultPrevented ||\n\t\t\tevent.button !== 0 ||\n\t\t\tevent.metaKey ||\n\t\t\tevent.ctrlKey ||\n\t\t\tevent.shiftKey ||\n\t\t\tevent.altKey\n\t\t)\n\t\t\treturn;\n\t\tconst target =\n\t\t\tevent.target instanceof Element ? event.target.closest<HTMLAnchorElement>('a[href]') : null;\n\t\tif (!target) return;\n\n\t\tconst url = new URL(target.href, window.location.href);\n\t\tif (\n\t\t\t!url.hash ||\n\t\t\turl.origin !== window.location.origin ||\n\t\t\turl.pathname !== window.location.pathname ||\n\t\t\turl.search !== window.location.search\n\t\t)\n\t\t\treturn;\n\n\t\tconst element = this.getHashTarget(url.hash);\n\t\tif (!element) return;\n\n\t\tevent.preventDefault();\n\t\tconst animated =\n\t\t\ttarget.hasAttribute('data-spatial-element-tab-id') ||\n\t\t\ttarget.hasAttribute('data-spatial-element-section-navigation');\n\t\tconst navigationHash =\n\t\t\tanimated && element.hasAttribute('data-stage-scroll-top') ? '' : url.hash;\n\t\tif (window.location.hash !== navigationHash) {\n\t\t\tif (this.writeHash) {\n\t\t\t\turl.hash = navigationHash;\n\t\t\t\tthis.writeHash(url, animated);\n\t\t\t} else if (animated) {\n\t\t\t\turl.hash = navigationHash;\n\t\t\t\thistory.replaceState(history.state, '', url);\n\t\t\t} else {\n\t\t\t\twindow.location.hash = navigationHash;\n\t\t\t}\n\t\t}\n\t\tthis.scrollElementIntoView(element, false, animated);\n\t};\n\n\tprivate scheduleHashNavigation() {\n\t\tif (!this.started || this.hashFrame || this.navigation) return;\n\t\tthis.hashFrame = requestAnimationFrame(() => {\n\t\t\tthis.hashFrame = 0;\n\t\t\tconst element = this.getHashTarget(window.location.hash);\n\t\t\tif (element) {\n\t\t\t\tthis.scrollElementIntoView(element, false, element.hasAttribute('data-spatial-element-tab-target'));\n\t\t\t}\n\t\t});\n\t}\n\n\tprivate getHashTarget(hash: string) {\n\t\tif (!hash || hash === '#') return null;\n\t\ttry {\n\t\t\treturn this.container.querySelector<HTMLElement>(\n\t\t\t\t`#${CSS.escape(decodeURIComponent(hash.slice(1)))}`\n\t\t\t);\n\t\t} catch {\n\t\t\treturn null;\n\t\t}\n\t}\n\n\tprivate readonly handleFocusIn = (event: FocusEvent) => {\n\t\tif (this.navigation || !(event.target instanceof HTMLElement)) return;\n\t\tconst rect = event.target.getBoundingClientRect();\n\t\tif (\n\t\t\trect.top >= FOCUS_VIEWPORT_MARGIN &&\n\t\t\trect.bottom <= window.innerHeight - FOCUS_VIEWPORT_MARGIN\n\t\t)\n\t\t\treturn;\n\n\t\tthis.scrollElementIntoView(event.target, true);\n\t};\n\n\tprivate getElementScrollTop(element: HTMLElement, center = false) {\n\t\tconst rect = element.getBoundingClientRect();\n\t\tconst style = window.getComputedStyle(element);\n\t\tconst scrollMarginTop = Number.parseFloat(style.scrollMarginTop) || 0;\n\t\tconst documentTop = rect.top + this.scrollY;\n\t\treturn Math.max(\n\t\t\telement.hasAttribute('data-stage-scroll-top')\n\t\t\t\t? 0\n\t\t\t\t: center\n\t\t\t\t\t? documentTop - (window.innerHeight - rect.height) * 0.5\n\t\t\t\t\t: documentTop - scrollMarginTop,\n\t\t\t0\n\t\t);\n\t}\n\n\tprivate scrollElementIntoView(element: HTMLElement, center = false, animated = false) {\n\t\tconst targetY = this.getElementScrollTop(element, center);\n\n\t\tthis.cancelAnchorScroll();\n\t\tif (animated) {\n\t\t\tthis.anchorNavigationTargetId = element.id;\n\t\t\twindow.dispatchEvent(\n\t\t\t\tnew CustomEvent(STAGE_ANCHOR_NAVIGATION_EVENT, {\n\t\t\t\t\tdetail: { targetId: element.id }\n\t\t\t\t})\n\t\t\t);\n\t\t}\n\t\tif (!animated || window.matchMedia('(prefers-reduced-motion: reduce)').matches) {\n\t\t\tmarkStageScrollInput(animated ? 'navigation' : 'programmatic');\n\t\t\twindow.scrollTo({ top: targetY, behavior: 'instant' });\n\t\t\tthis.completeAnchorNavigation();\n\t\t\treturn;\n\t\t}\n\n\t\tconst startY = this.scrollY;\n\t\tconst distance = targetY - startY;\n\t\tif (Math.abs(distance) < 0.5) {\n\t\t\tmarkStageScrollInput('navigation');\n\t\t\twindow.scrollTo({ top: targetY, behavior: 'instant' });\n\t\t\tthis.completeAnchorNavigation();\n\t\t\treturn;\n\t\t}\n\n\t\tlet startTime: number | undefined;\n\t\tconst animate = (time: number) => {\n\t\t\tif (!this.started) return;\n\t\t\tstartTime ??= time;\n\t\t\tconst progress = Math.min((time - startTime) / STAGE_ANCHOR_SCROLL_DURATION_MS, 1);\n\t\t\tconst scrollTop = startY + distance * easeStageAnchorScroll(progress);\n\t\t\tmarkStageScrollInput('navigation');\n\t\t\twindow.scrollTo({ top: progress === 1 ? targetY : scrollTop, behavior: 'instant' });\n\n\t\t\tif (progress < 1) {\n\t\t\t\tthis.anchorScrollFrame = requestAnimationFrame(animate);\n\t\t\t} else {\n\t\t\t\tthis.anchorScrollFrame = 0;\n\t\t\t\tthis.completeAnchorNavigation();\n\t\t\t}\n\t\t};\n\n\t\tthis.anchorScrollFrame = requestAnimationFrame(animate);\n\t}\n\n\tprivate applyPosition(scrollX: number, scrollY: number) {\n\t\tthis.scrollY = scrollY;\n\t\tthis.content.style.transform = `translate3d(${-scrollX}px, ${-scrollY}px, 0)`;\n\t\tthis.content.style.setProperty('--virtual-scroll-y', `${scrollY}px`);\n\t}\n\n\tprivate measureDocumentHeight() {\n\t\tconst rect = this.content.getBoundingClientRect();\n\t\tconst height = Math.max(this.content.scrollHeight, rect.height, window.innerHeight);\n\t\tthis.spacer.style.height = `${Math.ceil(height)}px`;\n\t}\n}\n"]}
|
|
1
|
+
{"version":3,"file":"VirtualScrollController.js","sourceRoot":"","sources":["../../src/stage/VirtualScrollController.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,qBAAqB,EACrB,4BAA4B,EAC5B,oBAAoB,EACpB,yBAAyB,EACzB,uBAAuB,EAEvB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACN,iCAAiC,EACjC,6BAA6B,EAC7B,+BAA+B,EAC/B,qBAAqB,EACrB,MAAM,sBAAsB,CAAC;AAE9B,MAAM,YAAY,GAAG,6BAA6B,CAAC;AACnD,MAAM,qBAAqB,GAAG,EAAE,CAAC;AACjC,MAAM,wBAAwB,GAAG,IAAI,GAAG,CAAC;IACxC,WAAW;IACX,SAAS;IACT,KAAK;IACL,MAAM;IACN,UAAU;IACV,QAAQ;IACR,GAAG;CACH,CAAC,CAAC;AASH;;;GAGG;AACH,MAAM,OAAO,uBAAuB;IAejB;IACA;IACA;IAhBV,gBAAgB,CAAc;IAC9B,cAAc,CAAkB;IAChC,YAAY,GAAG,CAAC,CAAC;IACjB,SAAS,GAAG,CAAC,CAAC;IACd,iBAAiB,GAAG,CAAC,CAAC;IACtB,wBAAwB,C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,CAAC,KAAK,CAAC,MAAM,GAAG,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC;IACrD,CAAC;CACD","sourcesContent":["import {\n\tSTAGE_SCROLL_PRIORITY,\n\tgetStageVisualScrollPosition,\n\tmarkStageScrollInput,\n\tsubscribeStageScrollFrame,\n\tsyncStageScrollToNative,\n\ttype StageScrollFrame\n} from './scrollFrame.js';\nimport {\n\tSTAGE_ANCHOR_NAVIGATION_END_EVENT,\n\tSTAGE_ANCHOR_NAVIGATION_EVENT,\n\tSTAGE_ANCHOR_SCROLL_DURATION_MS,\n\teaseStageAnchorScroll\n} from './scrollAnimation.js';\n\nconst ACTIVE_CLASS = 'stage-virtual-scroll-active';\nconst FOCUS_VIEWPORT_MARGIN = 24;\nconst SCROLL_INTERRUPTION_KEYS = new Set([\n\t'ArrowDown',\n\t'ArrowUp',\n\t'End',\n\t'Home',\n\t'PageDown',\n\t'PageUp',\n\t' '\n]);\n\nexport type ScrollRestoreTarget = { x: number; y: number } | { hash: string };\n\nexport interface ScrollPositions {\n\tnative: { x: number; y: number };\n\tvisual: { x: number; y: number };\n}\n\n/**\n * Keeps native scrolling as the input and scrollbar source while moving the\n * complete visible DOM from the same animation frame consumed by the stage.\n */\nexport class VirtualScrollController {\n\tprivate stopScrollFrames?: () => void;\n\tprivate resizeObserver?: ResizeObserver;\n\tprivate measureFrame = 0;\n\tprivate hashFrame = 0;\n\tprivate anchorScrollFrame = 0;\n\tprivate anchorNavigationTargetId?: string;\n\tprivate scrollY = 0;\n\tprivate started = false;\n\tprivate navigation?: { token: object; interrupted: boolean };\n\tprivate historyHashUrl?: string;\n\t/** The navigation bridge supplies SvelteKit's public history writers. */\n\twriteHash?: (url: URL, replace: boolean) => void;\n\n\tconstructor(\n\t\tprivate readonly container: HTMLElement,\n\t\tprivate readonly content: HTMLElement,\n\t\tprivate readonly spacer: HTMLElement\n\t) {}\n\n\tget active() {\n\t\treturn this.started;\n\t}\n\n\treadPositions(): ScrollPositions {\n\t\tconst visual = getStageVisualScrollPosition();\n\t\treturn {\n\t\t\tnative: { x: window.scrollX, y: window.scrollY },\n\t\t\tvisual: { x: visual.scrollX, y: visual.scrollY }\n\t\t};\n\t}\n\n\tbeginNavigation(token: object) {\n\t\tthis.cancelAnchorScroll();\n\t\tif (this.hashFrame) cancelAnimationFrame(this.hashFrame);\n\t\tthis.hashFrame = 0;\n\t\tthis.navigation = { token, interrupted: false };\n\t}\n\n\tmeasureExtentNow() {\n\t\tif (!this.started) return;\n\t\tif (this.measureFrame) cancelAnimationFrame(this.measureFrame);\n\t\tthis.measureFrame = 0;\n\t\tthis.measureDocumentHeight();\n\t\treturn Number.parseFloat(this.spacer.style.height);\n\t}\n\n\trestoreTarget(target: ScrollRestoreTarget, token: object) {\n\t\tif (!this.started || this.navigation?.token !== token || this.navigation.interrupted) return;\n\t\tlet position: { x: number; y: number };\n\t\tif ('hash' in target) {\n\t\t\tconst element = this.getHashTarget(target.hash);\n\t\t\tposition = { x: 0, y: element ? this.getElementScrollTop(element) : 0 };\n\t\t} else {\n\t\t\tposition = target;\n\t\t}\n\t\twindow.scrollTo({ left: position.x, top: position.y, behavior: 'instant' });\n\t\tsyncStageScrollToNative();\n\t\treturn this.readPositions();\n\t}\n\n\tendNavigation(token: object) {\n\t\tif (this.navigation?.token === token) this.navigation = undefined;\n\t}\n\n\tstart() {\n\t\tif (this.started) return;\n\t\tthis.started = true;\n\n\t\t// Preserve the in-flow height before the content becomes viewport-fixed.\n\t\tthis.measureDocumentHeight();\n\t\tthis.container.classList.add(ACTIVE_CLASS);\n\t\tthis.applyPosition(window.scrollX, window.scrollY);\n\t\tthis.measureDocumentHeight();\n\n\t\tthis.stopScrollFrames = subscribeStageScrollFrame(\n\t\t\tthis.handleScrollFrame,\n\t\t\tSTAGE_SCROLL_PRIORITY.virtualDocument\n\t\t);\n\t\twindow.addEventListener('resize', this.handleResize, { passive: true });\n\t\t// Panel content is moved into the CSS3D renderer after enhancement. Listen\n\t\t// on the stable stage container so anchors and focus keep working there too.\n\t\tthis.container.addEventListener('click', this.handleAnchorClick);\n\t\tthis.container.addEventListener('focusin', this.handleFocusIn);\n\t\twindow.addEventListener('hashchange', this.handleHashChange);\n\t\twindow.addEventListener('popstate', this.handlePopState);\n\t\twindow.addEventListener('wheel', this.handleUserInput, { passive: true });\n\t\twindow.addEventListener('touchstart', this.handleUserInput, { passive: true });\n\t\twindow.addEventListener('pointerdown', this.handleUserInput, { passive: true });\n\t\twindow.addEventListener('keydown', this.handleScrollInterruptionKey);\n\n\t\tif ('ResizeObserver' in window) {\n\t\t\tthis.resizeObserver = new ResizeObserver(this.scheduleMeasurement);\n\t\t\tthis.resizeObserver.observe(this.content);\n\t\t}\n\n\t\tvoid document.fonts?.ready.then(() => this.scheduleMeasurement());\n\t\tif (window.location.hash) this.scheduleHashNavigation();\n\t}\n\n\tdestroy() {\n\t\tif (!this.started) return;\n\t\tthis.started = false;\n\t\tthis.stopScrollFrames?.();\n\t\tthis.stopScrollFrames = undefined;\n\t\twindow.removeEventListener('resize', this.handleResize);\n\t\tthis.container.removeEventListener('click', this.handleAnchorClick);\n\t\tthis.container.removeEventListener('focusin', this.handleFocusIn);\n\t\twindow.removeEventListener('hashchange', this.handleHashChange);\n\t\twindow.removeEventListener('popstate', this.handlePopState);\n\t\twindow.removeEventListener('wheel', this.handleUserInput);\n\t\twindow.removeEventListener('touchstart', this.handleUserInput);\n\t\twindow.removeEventListener('pointerdown', this.handleUserInput);\n\t\twindow.removeEventListener('keydown', this.handleScrollInterruptionKey);\n\t\tthis.resizeObserver?.disconnect();\n\t\tthis.resizeObserver = undefined;\n\t\tif (this.measureFrame) cancelAnimationFrame(this.measureFrame);\n\t\tif (this.hashFrame) cancelAnimationFrame(this.hashFrame);\n\t\tthis.historyHashUrl = undefined;\n\t\tthis.navigation = undefined;\n\t\tthis.cancelAnchorScroll();\n\t\tthis.measureFrame = 0;\n\t\tthis.hashFrame = 0;\n\t\tthis.content.style.removeProperty('transform');\n\t\tthis.spacer.style.removeProperty('height');\n\t\tthis.container.classList.remove(ACTIVE_CLASS);\n\t}\n\n\tprivate readonly handleScrollFrame = (frame: StageScrollFrame) => {\n\t\tthis.applyPosition(frame.scrollX, frame.scrollY);\n\t};\n\n\tprivate readonly handleResize = () => {\n\t\tthis.scheduleMeasurement();\n\t};\n\n\tprivate readonly handleHashChange = (event: HashChangeEvent) => {\n\t\tconst restoredByHistory = event.newURL === this.historyHashUrl;\n\t\tthis.historyHashUrl = undefined;\n\t\tif (!restoredByHistory) this.scheduleHashNavigation();\n\t};\n\tprivate readonly handlePopState = () => {\n\t\tif (!this.writeHash) return;\n\t\t// History restoration wins over a fragment, including SvelteKit shallow entries.\n\t\tif (this.hashFrame) cancelAnimationFrame(this.hashFrame);\n\t\tthis.hashFrame = 0;\n\t\tthis.historyHashUrl = window.location.href;\n\t};\n\tprivate readonly handleUserInput = () => {\n\t\tthis.cancelAnchorScroll();\n\t\tif (this.navigation) this.navigation.interrupted = true;\n\t};\n\tprivate readonly handleScrollInterruptionKey = (event: KeyboardEvent) => {\n\t\tif (SCROLL_INTERRUPTION_KEYS.has(event.key)) this.handleUserInput();\n\t};\n\n\tprivate readonly cancelAnchorScroll = () => {\n\t\tif (this.anchorScrollFrame) cancelAnimationFrame(this.anchorScrollFrame);\n\t\tthis.anchorScrollFrame = 0;\n\t\tthis.completeAnchorNavigation();\n\t};\n\n\tprivate completeAnchorNavigation() {\n\t\tconst targetId = this.anchorNavigationTargetId;\n\t\tif (!targetId) return;\n\t\tthis.anchorNavigationTargetId = undefined;\n\t\twindow.dispatchEvent(\n\t\t\tnew CustomEvent(STAGE_ANCHOR_NAVIGATION_END_EVENT, { detail: { targetId } })\n\t\t);\n\t}\n\n\tprivate readonly scheduleMeasurement = () => {\n\t\tif (!this.started || this.measureFrame) return;\n\t\tthis.measureFrame = requestAnimationFrame(() => {\n\t\t\tthis.measureFrame = 0;\n\t\t\tthis.measureDocumentHeight();\n\t\t});\n\t};\n\n\tprivate readonly handleAnchorClick = (event: MouseEvent) => {\n\t\tif (\n\t\t\tthis.navigation ||\n\t\t\tevent.defaultPrevented ||\n\t\t\tevent.button !== 0 ||\n\t\t\tevent.metaKey ||\n\t\t\tevent.ctrlKey ||\n\t\t\tevent.shiftKey ||\n\t\t\tevent.altKey\n\t\t)\n\t\t\treturn;\n\t\tconst target =\n\t\t\tevent.target instanceof Element ? event.target.closest<HTMLAnchorElement>('a[href]') : null;\n\t\tif (!target) return;\n\n\t\tconst url = new URL(target.href, window.location.href);\n\t\tif (\n\t\t\t!url.hash ||\n\t\t\turl.origin !== window.location.origin ||\n\t\t\turl.pathname !== window.location.pathname ||\n\t\t\turl.search !== window.location.search\n\t\t)\n\t\t\treturn;\n\n\t\tconst element = this.getHashTarget(url.hash);\n\t\tif (!element) return;\n\n\t\tevent.preventDefault();\n\t\tconst animated =\n\t\t\ttarget.hasAttribute('data-spatial-element-tab-id') ||\n\t\t\ttarget.hasAttribute('data-spatial-element-section-navigation');\n\t\tconst navigationHash =\n\t\t\tanimated && element.hasAttribute('data-stage-scroll-top') ? '' : url.hash;\n\t\tif (window.location.hash !== navigationHash) {\n\t\t\tif (this.writeHash) {\n\t\t\t\turl.hash = navigationHash;\n\t\t\t\tthis.writeHash(url, animated);\n\t\t\t} else if (animated) {\n\t\t\t\turl.hash = navigationHash;\n\t\t\t\thistory.replaceState(history.state, '', url);\n\t\t\t} else {\n\t\t\t\twindow.location.hash = navigationHash;\n\t\t\t}\n\t\t}\n\t\tthis.scrollElementIntoView(element, false, animated);\n\t};\n\n\tprivate scheduleHashNavigation() {\n\t\tif (!this.started || this.hashFrame || this.navigation) return;\n\t\tthis.hashFrame = requestAnimationFrame(() => {\n\t\t\tthis.hashFrame = 0;\n\t\t\tconst element = this.getHashTarget(window.location.hash);\n\t\t\tif (element) {\n\t\t\t\tthis.scrollElementIntoView(element, false, element.hasAttribute('data-spatial-element-tab-target'));\n\t\t\t}\n\t\t});\n\t}\n\n\tprivate getHashTarget(hash: string) {\n\t\tif (!hash || hash === '#') return null;\n\t\ttry {\n\t\t\treturn this.container.querySelector<HTMLElement>(\n\t\t\t\t`#${CSS.escape(decodeURIComponent(hash.slice(1)))}`\n\t\t\t);\n\t\t} catch {\n\t\t\treturn null;\n\t\t}\n\t}\n\n\tprivate readonly handleFocusIn = (event: FocusEvent) => {\n\t\tif (this.navigation || !(event.target instanceof HTMLElement)) return;\n\t\tconst rect = event.target.getBoundingClientRect();\n\t\tif (\n\t\t\trect.top >= FOCUS_VIEWPORT_MARGIN &&\n\t\t\trect.bottom <= window.innerHeight - FOCUS_VIEWPORT_MARGIN\n\t\t)\n\t\t\treturn;\n\n\t\tthis.scrollElementIntoView(event.target, true);\n\t};\n\n\tprivate getElementScrollTop(element: HTMLElement, center = false) {\n\t\tconst rect = element.getBoundingClientRect();\n\t\tconst style = window.getComputedStyle(element);\n\t\tconst scrollMarginTop = Number.parseFloat(style.scrollMarginTop) || 0;\n\t\tconst documentTop = rect.top + this.scrollY;\n\t\treturn Math.max(\n\t\t\telement.hasAttribute('data-stage-scroll-top')\n\t\t\t\t? 0\n\t\t\t\t: center\n\t\t\t\t\t? documentTop - (window.innerHeight - rect.height) * 0.5\n\t\t\t\t\t: documentTop - scrollMarginTop,\n\t\t\t0\n\t\t);\n\t}\n\n\tprivate scrollElementIntoView(element: HTMLElement, center = false, animated = false) {\n\t\tconst targetY = this.getElementScrollTop(element, center);\n\n\t\tthis.cancelAnchorScroll();\n\t\tif (animated) {\n\t\t\tthis.anchorNavigationTargetId = element.id;\n\t\t\twindow.dispatchEvent(\n\t\t\t\tnew CustomEvent(STAGE_ANCHOR_NAVIGATION_EVENT, {\n\t\t\t\t\tdetail: { targetId: element.id }\n\t\t\t\t})\n\t\t\t);\n\t\t}\n\t\tif (!animated || window.matchMedia('(prefers-reduced-motion: reduce)').matches) {\n\t\t\tmarkStageScrollInput(animated ? 'navigation' : 'programmatic');\n\t\t\twindow.scrollTo({ top: targetY, behavior: 'instant' });\n\t\t\tthis.completeAnchorNavigation();\n\t\t\treturn;\n\t\t}\n\n\t\tconst startY = this.scrollY;\n\t\tconst distance = targetY - startY;\n\t\tif (Math.abs(distance) < 0.5) {\n\t\t\tmarkStageScrollInput('navigation');\n\t\t\twindow.scrollTo({ top: targetY, behavior: 'instant' });\n\t\t\tthis.completeAnchorNavigation();\n\t\t\treturn;\n\t\t}\n\n\t\tlet startTime: number | undefined;\n\t\tconst animate = (time: number) => {\n\t\t\tif (!this.started) return;\n\t\t\tstartTime ??= time;\n\t\t\tconst progress = Math.min((time - startTime) / STAGE_ANCHOR_SCROLL_DURATION_MS, 1);\n\t\t\tconst scrollTop = startY + distance * easeStageAnchorScroll(progress);\n\t\t\tmarkStageScrollInput('navigation');\n\t\t\twindow.scrollTo({ top: progress === 1 ? targetY : scrollTop, behavior: 'instant' });\n\n\t\t\tif (progress < 1) {\n\t\t\t\tthis.anchorScrollFrame = requestAnimationFrame(animate);\n\t\t\t} else {\n\t\t\t\tthis.anchorScrollFrame = 0;\n\t\t\t\tthis.completeAnchorNavigation();\n\t\t\t}\n\t\t};\n\n\t\tthis.anchorScrollFrame = requestAnimationFrame(animate);\n\t}\n\n\tprivate applyPosition(scrollX: number, scrollY: number) {\n\t\tthis.scrollY = scrollY;\n\t\tthis.content.style.transform = `translate3d(${-scrollX}px, ${-scrollY}px, 0)`;\n\t}\n\n\tprivate measureDocumentHeight() {\n\t\tconst rect = this.content.getBoundingClientRect();\n\t\tconst height = Math.max(this.content.scrollHeight, rect.height, window.innerHeight);\n\t\tthis.spacer.style.height = `${Math.ceil(height)}px`;\n\t}\n}\n"]}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export declare const MODEL_INPUT_EVENT = "stage:model-input";
|
|
2
|
+
export interface ModelInputState {
|
|
3
|
+
hovered: boolean;
|
|
4
|
+
active: boolean;
|
|
5
|
+
}
|
|
6
|
+
export interface InteractionGuidanceState {
|
|
7
|
+
interacted: boolean;
|
|
8
|
+
}
|
|
9
|
+
/** One learning state per browser tab, shared across products and stage remounts. */
|
|
10
|
+
export declare class InteractionGuidance {
|
|
11
|
+
private readonly storage?;
|
|
12
|
+
private state;
|
|
13
|
+
private readonly listeners;
|
|
14
|
+
constructor(storage?: Pick<Storage, "getItem" | "setItem"> | undefined);
|
|
15
|
+
get snapshot(): Readonly<InteractionGuidanceState>;
|
|
16
|
+
interact(): void;
|
|
17
|
+
subscribe(listener: (state: Readonly<InteractionGuidanceState>) => void): () => void;
|
|
18
|
+
private update;
|
|
19
|
+
}
|
|
20
|
+
/** Lazy browser access keeps server rendering isolated between requests. */
|
|
21
|
+
export declare function getInteractionGuidance(target?: (Window & typeof globalThis) | undefined): InteractionGuidance;
|
|
22
|
+
//# sourceMappingURL=interactionGuidance.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"interactionGuidance.d.ts","sourceRoot":"","sources":["../../src/stage/interactionGuidance.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,iBAAiB,sBAAsB,CAAC;AACrD,MAAM,WAAW,eAAe;IAAG,OAAO,EAAE,OAAO,CAAC;IAAC,MAAM,EAAE,OAAO,CAAA;CAAE;AACtE,MAAM,WAAW,wBAAwB;IAAG,UAAU,EAAE,OAAO,CAAA;CAAE;AAGjE,qFAAqF;AACrF,qBAAa,mBAAmB;IAGnB,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC;IAFrC,OAAO,CAAC,KAAK,CAAmD;IAChE,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAkE;gBAC/D,OAAO,CAAC,EAAE,IAAI,CAAC,OAAO,EAAE,SAAS,GAAG,SAAS,CAAC,YAAA;IAM3E,IAAI,QAAQ,IAAI,QAAQ,CAAC,wBAAwB,CAAC,CAAuB;IACzE,QAAQ;IAGR,SAAS,CAAC,QAAQ,EAAE,CAAC,KAAK,EAAE,QAAQ,CAAC,wBAAwB,CAAC,KAAK,IAAI;IAKvE,OAAO,CAAC,MAAM;CAKd;AAGD,4EAA4E;AAC5E,wBAAgB,sBAAsB,CAAC,MAAM,2CAAqD,uBAUjG"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
export const MODEL_INPUT_EVENT = 'stage:model-input';
|
|
2
|
+
const STORAGE_KEY = 'spatial-elements:interaction-guidance:v1';
|
|
3
|
+
/** One learning state per browser tab, shared across products and stage remounts. */
|
|
4
|
+
export class InteractionGuidance {
|
|
5
|
+
storage;
|
|
6
|
+
state = { interacted: false };
|
|
7
|
+
listeners = new Set();
|
|
8
|
+
constructor(storage) {
|
|
9
|
+
this.storage = storage;
|
|
10
|
+
try {
|
|
11
|
+
const saved = JSON.parse(storage?.getItem(STORAGE_KEY) ?? '{}');
|
|
12
|
+
this.state = { interacted: saved.interacted === true };
|
|
13
|
+
}
|
|
14
|
+
catch { /* Storage is optional, including in private browsing. */ }
|
|
15
|
+
}
|
|
16
|
+
get snapshot() { return this.state; }
|
|
17
|
+
interact() {
|
|
18
|
+
if (!this.state.interacted)
|
|
19
|
+
this.update({ interacted: true });
|
|
20
|
+
}
|
|
21
|
+
subscribe(listener) {
|
|
22
|
+
this.listeners.add(listener);
|
|
23
|
+
listener(this.state);
|
|
24
|
+
return () => { this.listeners.delete(listener); };
|
|
25
|
+
}
|
|
26
|
+
update(state) {
|
|
27
|
+
this.state = state;
|
|
28
|
+
try {
|
|
29
|
+
this.storage?.setItem(STORAGE_KEY, JSON.stringify(state));
|
|
30
|
+
}
|
|
31
|
+
catch { /* In-memory fallback. */ }
|
|
32
|
+
for (const listener of this.listeners)
|
|
33
|
+
listener(state);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
const sessions = new WeakMap();
|
|
37
|
+
/** Lazy browser access keeps server rendering isolated between requests. */
|
|
38
|
+
export function getInteractionGuidance(target = typeof window === 'undefined' ? undefined : window) {
|
|
39
|
+
if (!target)
|
|
40
|
+
return new InteractionGuidance();
|
|
41
|
+
let session = sessions.get(target);
|
|
42
|
+
if (!session) {
|
|
43
|
+
let storage;
|
|
44
|
+
try {
|
|
45
|
+
storage = target.sessionStorage;
|
|
46
|
+
}
|
|
47
|
+
catch { /* Sandboxed/private context. */ }
|
|
48
|
+
session = new InteractionGuidance(storage);
|
|
49
|
+
sessions.set(target, session);
|
|
50
|
+
}
|
|
51
|
+
return session;
|
|
52
|
+
}
|
|
53
|
+
//# sourceMappingURL=interactionGuidance.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"interactionGuidance.js","sourceRoot":"","sources":["../../src/stage/interactionGuidance.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,iBAAiB,GAAG,mBAAmB,CAAC;AAGrD,MAAM,WAAW,GAAG,0CAA0C,CAAC;AAE/D,qFAAqF;AACrF,MAAM,OAAO,mBAAmB;IAGF;IAFrB,KAAK,GAA6B,EAAE,UAAU,EAAE,KAAK,EAAE,CAAC;IAC/C,SAAS,GAAG,IAAI,GAAG,EAAuD,CAAC;IAC5F,YAA6B,OAA8C;QAA9C,YAAO,GAAP,OAAO,CAAuC;QAC1E,IAAI,CAAC;YACJ,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,OAAO,CAAC,WAAW,CAAC,IAAI,IAAI,CAAC,CAAC;YAChE,IAAI,CAAC,KAAK,GAAG,EAAE,UAAU,EAAE,KAAK,CAAC,UAAU,KAAK,IAAI,EAAE,CAAC;QACxD,CAAC;QAAC,MAAM,CAAC,CAAC,yDAAyD,CAAC,CAAC;IACtE,CAAC;IACD,IAAI,QAAQ,KAAyC,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;IACzE,QAAQ;QACP,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,UAAU;YAAE,IAAI,CAAC,MAAM,CAAC,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC,CAAC;IAC/D,CAAC;IACD,SAAS,CAAC,QAA6D;QACtE,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;QAC7B,QAAQ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}\nexport interface InteractionGuidanceState { interacted: boolean }\nconst STORAGE_KEY = 'spatial-elements:interaction-guidance:v1';\n\n/** One learning state per browser tab, shared across products and stage remounts. */\nexport class InteractionGuidance {\n\tprivate state: InteractionGuidanceState = { interacted: false };\n\tprivate readonly listeners = new Set<(state: Readonly<InteractionGuidanceState>) => void>();\n\tconstructor(private readonly storage?: Pick<Storage, 'getItem' | 'setItem'>) {\n\t\ttry {\n\t\t\tconst saved = JSON.parse(storage?.getItem(STORAGE_KEY) ?? '{}');\n\t\t\tthis.state = { interacted: saved.interacted === true };\n\t\t} catch { /* Storage is optional, including in private browsing. */ }\n\t}\n\tget snapshot(): Readonly<InteractionGuidanceState> { return this.state; }\n\tinteract() {\n\t\tif (!this.state.interacted) this.update({ interacted: true });\n\t}\n\tsubscribe(listener: (state: Readonly<InteractionGuidanceState>) => void) {\n\t\tthis.listeners.add(listener);\n\t\tlistener(this.state);\n\t\treturn () => { this.listeners.delete(listener); };\n\t}\n\tprivate update(state: InteractionGuidanceState) {\n\t\tthis.state = state;\n\t\ttry { this.storage?.setItem(STORAGE_KEY, JSON.stringify(state)); } catch { /* In-memory fallback. */ }\n\t\tfor (const listener of this.listeners) listener(state);\n\t}\n}\n\nconst sessions = new WeakMap<Window, InteractionGuidance>();\n/** Lazy browser access keeps server rendering isolated between requests. */\nexport function getInteractionGuidance(target = typeof window === 'undefined' ? undefined : window) {\n\tif (!target) return new InteractionGuidance();\n\tlet session = sessions.get(target);\n\tif (!session) {\n\t\tlet storage: Storage | undefined;\n\t\ttry { storage = target.sessionStorage; } catch { /* Sandboxed/private context. */ }\n\t\tsession = new InteractionGuidance(storage);\n\t\tsessions.set(target, session);\n\t}\n\treturn session;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MinimapGeometry.d.ts","sourceRoot":"","sources":["../../../src/stage/minimap/MinimapGeometry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,cAAc,CAAC;AAGtC,sEAAsE;AACtE,MAAM,WAAW,kBAAkB;IAClC,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;CACnB;
|
|
1
|
+
{"version":3,"file":"MinimapGeometry.d.ts","sourceRoot":"","sources":["../../../src/stage/minimap/MinimapGeometry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,cAAc,CAAC;AAGtC,sEAAsE;AACtE,MAAM,WAAW,kBAAkB;IAClC,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;CACnB;AAgBD;;;GAGG;AACH,wBAAgB,6BAA6B,CAC5C,UAAU,EAAE,MAAM,EAClB,WAAW,EAAE,MAAM,EACnB,IAAI,EAAE,MAAM,EACZ,GAAG,EAAE,MAAM,EACX,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,EACd,WAAW,EAAE,MAAM,GACjB,kBAAkB,CAkBpB;AAED,uEAAuE;AACvE,wBAAgB,0BAA0B,CACzC,UAAU,EAAE,MAAM,EAClB,WAAW,EAAE,MAAM,EACnB,WAAW,EAAE,MAAM,oFAKnB;AAED,oFAAoF;AACpF,wBAAgB,0BAA0B,CACzC,QAAQ,EAAE,KAAK,CAAC,cAAc,EAC9B,UAAU,EAAE,MAAM,EAClB,WAAW,EAAE,MAAM,EACnB,WAAW,EAAE,MAAM,QAuCnB;AAED,qFAAqF;AACrF,wBAAgB,iCAAiC,CAChD,UAAU,EAAE,MAAM,EAClB,WAAW,EAAE,MAAM,EACnB,IAAI,EAAE,MAAM,EACZ,GAAG,EAAE,MAAM,EACX,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,kBAAkB,EACzB,SAAS,EAAE,MAAM,oFAejB;AAED;;;;;;;GAOG;AACH,wBAAgB,iCAAiC,CAChD,QAAQ,EAAE,KAAK,CAAC,cAAc,EAC9B,UAAU,EAAE,MAAM,EAClB,WAAW,EAAE,MAAM,EACnB,IAAI,EAAE,MAAM,EACZ,GAAG,EAAE,MAAM,EACX,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,kBAAkB,EACzB,SAAS,EAAE,MAAM,QA0FjB;AAED,0EAA0E;AAC1E,wBAAgB,mBAAmB,CAClC,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,cAAc,EAAE,KAAK,CAAC,QAAQ,CAAC,EACtD,QAAQ,EAAE,KAAK,CAAC,cAAc,QAI9B"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as THREE from 'three/webgpu';
|
|
2
2
|
import { smoothstep } from '../stageMath.js';
|
|
3
|
+
const viewportRingStates = new WeakMap();
|
|
3
4
|
/**
|
|
4
5
|
* Blends viewport corners into the panel corners as the cutout reaches an edge.
|
|
5
6
|
* Sharing this result keeps the cutout and its border visually synchronized.
|
|
@@ -83,6 +84,22 @@ export function createMinimapViewportRingGeometry(panelWidth, panelHeight, left,
|
|
|
83
84
|
* explicit quad topology, so no triangle can ever cross the viewport.
|
|
84
85
|
*/
|
|
85
86
|
export function updateMinimapViewportRingGeometry(geometry, panelWidth, panelHeight, left, top, width, height, radii, lineWidth) {
|
|
87
|
+
const previous = viewportRingStates.get(geometry);
|
|
88
|
+
if (previous &&
|
|
89
|
+
previous.panelWidth === panelWidth &&
|
|
90
|
+
previous.panelHeight === panelHeight &&
|
|
91
|
+
previous.left === left &&
|
|
92
|
+
previous.top === top &&
|
|
93
|
+
previous.width === width &&
|
|
94
|
+
previous.height === height &&
|
|
95
|
+
previous.lineWidth === lineWidth &&
|
|
96
|
+
previous.topLeft === radii.topLeft &&
|
|
97
|
+
previous.topRight === radii.topRight &&
|
|
98
|
+
previous.bottomRight === radii.bottomRight &&
|
|
99
|
+
previous.bottomLeft === radii.bottomLeft &&
|
|
100
|
+
previous.position === geometry.getAttribute('position') &&
|
|
101
|
+
previous.index === geometry.getIndex())
|
|
102
|
+
return;
|
|
86
103
|
const panelW = Math.max(panelWidth, 0.001);
|
|
87
104
|
const panelH = Math.max(panelHeight, 0.001);
|
|
88
105
|
const thickness = THREE.MathUtils.clamp(lineWidth, 0.5, Math.min(width, height) * 0.45);
|
|
@@ -131,6 +148,18 @@ export function updateMinimapViewportRingGeometry(geometry, panelWidth, panelHei
|
|
|
131
148
|
position.needsUpdate = true;
|
|
132
149
|
geometry.computeBoundingBox();
|
|
133
150
|
geometry.computeBoundingSphere();
|
|
151
|
+
viewportRingStates.set(geometry, {
|
|
152
|
+
panelWidth,
|
|
153
|
+
panelHeight,
|
|
154
|
+
left,
|
|
155
|
+
top,
|
|
156
|
+
width,
|
|
157
|
+
height,
|
|
158
|
+
lineWidth,
|
|
159
|
+
...radii,
|
|
160
|
+
position: position,
|
|
161
|
+
index: geometry.getIndex()
|
|
162
|
+
});
|
|
134
163
|
}
|
|
135
164
|
/** Replaces a mesh geometry while releasing the previous GPU resource. */
|
|
136
165
|
export function replaceMeshGeometry(mesh, geometry) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MinimapGeometry.js","sourceRoot":"","sources":["../../../src/stage/minimap/MinimapGeometry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAU7C;;;GAGG;AACH,MAAM,UAAU,6BAA6B,CAC5C,UAAkB,EAClB,WAAmB,EACnB,IAAY,EACZ,GAAW,EACX,KAAa,EACb,MAAc,EACd,MAAc,EACd,WAAmB;IAEnB,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,UAAU,GAAG,IAAI,GAAG,KAAK,EAAE,CAAC,CAAC,CAAC;IACrD,MAAM,MAAM,GAAG,IAAI,CAAC,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AE,GAAG,GAAG,EACb,KAAK,CACL,CAAC;IAEF,OAAO,MAAM,CAAC;AACf,CAAC","sourcesContent":["import * as THREE from 'three/webgpu';\nimport { smoothstep } from '../stageMath.js';\n\n/** Per-corner radii used by the minimap viewport and panel shapes. */\nexport interface MinimapCornerRadii {\n\ttopLeft: number;\n\ttopRight: number;\n\tbottomRight: number;\n\tbottomLeft: number;\n}\n\n/**\n * Blends viewport corners into the panel corners as the cutout reaches an edge.\n * Sharing this result keeps the cutout and its border visually synchronized.\n */\nexport function getMinimapViewportCornerRadii(\n\tpanelWidth: number,\n\tpanelHeight: number,\n\tleft: number,\n\ttop: number,\n\twidth: number,\n\theight: number,\n\tradius: number,\n\tpanelRadius: number\n): MinimapCornerRadii {\n\tconst right = Math.max(panelWidth - left - width, 0);\n\tconst bottom = Math.max(panelHeight - top - height, 0);\n\tconst limit = Math.max(Math.min(width, height) * 0.5, 0);\n\tconst innerRadius = THREE.MathUtils.clamp(radius, 0, limit);\n\tconst edgeRadius = THREE.MathUtils.clamp(panelRadius, 0, limit);\n\tconst edgeBlendDistance = Math.max(edgeRadius * 1.45, 1);\n\tconst cornerRadius = (horizontalDistance: number, verticalDistance: number) => {\n\t\tconst distance = Math.max(Math.max(horizontalDistance, 0), Math.max(verticalDistance, 0));\n\t\tconst proximity = 1 - THREE.MathUtils.clamp(distance / edgeBlendDistance, 0, 1);\n\t\treturn THREE.MathUtils.lerp(innerRadius, edgeRadius, smoothstep(0, 1, proximity));\n\t};\n\treturn {\n\t\ttopLeft: cornerRadius(left, top),\n\t\ttopRight: cornerRadius(right, top),\n\t\tbottomRight: cornerRadius(right, bottom),\n\t\tbottomLeft: cornerRadius(left, bottom)\n\t};\n}\n\n/** Creates the rounded panel surface used by the minimap composite. */\nexport function createMinimapPanelGeometry(\n\tpanelWidth: number,\n\tpanelHeight: number,\n\tpanelRadius: number\n) {\n\tconst geometry = new THREE.BufferGeometry();\n\tupdateMinimapPanelGeometry(geometry, panelWidth, panelHeight, panelRadius);\n\treturn geometry;\n}\n\n/** Fixed convex fan with the original quadratic corner profile; resize in-place. */\nexport function updateMinimapPanelGeometry(\n\tgeometry: THREE.BufferGeometry,\n\tpanelWidth: number,\n\tpanelHeight: number,\n\tpanelRadius: number\n) {\n\tconst panelW = Math.max(panelWidth, 0.001);\n\tconst panelH = Math.max(panelHeight, 0.001);\n\tconst radius = THREE.MathUtils.clamp(panelRadius, 0, Math.min(panelW, panelH) * 0.5);\n\tconst count = 44;\n\tlet position = geometry.getAttribute('position');\n\tlet uv = geometry.getAttribute('uv');\n\tif (!position) {\n\t\tposition = new THREE.Float32BufferAttribute((count + 1) * 3, 3).setUsage(\n\t\t\tTHREE.DynamicDrawUsage\n\t\t);\n\t\tuv = new THREE.Float32BufferAttribute((count + 1) * 2, 2).setUsage(THREE.DynamicDrawUsage);\n\t\tgeometry.setAttribute('position', position);\n\t\tgeometry.setAttribute('uv', uv);\n\t\tconst indices: number[] = [];\n\t\tfor (let i = 0; i < count; i++) indices.push(0, i + 1, ((i + 1) % count) + 1);\n\t\tgeometry.setIndex(indices);\n\t}\n\tposition.setXYZ(0, 0, 0, 0);\n\tuv.setXY(0, 0.5, 0.5);\n\tfor (let corner = 0; corner < 4; corner++) {\n\t\tconst xSign = corner < 2 ? 1 : -1;\n\t\tconst ySign = corner === 0 || corner === 3 ? -1 : 1;\n\t\tfor (let step = 0; step <= 10; step++) {\n\t\t\tconst t = step / 10;\n\t\t\tconst a = radius * (1 - t) ** 2;\n\t\t\tconst b = radius * t ** 2;\n\t\t\tconst x = xSign * (panelW * 0.5 - (corner % 2 === 0 ? a : b));\n\t\t\tconst y = ySign * (panelH * 0.5 - (corner % 2 === 0 ? b : a));\n\t\t\tconst index = 1 + corner * 11 + step;\n\t\t\tposition.setXYZ(index, x, y, 0);\n\t\t\tuv.setXY(index, x / panelW + 0.5, 0.5 - y / panelH);\n\t\t}\n\t}\n\tposition.needsUpdate = true;\n\tuv.needsUpdate = true;\n\tgeometry.computeBoundingBox();\n\tgeometry.computeBoundingSphere();\n}\n\n/** Creates the rounded border that marks the main camera viewport on the minimap. */\nexport function createMinimapViewportRingGeometry(\n\tpanelWidth: number,\n\tpanelHeight: number,\n\tleft: number,\n\ttop: number,\n\twidth: number,\n\theight: number,\n\tradii: MinimapCornerRadii,\n\tlineWidth: number\n) {\n\tconst geometry = new THREE.BufferGeometry();\n\tupdateMinimapViewportRingGeometry(\n\t\tgeometry,\n\t\tpanelWidth,\n\t\tpanelHeight,\n\t\tleft,\n\t\ttop,\n\t\twidth,\n\t\theight,\n\t\tradii,\n\t\tlineWidth\n\t);\n\treturn geometry;\n}\n\n/**\n * Updates the viewport border without replacing its GPU buffers.\n *\n * `ShapeGeometry` triangulates a rounded rectangle with a hole through Earcut.\n * During animated size/radius transitions that topology can briefly contain a\n * diagonal triangle across the hole. A paired outer/inner contour has fixed,\n * explicit quad topology, so no triangle can ever cross the viewport.\n */\nexport function updateMinimapViewportRingGeometry(\n\tgeometry: THREE.BufferGeometry,\n\tpanelWidth: number,\n\tpanelHeight: number,\n\tleft: number,\n\ttop: number,\n\twidth: number,\n\theight: number,\n\tradii: MinimapCornerRadii,\n\tlineWidth: number\n) {\n\tconst panelW = Math.max(panelWidth, 0.001);\n\tconst panelH = Math.max(panelHeight, 0.001);\n\tconst thickness = THREE.MathUtils.clamp(lineWidth, 0.5, Math.min(width, height) * 0.45);\n\tconst outerX = left - panelW * 0.5;\n\tconst outerY = panelH * 0.5 - top - height;\n\tconst innerX = outerX + thickness;\n\tconst innerY = outerY + thickness;\n\tconst innerWidth = Math.max(width - thickness * 2, 0.001);\n\tconst innerHeight = Math.max(height - thickness * 2, 0.001);\n\tconst radiusLimit = Math.max(Math.min(width, height) * 0.5, 0);\n\tconst outerRadii = {\n\t\ttopLeft: THREE.MathUtils.clamp(radii.topLeft, 0, radiusLimit),\n\t\ttopRight: THREE.MathUtils.clamp(radii.topRight, 0, radiusLimit),\n\t\tbottomRight: THREE.MathUtils.clamp(radii.bottomRight, 0, radiusLimit),\n\t\tbottomLeft: THREE.MathUtils.clamp(radii.bottomLeft, 0, radiusLimit)\n\t};\n\tconst innerRadii = {\n\t\ttopLeft: Math.max(outerRadii.topLeft - thickness, 0),\n\t\ttopRight: Math.max(outerRadii.topRight - thickness, 0),\n\t\tbottomRight: Math.max(outerRadii.bottomRight - thickness, 0),\n\t\tbottomLeft: Math.max(outerRadii.bottomLeft - thickness, 0)\n\t};\n\tconst outer = createRoundedRectContour(outerX, outerY, width, height, outerRadii, 10);\n\tconst inner = createRoundedRectContour(innerX, innerY, innerWidth, innerHeight, innerRadii, 10);\n\tconst vertexCount = outer.length * 2;\n\tlet position = geometry.getAttribute('position');\n\tif (!(position instanceof THREE.BufferAttribute) || position.count !== vertexCount) {\n\t\tposition = new THREE.Float32BufferAttribute(vertexCount * 3, 3);\n\t\tposition.setUsage(THREE.DynamicDrawUsage);\n\t\tgeometry.setAttribute('position', position);\n\n\t\tconst indices: number[] = [];\n\t\tfor (let index = 0; index < outer.length; index += 1) {\n\t\t\tconst next = (index + 1) % outer.length;\n\t\t\tconst outerIndex = index * 2;\n\t\t\tconst innerIndex = outerIndex + 1;\n\t\t\tconst nextOuterIndex = next * 2;\n\t\t\tconst nextInnerIndex = nextOuterIndex + 1;\n\t\t\tindices.push(\n\t\t\t\touterIndex,\n\t\t\t\tnextOuterIndex,\n\t\t\t\tnextInnerIndex,\n\t\t\t\touterIndex,\n\t\t\t\tnextInnerIndex,\n\t\t\t\tinnerIndex\n\t\t\t);\n\t\t}\n\t\tgeometry.setIndex(indices);\n\t}\n\n\tfor (let index = 0; index < outer.length; index += 1) {\n\t\tposition.setXYZ(index * 2, outer[index].x, outer[index].y, 0);\n\t\tposition.setXYZ(index * 2 + 1, inner[index].x, inner[index].y, 0);\n\t}\n\tposition.needsUpdate = true;\n\tgeometry.computeBoundingBox();\n\tgeometry.computeBoundingSphere();\n}\n\n/** Replaces a mesh geometry while releasing the previous GPU resource. */\nexport function replaceMeshGeometry(\n\tmesh: THREE.Mesh<THREE.BufferGeometry, THREE.Material>,\n\tgeometry: THREE.BufferGeometry\n) {\n\tmesh.geometry.dispose();\n\tmesh.geometry = geometry;\n}\n\nfunction createRoundedRectContour(\n\tx: number,\n\ty: number,\n\twidth: number,\n\theight: number,\n\tradii: MinimapCornerRadii,\n\tsegmentsPerCorner: number\n) {\n\tconst right = x + width;\n\tconst top = y + height;\n\tconst segments = Math.max(Math.floor(segmentsPerCorner), 1);\n\tconst points: THREE.Vector2[] = [];\n\tconst addArc = (\n\t\tcenterX: number,\n\t\tcenterY: number,\n\t\tradius: number,\n\t\tstartAngle: number,\n\t\tendAngle: number,\n\t\tincludeEnd = true\n\t) => {\n\t\tconst lastStep = includeEnd ? segments : segments - 1;\n\t\tfor (let step = 1; step <= lastStep; step += 1) {\n\t\t\tconst angle = THREE.MathUtils.lerp(startAngle, endAngle, step / segments);\n\t\t\tpoints.push(\n\t\t\t\tnew THREE.Vector2(centerX + Math.cos(angle) * radius, centerY + Math.sin(angle) * radius)\n\t\t\t);\n\t\t}\n\t};\n\n\tpoints.push(new THREE.Vector2(x + radii.bottomLeft, y));\n\tpoints.push(new THREE.Vector2(right - radii.bottomRight, y));\n\taddArc(right - radii.bottomRight, y + radii.bottomRight, radii.bottomRight, -Math.PI * 0.5, 0);\n\tpoints.push(new THREE.Vector2(right, top - radii.topRight));\n\taddArc(right - radii.topRight, top - radii.topRight, radii.topRight, 0, Math.PI * 0.5);\n\tpoints.push(new THREE.Vector2(x + radii.topLeft, top));\n\taddArc(x + radii.topLeft, top - radii.topLeft, radii.topLeft, Math.PI * 0.5, Math.PI);\n\tpoints.push(new THREE.Vector2(x, y + radii.bottomLeft));\n\taddArc(\n\t\tx + radii.bottomLeft,\n\t\ty + radii.bottomLeft,\n\t\tradii.bottomLeft,\n\t\tMath.PI,\n\t\tMath.PI * 1.5,\n\t\tfalse\n\t);\n\n\treturn points;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"MinimapGeometry.js","sourceRoot":"","sources":["../../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C;IACxD,MAAM,CACL,CAAC,GAAG,KAAK,CAAC,UAAU,EACpB,CAAC,GAAG,KAAK,CAAC,UAAU,EACpB,KAAK,CAAC,UAAU,EAChB,IAAI,CAAC,EAAE,EACP,IAAI,CAAC,EAAE,GAAG,GAAG,EACb,KAAK,CACL,CAAC;IAEF,OAAO,MAAM,CAAC;AACf,CAAC","sourcesContent":["import * as THREE from 'three/webgpu';\nimport { smoothstep } from '../stageMath.js';\n\n/** Per-corner radii used by the minimap viewport and panel shapes. */\nexport interface MinimapCornerRadii {\n\ttopLeft: number;\n\ttopRight: number;\n\tbottomRight: number;\n\tbottomLeft: number;\n}\n\ninterface ViewportRingState extends MinimapCornerRadii {\n\tpanelWidth: number;\n\tpanelHeight: number;\n\tleft: number;\n\ttop: number;\n\twidth: number;\n\theight: number;\n\tlineWidth: number;\n\tposition: THREE.BufferAttribute;\n\tindex: THREE.BufferAttribute | null;\n}\n\nconst viewportRingStates = new WeakMap<THREE.BufferGeometry, ViewportRingState>();\n\n/**\n * Blends viewport corners into the panel corners as the cutout reaches an edge.\n * Sharing this result keeps the cutout and its border visually synchronized.\n */\nexport function getMinimapViewportCornerRadii(\n\tpanelWidth: number,\n\tpanelHeight: number,\n\tleft: number,\n\ttop: number,\n\twidth: number,\n\theight: number,\n\tradius: number,\n\tpanelRadius: number\n): MinimapCornerRadii {\n\tconst right = Math.max(panelWidth - left - width, 0);\n\tconst bottom = Math.max(panelHeight - top - height, 0);\n\tconst limit = Math.max(Math.min(width, height) * 0.5, 0);\n\tconst innerRadius = THREE.MathUtils.clamp(radius, 0, limit);\n\tconst edgeRadius = THREE.MathUtils.clamp(panelRadius, 0, limit);\n\tconst edgeBlendDistance = Math.max(edgeRadius * 1.45, 1);\n\tconst cornerRadius = (horizontalDistance: number, verticalDistance: number) => {\n\t\tconst distance = Math.max(Math.max(horizontalDistance, 0), Math.max(verticalDistance, 0));\n\t\tconst proximity = 1 - THREE.MathUtils.clamp(distance / edgeBlendDistance, 0, 1);\n\t\treturn THREE.MathUtils.lerp(innerRadius, edgeRadius, smoothstep(0, 1, proximity));\n\t};\n\treturn {\n\t\ttopLeft: cornerRadius(left, top),\n\t\ttopRight: cornerRadius(right, top),\n\t\tbottomRight: cornerRadius(right, bottom),\n\t\tbottomLeft: cornerRadius(left, bottom)\n\t};\n}\n\n/** Creates the rounded panel surface used by the minimap composite. */\nexport function createMinimapPanelGeometry(\n\tpanelWidth: number,\n\tpanelHeight: number,\n\tpanelRadius: number\n) {\n\tconst geometry = new THREE.BufferGeometry();\n\tupdateMinimapPanelGeometry(geometry, panelWidth, panelHeight, panelRadius);\n\treturn geometry;\n}\n\n/** Fixed convex fan with the original quadratic corner profile; resize in-place. */\nexport function updateMinimapPanelGeometry(\n\tgeometry: THREE.BufferGeometry,\n\tpanelWidth: number,\n\tpanelHeight: number,\n\tpanelRadius: number\n) {\n\tconst panelW = Math.max(panelWidth, 0.001);\n\tconst panelH = Math.max(panelHeight, 0.001);\n\tconst radius = THREE.MathUtils.clamp(panelRadius, 0, Math.min(panelW, panelH) * 0.5);\n\tconst count = 44;\n\tlet position = geometry.getAttribute('position');\n\tlet uv = geometry.getAttribute('uv');\n\tif (!position) {\n\t\tposition = new THREE.Float32BufferAttribute((count + 1) * 3, 3).setUsage(\n\t\t\tTHREE.DynamicDrawUsage\n\t\t);\n\t\tuv = new THREE.Float32BufferAttribute((count + 1) * 2, 2).setUsage(THREE.DynamicDrawUsage);\n\t\tgeometry.setAttribute('position', position);\n\t\tgeometry.setAttribute('uv', uv);\n\t\tconst indices: number[] = [];\n\t\tfor (let i = 0; i < count; i++) indices.push(0, i + 1, ((i + 1) % count) + 1);\n\t\tgeometry.setIndex(indices);\n\t}\n\tposition.setXYZ(0, 0, 0, 0);\n\tuv.setXY(0, 0.5, 0.5);\n\tfor (let corner = 0; corner < 4; corner++) {\n\t\tconst xSign = corner < 2 ? 1 : -1;\n\t\tconst ySign = corner === 0 || corner === 3 ? -1 : 1;\n\t\tfor (let step = 0; step <= 10; step++) {\n\t\t\tconst t = step / 10;\n\t\t\tconst a = radius * (1 - t) ** 2;\n\t\t\tconst b = radius * t ** 2;\n\t\t\tconst x = xSign * (panelW * 0.5 - (corner % 2 === 0 ? a : b));\n\t\t\tconst y = ySign * (panelH * 0.5 - (corner % 2 === 0 ? b : a));\n\t\t\tconst index = 1 + corner * 11 + step;\n\t\t\tposition.setXYZ(index, x, y, 0);\n\t\t\tuv.setXY(index, x / panelW + 0.5, 0.5 - y / panelH);\n\t\t}\n\t}\n\tposition.needsUpdate = true;\n\tuv.needsUpdate = true;\n\tgeometry.computeBoundingBox();\n\tgeometry.computeBoundingSphere();\n}\n\n/** Creates the rounded border that marks the main camera viewport on the minimap. */\nexport function createMinimapViewportRingGeometry(\n\tpanelWidth: number,\n\tpanelHeight: number,\n\tleft: number,\n\ttop: number,\n\twidth: number,\n\theight: number,\n\tradii: MinimapCornerRadii,\n\tlineWidth: number\n) {\n\tconst geometry = new THREE.BufferGeometry();\n\tupdateMinimapViewportRingGeometry(\n\t\tgeometry,\n\t\tpanelWidth,\n\t\tpanelHeight,\n\t\tleft,\n\t\ttop,\n\t\twidth,\n\t\theight,\n\t\tradii,\n\t\tlineWidth\n\t);\n\treturn geometry;\n}\n\n/**\n * Updates the viewport border without replacing its GPU buffers.\n *\n * `ShapeGeometry` triangulates a rounded rectangle with a hole through Earcut.\n * During animated size/radius transitions that topology can briefly contain a\n * diagonal triangle across the hole. A paired outer/inner contour has fixed,\n * explicit quad topology, so no triangle can ever cross the viewport.\n */\nexport function updateMinimapViewportRingGeometry(\n\tgeometry: THREE.BufferGeometry,\n\tpanelWidth: number,\n\tpanelHeight: number,\n\tleft: number,\n\ttop: number,\n\twidth: number,\n\theight: number,\n\tradii: MinimapCornerRadii,\n\tlineWidth: number\n) {\n\tconst previous = viewportRingStates.get(geometry);\n\tif (\n\t\tprevious &&\n\t\tprevious.panelWidth === panelWidth &&\n\t\tprevious.panelHeight === panelHeight &&\n\t\tprevious.left === left &&\n\t\tprevious.top === top &&\n\t\tprevious.width === width &&\n\t\tprevious.height === height &&\n\t\tprevious.lineWidth === lineWidth &&\n\t\tprevious.topLeft === radii.topLeft &&\n\t\tprevious.topRight === radii.topRight &&\n\t\tprevious.bottomRight === radii.bottomRight &&\n\t\tprevious.bottomLeft === radii.bottomLeft &&\n\t\tprevious.position === geometry.getAttribute('position') &&\n\t\tprevious.index === geometry.getIndex()\n\t)\n\t\treturn;\n\n\tconst panelW = Math.max(panelWidth, 0.001);\n\tconst panelH = Math.max(panelHeight, 0.001);\n\tconst thickness = THREE.MathUtils.clamp(lineWidth, 0.5, Math.min(width, height) * 0.45);\n\tconst outerX = left - panelW * 0.5;\n\tconst outerY = panelH * 0.5 - top - height;\n\tconst innerX = outerX + thickness;\n\tconst innerY = outerY + thickness;\n\tconst innerWidth = Math.max(width - thickness * 2, 0.001);\n\tconst innerHeight = Math.max(height - thickness * 2, 0.001);\n\tconst radiusLimit = Math.max(Math.min(width, height) * 0.5, 0);\n\tconst outerRadii = {\n\t\ttopLeft: THREE.MathUtils.clamp(radii.topLeft, 0, radiusLimit),\n\t\ttopRight: THREE.MathUtils.clamp(radii.topRight, 0, radiusLimit),\n\t\tbottomRight: THREE.MathUtils.clamp(radii.bottomRight, 0, radiusLimit),\n\t\tbottomLeft: THREE.MathUtils.clamp(radii.bottomLeft, 0, radiusLimit)\n\t};\n\tconst innerRadii = {\n\t\ttopLeft: Math.max(outerRadii.topLeft - thickness, 0),\n\t\ttopRight: Math.max(outerRadii.topRight - thickness, 0),\n\t\tbottomRight: Math.max(outerRadii.bottomRight - thickness, 0),\n\t\tbottomLeft: Math.max(outerRadii.bottomLeft - thickness, 0)\n\t};\n\tconst outer = createRoundedRectContour(outerX, outerY, width, height, outerRadii, 10);\n\tconst inner = createRoundedRectContour(innerX, innerY, innerWidth, innerHeight, innerRadii, 10);\n\tconst vertexCount = outer.length * 2;\n\tlet position = geometry.getAttribute('position');\n\tif (!(position instanceof THREE.BufferAttribute) || position.count !== vertexCount) {\n\t\tposition = new THREE.Float32BufferAttribute(vertexCount * 3, 3);\n\t\tposition.setUsage(THREE.DynamicDrawUsage);\n\t\tgeometry.setAttribute('position', position);\n\n\t\tconst indices: number[] = [];\n\t\tfor (let index = 0; index < outer.length; index += 1) {\n\t\t\tconst next = (index + 1) % outer.length;\n\t\t\tconst outerIndex = index * 2;\n\t\t\tconst innerIndex = outerIndex + 1;\n\t\t\tconst nextOuterIndex = next * 2;\n\t\t\tconst nextInnerIndex = nextOuterIndex + 1;\n\t\t\tindices.push(\n\t\t\t\touterIndex,\n\t\t\t\tnextOuterIndex,\n\t\t\t\tnextInnerIndex,\n\t\t\t\touterIndex,\n\t\t\t\tnextInnerIndex,\n\t\t\t\tinnerIndex\n\t\t\t);\n\t\t}\n\t\tgeometry.setIndex(indices);\n\t}\n\n\tfor (let index = 0; index < outer.length; index += 1) {\n\t\tposition.setXYZ(index * 2, outer[index].x, outer[index].y, 0);\n\t\tposition.setXYZ(index * 2 + 1, inner[index].x, inner[index].y, 0);\n\t}\n\tposition.needsUpdate = true;\n\tgeometry.computeBoundingBox();\n\tgeometry.computeBoundingSphere();\n\tviewportRingStates.set(geometry, {\n\t\tpanelWidth,\n\t\tpanelHeight,\n\t\tleft,\n\t\ttop,\n\t\twidth,\n\t\theight,\n\t\tlineWidth,\n\t\t...radii,\n\t\tposition: position as THREE.BufferAttribute,\n\t\tindex: geometry.getIndex()\n\t});\n}\n\n/** Replaces a mesh geometry while releasing the previous GPU resource. */\nexport function replaceMeshGeometry(\n\tmesh: THREE.Mesh<THREE.BufferGeometry, THREE.Material>,\n\tgeometry: THREE.BufferGeometry\n) {\n\tmesh.geometry.dispose();\n\tmesh.geometry = geometry;\n}\n\nfunction createRoundedRectContour(\n\tx: number,\n\ty: number,\n\twidth: number,\n\theight: number,\n\tradii: MinimapCornerRadii,\n\tsegmentsPerCorner: number\n) {\n\tconst right = x + width;\n\tconst top = y + height;\n\tconst segments = Math.max(Math.floor(segmentsPerCorner), 1);\n\tconst points: THREE.Vector2[] = [];\n\tconst addArc = (\n\t\tcenterX: number,\n\t\tcenterY: number,\n\t\tradius: number,\n\t\tstartAngle: number,\n\t\tendAngle: number,\n\t\tincludeEnd = true\n\t) => {\n\t\tconst lastStep = includeEnd ? segments : segments - 1;\n\t\tfor (let step = 1; step <= lastStep; step += 1) {\n\t\t\tconst angle = THREE.MathUtils.lerp(startAngle, endAngle, step / segments);\n\t\t\tpoints.push(\n\t\t\t\tnew THREE.Vector2(centerX + Math.cos(angle) * radius, centerY + Math.sin(angle) * radius)\n\t\t\t);\n\t\t}\n\t};\n\n\tpoints.push(new THREE.Vector2(x + radii.bottomLeft, y));\n\tpoints.push(new THREE.Vector2(right - radii.bottomRight, y));\n\taddArc(right - radii.bottomRight, y + radii.bottomRight, radii.bottomRight, -Math.PI * 0.5, 0);\n\tpoints.push(new THREE.Vector2(right, top - radii.topRight));\n\taddArc(right - radii.topRight, top - radii.topRight, radii.topRight, 0, Math.PI * 0.5);\n\tpoints.push(new THREE.Vector2(x + radii.topLeft, top));\n\taddArc(x + radii.topLeft, top - radii.topLeft, radii.topLeft, Math.PI * 0.5, Math.PI);\n\tpoints.push(new THREE.Vector2(x, y + radii.bottomLeft));\n\taddArc(\n\t\tx + radii.bottomLeft,\n\t\ty + radii.bottomLeft,\n\t\tradii.bottomLeft,\n\t\tMath.PI,\n\t\tMath.PI * 1.5,\n\t\tfalse\n\t);\n\n\treturn points;\n}\n"]}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Gates CSS hover effects by the actual pointer, including on touch laptops.
|
|
3
|
+
* Capability media queries alone still allow sticky touch :hover on hybrid devices.
|
|
4
|
+
* The returned lifecycle also works as a Svelte action.
|
|
5
|
+
*/
|
|
6
|
+
export declare function mouseHover(node: HTMLElement): {
|
|
7
|
+
destroy(): void;
|
|
8
|
+
};
|
|
9
|
+
//# sourceMappingURL=mouseHover.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mouseHover.d.ts","sourceRoot":"","sources":["../../src/stage/mouseHover.ts"],"names":[],"mappings":"AAWA;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,WAAW;;EAuC3C"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
const hovered = new Set();
|
|
2
|
+
let subscribers = 0;
|
|
3
|
+
function clearHover(event) {
|
|
4
|
+
if (event?.pointerType === 'mouse')
|
|
5
|
+
return;
|
|
6
|
+
for (const node of hovered)
|
|
7
|
+
node.removeAttribute('data-mouse-hover');
|
|
8
|
+
hovered.clear();
|
|
9
|
+
}
|
|
10
|
+
const clearOnBlur = () => clearHover();
|
|
11
|
+
/**
|
|
12
|
+
* Gates CSS hover effects by the actual pointer, including on touch laptops.
|
|
13
|
+
* Capability media queries alone still allow sticky touch :hover on hybrid devices.
|
|
14
|
+
* The returned lifecycle also works as a Svelte action.
|
|
15
|
+
*/
|
|
16
|
+
export function mouseHover(node) {
|
|
17
|
+
const enter = (event) => {
|
|
18
|
+
if (event.pointerType !== 'mouse') {
|
|
19
|
+
clearHover();
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
if (hovered.has(node))
|
|
23
|
+
return;
|
|
24
|
+
hovered.add(node);
|
|
25
|
+
node.setAttribute('data-mouse-hover', '');
|
|
26
|
+
};
|
|
27
|
+
const leave = () => {
|
|
28
|
+
hovered.delete(node);
|
|
29
|
+
node.removeAttribute('data-mouse-hover');
|
|
30
|
+
};
|
|
31
|
+
if (subscribers++ === 0) {
|
|
32
|
+
window.addEventListener('pointerdown', clearHover, { capture: true, passive: true });
|
|
33
|
+
window.addEventListener('pointermove', clearHover, { capture: true, passive: true });
|
|
34
|
+
window.addEventListener('blur', clearOnBlur);
|
|
35
|
+
}
|
|
36
|
+
node.addEventListener('pointerenter', enter, { passive: true });
|
|
37
|
+
node.addEventListener('pointermove', enter, { passive: true });
|
|
38
|
+
node.addEventListener('pointerleave', leave, { passive: true });
|
|
39
|
+
node.addEventListener('pointercancel', leave, { passive: true });
|
|
40
|
+
return {
|
|
41
|
+
destroy() {
|
|
42
|
+
leave();
|
|
43
|
+
node.removeEventListener('pointerenter', enter);
|
|
44
|
+
node.removeEventListener('pointermove', enter);
|
|
45
|
+
node.removeEventListener('pointerleave', leave);
|
|
46
|
+
node.removeEventListener('pointercancel', leave);
|
|
47
|
+
if (--subscribers === 0) {
|
|
48
|
+
window.removeEventListener('pointerdown', clearHover, true);
|
|
49
|
+
window.removeEventListener('pointermove', clearHover, true);
|
|
50
|
+
window.removeEventListener('blur', clearOnBlur);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
//# sourceMappingURL=mouseHover.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mouseHover.js","sourceRoot":"","sources":["../../src/stage/mouseHover.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,GAAG,IAAI,GAAG,EAAe,CAAC;AACvC,IAAI,WAAW,GAAG,CAAC,CAAC;AAEpB,SAAS,UAAU,CAAC,KAAoB;IACvC,IAAI,KAAK,EAAE,WAAW,KAAK,OAAO;QAAE,OAAO;IAC3C,KAAK,MAAM,IAAI,IAAI,OAAO;QAAE,IAAI,CAAC,eAAe,CAAC,kBAAkB,CAAC,CAAC;IACrE,OAAO,CAAC,KAAK,EAAE,CAAC;AACjB,CAAC;AAED,MAAM,WAAW,GAAG,GAAG,EAAE,CAAC,UAAU,EAAE,CAAC;AAEvC;;;;GAIG;AACH,MAAM,UAAU,UAAU,CAAC,IAAiB;IAC3C,MAAM,KAAK,GAAG,CAAC,KAAmB,EAAE,EAAE;QACrC,IAAI,KAAK,CAAC,WAAW,KAAK,OAAO,EAAE,CAAC;YACnC,UAAU,EAAE,CAAC;YACb,OAAO;QACR,CAAC;QACD,IAAI,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC;YAAE,OAAO;QAC9B,OAAO,CAAC,GAAG,CAAC,IAAI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K,CAAC,CAAC;YAChD,IAAI,CAAC,mBAAmB,CAAC,eAAe,EAAE,KAAK,CAAC,CAAC;YACjD,IAAI,EAAE,WAAW,KAAK,CAAC,EAAE,CAAC;gBACzB,MAAM,CAAC,mBAAmB,CAAC,aAAa,EAAE,UAAU,EAAE,IAAI,CAAC,CAAC;gBAC5D,MAAM,CAAC,mBAAmB,CAAC,aAAa,EAAE,UAAU,EAAE,IAAI,CAAC,CAAC;gBAC5D,MAAM,CAAC,mBAAmB,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;YACjD,CAAC;QACF,CAAC;KACD,CAAC;AACH,CAAC","sourcesContent":["const hovered = new Set<HTMLElement>();\nlet subscribers = 0;\n\nfunction clearHover(event?: PointerEvent) {\n\tif (event?.pointerType === 'mouse') return;\n\tfor (const node of hovered) node.removeAttribute('data-mouse-hover');\n\thovered.clear();\n}\n\nconst clearOnBlur = () => clearHover();\n\n/**\n * Gates CSS hover effects by the actual pointer, including on touch laptops.\n * Capability media queries alone still allow sticky touch :hover on hybrid devices.\n * The returned lifecycle also works as a Svelte action.\n */\nexport function mouseHover(node: HTMLElement) {\n\tconst enter = (event: PointerEvent) => {\n\t\tif (event.pointerType !== 'mouse') {\n\t\t\tclearHover();\n\t\t\treturn;\n\t\t}\n\t\tif (hovered.has(node)) return;\n\t\thovered.add(node);\n\t\tnode.setAttribute('data-mouse-hover', '');\n\t};\n\tconst leave = () => {\n\t\thovered.delete(node);\n\t\tnode.removeAttribute('data-mouse-hover');\n\t};\n\n\tif (subscribers++ === 0) {\n\t\twindow.addEventListener('pointerdown', clearHover, { capture: true, passive: true });\n\t\twindow.addEventListener('pointermove', clearHover, { capture: true, passive: true });\n\t\twindow.addEventListener('blur', clearOnBlur);\n\t}\n\tnode.addEventListener('pointerenter', enter, { passive: true });\n\tnode.addEventListener('pointermove', enter, { passive: true });\n\tnode.addEventListener('pointerleave', leave, { passive: true });\n\tnode.addEventListener('pointercancel', leave, { passive: true });\n\n\treturn {\n\t\tdestroy() {\n\t\t\tleave();\n\t\t\tnode.removeEventListener('pointerenter', enter);\n\t\t\tnode.removeEventListener('pointermove', enter);\n\t\t\tnode.removeEventListener('pointerleave', leave);\n\t\t\tnode.removeEventListener('pointercancel', leave);\n\t\t\tif (--subscribers === 0) {\n\t\t\t\twindow.removeEventListener('pointerdown', clearHover, true);\n\t\t\t\twindow.removeEventListener('pointermove', clearHover, true);\n\t\t\t\twindow.removeEventListener('blur', clearOnBlur);\n\t\t\t}\n\t\t}\n\t};\n}\n"]}
|
|
@@ -45,7 +45,14 @@ export interface StagePanelRegistration {
|
|
|
45
45
|
getElement(): HTMLElement | undefined;
|
|
46
46
|
getFrameElement(): HTMLElement | undefined;
|
|
47
47
|
getSurfaceElement(): HTMLElement | undefined;
|
|
48
|
-
getPointerReactive(): boolean;
|
|
48
|
+
getPointerReactive(): boolean | 'lift';
|
|
49
|
+
getFocusReactive?(): boolean | 'top-right';
|
|
50
|
+
/** Neighbouring panel frame that shares a corner control's exit path. */
|
|
51
|
+
getFocusAnchor?(): HTMLElement | undefined;
|
|
52
|
+
getNativeContent?(): boolean;
|
|
53
|
+
/** Runs synchronously before the native panel surface is measured and drawn. */
|
|
54
|
+
updateNativeLayout?(): void;
|
|
55
|
+
getVisible?(): boolean;
|
|
49
56
|
getMinimapOptions(): StagePanelMinimapOptions | undefined;
|
|
50
57
|
getOptions(): LiquidGlassPanelOptions;
|
|
51
58
|
getSurface(): StagePanelSurface;
|
|
@@ -62,7 +69,7 @@ export interface StageViewportRegistration {
|
|
|
62
69
|
getElement(): HTMLElement | undefined;
|
|
63
70
|
}
|
|
64
71
|
export interface StageContext {
|
|
65
|
-
prefetchSpatialElement?(stage: import('../spatial-element/
|
|
72
|
+
prefetchSpatialElement?(stage: import('../spatial-element/spatialElementScene.js').SpatialElementScene): void;
|
|
66
73
|
registerPanel(panel: StagePanelRegistration): () => void;
|
|
67
74
|
registerViewport(viewport: StageViewportRegistration): () => void;
|
|
68
75
|
/** Restores the element camera to its init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,MAAM,CAAC;IAC5B,kFAAkF;IAClF,oBAAoB,IAAI,MAAM,CAAC;IAC/B,mFAAmF;IACnF,sBAAsB,IAAI,MAAM,CAAC;IACjC,6EAA6E;IAC7E,kBAAkB,IAAI,MAAM,GAAG,SAAS,CAAC;CACzC;AAED,MAAM,WAAW,yBAAyB;IACzC,UAAU,IAAI,WAAW,GAAG,SAAS,CAAC;CACtC;AAED,MAAM,WAAW,YAAY;IAC5B,sBAAsB,CAAC,CAAC,KAAK,EAAE,OAAO,2CAA2C,EAAE,mBAAmB,GAAG,IAAI,CAAC;IAC9G,aAAa,CAAC,KAAK,EAAE,sBAAsB,GAAG,MAAM,IAAI,CAAC;IACzD,gBAAgB,CAAC,QAAQ,EAAE,yBAAyB,GAAG,MAAM,IAAI,CAAC;IAClE,8DAA8D;IAC9D,SAAS,IAAI,IAAI,CAAC;CAClB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"panelContext.js","sourceRoot":"","sources":["../../src/stage/panelContext.ts"],"names":[],"mappings":"AAIA,MAAM,CAAC,MAAM,iBAAiB,GAAG,MAAM,CAAC,OAAO,CAAC,CAAC;AAEjD,uFAAuF;AACvF,MAAM,CAAC,MAAM,wBAAwB,GAAG,oBAAoB,CAAC;AAE7D,+FAA+F;AAC/F,MAAM,CAAC,MAAM,wBAAwB,GAAG,oBAAoB,CAAC","sourcesContent":["\nimport type { LiquidGlassPanelOptions } from './LiquidGlassPanel.js';\nimport type { StageMinimapDockedView, StagePanelSurface } from './stageTypes.js';\n\nexport const STAGE_CONTEXT_KEY = Symbol('stage');\n\n/** Notifies an active stage that externally positioned panel frames changed layout. */\nexport const STAGE_PANEL_LAYOUT_EVENT = 'stage:panel-layout';\n\n/** Notifies an active stage that an external panel visual changed without affecting layout. */\nexport const STAGE_PANEL_VISUAL_EVENT = 'stage:panel-visual';\n\nexport interface StagePanelPose {\n\twidth: number;\n\theight: number;\n\tposition: { x: number; y: number };\n}\n\nexport interface StagePanelShape {\n\tradius: number;\n\tcontentInset?: number;\n}\n\nexport type StagePanelTheme = Omit<\n\tLiquidGlassPanelOptions,\n\t'width' | 'height' | 'position' | 'radius'\n> & {\n\t/** Semantic surface style. Defaults to the WebGPU-backed `glass` mode. */\n\tsurface?: StagePanelSurface;\n};\n\n\n\nexport interface StagePanelMinimapOptions {\n\texpandedHeight?: number;\n\tinset?: number;\n\t/** Additional unbounded scale applied to the fitted model. Values below 0.2 are clamped. */\n\tmodelScale?: number;\n\t/** Model multiplier at full pointer hover. Use 1 to disable hover enlargement. */\n\thoverModelScale?: number;\n\t/** Hover multiplier used once the minimap is expanded by camera zoom. */\n\texpandedHoverModelScale?: number;\n\t/** Optional spatial-element-specific presentation used while the minimap is docked. */\n\tdockedView?: StageMinimapDockedView;\n\toverlayColor?: string | number;\n\toverlayOpacity?: number;\n\t/** Gaussian blur radius in CSS pixels. */\n\toverlayBlur?: number;\n\tcontextColor?: string | number;\n\tcontextOpacity?: number;\n\tviewportColor?: string | number;\n}\n\nexport interface StagePanelRegistration {\n\tgetContentInset(): number;\n\tgetElement(): HTMLElement | undefined;\n\tgetFrameElement(): HTMLElement | undefined;\n\tgetSurfaceElement(): HTMLElement | undefined;\n\tgetPointerReactive(): boolean;\n\tgetMinimapOptions(): StagePanelMinimapOptions | undefined;\n\tgetOptions(): LiquidGlassPanelOptions;\n\tgetSurface(): StagePanelSurface;\n\t/** Returns the opacity of the panel surface without affecting panel content. */\n\tgetSurfaceOpacity(): number;\n\t/** Returns a transient presentation scale applied to a rendered minimap model. */\n\tgetMinimapModelScale(): number;\n\t/** Returns the animated transition from the regular to the docked minimap view. */\n\tgetMinimapDockProgress(): number;\n\t/** Returns the viewport-space top edge used to anchor the rendered model. */\n\tgetMinimapModelTop(): number | undefined;\n}\n\nexport interface StageViewportRegistration {\n\tgetElement(): HTMLElement | undefined;\n}\n\nexport interface StageContext {\n\tprefetchSpatialElement?(stage: import('../spatial-element/
|
|
1
|
+
{"version":3,"file":"panelContext.js","sourceRoot":"","sources":["../../src/stage/panelContext.ts"],"names":[],"mappings":"AAIA,MAAM,CAAC,MAAM,iBAAiB,GAAG,MAAM,CAAC,OAAO,CAAC,CAAC;AAEjD,uFAAuF;AACvF,MAAM,CAAC,MAAM,wBAAwB,GAAG,oBAAoB,CAAC;AAE7D,+FAA+F;AAC/F,MAAM,CAAC,MAAM,wBAAwB,GAAG,oBAAoB,CAAC","sourcesContent":["\nimport type { LiquidGlassPanelOptions } from './LiquidGlassPanel.js';\nimport type { StageMinimapDockedView, StagePanelSurface } from './stageTypes.js';\n\nexport const STAGE_CONTEXT_KEY = Symbol('stage');\n\n/** Notifies an active stage that externally positioned panel frames changed layout. */\nexport const STAGE_PANEL_LAYOUT_EVENT = 'stage:panel-layout';\n\n/** Notifies an active stage that an external panel visual changed without affecting layout. */\nexport const STAGE_PANEL_VISUAL_EVENT = 'stage:panel-visual';\n\nexport interface StagePanelPose {\n\twidth: number;\n\theight: number;\n\tposition: { x: number; y: number };\n}\n\nexport interface StagePanelShape {\n\tradius: number;\n\tcontentInset?: number;\n}\n\nexport type StagePanelTheme = Omit<\n\tLiquidGlassPanelOptions,\n\t'width' | 'height' | 'position' | 'radius'\n> & {\n\t/** Semantic surface style. Defaults to the WebGPU-backed `glass` mode. */\n\tsurface?: StagePanelSurface;\n};\n\n\n\nexport interface StagePanelMinimapOptions {\n\texpandedHeight?: number;\n\tinset?: number;\n\t/** Additional unbounded scale applied to the fitted model. Values below 0.2 are clamped. */\n\tmodelScale?: number;\n\t/** Model multiplier at full pointer hover. Use 1 to disable hover enlargement. */\n\thoverModelScale?: number;\n\t/** Hover multiplier used once the minimap is expanded by camera zoom. */\n\texpandedHoverModelScale?: number;\n\t/** Optional spatial-element-specific presentation used while the minimap is docked. */\n\tdockedView?: StageMinimapDockedView;\n\toverlayColor?: string | number;\n\toverlayOpacity?: number;\n\t/** Gaussian blur radius in CSS pixels. */\n\toverlayBlur?: number;\n\tcontextColor?: string | number;\n\tcontextOpacity?: number;\n\tviewportColor?: string | number;\n}\n\nexport interface StagePanelRegistration {\n\tgetContentInset(): number;\n\tgetElement(): HTMLElement | undefined;\n\tgetFrameElement(): HTMLElement | undefined;\n\tgetSurfaceElement(): HTMLElement | undefined;\n\tgetPointerReactive(): boolean | 'lift';\n\tgetFocusReactive?(): boolean | 'top-right';\n\t/** Neighbouring panel frame that shares a corner control's exit path. */\n\tgetFocusAnchor?(): HTMLElement | undefined;\n\tgetNativeContent?(): boolean;\n\t/** Runs synchronously before the native panel surface is measured and drawn. */\n\tupdateNativeLayout?(): void;\n\tgetVisible?(): boolean;\n\tgetMinimapOptions(): StagePanelMinimapOptions | undefined;\n\tgetOptions(): LiquidGlassPanelOptions;\n\tgetSurface(): StagePanelSurface;\n\t/** Returns the opacity of the panel surface without affecting panel content. */\n\tgetSurfaceOpacity(): number;\n\t/** Returns a transient presentation scale applied to a rendered minimap model. */\n\tgetMinimapModelScale(): number;\n\t/** Returns the animated transition from the regular to the docked minimap view. */\n\tgetMinimapDockProgress(): number;\n\t/** Returns the viewport-space top edge used to anchor the rendered model. */\n\tgetMinimapModelTop(): number | undefined;\n}\n\nexport interface StageViewportRegistration {\n\tgetElement(): HTMLElement | undefined;\n}\n\nexport interface StageContext {\n\tprefetchSpatialElement?(stage: import('../spatial-element/spatialElementScene.js').SpatialElementScene): void;\n\tregisterPanel(panel: StagePanelRegistration): () => void;\n\tregisterViewport(viewport: StageViewportRegistration): () => void;\n\t/** Restores the element camera to its initial fitted pose. */\n\tresetView(): void;\n}\n"]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { StageRenderSettings } from './stageTypes.js';
|
|
2
|
+
export interface ResolvedStageRenderSettings {
|
|
3
|
+
maxPixelRatio: number;
|
|
4
|
+
maxPixels: number | null;
|
|
5
|
+
}
|
|
6
|
+
export declare const DEFAULT_STAGE_RENDER_SETTINGS: Readonly<ResolvedStageRenderSettings>;
|
|
7
|
+
export declare function resolveStageRenderSettings(settings?: StageRenderSettings): ResolvedStageRenderSettings;
|
|
8
|
+
/** Keep the viewport aspect ratio and allow subsampling on very large displays. */
|
|
9
|
+
export declare function getStageRenderPixelRatio(width: number, height: number, devicePixelRatio: number, settings?: Readonly<ResolvedStageRenderSettings>): number;
|
|
10
|
+
//# sourceMappingURL=renderSettings.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"renderSettings.d.ts","sourceRoot":"","sources":["../../src/stage/renderSettings.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAE3D,MAAM,WAAW,2BAA2B;IAC3C,aAAa,EAAE,MAAM,CAAC;IACtB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;CACzB;AAED,eAAO,MAAM,6BAA6B,EAAE,QAAQ,CAAC,2BAA2B,CAG/E,CAAC;AAEF,wBAAgB,0BAA0B,CACzC,QAAQ,GAAE,mBAAwB,GAChC,2BAA2B,CAa7B;AAED,mFAAmF;AACnF,wBAAgB,wBAAwB,CACvC,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,EACd,gBAAgB,EAAE,MAAM,EACxB,QAAQ,GAAE,QAAQ,CAAC,2BAA2B,CAAiC,UAW/E"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export const DEFAULT_STAGE_RENDER_SETTINGS = {
|
|
2
|
+
maxPixelRatio: 1,
|
|
3
|
+
maxPixels: 1920 * 1080
|
|
4
|
+
};
|
|
5
|
+
export function resolveStageRenderSettings(settings = {}) {
|
|
6
|
+
return {
|
|
7
|
+
maxPixelRatio: Number.isFinite(settings.maxPixelRatio) && settings.maxPixelRatio > 0
|
|
8
|
+
? settings.maxPixelRatio
|
|
9
|
+
: DEFAULT_STAGE_RENDER_SETTINGS.maxPixelRatio,
|
|
10
|
+
maxPixels: settings.maxPixels === null
|
|
11
|
+
? null
|
|
12
|
+
: Number.isFinite(settings.maxPixels) && settings.maxPixels > 0
|
|
13
|
+
? Math.max(1, Math.floor(settings.maxPixels))
|
|
14
|
+
: DEFAULT_STAGE_RENDER_SETTINGS.maxPixels
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
/** Keep the viewport aspect ratio and allow subsampling on very large displays. */
|
|
18
|
+
export function getStageRenderPixelRatio(width, height, devicePixelRatio, settings = DEFAULT_STAGE_RENDER_SETTINGS) {
|
|
19
|
+
const viewportWidth = Number.isFinite(width) && width > 0 ? width : 1;
|
|
20
|
+
const viewportHeight = Number.isFinite(height) && height > 0 ? height : 1;
|
|
21
|
+
const nativeRatio = Number.isFinite(devicePixelRatio) && devicePixelRatio > 0 ? devicePixelRatio : 1;
|
|
22
|
+
const pixelBudgetRatio = settings.maxPixels === null
|
|
23
|
+
? Infinity
|
|
24
|
+
: Math.sqrt(settings.maxPixels / (viewportWidth * viewportHeight));
|
|
25
|
+
return Math.min(nativeRatio, settings.maxPixelRatio, pixelBudgetRatio);
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=renderSettings.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"renderSettings.js","sourceRoot":"","sources":["../../src/stage/renderSettings.ts"],"names":[],"mappings":"AAOA,MAAM,CAAC,MAAM,6BAA6B,GAA0C;IACnF,aAAa,EAAE,CAAC;IAChB,SAAS,EAAE,IAAI,GAAG,IAAI;CACtB,CAAC;AAEF,MAAM,UAAU,0BAA0B,CACzC,WAAgC,EAAE;IAElC,OAAO;QACN,aAAa,EACZ,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAC,aAAa,CAAC,IAAI,QAAQ,CAAC,aAAc,GAAG,CAAC;YACrE,CAAC,CAAC,QAAQ,CAAC,aAAc;YACzB,CAAC,CAAC,6BAA6B,CAAC,aAAa;QAC/C,SAAS,EACR,QAAQ,CAAC,SAAS,KAAK,IAAI;YAC1B,CAAC,CAAC,IAAI;YACN,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAC,SAAS,CAAC,IAAI,QAAQ,CAAC,SAAU,GAAG,CAAC;gBAC/D,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,SAAU,CAAC,CAAC;gBAC9C,CAAC,CAAC,6BAA6B,CAAC,SAAS;KAC5C,CAAC;AACH,CAAC;AAED,mFAAmF;AACnF,MAAM,UAAU,wBAAwB,CACvC,KAAa,EACb,MAAc,EACd,gBAAwB,EACxB,WAAkD,6BAA6B;IAE/E,MAAM,aAAa,GAAG,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;IACtE,MAAM,cAAc,GAAG,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;IAC1E,MAAM,WAAW,GAChB,MAAM,CAAC,QAAQ,CAAC,gBAAgB,CAAC,IAAI,gBAAgB,GAAG,CAAC,CAAC,CAAC,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,CAAC;IAClF,MAAM,gBAAgB,GACrB,QAAQ,CAAC,SAAS,KAAK,IAAI;QAC1B,CAAC,CAAC,QAAQ;QACV,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,SAAS,GAAG,CAAC,aAAa,GAAG,cAAc,CAAC,CAAC,CAAC;IACrE,OAAO,IAAI,CAAC,GAAG,CAAC,WAAW,EAAE,QAAQ,CAAC,aAAa,EAAE,gBAAgB,CAAC,CAAC;AACxE,CAAC","sourcesContent":["import type { StageRenderSettings } from './stageTypes.js';\n\nexport interface ResolvedStageRenderSettings {\n\tmaxPixelRatio: number;\n\tmaxPixels: number | null;\n}\n\nexport const DEFAULT_STAGE_RENDER_SETTINGS: Readonly<ResolvedStageRenderSettings> = {\n\tmaxPixelRatio: 1,\n\tmaxPixels: 1920 * 1080\n};\n\nexport function resolveStageRenderSettings(\n\tsettings: StageRenderSettings = {}\n): ResolvedStageRenderSettings {\n\treturn {\n\t\tmaxPixelRatio:\n\t\t\tNumber.isFinite(settings.maxPixelRatio) && settings.maxPixelRatio! > 0\n\t\t\t\t? settings.maxPixelRatio!\n\t\t\t\t: DEFAULT_STAGE_RENDER_SETTINGS.maxPixelRatio,\n\t\tmaxPixels:\n\t\t\tsettings.maxPixels === null\n\t\t\t\t? null\n\t\t\t\t: Number.isFinite(settings.maxPixels) && settings.maxPixels! > 0\n\t\t\t\t\t? Math.max(1, Math.floor(settings.maxPixels!))\n\t\t\t\t\t: DEFAULT_STAGE_RENDER_SETTINGS.maxPixels\n\t};\n}\n\n/** Keep the viewport aspect ratio and allow subsampling on very large displays. */\nexport function getStageRenderPixelRatio(\n\twidth: number,\n\theight: number,\n\tdevicePixelRatio: number,\n\tsettings: Readonly<ResolvedStageRenderSettings> = DEFAULT_STAGE_RENDER_SETTINGS\n) {\n\tconst viewportWidth = Number.isFinite(width) && width > 0 ? width : 1;\n\tconst viewportHeight = Number.isFinite(height) && height > 0 ? height : 1;\n\tconst nativeRatio =\n\t\tNumber.isFinite(devicePixelRatio) && devicePixelRatio > 0 ? devicePixelRatio : 1;\n\tconst pixelBudgetRatio =\n\t\tsettings.maxPixels === null\n\t\t\t? Infinity\n\t\t\t: Math.sqrt(settings.maxPixels / (viewportWidth * viewportHeight));\n\treturn Math.min(nativeRatio, settings.maxPixelRatio, pixelBudgetRatio);\n}\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { RenderTarget } from 'three/webgpu';
|
|
2
|
-
/** Three
|
|
2
|
+
/** Three r186 diagnostic adapter only; never used for rendering or ownership. */
|
|
3
3
|
export declare function gaussianTargets(effect: unknown): RenderTarget[];
|
|
4
4
|
export declare function describeRenderTargets(groups: Readonly<Record<string, readonly RenderTarget[]>>): {
|
|
5
5
|
liveTargets: number;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** Three
|
|
1
|
+
/** Three r186 diagnostic adapter only; never used for rendering or ownership. */
|
|
2
2
|
export function gaussianTargets(effect) {
|
|
3
3
|
const node = effect;
|
|
4
4
|
return [node?._horizontalRT, node?._verticalRT].filter((target) => Boolean(target));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"renderTargetInventory.js","sourceRoot":"","sources":["../../src/stage/renderTargetInventory.ts"],"names":[],"mappings":"AAEA,iFAAiF;AACjF,MAAM,UAAU,eAAe,CAAC,MAAe;IAC9C,MAAM,IAAI,GAAG,MAAkF,CAAC;IAChG,OAAO,CAAC,IAAI,EAAE,aAAa,EAAE,IAAI,EAAE,WAAW,CAAC,CAAC,MAAM,CAAC,CAAC,MAAM,EAA0B,EAAE,CACzF,OAAO,CAAC,MAAM,CAAC,CACf,CAAC;AACH,CAAC;AAED,MAAM,UAAU,qBAAqB,CAAC,MAAyD;IAC9F,MAAM,IAAI,GAAG,IAAI,GAAG,EAAgB,CAAC;IACrC,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,EAAE,MAAM,CAAC,EAAE,EAAE,CAClE,MAAM,CAAC,OAAO,CAAC,CAAC,MAAM,EAAE,EAAE;QACzB,IAAI,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC;YAAE,OAAO,EAAE,CAAC;QAChC,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;QACjB,OAAO;YACN;gBACC,KAAK;gBACL,EAAE,EAAE,MAAM,CAAC,OAAO,CAAC,IAAI;gBACvB,KAAK,EAAE,MAAM,CAAC,KAAK;gBACnB,MAAM,EAAE,MAAM,CAAC,MAAM;gBACrB,OAAO,EAAE,MAAM,CAAC,OAAO;gBACvB,KAAK,EAAE,MAAM,CAAC,WAAW;gBACzB,gBAAgB,EAAE,MAAM,CAAC,QAAQ,CAAC,MAAM;gBACxC,SAAS,EAAE,MAAM,CAAC,OAAO,CAAC,IAAI;aAC9B;SACD,CAAC;IACH,CAAC,CAAC,CACF,CAAC;IACF,OAAO,EAAE,WAAW,EAAE,OAAO,CAAC,MAAM,EAAE,OAAO,EAAE,CAAC;AACjD,CAAC","sourcesContent":["import type { RenderTarget } from 'three/webgpu';\n\n/** Three
|
|
1
|
+
{"version":3,"file":"renderTargetInventory.js","sourceRoot":"","sources":["../../src/stage/renderTargetInventory.ts"],"names":[],"mappings":"AAEA,iFAAiF;AACjF,MAAM,UAAU,eAAe,CAAC,MAAe;IAC9C,MAAM,IAAI,GAAG,MAAkF,CAAC;IAChG,OAAO,CAAC,IAAI,EAAE,aAAa,EAAE,IAAI,EAAE,WAAW,CAAC,CAAC,MAAM,CAAC,CAAC,MAAM,EAA0B,EAAE,CACzF,OAAO,CAAC,MAAM,CAAC,CACf,CAAC;AACH,CAAC;AAED,MAAM,UAAU,qBAAqB,CAAC,MAAyD;IAC9F,MAAM,IAAI,GAAG,IAAI,GAAG,EAAgB,CAAC;IACrC,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,EAAE,MAAM,CAAC,EAAE,EAAE,CAClE,MAAM,CAAC,OAAO,CAAC,CAAC,MAAM,EAAE,EAAE;QACzB,IAAI,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC;YAAE,OAAO,EAAE,CAAC;QAChC,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;QACjB,OAAO;YACN;gBACC,KAAK;gBACL,EAAE,EAAE,MAAM,CAAC,OAAO,CAAC,IAAI;gBACvB,KAAK,EAAE,MAAM,CAAC,KAAK;gBACnB,MAAM,EAAE,MAAM,CAAC,MAAM;gBACrB,OAAO,EAAE,MAAM,CAAC,OAAO;gBACvB,KAAK,EAAE,MAAM,CAAC,WAAW;gBACzB,gBAAgB,EAAE,MAAM,CAAC,QAAQ,CAAC,MAAM;gBACxC,SAAS,EAAE,MAAM,CAAC,OAAO,CAAC,IAAI;aAC9B;SACD,CAAC;IACH,CAAC,CAAC,CACF,CAAC;IACF,OAAO,EAAE,WAAW,EAAE,OAAO,CAAC,MAAM,EAAE,OAAO,EAAE,CAAC;AACjD,CAAC","sourcesContent":["import type { RenderTarget } from 'three/webgpu';\n\n/** Three r186 diagnostic adapter only; never used for rendering or ownership. */\nexport function gaussianTargets(effect: unknown): RenderTarget[] {\n\tconst node = effect as { _horizontalRT?: RenderTarget; _verticalRT?: RenderTarget } | undefined;\n\treturn [node?._horizontalRT, node?._verticalRT].filter((target): target is RenderTarget =>\n\t\tBoolean(target)\n\t);\n}\n\nexport function describeRenderTargets(groups: Readonly<Record<string, readonly RenderTarget[]>>) {\n\tconst seen = new Set<RenderTarget>();\n\tconst targets = Object.entries(groups).flatMap(([owner, values]) =>\n\t\tvalues.flatMap((target) => {\n\t\t\tif (seen.has(target)) return [];\n\t\t\tseen.add(target);\n\t\t\treturn [\n\t\t\t\t{\n\t\t\t\t\towner,\n\t\t\t\t\tid: target.texture.uuid,\n\t\t\t\t\twidth: target.width,\n\t\t\t\t\theight: target.height,\n\t\t\t\t\tsamples: target.samples,\n\t\t\t\t\tdepth: target.depthBuffer,\n\t\t\t\t\tcolorAttachments: target.textures.length,\n\t\t\t\t\tcolorType: target.texture.type\n\t\t\t\t}\n\t\t\t];\n\t\t})\n\t);\n\treturn { liveTargets: targets.length, targets };\n}\n"]}
|
|
@@ -30,6 +30,8 @@ export declare function getStageVisualScrollPosition(): {
|
|
|
30
30
|
scrollX: number;
|
|
31
31
|
scrollY: number;
|
|
32
32
|
};
|
|
33
|
+
/** Lets render owners defer to the ordered DOM/dock/scene update already queued. */
|
|
34
|
+
export declare function hasPendingStageScrollFrame(): boolean;
|
|
33
35
|
/** Rebase every consumer after restoration, including when no native scroll event fires. */
|
|
34
36
|
export declare function syncStageScrollToNative(): {
|
|
35
37
|
scrollX: number;
|