@spatial-elements/core 1.0.0-beta.12 → 1.0.0-beta.13

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.
Files changed (42) hide show
  1. package/dist/spatial-element/SpatialElementPaneController.js +3 -3
  2. package/dist/spatial-element/SpatialElementPaneController.js.map +1 -1
  3. package/dist/stage/DetailWheelGesture.d.ts +9 -0
  4. package/dist/stage/DetailWheelGesture.d.ts.map +1 -0
  5. package/dist/stage/DetailWheelGesture.js +16 -0
  6. package/dist/stage/DetailWheelGesture.js.map +1 -0
  7. package/dist/stage/LiquidGlassPanel.d.ts +2 -0
  8. package/dist/stage/LiquidGlassPanel.d.ts.map +1 -1
  9. package/dist/stage/LiquidGlassPanel.js +24 -17
  10. package/dist/stage/LiquidGlassPanel.js.map +1 -1
  11. package/dist/stage/PanelPresentationController.d.ts.map +1 -1
  12. package/dist/stage/PanelPresentationController.js +2 -0
  13. package/dist/stage/PanelPresentationController.js.map +1 -1
  14. package/dist/stage/SpatialElementInteractionController.d.ts +21 -0
  15. package/dist/stage/SpatialElementInteractionController.d.ts.map +1 -1
  16. package/dist/stage/SpatialElementInteractionController.js +185 -16
  17. package/dist/stage/SpatialElementInteractionController.js.map +1 -1
  18. package/dist/stage/SpatialElementPresentationController.js +4 -4
  19. package/dist/stage/SpatialElementPresentationController.js.map +1 -1
  20. package/dist/stage/StageExperience.d.ts +8 -0
  21. package/dist/stage/StageExperience.d.ts.map +1 -1
  22. package/dist/stage/StageExperience.js +34 -19
  23. package/dist/stage/StageExperience.js.map +1 -1
  24. package/dist/stage/StageRenderPipeline.d.ts +3 -0
  25. package/dist/stage/StageRenderPipeline.d.ts.map +1 -1
  26. package/dist/stage/StageRenderPipeline.js +15 -0
  27. package/dist/stage/StageRenderPipeline.js.map +1 -1
  28. package/dist/stage/browserPinch.d.ts +5 -0
  29. package/dist/stage/browserPinch.d.ts.map +1 -0
  30. package/dist/stage/browserPinch.js +29 -0
  31. package/dist/stage/browserPinch.js.map +1 -0
  32. package/dist/stage/panelContext.d.ts +2 -1
  33. package/dist/stage/panelContext.d.ts.map +1 -1
  34. package/dist/stage/panelContext.js.map +1 -1
  35. package/dist/stage/panelFocusMath.d.ts +2 -0
  36. package/dist/stage/panelFocusMath.d.ts.map +1 -1
  37. package/dist/stage/panelFocusMath.js +8 -0
  38. package/dist/stage/panelFocusMath.js.map +1 -1
  39. package/dist/stage/stageVisualTest.d.ts +1 -0
  40. package/dist/stage/stageVisualTest.d.ts.map +1 -1
  41. package/dist/stage/stageVisualTest.js.map +1 -1
  42. package/package.json +1 -1
