@wildo-ai/presets-components-3d 1.1.10 → 1.1.12
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/dist/esm/focal-plane/focal-plane-depth-axis.d.ts +17 -0
- package/dist/esm/focal-plane/focal-plane-depth-axis.d.ts.map +1 -0
- package/dist/esm/focal-plane/focal-plane-depth-axis.js +59 -0
- package/dist/esm/focal-plane/focal-plane-depth-axis.js.map +1 -0
- package/dist/esm/focal-plane/focal-plane-settings.d.ts.map +1 -1
- package/dist/esm/focal-plane/focal-plane-settings.js.map +1 -1
- package/dist/esm/focal-plane/focal-plane-shell-container.d.ts.map +1 -1
- package/dist/esm/focal-plane/focal-plane-shell-container.js +10 -119
- package/dist/esm/focal-plane/focal-plane-shell-container.js.map +1 -1
- package/dist/esm/focal-plane/focal-plane-stylesheet.d.ts +2 -9
- package/dist/esm/focal-plane/focal-plane-stylesheet.d.ts.map +1 -1
- package/dist/esm/focal-plane/focal-plane-stylesheet.js +41 -80
- package/dist/esm/focal-plane/focal-plane-stylesheet.js.map +1 -1
- package/dist/esm/focal-plane/focal-plane-vanishing-point.d.ts +27 -0
- package/dist/esm/focal-plane/focal-plane-vanishing-point.d.ts.map +1 -0
- package/dist/esm/focal-plane/focal-plane-vanishing-point.js +21 -0
- package/dist/esm/focal-plane/focal-plane-vanishing-point.js.map +1 -0
- package/dist/esm/frame/frame-3d-style.d.ts +24 -4
- package/dist/esm/frame/frame-3d-style.d.ts.map +1 -1
- package/dist/esm/frame/frame-3d-style.js +86 -6
- package/dist/esm/frame/frame-3d-style.js.map +1 -1
- package/dist/esm/frame/frame-appearance.js.map +1 -1
- package/dist/esm/frame/frame-canvas.js.map +1 -1
- package/dist/esm/frame/frame-canvas.lazy.js.map +1 -1
- package/dist/esm/frame/frame-color.d.ts.map +1 -1
- package/dist/esm/frame/frame-color.js.map +1 -1
- package/dist/esm/frame/frame-driver.js.map +1 -1
- package/dist/esm/frame/frame-renderer.js.map +1 -1
- package/dist/esm/frame/frame-shaders.d.ts.map +1 -1
- package/dist/esm/frame/frame-shaders.js.map +1 -1
- package/dist/esm/frame/use-frame-appearance.d.ts +1 -1
- package/dist/esm/frame/use-frame-appearance.js +3 -3
- package/dist/esm/frame/use-frame-appearance.js.map +1 -1
- package/dist/esm/index.d.ts +0 -1
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +0 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/layout/header-first-shell-container.js.map +1 -1
- package/dist/esm/layout/layout-3d-definition.d.ts +5 -7
- package/dist/esm/layout/layout-3d-definition.d.ts.map +1 -1
- package/dist/esm/layout/layout-3d-definition.js +1 -1
- package/dist/esm/layout/layout-3d-definition.js.map +1 -1
- package/dist/esm/layout/layout-3d-transition-choreography.d.ts.map +1 -1
- package/dist/esm/layout/layout-3d-transition-choreography.js.map +1 -1
- package/dist/esm/layout/layout-3d-vocabulary.d.ts.map +1 -1
- package/dist/esm/layout/layout-3d-vocabulary.js.map +1 -1
- package/dist/esm/layout-3d-main-container.d.ts +13 -18
- package/dist/esm/layout-3d-main-container.d.ts.map +1 -1
- package/dist/esm/layout-3d-main-container.js +7 -15
- package/dist/esm/layout-3d-main-container.js.map +1 -1
- package/dist/esm/register-3d-layout.d.ts +8 -4
- package/dist/esm/register-3d-layout.d.ts.map +1 -1
- package/dist/esm/register-3d-layout.js +16 -36
- package/dist/esm/register-3d-layout.js.map +1 -1
- package/dist/esm/shell-region-measurement.js.map +1 -1
- package/dist/esm/tokens/design-token-resolution.js.map +1 -1
- package/dist/esm/tokens/use-design-token-resolution.js.map +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +8 -6
- package/dist/esm/focal-plane/use-pane-depth.d.ts +0 -20
- package/dist/esm/focal-plane/use-pane-depth.d.ts.map +0 -1
- package/dist/esm/focal-plane/use-pane-depth.js +0 -162
- package/dist/esm/focal-plane/use-pane-depth.js.map +0 -1
- package/dist/esm/focal-plane/use-shared-vanishing-point.d.ts +0 -35
- package/dist/esm/focal-plane/use-shared-vanishing-point.d.ts.map +0 -1
- package/dist/esm/focal-plane/use-shared-vanishing-point.js +0 -86
- package/dist/esm/focal-plane/use-shared-vanishing-point.js.map +0 -1
- package/dist/esm/layout/shell-layout-placement.d.ts +0 -26
- package/dist/esm/layout/shell-layout-placement.d.ts.map +0 -1
- package/dist/esm/layout/shell-layout-placement.js +0 -18
- package/dist/esm/layout/shell-layout-placement.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"frame-canvas.js","sourceRoot":"","sources":["../../../../src/frame/frame-canvas.tsx"],"names":[],"mappings":";AAAA,OAAc,EAAE,eAAe,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AACvD,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAuC,MAAM,oBAAoB,CAAC;AAG3F,OAAO,EAAE,iBAAiB,EAAoB,MAAM,gBAAgB,CAAC;AACrE,OAAO,EAAE,aAAa,EAA+B,MAAM,kBAAkB,CAAC;AAE9E,OAAO,EAAE,cAAc,EAAoE,MAAM,gCAAgC,CAAC;AAElI;;;;GAIG;AACH,MAAM,iBAAiB,GAAG,GAA8B,EAAE,CAAC,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAC,EAAE,CAAC,CAAC;AAE7F;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG;IACnC,IAAI,EAAE,IAAI;IACV,SAAS,EAAE,OAAO;IAClB,EAAE,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,eAAe,EAAE,WAAW,EAAE;IAClE,MAAM,EAAE,iBAAiB;IACzB,KAAK,EAAE,EAAE,aAAa,EAAE,MAAM,EAAE;CACO,CAAC;AAqB1C;;;GAGG;AACH,MAAM,UAAU,oBAAoB,CAAC,MAAsB;IACzD,QAAQ,MAAM,EAAE,CAAC;QACf,KAAK,cAAc,CAAC,iBA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,CAAC;IAEjB,iGAAiG;IACjG,eAAe,CAAC,GAAG,EAAE;QACnB,aAAa,CAAC,OAAO,GAAG,mBAAmB,CAAC;QAC5C,SAAS,CAAC,OAAO,EAAE,aAAa,CAAC,mBAAmB,CAAC,CAAC;IACxD,CAAC,EAAE,CAAC,mBAAmB,CAAC,CAAC,CAAC;IAC1B,eAAe,CAAC,GAAG,EAAE;QACnB,cAAc,CAAC,OAAO,GAAG,WAAW,CAAC;QACrC,SAAS,CAAC,OAAO,EAAE,cAAc,CAAC,WAAW,CAAC,CAAC;IACjD,CAAC,EAAE,CAAC,WAAW,CAAC,CAAC,CAAC;IAElB,iHAAiH;IACjH,kDAAkD;IAClD,eAAe,CAAC,GAAG,EAAE;QACnB,SAAS,CAAC,OAAO,EAAE,MAAM,EAAE,CAAC;IAC9B,CAAC,EAAE,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,CAAC;IAEnC,OAAO,gBAAO,GAAG,EAAE,QAAQ,GAAI,CAAC;AAClC,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,eAAe,CAAC,MAAmB,EAAE,OAA+B;IAClF,MAAM,SAAS,GAAG,6BAA6B,OAAO,EAAE,CAAC;IACzD,MAAM,CAAC,YAAY,CAAC,SAAS,EAAE,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,YAAY,CAAC,SAAS,CAAC,IAAI,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;AAC5F,CAAC","sourcesContent":["import React, { useLayoutEffect, useRef } from 'react';\nimport { Canvas, useThree, type CanvasProps, type EventManager } from '@react-three/fiber';\nimport { Group } from 'three';\n\nimport { createFrameDriver, type FrameDriver } from './frame-driver';\nimport { FrameRenderer, type FrameTransitionTrigger } from './frame-renderer';\nimport type { FrameAppearance } from './frame-appearance';\nimport { Layout3DCamera, type Layout3DFrameChoreography, type Layout3DZoneFocusTransition } from '../layout/layout-3d-vocabulary';\n\n/**\n * The frame receives no pointer events and handles none. fiber's wrapper would otherwise set\n * `pointer-events: auto` inline and attach its listeners, making a full-viewport canvas a hit target wherever\n * the shell root does not cover it. Hover is read from the DOCUMENT instead (see {@link FrameScene}).\n */\nconst NO_POINTER_EVENTS = (): EventManager<HTMLElement> => ({ enabled: false, priority: 0 });\n\n/**\n * Every `<Canvas>` setting the frame depends on, in one place so a test pins them.\n *\n * - `flat`: no tone mapping. The shaders write sRGB-encoded colours as given; tone mapping would move every\n * colour after the contrast bound was checked.\n * - `frameloop: 'never'`: fiber renders nothing on its own. The scene renders when a region moved, when the\n * appearance changed, and per animation frame only while something animates — so an idle shell costs zero frames.\n * - `powerPreference: 'low-power'`: a decorative frame must not wake a discrete GPU.\n */\nexport const FRAME_CANVAS_SETTINGS = {\n flat: true,\n frameloop: 'never',\n gl: { alpha: true, antialias: true, powerPreference: 'low-power' },\n events: NO_POINTER_EVENTS,\n style: { pointerEvents: 'none' },\n} satisfies Omit<CanvasProps, 'children'>;\n\nexport interface FrameCanvasProps {\n /** Computed in the DOM tree (`useFrameAppearance`); the canvas reads no context of its own. */\n appearance: FrameAppearance | null;\n /** The layout's camera. */\n camera: Layout3DCamera;\n /** Whether the layout's transitions cross-fade an appearance change (`crossFadesAppearance`). */\n crossFadeAppearance: boolean;\n /** What the layout plays on a navigation (#1826). */\n navigationTransition: Layout3DFrameChoreography;\n /** What the layout plays when the sidebar collapses, expands or is resized (#1826). */\n sidebarResizeTransition: Layout3DFrameChoreography;\n /** What the layout shows for the focused zone (#1826). */\n zoneFocusTransition: Layout3DZoneFocusTransition;\n /** The content's identity, from the navigation state: a change plays the navigation transition. */\n navigationSignature: string;\n /** The navigation state's focused zone, or null. */\n focusedZone: string | null;\n}\n\n/**\n * The `<Canvas>` camera for a layout's camera. Exhaustive over {@link Layout3DCamera}: a camera added for #1826\n * fails to compile here until the frame can draw through it.\n */\nexport function canvasCameraSettings(camera: Layout3DCamera): Pick<CanvasProps, 'orthographic' | 'camera'> {\n switch (camera) {\n case Layout3DCamera.FLAT_ORTHOGRAPHIC:\n // Orthographic with zoom 1: one scene unit is one CSS pixel, so a slab lies exactly on its region's box.\n return { orthographic: true, camera: { position: [0, 0, 10], zoom: 1 } };\n case Layout3DCamera.STILL_PERSPECTIVE:\n // A still-perspective layout carries its depth in its own HTML objects; the frame is never mounted for it.\n throw new Error('The 3D frame does not draw a still-perspective layout: its placement stages the objects itself.');\n default: {\n const unsupported: never = camera;\n throw new Error(`The 3D frame has no camera '${String(unsupported)}'.`);\n }\n }\n}\n\n/**\n * The 3D frame (#1823): an in-scene background derived from the theme tokens, and a frosted slab under every\n * shell region, aligned to the region's box. Everything inside the regions stays the 2D shell's HTML; this\n * canvas draws only what is behind them, and holds meshes only.\n */\nexport default function FrameCanvas({ camera, ...scene }: FrameCanvasProps): React.JSX.Element {\n return (\n <div aria-hidden=\"true\" data-frame-3d=\"frame\" className=\"fixed inset-0 pointer-events-none\">\n <Canvas {...FRAME_CANVAS_SETTINGS} {...canvasCameraSettings(camera)}>\n <FrameScene {...scene} />\n </Canvas>\n </div>\n );\n}\n\n/**\n * The scene host: creates the renderer and the scheduling driver (`createFrameDriver`, which decides WHEN to draw)\n * and forwards the appearance prop to it. Everything about timing lives in the driver, where it is unit-tested.\n */\nfunction FrameScene({\n appearance,\n crossFadeAppearance,\n navigationTransition,\n sidebarResizeTransition,\n zoneFocusTransition,\n navigationSignature,\n focusedZone,\n}: Omit<FrameCanvasProps, 'camera'>): React.JSX.Element {\n const groupRef = useRef<Group>(null);\n const gl = useThree((state) => state.gl);\n const scene = useThree((state) => state.scene);\n const camera = useThree((state) => state.camera);\n const get = useThree((state) => state.get);\n const size = useThree((state) => state.size);\n const dpr = useThree((state) => state.viewport.dpr);\n const driverRef = useRef<FrameDriver | null>(null);\n // The latest inputs, so a driver re-created for a new renderer or camera starts from them (not from nothing): its\n // first navigation signature only records, so a re-creation never plays a navigation that did not happen.\n const appearanceRef = useRef(appearance);\n const navigationRef = useRef(navigationSignature);\n const focusedZoneRef = useRef(focusedZone);\n\n useLayoutEffect(() => {\n const group = groupRef.current;\n if (!group) return undefined;\n const renderer = new FrameRenderer(group, { navigation: navigationTransition, sidebarResize: sidebarResizeTransition, zoneFocus: zoneFocusTransition });\n const driver = createFrameDriver(\n {\n renderer,\n renderScene: () => gl.render(scene, camera),\n // The canvas' own size from fiber's store: the number the camera frustum was fitted to.\n viewport: () => ({ width: get().size.width, height: get().size.height }),\n canvas: gl.domElement,\n document,\n requestFrame: (callback) => requestAnimationFrame(callback),\n cancelFrame: (handle) => cancelAnimationFrame(handle),\n now: () => performance.now(),\n createResizeObserver: (callback) => new ResizeObserver(callback),\n createMutationObserver: (callback) => new MutationObserver(callback),\n crossFadeAppearance,\n onTransitionStarted: (trigger) => countTransition(gl.domElement, trigger),\n },\n appearanceRef.current,\n );\n driver.setNavigation(navigationRef.current);\n driver.setFocusedZone(focusedZoneRef.current);\n driverRef.current = driver;\n return () => {\n driver.dispose();\n renderer.dispose();\n driverRef.current = null;\n };\n }, [gl, scene, camera, get, crossFadeAppearance, navigationTransition, sidebarResizeTransition, zoneFocusTransition]);\n\n // The appearance changed (theme, mode, reduced motion). Declared AFTER the scene effect, so the driver exists.\n useLayoutEffect(() => {\n if (appearanceRef.current === appearance) return;\n appearanceRef.current = appearance;\n driverRef.current?.setAppearance(appearance);\n }, [appearance]);\n\n // The content or the focused zone changed (#1826). After the scene effect, so the driver exists.\n useLayoutEffect(() => {\n navigationRef.current = navigationSignature;\n driverRef.current?.setNavigation(navigationSignature);\n }, [navigationSignature]);\n useLayoutEffect(() => {\n focusedZoneRef.current = focusedZone;\n driverRef.current?.setFocusedZone(focusedZone);\n }, [focusedZone]);\n\n // The canvas resized, or its pixel ratio changed: fiber has re-fitted the camera and cleared the drawing buffer,\n // so redraw even if every region is where it was.\n useLayoutEffect(() => {\n driverRef.current?.redraw();\n }, [size.width, size.height, dpr]);\n\n return <group ref={groupRef} />;\n}\n\n/**\n * Counts each started transition on the canvas element, as `data-frame-3d-transitions-<trigger>`. The frame's only\n * observable surface for WHICH choreography ran: a live probe (`scripts/presets-3d-live-probe`) reads it, because\n * counting draws cannot tell a choreography from a hover or a re-layout. Writes a number, nothing else.\n */\nexport function countTransition(canvas: HTMLElement, trigger: FrameTransitionTrigger): void {\n const attribute = `data-frame-3d-transitions-${trigger}`;\n canvas.setAttribute(attribute, String(Number(canvas.getAttribute(attribute) ?? '0') + 1));\n}\n"]}
|
|
1
|
+
{"version":3,"file":"frame-canvas.js","sourceRoot":"","sources":["../../../src/frame/frame-canvas.tsx"],"names":[],"mappings":";AAAA,OAAc,EAAE,eAAe,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AACvD,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAuC,MAAM,oBAAoB,CAAC;AAG3F,OAAO,EAAE,iBAAiB,EAAoB,MAAM,gBAAgB,CAAC;AACrE,OAAO,EAAE,aAAa,EAA+B,MAAM,kBAAkB,CAAC;AAE9E,OAAO,EAAE,cAAc,EAAoE,MAAM,gCAAgC,CAAC;AAElI;;;;GAIG;AACH,MAAM,iBAAiB,GAAG,GAA8B,EAAE,CAAC,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAC,EAAE,CAAC,CAAC;AAE7F;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG;IACnC,IAAI,EAAE,IAAI;IACV,SAAS,EAAE,OAAO;IAClB,EAAE,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,eAAe,EAAE,WAAW,EAAE;IAClE,MAAM,EAAE,iBAAiB;IACzB,KAAK,EAAE,EAAE,aAAa,EAAE,MAAM,EAAE;CACO,CAAC;AAqB1C;;;GAGG;AACH,MAAM,UAAU,oBAAoB,CAAC,MAAsB;IACzD,QAAQ,MAAM,EAAE,CAAC;QACf,KAAK,cAAc,CAAC,iBAAiB;YACnC,yGAAyG;YACzG,OAAO,EAAE,YAAY,EAAE,IAAI,EA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,aAAa,CAAC,OAAO,GAAG,mBAAmB,CAAC;QAC5C,SAAS,CAAC,OAAO,EAAE,aAAa,CAAC,mBAAmB,CAAC,CAAC;IACxD,CAAC,EAAE,CAAC,mBAAmB,CAAC,CAAC,CAAC;IAC1B,eAAe,CAAC,GAAG,EAAE;QACnB,cAAc,CAAC,OAAO,GAAG,WAAW,CAAC;QACrC,SAAS,CAAC,OAAO,EAAE,cAAc,CAAC,WAAW,CAAC,CAAC;IACjD,CAAC,EAAE,CAAC,WAAW,CAAC,CAAC,CAAC;IAElB,iHAAiH;IACjH,kDAAkD;IAClD,eAAe,CAAC,GAAG,EAAE;QACnB,SAAS,CAAC,OAAO,EAAE,MAAM,EAAE,CAAC;IAC9B,CAAC,EAAE,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,CAAC;IAEnC,OAAO,gBAAO,GAAG,EAAE,QAAQ,GAAI,CAAC;AAClC,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,eAAe,CAAC,MAAmB,EAAE,OAA+B;IAClF,MAAM,SAAS,GAAG,6BAA6B,OAAO,EAAE,CAAC;IACzD,MAAM,CAAC,YAAY,CAAC,SAAS,EAAE,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,YAAY,CAAC,SAAS,CAAC,IAAI,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;AAC5F,CAAC","sourcesContent":["import React, { useLayoutEffect, useRef } from 'react';\nimport { Canvas, useThree, type CanvasProps, type EventManager } from '@react-three/fiber';\nimport { Group } from 'three';\n\nimport { createFrameDriver, type FrameDriver } from './frame-driver';\nimport { FrameRenderer, type FrameTransitionTrigger } from './frame-renderer';\nimport type { FrameAppearance } from './frame-appearance';\nimport { Layout3DCamera, type Layout3DFrameChoreography, type Layout3DZoneFocusTransition } from '../layout/layout-3d-vocabulary';\n\n/**\n * The frame receives no pointer events and handles none. fiber's wrapper would otherwise set\n * `pointer-events: auto` inline and attach its listeners, making a full-viewport canvas a hit target wherever\n * the shell root does not cover it. Hover is read from the DOCUMENT instead (see {@link FrameScene}).\n */\nconst NO_POINTER_EVENTS = (): EventManager<HTMLElement> => ({ enabled: false, priority: 0 });\n\n/**\n * Every `<Canvas>` setting the frame depends on, in one place so a test pins them.\n *\n * - `flat`: no tone mapping. The shaders write sRGB-encoded colours as given; tone mapping would move every\n * colour after the contrast bound was checked.\n * - `frameloop: 'never'`: fiber renders nothing on its own. The scene renders when a region moved, when the\n * appearance changed, and per animation frame only while something animates — so an idle shell costs zero frames.\n * - `powerPreference: 'low-power'`: a decorative frame must not wake a discrete GPU.\n */\nexport const FRAME_CANVAS_SETTINGS = {\n flat: true,\n frameloop: 'never',\n gl: { alpha: true, antialias: true, powerPreference: 'low-power' },\n events: NO_POINTER_EVENTS,\n style: { pointerEvents: 'none' },\n} satisfies Omit<CanvasProps, 'children'>;\n\nexport interface FrameCanvasProps {\n /** Computed in the DOM tree (`useFrameAppearance`); the canvas reads no context of its own. */\n appearance: FrameAppearance | null;\n /** The layout's camera. */\n camera: Layout3DCamera;\n /** Whether the layout's transitions cross-fade an appearance change (`crossFadesAppearance`). */\n crossFadeAppearance: boolean;\n /** What the layout plays on a navigation (#1826). */\n navigationTransition: Layout3DFrameChoreography;\n /** What the layout plays when the sidebar collapses, expands or is resized (#1826). */\n sidebarResizeTransition: Layout3DFrameChoreography;\n /** What the layout shows for the focused zone (#1826). */\n zoneFocusTransition: Layout3DZoneFocusTransition;\n /** The content's identity, from the navigation state: a change plays the navigation transition. */\n navigationSignature: string;\n /** The navigation state's focused zone, or null. */\n focusedZone: string | null;\n}\n\n/**\n * The `<Canvas>` camera for a layout's camera. Exhaustive over {@link Layout3DCamera}: a camera added for #1826\n * fails to compile here until the frame can draw through it.\n */\nexport function canvasCameraSettings(camera: Layout3DCamera): Pick<CanvasProps, 'orthographic' | 'camera'> {\n switch (camera) {\n case Layout3DCamera.FLAT_ORTHOGRAPHIC:\n // Orthographic with zoom 1: one scene unit is one CSS pixel, so a slab lies exactly on its region's box.\n return { orthographic: true, camera: { position: [0, 0, 10], zoom: 1 } };\n case Layout3DCamera.STILL_PERSPECTIVE:\n // A still-perspective layout carries its depth in its own HTML objects; the frame is never mounted for it.\n throw new Error('The 3D frame does not draw a still-perspective layout: its placement stages the objects itself.');\n default: {\n const unsupported: never = camera;\n throw new Error(`The 3D frame has no camera '${String(unsupported)}'.`);\n }\n }\n}\n\n/**\n * The 3D frame (#1823): an in-scene background derived from the theme tokens, and a frosted slab under every\n * shell region, aligned to the region's box. Everything inside the regions stays the 2D shell's HTML; this\n * canvas draws only what is behind them, and holds meshes only.\n */\nexport default function FrameCanvas({ camera, ...scene }: FrameCanvasProps): React.JSX.Element {\n return (\n <div aria-hidden=\"true\" data-frame-3d=\"frame\" className=\"fixed inset-0 pointer-events-none\">\n <Canvas {...FRAME_CANVAS_SETTINGS} {...canvasCameraSettings(camera)}>\n <FrameScene {...scene} />\n </Canvas>\n </div>\n );\n}\n\n/**\n * The scene host: creates the renderer and the scheduling driver (`createFrameDriver`, which decides WHEN to draw)\n * and forwards the appearance prop to it. Everything about timing lives in the driver, where it is unit-tested.\n */\nfunction FrameScene({\n appearance,\n crossFadeAppearance,\n navigationTransition,\n sidebarResizeTransition,\n zoneFocusTransition,\n navigationSignature,\n focusedZone,\n}: Omit<FrameCanvasProps, 'camera'>): React.JSX.Element {\n const groupRef = useRef<Group>(null);\n const gl = useThree((state) => state.gl);\n const scene = useThree((state) => state.scene);\n const camera = useThree((state) => state.camera);\n const get = useThree((state) => state.get);\n const size = useThree((state) => state.size);\n const dpr = useThree((state) => state.viewport.dpr);\n const driverRef = useRef<FrameDriver | null>(null);\n // The latest inputs, so a driver re-created for a new renderer or camera starts from them (not from nothing): its\n // first navigation signature only records, so a re-creation never plays a navigation that did not happen.\n const appearanceRef = useRef(appearance);\n const navigationRef = useRef(navigationSignature);\n const focusedZoneRef = useRef(focusedZone);\n\n useLayoutEffect(() => {\n const group = groupRef.current;\n if (!group) return undefined;\n const renderer = new FrameRenderer(group, { navigation: navigationTransition, sidebarResize: sidebarResizeTransition, zoneFocus: zoneFocusTransition });\n const driver = createFrameDriver(\n {\n renderer,\n renderScene: () => gl.render(scene, camera),\n // The canvas' own size from fiber's store: the number the camera frustum was fitted to.\n viewport: () => ({ width: get().size.width, height: get().size.height }),\n canvas: gl.domElement,\n document,\n requestFrame: (callback) => requestAnimationFrame(callback),\n cancelFrame: (handle) => cancelAnimationFrame(handle),\n now: () => performance.now(),\n createResizeObserver: (callback) => new ResizeObserver(callback),\n createMutationObserver: (callback) => new MutationObserver(callback),\n crossFadeAppearance,\n onTransitionStarted: (trigger) => countTransition(gl.domElement, trigger),\n },\n appearanceRef.current,\n );\n driver.setNavigation(navigationRef.current);\n driver.setFocusedZone(focusedZoneRef.current);\n driverRef.current = driver;\n return () => {\n driver.dispose();\n renderer.dispose();\n driverRef.current = null;\n };\n }, [gl, scene, camera, get, crossFadeAppearance, navigationTransition, sidebarResizeTransition, zoneFocusTransition]);\n\n // The appearance changed (theme, mode, reduced motion). Declared AFTER the scene effect, so the driver exists.\n useLayoutEffect(() => {\n if (appearanceRef.current === appearance) return;\n appearanceRef.current = appearance;\n driverRef.current?.setAppearance(appearance);\n }, [appearance]);\n\n // The content or the focused zone changed (#1826). After the scene effect, so the driver exists.\n useLayoutEffect(() => {\n navigationRef.current = navigationSignature;\n driverRef.current?.setNavigation(navigationSignature);\n }, [navigationSignature]);\n useLayoutEffect(() => {\n focusedZoneRef.current = focusedZone;\n driverRef.current?.setFocusedZone(focusedZone);\n }, [focusedZone]);\n\n // The canvas resized, or its pixel ratio changed: fiber has re-fitted the camera and cleared the drawing buffer,\n // so redraw even if every region is where it was.\n useLayoutEffect(() => {\n driverRef.current?.redraw();\n }, [size.width, size.height, dpr]);\n\n return <group ref={groupRef} />;\n}\n\n/**\n * Counts each started transition on the canvas element, as `data-frame-3d-transitions-<trigger>`. The frame's only\n * observable surface for WHICH choreography ran: a live probe (`scripts/presets-3d-live-probe`) reads it, because\n * counting draws cannot tell a choreography from a hover or a re-layout. Writes a number, nothing else.\n */\nexport function countTransition(canvas: HTMLElement, trigger: FrameTransitionTrigger): void {\n const attribute = `data-frame-3d-transitions-${trigger}`;\n canvas.setAttribute(attribute, String(Number(canvas.getAttribute(attribute) ?? '0') + 1));\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"frame-canvas.lazy.js","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"frame-canvas.lazy.js","sourceRoot":"","sources":["../../../src/frame/frame-canvas.lazy.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC;AAE9C,OAAO,EAAE,qBAAqB,EAAE,MAAM,6BAA6B,CAAC;AAIpE;;;;;GAKG;AACH,MAAM,eAAe,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC,gBAAgB,CAAC,CAAC,CAAC;AAE7D;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,KAAK,CAAC,IAAI,CAAC,SAAS,eAAe,CAAC,KAAuB;IACxF,OAAO,CACL,KAAC,qBAAqB,IAAC,QAAQ,EAAC,6BAA6B,EAAC,QAAQ,EAAE,IAAI,YAC1E,KAAC,QAAQ,IAAC,QAAQ,EAAE,IAAI,YACtB,KAAC,eAAe,OAAK,KAAK,GAAI,GACrB,GACW,CACzB,CAAC;AACJ,CAAC,CAAC,CAAC","sourcesContent":["import React, { Suspense, lazy } from 'react';\n\nimport { LazyDoorErrorBoundary } from '@wildo-ai/saas-frontend-lib';\n\nimport type { FrameCanvasProps } from './frame-canvas';\n\n/**\n * The lazy door of the 3D frame: three.js and @react-three/fiber load only when a 3D main container actually\n * mounts, so an application that declares this library but has not reached its shell (the sign-in screens, a\n * public page) downloads none of it. `check:lazy-boundaries` keeps it a door: the module behind it may be\n * imported statically only here (and from tests).\n */\nconst LazyFrameCanvas = lazy(() => import('./frame-canvas'));\n\n/**\n * The boundary contains every THROWN failure of the decorative frame — a chunk that did not arrive, a WebGL\n * context the browser refused to create (fiber rethrows that during render) — to the frame's own slot. It is\n * failure containment, not a fallback mode: the 2D shell beside it never depended on the frame, so the\n * application keeps every region and simply shows no frame. There is deliberately no retry: a browser that\n * refused WebGL once refuses it again, and a retry loop is how a decoration becomes a CPU cost.\n *\n * A context LOST after creation is not an error and no boundary sees it: it is a `webglcontextlost` event,\n * which the canvas handles itself (it stops drawing, and redraws on `webglcontextrestored`).\n *\n * The boundary logs the failure itself (with the door name), so no `onError` is passed: a second line would\n * report the same failure twice.\n *\n * Memoised: its props are primitives and the appearance value, and the navigation context the frame slot reads\n * changes far more often than they do (the content area's width, on every frame of a sidebar animation), so an\n * unchanged frame never re-renders the canvas.\n */\nexport const FrameCanvasDoor = React.memo(function FrameCanvasDoor(props: FrameCanvasProps): React.JSX.Element {\n return (\n <LazyDoorErrorBoundary doorName=\"presets-components-3d/frame\" fallback={null}>\n <Suspense fallback={null}>\n <LazyFrameCanvas {...props} />\n </Suspense>\n </LazyDoorErrorBoundary>\n );\n});\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"frame-color.d.ts","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"frame-color.d.ts","sourceRoot":"","sources":["../../../src/frame/frame-color.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,2GAA2G;AAC3G,MAAM,MAAM,UAAU,GAAG,SAAS,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;AAE3D,eAAO,MAAM,KAAK,EAAE,UAAsB,CAAC;AAC3C,eAAO,MAAM,KAAK,EAAE,UAAsB,CAAC;AAM3C,sKAAsK;AACtK,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,UAAU,GAAG,MAAM,CAG3D;AAED,iKAAiK;AACjK,wBAAgB,aAAa,CAAC,CAAC,EAAE,UAAU,EAAE,CAAC,EAAE,UAAU,GAAG,MAAM,CAIlE;AAED,uGAAuG;AACvG,wBAAgB,SAAS,CAAC,GAAG,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,GAAG,UAAU,CAExF;AAED,wBAAgB,GAAG,CAAC,CAAC,EAAE,UAAU,EAAE,CAAC,EAAE,UAAU,EAAE,CAAC,EAAE,MAAM,GAAG,UAAU,CAEvE;AAED,iDAAiD;AACjD,wBAAgB,cAAc,CAAC,IAAI,EAAE,UAAU,EAAE,EAAE,EAAE,UAAU,GAAG,UAAU,EAAE,CAE7E;AAED,+GAA+G;AAC/G,wBAAgB,SAAS,CAAC,KAAK,EAAE,UAAU,EAAE,IAAI,EAAE,UAAU,EAAE,EAAE,EAAE,CAAC,CAAC,EAAE,UAAU,KAAK,OAAO,GAAG,UAAU,CAMzG;AAED,wBAAgB,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAElD;AAED,wBAAgB,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAGlD;AAED,wGAAwG;AACxG,wBAAgB,QAAQ,CAAC,KAAK,EAAE,UAAU,GAAG,UAAU,CAEtD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"frame-color.js","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"frame-color.js","sourceRoot":"","sources":["../../../src/frame/frame-color.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,MAAM,CAAC,MAAM,KAAK,GAAe,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;AAC3C,MAAM,CAAC,MAAM,KAAK,GAAe,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;AAE3C,8GAA8G;AAC9G,MAAM,gBAAgB,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;AACjD,MAAM,WAAW,GAAG,EAAE,CAAC;AAEvB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AAG,CAAC,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,GAAG,GAAG,CAA0B,CAAC;AACxG,CAAC","sourcesContent":["/**\n * The frame's colour arithmetic (#1823). INTERNAL to the package: the root barrel does not export it. It is the\n * model of what the shaders write, and the appearance derivation and its tests share it; it is not an API.\n */\n\n/** A colour as the frame draws it: sRGB-ENCODED channels in 0–1, exactly what lands in the framebuffer. */\nexport type FrameColor = readonly [number, number, number];\n\nexport const BLACK: FrameColor = [0, 0, 0];\nexport const WHITE: FrameColor = [1, 1, 1];\n\n/** The gradient is checked at these points, not only its ends: a lerp's luminance can dip below both ends. */\nconst GRADIENT_SAMPLES = [0, 0.25, 0.5, 0.75, 1];\nconst BOUND_STEPS = 40;\n\n/** WCAG relative luminance of an sRGB-encoded colour. spec-cite: WCAG 2.2 — \"relative luminance\" definition — https://www.w3.org/TR/WCAG22/#dfn-relative-luminance */\nexport function relativeLuminance(color: FrameColor): number {\n const [r, g, b] = color.map(decodeSrgb);\n return 0.2126 * r! + 0.7152 * g! + 0.0722 * b!;\n}\n\n/** WCAG contrast ratio between two sRGB-encoded colours. spec-cite: WCAG 2.2 — \"contrast ratio\" definition — https://www.w3.org/TR/WCAG22/#dfn-contrast-ratio */\nexport function contrastRatio(a: FrameColor, b: FrameColor): number {\n const la = relativeLuminance(a);\n const lb = relativeLuminance(b);\n return (Math.max(la, lb) + 0.05) / (Math.min(la, lb) + 0.05);\n}\n\n/** `top` at `alpha` over an opaque `bottom`, blended in sRGB-encoded space as the framebuffer does. */\nexport function composite(top: FrameColor, alpha: number, bottom: FrameColor): FrameColor {\n return [0, 1, 2].map((i) => top[i]! * alpha + bottom[i]! * (1 - alpha)) as unknown as FrameColor;\n}\n\nexport function mix(a: FrameColor, b: FrameColor, t: number): FrameColor {\n return [0, 1, 2].map((i) => a[i]! + (b[i]! - a[i]!) * t) as unknown as FrameColor;\n}\n\n/** The points of a gradient the bound checks. */\nexport function gradientPoints(from: FrameColor, to: FrameColor): FrameColor[] {\n return GRADIENT_SAMPLES.map((t) => mix(from, to, t));\n}\n\n/** Move `color` toward `pole` in small steps until `ok` holds; the pole itself if nothing short of it does. */\nexport function pushUntil(color: FrameColor, pole: FrameColor, ok: (c: FrameColor) => boolean): FrameColor {\n for (let step = 0; step <= BOUND_STEPS; step += 1) {\n const candidate = mix(color, pole, step / BOUND_STEPS);\n if (ok(candidate)) return candidate;\n }\n return pole;\n}\n\nexport function decodeSrgb(channel: number): number {\n return channel <= 0.04045 ? channel / 12.92 : ((channel + 0.055) / 1.055) ** 2.4;\n}\n\nexport function encodeSrgb(channel: number): number {\n const c = Math.min(1, Math.max(0, channel));\n return c <= 0.0031308 ? c * 12.92 : 1.055 * c ** (1 / 2.4) - 0.055;\n}\n\n/** The colour as the 8-bit framebuffer stores it: each channel rounded to the nearest of 256 levels. */\nexport function quantize(color: FrameColor): FrameColor {\n return color.map((c) => Math.round(Math.min(1, Math.max(0, c)) * 255) / 255) as unknown as FrameColor;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"frame-driver.js","sourceRoot":"","sources":["../../../../src/frame/frame-driver.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,qCAAqC,CAAC;AAElE,OAAO,EAAE,iBAAiB,EAAE,sBAAsB,EAAkF,MAAM,kBAAkB,CAAC;AAC7J,OAAO,EAAE,0BAA0B,EAAE,uBAAuB,EAAE,sBAAsB,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AA4C/I;;;;;;;;;;;;;;;GAeG;AACH,MAAM,UAAU,iBAAiB,CAAC,IAAqB,EAAE,iBAAyC;IAChG,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,GAAG,IAAI,CAAC;IACpC,IAAI,WAAW,GAAG,KAAK,CAAC;IACxB,IAAI,aAAa,GAAG,KAAK,CAAC;IAC1B,IAAI,UAAU,GAA2B,IAAI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AC,CAAC;AAC/B,SAAS,kBAAkB,CAAC,MAA0B;IACpD,IAAI,CAAC,MAAM;QAAE,OAAO,CAAC,CAAC,CAAC;IACvB,IAAI,EAAE,GAAG,mBAAmB,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;IACzC,IAAI,EAAE,KAAK,SAAS,EAAE,CAAC;QAAC,EAAE,GAAG,sBAAsB,EAAE,CAAC;QAAC,mBAAmB,CAAC,GAAG,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;IAAC,CAAC;IAC7F,OAAO,EAAE,CAAC;AACZ,CAAC","sourcesContent":["import type { FrameAppearance } from './frame-appearance';\nimport { ShellRegion } from '@wildo-ai/presets-components-models';\n\nimport { FramePulseOutcome, FrameTransitionTrigger, type FrameRegionBox, type FrameRenderer, type FrameViewport, type FrameZoneBox } from './frame-renderer';\nimport { findNavigationZoneElements, findShellRegionElements, measureNavigationZones, measureShellRegions } from '../shell-region-measurement';\n\n/** What the driver needs from its host. Injected, so the scheduling is tested with fake clocks and observers. */\nexport interface FrameDriverHost {\n renderer: Pick<FrameRenderer, 'setAppearance' | 'setLayout' | 'setHovered' | 'setZones' | 'rimmedZone' | 'pulse' | 'hasPendingMotion' | 'tick'>;\n /** Renders the scene as the renderer last left it. */\n renderScene: () => void;\n /** The canvas' size in CSS pixels, as the camera was fitted to it. */\n viewport: () => FrameViewport;\n /** The canvas element, for context-loss events. */\n canvas: EventTarget;\n document: Document;\n requestFrame: (callback: () => void) => number;\n cancelFrame: (handle: number) => void;\n now: () => number;\n createResizeObserver: (callback: () => void) => Pick<ResizeObserver, 'observe' | 'unobserve' | 'disconnect'>;\n createMutationObserver: (callback: () => void) => Pick<MutationObserver, 'observe' | 'disconnect'>;\n /** Whether an appearance change after the first cross-fades (the layout's transitions) or is shown at once. */\n crossFadeAppearance: boolean;\n /**\n * A transition of the frame started (#1826). The canvas counts them on its element, so a live probe can tell that a\n * choreography ran — draws alone cannot, since a hover or a re-layout draws too.\n */\n onTransitionStarted?: (trigger: FrameTransitionTrigger) => void;\n}\n\n/** The canvas-facing surface of a running driver. */\nexport interface FrameDriver {\n /** A new appearance: shown at once the first time, cross-faded afterwards. */\n setAppearance(appearance: FrameAppearance | null): void;\n /** The canvas resized or its pixel ratio changed: the drawing buffer was cleared, so redraw regardless. */\n redraw(): void;\n /**\n * The content's identity: the structural zones' top entries, as the navigation state reports them (#1826). The\n * first value only records; every later CHANGE plays the layout's navigation choreography. An EMPTY signature (no\n * zone holds anything yet: the route sync has not landed) is not a place and is never recorded, so the first\n * landing after the canvas mounted is not played as a navigation.\n */\n setNavigation(signature: string): void;\n /** The navigation state's focused zone (a `data-content-area` value), or null. */\n setFocusedZone(zone: string | null): void;\n dispose(): void;\n}\n\n/**\n * The frame's scheduler (#1823): decides WHEN the renderer draws, and nothing about what it draws.\n *\n * - **At rest**, it draws synchronously inside the callback of whatever changed a region's box (ResizeObserver,\n * a region mounting or leaving), so a slab never lags its region by a frame — and draws NOTHING when every box\n * is where it was.\n * - **While something moves** — a CSS transition in the shell, a cross-fade, a hover emphasis — it runs one loop\n * per animation frame. The loop still renders only when a box moved or the renderer has motion pending. A\n * `transitionstart` anywhere in the document (a button's hover colour) keeps the loop ALIVE, so a moving\n * sidebar is followed frame by frame, but a frame where nothing in the scene changed costs no draw.\n * - **A navigation or a zone focus** (#1826) is an input from the DOM tree (`setNavigation`, `setFocusedZone`); a\n * **sidebar resize** is read off the measurement itself (its width changed while it stayed on screen). Each starts\n * the renderer's choreography and the same loop, which stops the frame the choreography settles. The zone\n * containers are observed like the regions, so a split resized by dragging its divider keeps the rim on the zone.\n * - **After a context loss**, it draws nothing until the context is restored.\n */\nexport function createFrameDriver(host: FrameDriverHost, initialAppearance: FrameAppearance | null): FrameDriver {\n const { renderer, document } = host;\n let contextLost = false;\n let hadAppearance = false;\n let appearance: FrameAppearance | null = null;\n const observed = new Set<HTMLElement>();\n const observedZones = new Set<HTMLElement>();\n const resizeObserver = host.createResizeObserver(() => draw(false));\n let navigationSignature: string | null = null;\n let focusedZone: string | null = null;\n /** The sidebar's width at the last measurement, or null when it was not on screen. */\n let sidebarWidth: number | null = null;\n const started = (trigger: FrameTransitionTrigger): void => host.onTransitionStarted?.(trigger);\n\n const observeOnly = (present: Set<HTMLElement>, into: Set<HTMLElement>): void => {\n for (const element of present) if (!into.has(element)) { resizeObserver.observe(element); into.add(element); }\n for (const element of into) if (!present.has(element)) { resizeObserver.unobserve(element); into.delete(element); }\n };\n\n const measure = (): boolean => {\n // Every marked region and zone is OBSERVED, whatever its box: one collapsed to nothing must redraw the moment it reappears.\n observeOnly(new Set(findShellRegionElements(document)), observed);\n observeOnly(new Set(findNavigationZoneElements(document)), observedZones);\n const boxes: FrameRegionBox[] = measureShellRegions(document).map(({ element, region, left, top, width, height, glass }) => ({ element, region, left, top, width, height, glass }));\n const zones = measureNavigationZones(document);\n const focused = zones.find((zone) => zone.zone === focusedZone)?.element ?? null;\n const zoneBoxes: FrameZoneBox[] = zones.map(({ element, left, top, width, height }) => ({ element, left, top, width, height }));\n const moved = renderer.setLayout(boxes, host.viewport());\n // A sidebar resize: its width changed while it stayed on screen. A sidebar that appears (labels ready, an\n // organization switch) or leaves is not one. Every frame of its animation extends the same pulse.\n const sidebar = boxes.find((box) => box.region === ShellRegion.SIDEBAR);\n const width = sidebar ? sidebar.width : null;\n const resizing = width !== null && sidebarWidth !== null && width !== sidebarWidth;\n sidebarWidth = width;\n // Reported when a pulse STARTS, never per frame: a ResizeObserver measure between two animation frames sees an\n // unchanged width, so any \"was it resizing last time\" flag would re-arm and count every frame of the animation.\n if (resizing && renderer.pulse(FrameTransitionTrigger.SIDEBAR_RESIZE) === FramePulseOutcome.STARTED) started(FrameTransitionTrigger.SIDEBAR_RESIZE);\n const rimmedBefore = renderer.rimmedZone();\n const zonesChanged = renderer.setZones(zoneBoxes, focused);\n const rimmedAfter = renderer.rimmedZone();\n if (rimmedAfter !== null && rimmedAfter !== rimmedBefore) started(FrameTransitionTrigger.ZONE_FOCUS);\n return zonesChanged || moved || resizing;\n };\n\n const renderFrame = (): void => {\n renderer.tick(host.now());\n host.renderScene();\n };\n\n // A running CSS transition, per (property, element); the deadline stops following one whose end never arrives.\n const runningTransitions = new Map<string, number>();\n let loopHandle = 0;\n const kick = (): void => {\n if (!loopHandle) loopHandle = host.requestFrame(loop);\n };\n const loop = (): void => {\n loopHandle = 0;\n if (contextLost) return;\n const now = host.now();\n for (const [key, deadline] of runningTransitions) if (now > deadline) runningTransitions.delete(key);\n const moved = measure();\n if (moved || renderer.hasPendingMotion()) renderFrame();\n if (renderer.hasPendingMotion() || runningTransitions.size > 0) kick();\n };\n\n function draw(force: boolean): void {\n if (contextLost) return;\n const moved = measure();\n if (!moved && !force && !renderer.hasPendingMotion()) return;\n renderFrame();\n if (renderer.hasPendingMotion()) kick();\n }\n\n // Regions render nothing until their labels are ready and remount on an organization switch: re-query, at most\n // once per animation frame, whenever the DOM gains or loses nodes.\n let mutationHandle = 0;\n const mutationObserver = host.createMutationObserver(() => {\n if (mutationHandle) return;\n mutationHandle = host.requestFrame(() => { mutationHandle = 0; draw(false); });\n });\n mutationObserver.observe(document.body, { childList: true, subtree: true });\n\n const transitionKey = (event: Event): string => `${(event as TransitionEvent).propertyName}#${transitionTargetId(event.target)}`;\n const onTransitionStart = (event: Event): void => {\n const ceilingMs = (appearance?.transitionCeilingSeconds ?? 1.5) * 1000;\n runningTransitions.set(transitionKey(event), host.now() + ceilingMs);\n kick();\n };\n const onTransitionEnd = (event: Event): void => {\n runningTransitions.delete(transitionKey(event));\n draw(false);\n };\n document.addEventListener('transitionstart', onTransitionStart, true);\n document.addEventListener('transitionend', onTransitionEnd, true);\n document.addEventListener('transitioncancel', onTransitionEnd, true);\n\n // Hover: read from the document (the canvas takes no pointer events), resolved to the region under the pointer.\n const onPointerOver = (event: Event): void => {\n const target = event.target instanceof Element ? event.target.closest<HTMLElement>('[data-component-area]') : null;\n if (renderer.setHovered(target && observed.has(target) ? target : null)) kick();\n };\n const onPointerOut = (event: Event): void => {\n if ((event as PointerEvent).relatedTarget !== null) return;\n if (renderer.setHovered(null)) kick();\n };\n document.addEventListener('pointerover', onPointerOver, { passive: true });\n document.addEventListener('pointerout', onPointerOut, { passive: true });\n\n const onContextLost = (event: Event): void => { event.preventDefault(); contextLost = true; };\n const onContextRestored = (): void => { contextLost = false; draw(true); };\n host.canvas.addEventListener('webglcontextlost', onContextLost);\n host.canvas.addEventListener('webglcontextrestored', onContextRestored);\n\n const driver: FrameDriver = {\n setAppearance(next) {\n appearance = next ?? appearance;\n renderer.setAppearance(next, { animate: hadAppearance && host.crossFadeAppearance });\n hadAppearance = hadAppearance || next !== null;\n draw(true);\n },\n redraw() {\n draw(true);\n },\n setNavigation(signature) {\n if (signature === '') return;\n const previous = navigationSignature;\n navigationSignature = signature;\n if (previous === null || previous === signature) return;\n const outcome = renderer.pulse(FrameTransitionTrigger.NAVIGATION);\n if (outcome === FramePulseOutcome.STARTED) started(FrameTransitionTrigger.NAVIGATION);\n if (outcome !== FramePulseOutcome.NOT_PLAYED) kick();\n },\n setFocusedZone(zone) {\n if (zone === focusedZone) return;\n focusedZone = zone;\n draw(false);\n },\n dispose() {\n resizeObserver.disconnect();\n mutationObserver.disconnect();\n host.cancelFrame(mutationHandle);\n host.cancelFrame(loopHandle);\n document.removeEventListener('transitionstart', onTransitionStart, true);\n document.removeEventListener('transitionend', onTransitionEnd, true);\n document.removeEventListener('transitioncancel', onTransitionEnd, true);\n document.removeEventListener('pointerover', onPointerOver);\n document.removeEventListener('pointerout', onPointerOut);\n host.canvas.removeEventListener('webglcontextlost', onContextLost);\n host.canvas.removeEventListener('webglcontextrestored', onContextRestored);\n },\n };\n // The current appearance, applied at once: a driver re-created by its host (a new renderer, a new camera) must\n // not wait for the NEXT appearance change to show anything.\n driver.setAppearance(initialAppearance);\n return driver;\n}\n\n/** A stable identity per transitioning element, so two elements animating the same property are two entries. */\nconst transitionTargetIds = new WeakMap<object, number>();\nlet nextTransitionTargetId = 0;\nfunction transitionTargetId(target: EventTarget | null): number {\n if (!target) return -1;\n let id = transitionTargetIds.get(target);\n if (id === undefined) { id = nextTransitionTargetId++; transitionTargetIds.set(target, id); }\n return id;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"frame-driver.js","sourceRoot":"","sources":["../../../src/frame/frame-driver.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,qCAAqC,CAAC;AAElE,OAAO,EAAE,iBAAiB,EAAE,sBAAsB,EAAkF,MAAM,kBAAkB,CAAC;AAC7J,OAAO,EAAE,0BAA0B,EAAE,uBAAuB,EAAE,sBAAsB,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AA4C/I;;;;;;;;;;;;;;;GAeG;AACH,MAAM,UAAU,iBAAiB,CAAC,IAAqB,EAAE,iBAAyC;IAChG,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,GAAG,IAAI,CAAC;IACpC,IAAI,WAAW,GAAG,KAAK,CAAC;IACxB,IAAI,aAAa,GAAG,KAAK,CAAC;IAC1B,IAAI,UAAU,GAA2B,IAAI,CAAC;IAC9C,MAAM,QAAQ,GAAG,IAAI,GAAG,EAAe,CAAC;IACxC,MAAM,aAAa,GAAG,IAAI,GAAG,EAAe,CAAC;IAC7C,MAAM,cAAc,GAAG,IAAI,CAAC,oBAAoB,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;IACpE,IAAI,mBAAmB,GAAkB,IAAI,CAAC;IAC9C,IAAI,WAAW,GAAkB,IAAI,CAAC;IACtC,sFAAsF;IACtF,IAAI,YAAY,GAAkB,IAAI,CAAC;IACvC,MAAM,OAAO,GAAG,CAAC,OAA+B,EAAQ,EAAE,CAAC,IAAI,CAAC,mBAAmB,EAAE,CAAC,OAAO,CAAC,CAAC;IAE/F,MAAM,WAAW,GAAG,CAAC,OAAyB,EAAE,IAAsB,EAAQ,EAAE;QAC9E,KAAK,MAAM,OAAO,IAAI,OAAO;YAAE,IAAI,C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AAQ,CAAC,mBAAmB,CAAC,eAAe,EAAE,eAAe,EAAE,IAAI,CAAC,CAAC;YACrE,QAAQ,CAAC,mBAAmB,CAAC,kBAAkB,EAAE,eAAe,EAAE,IAAI,CAAC,CAAC;YACxE,QAAQ,CAAC,mBAAmB,CAAC,aAAa,EAAE,aAAa,CAAC,CAAC;YAC3D,QAAQ,CAAC,mBAAmB,CAAC,YAAY,EAAE,YAAY,CAAC,CAAC;YACzD,IAAI,CAAC,MAAM,CAAC,mBAAmB,CAAC,kBAAkB,EAAE,aAAa,CAAC,CAAC;YACnE,IAAI,CAAC,MAAM,CAAC,mBAAmB,CAAC,sBAAsB,EAAE,iBAAiB,CAAC,CAAC;QAC7E,CAAC;KACF,CAAC;IACF,+GAA+G;IAC/G,4DAA4D;IAC5D,MAAM,CAAC,aAAa,CAAC,iBAAiB,CAAC,CAAC;IACxC,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,gHAAgH;AAChH,MAAM,mBAAmB,GAAG,IAAI,OAAO,EAAkB,CAAC;AAC1D,IAAI,sBAAsB,GAAG,CAAC,CAAC;AAC/B,SAAS,kBAAkB,CAAC,MAA0B;IACpD,IAAI,CAAC,MAAM;QAAE,OAAO,CAAC,CAAC,CAAC;IACvB,IAAI,EAAE,GAAG,mBAAmB,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;IACzC,IAAI,EAAE,KAAK,SAAS,EAAE,CAAC;QAAC,EAAE,GAAG,sBAAsB,EAAE,CAAC;QAAC,mBAAmB,CAAC,GAAG,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;IAAC,CAAC;IAC7F,OAAO,EAAE,CAAC;AACZ,CAAC","sourcesContent":["import type { FrameAppearance } from './frame-appearance';\nimport { ShellRegion } from '@wildo-ai/presets-components-models';\n\nimport { FramePulseOutcome, FrameTransitionTrigger, type FrameRegionBox, type FrameRenderer, type FrameViewport, type FrameZoneBox } from './frame-renderer';\nimport { findNavigationZoneElements, findShellRegionElements, measureNavigationZones, measureShellRegions } from '../shell-region-measurement';\n\n/** What the driver needs from its host. Injected, so the scheduling is tested with fake clocks and observers. */\nexport interface FrameDriverHost {\n renderer: Pick<FrameRenderer, 'setAppearance' | 'setLayout' | 'setHovered' | 'setZones' | 'rimmedZone' | 'pulse' | 'hasPendingMotion' | 'tick'>;\n /** Renders the scene as the renderer last left it. */\n renderScene: () => void;\n /** The canvas' size in CSS pixels, as the camera was fitted to it. */\n viewport: () => FrameViewport;\n /** The canvas element, for context-loss events. */\n canvas: EventTarget;\n document: Document;\n requestFrame: (callback: () => void) => number;\n cancelFrame: (handle: number) => void;\n now: () => number;\n createResizeObserver: (callback: () => void) => Pick<ResizeObserver, 'observe' | 'unobserve' | 'disconnect'>;\n createMutationObserver: (callback: () => void) => Pick<MutationObserver, 'observe' | 'disconnect'>;\n /** Whether an appearance change after the first cross-fades (the layout's transitions) or is shown at once. */\n crossFadeAppearance: boolean;\n /**\n * A transition of the frame started (#1826). The canvas counts them on its element, so a live probe can tell that a\n * choreography ran — draws alone cannot, since a hover or a re-layout draws too.\n */\n onTransitionStarted?: (trigger: FrameTransitionTrigger) => void;\n}\n\n/** The canvas-facing surface of a running driver. */\nexport interface FrameDriver {\n /** A new appearance: shown at once the first time, cross-faded afterwards. */\n setAppearance(appearance: FrameAppearance | null): void;\n /** The canvas resized or its pixel ratio changed: the drawing buffer was cleared, so redraw regardless. */\n redraw(): void;\n /**\n * The content's identity: the structural zones' top entries, as the navigation state reports them (#1826). The\n * first value only records; every later CHANGE plays the layout's navigation choreography. An EMPTY signature (no\n * zone holds anything yet: the route sync has not landed) is not a place and is never recorded, so the first\n * landing after the canvas mounted is not played as a navigation.\n */\n setNavigation(signature: string): void;\n /** The navigation state's focused zone (a `data-content-area` value), or null. */\n setFocusedZone(zone: string | null): void;\n dispose(): void;\n}\n\n/**\n * The frame's scheduler (#1823): decides WHEN the renderer draws, and nothing about what it draws.\n *\n * - **At rest**, it draws synchronously inside the callback of whatever changed a region's box (ResizeObserver,\n * a region mounting or leaving), so a slab never lags its region by a frame — and draws NOTHING when every box\n * is where it was.\n * - **While something moves** — a CSS transition in the shell, a cross-fade, a hover emphasis — it runs one loop\n * per animation frame. The loop still renders only when a box moved or the renderer has motion pending. A\n * `transitionstart` anywhere in the document (a button's hover colour) keeps the loop ALIVE, so a moving\n * sidebar is followed frame by frame, but a frame where nothing in the scene changed costs no draw.\n * - **A navigation or a zone focus** (#1826) is an input from the DOM tree (`setNavigation`, `setFocusedZone`); a\n * **sidebar resize** is read off the measurement itself (its width changed while it stayed on screen). Each starts\n * the renderer's choreography and the same loop, which stops the frame the choreography settles. The zone\n * containers are observed like the regions, so a split resized by dragging its divider keeps the rim on the zone.\n * - **After a context loss**, it draws nothing until the context is restored.\n */\nexport function createFrameDriver(host: FrameDriverHost, initialAppearance: FrameAppearance | null): FrameDriver {\n const { renderer, document } = host;\n let contextLost = false;\n let hadAppearance = false;\n let appearance: FrameAppearance | null = null;\n const observed = new Set<HTMLElement>();\n const observedZones = new Set<HTMLElement>();\n const resizeObserver = host.createResizeObserver(() => draw(false));\n let navigationSignature: string | null = null;\n let focusedZone: string | null = null;\n /** The sidebar's width at the last measurement, or null when it was not on screen. */\n let sidebarWidth: number | null = null;\n const started = (trigger: FrameTransitionTrigger): void => host.onTransitionStarted?.(trigger);\n\n const observeOnly = (present: Set<HTMLElement>, into: Set<HTMLElement>): void => {\n for (const element of present) if (!into.has(element)) { resizeObserver.observe(element); into.add(element); }\n for (const element of into) if (!present.has(element)) { resizeObserver.unobserve(element); into.delete(element); }\n };\n\n const measure = (): boolean => {\n // Every marked region and zone is OBSERVED, whatever its box: one collapsed to nothing must redraw the moment it reappears.\n observeOnly(new Set(findShellRegionElements(document)), observed);\n observeOnly(new Set(findNavigationZoneElements(document)), observedZones);\n const boxes: FrameRegionBox[] = measureShellRegions(document).map(({ element, region, left, top, width, height, glass }) => ({ element, region, left, top, width, height, glass }));\n const zones = measureNavigationZones(document);\n const focused = zones.find((zone) => zone.zone === focusedZone)?.element ?? null;\n const zoneBoxes: FrameZoneBox[] = zones.map(({ element, left, top, width, height }) => ({ element, left, top, width, height }));\n const moved = renderer.setLayout(boxes, host.viewport());\n // A sidebar resize: its width changed while it stayed on screen. A sidebar that appears (labels ready, an\n // organization switch) or leaves is not one. Every frame of its animation extends the same pulse.\n const sidebar = boxes.find((box) => box.region === ShellRegion.SIDEBAR);\n const width = sidebar ? sidebar.width : null;\n const resizing = width !== null && sidebarWidth !== null && width !== sidebarWidth;\n sidebarWidth = width;\n // Reported when a pulse STARTS, never per frame: a ResizeObserver measure between two animation frames sees an\n // unchanged width, so any \"was it resizing last time\" flag would re-arm and count every frame of the animation.\n if (resizing && renderer.pulse(FrameTransitionTrigger.SIDEBAR_RESIZE) === FramePulseOutcome.STARTED) started(FrameTransitionTrigger.SIDEBAR_RESIZE);\n const rimmedBefore = renderer.rimmedZone();\n const zonesChanged = renderer.setZones(zoneBoxes, focused);\n const rimmedAfter = renderer.rimmedZone();\n if (rimmedAfter !== null && rimmedAfter !== rimmedBefore) started(FrameTransitionTrigger.ZONE_FOCUS);\n return zonesChanged || moved || resizing;\n };\n\n const renderFrame = (): void => {\n renderer.tick(host.now());\n host.renderScene();\n };\n\n // A running CSS transition, per (property, element); the deadline stops following one whose end never arrives.\n const runningTransitions = new Map<string, number>();\n let loopHandle = 0;\n const kick = (): void => {\n if (!loopHandle) loopHandle = host.requestFrame(loop);\n };\n const loop = (): void => {\n loopHandle = 0;\n if (contextLost) return;\n const now = host.now();\n for (const [key, deadline] of runningTransitions) if (now > deadline) runningTransitions.delete(key);\n const moved = measure();\n if (moved || renderer.hasPendingMotion()) renderFrame();\n if (renderer.hasPendingMotion() || runningTransitions.size > 0) kick();\n };\n\n function draw(force: boolean): void {\n if (contextLost) return;\n const moved = measure();\n if (!moved && !force && !renderer.hasPendingMotion()) return;\n renderFrame();\n if (renderer.hasPendingMotion()) kick();\n }\n\n // Regions render nothing until their labels are ready and remount on an organization switch: re-query, at most\n // once per animation frame, whenever the DOM gains or loses nodes.\n let mutationHandle = 0;\n const mutationObserver = host.createMutationObserver(() => {\n if (mutationHandle) return;\n mutationHandle = host.requestFrame(() => { mutationHandle = 0; draw(false); });\n });\n mutationObserver.observe(document.body, { childList: true, subtree: true });\n\n const transitionKey = (event: Event): string => `${(event as TransitionEvent).propertyName}#${transitionTargetId(event.target)}`;\n const onTransitionStart = (event: Event): void => {\n const ceilingMs = (appearance?.transitionCeilingSeconds ?? 1.5) * 1000;\n runningTransitions.set(transitionKey(event), host.now() + ceilingMs);\n kick();\n };\n const onTransitionEnd = (event: Event): void => {\n runningTransitions.delete(transitionKey(event));\n draw(false);\n };\n document.addEventListener('transitionstart', onTransitionStart, true);\n document.addEventListener('transitionend', onTransitionEnd, true);\n document.addEventListener('transitioncancel', onTransitionEnd, true);\n\n // Hover: read from the document (the canvas takes no pointer events), resolved to the region under the pointer.\n const onPointerOver = (event: Event): void => {\n const target = event.target instanceof Element ? event.target.closest<HTMLElement>('[data-component-area]') : null;\n if (renderer.setHovered(target && observed.has(target) ? target : null)) kick();\n };\n const onPointerOut = (event: Event): void => {\n if ((event as PointerEvent).relatedTarget !== null) return;\n if (renderer.setHovered(null)) kick();\n };\n document.addEventListener('pointerover', onPointerOver, { passive: true });\n document.addEventListener('pointerout', onPointerOut, { passive: true });\n\n const onContextLost = (event: Event): void => { event.preventDefault(); contextLost = true; };\n const onContextRestored = (): void => { contextLost = false; draw(true); };\n host.canvas.addEventListener('webglcontextlost', onContextLost);\n host.canvas.addEventListener('webglcontextrestored', onContextRestored);\n\n const driver: FrameDriver = {\n setAppearance(next) {\n appearance = next ?? appearance;\n renderer.setAppearance(next, { animate: hadAppearance && host.crossFadeAppearance });\n hadAppearance = hadAppearance || next !== null;\n draw(true);\n },\n redraw() {\n draw(true);\n },\n setNavigation(signature) {\n if (signature === '') return;\n const previous = navigationSignature;\n navigationSignature = signature;\n if (previous === null || previous === signature) return;\n const outcome = renderer.pulse(FrameTransitionTrigger.NAVIGATION);\n if (outcome === FramePulseOutcome.STARTED) started(FrameTransitionTrigger.NAVIGATION);\n if (outcome !== FramePulseOutcome.NOT_PLAYED) kick();\n },\n setFocusedZone(zone) {\n if (zone === focusedZone) return;\n focusedZone = zone;\n draw(false);\n },\n dispose() {\n resizeObserver.disconnect();\n mutationObserver.disconnect();\n host.cancelFrame(mutationHandle);\n host.cancelFrame(loopHandle);\n document.removeEventListener('transitionstart', onTransitionStart, true);\n document.removeEventListener('transitionend', onTransitionEnd, true);\n document.removeEventListener('transitioncancel', onTransitionEnd, true);\n document.removeEventListener('pointerover', onPointerOver);\n document.removeEventListener('pointerout', onPointerOut);\n host.canvas.removeEventListener('webglcontextlost', onContextLost);\n host.canvas.removeEventListener('webglcontextrestored', onContextRestored);\n },\n };\n // The current appearance, applied at once: a driver re-created by its host (a new renderer, a new camera) must\n // not wait for the NEXT appearance change to show anything.\n driver.setAppearance(initialAppearance);\n return driver;\n}\n\n/** A stable identity per transitioning element, so two elements animating the same property are two entries. */\nconst transitionTargetIds = new WeakMap<object, number>();\nlet nextTransitionTargetId = 0;\nfunction transitionTargetId(target: EventTarget | null): number {\n if (!target) return -1;\n let id = transitionTargetIds.get(target);\n if (id === undefined) { id = nextTransitionTargetId++; transitionTargetIds.set(target, id); }\n return id;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"frame-renderer.js","sourceRoot":"","sources":["../../../../src/frame/frame-renderer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAS,IAAI,EAAE,WAAW,EAAE,aAAa,EAAE,cAAc,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAClH,OAAO,EAAE,WAAW,EAAE,MAAM,qCAAqC,CAAC;AAElE,OAAO,EAAE,0BAA0B,EAAE,4BAA4B,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAGhH,OAAO,EAAE,wBAAwB,EAAE,MAAM,6BAA6B,CAAC;AACvE,OAAO,EAAE,iBAAiB,EAA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C;AACvC,CAAC","sourcesContent":["import { CustomBlending, Group, Mesh, MinEquation, PlaneGeometry, ShaderMaterial, Vector2, Vector3 } from 'three';\nimport { ShellRegion } from '@wildo-ai/presets-components-models';\n\nimport { FRAME_BODY_FRAGMENT_SHADER, FRAME_SHADOW_FRAGMENT_SHADER, FRAME_VERTEX_SHADER } from './frame-shaders';\nimport type { FrameAppearance, FrameEasing, FrameSlabAppearance, FrameSpring } from './frame-appearance';\nimport type { FrameColor } from './frame-color';\nimport { regionCentreInFrameUnits } from '../shell-region-measurement';\nimport { frameChoreography, rimsFocusedZone, type FrameChoreography } from '../layout/layout-3d-transition-choreography';\nimport { Layout3DFrameChoreography, Layout3DZoneFocusTransition, type Layout3DTransitions } from '../layout/layout-3d-vocabulary';\n\n/** One region the frame draws under, as measured off the DOM. */\nexport interface FrameRegionBox {\n /** The region's element: the identity a slab (and its hover state) follows across redraws. */\n element: object;\n region: ShellRegion;\n left: number;\n top: number;\n width: number;\n height: number;\n /** The region already renders a glass material (`data-material-kind=\"glass\"`): no slab under it (#1823, no double glass). */\n glass: boolean;\n}\n\n/** One navigation zone inside the content region, as measured off the DOM (#1826). */\nexport interface FrameZoneBox {\n /** The zone container: the identity its rim emphasis follows across redraws. */\n element: object;\n left: number;\n top: number;\n width: number;\n height: number;\n}\n\n/** The canvas' size in CSS pixels, which the orthographic camera is fitted to. */\nexport interface FrameViewport {\n width: number;\n height: number;\n}\n\n/** Draw order: the background, then every shadow, then every body — so no shadow lands on a slab. */\nenum FrameRenderOrder {\n BACKGROUND = 0,\n SHADOW = 1,\n BODY = 2,\n /** The focused zone's rim, over the content slab it sits in. */\n ZONE_RIM = 3,\n}\n\n/**\n * A slab's numbers, flattened so a theme change can interpolate all of them at once:\n * fillFrom(3) fillTo(3) fillAlpha rim(3) rimAlpha rimHoverAlpha rimWidth radius shadowX shadowY shadowBlur\n * shadowAlpha presence.\n */\ntype SlabVector = number[];\n/** The background's numbers: from(3) to(3) presence. */\ntype BackgroundVector = number[];\n\ninterface DisplayedFrame {\n regions: Record<ShellRegion, SlabVector>;\n background: BackgroundVector;\n lightAngleDeg: number;\n}\n\ninterface Tween<T> {\n from: T;\n to: T;\n /** Set on the first tick after the tween is created, so a tween started between frames loses no time. */\n start: number | null;\n seconds: number;\n easing: FrameEasing;\n}\n\n/** A rim's hover emphasis: 0 at rest, 1 fully emphasised. Driven by a spring when the theme declares one. */\ninterface HoverState {\n value: number;\n target: number;\n velocity: number;\n /** The eased path, when there is no spring. */\n tween: Tween<number> | null;\n spring: FrameSpring | null;\n lastTick: number | null;\n}\n\n/**\n * What starts a transition of the frame (#1826). The driver reports each start to its host, which is how a live\n * probe tells that a choreography ran rather than inferring it from draws.\n */\nexport enum FrameTransitionTrigger {\n /** A structural zone's top entry became another place. Plays the layout's `navigation` choreography. */\n NAVIGATION = 'navigation',\n /** The sidebar's width changed while it stayed on screen. Plays the layout's `sidebarResize` choreography. */\n SIDEBAR_RESIZE = 'sidebar-resize',\n /** The focused zone of a split changed, and the layout rims it. */\n ZONE_FOCUS = 'zone-focus',\n}\n\n/** What a {@link FrameRenderer.pulse} call did. */\nexport enum FramePulseOutcome {\n /** Nothing plays: no choreography for the trigger, reduced motion, or no appearance yet. */\n NOT_PLAYED = 'not-played',\n /** A new pulse started (from rest, or a new rise out of a settle): a transition the driver reports. */\n STARTED = 'started',\n /** The trigger's pulse was already rising and keeps rising: nothing new to report. */\n ALREADY_RISING = 'already-rising',\n}\n\n/** The triggers that play a pulse-shaped {@link Layout3DFrameChoreography}. */\nexport type FramePulseTrigger = FrameTransitionTrigger.NAVIGATION | FrameTransitionTrigger.SIDEBAR_RESIZE;\n\n/**\n * One trigger's pulse (#1826): a RISE from wherever it stands to 1, then a SETTLE back to 0, each over half the\n * pulse's duration. The same trigger while it RISES changes nothing; while it SETTLES, it starts a new rise from the\n * CURRENT strength. So a quick run of navigations, or a sidebar whose width changes on every frame of its animation,\n * holds the pulse up without ever making the frame jump.\n */\ninterface FramePulse {\n rising: boolean;\n tween: Tween<number>;\n /** The strength after the last tick: where a restarted rise begins. */\n value: number;\n}\n\ninterface SlabMeshes {\n body: Mesh<PlaneGeometry, ShaderMaterial>;\n shadow: Mesh<PlaneGeometry, ShaderMaterial>;\n}\n\nconst PRESENCE = 18;\nconst SLAB_SIZE = PRESENCE + 1;\n/** A spring is considered at rest once it is this close to its target and this slow. */\nconst SPRING_REST = 1e-3;\n/** Integration step for a spring, in seconds: small enough to stay stable for any stiffness a theme declares. */\nconst SPRING_STEP_SECONDS = 1 / 240;\n\n/**\n * The frame's scene, driven imperatively (#1823).\n *\n * It owns the meshes and their uniforms and nothing else: WHEN to draw is the canvas driver's decision. Every\n * method is a plain state change plus {@link tick}, which applies the state for an instant and says whether\n * anything is still animating — so the whole scene logic runs, and is tested, without a WebGL context.\n *\n * Hover emphasises the RIM only, and its progress is clamped to 0–1 even when a spring overshoots. The frost never\n * changes on hover, so hover cannot take a colour outside the contrast bound the appearance derivation proved.\n */\nexport class FrameRenderer {\n private readonly geometry = new PlaneGeometry(1, 1);\n private readonly backgroundMesh: Mesh<PlaneGeometry, ShaderMaterial>;\n private readonly slabs: SlabMeshes[] = [];\n private boxes: FrameRegionBox[] = [];\n private viewport: FrameViewport = { width: 0, height: 0 };\n private layoutSignature = '';\n /** What is on screen now: the last frame applied, mid-cross-fade included. A new appearance fades FROM this. */\n private shown: DisplayedFrame | null = null;\n private tween: Tween<DisplayedFrame> | null = null;\n private appearance: FrameAppearance | null = null;\n private hovered: object | null = null;\n private readonly hover = new Map<object, HoverState>();\n private readonly choreographies: Record<FramePulseTrigger, FrameChoreography>;\n private readonly rimsFocusedZone: boolean;\n private readonly pulses = new Map<FramePulseTrigger, FramePulse>();\n /** The zone the rim is moving toward, or null. */\n private rimmed: object | null = null;\n private zones: FrameZoneBox[] = [];\n private zoneSignature = '';\n private focusedZone: object | null = null;\n /** Each zone's rim emphasis, 0 to 1, stepped exactly like a hover emphasis. */\n private readonly zoneEmphasis = new Map<object, HoverState>();\n private readonly zoneRims: Mesh<PlaneGeometry, ShaderMaterial>[] = [];\n\n /**\n * @param transitions What the layout plays on a navigation, a sidebar resize and a zone focus. Defaults to nothing:\n * a renderer with no layout behind it (a test, a probe) draws the regions and moves only on appearance and hover.\n */\n constructor(\n private readonly group: Group,\n transitions: Pick<Layout3DTransitions, 'navigation' | 'sidebarResize' | 'zoneFocus'> = {\n navigation: Layout3DFrameChoreography.NONE,\n sidebarResize: Layout3DFrameChoreography.NONE,\n zoneFocus: Layout3DZoneFocusTransition.NONE,\n },\n ) {\n this.choreographies = {\n [FrameTransitionTrigger.NAVIGATION]: frameChoreography(transitions.navigation),\n [FrameTransitionTrigger.SIDEBAR_RESIZE]: frameChoreography(transitions.sidebarResize),\n };\n this.rimsFocusedZone = rimsFocusedZone(transitions.zoneFocus);\n this.backgroundMesh = new Mesh(this.geometry, bodyMaterial());\n this.backgroundMesh.renderOrder = FrameRenderOrder.BACKGROUND;\n this.backgroundMesh.visible = false;\n group.add(this.backgroundMesh);\n }\n\n /**\n * The appearance to draw. With `animate`, the change cross-fades over the appearance's transition time —\n * except when the FOREGROUND changed (a light/dark switch): text switches colour at once, and a backdrop\n * halfway between two modes is bounded against neither foreground, so the frame switches at once too.\n */\n setAppearance(appearance: FrameAppearance | null, options: { animate: boolean }): void {\n const previous = this.appearance;\n const target = displayedOf(appearance, this.shown);\n if (appearance) this.appearance = appearance;\n // Reduced motion turned on mid-hover: the frame is static from now on, so the emphasis goes at once.\n if (appearance && !appearance.hoverResponse) {\n this.hovered = null;\n this.hover.clear();\n this.pulses.clear();\n this.zoneEmphasis.clear();\n }\n // A reduced-motion switch (either way) or a new gesture spring changes what the focused zone's rim should do.\n this.retargetZoneEmphasis();\n const seconds = appearance?.transitionSeconds ?? 0;\n const foregroundChanged = Boolean(previous && appearance && !sameColor(previous.foreground, appearance.foreground));\n if (!options.animate || !this.shown || seconds <= 0 || foregroundChanged) {\n this.shown = target;\n this.tween = null;\n return;\n }\n this.tween = { from: fadeInFrom(this.shown, target), to: target, start: null, seconds, easing: appearance?.transitionEasing ?? [0, 0, 1, 1] };\n }\n\n /** The measured regions. Returns false when nothing moved, so the caller can skip the frame entirely. */\n setLayout(boxes: FrameRegionBox[], viewport: FrameViewport): boolean {\n const signature = `${viewport.width}x${viewport.height}|${boxes.map((b) => `${b.region}:${b.left},${b.top},${b.width},${b.height},${b.glass ? 'g' : ''}`).join(';')}`;\n this.boxes = boxes;\n this.viewport = viewport;\n // A region that left takes its hover state with it (an organization switch remounts regions).\n const present = new Set(boxes.map((box) => box.element));\n for (const key of this.hover.keys()) if (!present.has(key)) this.hover.delete(key);\n if (this.hovered && !present.has(this.hovered)) this.hovered = null;\n if (signature === this.layoutSignature) return false;\n this.layoutSignature = signature;\n return true;\n }\n\n /**\n * The region element under the pointer, or null. Its rim moves toward the hover opacity — unless the\n * appearance says the frame is static (reduced motion). Returns whether anything will change on screen.\n */\n setHovered(element: object | null): boolean {\n const next = this.appearance?.hoverResponse ? element : null;\n if (next === this.hovered) return false;\n for (const [key, target] of [[this.hovered, 0], [next, 1]] as const) {\n if (!key) continue;\n const state = this.hover.get(key) ?? { value: 0, target: 0, velocity: 0, tween: null, spring: null, lastTick: null };\n state.target = target;\n state.spring = this.appearance?.hoverSpring ?? null;\n state.tween = state.spring ? null : { from: state.value, to: target, start: null, seconds: this.appearance?.hoverSeconds ?? 0, easing: this.appearance?.hoverEasing ?? [0, 0, 1, 1] };\n state.lastTick = null;\n this.hover.set(key, state);\n }\n this.hovered = next;\n return true;\n }\n\n /**\n * A shell state changed (#1826): play the layout's choreography for that trigger. Nothing plays when the layout\n * declares none for it, under reduced motion (the frame is static), or when the theme's motion duration is zero.\n * Says whether a pulse STARTED, was already rising, or nothing plays.\n */\n pulse(trigger: FramePulseTrigger): FramePulseOutcome {\n const appearance = this.appearance;\n const choreography = this.choreographies[trigger];\n if (!choreography.plays || !appearance || !appearance.hoverResponse || appearance.transitionSeconds <= 0) return FramePulseOutcome.NOT_PLAYED;\n // Already rising: let it rise. Restarting would re-anchor its clock on every call, and a sidebar calls on every\n // frame of its width animation, so the pulse would never leave where it stood until the sidebar stopped.\n if (this.pulses.get(trigger)?.rising) return FramePulseOutcome.ALREADY_RISING;\n const halfSeconds = (appearance.transitionSeconds * choreography.durationFactor) / 2;\n const from = this.pulses.get(trigger)?.value ?? 0;\n this.pulses.set(trigger, { rising: true, value: from, tween: { from, to: 1, start: null, seconds: halfSeconds, easing: appearance.transitionEasing } });\n return FramePulseOutcome.STARTED;\n }\n\n /** The zone whose rim is shown or moving in, or null: what the driver compares to report a zone-focus transition. */\n rimmedZone(): object | null {\n return this.rimmed;\n }\n\n /**\n * The navigation zones inside the content region, and the focused one (the navigation state's `focusedZone`), or\n * null. When the layout rims the focused zone and two or more zones are side by side, the focused one's rim moves\n * toward full emphasis and every other zone's back to none. Returns whether anything will change on screen.\n */\n setZones(zones: FrameZoneBox[], focused: object | null): boolean {\n const signature = zones.map((zone) => `${zone.left},${zone.top},${zone.width},${zone.height}`).join(';');\n const moved = signature !== this.zoneSignature;\n this.zoneSignature = signature;\n this.zones = zones;\n const present = new Set(zones.map((zone) => zone.element));\n for (const key of this.zoneEmphasis.keys()) if (!present.has(key)) this.zoneEmphasis.delete(key);\n this.focusedZone = focused && present.has(focused) ? focused : null;\n return this.retargetZoneEmphasis() || moved;\n }\n\n /** Whether a cross-fade, a hover or zone emphasis, or a pulse is still moving: the only reasons to draw when no region moved. */\n hasPendingMotion(): boolean {\n if (this.tween || this.pulses.size > 0) return true;\n for (const state of this.hover.values()) if (!hoverSettled(state)) return true;\n for (const state of this.zoneEmphasis.values()) if (!hoverSettled(state)) return true;\n return false;\n }\n\n /** Apply the state for instant `now` (ms). Returns true while a cross-fade or a hover emphasis is still moving. */\n tick(now: number): boolean {\n if (this.tween) {\n const { eased, done } = advance(this.tween, now);\n if (done) {\n this.shown = this.tween.to;\n this.tween = null;\n } else {\n this.shown = interpolateFrame(this.tween.from, this.tween.to, eased);\n }\n }\n for (const [key, state] of this.hover) {\n stepHover(state, now);\n if (hoverSettled(state) && state.target === 0) this.hover.delete(key);\n }\n for (const [key, state] of this.zoneEmphasis) {\n stepHover(state, now);\n if (hoverSettled(state) && state.target === 0) this.zoneEmphasis.delete(key);\n }\n for (const [trigger, pulse] of this.pulses) {\n const { eased, done } = advance(pulse.tween, now);\n const { from, to } = pulse.tween;\n pulse.value = from + (to - from) * eased;\n if (done && pulse.rising) {\n const easing = this.appearance?.transitionEasing ?? [0, 0, 1, 1];\n this.pulses.set(trigger, { rising: false, value: 1, tween: { from: 1, to: 0, start: now, seconds: pulse.tween.seconds, easing } });\n } else if (done) {\n this.pulses.delete(trigger);\n }\n }\n this.apply(this.shown);\n return this.hasPendingMotion();\n }\n\n dispose(): void {\n this.group.remove(this.backgroundMesh);\n this.backgroundMesh.material.dispose();\n for (const slab of this.slabs) {\n this.group.remove(slab.body, slab.shadow);\n slab.body.material.dispose();\n slab.shadow.material.dispose();\n }\n this.slabs.length = 0;\n for (const rim of this.zoneRims) {\n this.group.remove(rim);\n rim.material.dispose();\n }\n this.zoneRims.length = 0;\n this.geometry.dispose();\n }\n\n private apply(frame: DisplayedFrame | null): void {\n const { width, height } = this.viewport;\n // Each pulse's strength, 0 at rest: `sin` shapes the rise-and-settle into one smooth swell. Two pulses at once (a\n // navigation that also resized the sidebar) combine by their MAXIMUM, never by summing: the frame never moves\n // further than one choreography would move it.\n let lightSweepDeg = 0;\n let shadowSpread = 0;\n let rimLift = 0;\n for (const [trigger, pulse] of this.pulses) {\n const strength = Math.sin((Math.PI / 2) * clamp01(pulse.value));\n const choreography = this.choreographies[trigger];\n lightSweepDeg = Math.max(lightSweepDeg, choreography.lightSweepDeg * strength);\n shadowSpread = Math.max(shadowSpread, choreography.shadowSpread * strength);\n rimLift = Math.max(rimLift, choreography.rimLift * strength);\n }\n const light = frame ? (frame.lightAngleDeg + lightSweepDeg) * (Math.PI / 180) : 0;\n const lightDir = new Vector2(Math.cos(light), Math.sin(light));\n\n const background = frame?.background;\n this.backgroundMesh.visible = Boolean(background && background[6]! > 0 && width > 0 && height > 0);\n if (background && this.backgroundMesh.visible) {\n setBody(this.backgroundMesh.material, {\n size: [width, height],\n quad: [width + 2, height + 2],\n radius: 0,\n fillFrom: background.slice(0, 3),\n fillTo: background.slice(3, 6),\n fillAlpha: 1,\n rim: [0, 0, 0],\n rimAlpha: 0,\n rimWidth: 0,\n lightDir,\n presence: background[6]!,\n });\n this.backgroundMesh.scale.set(width + 2, height + 2, 1);\n this.backgroundMesh.position.set(0, 0, 0);\n }\n\n while (this.slabs.length < this.boxes.length) this.slabs.push(this.createSlab());\n this.slabs.forEach((slab, index) => {\n const box = this.boxes[index];\n const params = box && frame ? frame.regions[box.region] : undefined;\n const presence = params && box && !box.glass ? params[PRESENCE]! : 0;\n slab.body.visible = presence > 0;\n slab.shadow.visible = presence > 0 && params![17]! > 0 && this.backgroundMesh.visible;\n if (!box || !params || presence <= 0) return;\n\n const centre = regionCentreInFrameUnits(box, this.viewport);\n const radius = params[13]!;\n // The content slab carries the lift: its rim toward the hover opacity (never past it), its shadow further.\n const isContent = box.region === ShellRegion.CONTENT;\n const hover = Math.max(clamp01(this.hover.get(box.element)?.value ?? 0), isContent ? rimLift : 0);\n setBody(slab.body.material, {\n size: [box.width, box.height],\n quad: [box.width + 2, box.height + 2],\n radius,\n fillFrom: params.slice(0, 3),\n fillTo: params.slice(3, 6),\n fillAlpha: params[6]!,\n rim: params.slice(7, 10),\n rimAlpha: params[10]! + (params[11]! - params[10]!) * hover,\n rimWidth: params[12]!,\n lightDir,\n presence,\n });\n slab.body.scale.set(box.width + 2, box.height + 2, 1);\n slab.body.position.set(centre.x, centre.y, 0);\n\n if (!slab.shadow.visible) return;\n // Blur and offset grow with the lift; the opacity never does (the frost bound covers the strongest shadow's opacity anywhere).\n const spread = 1 + (isContent ? shadowSpread : 0);\n const [offsetX, offsetY, blur, alpha] = [params[14]! * spread, params[15]! * spread, params[16]! * spread, params[17]!];\n const margin = blur + 2;\n const u = slab.shadow.material.uniforms;\n (u.uSize!.value as Vector2).set(box.width, box.height);\n (u.uQuad!.value as Vector2).set(box.width + 2 * margin, box.height + 2 * margin);\n u.uRadius!.value = radius;\n u.uBlur!.value = blur;\n u.uAlpha!.value = alpha;\n u.uPresence!.value = presence;\n (u.uBgFrom!.value as Vector3).set(background![0]!, background![1]!, background![2]!);\n (u.uBgTo!.value as Vector3).set(background![3]!, background![4]!, background![5]!);\n (u.uBgSize!.value as Vector2).set(width, height);\n (u.uLightDir!.value as Vector2).copy(lightDir);\n slab.shadow.scale.set(box.width + 2 * margin, box.height + 2 * margin, 1);\n // The DOM's y axis points down and three.js' up, so a downward CSS offset is a negative y.\n slab.shadow.position.set(centre.x + offsetX, centre.y - offsetY, 0);\n });\n\n this.applyZoneRims(frame, lightDir);\n }\n\n /**\n * The focused zone's rim, drawn over the content slab: the content slab's rim colour and width, at most its HOVER\n * opacity, and no fill. Each rim is inset from the content box by the content rim's own width, so it never lands\n * on the content slab's rim band — where it is drawn, it is exactly the case the contrast bound was proved for.\n */\n private applyZoneRims(frame: DisplayedFrame | null, lightDir: Vector2): void {\n const content = this.boxes.find((box) => box.region === ShellRegion.CONTENT);\n const params = frame?.regions[ShellRegion.CONTENT];\n const drawable = Boolean(content && params && !content.glass && params[PRESENCE]! > 0);\n const shown = drawable ? this.zones.filter((zone) => (this.zoneEmphasis.get(zone.element)?.value ?? 0) > 0) : [];\n while (this.zoneRims.length < shown.length) {\n const rim = new Mesh(this.geometry, bodyMaterial());\n rim.renderOrder = FrameRenderOrder.ZONE_RIM;\n this.group.add(rim);\n this.zoneRims.push(rim);\n }\n this.zoneRims.forEach((rim, index) => {\n const zone = shown[index];\n rim.visible = false;\n if (!zone || !content || !params) return;\n const inset = params[12]! + 1;\n const left = Math.max(zone.left, content.left + inset);\n const top = Math.max(zone.top, content.top + inset);\n const right = Math.min(zone.left + zone.width, content.left + content.width - inset);\n const bottom = Math.min(zone.top + zone.height, content.top + content.height - inset);\n if (right - left <= 0 || bottom - top <= 0) return;\n const emphasis = clamp01(this.zoneEmphasis.get(zone.element)?.value ?? 0);\n const box = { left, top, width: right - left, height: bottom - top };\n const centre = regionCentreInFrameUnits(box, this.viewport);\n rim.visible = true;\n setBody(rim.material, {\n size: [box.width, box.height],\n quad: [box.width + 2, box.height + 2],\n radius: Math.max(0, params[13]! - inset),\n fillFrom: params.slice(0, 3),\n fillTo: params.slice(3, 6),\n fillAlpha: 0,\n rim: params.slice(7, 10),\n rimAlpha: params[11]! * emphasis,\n rimWidth: params[12]!,\n lightDir,\n presence: params[PRESENCE]!,\n });\n rim.scale.set(box.width + 2, box.height + 2, 1);\n rim.position.set(centre.x, centre.y, 0);\n });\n }\n\n /** Point every zone's rim emphasis at its target: 1 for the focused zone of a split, 0 otherwise. Returns whether any target moved. */\n private retargetZoneEmphasis(): boolean {\n const active = this.rimsFocusedZone && Boolean(this.appearance?.hoverResponse) && this.zones.length >= 2 ? this.focusedZone : null;\n this.rimmed = active;\n let changed = false;\n for (const zone of this.zones) {\n const target = zone.element === active ? 1 : 0;\n const state = this.zoneEmphasis.get(zone.element);\n if ((state?.target ?? 0) === target) continue;\n const next = state ?? { value: 0, target: 0, velocity: 0, tween: null, spring: null, lastTick: null };\n next.target = target;\n next.spring = this.appearance?.hoverSpring ?? null;\n next.tween = next.spring ? null : { from: next.value, to: target, start: null, seconds: this.appearance?.hoverSeconds ?? 0, easing: this.appearance?.hoverEasing ?? [0, 0, 1, 1] };\n next.lastTick = null;\n this.zoneEmphasis.set(zone.element, next);\n changed = true;\n }\n return changed;\n }\n\n private createSlab(): SlabMeshes {\n const body = new Mesh(this.geometry, bodyMaterial());\n body.renderOrder = FrameRenderOrder.BODY;\n const shadow = new Mesh(this.geometry, shadowMaterial());\n shadow.renderOrder = FrameRenderOrder.SHADOW;\n this.group.add(shadow, body);\n return { body, shadow };\n }\n}\n\n/** A cubic-Bézier easing evaluated at `x` in 0–1, as CSS `cubic-bezier()` defines it (x → y, solved by Newton then bisection). */\nexport function evaluateEasing([x1, y1, x2, y2]: FrameEasing, x: number): number {\n if (x <= 0) return 0;\n if (x >= 1) return 1;\n const sample = (a: number, b: number, t: number): number => ((1 - 3 * b + 3 * a) * t + (3 * b - 6 * a)) * t * t + 3 * a * t;\n const slope = (a: number, b: number, t: number): number => 3 * (1 - 3 * b + 3 * a) * t * t + 2 * (3 * b - 6 * a) * t + 3 * a;\n let t = x;\n for (let i = 0; i < 8; i += 1) {\n const error = sample(x1, x2, t) - x;\n if (Math.abs(error) < 1e-6) return sample(y1, y2, t);\n const d = slope(x1, x2, t);\n if (Math.abs(d) < 1e-6) break;\n t -= error / d;\n }\n let low = 0;\n let high = 1;\n t = x;\n for (let i = 0; i < 30; i += 1) {\n const value = sample(x1, x2, t);\n if (Math.abs(value - x) < 1e-6) break;\n if (value < x) low = t; else high = t;\n t = (low + high) / 2;\n }\n return sample(y1, y2, t);\n}\n\n/**\n * A tween's progress at `now`.\n *\n * - `eased` is CLAMPED to 0–1. A theme's easing token may overshoot (a y control point above 1 — the engine's own\n * `emphasized` easing does), and an overshooting cross-fade would pass its target: colours outside 0–1, a frost\n * more opaque than the bound was computed for. The frame follows the curve's shape inside the range only.\n * - `done` is decided by ELAPSED TIME, never by the eased value: an overshooting curve reaches 1 early, and ending\n * the tween there would cut the transition short.\n */\nfunction advance<T>(tween: Tween<T>, now: number): { eased: number; done: boolean } {\n if (tween.seconds <= 0) return { eased: 1, done: true };\n if (tween.start === null) tween.start = now;\n const linear = Math.min(1, Math.max(0, (now - tween.start) / (tween.seconds * 1000)));\n return linear >= 1 ? { eased: 1, done: true } : { eased: clamp01(evaluateEasing(tween.easing, linear)), done: false };\n}\n\nfunction stepHover(state: HoverState, now: number): void {\n if (state.tween) {\n const { eased, done } = advance(state.tween, now);\n state.value = state.tween.from + (state.tween.to - state.tween.from) * eased;\n if (done) state.tween = null;\n return;\n }\n if (!state.spring) return;\n const last = state.lastTick ?? now;\n state.lastTick = now;\n let remaining = Math.min(0.25, Math.max(0, (now - last) / 1000));\n const { stiffness, damping, mass } = state.spring;\n while (remaining > 0) {\n const dt = Math.min(SPRING_STEP_SECONDS, remaining);\n const acceleration = (-stiffness * (state.value - state.target) - damping * state.velocity) / mass;\n state.velocity += acceleration * dt;\n state.value += state.velocity * dt;\n remaining -= dt;\n }\n if (Math.abs(state.value - state.target) < SPRING_REST && Math.abs(state.velocity) < SPRING_REST) {\n state.value = state.target;\n state.velocity = 0;\n }\n}\n\nfunction hoverSettled(state: HoverState): boolean {\n if (state.tween) return false;\n return state.value === state.target && state.velocity === 0;\n}\n\nfunction clamp01(value: number): number {\n return Math.min(1, Math.max(0, value));\n}\n\nfunction sameColor(a: FrameColor, b: FrameColor): boolean {\n return a.every((channel, i) => Math.abs(channel - b[i]!) < 1e-9);\n}\n\nfunction slabVector(slab: FrameSlabAppearance): SlabVector {\n return [\n ...slab.fillFrom, ...slab.fillTo, slab.fillAlpha,\n ...slab.rim, slab.rimAlpha, slab.rimHoverAlpha, slab.rimWidthPx, slab.radiusPx,\n slab.shadowOffsetXPx, slab.shadowOffsetYPx, slab.shadowBlurPx, slab.shadowAlpha,\n slab.visible ? 1 : 0,\n ];\n}\n\n/**\n * The numbers to display for an appearance. A null appearance (or an invisible slab) keeps the PREVIOUS colours\n * with presence 0, so a fade-out fades the colours that were on screen instead of flashing to black.\n */\nfunction displayedOf(appearance: FrameAppearance | null, previous: DisplayedFrame | null): DisplayedFrame {\n const regions = {} as Record<ShellRegion, SlabVector>;\n for (const region of Object.values(ShellRegion)) {\n const slab = appearance?.regions[region];\n const prior = previous?.regions[region];\n if (slab?.visible) regions[region] = slabVector(slab);\n else regions[region] = prior ? [...prior.slice(0, PRESENCE), 0] : new Array<number>(SLAB_SIZE).fill(0);\n }\n const background = appearance?.background\n ? [...appearance.background.from, ...appearance.background.to, 1]\n : previous ? [...previous.background.slice(0, 6), 0] : [0, 0, 0, 0, 0, 0, 0];\n return { regions, background, lightAngleDeg: appearance?.lightAngleDeg ?? previous?.lightAngleDeg ?? 0 };\n}\n\n/**\n * The start of a cross-fade: what is on screen, except that anything NOT on screen (presence 0) starts from the\n * TARGET's colours. A slab appearing then fades in as itself — only its presence moves — instead of passing\n * through black, which no contrast bound covers.\n */\nfunction fadeInFrom(shown: DisplayedFrame, target: DisplayedFrame): DisplayedFrame {\n const regions = {} as Record<ShellRegion, SlabVector>;\n for (const region of Object.values(ShellRegion)) {\n const current = shown.regions[region];\n regions[region] = current[PRESENCE]! > 0 ? current : [...target.regions[region].slice(0, PRESENCE), 0];\n }\n const background = shown.background[6]! > 0 ? shown.background : [...target.background.slice(0, 6), 0];\n return { regions, background, lightAngleDeg: shown.lightAngleDeg };\n}\n\nfunction interpolateFrame(from: DisplayedFrame, to: DisplayedFrame, t: number): DisplayedFrame {\n const lerp = (a: number[], b: number[]): number[] => a.map((value, i) => value + (b[i]! - value) * t);\n const regions = {} as Record<ShellRegion, SlabVector>;\n for (const region of Object.values(ShellRegion)) regions[region] = lerp(from.regions[region], to.regions[region]);\n return { regions, background: lerp(from.background, to.background), lightAngleDeg: from.lightAngleDeg + (to.lightAngleDeg - from.lightAngleDeg) * t };\n}\n\nfunction bodyMaterial(): ShaderMaterial {\n return new ShaderMaterial({\n vertexShader: FRAME_VERTEX_SHADER,\n fragmentShader: FRAME_BODY_FRAGMENT_SHADER,\n transparent: true,\n depthTest: false,\n depthWrite: false,\n toneMapped: false,\n uniforms: {\n uSize: { value: new Vector2() },\n uQuad: { value: new Vector2() },\n uRadius: { value: 0 },\n uFillFrom: { value: new Vector3() },\n uFillTo: { value: new Vector3() },\n uFillAlpha: { value: 0 },\n uRim: { value: new Vector3() },\n uRimAlpha: { value: 0 },\n uRimWidth: { value: 0 },\n uLightDir: { value: new Vector2(0, 1) },\n uPresence: { value: 0 },\n },\n });\n}\n\n/** The shadow writes an opaque, darkened background with MIN blending: overlapping shadows never stack. */\nfunction shadowMaterial(): ShaderMaterial {\n return new ShaderMaterial({\n vertexShader: FRAME_VERTEX_SHADER,\n fragmentShader: FRAME_SHADOW_FRAGMENT_SHADER,\n transparent: true,\n depthTest: false,\n depthWrite: false,\n toneMapped: false,\n blending: CustomBlending,\n blendEquation: MinEquation,\n uniforms: {\n uSize: { value: new Vector2() },\n uQuad: { value: new Vector2() },\n uRadius: { value: 0 },\n uBlur: { value: 0 },\n uAlpha: { value: 0 },\n uPresence: { value: 0 },\n uBgFrom: { value: new Vector3() },\n uBgTo: { value: new Vector3() },\n uBgSize: { value: new Vector2() },\n uLightDir: { value: new Vector2(0, 1) },\n },\n });\n}\n\nfunction setBody(\n material: ShaderMaterial,\n values: {\n size: [number, number];\n quad: [number, number];\n radius: number;\n fillFrom: number[];\n fillTo: number[];\n fillAlpha: number;\n rim: number[];\n rimAlpha: number;\n rimWidth: number;\n lightDir: Vector2;\n presence: number;\n },\n): void {\n const u = material.uniforms;\n (u.uSize!.value as Vector2).set(...values.size);\n (u.uQuad!.value as Vector2).set(...values.quad);\n u.uRadius!.value = values.radius;\n (u.uFillFrom!.value as Vector3).set(values.fillFrom[0]!, values.fillFrom[1]!, values.fillFrom[2]!);\n (u.uFillTo!.value as Vector3).set(values.fillTo[0]!, values.fillTo[1]!, values.fillTo[2]!);\n u.uFillAlpha!.value = values.fillAlpha;\n (u.uRim!.value as Vector3).set(values.rim[0]!, values.rim[1]!, values.rim[2]!);\n u.uRimAlpha!.value = values.rimAlpha;\n u.uRimWidth!.value = values.rimWidth;\n (u.uLightDir!.value as Vector2).copy(values.lightDir);\n u.uPresence!.value = values.presence;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"frame-renderer.js","sourceRoot":"","sources":["../../../src/frame/frame-renderer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAS,IAAI,EAAE,WAAW,EAAE,aAAa,EAAE,cAAc,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAClH,OAAO,EAAE,WAAW,EAAE,MAAM,qCAAqC,CAAC;AAElE,OAAO,EAAE,0BAA0B,EAAE,4BAA4B,EAA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KAAiB,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;IACtD,CAAC,CAAC,SAAU,CAAC,KAAK,GAAG,MAAM,CAAC,QAAQ,CAAC;AACvC,CAAC","sourcesContent":["import { CustomBlending, Group, Mesh, MinEquation, PlaneGeometry, ShaderMaterial, Vector2, Vector3 } from 'three';\nimport { ShellRegion } from '@wildo-ai/presets-components-models';\n\nimport { FRAME_BODY_FRAGMENT_SHADER, FRAME_SHADOW_FRAGMENT_SHADER, FRAME_VERTEX_SHADER } from './frame-shaders';\nimport type { FrameAppearance, FrameEasing, FrameSlabAppearance, FrameSpring } from './frame-appearance';\nimport type { FrameColor } from './frame-color';\nimport { regionCentreInFrameUnits } from '../shell-region-measurement';\nimport { frameChoreography, rimsFocusedZone, type FrameChoreography } from '../layout/layout-3d-transition-choreography';\nimport { Layout3DFrameChoreography, Layout3DZoneFocusTransition, type Layout3DTransitions } from '../layout/layout-3d-vocabulary';\n\n/** One region the frame draws under, as measured off the DOM. */\nexport interface FrameRegionBox {\n /** The region's element: the identity a slab (and its hover state) follows across redraws. */\n element: object;\n region: ShellRegion;\n left: number;\n top: number;\n width: number;\n height: number;\n /** The region already renders a glass material (`data-material-kind=\"glass\"`): no slab under it (#1823, no double glass). */\n glass: boolean;\n}\n\n/** One navigation zone inside the content region, as measured off the DOM (#1826). */\nexport interface FrameZoneBox {\n /** The zone container: the identity its rim emphasis follows across redraws. */\n element: object;\n left: number;\n top: number;\n width: number;\n height: number;\n}\n\n/** The canvas' size in CSS pixels, which the orthographic camera is fitted to. */\nexport interface FrameViewport {\n width: number;\n height: number;\n}\n\n/** Draw order: the background, then every shadow, then every body — so no shadow lands on a slab. */\nenum FrameRenderOrder {\n BACKGROUND = 0,\n SHADOW = 1,\n BODY = 2,\n /** The focused zone's rim, over the content slab it sits in. */\n ZONE_RIM = 3,\n}\n\n/**\n * A slab's numbers, flattened so a theme change can interpolate all of them at once:\n * fillFrom(3) fillTo(3) fillAlpha rim(3) rimAlpha rimHoverAlpha rimWidth radius shadowX shadowY shadowBlur\n * shadowAlpha presence.\n */\ntype SlabVector = number[];\n/** The background's numbers: from(3) to(3) presence. */\ntype BackgroundVector = number[];\n\ninterface DisplayedFrame {\n regions: Record<ShellRegion, SlabVector>;\n background: BackgroundVector;\n lightAngleDeg: number;\n}\n\ninterface Tween<T> {\n from: T;\n to: T;\n /** Set on the first tick after the tween is created, so a tween started between frames loses no time. */\n start: number | null;\n seconds: number;\n easing: FrameEasing;\n}\n\n/** A rim's hover emphasis: 0 at rest, 1 fully emphasised. Driven by a spring when the theme declares one. */\ninterface HoverState {\n value: number;\n target: number;\n velocity: number;\n /** The eased path, when there is no spring. */\n tween: Tween<number> | null;\n spring: FrameSpring | null;\n lastTick: number | null;\n}\n\n/**\n * What starts a transition of the frame (#1826). The driver reports each start to its host, which is how a live\n * probe tells that a choreography ran rather than inferring it from draws.\n */\nexport enum FrameTransitionTrigger {\n /** A structural zone's top entry became another place. Plays the layout's `navigation` choreography. */\n NAVIGATION = 'navigation',\n /** The sidebar's width changed while it stayed on screen. Plays the layout's `sidebarResize` choreography. */\n SIDEBAR_RESIZE = 'sidebar-resize',\n /** The focused zone of a split changed, and the layout rims it. */\n ZONE_FOCUS = 'zone-focus',\n}\n\n/** What a {@link FrameRenderer.pulse} call did. */\nexport enum FramePulseOutcome {\n /** Nothing plays: no choreography for the trigger, reduced motion, or no appearance yet. */\n NOT_PLAYED = 'not-played',\n /** A new pulse started (from rest, or a new rise out of a settle): a transition the driver reports. */\n STARTED = 'started',\n /** The trigger's pulse was already rising and keeps rising: nothing new to report. */\n ALREADY_RISING = 'already-rising',\n}\n\n/** The triggers that play a pulse-shaped {@link Layout3DFrameChoreography}. */\nexport type FramePulseTrigger = FrameTransitionTrigger.NAVIGATION | FrameTransitionTrigger.SIDEBAR_RESIZE;\n\n/**\n * One trigger's pulse (#1826): a RISE from wherever it stands to 1, then a SETTLE back to 0, each over half the\n * pulse's duration. The same trigger while it RISES changes nothing; while it SETTLES, it starts a new rise from the\n * CURRENT strength. So a quick run of navigations, or a sidebar whose width changes on every frame of its animation,\n * holds the pulse up without ever making the frame jump.\n */\ninterface FramePulse {\n rising: boolean;\n tween: Tween<number>;\n /** The strength after the last tick: where a restarted rise begins. */\n value: number;\n}\n\ninterface SlabMeshes {\n body: Mesh<PlaneGeometry, ShaderMaterial>;\n shadow: Mesh<PlaneGeometry, ShaderMaterial>;\n}\n\nconst PRESENCE = 18;\nconst SLAB_SIZE = PRESENCE + 1;\n/** A spring is considered at rest once it is this close to its target and this slow. */\nconst SPRING_REST = 1e-3;\n/** Integration step for a spring, in seconds: small enough to stay stable for any stiffness a theme declares. */\nconst SPRING_STEP_SECONDS = 1 / 240;\n\n/**\n * The frame's scene, driven imperatively (#1823).\n *\n * It owns the meshes and their uniforms and nothing else: WHEN to draw is the canvas driver's decision. Every\n * method is a plain state change plus {@link tick}, which applies the state for an instant and says whether\n * anything is still animating — so the whole scene logic runs, and is tested, without a WebGL context.\n *\n * Hover emphasises the RIM only, and its progress is clamped to 0–1 even when a spring overshoots. The frost never\n * changes on hover, so hover cannot take a colour outside the contrast bound the appearance derivation proved.\n */\nexport class FrameRenderer {\n private readonly geometry = new PlaneGeometry(1, 1);\n private readonly backgroundMesh: Mesh<PlaneGeometry, ShaderMaterial>;\n private readonly slabs: SlabMeshes[] = [];\n private boxes: FrameRegionBox[] = [];\n private viewport: FrameViewport = { width: 0, height: 0 };\n private layoutSignature = '';\n /** What is on screen now: the last frame applied, mid-cross-fade included. A new appearance fades FROM this. */\n private shown: DisplayedFrame | null = null;\n private tween: Tween<DisplayedFrame> | null = null;\n private appearance: FrameAppearance | null = null;\n private hovered: object | null = null;\n private readonly hover = new Map<object, HoverState>();\n private readonly choreographies: Record<FramePulseTrigger, FrameChoreography>;\n private readonly rimsFocusedZone: boolean;\n private readonly pulses = new Map<FramePulseTrigger, FramePulse>();\n /** The zone the rim is moving toward, or null. */\n private rimmed: object | null = null;\n private zones: FrameZoneBox[] = [];\n private zoneSignature = '';\n private focusedZone: object | null = null;\n /** Each zone's rim emphasis, 0 to 1, stepped exactly like a hover emphasis. */\n private readonly zoneEmphasis = new Map<object, HoverState>();\n private readonly zoneRims: Mesh<PlaneGeometry, ShaderMaterial>[] = [];\n\n /**\n * @param transitions What the layout plays on a navigation, a sidebar resize and a zone focus. Defaults to nothing:\n * a renderer with no layout behind it (a test, a probe) draws the regions and moves only on appearance and hover.\n */\n constructor(\n private readonly group: Group,\n transitions: Pick<Layout3DTransitions, 'navigation' | 'sidebarResize' | 'zoneFocus'> = {\n navigation: Layout3DFrameChoreography.NONE,\n sidebarResize: Layout3DFrameChoreography.NONE,\n zoneFocus: Layout3DZoneFocusTransition.NONE,\n },\n ) {\n this.choreographies = {\n [FrameTransitionTrigger.NAVIGATION]: frameChoreography(transitions.navigation),\n [FrameTransitionTrigger.SIDEBAR_RESIZE]: frameChoreography(transitions.sidebarResize),\n };\n this.rimsFocusedZone = rimsFocusedZone(transitions.zoneFocus);\n this.backgroundMesh = new Mesh(this.geometry, bodyMaterial());\n this.backgroundMesh.renderOrder = FrameRenderOrder.BACKGROUND;\n this.backgroundMesh.visible = false;\n group.add(this.backgroundMesh);\n }\n\n /**\n * The appearance to draw. With `animate`, the change cross-fades over the appearance's transition time —\n * except when the FOREGROUND changed (a light/dark switch): text switches colour at once, and a backdrop\n * halfway between two modes is bounded against neither foreground, so the frame switches at once too.\n */\n setAppearance(appearance: FrameAppearance | null, options: { animate: boolean }): void {\n const previous = this.appearance;\n const target = displayedOf(appearance, this.shown);\n if (appearance) this.appearance = appearance;\n // Reduced motion turned on mid-hover: the frame is static from now on, so the emphasis goes at once.\n if (appearance && !appearance.hoverResponse) {\n this.hovered = null;\n this.hover.clear();\n this.pulses.clear();\n this.zoneEmphasis.clear();\n }\n // A reduced-motion switch (either way) or a new gesture spring changes what the focused zone's rim should do.\n this.retargetZoneEmphasis();\n const seconds = appearance?.transitionSeconds ?? 0;\n const foregroundChanged = Boolean(previous && appearance && !sameColor(previous.foreground, appearance.foreground));\n if (!options.animate || !this.shown || seconds <= 0 || foregroundChanged) {\n this.shown = target;\n this.tween = null;\n return;\n }\n this.tween = { from: fadeInFrom(this.shown, target), to: target, start: null, seconds, easing: appearance?.transitionEasing ?? [0, 0, 1, 1] };\n }\n\n /** The measured regions. Returns false when nothing moved, so the caller can skip the frame entirely. */\n setLayout(boxes: FrameRegionBox[], viewport: FrameViewport): boolean {\n const signature = `${viewport.width}x${viewport.height}|${boxes.map((b) => `${b.region}:${b.left},${b.top},${b.width},${b.height},${b.glass ? 'g' : ''}`).join(';')}`;\n this.boxes = boxes;\n this.viewport = viewport;\n // A region that left takes its hover state with it (an organization switch remounts regions).\n const present = new Set(boxes.map((box) => box.element));\n for (const key of this.hover.keys()) if (!present.has(key)) this.hover.delete(key);\n if (this.hovered && !present.has(this.hovered)) this.hovered = null;\n if (signature === this.layoutSignature) return false;\n this.layoutSignature = signature;\n return true;\n }\n\n /**\n * The region element under the pointer, or null. Its rim moves toward the hover opacity — unless the\n * appearance says the frame is static (reduced motion). Returns whether anything will change on screen.\n */\n setHovered(element: object | null): boolean {\n const next = this.appearance?.hoverResponse ? element : null;\n if (next === this.hovered) return false;\n for (const [key, target] of [[this.hovered, 0], [next, 1]] as const) {\n if (!key) continue;\n const state = this.hover.get(key) ?? { value: 0, target: 0, velocity: 0, tween: null, spring: null, lastTick: null };\n state.target = target;\n state.spring = this.appearance?.hoverSpring ?? null;\n state.tween = state.spring ? null : { from: state.value, to: target, start: null, seconds: this.appearance?.hoverSeconds ?? 0, easing: this.appearance?.hoverEasing ?? [0, 0, 1, 1] };\n state.lastTick = null;\n this.hover.set(key, state);\n }\n this.hovered = next;\n return true;\n }\n\n /**\n * A shell state changed (#1826): play the layout's choreography for that trigger. Nothing plays when the layout\n * declares none for it, under reduced motion (the frame is static), or when the theme's motion duration is zero.\n * Says whether a pulse STARTED, was already rising, or nothing plays.\n */\n pulse(trigger: FramePulseTrigger): FramePulseOutcome {\n const appearance = this.appearance;\n const choreography = this.choreographies[trigger];\n if (!choreography.plays || !appearance || !appearance.hoverResponse || appearance.transitionSeconds <= 0) return FramePulseOutcome.NOT_PLAYED;\n // Already rising: let it rise. Restarting would re-anchor its clock on every call, and a sidebar calls on every\n // frame of its width animation, so the pulse would never leave where it stood until the sidebar stopped.\n if (this.pulses.get(trigger)?.rising) return FramePulseOutcome.ALREADY_RISING;\n const halfSeconds = (appearance.transitionSeconds * choreography.durationFactor) / 2;\n const from = this.pulses.get(trigger)?.value ?? 0;\n this.pulses.set(trigger, { rising: true, value: from, tween: { from, to: 1, start: null, seconds: halfSeconds, easing: appearance.transitionEasing } });\n return FramePulseOutcome.STARTED;\n }\n\n /** The zone whose rim is shown or moving in, or null: what the driver compares to report a zone-focus transition. */\n rimmedZone(): object | null {\n return this.rimmed;\n }\n\n /**\n * The navigation zones inside the content region, and the focused one (the navigation state's `focusedZone`), or\n * null. When the layout rims the focused zone and two or more zones are side by side, the focused one's rim moves\n * toward full emphasis and every other zone's back to none. Returns whether anything will change on screen.\n */\n setZones(zones: FrameZoneBox[], focused: object | null): boolean {\n const signature = zones.map((zone) => `${zone.left},${zone.top},${zone.width},${zone.height}`).join(';');\n const moved = signature !== this.zoneSignature;\n this.zoneSignature = signature;\n this.zones = zones;\n const present = new Set(zones.map((zone) => zone.element));\n for (const key of this.zoneEmphasis.keys()) if (!present.has(key)) this.zoneEmphasis.delete(key);\n this.focusedZone = focused && present.has(focused) ? focused : null;\n return this.retargetZoneEmphasis() || moved;\n }\n\n /** Whether a cross-fade, a hover or zone emphasis, or a pulse is still moving: the only reasons to draw when no region moved. */\n hasPendingMotion(): boolean {\n if (this.tween || this.pulses.size > 0) return true;\n for (const state of this.hover.values()) if (!hoverSettled(state)) return true;\n for (const state of this.zoneEmphasis.values()) if (!hoverSettled(state)) return true;\n return false;\n }\n\n /** Apply the state for instant `now` (ms). Returns true while a cross-fade or a hover emphasis is still moving. */\n tick(now: number): boolean {\n if (this.tween) {\n const { eased, done } = advance(this.tween, now);\n if (done) {\n this.shown = this.tween.to;\n this.tween = null;\n } else {\n this.shown = interpolateFrame(this.tween.from, this.tween.to, eased);\n }\n }\n for (const [key, state] of this.hover) {\n stepHover(state, now);\n if (hoverSettled(state) && state.target === 0) this.hover.delete(key);\n }\n for (const [key, state] of this.zoneEmphasis) {\n stepHover(state, now);\n if (hoverSettled(state) && state.target === 0) this.zoneEmphasis.delete(key);\n }\n for (const [trigger, pulse] of this.pulses) {\n const { eased, done } = advance(pulse.tween, now);\n const { from, to } = pulse.tween;\n pulse.value = from + (to - from) * eased;\n if (done && pulse.rising) {\n const easing = this.appearance?.transitionEasing ?? [0, 0, 1, 1];\n this.pulses.set(trigger, { rising: false, value: 1, tween: { from: 1, to: 0, start: now, seconds: pulse.tween.seconds, easing } });\n } else if (done) {\n this.pulses.delete(trigger);\n }\n }\n this.apply(this.shown);\n return this.hasPendingMotion();\n }\n\n dispose(): void {\n this.group.remove(this.backgroundMesh);\n this.backgroundMesh.material.dispose();\n for (const slab of this.slabs) {\n this.group.remove(slab.body, slab.shadow);\n slab.body.material.dispose();\n slab.shadow.material.dispose();\n }\n this.slabs.length = 0;\n for (const rim of this.zoneRims) {\n this.group.remove(rim);\n rim.material.dispose();\n }\n this.zoneRims.length = 0;\n this.geometry.dispose();\n }\n\n private apply(frame: DisplayedFrame | null): void {\n const { width, height } = this.viewport;\n // Each pulse's strength, 0 at rest: `sin` shapes the rise-and-settle into one smooth swell. Two pulses at once (a\n // navigation that also resized the sidebar) combine by their MAXIMUM, never by summing: the frame never moves\n // further than one choreography would move it.\n let lightSweepDeg = 0;\n let shadowSpread = 0;\n let rimLift = 0;\n for (const [trigger, pulse] of this.pulses) {\n const strength = Math.sin((Math.PI / 2) * clamp01(pulse.value));\n const choreography = this.choreographies[trigger];\n lightSweepDeg = Math.max(lightSweepDeg, choreography.lightSweepDeg * strength);\n shadowSpread = Math.max(shadowSpread, choreography.shadowSpread * strength);\n rimLift = Math.max(rimLift, choreography.rimLift * strength);\n }\n const light = frame ? (frame.lightAngleDeg + lightSweepDeg) * (Math.PI / 180) : 0;\n const lightDir = new Vector2(Math.cos(light), Math.sin(light));\n\n const background = frame?.background;\n this.backgroundMesh.visible = Boolean(background && background[6]! > 0 && width > 0 && height > 0);\n if (background && this.backgroundMesh.visible) {\n setBody(this.backgroundMesh.material, {\n size: [width, height],\n quad: [width + 2, height + 2],\n radius: 0,\n fillFrom: background.slice(0, 3),\n fillTo: background.slice(3, 6),\n fillAlpha: 1,\n rim: [0, 0, 0],\n rimAlpha: 0,\n rimWidth: 0,\n lightDir,\n presence: background[6]!,\n });\n this.backgroundMesh.scale.set(width + 2, height + 2, 1);\n this.backgroundMesh.position.set(0, 0, 0);\n }\n\n while (this.slabs.length < this.boxes.length) this.slabs.push(this.createSlab());\n this.slabs.forEach((slab, index) => {\n const box = this.boxes[index];\n const params = box && frame ? frame.regions[box.region] : undefined;\n const presence = params && box && !box.glass ? params[PRESENCE]! : 0;\n slab.body.visible = presence > 0;\n slab.shadow.visible = presence > 0 && params![17]! > 0 && this.backgroundMesh.visible;\n if (!box || !params || presence <= 0) return;\n\n const centre = regionCentreInFrameUnits(box, this.viewport);\n const radius = params[13]!;\n // The content slab carries the lift: its rim toward the hover opacity (never past it), its shadow further.\n const isContent = box.region === ShellRegion.CONTENT;\n const hover = Math.max(clamp01(this.hover.get(box.element)?.value ?? 0), isContent ? rimLift : 0);\n setBody(slab.body.material, {\n size: [box.width, box.height],\n quad: [box.width + 2, box.height + 2],\n radius,\n fillFrom: params.slice(0, 3),\n fillTo: params.slice(3, 6),\n fillAlpha: params[6]!,\n rim: params.slice(7, 10),\n rimAlpha: params[10]! + (params[11]! - params[10]!) * hover,\n rimWidth: params[12]!,\n lightDir,\n presence,\n });\n slab.body.scale.set(box.width + 2, box.height + 2, 1);\n slab.body.position.set(centre.x, centre.y, 0);\n\n if (!slab.shadow.visible) return;\n // Blur and offset grow with the lift; the opacity never does (the frost bound covers the strongest shadow's opacity anywhere).\n const spread = 1 + (isContent ? shadowSpread : 0);\n const [offsetX, offsetY, blur, alpha] = [params[14]! * spread, params[15]! * spread, params[16]! * spread, params[17]!];\n const margin = blur + 2;\n const u = slab.shadow.material.uniforms;\n (u.uSize!.value as Vector2).set(box.width, box.height);\n (u.uQuad!.value as Vector2).set(box.width + 2 * margin, box.height + 2 * margin);\n u.uRadius!.value = radius;\n u.uBlur!.value = blur;\n u.uAlpha!.value = alpha;\n u.uPresence!.value = presence;\n (u.uBgFrom!.value as Vector3).set(background![0]!, background![1]!, background![2]!);\n (u.uBgTo!.value as Vector3).set(background![3]!, background![4]!, background![5]!);\n (u.uBgSize!.value as Vector2).set(width, height);\n (u.uLightDir!.value as Vector2).copy(lightDir);\n slab.shadow.scale.set(box.width + 2 * margin, box.height + 2 * margin, 1);\n // The DOM's y axis points down and three.js' up, so a downward CSS offset is a negative y.\n slab.shadow.position.set(centre.x + offsetX, centre.y - offsetY, 0);\n });\n\n this.applyZoneRims(frame, lightDir);\n }\n\n /**\n * The focused zone's rim, drawn over the content slab: the content slab's rim colour and width, at most its HOVER\n * opacity, and no fill. Each rim is inset from the content box by the content rim's own width, so it never lands\n * on the content slab's rim band — where it is drawn, it is exactly the case the contrast bound was proved for.\n */\n private applyZoneRims(frame: DisplayedFrame | null, lightDir: Vector2): void {\n const content = this.boxes.find((box) => box.region === ShellRegion.CONTENT);\n const params = frame?.regions[ShellRegion.CONTENT];\n const drawable = Boolean(content && params && !content.glass && params[PRESENCE]! > 0);\n const shown = drawable ? this.zones.filter((zone) => (this.zoneEmphasis.get(zone.element)?.value ?? 0) > 0) : [];\n while (this.zoneRims.length < shown.length) {\n const rim = new Mesh(this.geometry, bodyMaterial());\n rim.renderOrder = FrameRenderOrder.ZONE_RIM;\n this.group.add(rim);\n this.zoneRims.push(rim);\n }\n this.zoneRims.forEach((rim, index) => {\n const zone = shown[index];\n rim.visible = false;\n if (!zone || !content || !params) return;\n const inset = params[12]! + 1;\n const left = Math.max(zone.left, content.left + inset);\n const top = Math.max(zone.top, content.top + inset);\n const right = Math.min(zone.left + zone.width, content.left + content.width - inset);\n const bottom = Math.min(zone.top + zone.height, content.top + content.height - inset);\n if (right - left <= 0 || bottom - top <= 0) return;\n const emphasis = clamp01(this.zoneEmphasis.get(zone.element)?.value ?? 0);\n const box = { left, top, width: right - left, height: bottom - top };\n const centre = regionCentreInFrameUnits(box, this.viewport);\n rim.visible = true;\n setBody(rim.material, {\n size: [box.width, box.height],\n quad: [box.width + 2, box.height + 2],\n radius: Math.max(0, params[13]! - inset),\n fillFrom: params.slice(0, 3),\n fillTo: params.slice(3, 6),\n fillAlpha: 0,\n rim: params.slice(7, 10),\n rimAlpha: params[11]! * emphasis,\n rimWidth: params[12]!,\n lightDir,\n presence: params[PRESENCE]!,\n });\n rim.scale.set(box.width + 2, box.height + 2, 1);\n rim.position.set(centre.x, centre.y, 0);\n });\n }\n\n /** Point every zone's rim emphasis at its target: 1 for the focused zone of a split, 0 otherwise. Returns whether any target moved. */\n private retargetZoneEmphasis(): boolean {\n const active = this.rimsFocusedZone && Boolean(this.appearance?.hoverResponse) && this.zones.length >= 2 ? this.focusedZone : null;\n this.rimmed = active;\n let changed = false;\n for (const zone of this.zones) {\n const target = zone.element === active ? 1 : 0;\n const state = this.zoneEmphasis.get(zone.element);\n if ((state?.target ?? 0) === target) continue;\n const next = state ?? { value: 0, target: 0, velocity: 0, tween: null, spring: null, lastTick: null };\n next.target = target;\n next.spring = this.appearance?.hoverSpring ?? null;\n next.tween = next.spring ? null : { from: next.value, to: target, start: null, seconds: this.appearance?.hoverSeconds ?? 0, easing: this.appearance?.hoverEasing ?? [0, 0, 1, 1] };\n next.lastTick = null;\n this.zoneEmphasis.set(zone.element, next);\n changed = true;\n }\n return changed;\n }\n\n private createSlab(): SlabMeshes {\n const body = new Mesh(this.geometry, bodyMaterial());\n body.renderOrder = FrameRenderOrder.BODY;\n const shadow = new Mesh(this.geometry, shadowMaterial());\n shadow.renderOrder = FrameRenderOrder.SHADOW;\n this.group.add(shadow, body);\n return { body, shadow };\n }\n}\n\n/** A cubic-Bézier easing evaluated at `x` in 0–1, as CSS `cubic-bezier()` defines it (x → y, solved by Newton then bisection). */\nexport function evaluateEasing([x1, y1, x2, y2]: FrameEasing, x: number): number {\n if (x <= 0) return 0;\n if (x >= 1) return 1;\n const sample = (a: number, b: number, t: number): number => ((1 - 3 * b + 3 * a) * t + (3 * b - 6 * a)) * t * t + 3 * a * t;\n const slope = (a: number, b: number, t: number): number => 3 * (1 - 3 * b + 3 * a) * t * t + 2 * (3 * b - 6 * a) * t + 3 * a;\n let t = x;\n for (let i = 0; i < 8; i += 1) {\n const error = sample(x1, x2, t) - x;\n if (Math.abs(error) < 1e-6) return sample(y1, y2, t);\n const d = slope(x1, x2, t);\n if (Math.abs(d) < 1e-6) break;\n t -= error / d;\n }\n let low = 0;\n let high = 1;\n t = x;\n for (let i = 0; i < 30; i += 1) {\n const value = sample(x1, x2, t);\n if (Math.abs(value - x) < 1e-6) break;\n if (value < x) low = t; else high = t;\n t = (low + high) / 2;\n }\n return sample(y1, y2, t);\n}\n\n/**\n * A tween's progress at `now`.\n *\n * - `eased` is CLAMPED to 0–1. A theme's easing token may overshoot (a y control point above 1 — the engine's own\n * `emphasized` easing does), and an overshooting cross-fade would pass its target: colours outside 0–1, a frost\n * more opaque than the bound was computed for. The frame follows the curve's shape inside the range only.\n * - `done` is decided by ELAPSED TIME, never by the eased value: an overshooting curve reaches 1 early, and ending\n * the tween there would cut the transition short.\n */\nfunction advance<T>(tween: Tween<T>, now: number): { eased: number; done: boolean } {\n if (tween.seconds <= 0) return { eased: 1, done: true };\n if (tween.start === null) tween.start = now;\n const linear = Math.min(1, Math.max(0, (now - tween.start) / (tween.seconds * 1000)));\n return linear >= 1 ? { eased: 1, done: true } : { eased: clamp01(evaluateEasing(tween.easing, linear)), done: false };\n}\n\nfunction stepHover(state: HoverState, now: number): void {\n if (state.tween) {\n const { eased, done } = advance(state.tween, now);\n state.value = state.tween.from + (state.tween.to - state.tween.from) * eased;\n if (done) state.tween = null;\n return;\n }\n if (!state.spring) return;\n const last = state.lastTick ?? now;\n state.lastTick = now;\n let remaining = Math.min(0.25, Math.max(0, (now - last) / 1000));\n const { stiffness, damping, mass } = state.spring;\n while (remaining > 0) {\n const dt = Math.min(SPRING_STEP_SECONDS, remaining);\n const acceleration = (-stiffness * (state.value - state.target) - damping * state.velocity) / mass;\n state.velocity += acceleration * dt;\n state.value += state.velocity * dt;\n remaining -= dt;\n }\n if (Math.abs(state.value - state.target) < SPRING_REST && Math.abs(state.velocity) < SPRING_REST) {\n state.value = state.target;\n state.velocity = 0;\n }\n}\n\nfunction hoverSettled(state: HoverState): boolean {\n if (state.tween) return false;\n return state.value === state.target && state.velocity === 0;\n}\n\nfunction clamp01(value: number): number {\n return Math.min(1, Math.max(0, value));\n}\n\nfunction sameColor(a: FrameColor, b: FrameColor): boolean {\n return a.every((channel, i) => Math.abs(channel - b[i]!) < 1e-9);\n}\n\nfunction slabVector(slab: FrameSlabAppearance): SlabVector {\n return [\n ...slab.fillFrom, ...slab.fillTo, slab.fillAlpha,\n ...slab.rim, slab.rimAlpha, slab.rimHoverAlpha, slab.rimWidthPx, slab.radiusPx,\n slab.shadowOffsetXPx, slab.shadowOffsetYPx, slab.shadowBlurPx, slab.shadowAlpha,\n slab.visible ? 1 : 0,\n ];\n}\n\n/**\n * The numbers to display for an appearance. A null appearance (or an invisible slab) keeps the PREVIOUS colours\n * with presence 0, so a fade-out fades the colours that were on screen instead of flashing to black.\n */\nfunction displayedOf(appearance: FrameAppearance | null, previous: DisplayedFrame | null): DisplayedFrame {\n const regions = {} as Record<ShellRegion, SlabVector>;\n for (const region of Object.values(ShellRegion)) {\n const slab = appearance?.regions[region];\n const prior = previous?.regions[region];\n if (slab?.visible) regions[region] = slabVector(slab);\n else regions[region] = prior ? [...prior.slice(0, PRESENCE), 0] : new Array<number>(SLAB_SIZE).fill(0);\n }\n const background = appearance?.background\n ? [...appearance.background.from, ...appearance.background.to, 1]\n : previous ? [...previous.background.slice(0, 6), 0] : [0, 0, 0, 0, 0, 0, 0];\n return { regions, background, lightAngleDeg: appearance?.lightAngleDeg ?? previous?.lightAngleDeg ?? 0 };\n}\n\n/**\n * The start of a cross-fade: what is on screen, except that anything NOT on screen (presence 0) starts from the\n * TARGET's colours. A slab appearing then fades in as itself — only its presence moves — instead of passing\n * through black, which no contrast bound covers.\n */\nfunction fadeInFrom(shown: DisplayedFrame, target: DisplayedFrame): DisplayedFrame {\n const regions = {} as Record<ShellRegion, SlabVector>;\n for (const region of Object.values(ShellRegion)) {\n const current = shown.regions[region];\n regions[region] = current[PRESENCE]! > 0 ? current : [...target.regions[region].slice(0, PRESENCE), 0];\n }\n const background = shown.background[6]! > 0 ? shown.background : [...target.background.slice(0, 6), 0];\n return { regions, background, lightAngleDeg: shown.lightAngleDeg };\n}\n\nfunction interpolateFrame(from: DisplayedFrame, to: DisplayedFrame, t: number): DisplayedFrame {\n const lerp = (a: number[], b: number[]): number[] => a.map((value, i) => value + (b[i]! - value) * t);\n const regions = {} as Record<ShellRegion, SlabVector>;\n for (const region of Object.values(ShellRegion)) regions[region] = lerp(from.regions[region], to.regions[region]);\n return { regions, background: lerp(from.background, to.background), lightAngleDeg: from.lightAngleDeg + (to.lightAngleDeg - from.lightAngleDeg) * t };\n}\n\nfunction bodyMaterial(): ShaderMaterial {\n return new ShaderMaterial({\n vertexShader: FRAME_VERTEX_SHADER,\n fragmentShader: FRAME_BODY_FRAGMENT_SHADER,\n transparent: true,\n depthTest: false,\n depthWrite: false,\n toneMapped: false,\n uniforms: {\n uSize: { value: new Vector2() },\n uQuad: { value: new Vector2() },\n uRadius: { value: 0 },\n uFillFrom: { value: new Vector3() },\n uFillTo: { value: new Vector3() },\n uFillAlpha: { value: 0 },\n uRim: { value: new Vector3() },\n uRimAlpha: { value: 0 },\n uRimWidth: { value: 0 },\n uLightDir: { value: new Vector2(0, 1) },\n uPresence: { value: 0 },\n },\n });\n}\n\n/** The shadow writes an opaque, darkened background with MIN blending: overlapping shadows never stack. */\nfunction shadowMaterial(): ShaderMaterial {\n return new ShaderMaterial({\n vertexShader: FRAME_VERTEX_SHADER,\n fragmentShader: FRAME_SHADOW_FRAGMENT_SHADER,\n transparent: true,\n depthTest: false,\n depthWrite: false,\n toneMapped: false,\n blending: CustomBlending,\n blendEquation: MinEquation,\n uniforms: {\n uSize: { value: new Vector2() },\n uQuad: { value: new Vector2() },\n uRadius: { value: 0 },\n uBlur: { value: 0 },\n uAlpha: { value: 0 },\n uPresence: { value: 0 },\n uBgFrom: { value: new Vector3() },\n uBgTo: { value: new Vector3() },\n uBgSize: { value: new Vector2() },\n uLightDir: { value: new Vector2(0, 1) },\n },\n });\n}\n\nfunction setBody(\n material: ShaderMaterial,\n values: {\n size: [number, number];\n quad: [number, number];\n radius: number;\n fillFrom: number[];\n fillTo: number[];\n fillAlpha: number;\n rim: number[];\n rimAlpha: number;\n rimWidth: number;\n lightDir: Vector2;\n presence: number;\n },\n): void {\n const u = material.uniforms;\n (u.uSize!.value as Vector2).set(...values.size);\n (u.uQuad!.value as Vector2).set(...values.quad);\n u.uRadius!.value = values.radius;\n (u.uFillFrom!.value as Vector3).set(values.fillFrom[0]!, values.fillFrom[1]!, values.fillFrom[2]!);\n (u.uFillTo!.value as Vector3).set(values.fillTo[0]!, values.fillTo[1]!, values.fillTo[2]!);\n u.uFillAlpha!.value = values.fillAlpha;\n (u.uRim!.value as Vector3).set(values.rim[0]!, values.rim[1]!, values.rim[2]!);\n u.uRimAlpha!.value = values.rimAlpha;\n u.uRimWidth!.value = values.rimWidth;\n (u.uLightDir!.value as Vector2).copy(values.lightDir);\n u.uPresence!.value = values.presence;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"frame-shaders.d.ts","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"frame-shaders.d.ts","sourceRoot":"","sources":["../../../src/frame/frame-shaders.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAUH,eAAO,MAAM,mBAAmB,8MAQ/B,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,0BAA0B,6lCA4BtC,CAAC;AAEF;;;;;;;;;;GAUG;AACH,eAAO,MAAM,4BAA4B,+5BAwBxC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"frame-shaders.js","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"frame-shaders.js","sourceRoot":"","sources":["../../../src/frame/frame-shaders.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,MAAM,YAAY,GAAG,UAAU,CAAC;;;;;;CAM/B,CAAC;AAEF,MAAM,CAAC,MAAM,mBAAmB,GAAG,UAAU,CAAC;;;;;;;;CAQ7C,CAAC;AAEF;;;;GAIG;AACH,MAAM,CAAC,MAAM,0BAA0B,GAAG,UAAU,CAAC;EACnD,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2Bb,CAAC;AAEF;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,4BAA4B,GAAG,UAAU,CAAC;EACrD,YAAY;;;;;;;;;;;;;;;;;;;;;;;CAuBb,CAAC","sourcesContent":["/**\n * The frame's two shaders (#1823). Both are UNLIT and write their colours as given: the colours arrive already\n * sRGB-encoded, and neither shader includes three.js' colour-space or tone-mapping chunks. So the pixel on screen\n * is exactly the colour the appearance derivation computed, which is what lets the contrast bound computed there\n * be the contrast on screen. A lit material would move every colour after the bound was checked.\n *\n * Geometry is one unit quad per mesh, scaled in CSS pixels by an orthographic camera matched 1:1 to the canvas.\n * The rounded rectangle is a signed distance field in pixels, so an edge is antialiased over one CSS pixel and\n * sits within half a pixel of the region's box.\n */\n\nconst SD_ROUND_BOX = /* glsl */ `\nfloat sdRoundBox(vec2 p, vec2 halfSize, float radius) {\n float r = min(radius, min(halfSize.x, halfSize.y));\n vec2 q = abs(p) - halfSize + r;\n return length(max(q, 0.0)) + min(max(q.x, q.y), 0.0) - r;\n}\n`;\n\nexport const FRAME_VERTEX_SHADER = /* glsl */ `\nvarying vec2 vUv;\nvarying vec2 vWorld;\nvoid main() {\n vUv = uv;\n vWorld = (modelMatrix * vec4(position, 1.0)).xy;\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n}\n`;\n\n/**\n * A slab body (and the in-scene background, which is a body with no radius, no rim and full opacity): a\n * gradient frost along the light direction, with a rim band inside its edge. The rim is composited over the\n * frost in the shader so the pair blends onto what is beneath as ONE layer, exactly as the derivation assumed.\n */\nexport const FRAME_BODY_FRAGMENT_SHADER = /* glsl */ `\n${SD_ROUND_BOX}\nuniform vec2 uSize;\nuniform vec2 uQuad;\nuniform float uRadius;\nuniform vec3 uFillFrom;\nuniform vec3 uFillTo;\nuniform float uFillAlpha;\nuniform vec3 uRim;\nuniform float uRimAlpha;\nuniform float uRimWidth;\nuniform vec2 uLightDir;\nuniform float uPresence;\nvarying vec2 vUv;\nvoid main() {\n vec2 p = (vUv - 0.5) * uQuad;\n float d = sdRoundBox(p, uSize * 0.5, uRadius);\n float coverage = clamp(0.5 - d, 0.0, 1.0);\n if (coverage <= 0.0) discard;\n float t = clamp(0.5 + dot(p / max(uSize, vec2(1.0)), uLightDir), 0.0, 1.0);\n vec3 fill = mix(uFillFrom, uFillTo, t);\n float rimMask = uRimWidth > 0.0 ? clamp(uRimWidth + d + 0.5, 0.0, 1.0) : 0.0;\n float ra = uRimAlpha * rimMask;\n float fa = uFillAlpha;\n float a = 1.0 - (1.0 - fa) * (1.0 - ra);\n vec3 c = a > 0.0 ? (uRim * ra + fill * fa * (1.0 - ra)) / a : fill;\n gl_FragColor = vec4(c, a * coverage * uPresence);\n}\n`;\n\n/**\n * A slab's shadow, drawn after the background and before every body (so no shadow lands on a slab above it).\n *\n * Shadows must never STACK: where several overlap (a corner where three regions meet), stacked shadows would be\n * darker than the one shadow the contrast bound was computed for. So a shadow does not blend as a translucent\n * black layer. It computes the scene background at its own pixel — the same gradient the background quad drew —\n * darkens it, writes it OPAQUE, and is drawn with MIN blending: the framebuffer keeps the darker of what is there\n * and what the shadow writes. Overlapping shadows therefore combine by their MAXIMUM opacity, exactly one shadow\n * deep, with no extra render target. Over a pixel where no background was drawn (framebuffer cleared to zero) the\n * minimum is zero, so a shadow never appears there.\n */\nexport const FRAME_SHADOW_FRAGMENT_SHADER = /* glsl */ `\n${SD_ROUND_BOX}\nuniform vec2 uSize;\nuniform vec2 uQuad;\nuniform float uRadius;\nuniform float uBlur;\nuniform float uAlpha;\nuniform float uPresence;\nuniform vec3 uBgFrom;\nuniform vec3 uBgTo;\nuniform vec2 uBgSize;\nuniform vec2 uLightDir;\nvarying vec2 vUv;\nvarying vec2 vWorld;\nvoid main() {\n vec2 p = (vUv - 0.5) * uQuad;\n float d = sdRoundBox(p, uSize * 0.5, uRadius);\n float a = uBlur > 0.0 ? 1.0 - smoothstep(-uBlur * 0.5, uBlur, d) : clamp(0.5 - d, 0.0, 1.0);\n a *= uAlpha * uPresence;\n if (a <= 0.0) discard;\n float t = clamp(0.5 + dot(vWorld / max(uBgSize, vec2(1.0)), uLightDir), 0.0, 1.0);\n vec3 background = mix(uBgFrom, uBgTo, t);\n gl_FragColor = vec4(background * (1.0 - a), 1.0);\n}\n`;\n"]}
|
|
@@ -5,7 +5,7 @@ import { type FrameAppearance } from './frame-appearance';
|
|
|
5
5
|
*
|
|
6
6
|
* This is the frame's only reader of the theme: the tokens (through the resolver, #1819), the navigation
|
|
7
7
|
* material, the gesture spring of the SUNKEN surface recipe (the recipe the shell regions render with), `isDark`,
|
|
8
|
-
* `prefersReducedMotion` and the theme id that
|
|
8
|
+
* `prefersReducedMotion` and the theme id and personality point that pick the frame style. The recipe's Tailwind classes are NOT read:
|
|
9
9
|
* they stay DOM, inside the regions. The canvas behind the
|
|
10
10
|
* lazy door receives the result as props and reads nothing itself, so a theme, mode or breakpoint change is a
|
|
11
11
|
* prop change on the canvas — never a remount of anything, and never of the 2D shell beside it.
|