{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "elastic-mesh",
  "title": "Elastic Mesh",
  "author": "HorizonX <https://horizonx.so>",
  "description": "A rubbery surface that stretches under the pointer, on a damped height field rendered with three.js. Keyboard accessible.",
  "dependencies": [
    "three"
  ],
  "devDependencies": [
    "@types/three"
  ],
  "files": [
    {
      "path": "registry/drops/elastic-mesh/elastic-mesh.tsx",
      "content": "// MIT License, Copyright (c) 2026 HorizonX. The full text is at the top of elastic-mesh.engine.js.\n'use client';\n\nimport { useEffect, useRef, type CSSProperties } from 'react';\nimport { createElasticMesh, type ElasticMeshConfig, type ElasticMeshHandle } from './elastic-mesh.engine.js';\n\nexport interface ElasticMeshProps {\n  /**\n   * Image drawn on the surface. Without it the surface is a gradient from `color1` to `color2`.\n   * WebGL reads the pixels, so a remote image must be served with CORS headers.\n   */\n  image?: string;\n  /** Corner radius in px, 0 to 100. */\n  borderRadius?: number;\n  /** Top gradient colour. */\n  color1?: string;\n  /** Bottom gradient colour. */\n  color2?: string;\n  highlight?: string;\n  showGrid?: boolean;\n  /** Grid cells, 4 to 48. */\n  gridDensity?: number;\n  /** 0 to 1. */\n  gridOpacity?: number;\n  gridColor?: string;\n  /** Spring stiffness, 0.02 to 0.2. */\n  stiffness?: number;\n  /** 0.05 to 0.9. */\n  damping?: number;\n  /** Share of the surface the pointer grabs, 0.1 to 1. */\n  grabRadius?: number;\n  /** 0 to 1. */\n  pull?: number;\n  /** How far waves spread, 0 to 10. */\n  wobble?: number;\n  /** Tilt in degrees, -30 to 30. */\n  tilt?: number;\n  /** 0 to 1. */\n  shading?: number;\n  /** Mesh resolution, 12 to 48. */\n  resolution?: number;\n  /** `hover` stretches under the pointer; `drag` stretches only while pressed. */\n  interaction?: 'hover' | 'drag';\n  /** Turns the pointer and keyboard interaction off. */\n  disabled?: boolean;\n  className?: string;\n  style?: CSSProperties;\n}\n\nconst DEFAULTS = {\n  borderRadius: 30, color1: '#4f46e5', color2: '#0ea5e9', highlight: '#ffffff',\n  gridDensity: 20, gridOpacity: 0.28, gridColor: '#ffffff',\n  stiffness: 0.05, damping: 0.2, grabRadius: 0.6, pull: 0.4, wobble: 5,\n  tilt: 14, shading: 0.5, resolution: 32\n};\n\nconst clamp = (value: number | undefined, min: number, max: number, fallback: number) =>\n  typeof value === 'number' && Number.isFinite(value) ? Math.min(max, Math.max(min, value)) : fallback;\n\n// Same rule as the editor: site-relative paths, http(s), blob: and base64 image data only.\nconst safeImage = (value: string | undefined) => {\n  const source = String(value ?? '').trim();\n  return /^\\/(?!\\/)/.test(source) || /^https?:\\/\\//i.test(source) || /^blob:/i.test(source) ||\n    /^data:image\\/(png|jpe?g|webp|gif|avif);base64,/i.test(source) ? source : '';\n};\n\nfunction toConfig(props: ElasticMeshProps): ElasticMeshConfig {\n  return {\n    image: safeImage(props.image),\n    borderRadius: clamp(props.borderRadius, 0, 100, DEFAULTS.borderRadius),\n    color1: props.color1 ?? DEFAULTS.color1,\n    color2: props.color2 ?? DEFAULTS.color2,\n    highlight: props.highlight ?? DEFAULTS.highlight,\n    showGrid: props.showGrid ?? false,\n    gridDensity: clamp(props.gridDensity, 4, 48, DEFAULTS.gridDensity),\n    gridOpacity: clamp(props.gridOpacity, 0, 1, DEFAULTS.gridOpacity),\n    gridColor: props.gridColor ?? DEFAULTS.gridColor,\n    stiffness: clamp(props.stiffness, 0.02, 0.2, DEFAULTS.stiffness),\n    damping: clamp(props.damping, 0.05, 0.9, DEFAULTS.damping),\n    grabRadius: clamp(props.grabRadius, 0.1, 1, DEFAULTS.grabRadius),\n    pull: clamp(props.pull, 0, 1, DEFAULTS.pull),\n    wobble: clamp(props.wobble, 0, 10, DEFAULTS.wobble),\n    tilt: clamp(props.tilt, -30, 30, DEFAULTS.tilt),\n    shading: clamp(props.shading, 0, 1, DEFAULTS.shading),\n    resolution: Math.round(clamp(props.resolution, 12, 48, DEFAULTS.resolution)),\n    interaction: props.interaction ?? 'hover',\n    enabled: !props.disabled\n  };\n}\n\nconst CSS = `\n.elm-viewport{position:relative;box-sizing:border-box;width:100%;height:100%;min-width:0;min-height:0;isolation:isolate;touch-action:pan-y;outline:none;cursor:crosshair}\n.elm-viewport[data-interaction=\"drag\"]{touch-action:none;cursor:grab}\n.elm-viewport[data-grabbing=\"true\"]{cursor:grabbing}\n.elm-viewport:focus-visible{outline:2px solid #a7a7a7;outline-offset:-4px;border-radius:12px}\n.elm-viewport canvas{display:block;width:100%;height:100%}\n.elm-status{position:absolute;inset:auto 16px 16px;text-align:center;font:14px/1.5 system-ui,sans-serif;color:#f3f3f3;background:#171717;border-radius:8px;padding:8px 12px}\n.elm-status:empty{display:none}\n@media(prefers-reduced-motion:reduce){.elm-viewport{cursor:default}}\n`;\n\n/** A rubbery surface on a damped height field that stretches under the pointer, rendered with three.js. Fills its parent. */\nexport function ElasticMesh({ className, style, ...props }: ElasticMeshProps) {\n  const root = useRef<HTMLDivElement>(null);\n  const engine = useRef<ElasticMeshHandle | null>(null);\n  const config = toConfig(props);\n  const latest = useRef(config);\n  const key = JSON.stringify(config);\n\n  // Declared before the mount effect so a remount always starts from the newest props.\n  useEffect(() => {\n    latest.current = config;\n    engine.current?.update(config);\n  }, [key]); // eslint-disable-line react-hooks/exhaustive-deps\n\n  useEffect(() => {\n    const handle = createElasticMesh(root.current!, latest.current);\n    engine.current = handle;\n    return () => { handle.destroy(); engine.current = null; };\n  }, []);\n\n  return (\n    <>\n      <style href=\"hx-drops-elastic-mesh\" precedence=\"default\">{CSS}</style>\n      <div\n        ref={root}\n        className={className ? `elm-viewport ${className}` : 'elm-viewport'}\n        style={style}\n        role=\"group\"\n        tabIndex={0}\n        aria-label=\"Elastic mesh. Move the pointer or drag to stretch. With keyboard focus, press Enter to grab, arrow keys to move, and Escape to release.\"\n      >\n        <span className=\"elm-status\" role=\"status\" />\n      </div>\n    </>\n  );\n}\n\nexport default ElasticMesh;\n",
      "type": "registry:component"
    },
    {
      "path": "registry/drops/elastic-mesh/elastic-mesh.engine.js",
      "content": "// HorizonX Drops: this engine is copied unchanged from the HorizonX editor\n// (horizonx-frontend src/lib/tools/elasticMesh.engine.js at 00b7cec).\n// Licensed under the MIT License below.\n// Do not edit here: change it in horizonx-frontend and run scripts/sync-from-horizonx.mjs.\n// --- end of HorizonX Drops banner ---\n// Original HorizonX implementation. A damped height field, not a port of React Bits.\n// MIT License — Copyright (c) 2026 HorizonX\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n// The boundary is pinned; the pointer excites a Gaussian patch. Neighbor springs\n// carry the wave, while a small slope-dependent in-plane displacement gathers it.\nexport function createElasticField(size, width, height) {\n  const count = size * size;\n  const displacement = new Float32Array(count);\n  const velocity = new Float32Array(count);\n  const nextVelocity = new Float32Array(count);\n  const positions = new Float32Array(count * 3);\n  let energy = 0;\n  function commit() {\n    energy = 0;\n    for (let row = 0; row < size; row++) {\n      for (let col = 0; col < size; col++) {\n        const index = row * size + col;\n        const x = (col / (size - 1) - 0.5) * width;\n        const y = (0.5 - row / (size - 1)) * height;\n        const left = displacement[index - (col > 0 ? 1 : 0)];\n        const right = displacement[index + (col < size - 1 ? 1 : 0)];\n        const above = displacement[index - (row > 0 ? size : 0)];\n        const below = displacement[index + (row < size - 1 ? size : 0)];\n        positions[index * 3] = x + (right - left) * 0.28;\n        positions[index * 3 + 1] = y + (above - below) * 0.28;\n        positions[index * 3 + 2] = displacement[index];\n        energy = Math.max(energy, Math.abs(displacement[index]), Math.abs(velocity[index]));\n      }\n    }\n  }\n  function step(dt, pointer, config) {\n    // A fixed 120 Hz step bounds numerical stability across display refresh rates.\n    dt = Math.min(Math.max(dt, 0), 1 / 120);\n    const spring = 25 + config.stiffness * 300;\n    const friction = Math.exp(-(2 + config.damping * 24) * dt);\n    const coupling = 6 + config.wobble * 3;\n    const radius = height * (0.08 + config.grabRadius * 0.42);\n    for (let row = 1; row < size - 1; row++) {\n      for (let col = 1; col < size - 1; col++) {\n        const index = row * size + col;\n        const z = displacement[index];\n        const laplacian = displacement[index - 1] + displacement[index + 1] + displacement[index - size] + displacement[index + size] - 4 * z;\n        const x = (col / (size - 1) - 0.5) * width;\n        const y = (0.5 - row / (size - 1)) * height;\n        const distance = ((pointer.x - x) ** 2 + (pointer.y - y) ** 2) / (radius * radius);\n        const edge = Math.min(1, Math.min(col, row, size - 1 - col, size - 1 - row) / 3);\n        const force = pointer.active ? Math.exp(-distance * 2) * config.pull * 120 * edge : 0;\n        nextVelocity[index] = (velocity[index] + (force + coupling * laplacian - spring * z) * dt) * friction;\n      }\n    }\n    for (let index = 0; index < count; index++) {\n      velocity[index] = nextVelocity[index];\n      const z = displacement[index] + velocity[index] * dt;\n      displacement[index] = Math.max(-0.6, Math.min(0.6, z));\n      if (z > 0.6 || z < -0.6) velocity[index] = 0;\n    }\n    commit();\n  }\n  function reset() {\n    displacement.fill(0);\n    velocity.fill(0);\n    nextVelocity.fill(0);\n    commit();\n  }\n  reset();\n  return { positions, step, reset, get energy() { return energy; } };\n}\n\nexport function createElasticMesh(container, initial) {\n  let config = { ...initial };\n  let disposed = false;\n  let renderer, mesh, geometry, material, texture, field;\n  let raf = 0;\n  let last = 0;\n  let accumulated = 0;\n  let visible = true;\n  let imageVersion = 0;\n  let imageSource;\n  let renderFrame = () => {};\n  let sync = () => {};\n  const pointer = { x: 0, y: 0, active: false };\n  let captured = null;\n  const motion = window.matchMedia('(prefers-reduced-motion: reduce)');\n  const status = container.querySelector('.elm-status');\n  const listeners = [];\n  function listen(target, name, handler, options) {\n    target.addEventListener(name, handler, options);\n    listeners.push(() => target.removeEventListener(name, handler, options));\n  }\n  function wake() {\n    if (!raf && renderer && visible && !disposed && !document.hidden) {\n      last = performance.now();\n      raf = requestAnimationFrame(renderFrame);\n    }\n  }\n  function release() {\n    pointer.active = false;\n    container.dataset.grabbing = 'false';\n    if (captured !== null && container.hasPointerCapture?.(captured)) container.releasePointerCapture(captured);\n    captured = null;\n    wake();\n  }\n  function reduced() {\n    release();\n    field?.reset();\n    wake();\n  }\n  listen(motion, 'change', reduced);\n  listen(document, 'visibilitychange', () => {\n    if (document.hidden) { release(); cancelAnimationFrame(raf); raf = 0; }\n    else wake();\n  });\n  const visibility = new IntersectionObserver(([entry]) => {\n    visible = entry.isIntersecting;\n    if (visible) wake();\n    else { release(); cancelAnimationFrame(raf); raf = 0; }\n  });\n  visibility.observe(container);\n  let resize = () => {};\n  const observer = new ResizeObserver(() => resize());\n  observer.observe(container);\n\n  const ready = import('three').then((THREE) => {\n    if (disposed) return;\n    renderer = new THREE.WebGLRenderer({ alpha: true, antialias: true });\n    renderer.setPixelRatio(Math.min(window.devicePixelRatio || 1, 2));\n    renderer.setClearColor(0x000000, 0);\n    renderer.domElement.setAttribute('aria-hidden', 'true');\n    container.appendChild(renderer.domElement);\n    const scene = new THREE.Scene();\n    const camera = new THREE.PerspectiveCamera(35, 1, 0.1, 100);\n    const sheetWidth = 3.6;\n    const sheetHeight = 2.4;\n    let sheetPixels = [1, 1];\n    material = new THREE.ShaderMaterial({\n      transparent: true, side: THREE.DoubleSide,\n      uniforms: {\n        topColor: { value: new THREE.Color() }, bottomColor: { value: new THREE.Color() },\n        gridColor: { value: new THREE.Color() }, highlight: { value: new THREE.Color() },\n        imageMap: { value: null }, hasImage: { value: 0 }, imageScale: { value: new THREE.Vector2(1, 1) },\n        gridDensity: { value: 20 }, gridAlpha: { value: 0.28 }, lighting: { value: 0.5 },\n        radius: { value: 0 }, sheetPixels: { value: new THREE.Vector2(1, 1) }\n      },\n      vertexShader: `\n        varying vec2 surfaceUv;\n        varying vec3 surfaceNormal;\n        void main() {\n          surfaceUv = uv;\n          surfaceNormal = normalize(normalMatrix * normal);\n          gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n        }\n      `,\n      fragmentShader: `\n        varying vec2 surfaceUv;\n        varying vec3 surfaceNormal;\n        uniform vec3 topColor, bottomColor, gridColor, highlight;\n        uniform sampler2D imageMap;\n        uniform vec2 imageScale, sheetPixels;\n        uniform float hasImage, gridDensity, gridAlpha, lighting, radius;\n        void main() {\n          vec2 photoUv = (surfaceUv - 0.5) * imageScale + 0.5;\n          vec3 color = mix(bottomColor, topColor, surfaceUv.y);\n          if (hasImage > 0.5) color = texture2D(imageMap, photoUv).rgb;\n          vec3 n = normalize(surfaceNormal);\n          float light = dot(n, normalize(vec3(-0.6, 0.8, 1.8)));\n          float sheen = pow(max(0.0, dot(n, normalize(vec3(0.3, -0.4, 1.0)))), 40.0);\n          color *= mix(1.0, 0.65 + 0.4 * max(light, 0.0), lighting);\n          color += highlight * sheen * lighting * 0.16;\n          vec2 cells = surfaceUv * vec2(gridDensity, gridDensity / 1.5);\n          vec2 edge = min(fract(cells), 1.0 - fract(cells));\n          vec2 lineWidth = max(fwidth(cells), vec2(0.0001));\n          float lattice = 1.0 - min(smoothstep(0.0, lineWidth.x, edge.x), smoothstep(0.0, lineWidth.y, edge.y));\n          color = mix(color, gridColor, lattice * gridAlpha);\n          vec2 distanceToEdge = min(surfaceUv, 1.0 - surfaceUv) * sheetPixels;\n          float r = min(radius, min(sheetPixels.x, sheetPixels.y) * 0.5);\n          vec2 corner = max(vec2(r) - distanceToEdge, 0.0);\n          float mask = 1.0 - smoothstep(r - 1.0, r + 1.0, length(corner));\n          gl_FragColor = vec4(color, r < 1.0 ? 1.0 : mask);\n          #include <tonemapping_fragment>\n          #include <colorspace_fragment>\n        }\n      `\n    });\n    mesh = new THREE.Mesh(undefined, material);\n    mesh.frustumCulled = false;\n    scene.add(mesh);\n\n    function rebuildField() {\n      geometry?.dispose();\n      geometry = new THREE.PlaneGeometry(sheetWidth, sheetHeight, config.resolution - 1, config.resolution - 1);\n      field = createElasticField(config.resolution, sheetWidth, sheetHeight);\n      geometry.attributes.position.setUsage(THREE.DynamicDrawUsage);\n      mesh.geometry = geometry;\n    }\n    rebuildField();\n\n    const raycaster = new THREE.Raycaster();\n    const plane = new THREE.Plane();\n    const worldNormal = new THREE.Vector3();\n    const hit = new THREE.Vector3();\n    const coordinates = new THREE.Vector2();\n    function locate(event) {\n      const rect = container.getBoundingClientRect();\n      if (!rect.width || !rect.height) return;\n      coordinates.set((event.clientX - rect.left) / rect.width * 2 - 1, 1 - (event.clientY - rect.top) / rect.height * 2);\n      mesh.updateMatrixWorld();\n      worldNormal.set(0, 0, 1).applyQuaternion(mesh.quaternion);\n      plane.setFromNormalAndCoplanarPoint(worldNormal, mesh.position);\n      raycaster.setFromCamera(coordinates, camera);\n      if (raycaster.ray.intersectPlane(plane, hit)) {\n        mesh.worldToLocal(hit);\n        pointer.x = Math.max(-sheetWidth / 2, Math.min(sheetWidth / 2, hit.x));\n        pointer.y = Math.max(-sheetHeight / 2, Math.min(sheetHeight / 2, hit.y));\n      }\n    }\n    const canInteract = () => config.enabled && !motion.matches;\n    listen(container, 'pointermove', (event) => {\n      if (!canInteract()) return;\n      locate(event);\n      if (config.interaction === 'hover' && event.pointerType !== 'touch') pointer.active = true;\n      wake();\n    });\n    listen(container, 'pointerdown', (event) => {\n      if (!canInteract() || (event.button !== 0 && event.pointerType === 'mouse')) return;\n      locate(event);\n      pointer.active = true;\n      captured = event.pointerId;\n      container.setPointerCapture(captured);\n      container.dataset.grabbing = 'true';\n      wake();\n    });\n    listen(container, 'pointerup', release);\n    listen(container, 'pointercancel', release);\n    listen(container, 'lostpointercapture', release);\n    listen(container, 'pointerleave', () => { if (captured === null) release(); });\n    listen(container, 'blur', release);\n    listen(container, 'keydown', (event) => {\n      if (event.key === 'Escape') { release(); return; }\n      if (!canInteract()) return;\n      if (event.key === 'Enter' || event.key === ' ') {\n        event.preventDefault();\n        pointer.active = !pointer.active;\n        container.dataset.grabbing = String(pointer.active);\n      } else if (['ArrowLeft', 'ArrowRight', 'ArrowUp', 'ArrowDown'].includes(event.key)) {\n        event.preventDefault();\n        pointer.x = Math.max(-1.6, Math.min(1.6, pointer.x + (event.key === 'ArrowRight' ? 0.15 : event.key === 'ArrowLeft' ? -0.15 : 0)));\n        pointer.y = Math.max(-1, Math.min(1, pointer.y + (event.key === 'ArrowUp' ? 0.15 : event.key === 'ArrowDown' ? -0.15 : 0)));\n        pointer.active = true;\n      }\n      wake();\n    });\n    listen(renderer.domElement, 'webglcontextlost', (event) => {\n      event.preventDefault();\n      cancelAnimationFrame(raf);\n      raf = 0;\n      status.textContent = 'Graphics paused. Reload this preview to restore the surface.';\n    });\n    listen(renderer.domElement, 'webglcontextrestored', () => { status.textContent = ''; wake(); });\n\n    function loadImage(source) {\n      imageSource = source;\n      const version = ++imageVersion;\n      material.uniforms.hasImage.value = 0;\n      texture?.dispose();\n      texture = null;\n      material.uniforms.imageMap.value = null;\n      status.textContent = '';\n      if (!source) return;\n      const pending = new THREE.TextureLoader().load(source, (loaded) => {\n        if (disposed || version !== imageVersion) { loaded.dispose(); return; }\n        texture = loaded;\n        texture.colorSpace = THREE.SRGBColorSpace;\n        material.uniforms.imageMap.value = texture;\n        material.uniforms.hasImage.value = 1;\n        const ratio = texture.image.width / texture.image.height;\n        material.uniforms.imageScale.value.set(Math.min(1, 1.5 / ratio), Math.min(1, ratio / 1.5));\n        wake();\n      }, undefined, () => {\n        pending.dispose();\n        if (disposed || version !== imageVersion) return;\n        status.textContent = 'Image unavailable. Showing the gradient; choose another image.';\n        wake();\n      });\n      texture = pending;\n    }\n    resize = () => {\n      if (disposed) return;\n      const width = Math.max(1, container.clientWidth);\n      const height = Math.max(1, container.clientHeight);\n      renderer.setSize(width, height, false);\n      camera.aspect = width / height;\n      // Fit the deformed volume, not only its flat rectangle. Camera distance\n      // includes the maximum height and tilt, retaining breathing room on mobile.\n      const tangent = Math.tan(THREE.MathUtils.degToRad(camera.fov / 2));\n      camera.position.z = Math.max(sheetWidth / (2 * tangent * camera.aspect), (sheetHeight + 0.6) / (2 * tangent)) / 0.8 + 0.6;\n      camera.updateProjectionMatrix();\n      camera.updateMatrixWorld();\n      const pixelScale = height / (2 * tangent * camera.position.z);\n      sheetPixels = [sheetWidth * pixelScale, sheetHeight * pixelScale];\n      material.uniforms.sheetPixels.value.set(...sheetPixels);\n      wake();\n    };\n    sync = (previous = {}) => {\n      if (previous.resolution !== config.resolution && previous.resolution !== undefined) rebuildField();\n      for (const [uniform, key] of [['topColor', 'color1'], ['bottomColor', 'color2'], ['highlight', 'highlight'], ['gridColor', 'gridColor']]) material.uniforms[uniform].value.set(config[key]);\n      material.uniforms.gridDensity.value = config.gridDensity;\n      material.uniforms.gridAlpha.value = config.showGrid ? config.gridOpacity : 0;\n      material.uniforms.lighting.value = config.shading;\n      material.uniforms.radius.value = config.borderRadius;\n      mesh.rotation.x = THREE.MathUtils.degToRad(config.tilt);\n      container.dataset.interaction = config.interaction;\n      container.setAttribute('aria-disabled', String(!config.enabled));\n      if (!config.enabled || previous.interaction !== config.interaction) release();\n      if (config.image !== imageSource) loadImage(config.image);\n      wake();\n    };\n    renderFrame = (now) => {\n      raf = 0;\n      if (disposed || !visible || document.hidden) return;\n      accumulated += Math.min((now - last) / 1000, 1 / 30);\n      last = now;\n      if (motion.matches) { field.reset(); accumulated = 0; }\n      else {\n        while (accumulated >= 1 / 120) {\n          field.step(1 / 120, pointer, config);\n          accumulated -= 1 / 120;\n        }\n      }\n      geometry.attributes.position.array.set(field.positions);\n      geometry.attributes.position.needsUpdate = true;\n      geometry.computeVertexNormals();\n      renderer.render(scene, camera);\n      if (pointer.active || field.energy > 0.0005) raf = requestAnimationFrame(renderFrame);\n    };\n    sync();\n    resize();\n  }).catch(() => {\n    if (!disposed) {\n      renderer?.dispose();\n      renderer?.domElement.remove();\n      renderer = null;\n      container.style.background = `linear-gradient(${config.color1},${config.color2})`;\n      status.textContent = 'Interactive graphics are unavailable in this browser. Showing a static gradient.';\n    }\n  });\n\n  return {\n    ready,\n    update(next) {\n      const previous = config;\n      config = { ...next };\n      sync(previous);\n    },\n    destroy() {\n      disposed = true;\n      imageVersion++;\n      cancelAnimationFrame(raf);\n      observer.disconnect();\n      visibility.disconnect();\n      listeners.forEach((remove) => remove());\n      geometry?.dispose();\n      material?.dispose();\n      texture?.dispose();\n      renderer?.dispose();\n      renderer?.forceContextLoss();\n      renderer?.domElement.remove();\n    }\n  };\n}\n",
      "type": "registry:component"
    },
    {
      "path": "registry/drops/elastic-mesh/elastic-mesh.engine.d.ts",
      "content": "// Types for elastic-mesh.engine.js (the engine itself is plain JavaScript).\nexport interface ElasticMeshConfig {\n  /** Image URL for the surface; an empty string draws the colour gradient. */\n  image: string;\n  borderRadius: number;\n  color1: string;\n  color2: string;\n  highlight: string;\n  showGrid: boolean;\n  gridDensity: number;\n  gridOpacity: number;\n  gridColor: string;\n  stiffness: number;\n  damping: number;\n  grabRadius: number;\n  pull: number;\n  wobble: number;\n  tilt: number;\n  shading: number;\n  resolution: number;\n  interaction: 'hover' | 'drag';\n  enabled: boolean;\n}\n\nexport interface ElasticMeshHandle {\n  ready: Promise<void>;\n  update(next: ElasticMeshConfig): void;\n  destroy(): void;\n}\n\nexport function createElasticMesh(container: HTMLElement, initial: ElasticMeshConfig): ElasticMeshHandle;\nexport function createElasticField(size: number, width: number, height: number): unknown;\n",
      "type": "registry:component"
    }
  ],
  "meta": {
    "license": "MIT",
    "page": "https://horizonx.so/tools/elastic-mesh",
    "source": "https://horizonx.so"
  },
  "docs": "Elastic Mesh fills its parent, so give the parent a width and height. The full editor, presets and exports are at https://horizonx.so/tools/elastic-mesh",
  "categories": [
    "webgl",
    "background"
  ],
  "type": "registry:component"
}