@@ -87,7 +87,7 @@ export class SpatialElementPaneController {
87
87
  this.savedScroll = { x: window.scrollX, y: window.scrollY };
88
88
  this.root.toggleAttribute('data-spatial-detail-pane-hidden', hidden);
89
89
  for (const region of this.hiddenRegions)
90
- region.inert = hidden && this.layout?.composition === 'split';
90
+ region.inert = hidden;
91
91
  if (!hidden && this.savedScroll) {
92
92
  window.scrollTo({ left: this.savedScroll.x, top: this.savedScroll.y, behavior: 'instant' });
93
93
  syncStageScrollToNative();
@@ -150,7 +150,7 @@ export class SpatialElementPaneController {
150
150
  for (const region of this.regions)
151
151
  region.toggleAttribute('data-stage-fixed-region', split);
152
152
  for (const region of this.hiddenRegions)
153
- region.inert = split && this.hidden;
153
+ region.inert = this.hidden;
154
154
  this.onMode(split);
155
155
  // The framework flushes the native summary ownership before its new box is measured.
156
156
  this.schedule();
@@ -206,7 +206,7 @@ export class SpatialElementPaneController {
206
206
  : { x: 0, y: 0, scale: 1, opacity: 1, blur: 0, pivotY: 0 };
207
207
  const pose = this.focusPose;
208
208
  this.root.toggleAttribute('data-spatial-detail-pane-zooming', Boolean(pane && this.focus > 0.001));
209
- this.setHidden(Boolean(pane && pose.opacity < 0.12));
209
+ this.setHidden(getPanelFocusOpacity(this.focus) < 0.12);
210
210
  const values = { '--spatial-pane-focus-x': `${pose.x}px`, '--spatial-pane-focus-y': `${pose.y}px`,
211
211
  '--spatial-pane-focus-scale': String(pose.scale), '--spatial-pane-focus-opacity': String(pose.opacity),
212
212
  '--spatial-pane-focus-blur': `${pose.blur}px` };
@@ -1 +1 @@
1
- {"version":3,"file":"SpatialElementPaneController.js","sourceRoot":"","sources":["../../src/spatial-element/SpatialElementPaneController.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAA8B,MAAM,uBAAuB,CAAC;AACxF,OAAO,EAAE,wBAAwB,EAAE,MAAM,0BAA0B,CAAC;AACpE,OAAO,EAAE,4BAA4B,EAAE,qBAAqB,EAAE,yBAAyB,EAAE,uBAAuB,EAAE,MAAM,yBAAyB,CAAC;AAClJ,OAAO,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,8BAA8B,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AAClK,OAAO,EAAE,gBAAgB,EAAE,iCAAiC,EAAE,MAAM,4BAA4B,CAAC;AAEjG,oFAAoF;AACpF,MAAM,UAAU,4BAA4B,CAAC,IAA6D,EACzG,QAA2C,EAAE,KAAa;IAC1D,MAAM,QAAQ,GAAG,EAAE,CAAC,EAAE,IAAI,CAAC,CAAC,GAAG,IAAI,CAAC,KAAK,GAAG,CAAC,GAAG,QAAQ,CAAC,KAAK,GAAG,CAAC;QACjE,CAAC,EAAE,QAAQ,CAAC,MAAM,GAAG,CAAC,GAAG,IAAI,CAAC,CAAC,GAAG,IAAI,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;IACrD,MAAM,OAAO,GAAG,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,QAAQ,EAAE,CAAC;IACrE,MAAM,MAAM,GAAG,mBAAmB,CAAC,OAAO,EAAE,KAAK,EAAE,QAAQ,CAAC,KAAK,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAC;IACpF,MAAM,QAAQ,GAAG,sBAAsB,CAAC,QAAQ,CAAC,MAAM,EAAE,gBAAgB,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AAI,CAAC,KAAK,EAAE,SAAS,CAAC,QAAQ,CAAC,6BAA6B,CAAC;YAAE,OAAO;QAC/G,MAAM,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC;QAC5B,IAAI,CAAC,CAAC,MAAM,YAAY,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,QAAQ,CAAC,MAAM,CAAC;YAAE,OAAO;QAC7E,MAAM,IAAI,GAAG,MAAM,CAAC,qBAAqB,EAAE,CAAC;QAC5C,MAAM,QAAQ,GAAG,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC;QACvC,MAAM,MAAM,GAAG,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,GAAG,QAAQ,CAAC,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC,IAAI,QAAQ,CAAC,CAAC;QAC1F,IAAI,IAAI,CAAC,GAAG,IAAI,QAAQ,CAAC,CAAC,IAAI,IAAI,CAAC,MAAM,IAAI,MAAM;YAAE,OAAO;QAC5D,MAAM,CAAC,QAAQ,CAAC,EAAE,GAAG,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,MAAM,CAAC,OAAO,GAAG,IAAI,CAAC,GAAG,GAAG,QAAQ,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,MAAM,GAAG,QAAQ,CAAC,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,SAAS,EAAE,CAAC,CAAC;IAC3J,CAAC,CAAC;CACF","sourcesContent":["import { resolveDetailLayout, type ResponsiveLayoutInput } from './responsiveLayout.js';\nimport { STAGE_PANEL_LAYOUT_EVENT } from '../stage/panelContext.js';\nimport { getStageVisualScrollPosition, STAGE_SCROLL_PRIORITY, subscribeStageScrollFrame, syncStageScrollToNative } from '../stage/scrollFrame.js';\nimport { getPanelFocusBlur, getPanelFocusOffset, getPanelFocusOpacity, getPanelFocusPerspectiveOffset, getPerspectiveDistance } from '../stage/panelFocusMath.js';\nimport { PANEL_CAMERA_FOV, PANEL_FOCUS_PERSPECTIVE_MAX_SCALE } from '../stage/stageConstants.js';\n\n/** The native pane uses the same focus curve and camera-facing motion as panels. */\nexport function resolvePaneFocusPresentation(rect: { x: number; y: number; width: number; height: number },\n\tviewport: { width: number; height: number }, focus: number) {\n\tconst position = { x: rect.x + rect.width / 2 - viewport.width / 2,\n\t\ty: viewport.height / 2 - rect.y - rect.height / 2 };\n\tconst options = { width: rect.width, height: rect.height, position };\n\tconst offset = getPanelFocusOffset(options, focus, viewport.width, viewport.height);\n\tconst distance = getPerspectiveDistance(viewport.height, PANEL_CAMERA_FOV);\n\tconst perspective = getPanelFocusPerspectiveOffset({ x: position.x + offset.x, y: position.y + offset.y }, offset.z, distance);\n\treturn { x: offset.x + perspective.x, y: -offset.y - perspective.y,\n\t\tscale: Math.min(PANEL_FOCUS_PERSPECTIVE_MAX_SCALE, Math.max(1, distance / Math.max(distance - offset.z, 1))),\n\t\topacity: getPanelFocusOpacity(focus), blur: getPanelFocusBlur(focus, options),\n\t\tpivotY: rect.y + rect.height / 2 };\n}\n\n/** One document coordinate system; clipping changes paint and hit testing only. */\nexport function resolvePaneScrollClip(bodyTop: number, bodyHeight: number, viewportTop: number, viewportBottom: number, scrollY: number) {\n\treturn {\n\t\ttop: Math.max(0, scrollY + viewportTop - bodyTop),\n\t\tbottom: Math.max(0, bodyTop + bodyHeight - scrollY - viewportBottom)\n\t};\n}\n\n/** Keeps fixed 3XL regions and the ordinary document body on the Stage scroll clock. */\nexport class SpatialElementPaneController {\n\tprivate body?: HTMLElement;\n\tprivate stage?: HTMLElement;\n\tprivate regions: HTMLElement[] = [];\n\tprivate hiddenRegions: HTMLElement[] = [];\n\tprivate observer?: ResizeObserver;\n\tprivate stageObserver?: MutationObserver;\n\tprivate stopScroll?: () => void;\n\tprivate frame = 0;\n\tprivate layout?: ReturnType<typeof resolveDetailLayout>;\n\tprivate metricKey = '';\n\tprivate bodyTop = 0;\n\tprivate bodyHeight = 0;\n\tprivate scrollY = 0;\n\tprivate hidden = false;\n\tprivate focus = 0;\n\tprivate focusPose = { x: 0, y: 0, scale: 1, opacity: 1, blur: 0, pivotY: 0 };\n\tprivate savedScroll?: { x: number; y: number };\n\tprivate sectionPositions: { element: HTMLElement; top: number }[] = [];\n\tprivate restoreAnchor?: { element: HTMLElement; offset: number };\n\tprivate resizeAnchor?: { element: HTMLElement; offset: number };\n\tprivate readingTop = 0;\n\tprivate started = false;\n\n\tconstructor(private readonly root: HTMLElement,\n\t\tprivate readonly readMetrics: () => ResponsiveLayoutInput | undefined,\n\t\tprivate readonly onMode: (split: boolean) => void) {}\n\n\tstart() {\n\t\tif (this.started) return;\n\t\tthis.started = true;\n\t\tthis.stage = this.root.closest<HTMLElement>('.stage') ?? undefined;\n\t\tthis.body = this.root.querySelector<HTMLElement>('[data-spatial-detail-pane-body]') ?? undefined;\n\t\tthis.regions = Array.from(this.root.querySelectorAll<HTMLElement>('[data-spatial-detail-fixed]'));\n\t\tthis.hiddenRegions = Array.from(this.root.querySelectorAll<HTMLElement>('[data-spatial-detail-pane-body], [data-spatial-detail-pane-header], [data-spatial-detail-pane-submenu-shell]'));\n\t\tthis.scrollY = getStageVisualScrollPosition().scrollY;\n\t\tthis.observer = new ResizeObserver(this.schedule);\n\t\tif (this.body) this.observer.observe(this.body);\n\t\tthis.stageObserver = new MutationObserver(this.schedule);\n\t\tif (this.stage) this.stageObserver.observe(this.stage, { attributes: true, attributeFilter: ['class'] });\n\t\twindow.addEventListener(STAGE_PANEL_LAYOUT_EVENT, this.schedule);\n\t\twindow.addEventListener('resize', this.handleResize, { passive: true });\n\t\tthis.root.addEventListener('focusin', this.handleFocus);\n\t\tthis.stopScroll = subscribeStageScrollFrame(frame => {\n\t\t\tthis.scrollY = frame.scrollY;\n\t\t\tthis.paint();\n\t\t}, STAGE_SCROLL_PRIORITY.virtualDocument + 2);\n\t\tthis.update();\n\t}\n\n\tsetHidden(hidden: boolean) {\n\t\tif (this.hidden === hidden) return;\n\t\tthis.hidden = hidden;\n\t\tif (hidden && this.layout?.composition === 'split') this.savedScroll = { x: window.scrollX, y: window.scrollY };\n\t\tthis.root.toggleAttribute('data-spatial-detail-pane-hidden', hidden);\n\t\tfor (const region of this.hiddenRegions) region.inert = hidden && this.layout?.composition === 'split';\n\t\tif (!hidden && this.savedScroll) {\n\t\t\twindow.scrollTo({ left: this.savedScroll.x, top: this.savedScroll.y, behavior: 'instant' });\n\t\t\tsyncStageScrollToNative();\n\t\t\tthis.savedScroll = undefined;\n\t\t}\n\t}\n\n\tsetFocus(focus: number, fullscreen = false) {\n\t\tthis.focus = fullscreen ? 1 : Math.max(0, Math.min(1, Number.isFinite(focus) ? focus : 0));\n\t\tthis.paintFocus();\n\t}\n\n\tdestroy() {\n\t\tthis.started = false;\n\t\tthis.stopScroll?.();\n\t\tthis.observer?.disconnect();\n\t\tthis.stageObserver?.disconnect();\n\t\tcancelAnimationFrame(this.frame);\n\t\twindow.removeEventListener(STAGE_PANEL_LAYOUT_EVENT, this.schedule);\n\t\twindow.removeEventListener('resize', this.handleResize);\n\t\tthis.root.removeEventListener('focusin', this.handleFocus);\n\t\tfor (const region of this.regions) region.removeAttribute('data-stage-fixed-region');\n\t}\n\n\tprivate readonly schedule = () => {\n\t\tif (!this.started || this.frame) return;\n\t\tthis.frame = requestAnimationFrame(() => { this.frame = 0; this.update(); });\n\t};\n\n\tprivate readAnchor() {\n\t\tconst anchor = this.sectionPositions.filter(item => item.top <= this.scrollY + this.readingTop + 1).at(-1);\n\t\treturn anchor ? { element: anchor.element, offset: this.scrollY + this.readingTop - anchor.top } : undefined;\n\t}\n\n\tprivate readonly handleResize = () => {\n\t\t// CSS reflows before the shared viewport probe's next frame. Preserve the\n\t\t// last stable document anchor now, before any observer can cache new boxes\n\t\t// against old metrics. Keep it across consecutive breakpoint crossings.\n\t\tthis.resizeAnchor ??= this.restoreAnchor ?? this.readAnchor();\n\t\tthis.schedule();\n\t};\n\n\tprivate update() {\n\t\tconst metrics = this.readMetrics();\n\t\tif (!metrics || !this.body) return;\n\t\tif (!this.stage?.classList.contains('stage-virtual-scroll-active')) this.scrollY = window.scrollY;\n\t\tconst key = JSON.stringify(metrics);\n\t\tconst metricsChanged = key !== this.metricKey;\n\t\tif (key !== this.metricKey) {\n\t\t\tconst previous = this.layout;\n\t\t\tconst next = resolveDetailLayout(metrics);\n\t\t\tif (previous && previous.composition !== next.composition && this.scrollY > 1) {\n\t\t\t\tthis.restoreAnchor = this.resizeAnchor ?? this.restoreAnchor ?? this.readAnchor();\n\t\t\t}\n\t\t\tif (!this.restoreAnchor) this.resizeAnchor = undefined;\n\t\t\tthis.metricKey = key;\n\t\t\tthis.layout = next;\n\t\t\tconst split = next.composition === 'split';\n\t\t\tthis.root.toggleAttribute('data-spatial-detail-pane', split);\n\t\t\tthis.root.toggleAttribute('data-spatial-detail-flow', next.shortHeightFallback);\n\t\t\tfor (const region of this.regions) region.toggleAttribute('data-stage-fixed-region', split);\n\t\t\tfor (const region of this.hiddenRegions) region.inert = split && this.hidden;\n\t\t\tthis.onMode(split);\n\t\t\t// The framework flushes the native summary ownership before its new box is measured.\n\t\t\tthis.schedule();\n\t\t}\n\t\tconst rect = this.body.getBoundingClientRect();\n\t\t// A breakpoint can remove the paint transform before this resize callback.\n\t\tif (this.layout?.composition !== 'split') this.focusPose = { x: 0, y: 0, scale: 1, opacity: 1, blur: 0, pivotY: 0 };\n\t\tconst bodyHeightChanged = Math.abs(this.bodyHeight - rect.height / this.focusPose.scale) > 0.5;\n\t\tthis.bodyTop = this.neutralY(rect.top) + this.scrollY;\n\t\tthis.bodyHeight = rect.height / this.focusPose.scale;\n\t\tthis.sectionPositions = Array.from(this.body.querySelectorAll<HTMLElement>('[data-spatial-element-tab-target]'))\n\t\t\t.map(element => ({ element, top: this.neutralY(element.getBoundingClientRect().top) + this.scrollY }));\n\t\tthis.readingTop = this.layout?.pane?.body.y ?? (Number.parseFloat(getComputedStyle(this.root).getPropertyValue('--spatial-element-section-scroll-offset')) || 0);\n\t\tconst summaryReady = this.layout?.composition !== 'split' || Boolean(this.body.querySelector('[data-spatial-summary-root]'));\n\t\tif (!metricsChanged && !bodyHeightChanged && summaryReady && this.restoreAnchor && this.restoreAnchor.element.isConnected) {\n\t\t\tconst anchor = this.restoreAnchor;\n\t\t\tthis.restoreAnchor = undefined;\n\t\t\tthis.resizeAnchor = undefined;\n\t\t\tconst y = Math.max(0, this.neutralY(anchor.element.getBoundingClientRect().top) + this.scrollY + anchor.offset - this.readingTop);\n\t\t\twindow.scrollTo({ top: y, behavior: 'instant' });\n\t\t\tsyncStageScrollToNative();\n\t\t\tthis.scrollY = getStageVisualScrollPosition().scrollY;\n\t\t}\n\t\tif (this.restoreAnchor) this.schedule();\n\t\tthis.paint();\n\t}\n\n\tprivate paint() {\n\t\tthis.paintFocus();\n\t\tconst pane = this.layout?.pane;\n\t\tif (!pane || !this.body) {\n\t\t\tthis.root.removeAttribute('data-spatial-detail-pane-clipped');\n\t\t\tthis.body?.style.removeProperty('clip-path');\n\t\t\tthis.root.style.removeProperty('--spatial-pane-fixed-compensation');\n\t\t\treturn;\n\t\t}\n\t\tconst enhanced = this.stage?.classList.contains('stage-virtual-scroll-active');\n\t\tthis.root.style.setProperty('--spatial-pane-fixed-compensation', `${enhanced ? this.scrollY : 0}px`);\n\t\tconst clip = resolvePaneScrollClip(this.bodyTop, this.bodyHeight, pane.body.y, pane.body.y + pane.body.height, this.scrollY);\n\t\tthis.body.style.clipPath = `inset(${clip.top}px 0 ${clip.bottom}px 0 round 0 0 var(--spatial-element-panel-radius) var(--spatial-element-panel-radius))`;\n\t\tthis.root.toggleAttribute('data-spatial-detail-pane-clipped', true);\n\t}\n\n\t/** Measurements remain in document coordinates while the pane moves in paint. */\n\tprivate neutralY(y: number) {\n\t\tconst { scale, pivotY, y: offset } = this.focusPose;\n\t\treturn pivotY + (y - pivotY - offset) / scale;\n\t}\n\n\tprivate paintFocus() {\n\t\tconst pane = this.layout?.pane;\n\t\tconst metrics = this.readMetrics();\n\t\tthis.focusPose = pane && metrics ? resolvePaneFocusPresentation(pane.surface, metrics, this.focus)\n\t\t\t: { x: 0, y: 0, scale: 1, opacity: 1, blur: 0, pivotY: 0 };\n\t\tconst pose = this.focusPose;\n\t\tthis.root.toggleAttribute('data-spatial-detail-pane-zooming', Boolean(pane && this.focus > 0.001));\n\t\tthis.setHidden(Boolean(pane && pose.opacity < 0.12));\n\t\tconst values = { '--spatial-pane-focus-x': `${pose.x}px`, '--spatial-pane-focus-y': `${pose.y}px`,\n\t\t\t'--spatial-pane-focus-scale': String(pose.scale), '--spatial-pane-focus-opacity': String(pose.opacity),\n\t\t\t'--spatial-pane-focus-blur': `${pose.blur}px` };\n\t\tfor (const [name, value] of Object.entries(values)) {\n\t\t\tif (this.root.style.getPropertyValue(name) !== value) this.root.style.setProperty(name, value);\n\t\t}\n\t\tif (!pane || !this.body) return;\n\t\tthis.body.style.setProperty('--spatial-pane-focus-origin-y', `${pose.pivotY - this.bodyTop + this.scrollY}px`);\n\t\tfor (const region of this.regions) {\n\t\t\tconst top = region.hasAttribute('data-spatial-detail-pane-submenu-shell') ? this.layout!.submenu!.y\n\t\t\t\t: region.hasAttribute('data-spatial-detail-pane-header') || region.hasAttribute('data-spatial-detail-pane-surface') ? pane.surface.y : undefined;\n\t\t\tif (top !== undefined) region.style.setProperty('--spatial-pane-focus-origin-y', `${pose.pivotY - top}px`);\n\t\t}\n\t}\n\n\tprivate readonly handleFocus = (event: FocusEvent) => {\n\t\t// VirtualScrollController owns the enhanced path; native DOM uses identical bounds.\n\t\tif (!this.layout?.pane || this.hidden || this.stage?.classList.contains('stage-virtual-scroll-active')) return;\n\t\tconst target = event.target;\n\t\tif (!(target instanceof HTMLElement) || !this.body?.contains(target)) return;\n\t\tconst rect = target.getBoundingClientRect();\n\t\tconst viewport = this.layout.pane.body;\n\t\tconst bottom = Math.min(viewport.y + viewport.height, this.layout.submenu?.y ?? Infinity);\n\t\tif (rect.top >= viewport.y && rect.bottom <= bottom) return;\n\t\twindow.scrollTo({ top: Math.max(0, window.scrollY + rect.top - viewport.y - Math.max(0, (bottom - viewport.y - rect.height) / 2)), behavior: 'instant' });\n\t};\n}\n"]}
1
+ {"version":3,"file":"SpatialElementPaneController.js","sourceRoot":"","sources":["../../src/spatial-element/SpatialElementPaneController.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAA8B,MAAM,uBAAuB,CAAC;AACxF,OAAO,EAAE,wBAAwB,EAAE,MAAM,0BAA0B,CAAC;AACpE,OAAO,EAAE,4BAA4B,EAAE,qBAAqB,EAAE,yBAAyB,EAAE,uBAAuB,EAAE,MAAM,yBAAyB,CAAC;AAClJ,OAAO,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,8BAA8B,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AAClK,OAAO,EAAE,gBAAgB,EAAE,iCAAiC,EAAE,MAAM,4BAA4B,CAAC;AAEjG,oFAAoF;AACpF,MAAM,UAAU,4BAA4B,CAAC,IAA6D,EACzG,QAA2C,EAAE,KAAa;IAC1D,MAAM,QAAQ,GAAG,EAAE,CAAC,EAAE,IAAI,CAAC,CAAC,GAAG,IAAI,CAAC,KAAK,GAAG,CAAC,GAAG,QAAQ,CAAC,KAAK,GAAG,CAAC;QACjE,CAAC,EAAE,QAAQ,CAAC,MAAM,GAAG,CAAC,GAAG,IAAI,CAAC,CAAC,GAAG,IAAI,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;IACrD,MAAM,OAAO,GAAG,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,QAAQ,EAAE,CAAC;IACrE,MAAM,MAAM,GAAG,mBAAmB,CAAC,OAAO,EAAE,KAAK,EAAE,QAAQ,CAAC,KAAK,EAAE,QAAQ,CAAC,MAAM,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C,MAAM,IAAI,IAAI,CAAC,KAAK,EAAE,SAAS,CAAC,QAAQ,CAAC,6BAA6B,CAAC;YAAE,OAAO;QAC/G,MAAM,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC;QAC5B,IAAI,CAAC,CAAC,MAAM,YAAY,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,QAAQ,CAAC,MAAM,CAAC;YAAE,OAAO;QAC7E,MAAM,IAAI,GAAG,MAAM,CAAC,qBAAqB,EAAE,CAAC;QAC5C,MAAM,QAAQ,GAAG,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC;QACvC,MAAM,MAAM,GAAG,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,GAAG,QAAQ,CAAC,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC,IAAI,QAAQ,CAAC,CAAC;QAC1F,IAAI,IAAI,CAAC,GAAG,IAAI,QAAQ,CAAC,CAAC,IAAI,IAAI,CAAC,MAAM,IAAI,MAAM;YAAE,OAAO;QAC5D,MAAM,CAAC,QAAQ,CAAC,EAAE,GAAG,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,MAAM,CAAC,OAAO,GAAG,IAAI,CAAC,GAAG,GAAG,QAAQ,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,MAAM,GAAG,QAAQ,CAAC,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,SAAS,EAAE,CAAC,CAAC;IAC3J,CAAC,CAAC;CACF","sourcesContent":["import { resolveDetailLayout, type ResponsiveLayoutInput } from './responsiveLayout.js';\nimport { STAGE_PANEL_LAYOUT_EVENT } from '../stage/panelContext.js';\nimport { getStageVisualScrollPosition, STAGE_SCROLL_PRIORITY, subscribeStageScrollFrame, syncStageScrollToNative } from '../stage/scrollFrame.js';\nimport { getPanelFocusBlur, getPanelFocusOffset, getPanelFocusOpacity, getPanelFocusPerspectiveOffset, getPerspectiveDistance } from '../stage/panelFocusMath.js';\nimport { PANEL_CAMERA_FOV, PANEL_FOCUS_PERSPECTIVE_MAX_SCALE } from '../stage/stageConstants.js';\n\n/** The native pane uses the same focus curve and camera-facing motion as panels. */\nexport function resolvePaneFocusPresentation(rect: { x: number; y: number; width: number; height: number },\n\tviewport: { width: number; height: number }, focus: number) {\n\tconst position = { x: rect.x + rect.width / 2 - viewport.width / 2,\n\t\ty: viewport.height / 2 - rect.y - rect.height / 2 };\n\tconst options = { width: rect.width, height: rect.height, position };\n\tconst offset = getPanelFocusOffset(options, focus, viewport.width, viewport.height);\n\tconst distance = getPerspectiveDistance(viewport.height, PANEL_CAMERA_FOV);\n\tconst perspective = getPanelFocusPerspectiveOffset({ x: position.x + offset.x, y: position.y + offset.y }, offset.z, distance);\n\treturn { x: offset.x + perspective.x, y: -offset.y - perspective.y,\n\t\tscale: Math.min(PANEL_FOCUS_PERSPECTIVE_MAX_SCALE, Math.max(1, distance / Math.max(distance - offset.z, 1))),\n\t\topacity: getPanelFocusOpacity(focus), blur: getPanelFocusBlur(focus, options),\n\t\tpivotY: rect.y + rect.height / 2 };\n}\n\n/** One document coordinate system; clipping changes paint and hit testing only. */\nexport function resolvePaneScrollClip(bodyTop: number, bodyHeight: number, viewportTop: number, viewportBottom: number, scrollY: number) {\n\treturn {\n\t\ttop: Math.max(0, scrollY + viewportTop - bodyTop),\n\t\tbottom: Math.max(0, bodyTop + bodyHeight - scrollY - viewportBottom)\n\t};\n}\n\n/** Keeps fixed 3XL regions and the ordinary document body on the Stage scroll clock. */\nexport class SpatialElementPaneController {\n\tprivate body?: HTMLElement;\n\tprivate stage?: HTMLElement;\n\tprivate regions: HTMLElement[] = [];\n\tprivate hiddenRegions: HTMLElement[] = [];\n\tprivate observer?: ResizeObserver;\n\tprivate stageObserver?: MutationObserver;\n\tprivate stopScroll?: () => void;\n\tprivate frame = 0;\n\tprivate layout?: ReturnType<typeof resolveDetailLayout>;\n\tprivate metricKey = '';\n\tprivate bodyTop = 0;\n\tprivate bodyHeight = 0;\n\tprivate scrollY = 0;\n\tprivate hidden = false;\n\tprivate focus = 0;\n\tprivate focusPose = { x: 0, y: 0, scale: 1, opacity: 1, blur: 0, pivotY: 0 };\n\tprivate savedScroll?: { x: number; y: number };\n\tprivate sectionPositions: { element: HTMLElement; top: number }[] = [];\n\tprivate restoreAnchor?: { element: HTMLElement; offset: number };\n\tprivate resizeAnchor?: { element: HTMLElement; offset: number };\n\tprivate readingTop = 0;\n\tprivate started = false;\n\n\tconstructor(private readonly root: HTMLElement,\n\t\tprivate readonly readMetrics: () => ResponsiveLayoutInput | undefined,\n\t\tprivate readonly onMode: (split: boolean) => void) {}\n\n\tstart() {\n\t\tif (this.started) return;\n\t\tthis.started = true;\n\t\tthis.stage = this.root.closest<HTMLElement>('.stage') ?? undefined;\n\t\tthis.body = this.root.querySelector<HTMLElement>('[data-spatial-detail-pane-body]') ?? undefined;\n\t\tthis.regions = Array.from(this.root.querySelectorAll<HTMLElement>('[data-spatial-detail-fixed]'));\n\t\tthis.hiddenRegions = Array.from(this.root.querySelectorAll<HTMLElement>('[data-spatial-detail-pane-body], [data-spatial-detail-pane-header], [data-spatial-detail-pane-submenu-shell]'));\n\t\tthis.scrollY = getStageVisualScrollPosition().scrollY;\n\t\tthis.observer = new ResizeObserver(this.schedule);\n\t\tif (this.body) this.observer.observe(this.body);\n\t\tthis.stageObserver = new MutationObserver(this.schedule);\n\t\tif (this.stage) this.stageObserver.observe(this.stage, { attributes: true, attributeFilter: ['class'] });\n\t\twindow.addEventListener(STAGE_PANEL_LAYOUT_EVENT, this.schedule);\n\t\twindow.addEventListener('resize', this.handleResize, { passive: true });\n\t\tthis.root.addEventListener('focusin', this.handleFocus);\n\t\tthis.stopScroll = subscribeStageScrollFrame(frame => {\n\t\t\tthis.scrollY = frame.scrollY;\n\t\t\tthis.paint();\n\t\t}, STAGE_SCROLL_PRIORITY.virtualDocument + 2);\n\t\tthis.update();\n\t}\n\n\tsetHidden(hidden: boolean) {\n\t\tif (this.hidden === hidden) return;\n\t\tthis.hidden = hidden;\n\t\tif (hidden && this.layout?.composition === 'split') this.savedScroll = { x: window.scrollX, y: window.scrollY };\n\t\tthis.root.toggleAttribute('data-spatial-detail-pane-hidden', hidden);\n\t\tfor (const region of this.hiddenRegions) region.inert = hidden;\n\t\tif (!hidden && this.savedScroll) {\n\t\t\twindow.scrollTo({ left: this.savedScroll.x, top: this.savedScroll.y, behavior: 'instant' });\n\t\t\tsyncStageScrollToNative();\n\t\t\tthis.savedScroll = undefined;\n\t\t}\n\t}\n\n\tsetFocus(focus: number, fullscreen = false) {\n\t\tthis.focus = fullscreen ? 1 : Math.max(0, Math.min(1, Number.isFinite(focus) ? focus : 0));\n\t\tthis.paintFocus();\n\t}\n\n\tdestroy() {\n\t\tthis.started = false;\n\t\tthis.stopScroll?.();\n\t\tthis.observer?.disconnect();\n\t\tthis.stageObserver?.disconnect();\n\t\tcancelAnimationFrame(this.frame);\n\t\twindow.removeEventListener(STAGE_PANEL_LAYOUT_EVENT, this.schedule);\n\t\twindow.removeEventListener('resize', this.handleResize);\n\t\tthis.root.removeEventListener('focusin', this.handleFocus);\n\t\tfor (const region of this.regions) region.removeAttribute('data-stage-fixed-region');\n\t}\n\n\tprivate readonly schedule = () => {\n\t\tif (!this.started || this.frame) return;\n\t\tthis.frame = requestAnimationFrame(() => { this.frame = 0; this.update(); });\n\t};\n\n\tprivate readAnchor() {\n\t\tconst anchor = this.sectionPositions.filter(item => item.top <= this.scrollY + this.readingTop + 1).at(-1);\n\t\treturn anchor ? { element: anchor.element, offset: this.scrollY + this.readingTop - anchor.top } : undefined;\n\t}\n\n\tprivate readonly handleResize = () => {\n\t\t// CSS reflows before the shared viewport probe's next frame. Preserve the\n\t\t// last stable document anchor now, before any observer can cache new boxes\n\t\t// against old metrics. Keep it across consecutive breakpoint crossings.\n\t\tthis.resizeAnchor ??= this.restoreAnchor ?? this.readAnchor();\n\t\tthis.schedule();\n\t};\n\n\tprivate update() {\n\t\tconst metrics = this.readMetrics();\n\t\tif (!metrics || !this.body) return;\n\t\tif (!this.stage?.classList.contains('stage-virtual-scroll-active')) this.scrollY = window.scrollY;\n\t\tconst key = JSON.stringify(metrics);\n\t\tconst metricsChanged = key !== this.metricKey;\n\t\tif (key !== this.metricKey) {\n\t\t\tconst previous = this.layout;\n\t\t\tconst next = resolveDetailLayout(metrics);\n\t\t\tif (previous && previous.composition !== next.composition && this.scrollY > 1) {\n\t\t\t\tthis.restoreAnchor = this.resizeAnchor ?? this.restoreAnchor ?? this.readAnchor();\n\t\t\t}\n\t\t\tif (!this.restoreAnchor) this.resizeAnchor = undefined;\n\t\t\tthis.metricKey = key;\n\t\t\tthis.layout = next;\n\t\t\tconst split = next.composition === 'split';\n\t\t\tthis.root.toggleAttribute('data-spatial-detail-pane', split);\n\t\t\tthis.root.toggleAttribute('data-spatial-detail-flow', next.shortHeightFallback);\n\t\t\tfor (const region of this.regions) region.toggleAttribute('data-stage-fixed-region', split);\n\t\t\tfor (const region of this.hiddenRegions) region.inert = this.hidden;\n\t\t\tthis.onMode(split);\n\t\t\t// The framework flushes the native summary ownership before its new box is measured.\n\t\t\tthis.schedule();\n\t\t}\n\t\tconst rect = this.body.getBoundingClientRect();\n\t\t// A breakpoint can remove the paint transform before this resize callback.\n\t\tif (this.layout?.composition !== 'split') this.focusPose = { x: 0, y: 0, scale: 1, opacity: 1, blur: 0, pivotY: 0 };\n\t\tconst bodyHeightChanged = Math.abs(this.bodyHeight - rect.height / this.focusPose.scale) > 0.5;\n\t\tthis.bodyTop = this.neutralY(rect.top) + this.scrollY;\n\t\tthis.bodyHeight = rect.height / this.focusPose.scale;\n\t\tthis.sectionPositions = Array.from(this.body.querySelectorAll<HTMLElement>('[data-spatial-element-tab-target]'))\n\t\t\t.map(element => ({ element, top: this.neutralY(element.getBoundingClientRect().top) + this.scrollY }));\n\t\tthis.readingTop = this.layout?.pane?.body.y ?? (Number.parseFloat(getComputedStyle(this.root).getPropertyValue('--spatial-element-section-scroll-offset')) || 0);\n\t\tconst summaryReady = this.layout?.composition !== 'split' || Boolean(this.body.querySelector('[data-spatial-summary-root]'));\n\t\tif (!metricsChanged && !bodyHeightChanged && summaryReady && this.restoreAnchor && this.restoreAnchor.element.isConnected) {\n\t\t\tconst anchor = this.restoreAnchor;\n\t\t\tthis.restoreAnchor = undefined;\n\t\t\tthis.resizeAnchor = undefined;\n\t\t\tconst y = Math.max(0, this.neutralY(anchor.element.getBoundingClientRect().top) + this.scrollY + anchor.offset - this.readingTop);\n\t\t\twindow.scrollTo({ top: y, behavior: 'instant' });\n\t\t\tsyncStageScrollToNative();\n\t\t\tthis.scrollY = getStageVisualScrollPosition().scrollY;\n\t\t}\n\t\tif (this.restoreAnchor) this.schedule();\n\t\tthis.paint();\n\t}\n\n\tprivate paint() {\n\t\tthis.paintFocus();\n\t\tconst pane = this.layout?.pane;\n\t\tif (!pane || !this.body) {\n\t\t\tthis.root.removeAttribute('data-spatial-detail-pane-clipped');\n\t\t\tthis.body?.style.removeProperty('clip-path');\n\t\t\tthis.root.style.removeProperty('--spatial-pane-fixed-compensation');\n\t\t\treturn;\n\t\t}\n\t\tconst enhanced = this.stage?.classList.contains('stage-virtual-scroll-active');\n\t\tthis.root.style.setProperty('--spatial-pane-fixed-compensation', `${enhanced ? this.scrollY : 0}px`);\n\t\tconst clip = resolvePaneScrollClip(this.bodyTop, this.bodyHeight, pane.body.y, pane.body.y + pane.body.height, this.scrollY);\n\t\tthis.body.style.clipPath = `inset(${clip.top}px 0 ${clip.bottom}px 0 round 0 0 var(--spatial-element-panel-radius) var(--spatial-element-panel-radius))`;\n\t\tthis.root.toggleAttribute('data-spatial-detail-pane-clipped', true);\n\t}\n\n\t/** Measurements remain in document coordinates while the pane moves in paint. */\n\tprivate neutralY(y: number) {\n\t\tconst { scale, pivotY, y: offset } = this.focusPose;\n\t\treturn pivotY + (y - pivotY - offset) / scale;\n\t}\n\n\tprivate paintFocus() {\n\t\tconst pane = this.layout?.pane;\n\t\tconst metrics = this.readMetrics();\n\t\tthis.focusPose = pane && metrics ? resolvePaneFocusPresentation(pane.surface, metrics, this.focus)\n\t\t\t: { x: 0, y: 0, scale: 1, opacity: 1, blur: 0, pivotY: 0 };\n\t\tconst pose = this.focusPose;\n\t\tthis.root.toggleAttribute('data-spatial-detail-pane-zooming', Boolean(pane && this.focus > 0.001));\n\t\tthis.setHidden(getPanelFocusOpacity(this.focus) < 0.12);\n\t\tconst values = { '--spatial-pane-focus-x': `${pose.x}px`, '--spatial-pane-focus-y': `${pose.y}px`,\n\t\t\t'--spatial-pane-focus-scale': String(pose.scale), '--spatial-pane-focus-opacity': String(pose.opacity),\n\t\t\t'--spatial-pane-focus-blur': `${pose.blur}px` };\n\t\tfor (const [name, value] of Object.entries(values)) {\n\t\t\tif (this.root.style.getPropertyValue(name) !== value) this.root.style.setProperty(name, value);\n\t\t}\n\t\tif (!pane || !this.body) return;\n\t\tthis.body.style.setProperty('--spatial-pane-focus-origin-y', `${pose.pivotY - this.bodyTop + this.scrollY}px`);\n\t\tfor (const region of this.regions) {\n\t\t\tconst top = region.hasAttribute('data-spatial-detail-pane-submenu-shell') ? this.layout!.submenu!.y\n\t\t\t\t: region.hasAttribute('data-spatial-detail-pane-header') || region.hasAttribute('data-spatial-detail-pane-surface') ? pane.surface.y : undefined;\n\t\t\tif (top !== undefined) region.style.setProperty('--spatial-pane-focus-origin-y', `${pose.pivotY - top}px`);\n\t\t}\n\t}\n\n\tprivate readonly handleFocus = (event: FocusEvent) => {\n\t\t// VirtualScrollController owns the enhanced path; native DOM uses identical bounds.\n\t\tif (!this.layout?.pane || this.hidden || this.stage?.classList.contains('stage-virtual-scroll-active')) return;\n\t\tconst target = event.target;\n\t\tif (!(target instanceof HTMLElement) || !this.body?.contains(target)) return;\n\t\tconst rect = target.getBoundingClientRect();\n\t\tconst viewport = this.layout.pane.body;\n\t\tconst bottom = Math.min(viewport.y + viewport.height, this.layout.submenu?.y ?? Infinity);\n\t\tif (rect.top >= viewport.y && rect.bottom <= bottom) return;\n\t\twindow.scrollTo({ top: Math.max(0, window.scrollY + rect.top - viewport.y - Math.max(0, (bottom - viewport.y - rect.height) / 2)), behavior: 'instant' });\n\t};\n}\n"]}
@@ -0,0 +1,9 @@
1
+ /** Keep one wheel burst with its original owner, including inertial samples. */
2
+ export declare class DetailWheelGesture {
3
+ private lastTime;
4
+ private owner?;
5
+ reset(): void;
6
+ zooming(now: number): boolean;
7
+ resolve(now: number, hit: boolean, down: boolean, atOverview: boolean, pinch?: boolean): "scroll" | "zoom";
8
+ }
9
+ //# sourceMappingURL=DetailWheelGesture.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DetailWheelGesture.d.ts","sourceRoot":"","sources":["../../src/stage/DetailWheelGesture.ts"],"names":[],"mappings":"AAAA,gFAAgF;AAChF,qBAAa,kBAAkB;IAC9B,OAAO,CAAC,QAAQ,CAAa;IAC7B,OAAO,CAAC,KAAK,CAAC,CAAoB;IAClC,KAAK;IACL,OAAO,CAAC,GAAG,EAAE,MAAM;IACnB,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,KAAK,UAAQ;CAQpF"}
@@ -0,0 +1,16 @@
1
+ /** Keep one wheel burst with its original owner, including inertial samples. */
2
+ export class DetailWheelGesture {
3
+ lastTime = -Infinity;
4
+ owner;
5
+ reset() { this.lastTime = -Infinity; this.owner = undefined; }
6
+ zooming(now) { return this.owner === 'zoom' && now - this.lastTime < 800; }
7
+ resolve(now, hit, down, atOverview, pinch = false) {
8
+ const recent = now - this.lastTime < 800;
9
+ const previous = recent ? this.owner : undefined;
10
+ this.owner = pinch ? 'zoom' : previous === 'scroll' || !hit ||
11
+ (down && atOverview && previous !== 'zoom') ? 'scroll' : 'zoom';
12
+ this.lastTime = now;
13
+ return this.owner;
14
+ }
15
+ }
16
+ //# sourceMappingURL=DetailWheelGesture.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DetailWheelGesture.js","sourceRoot":"","sources":["../../src/stage/DetailWheelGesture.ts"],"names":[],"mappings":"AAAA,gFAAgF;AAChF,MAAM,OAAO,kBAAkB;IACtB,QAAQ,GAAG,CAAC,QAAQ,CAAC;IACrB,KAAK,CAAqB;IAClC,KAAK,KAAK,IAAI,CAAC,QAAQ,GAAG,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,KAAK,GAAG,SAAS,CAAC,CAAC,CAAC;IAC9D,OAAO,CAAC,GAAW,IAAI,OAAO,IAAI,CAAC,KAAK,KAAK,MAAM,IAAI,GAAG,GAAG,IAAI,CAAC,QAAQ,GAAG,GAAG,CAAC,CAAC,CAAC;IACnF,OAAO,CAAC,GAAW,EAAE,GAAY,EAAE,IAAa,EAAE,UAAmB,EAAE,KAAK,GAAG,KAAK;QACnF,MAAM,MAAM,GAAG,GAAG,GAAG,IAAI,CAAC,QAAQ,GAAG,GAAG,CAAC;QACzC,MAAM,QAAQ,GAAG,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC;QACjD,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,QAAQ,KAAK,QAAQ,IAAI,CAAC,GAAG;YAC1D,CAAC,IAAI,IAAI,UAAU,IAAI,QAAQ,KAAK,MAAM,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC;QACjE,IAAI,CAAC,QAAQ,GAAG,GAAG,CAAC;QACpB,OAAO,IAAI,CAAC,KAAK,CAAC;IACnB,CAAC;CACD","sourcesContent":["/** Keep one wheel burst with its original owner, including inertial samples. */\nexport class DetailWheelGesture {\n\tprivate lastTime = -Infinity;\n\tprivate owner?: 'scroll' | 'zoom';\n\treset() { this.lastTime = -Infinity; this.owner = undefined; }\n\tzooming(now: number) { return this.owner === 'zoom' && now - this.lastTime < 800; }\n\tresolve(now: number, hit: boolean, down: boolean, atOverview: boolean, pinch = false) {\n\t\tconst recent = now - this.lastTime < 800;\n\t\tconst previous = recent ? this.owner : undefined;\n\t\tthis.owner = pinch ? 'zoom' : previous === 'scroll' || !hit ||\n\t\t\t(down && atOverview && previous !== 'zoom') ? 'scroll' : 'zoom';\n\t\tthis.lastTime = now;\n\t\treturn this.owner;\n\t}\n}\n"]}
@@ -5,6 +5,8 @@ export interface LiquidGlassPanelOptions {
5
5
  width?: number;
6
6
  height?: number;
7
7
  radius?: number;
8
+ /** Keep the lower corners square when a panel joins the content below it. */
9
+ squareBottom?: boolean;
8
10
  position?: {
9
11
  x: number;
10
12
  y: number;
@@ -1 +1 @@
1
- {"version":3,"file":"LiquidGlassPanel.d.ts","sourceRoot":"","sources":["../../src/stage/LiquidGlassPanel.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,cAAc,CAAC;AA6BtC,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,OAAO,CAAC;AACjD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAOzC,MAAM,WAAW,uBAAuB;IACvC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE;QAAE,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IACpC,gEAAgE;IAChE,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,uFAAuF;IACvF,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,IAAI,CAAC,EAAE,mBAAmB,CAAC;IAC3B,8EAA8E;IAC9E,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,4DAA4D;IAC5D,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,kEAAkE;IAClE,SA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;IA0CzE,OAAO;CAWP;AAqID;;;GAGG;AACH,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,GAkCQ,IAAI,CAAC,MAAM,CAAC,CAC9E"}
@@ -8,6 +8,7 @@ const DEFAULT_OPTIONS = {
8
8
  width: 360,
9
9
  height: 230,
10
10
  radius: 42,
11
+ squareBottom: false,
11
12
  position: { x: 0, y: 42 },
12
13
  backdropBlur: 5,
13
14
  refraction: 12,
@@ -34,6 +35,7 @@ export function resolveLiquidGlassPanelOptions(options = {}) {
34
35
  ...merged,
35
36
  width,
36
37
  height,
38
+ squareBottom: options.squareBottom === true,
37
39
  radius: clampFinite(merged.radius, 0, Math.min(width, height) * 0.5, DEFAULT_OPTIONS.radius),
38
40
  position: {
39
41
  x: finiteOr(merged.position.x, DEFAULT_OPTIONS.position.x),
@@ -87,11 +89,11 @@ export class LiquidGlassPanel {
87
89
  };
88
90
  this.backdropProjection = createBackdropProjectionUniforms(this.options);
89
91
  this.group.position.set(this.options.position.x, this.options.position.y, 0);
90
- this.backdropGeometry = createRoundedGridGeometry(this.geometryOptions.width, this.geometryOptions.height, this.geometryOptions.radius, 128, 82);
91
- this.bezelGeometry = createRoundedBandGeometry(this.geometryOptions.width, this.geometryOptions.height, this.geometryOptions.radius, -this.geometryOptions.bezel, 14, 1.7);
92
+ this.backdropGeometry = createRoundedGridGeometry(this.geometryOptions.width, this.geometryOptions.height, this.geometryOptions.radius, 128, 82, undefined, this.options.squareBottom);
93
+ this.bezelGeometry = createRoundedBandGeometry(this.geometryOptions.width, this.geometryOptions.height, this.geometryOptions.radius, -this.geometryOptions.bezel, 14, 1.7, this.options.squareBottom);
92
94
  this.shadowLayers = PANEL_SHADOW_RECIPE.map((layer, index) => {
93
95
  const shadowStrength = resolvePanelShadowStrength(this.options.shadowIntensity);
94
- const geometry = createRoundedBandGeometry(this.geometryOptions.width, this.geometryOptions.height, this.geometryOptions.radius, layer.blur * WEBGPU_SHADOW_EXTENT_PER_BLUR, Math.max(8, Math.round(layer.blur)), 2.1);
96
+ const geometry = createRoundedBandGeometry(this.geometryOptions.width, this.geometryOptions.height, this.geometryOptions.radius, layer.blur * WEBGPU_SHADOW_EXTENT_PER_BLUR, Math.max(8, Math.round(layer.blur)), 2.1, this.options.squareBottom);
95
97
  const material = createVertexAlphaMaterial(0x000000, shadowStrength * layer.alphaScale * WEBGPU_SHADOW_EDGE_COMPENSATION);
96
98
  const mesh = new THREE.Mesh(geometry, material);
97
99
  mesh.position.set(0, -layer.offsetY, 0);
@@ -172,11 +174,11 @@ export class LiquidGlassPanel {
172
174
  this.backdropProjection.panelSize.value.set(nextWidth, nextHeight);
173
175
  this.backdropProjection.radius.value = nextRadius;
174
176
  this.backdropProjection.bezel.value = nextBezel;
175
- createRoundedGridGeometry(nextWidth, nextHeight, nextRadius, 128, 82, this.backdropGeometry);
176
- copyGeometry(this.bezelGeometry, createRoundedBandGeometry(nextWidth, nextHeight, nextRadius, -nextBezel, 14, 1.7));
177
+ createRoundedGridGeometry(nextWidth, nextHeight, nextRadius, 128, 82, this.backdropGeometry, this.options.squareBottom);
178
+ copyGeometry(this.bezelGeometry, createRoundedBandGeometry(nextWidth, nextHeight, nextRadius, -nextBezel, 14, 1.7, this.options.squareBottom));
177
179
  this.shadowLayers.forEach(({ geometry }, index) => {
178
180
  const layer = PANEL_SHADOW_RECIPE[index];
179
- copyGeometry(geometry, createRoundedBandGeometry(nextWidth, nextHeight, nextRadius, layer.blur * WEBGPU_SHADOW_EXTENT_PER_BLUR, Math.max(8, Math.round(layer.blur)), 2.1));
181
+ copyGeometry(geometry, createRoundedBandGeometry(nextWidth, nextHeight, nextRadius, layer.blur * WEBGPU_SHADOW_EXTENT_PER_BLUR, Math.max(8, Math.round(layer.blur)), 2.1, this.options.squareBottom));
180
182
  });
181
183
  }
182
184
  dispose() {
@@ -246,6 +248,7 @@ function createBackdropProjectionUniforms(options) {
246
248
  uvScale: uniform(new THREE.Vector2(1, 1)),
247
249
  panelSize: uniform(new THREE.Vector2(options.width, options.height)),
248
250
  radius: uniform(options.radius),
251
+ squareBottom: uniform(options.squareBottom ? 1 : 0),
249
252
  bezel: uniform(options.bezel),
250
253
  refraction: uniform(options.refraction)
251
254
  };
@@ -258,7 +261,8 @@ function createBackdropProjectionUniforms(options) {
258
261
  function createBackdropUvNode(projection) {
259
262
  const localPosition = positionLocal.xy;
260
263
  const halfSize = projection.panelSize.mul(0.5);
261
- const radius = tslMin(projection.radius, tslMin(halfSize.x, halfSize.y));
264
+ const radius = tslMin(projection.radius, tslMin(halfSize.x, halfSize.y))
265
+ .mul(oneMinus(projection.squareBottom.mul(oneMinus(step(0, localPosition.y)))));
262
266
  const signedDistance = roundedRectSdfNode(localPosition, halfSize, radius);
263
267
  const insideDistance = tslMax(signedDistance.negate(), 0);
264
268
  const edge = oneMinus(smoothstep(0, tslMax(projection.bezel, 0.0001), insideDistance)).mul(step(0.0001, projection.bezel));
@@ -334,7 +338,7 @@ function createVertexAlphaMaterial(color, opacity, blending = THREE.NormalBlendi
334
338
  return material;
335
339
  }
336
340
  const roundedGridVertices = new WeakMap();
337
- function createRoundedGridGeometry(width, height, radius, columns, rows, geometry = new THREE.BufferGeometry()) {
341
+ function createRoundedGridGeometry(width, height, radius, columns, rows, geometry = new THREE.BufferGeometry(), squareBottom = false) {
338
342
  const halfWidth = width * 0.5;
339
343
  const halfHeight = height * 0.5;
340
344
  const r = Math.min(radius, halfWidth, halfHeight);
@@ -365,9 +369,10 @@ function createRoundedGridGeometry(width, height, radius, columns, rows, geometr
365
369
  return existing;
366
370
  let x = -halfWidth + (gridX / columns) * width;
367
371
  let y = -halfHeight + (gridY / rows) * height;
368
- const distance = roundedRectSdf(x, y, halfWidth, halfHeight, r);
372
+ const cornerRadius = squareBottom && y < 0 ? 0 : r;
373
+ const distance = roundedRectSdf(x, y, halfWidth, halfHeight, cornerRadius);
369
374
  if (distance > 0) {
370
- const gradient = roundedRectGradient(x, y, halfWidth, halfHeight, r);
375
+ const gradient = roundedRectGradient(x, y, halfWidth, halfHeight, cornerRadius);
371
376
  x -= gradient.x * distance;
372
377
  y -= gradient.y * distance;
373
378
  }
@@ -386,7 +391,8 @@ function createRoundedGridGeometry(width, height, radius, columns, rows, geometr
386
391
  const y1 = -halfHeight + ((y + 1) / rows) * height;
387
392
  const centerX = -halfWidth + ((x + 0.5) / columns) * width;
388
393
  const centerY = -halfHeight + ((y + 0.5) / rows) * height;
389
- const inside = roundedRectSdf(centerX, centerY, halfWidth, halfHeight, r) <= 0 ||
394
+ const inside = (squareBottom && centerY < 0) ||
395
+ roundedRectSdf(centerX, centerY, halfWidth, halfHeight, r) <= 0 ||
390
396
  roundedRectSdf(x0, y0, halfWidth, halfHeight, r) <= 0 ||
391
397
  roundedRectSdf(x1, y0, halfWidth, halfHeight, r) <= 0 ||
392
398
  roundedRectSdf(x0, y1, halfWidth, halfHeight, r) <= 0 ||
@@ -415,7 +421,7 @@ function createRoundedGridGeometry(width, height, radius, columns, rows, geometr
415
421
  geometry.computeBoundingSphere();
416
422
  return geometry;
417
423
  }
418
- function createRoundedBandGeometry(width, height, radius, spread, rings, alphaPower) {
424
+ function createRoundedBandGeometry(width, height, radius, spread, rings, alphaPower, squareBottom = false) {
419
425
  const positions = [];
420
426
  const colors = [];
421
427
  const indices = [];
@@ -427,7 +433,7 @@ function createRoundedBandGeometry(width, height, radius, spread, rings, alphaPo
427
433
  const ringHeight = Math.max(1, height + offset * 2);
428
434
  const ringRadius = Math.max(0, Math.min(radius + offset, ringWidth * 0.5, ringHeight * 0.5));
429
435
  const alpha = Math.pow(1 - t, alphaPower);
430
- const points = createRoundedRectPoints(ringWidth, ringHeight, ringRadius, pointsPerRing / 4);
436
+ const points = createRoundedRectPoints(ringWidth, ringHeight, ringRadius, pointsPerRing / 4, squareBottom);
431
437
  points.forEach(({ x, y }) => {
432
438
  positions.push(x, y, 0);
433
439
  colors.push(1, 1, 1, alpha);
@@ -451,7 +457,7 @@ function createRoundedBandGeometry(width, height, radius, spread, rings, alphaPo
451
457
  geometry.computeVertexNormals();
452
458
  return geometry;
453
459
  }
454
- function createRoundedRectPoints(width, height, radius, segmentsPerCorner) {
460
+ function createRoundedRectPoints(width, height, radius, segmentsPerCorner, squareBottom = false) {
455
461
  const halfWidth = width * 0.5;
456
462
  const halfHeight = height * 0.5;
457
463
  const r = Math.min(radius, halfWidth, halfHeight);
@@ -462,13 +468,14 @@ function createRoundedRectPoints(width, height, radius, segmentsPerCorner) {
462
468
  { x: -halfWidth + r, y: halfHeight - r, start: Math.PI, end: Math.PI * 0.5 }
463
469
  ];
464
470
  const points = [];
465
- corners.forEach((corner) => {
471
+ corners.forEach((corner, index) => {
472
+ const square = squareBottom && (index === 1 || index === 2);
466
473
  for (let step = 0; step < segmentsPerCorner; step += 1) {
467
474
  const t = step / segmentsPerCorner;
468
475
  const angle = THREE.MathUtils.lerp(corner.start, corner.end, t);
469
476
  points.push({
470
- x: corner.x + Math.cos(angle) * r,
471
- y: corner.y + Math.sin(angle) * r
477
+ x: square ? (index === 1 ? halfWidth : -halfWidth) : corner.x + Math.cos(angle) * r,
478
+ y: square ? -halfHeight : corner.y + Math.sin(angle) * r
472
479
  });
473
480
  }
474
481
  });