@mkbabb/glass-ui 3.6.0 → 3.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (255) hide show
  1. package/dist/CardAction-q2qHCJFG.js +157 -0
  2. package/dist/CollapsibleContent-CP9qF1v4.js +63 -0
  3. package/dist/{CommandShortcut-BiVyqipe.js → CommandShortcut-SzWRhROC.js} +4 -4
  4. package/dist/{ContextMenuContent-De01_83g.js → ContextMenuContent-DDa0v27s.js} +1 -1
  5. package/dist/{ContextMenuSubContent-DrWkXKQP.js → ContextMenuSubContent-Do977Cbf.js} +4 -4
  6. package/dist/{DataTable-BGVXx0Ww.js → DataTable-CvlWXz65.js} +14 -7
  7. package/dist/DeckProgress-AVgbIULY.js +23 -0
  8. package/dist/{DialogContent-IQ8_BRrC.js → DialogContent-DjZWT3lK.js} +24 -24
  9. package/dist/{DialogFooter-Er0wA3K6.js → DialogFooter-Gprw8H_A.js} +2 -2
  10. package/dist/{DiscoGlyph-BaZ8OawK.js → DiscoGlyph-CG0F410s.js} +1 -1
  11. package/dist/{GlyphFace-B_7vOmYn.js → GlyphFace-DRjDkB0s.js} +1 -1
  12. package/dist/{HoverCardContent-ICfIMZX1.js → HoverCardContent-B6CcQ8He.js} +1 -1
  13. package/dist/{HoverPopover-DTSYkJtw.js → HoverPopover-D56O6Ylp.js} +1 -1
  14. package/dist/{IconTooltip-DZlCkU-0.js → IconTooltip-D2T5nYOM.js} +1 -1
  15. package/dist/{Input-CRJ2owjN.js → Input-DVG_J0ne.js} +4 -1
  16. package/dist/{Label-CZk-3nTc.js → Label-zRfbQdCn.js} +1 -1
  17. package/dist/{MetricBadge-BlrdbOGN.js → MetricBadge-lTc002u2.js} +1 -1
  18. package/dist/{Notification-DP_ApJLo.js → Notification-BxK8LZMw.js} +5 -4
  19. package/dist/{NumberFieldContent-Bhhmk95p.js → NumberFieldContent-CLNVR1iY.js} +5 -5
  20. package/dist/{PopoverContent-B8WtJECb.js → PopoverContent-BId6ggf_.js} +2 -2
  21. package/dist/{Progress-DjM86vfb.js → Progress-iEuD9pxG.js} +7 -7
  22. package/dist/{ScrollingText-P9o_DuMn.js → ScrollingText-CVyqxvfv.js} +2 -2
  23. package/dist/{SelectScrollDownButton-BGn3rjs9.js → SelectScrollDownButton-C7TRe-ep.js} +8 -7
  24. package/dist/{Separator-C2XtAXRp.js → Separator-D7sD7RKj.js} +1 -1
  25. package/dist/{Switch-x8n6husW.js → Switch-LDKLmmgx.js} +8 -2
  26. package/dist/TabsList-qyHZ2lKY.js +101 -0
  27. package/dist/{Toaster-DdhMKfus.js → Toaster-CabYEEF_.js} +54 -60
  28. package/dist/{ToggleGroupItem-gyXj998A.js → ToggleGroupItem-CkXUcBlt.js} +13 -5
  29. package/dist/{TooltipProvider-D-JrSqDu.js → TooltipProvider-CmZzCuaG.js} +1 -1
  30. package/dist/{UnderlineTabs-CuIK16JI.js → UnderlineTabs-Uxn-R3MT.js} +2 -2
  31. package/dist/animated-digit.js +2 -2
  32. package/dist/api/index.d.ts +4 -2
  33. package/dist/api.js +1 -1
  34. package/dist/aurora.js +753 -359
  35. package/dist/{badge-Cl6JZ1B7.js → badge-DHQrc_GQ.js} +13 -9
  36. package/dist/badge.js +1 -1
  37. package/dist/{button-BcMzVrqs.js → button-CAywcrhO.js} +6 -3
  38. package/dist/button.js +1 -1
  39. package/dist/canvas.d.ts +1 -0
  40. package/dist/canvas.js +3 -0
  41. package/dist/card.js +2 -2
  42. package/dist/carousel.js +110 -109
  43. package/dist/{check-CdkxGxXJ.js → check-BBKKKSTf.js} +1 -1
  44. package/dist/{chevron-down-pBY8sYfV.js → chevron-down-BSkTP2aL.js} +1 -1
  45. package/dist/{chevron-right-BjeKC22V.js → chevron-right-sDM0Yvrf.js} +1 -1
  46. package/dist/{chevron-up-DBeNHUm1.js → chevron-up-CCOD_FTz.js} +1 -1
  47. package/dist/collapsible.js +1 -1
  48. package/dist/color-DMLTunJK.js +84 -0
  49. package/dist/color.js +2 -2
  50. package/dist/command.js +1 -1
  51. package/dist/compile-BBTRjvQS.js +158 -0
  52. package/dist/components/custom/aurora/Aurora.vue.d.ts +1 -0
  53. package/dist/components/custom/aurora/composables/atoms.d.ts +125 -0
  54. package/dist/components/custom/aurora/composables/color.d.ts +7 -25
  55. package/dist/components/custom/aurora/composables/cursorModel.d.ts +35 -2
  56. package/dist/components/custom/aurora/composables/glSetup.d.ts +1 -1
  57. package/dist/components/custom/aurora/composables/gpuRuntime.d.ts +16 -0
  58. package/dist/components/custom/aurora/composables/runtime.d.ts +18 -0
  59. package/dist/components/custom/aurora/composables/uniformBridge.d.ts +46 -12
  60. package/dist/components/custom/aurora/composables/useAurora.d.ts +6 -0
  61. package/dist/components/custom/aurora/composables/useCursorInteraction.d.ts +8 -0
  62. package/dist/components/custom/aurora/constants/presets.d.ts +60 -4
  63. package/dist/components/custom/aurora/constants/renderMode.d.ts +32 -0
  64. package/dist/components/custom/aurora/constants/shaders/aurora.wgsl.d.ts +7 -0
  65. package/dist/components/custom/aurora/constants/shaders/brush.glsl.d.ts +1 -1
  66. package/dist/components/custom/aurora/constants/shaders/composition.glsl.d.ts +1 -1
  67. package/dist/components/custom/aurora/constants/shaders/flow.glsl.d.ts +1 -1
  68. package/dist/components/custom/aurora/constants/shaders/mediums.glsl.d.ts +2 -2
  69. package/dist/components/custom/aurora/constants/shaders/painterly.wgsl.d.ts +7 -0
  70. package/dist/components/custom/aurora/constants/shaders/wake.wgsl.d.ts +4 -0
  71. package/dist/components/custom/aurora/index.d.ts +4 -3
  72. package/dist/components/custom/constellation/Constellation.vue.d.ts +40 -5
  73. package/dist/components/custom/constellation/constellationField.d.ts +110 -5
  74. package/dist/components/custom/constellation/index.d.ts +2 -2
  75. package/dist/components/custom/dock/GlassDock.vue.d.ts +12 -4
  76. package/dist/components/custom/dock/composables/dockMorphContext.d.ts +57 -0
  77. package/dist/components/custom/dock/composables/index.d.ts +3 -0
  78. package/dist/components/custom/dock/composables/useDockHold.d.ts +61 -0
  79. package/dist/components/custom/dock/composables/useLayerTransition.d.ts +13 -59
  80. package/dist/components/custom/dock/index.d.ts +2 -0
  81. package/dist/components/custom/fourier-field/FourierField.vue.d.ts +38 -0
  82. package/dist/components/custom/fourier-field/index.d.ts +2 -0
  83. package/dist/components/custom/fourier-field/math.d.ts +57 -0
  84. package/dist/components/custom/goo-blob/GooBlob.vue.d.ts +15 -0
  85. package/dist/components/custom/goo-blob/composables/useBlobMood.d.ts +18 -2
  86. package/dist/components/custom/goo-blob/composables/useBlobPointer.d.ts +47 -4
  87. package/dist/components/custom/goo-blob/composables/useBlobSatellites.d.ts +2 -0
  88. package/dist/components/custom/goo-blob/composables/useMetaballRenderer.d.ts +19 -4
  89. package/dist/components/custom/goo-blob/index.d.ts +1 -1
  90. package/dist/components/custom/goo-blob/shaders/sdf-body.glsl.d.ts +1 -1
  91. package/dist/components/custom/goo-blob/shaders/watercolor-edges.glsl.d.ts +2 -2
  92. package/dist/components/custom/goo-blob/types.d.ts +48 -0
  93. package/dist/components/custom/metric-cell/MetricCell.vue.d.ts +1 -1
  94. package/dist/components/custom/metric-stack/MetricStack.vue.d.ts +1 -1
  95. package/dist/components/ui/_shared/ModalOverlay.vue.d.ts +1 -1
  96. package/dist/components/ui/alert/index.d.ts +1 -1
  97. package/dist/components/ui/card/Card.vue.d.ts +26 -3
  98. package/dist/components/ui/card/CardAction.vue.d.ts +24 -0
  99. package/dist/components/ui/card/index.d.ts +2 -1
  100. package/dist/components/ui/collapsible/CollapsibleTrigger.vue.d.ts +5 -1
  101. package/dist/components/ui/progress/ProgressDefault.vue.d.ts +14 -4
  102. package/dist/components/ui/slider/Slider.vue.d.ts +3 -1
  103. package/dist/components/ui/tabs/TabsList.vue.d.ts +13 -3
  104. package/dist/components/ui/toast/Toast.vue.d.ts +5 -5
  105. package/dist/components/ui/toast/use-toast.d.ts +1 -1
  106. package/dist/composables/color/index.d.ts +69 -0
  107. package/dist/composables/dom/index.d.ts +1 -1
  108. package/dist/composables/dom/useResolveTokenColor.d.ts +27 -0
  109. package/dist/composables/glass/canvas2d/index.d.ts +2 -1
  110. package/dist/composables/glass/canvas2d/resolveCanvasColor.d.ts +20 -0
  111. package/dist/composables/glass/canvas2d/useCanvas2D.d.ts +15 -1
  112. package/dist/composables/glass/createGPUCanvas.d.ts +40 -0
  113. package/dist/composables/glass/index.d.ts +3 -1
  114. package/dist/composables/glass/useSpecularTracking.d.ts +33 -0
  115. package/dist/composables/glass/webgl/createCanvasLifecycle.d.ts +45 -0
  116. package/dist/composables/glass/webgl/shaders/procedural-color.glsl.d.ts +7 -0
  117. package/dist/composables/glass/webgl/useWebGLCanvas.d.ts +5 -5
  118. package/dist/composables/motion/core/index.d.ts +1 -0
  119. package/dist/configurator.js +1 -1
  120. package/dist/confirm-dialog.js +3 -3
  121. package/dist/constellation.js +144 -75
  122. package/dist/context-menu.js +2 -2
  123. package/dist/controls.js +2 -2
  124. package/dist/dark.js +1 -1
  125. package/dist/data-table.js +1 -1
  126. package/dist/deck-progress.d.ts +1 -0
  127. package/dist/deck-progress.js +2 -0
  128. package/dist/dialog.js +2 -2
  129. package/dist/disco-glyph.js +1 -1
  130. package/dist/dock.js +388 -287
  131. package/dist/{dockContext-spUj_-E5.js → dockContext-BKeIMmNk.js} +1 -1
  132. package/dist/dom.js +6 -6
  133. package/dist/{dropdown-menu-EFjl5iKo.js → dropdown-menu-B_4bWyyG.js} +5 -5
  134. package/dist/dropdown-menu.js +1 -1
  135. package/dist/expandable-container.js +2 -2
  136. package/dist/fonts/README.md +26 -18
  137. package/dist/forms.js +10 -7
  138. package/dist/fourier-field.d.ts +1 -0
  139. package/dist/fourier-field.js +166 -0
  140. package/dist/glass-carousel.js +12 -7
  141. package/dist/glass-panel.js +7 -7
  142. package/dist/glass-ui.css +1 -1
  143. package/dist/glass-ui.js +209 -206
  144. package/dist/glyph-face.js +2 -2
  145. package/dist/goo-blob.js +485 -300
  146. package/dist/header-ribbon.js +1 -1
  147. package/dist/hover-card.js +1 -1
  148. package/dist/hover-popover.js +1 -1
  149. package/dist/icon-tooltip.js +1 -1
  150. package/dist/index.d.ts +1 -0
  151. package/dist/instrument-chassis.js +1 -1
  152. package/dist/instrument-rail.js +1 -1
  153. package/dist/keyboard.js +1 -1
  154. package/dist/{keys-BFoma9vm.js → keys-BsYjEFOW.js} +1 -1
  155. package/dist/label.js +1 -1
  156. package/dist/labeled-field.js +6 -6
  157. package/dist/metric-badge.js +1 -1
  158. package/dist/metric-stack.js +1 -1
  159. package/dist/{minimize-2-BP27-qBY.js → minimize-2-lcXOuc6V.js} +1 -1
  160. package/dist/motion-core.js +68 -98
  161. package/dist/motion.js +3 -3
  162. package/dist/notification.js +1 -1
  163. package/dist/number-field.js +1 -1
  164. package/dist/paper-backdrop.js +1 -1
  165. package/dist/popover.js +1 -1
  166. package/dist/progress.js +1 -1
  167. package/dist/pulse.js +1 -1
  168. package/dist/reactive.js +2 -2
  169. package/dist/resolveCanvasColor-BBiYfp8g.js +11 -0
  170. package/dist/responsive-tabs.js +2 -2
  171. package/dist/scrolling-text.js +1 -1
  172. package/dist/{search-DBG8qaRs.js → search-nbkvr2dC.js} +1 -1
  173. package/dist/search.js +12 -12
  174. package/dist/select.js +3 -3
  175. package/dist/separator.js +1 -1
  176. package/dist/{sheet-CQYYrkr9.js → sheet-VZEtNFvO.js} +4 -4
  177. package/dist/sheet.js +1 -1
  178. package/dist/slider-D9puf-Ko.js +142 -0
  179. package/dist/slider.js +1 -1
  180. package/dist/sortable-list.js +3 -3
  181. package/dist/styles/components.css +1 -1
  182. package/dist/styles/dock-controls.css +21 -18
  183. package/dist/styles/dock.css +415 -224
  184. package/dist/styles/fonts.css +0 -25
  185. package/dist/styles/glass.css +100 -41
  186. package/dist/styles/theme.css +58 -2
  187. package/dist/styles/tokens.css +139 -32
  188. package/dist/styles/typography.css +55 -72
  189. package/dist/styles/utilities.css +19 -14
  190. package/dist/styles/view-transition.css +12 -40
  191. package/dist/supportsCssTimeline-C5oe0lnD.js +12 -0
  192. package/dist/switch.js +1 -1
  193. package/dist/tabs.js +5 -5
  194. package/dist/timeline.js +3 -3
  195. package/dist/toast.js +1 -1
  196. package/dist/toggle-group.js +1 -1
  197. package/dist/tooltip.js +1 -1
  198. package/dist/typewriter.js +1 -1
  199. package/dist/{useAnimatedNumber-DfVgP4te.js → useAnimatedNumber-C_3wZLx4.js} +1 -1
  200. package/dist/{useCanvas2D-BeNJqqIS.js → useCanvas2D-ClrQuZtp.js} +2 -1
  201. package/dist/{useConfiguratorState-DUtC1jxr.js → useConfiguratorState-CMff4GzH.js} +5 -5
  202. package/dist/useResolveTokenColor-r9pnNjqK.js +24 -0
  203. package/dist/useScrollProgress-C9ysDic5.js +35 -0
  204. package/dist/useSpecularTracking-BVRZsRHA.js +26 -0
  205. package/dist/{useTextHighlight-Dmtofpk2.js → useTextHighlight-9nMW23Qb.js} +1 -1
  206. package/dist/{useTouchGate-CS5Csc2h.js → useTouchGate-WFyJYsth.js} +1 -1
  207. package/dist/vReveal-CqaCz_mC.js +44 -0
  208. package/dist/watercolor-dot.js +2 -2
  209. package/dist/{x-C4pz9nbD.js → x-Dfsegz9Y.js} +1 -1
  210. package/package.json +64 -4
  211. package/src/fonts/README.md +26 -18
  212. package/src/styles/dock-controls.css +21 -18
  213. package/src/styles/dock.css +415 -224
  214. package/src/styles/fonts.css +0 -25
  215. package/src/styles/glass.css +100 -41
  216. package/src/styles/theme.css +58 -2
  217. package/src/styles/tokens.css +139 -32
  218. package/src/styles/typography.css +55 -72
  219. package/src/styles/utilities.css +19 -14
  220. package/src/styles/view-transition.css +12 -40
  221. package/dist/CardFooter-C390imy7.js +0 -129
  222. package/dist/CollapsibleContent-cauTbZEM.js +0 -52
  223. package/dist/TabsIndicator-DA0x9gPr.js +0 -97
  224. package/dist/color-DS-iLRVM.js +0 -33
  225. package/dist/compile-C62K_FpC.js +0 -106
  226. package/dist/fonts/fraunces/fraunces-latin.woff2 +0 -0
  227. package/dist/slider-CgNzRSh6.js +0 -129
  228. package/dist/useViewTransition-DI0Rs2rV.js +0 -21
  229. package/dist/vReveal-u2wSG2El.js +0 -35
  230. package/src/fonts/fraunces/fraunces-latin.woff2 +0 -0
  231. /package/dist/{InstrumentChassis-DaHIZCqy.js → InstrumentChassis-C2f6cBaQ.js} +0 -0
  232. /package/dist/{InstrumentRail-B0qqLFN0.js → InstrumentRail-CUJ05YVG.js} +0 -0
  233. /package/dist/{ModalOverlay-B_CBtqcE.js → ModalOverlay-B1GkAjNb.js} +0 -0
  234. /package/dist/{PaperBackdrop-D_YZW47j.js → PaperBackdrop-CqwjnfLv.js} +0 -0
  235. /package/dist/{SelectGroup-CMdoCjRE.js → SelectGroup-BFiod7X2.js} +0 -0
  236. /package/dist/{SelectSeparator-CaJnPF3_.js → SelectSeparator-L8pPEn4L.js} +0 -0
  237. /package/dist/{_plugin-vue_export-helper-C1je1s0u.js → _plugin-vue_export-helper-ok8pgSl5.js} +0 -0
  238. /package/dist/composables/{dom → motion}/useTextHighlight.d.ts +0 -0
  239. /package/dist/{constants-C8NMonuo.js → constants-BPOqYJAm.js} +0 -0
  240. /package/dist/{createContext-DBMGRlx4.js → createContext-B44Sah_H.js} +0 -0
  241. /package/dist/{createLucideIcon-DuDoe_ra.js → createLucideIcon-B6uNAU9G.js} +0 -0
  242. /package/dist/{menuItemVariants-C2QlXqT3.js → menuItemVariants-DKM85SNE.js} +0 -0
  243. /package/dist/{presets-Dyv9Zl7W.js → presets-D1XPuTj-.js} +0 -0
  244. /package/dist/{prng-CjVgzjQT.js → prng-COGhh02-.js} +0 -0
  245. /package/dist/{useGlassRenderer-Dn3WpfG-.js → useGlassRenderer-5I0YkI4t.js} +0 -0
  246. /package/dist/{useGlobalDark-D7R9OypB.js → useGlobalDark-D3EBWzXK.js} +0 -0
  247. /package/dist/{useIntersectionPause-DsQYGc8V.js → useIntersectionPause-Bj4sPkMh.js} +0 -0
  248. /package/dist/{useInterval-CHVYFpXV.js → useInterval-CcLfq2WU.js} +0 -0
  249. /package/dist/{useKeyboardShortcuts-i8tHd5WO.js → useKeyboardShortcuts-BXWXOZ-9.js} +0 -0
  250. /package/dist/{useResizeObserver-DX-STszm.js → useResizeObserver-CWCbk5Px.js} +0 -0
  251. /package/dist/{useSortable-muI29agz.js → useSortable-MGAbCGVJ.js} +0 -0
  252. /package/dist/{useSpringMount-CnizvZGm.js → useSpringMount-BJSHcLl3.js} +0 -0
  253. /package/dist/{useTimer-DGgoxTXL.js → useTimer-3xqf_54b.js} +0 -0
  254. /package/dist/{useUserInvalidAria-DmvZ_6Dx.js → useUserInvalidAria-DoJKMZ3s.js} +0 -0
  255. /package/dist/{useViewportReady-Dcvf0c4p.js → useViewportReady-RIr5Wgkh.js} +0 -0
package/dist/goo-blob.js CHANGED
@@ -1,19 +1,25 @@
1
- import { t as e } from "./_plugin-vue_export-helper-C1je1s0u.js";
2
- import { a as t, i as n, n as r, o as i, r as a, s as o, t as s } from "./compile-C62K_FpC.js";
3
- import { t as c } from "./useIntersectionPause-DsQYGc8V.js";
4
- import { n as l, t as u } from "./prng-CjVgzjQT.js";
5
- import { computed as d, createElementBlock as f, createElementVNode as p, defineComponent as m, inject as h, normalizeStyle as g, onScopeDispose as _, onUnmounted as v, openBlock as y, readonly as b, ref as x, useTemplateRef as S, watch as C } from "vue";
1
+ import { t as e } from "./_plugin-vue_export-helper-ok8pgSl5.js";
2
+ import { t } from "./useResolveTokenColor-r9pnNjqK.js";
3
+ import { d as n, l as r, n as i, o as a, r as o, s, t as c } from "./compile-BBTRjvQS.js";
4
+ import { t as l } from "./useIntersectionPause-Bj4sPkMh.js";
5
+ import { n as u, t as d } from "./prng-COGhh02-.js";
6
+ import { computed as f, createElementBlock as p, createElementVNode as m, defineComponent as h, inject as g, normalizeStyle as _, onScopeDispose as v, onUnmounted as y, openBlock as b, readonly as x, ref as S, useTemplateRef as C, watch as w } from "vue";
7
+ import { SpringProgress as T } from "@mkbabb/keyframes.js";
6
8
  //#region src/components/custom/goo-blob/types.ts
7
- var w = {
9
+ var E = {
8
10
  canvasSize: 200,
9
- bodyRadius: .25,
11
+ bodyRadius: .22,
10
12
  satelliteCount: 3,
11
- satelliteRadius: .13,
12
- orbitRadius: .35,
13
- smoothK: .22,
14
- noiseAmp: .025,
13
+ satelliteRadius: .082,
14
+ orbitRadius: .17,
15
+ quality: "full",
16
+ tempo: 1,
17
+ smoothK: .05,
18
+ merge: "quadratic",
19
+ noiseAmp: .038,
15
20
  noiseFreq: 3.5,
16
21
  noiseSpeed: .08,
22
+ warpAmp: .35,
17
23
  pulseFreq: .3,
18
24
  pulseAmp: .008,
19
25
  hueRange: 5,
@@ -21,9 +27,29 @@ var w = {
21
27
  brightnessShift: 0,
22
28
  colorNoiseFreq: 2,
23
29
  colorNoiseSpeed: .05,
24
- pointerAttraction: 0,
25
- pointerStrength: .08,
26
- eccentricity: .25,
30
+ paletteStops: [],
31
+ iridescence: .18,
32
+ iridHue: 85,
33
+ iridSpeed: .06,
34
+ sssScale: .2,
35
+ sssPower: 2,
36
+ coreGlow: .1,
37
+ lit: !0,
38
+ rimColor: "var(--foreground)",
39
+ lightDir: [
40
+ .4,
41
+ .7,
42
+ .6
43
+ ],
44
+ specStrength: .9,
45
+ specShininess: 32,
46
+ rimPower: 2.5,
47
+ rimStrength: .5,
48
+ pointerAttraction: .35,
49
+ pointerStrength: .45,
50
+ stretch: .5,
51
+ clickImpulse: .5,
52
+ eccentricity: .05,
27
53
  orbitSpeedScale: 1,
28
54
  wobbleScale: 1,
29
55
  mergeRate: 1,
@@ -31,94 +57,72 @@ var w = {
31
57
  absorbedDuration: [2e3, 4e3],
32
58
  emergeDuration: 2200,
33
59
  orbitDuration: [8e3, 14e3]
34
- }, T = Symbol("blobConfig");
60
+ }, D = Symbol("blobConfig");
35
61
  //#endregion
36
62
  //#region src/components/custom/goo-blob/composables/easing.ts
37
- function E(e) {
63
+ function O(e) {
38
64
  return e < .5 ? 2 * e * e : 1 - 2 * (1 - e) * (1 - e);
39
65
  }
40
- function D(e) {
66
+ function k(e) {
41
67
  return e * e;
42
68
  }
43
- function ee(e) {
69
+ function A(e) {
44
70
  return 1 - (1 - e) * (1 - e);
45
71
  }
46
72
  //#endregion
47
73
  //#region src/components/custom/goo-blob/composables/useBlobMood.ts
48
- var O = {
74
+ var j = {
49
75
  idle: {
50
- orbitSpeedScale: 1,
51
- wobbleScale: 1,
52
- pulseFreq: .3,
53
- pulseAmp: .015,
54
- noiseAmp: .025,
55
- hueRange: 5,
56
- satShift: 0,
57
- brightnessShift: 0,
58
- smoothK: .22,
59
- pointerAttraction: 0,
60
- mergeRate: 1
76
+ valence: 0,
77
+ arousal: .35
61
78
  },
62
79
  happy: {
63
- orbitSpeedScale: 1.4,
64
- wobbleScale: 1.3,
65
- pulseFreq: .8,
66
- pulseAmp: .03,
67
- noiseAmp: .035,
68
- hueRange: 15,
69
- satShift: .05,
70
- brightnessShift: .05,
71
- smoothK: .28,
72
- pointerAttraction: .3,
73
- mergeRate: .6
80
+ valence: .8,
81
+ arousal: .6
74
82
  },
75
83
  curious: {
76
- orbitSpeedScale: .8,
77
- wobbleScale: 1.5,
78
- pulseFreq: .5,
79
- pulseAmp: .02,
80
- noiseAmp: .03,
81
- hueRange: 10,
82
- satShift: .03,
83
- brightnessShift: .02,
84
- smoothK: .25,
85
- pointerAttraction: .6,
86
- mergeRate: 1.2
84
+ valence: .3,
85
+ arousal: .5
87
86
  },
88
87
  sleepy: {
89
- orbitSpeedScale: .4,
90
- wobbleScale: .5,
91
- pulseFreq: .15,
92
- pulseAmp: .008,
93
- noiseAmp: .015,
94
- hueRange: 3,
95
- satShift: -.05,
96
- brightnessShift: -.03,
97
- smoothK: .16,
98
- pointerAttraction: -.2,
99
- mergeRate: 2
88
+ valence: -.1,
89
+ arousal: .1
100
90
  },
101
91
  excited: {
102
- orbitSpeedScale: 2.2,
103
- wobbleScale: 2,
104
- pulseFreq: 1.5,
105
- pulseAmp: .05,
106
- noiseAmp: .045,
107
- hueRange: 25,
108
- satShift: .1,
109
- brightnessShift: .08,
110
- smoothK: .32,
111
- pointerAttraction: .1,
112
- mergeRate: .3
92
+ valence: .7,
93
+ arousal: 1
113
94
  }
114
- }, k = {
95
+ }, M = (e, t, n) => e + (t - e) * n;
96
+ function N({ valence: e, arousal: t }) {
97
+ return {
98
+ orbitSpeedScale: M(.4, 2.2, t),
99
+ wobbleScale: M(.5, 2, t),
100
+ pulseFreq: M(.15, 1.5, t),
101
+ pulseAmp: M(.008, .05, t),
102
+ noiseAmp: M(.015, .045, t),
103
+ hueRange: M(3, 25, t * .6 + (e * .5 + .5) * .4),
104
+ satShift: M(-.05, .1, e * .5 + .5),
105
+ brightnessShift: M(-.03, .08, e * .5 + .5),
106
+ smoothK: M(.85, 1.35, t),
107
+ pointerAttraction: M(-.2, .6, e * .5 + .5) * (.4 + .6 * t),
108
+ mergeRate: M(2, .3, t),
109
+ iridScale: M(.55, 1.35, t)
110
+ };
111
+ }
112
+ var P = {
113
+ idle: N(j.idle),
114
+ happy: N(j.happy),
115
+ curious: N(j.curious),
116
+ sleepy: N(j.sleepy),
117
+ excited: N(j.excited)
118
+ }, F = {
115
119
  idle: 1500,
116
120
  happy: 1200,
117
121
  curious: 800,
118
122
  sleepy: 2500,
119
123
  excited: 600
120
124
  };
121
- function A(e, t, n) {
125
+ function I(e, t, n) {
122
126
  let r = (e, t) => e + (t - e) * n;
123
127
  return {
124
128
  orbitSpeedScale: r(e.orbitSpeedScale, t.orbitSpeedScale),
@@ -131,75 +135,157 @@ function A(e, t, n) {
131
135
  brightnessShift: r(e.brightnessShift, t.brightnessShift),
132
136
  smoothK: r(e.smoothK, t.smoothK),
133
137
  pointerAttraction: r(e.pointerAttraction, t.pointerAttraction),
134
- mergeRate: r(e.mergeRate, t.mergeRate)
138
+ mergeRate: r(e.mergeRate, t.mergeRate),
139
+ iridScale: r(e.iridScale, t.iridScale)
135
140
  };
136
141
  }
137
- function j() {
138
- let e = x("idle"), t = x({ ...O.idle }), n = { ...O.idle }, r = { ...O.idle }, i = 0, a = 0, o = !1;
139
- function s(s) {
140
- s === e.value && !o || (e.value = s, n = { ...t.value }, r = O[s], a = k[s], i = 0, o = !0);
142
+ var L = 6e3;
143
+ function R() {
144
+ let e = S("idle"), t = S({ ...P.idle }), n = { ...P.idle }, r = { ...P.idle }, i = 0, a = 0, o = !1, s = 0, c = 0;
145
+ function l(s) {
146
+ s === e.value && !o || (e.value = s, n = { ...t.value }, r = P[s], a = F[s], i = 0, o = !0);
147
+ }
148
+ function u(e) {
149
+ if (c = e.idleMs, e.clicked) {
150
+ s = 900, l("excited");
151
+ return;
152
+ }
153
+ s > 0 || (e.pointerActive ? l("curious") : e.idleMs > L ? l("sleepy") : l("idle"));
141
154
  }
142
- function c(e) {
143
- if (!o) return;
155
+ function d() {
156
+ return o || s > 0 ? !1 : !(e.value !== "sleepy" && c < L);
157
+ }
158
+ function f() {
159
+ return o || s > 0 || e.value === "sleepy" ? Infinity : Math.max(0, L - c);
160
+ }
161
+ function p(e) {
162
+ if (s > 0 && (s = Math.max(0, s - e)), !o) return;
144
163
  i += e;
145
- let s = Math.min(i / a, 1), c = E(s);
146
- t.value = A(n, r, c), s >= 1 && (o = !1);
164
+ let c = Math.min(i / a, 1), l = O(c);
165
+ t.value = I(n, r, l), c >= 1 && (o = !1);
147
166
  }
148
167
  return {
149
- currentMood: b(e),
150
- params: b(t),
151
- setMood: s,
152
- tick: c
168
+ currentMood: x(e),
169
+ params: x(t),
170
+ setMood: l,
171
+ update: u,
172
+ tick: p,
173
+ isSettled: d,
174
+ nextAutoMoodMs: f
153
175
  };
154
176
  }
155
- //#endregion
156
- //#region src/components/custom/goo-blob/composables/useBlobPointer.ts
157
- var M = .12;
158
- function N(e) {
159
- let t = x({
177
+ function z(e) {
178
+ let t = S({
179
+ x: 0,
180
+ y: 0
181
+ }), n = S({
160
182
  x: 0,
161
183
  y: 0
162
- }), n = x(!1), r = 0, i = 0, a = 0, o = 0;
163
- function s(t) {
164
- let a = e.value;
165
- if (!a) return;
166
- let o = a.getBoundingClientRect();
167
- r = (t.clientX - o.left) / o.width * 2 - 1, i = (t.clientY - o.top) / o.height * 2 - 1, n.value = !0;
184
+ }), r = S(!1), i = S(0), a = 0, o = 0, s = {
185
+ response: .18,
186
+ dampingFraction: 1
187
+ }, c = new T(s), l = new T(s), u = Array.from({ length: 15 }, () => ({
188
+ x: 0,
189
+ y: 0,
190
+ radius: 0
191
+ })), d = 0, f = 0, p = 0, m = 0;
192
+ function h(t) {
193
+ let n = e.value;
194
+ if (!n) return;
195
+ let i = n.getBoundingClientRect();
196
+ a = (t.clientX - i.left) / i.width * 2 - 1, o = (t.clientY - i.top) / i.height * 2 - 1, r.value = !0;
168
197
  }
169
- function c() {
170
- n.value = !1;
198
+ function g() {
199
+ r.value = !1;
171
200
  }
172
- let l = null;
173
- C(e, (e) => {
174
- l &&= (l(), null), e && (e.addEventListener("pointermove", s), e.addEventListener("pointerleave", c), l = () => {
175
- e.removeEventListener("pointermove", s), e.removeEventListener("pointerleave", c);
201
+ let _ = null;
202
+ w(e, (e) => {
203
+ _ &&= (_(), null), e && (e.addEventListener("pointermove", h), e.addEventListener("pointerleave", g), _ = () => {
204
+ e.removeEventListener("pointermove", h), e.removeEventListener("pointerleave", g);
176
205
  });
177
- }, { immediate: !0 }), v(() => l?.());
178
- function u() {
179
- n.value ? (a += (r - a) * M, o += (i - o) * M) : (a *= 1 - M, o *= 1 - M), t.value = {
180
- x: a,
181
- y: o
206
+ }, { immediate: !0 }), y(() => _?.());
207
+ function v(e = 16) {
208
+ let s = Math.min(e, 50) / 1e3;
209
+ r.value ? O = 0 : O += Math.min(e, 50);
210
+ let h = r.value ? a : 0, g = r.value ? o : 0;
211
+ if (c.target = h, l.target = g, c.tick(s), l.tick(s), t.value = {
212
+ x: c.value,
213
+ y: l.value
214
+ }, n.value = {
215
+ x: c.velocity,
216
+ y: l.velocity
217
+ }, p !== 0 || m !== 0) {
218
+ let e = -324 * p - 2 * .35 * 18 * m;
219
+ m += e * s, p += m * s, p < -.9 && (p = -.9), Math.abs(p) < 1e-4 && Math.abs(m) < 1e-4 && (p = 0, m = 0);
220
+ }
221
+ i.value = p;
222
+ let _ = Math.hypot(c.velocity, l.velocity);
223
+ r.value || _ > .05 ? (d = (d + 1) % 15, u[d].x = c.value, u[d].y = l.value, f = Math.min(f + 1, 15)) : f > 0 && (f = Math.max(0, f - 1));
224
+ }
225
+ function b(e) {
226
+ let t = [];
227
+ for (let n = 0; n < f; n++) {
228
+ let r = u[(d - n + 30) % 15];
229
+ t.push({
230
+ x: r.x,
231
+ y: r.y,
232
+ radius: e * (1 - n / 15)
233
+ });
234
+ }
235
+ return {
236
+ sources: t,
237
+ count: f
182
238
  };
183
239
  }
240
+ let C = !1;
241
+ function E(e) {
242
+ m += e * 18, C = !0;
243
+ }
244
+ function D() {
245
+ let e = C;
246
+ return C = !1, e;
247
+ }
248
+ let O = 0;
249
+ function k() {
250
+ c.reset(0, 0), l.reset(0, 0), c.target = 0, l.target = 0, t.value = {
251
+ x: 0,
252
+ y: 0
253
+ }, n.value = {
254
+ x: 0,
255
+ y: 0
256
+ }, p = 0, m = 0, i.value = 0, f = 0;
257
+ }
258
+ let A = .001;
259
+ function j() {
260
+ return !(r.value || Math.hypot(c.velocity, l.velocity) > A || Math.abs(c.value) > A || Math.abs(l.value) > A || f > 0 || p !== 0 || m !== 0);
261
+ }
184
262
  return {
185
- pointer: b(t),
186
- active: b(n),
187
- tick: u
263
+ pointer: x(t),
264
+ velocity: x(n),
265
+ active: x(r),
266
+ pulse: x(i),
267
+ idleMs: () => O,
268
+ tick: v,
269
+ trailSources: b,
270
+ click: E,
271
+ consumeClick: D,
272
+ rest: k,
273
+ isAtRest: j
188
274
  };
189
275
  }
190
276
  //#endregion
191
277
  //#region src/components/custom/goo-blob/composables/useBlobSatellites.ts
192
- function P(e, t, n) {
278
+ function B(e, t, n) {
193
279
  return t + e() * (n - t);
194
280
  }
195
- function F(e) {
281
+ function V(e) {
196
282
  return e < 0 ? 0 : e > 1 ? 1 : e;
197
283
  }
198
- function I(e, t, n) {
284
+ function H(e, t, n) {
199
285
  return e + (t - e) * n;
200
286
  }
201
- function L(e, t, n, r) {
202
- let i = performance.now(), a = t / 4 * Math.PI * 2 + (e() - .5) * Math.PI, o = n * (.8 + e() * .4), s = r * (.3 + e() * .7);
287
+ function ee(e, t, n, r, i) {
288
+ let a = t / 4 * Math.PI * 2 + (e() - .5) * Math.PI, o = n * (.8 + e() * .4), s = r * (.3 + e() * .7);
203
289
  return {
204
290
  phase: "orbiting",
205
291
  phaseStart: i,
@@ -225,24 +311,24 @@ function L(e, t, n, r) {
225
311
  endY: 0
226
312
  };
227
313
  }
228
- function R(e, t, n, r) {
314
+ function U(e, t, n, r) {
229
315
  e.phase = t, e.phaseStart = n, e.phaseDuration = r;
230
316
  }
231
- function z(e, t) {
232
- let n = (t - e.timeOrigin) / 1e3, r = e.angularSpeed * n + e.phaseOffset, i = e.wobbleAmp1 * Math.sin(e.wobbleFreq1 * n) + e.wobbleAmp2 * Math.sin(e.wobbleFreq2 * n + 1.3);
317
+ function W(e, t, n, r) {
318
+ let i = (t - e.timeOrigin) / 1e3, a = e.angularSpeed * n * i + e.phaseOffset, o = r * (e.wobbleAmp1 * Math.sin(e.wobbleFreq1 * i) + e.wobbleAmp2 * Math.sin(e.wobbleFreq2 * i + 1.3));
233
319
  return {
234
- x: (e.baseRadiusX + i) * Math.cos(r) + e.pertXAmp * Math.sin(e.pertXFreq * n + e.pertXPhase),
235
- y: (e.baseRadiusY + i) * Math.sin(r) + e.pertYAmp * Math.cos(e.pertYFreq * n + e.pertYPhase)
320
+ x: (e.baseRadiusX + o) * Math.cos(a) + e.pertXAmp * Math.sin(e.pertXFreq * i + e.pertXPhase),
321
+ y: (e.baseRadiusY + o) * Math.sin(a) + e.pertYAmp * Math.cos(e.pertYFreq * i + e.pertYPhase)
236
322
  };
237
323
  }
238
- function B(e, t, n, r, i) {
324
+ function te(e, t, n, r, i) {
239
325
  e.timeOrigin = i, e.angularSpeed = .08 + t() * .16, e.phaseOffset = t() * Math.PI * 2;
240
326
  let a = n * (.8 + t() * .4), o = r * (.3 + t() * .7);
241
327
  e.baseRadiusX = a * (1 - o), e.baseRadiusY = a * (1 + o), e.wobbleAmp1 = .02 + t() * .06, e.wobbleFreq1 = .08 + t() * .22, e.wobbleAmp2 = .015 + t() * .04, e.wobbleFreq2 = .18 + t() * .32, e.pertXAmp = .03 + t() * .05, e.pertXFreq = .06 + t() * .18, e.pertXPhase = t() * Math.PI * 2, e.pertYAmp = .03 + t() * .05, e.pertYFreq = .07 + t() * .17, e.pertYPhase = t() * Math.PI * 2;
242
328
  }
243
- var V = .75, H = 2e3;
244
- function U(e, t) {
245
- let n = l(u(t + "goo")), r = [], i = [], a = [], o = -Infinity, s = e.orbitRadius;
329
+ var G = .75, K = 2e3;
330
+ function q(e, t) {
331
+ let n = u(d(t + "goo")), r = [], i = [], a = [], o = -Infinity, s = e.orbitRadius;
246
332
  function c() {
247
333
  let t = e.orbitRadius;
248
334
  if (t !== s && s > 0) {
@@ -251,9 +337,9 @@ function U(e, t) {
251
337
  s = t;
252
338
  }
253
339
  }
254
- function d() {
255
- let t = e.satelliteCount;
256
- for (; r.length < t;) r.push(L(n, r.length, e.orbitRadius, e.eccentricity)), i.push({
340
+ function l(t) {
341
+ let o = e.satelliteCount;
342
+ for (; r.length < o;) r.push(ee(n, r.length, e.orbitRadius, e.eccentricity, t)), i.push({
257
343
  x: 0,
258
344
  y: 0,
259
345
  radius: e.satelliteRadius,
@@ -263,94 +349,159 @@ function U(e, t) {
263
349
  y: 0,
264
350
  start: 0
265
351
  });
266
- r.length > t && (r.length = t, i.length = t, a.length = t);
352
+ r.length > o && (r.length = o, i.length = o, a.length = o);
267
353
  }
268
- d();
269
354
  function f(t, s) {
270
- d(), c();
271
- let l = r.length, u = s.mergeRate, f = e.satelliteRadius, p = e.mergeDuration, m = e.emergeDuration, h = e.orbitDuration, g = e.absorbedDuration;
272
- for (let s = 0; s < l; s++) {
273
- let c = r[s], l = t - c.phaseStart, d = F(c.phaseDuration > 0 ? l / c.phaseDuration : 1);
274
- switch (c.phase) {
355
+ l(t), c();
356
+ let u = r.length, d = s.mergeRate, f = e.satelliteRadius, p = e.mergeDuration, m = e.emergeDuration, h = e.orbitDuration, g = e.absorbedDuration;
357
+ for (let c = 0; c < u; c++) {
358
+ let l = r[c], u = t - l.phaseStart, _ = V(l.phaseDuration > 0 ? u / l.phaseDuration : 1);
359
+ switch (l.phase) {
275
360
  case "orbiting":
276
- if (d >= 1) if (t - o < 3e3 * u) c.phaseStart = t, c.phaseDuration = P(n, h[0], h[1]);
361
+ if (_ >= 1) if (t - o < 3e3 * d) l.phaseStart = t, l.phaseDuration = B(n, h[0], h[1]);
277
362
  else {
278
- let e = z(c, t);
279
- c.startX = e.x, c.startY = e.y;
363
+ let e = W(l, t, s.orbitSpeedScale, s.wobbleScale);
364
+ l.startX = e.x, l.startY = e.y;
280
365
  let n = Math.hypot(e.x, e.y), r = n > .01 ? .08 / n : 0;
281
- c.endX = e.x * r, c.endY = e.y * r, R(c, "merging", t, p), o = t;
366
+ l.endX = e.x * r, l.endY = e.y * r, U(l, "merging", t, p), o = t;
282
367
  }
283
368
  break;
284
369
  case "merging":
285
- d >= 1 && R(c, "absorbed", t, P(n, g[0], g[1]));
370
+ _ >= 1 && U(l, "absorbed", t, B(n, g[0], g[1]));
286
371
  break;
287
372
  case "absorbed":
288
- if (d >= 1) {
289
- B(c, n, e.orbitRadius, e.eccentricity, t);
290
- let r = z(c, t + 3e3);
291
- c.endX = r.x, c.endY = r.y;
373
+ if (_ >= 1) {
374
+ te(l, n, e.orbitRadius, e.eccentricity, t);
375
+ let r = W(l, t + 3e3, s.orbitSpeedScale, s.wobbleScale);
376
+ l.endX = r.x, l.endY = r.y;
292
377
  let i = Math.hypot(r.x, r.y), a = i > .01 ? .08 / i : 0;
293
- c.startX = r.x * a, c.startY = r.y * a, R(c, "emerging", t, m);
378
+ l.startX = r.x * a, l.startY = r.y * a, U(l, "emerging", t, m);
294
379
  }
295
380
  break;
296
381
  case "emerging":
297
- if (d >= 1) {
298
- let e = a[s];
299
- e.x = c.endX, e.y = c.endY, e.start = t, c.timeOrigin = t, c.phaseOffset = Math.atan2(c.endY, c.endX), R(c, "orbiting", t, P(n, h[0], h[1]));
382
+ if (_ >= 1) {
383
+ let e = a[c];
384
+ e.x = l.endX, e.y = l.endY, e.start = t, l.timeOrigin = t, l.phaseOffset = Math.atan2(l.endY, l.endX), U(l, "orbiting", t, B(n, h[0], h[1]));
300
385
  }
301
386
  break;
302
387
  }
303
- let _, v, y, b;
304
- switch (c.phase) {
388
+ let v, y, b, x;
389
+ switch (l.phase) {
305
390
  case "orbiting": {
306
- let e = z(c, t), n = a[s], r = t - n.start;
307
- if (n.start > 0 && r < H) {
308
- let t = F(r / H), i = t * t * (3 - 2 * t);
309
- _ = I(n.x, e.x, i), v = I(n.y, e.y, i);
310
- } else _ = e.x, v = e.y;
311
- y = V, b = 1;
391
+ let e = W(l, t, s.orbitSpeedScale, s.wobbleScale), n = a[c], r = t - n.start;
392
+ if (n.start > 0 && r < K) {
393
+ let t = V(r / K), i = t * t * (3 - 2 * t);
394
+ v = H(n.x, e.x, i), y = H(n.y, e.y, i);
395
+ } else v = e.x, y = e.y;
396
+ b = G, x = 1;
312
397
  break;
313
398
  }
314
399
  case "merging": {
315
- let e = D(F((t - c.phaseStart) / c.phaseDuration));
316
- _ = I(c.startX, c.endX, e), v = I(c.startY, c.endY, e);
317
- let n = F((t - c.phaseStart) / c.phaseDuration);
318
- y = n > .85 ? I(V, 0, (n - .85) / .15) : V, b = I(1, .65, e);
400
+ let e = k(V((t - l.phaseStart) / l.phaseDuration));
401
+ v = H(l.startX, l.endX, e), y = H(l.startY, l.endY, e);
402
+ let n = V((t - l.phaseStart) / l.phaseDuration);
403
+ b = n > .85 ? H(G, 0, (n - .85) / .15) : G, x = H(1, .65, e);
319
404
  break;
320
405
  }
321
406
  case "absorbed":
322
- _ = 0, v = 0, y = 0, b = .5;
407
+ v = 0, y = 0, b = 0, x = .5;
323
408
  break;
324
409
  case "emerging": {
325
- let e = ee(F((t - c.phaseStart) / c.phaseDuration));
326
- _ = I(c.startX, c.endX, e), v = I(c.startY, c.endY, e);
327
- let n = F((t - c.phaseStart) / c.phaseDuration);
328
- y = n < .1 ? I(0, V, n / .1) : V, b = I(.65, 1, e);
410
+ let e = A(V((t - l.phaseStart) / l.phaseDuration));
411
+ v = H(l.startX, l.endX, e), y = H(l.startY, l.endY, e);
412
+ let n = V((t - l.phaseStart) / l.phaseDuration);
413
+ b = n < .1 ? H(0, G, n / .1) : G, x = H(.65, 1, e);
329
414
  break;
330
415
  }
331
416
  }
332
- let x = i[s];
333
- x.x = _, x.y = v, x.radius = f * b, x.opacity = y;
417
+ let S = i[c];
418
+ S.x = v, S.y = y, S.radius = f * x, S.opacity = b;
334
419
  }
335
420
  }
336
421
  function p() {
337
422
  for (let e of r) e.phaseOffset += (n() - .5) * .6, e.pertXPhase += n() * Math.PI, e.pertYPhase += n() * Math.PI;
338
423
  }
339
424
  function m(e) {
340
- n = l(u(e + "goo"));
425
+ n = u(d(e + "goo"));
426
+ }
427
+ function h() {
428
+ for (let e of r) if (e.phase !== "orbiting") return !1;
429
+ return !0;
430
+ }
431
+ function g(e) {
432
+ let t = Infinity;
433
+ for (let e of r) {
434
+ let n = e.phaseStart + e.phaseDuration;
435
+ n < t && (t = n);
436
+ }
437
+ return t === Infinity ? e + 3e4 : t;
341
438
  }
342
439
  return {
343
440
  sources: i,
344
441
  tick: f,
345
442
  nudge: p,
346
- reseed: m
443
+ reseed: m,
444
+ isQuiescent: h,
445
+ nextEventMs: g
347
446
  };
348
447
  }
349
448
  //#endregion
350
449
  //#region src/components/custom/goo-blob/shaders/metaball.vert.ts
351
- var te = "#version 300 es\n\nin vec2 aPosition;\nout vec2 vUv;\n\nvoid main() {\n vUv = 0.5 * (aPosition + 1.0);\n gl_Position = vec4(aPosition, 0.0, 1.0);\n}", W = "// --- SDF ---\n\nfloat sdCircle(vec2 p, vec2 center, float radius) {\n return length(p - center) - radius;\n}\n\n// Edit #2 — Inigo Quilez quadratic polynomial smin (same uSmoothK uniform). The\n// quadratic h*h*k*0.25 form has a cleaner C1 seam than the prior cubic smin.\nfloat smin(float a, float b, float k) {\n float h = max(k - abs(a - b), 0.0) / k;\n return min(a, b) - h * h * k * 0.25;\n}", G = "// --- Noise ---\n\nfloat hash21(vec2 p) {\n vec3 p3 = fract(vec3(p.xyx) * 0.1031);\n p3 += dot(p3, p3.yzx + 33.33);\n return fract((p3.x + p3.y) * p3.z);\n}\n\nfloat valueNoise(vec2 p) {\n vec2 i = floor(p);\n vec2 f = fract(p);\n f = f * f * (3.0 - 2.0 * f);\n\n float a = hash21(i);\n float b = hash21(i + vec2(1.0, 0.0));\n float c = hash21(i + vec2(0.0, 1.0));\n float d = hash21(i + vec2(1.0, 1.0));\n\n return mix(mix(a, b, f.x), mix(c, d, f.x), f.y);\n}\n\n// Edit #3 — rotated-octave FBM: a fixed ~0.5 rad 2x2 rotation between octaves\n// breaks the axis-aligned banding the un-rotated lattice noise produces. The\n// rotation CONSTANT is spliced from the shared chunk (AV.W2 — the one FBM_ROT);\n// the loop below stays blob-local (param octaves + 2.0 lacunarity, per §3a).", K = "float fbm(vec2 p, int octaves) {\n float value = 0.0;\n float amp = 0.5;\n float freq = 1.0;\n for (int i = 0; i < 4; i++) {\n if (i >= octaves) break;\n value += amp * valueNoise(p * freq);\n p = FBM_ROT * p;\n freq *= 2.0;\n amp *= 0.5;\n }\n return value;\n}\n", q = "// Edit #4's gamut step — hue-preserving inward chroma clamp. If the linear result\n// is out of [0,1], bisect chroma toward 0 (L + h fixed) until in gamut. Preserves\n// hue exactly (only C shrinks). 16 steps resolve C to < 2^-16 of its span.\nbool inGamut(vec3 lin) {\n return all(greaterThanEqual(lin, vec3(0.0))) && all(lessThanEqual(lin, vec3(1.0)));\n}\nvec3 gamutClampOklch(vec3 lch) {\n vec3 lin = oklabToLinearSrgb(oklchToOklab(lch));\n if (inGamut(lin)) return lch;\n float lo = 0.0;\n float hi = lch.y;\n for (int i = 0; i < 16; i++) {\n float mid = 0.5 * (lo + hi);\n vec3 test = vec3(lch.x, mid, lch.z);\n if (inGamut(oklabToLinearSrgb(oklchToOklab(test)))) {\n lo = mid;\n } else {\n hi = mid;\n }\n }\n return vec3(lch.x, lo, lch.z);\n}", J = "\n", Y = "#version 300 es\nprecision highp float;\n\nin vec2 vUv;\nout vec4 fragColor;\n\nuniform vec2 uResolution;\nuniform float uTime;\nuniform vec3 uBaseColor;\n\n// Pointer\nuniform vec2 uPointer;\nuniform float uPointerActive;\nuniform float uPointerAttraction;\nuniform float uPointerStrength;\n\n// Main body\nuniform float uBodyRadius;\n\n// Pulsation\nuniform float uPulsePhase;\nuniform float uPulseAmp;\n\n// Surface noise\nuniform float uNoiseAmp;\nuniform float uNoiseFreq;\nuniform float uNoiseSpeed;\n\n// Gooey\nuniform float uSmoothK;\n\n// Color perturbation (perceptually uniform — OKLCh L/C/h)\nuniform float uHueRange; // degrees of hue swing (converted to radians)\nuniform float uSatShift; // OKLCh chroma swing\nuniform float uBrightnessShift; // OKLCh lightness bias\nuniform float uColorNoiseFreq;\nuniform float uColorNoiseSpeed;\n\n// Satellites (max 4)\n#define MAX_SATS 4\nuniform int uSatCount;\nuniform vec2 uSatPos[MAX_SATS];\nuniform float uSatRadius[MAX_SATS];\nuniform float uSatOpacity[MAX_SATS];\n\nconst float PI = 3.141592653589793;\n\n" + G + J + `${t}
450
+ var ne = "#version 300 es\n\nin vec2 aPosition;\nout vec2 vUv;\n\nvoid main() {\n vUv = 0.5 * (aPosition + 1.0);\n gl_Position = vec4(aPosition, 0.0, 1.0);\n}", re = "// --- SDF ---\n\nfloat sdCircle(vec2 p, vec2 center, float radius) {\n return length(p - center) - radius;\n}\n\n// AX.W15 — the VALUE+GRADIENT circle: returns vec3(d, dd/dx, dd/dy). The circle\n// gradient is the UNIT radial direction (p - center)/length(p - center) (the\n// eikonal property holds EXACTLY for a circle), guarded at the degenerate centre.\n// This is the keystone of the analytic-gradient smin: carrying the gradient\n// through the scene field DELETES the per-pixel 4-tap normal (4 full sceneDist\n// evals, each running 3-octave FBM + the sat/trail loops).\nvec3 sdgCircle(vec2 p, vec2 center, float radius) {\n vec2 d = p - center;\n float len = length(d);\n vec2 grad = len > 1e-6 ? d / len : vec2(0.0, 1.0);\n return vec3(len - radius, grad);\n}\n\n// IQ 2024 quadratic-polynomial smin, NORMALIZED so k is a blend band in distance\n// units. The k *= 4.0 pre-scale makes the h*h*k*0.25 poly's effective blend width\n// equal to k (the un-normalized form's width was 0.25*k).\nfloat sminQuadratic(float a, float b, float k) {\n k *= 4.0;\n float h = max(k - abs(a - b), 0.0) / k;\n return min(a, b) - h * h * k * 0.25;\n}\n\n// IQ circular smin — a quarter-circle fillet at the seam (rounder than the\n// quadratic). The k *= 1.0/(1.0-sqrt(0.5)) factor normalizes k to the same\n// blend-band units so the merge axis swaps shape without re-tuning uSmoothK.\nfloat sminCircular(float a, float b, float k) {\n k *= 1.0 / (1.0 - sqrt(0.5));\n float h = max(k - abs(a - b), 0.0) / k;\n return min(a, b) - k * 0.5 * (1.0 + h - sqrt(1.0 - h * (h - 2.0)));\n}\n\n// Config-gated merge dispatch — uMerge 0 = quadratic, 1 = circular.\nfloat smin(float a, float b, float k) {\n if (uMerge > 0.5) return sminCircular(a, b, k);\n return sminQuadratic(a, b, k);\n}\n\n// AX.W15 — the VALUE+GRADIENT smin. a/b are vec3(dist, grad.xy); the blended\n// gradient is mix(a.yz, b.yz, w) with the interpolation weight w the distance\n// blend uses (IQ's vec2-smin insight). This propagates the analytic gradient\n// through the merge so the surface normal reads the field gradient DIRECTLY — no\n// finite-difference tap. The blend weight matches each variant.\nvec3 sminQuadraticG(vec3 a, vec3 b, float k) {\n k *= 4.0;\n float h = max(k - abs(a.x - b.x), 0.0) / k;\n float m = h * h * k * 0.25;\n // h-weight that selects which surface dominates (0 → a, 1 → b).\n float w = (a.x < b.x) ? 0.5 * h * h : 1.0 - 0.5 * h * h;\n float dist = min(a.x, b.x) - m;\n vec2 grad = mix(a.yz, b.yz, w);\n return vec3(dist, grad);\n}\n\nvec3 sminCircularG(vec3 a, vec3 b, float k) {\n k *= 1.0 / (1.0 - sqrt(0.5));\n float h = max(k - abs(a.x - b.x), 0.0) / k;\n float m = k * 0.5 * (1.0 + h - sqrt(1.0 - h * (h - 2.0)));\n float w = (a.x < b.x) ? 0.5 * h : 1.0 - 0.5 * h;\n float dist = min(a.x, b.x) - m;\n vec2 grad = mix(a.yz, b.yz, w);\n return vec3(dist, grad);\n}\n\nvec3 sminG(vec3 a, vec3 b, float k) {\n if (uMerge > 0.5) return sminCircularG(a, b, k);\n return sminQuadraticG(a, b, k);\n}", ie = "// --- Noise ---\n\nfloat hash21(vec2 p) {\n vec3 p3 = fract(vec3(p.xyx) * 0.1031);\n p3 += dot(p3, p3.yzx + 33.33);\n return fract((p3.x + p3.y) * p3.z);\n}\n\n// IQ analytic-derivative gradient noise — value in .x, ANALYTIC gradient\n// (d/dx, d/dy) in .yz, from one eval. The quintic fade has a continuous 2nd\n// derivative so the gradient is smooth (a cubic smoothstep fade would crease it).\n// (Inigo Quilez, https://iquilezles.org/articles/gradientnoise/.)\nvec3 noised(vec2 p) {\n vec2 i = floor(p);\n vec2 f = fract(p);\n\n // Quintic fade + its derivative.\n vec2 u = f * f * f * (f * (f * 6.0 - 15.0) + 10.0);\n vec2 du = 30.0 * f * f * (f * (f - 2.0) + 1.0);\n\n // Per-corner gradient vectors from the hash (centred to [-1, 1]).\n vec2 ga = -1.0 + 2.0 * vec2(hash21(i + vec2(0.0, 0.0)), hash21(i + vec2(7.3, 0.0)));\n vec2 gb = -1.0 + 2.0 * vec2(hash21(i + vec2(1.0, 0.0)), hash21(i + vec2(8.3, 0.0)));\n vec2 gc = -1.0 + 2.0 * vec2(hash21(i + vec2(0.0, 1.0)), hash21(i + vec2(7.3, 1.0)));\n vec2 gd = -1.0 + 2.0 * vec2(hash21(i + vec2(1.0, 1.0)), hash21(i + vec2(8.3, 1.0)));\n\n float va = dot(ga, f - vec2(0.0, 0.0));\n float vb = dot(gb, f - vec2(1.0, 0.0));\n float vc = dot(gc, f - vec2(0.0, 1.0));\n float vd = dot(gd, f - vec2(1.0, 1.0));\n\n // Value, remapped to [0,1] so it drops in for the prior valueNoise.\n float n = va + u.x * (vb - va) + u.y * (vc - va) + u.x * u.y * (va - vb - vc + vd);\n float value = 0.5 + 0.5 * n;\n\n // Analytic gradient (chain rule through the bilinear blend + the fade).\n vec2 grad =\n ga + u.x * (gb - ga) + u.y * (gc - ga) + u.x * u.y * (ga - gb - gc + gd) +\n du * (vec2(u.y, u.x) * (va - vb - vc + vd) + vec2(vb, vc) - va);\n return vec3(value, 0.5 * grad);\n}\n\n// Rotated-octave FBM over the analytic gradient noise: a fixed ~0.5 rad 2x2\n// rotation between octaves breaks the axis-aligned banding. The rotation CONSTANT\n// is spliced from the shared chunk (AV.W2 — the one FBM_ROT); the loops below\n// stay blob-local (param octaves + the LIQUID lacunarity/persistence, per §3a).", J = 1.8, Y = .42, ae = `float fbm(vec2 p, int octaves) {
451
+ float value = 0.0;
452
+ float amp = 0.5;
453
+ float freq = 1.0;
454
+ for (int i = 0; i < 4; i++) {
455
+ if (i >= octaves) break;
456
+ value += amp * noised(p * freq).x;
457
+ p = FBM_ROT * p;
458
+ freq *= ${J.toFixed(1)};
459
+ amp *= ${Y.toFixed(2)};
460
+ }
461
+ return value;
462
+ }
352
463
 
353
- ` + K + J + W + J + `
464
+ // AX.W15 — FBM with ANALYTIC GRADIENT. Returns vec3(value, ∂/∂x, ∂/∂y). The
465
+ // gradient accumulates noised()'s analytic gradient per octave, chain-ruled
466
+ // through the per-octave frequency scale AND the FBM_ROT rotation: octave i samples
467
+ // at R^i · (freq·p), so the gradient w.r.t. the ORIGINAL p picks up freq and
468
+ // the accumulated rotation transpose (R^T)^i. The keystone feed for the
469
+ // analytic surface normal — it DELETES the per-pixel 4-tap finite difference.
470
+ vec3 fbmG(vec2 p, int octaves) {
471
+ float value = 0.0;
472
+ vec2 grad = vec2(0.0);
473
+ float amp = 0.5;
474
+ float freq = 1.0;
475
+ // The accumulated octave rotation R^i — its transpose maps the i-th octave's
476
+ // local gradient back into the ORIGINAL p frame. Seeded at identity (octave 0).
477
+ mat2 rotAccum = mat2(1.0, 0.0, 0.0, 1.0);
478
+ vec2 pp = p;
479
+ for (int i = 0; i < 4; i++) {
480
+ if (i >= octaves) break;
481
+ vec3 n = noised(pp * freq);
482
+ value += amp * n.x;
483
+ // d(value)/dp = amp · freq · (R^i)^T · noised.yz (the rotated chain rule).
484
+ grad += amp * freq * (transpose(rotAccum) * n.yz);
485
+ pp = FBM_ROT * pp;
486
+ freq *= ${J.toFixed(1)};
487
+ amp *= ${Y.toFixed(2)};
488
+ rotAccum = FBM_ROT * rotAccum;
489
+ }
490
+ return vec3(value, grad);
491
+ }
492
+
493
+ // One domain-warp pass with the ANALYTIC GRADIENT carried (warp-Jacobian
494
+ // APPROXIMATION per the SOTA deepening [2]: the warp is low-frequency, so the
495
+ // gradient of the OUTER fbm dominates and the warp-offset Jacobian is dropped —
496
+ // the error is sub-perceptible and full autodiff is overfit for one blob).
497
+ vec3 fbmWarpedG(vec2 p, int octaves, float warpAmp) {
498
+ if (warpAmp <= 0.0) return fbmG(p, octaves);
499
+ vec2 q = vec2(fbm(p + vec2(0.0, 0.0), octaves), fbm(p + vec2(5.2, 1.3), octaves));
500
+ return fbmG(p + warpAmp * (q - 0.5), octaves);
501
+ }
502
+ `, oe = "// Edit #4's gamut step — hue-preserving inward chroma clamp. If the linear result\n// is out of [0,1], bisect chroma toward 0 (L + h fixed) until in gamut. Preserves\n// hue exactly (only C shrinks). 16 steps resolve C to < 2^-16 of its span.\nbool inGamut(vec3 lin) {\n return all(greaterThanEqual(lin, vec3(0.0))) && all(lessThanEqual(lin, vec3(1.0)));\n}\nvec3 gamutClampOklch(vec3 lch) {\n vec3 lin = oklabToLinearSrgb(oklchToOklab(lch));\n if (inGamut(lin)) return lch;\n float lo = 0.0;\n float hi = lch.y;\n for (int i = 0; i < 16; i++) {\n float mid = 0.5 * (lo + hi);\n vec3 test = vec3(lch.x, mid, lch.z);\n if (inGamut(oklabToLinearSrgb(oklchToOklab(test)))) {\n lo = mid;\n } else {\n hi = mid;\n }\n }\n return vec3(lch.x, lo, lch.z);\n}", X = "\n", se = "#version 300 es\nprecision highp float;\n\nin vec2 vUv;\nout vec4 fragColor;\n\nuniform vec2 uResolution;\nuniform float uTime;\nuniform vec3 uBaseColor;\n\n// Multi-stop palette (W11.b) — 2-4 in-family OKLCh stops (uploaded GAMMA sRGB, like\n// uBaseColor). uStopCount <= 1 falls back to uBaseColor (the single-color default,\n// zero regression). MAX_BLOB_STOPS is a compile-time #define.\n#define MAX_BLOB_STOPS 4\nuniform int uStopCount;\nuniform vec3 uPalette[MAX_BLOB_STOPS];\n\n// Pointer\nuniform vec2 uPointer;\nuniform float uPointerActive;\nuniform float uPointerAttraction;\nuniform float uPointerStrength;\n\n// Main body\nuniform float uBodyRadius;\n\n// Pulsation\nuniform float uPulsePhase;\nuniform float uPulseAmp;\n\n// Surface noise\nuniform float uNoiseAmp;\nuniform float uNoiseFreq;\nuniform float uNoiseSpeed;\n\n// Gooey\nuniform float uSmoothK;\nuniform float uMerge; // 0 = quadratic smin, 1 = circular smin (rounder menisci)\n\n// AX.W16 (arm 5) — the PRE-FBM bounding-discard radius (UV space). main() early-outs\n// to a transparent write for any fragment OUTSIDE this radius BEFORE the two 3-octave\n// FBM calls + the OKLCh round-trip. The renderer uploads it PADDED by every\n// outward-expanding term (body + eccentric orbit + sat radius + smin band + FBM edge\n// amplitude + click-pulse + a lean/squash safety pad) so it NEVER clips the wet\n// meniscus (IQ: inflate the bound to match any outward op).\nuniform float uMaxReach;\n\n// Membrane — domain-warp strength on the FBM edge displacement (0 = plain fbm).\nuniform float uWarpAmp;\n\n// Lit glass surface (W9.b) — gated behind uLit so the flat fill stays default.\nuniform float uLit; // 0 = flat fill (default), 1 = lit droplet\nuniform vec3 uRimColor; // Fresnel rim tint (GAMMA sRGB, via ColorResolver)\nuniform vec3 uLightDir; // normalized light direction (x, y, z)\nuniform float uSpecStrength; // Blinn-Phong specular weight\nuniform float uSpecShininess; // specular exponent (16-64, tight glint)\nuniform float uRimPower; // Fresnel/Schlick exponent (~2-3)\nuniform float uRimStrength; // Fresnel rim weight\n\n// Iridescence + fake subsurface (W11.a) — translucent-gel read.\nuniform float uIridescence; // warm-pearl rim sheen weight (0 = off)\nuniform float uIridHue; // base hue (radians) the cosine palette biases toward (warm)\nuniform float uIridSpeed; // animated-thickness scroll for the iridescent t\nuniform float uSssScale; // fast-SSS back-light weight\nuniform float uSssPower; // fast-SSS exponent\nuniform float uCoreGlow; // thickness-driven inner-luminosity lift\n\n// Color perturbation (perceptually uniform — OKLCh L/C/h)\nuniform float uHueRange; // degrees of hue swing (converted to radians)\nuniform float uSatShift; // OKLCh chroma swing\nuniform float uBrightnessShift; // OKLCh lightness bias\nuniform float uColorNoiseFreq;\nuniform float uColorNoiseSpeed;\n\n// Satellites (max 4)\n#define MAX_SATS 4\nuniform int uSatCount;\nuniform vec2 uSatPos[MAX_SATS];\nuniform float uSatRadius[MAX_SATS];\nuniform float uSatOpacity[MAX_SATS];\n\n// Pointer trail (W10) — a decaying-radius pseudopod toward the cursor. uTrail is a\n// COMPILE-TIME-SIZED array (GLSL ES 3.00 forbids a uniform-sized array) with a\n// DYNAMIC break on uTrailCount, mirroring the satellite loop. Later samples paint\n// smaller metaballs (r *= 1 - i/N) so the trail tapers into a tail.\n#define TRAIL_N 15\nuniform int uTrailCount;\nuniform vec2 uTrailPos[TRAIL_N];\nuniform float uTrailRadius[TRAIL_N];\n\n// Velocity-driven volume-preserving squash-and-stretch (W10).\nuniform vec2 uVelocity; // smoothed pointer velocity (motion direction + speed)\nuniform float uStretch; // squash-stretch magnitude (0 = off)\n\nconst float PI = 3.141592653589793;\n\n" + ie + X + `${s}
503
+
504
+ ` + ae + X + re + X + `
354
505
  // --- Color (Ottosson OKLab/OKLCh — value.js EXACT constants, transposed) ---
355
506
  //
356
507
  // The OETF (srgbToLinear/linearToSrgb) + the four Ottosson matrices + their space
@@ -359,51 +510,40 @@ var te = "#version 300 es\n\nin vec2 aPosition;\nout vec2 vUv;\n\nvoid main() {\
359
510
  // ONCE so the OETF can never diverge from aurora's; the line-for-line TS port
360
511
  // (__tests__/metaball-color.glsl-port.ts) mirrors that chunk. The gamut-clamp
361
512
  // below stays blob-local (aurora has no in-shader OKLCh path).
362
- ${i}
363
- ${o}
513
+ ${r}
514
+ ${n}
364
515
 
365
- ` + q + J + "\nvoid main() {\n vec2 uv = vUv - 0.5;\n\n // Pointer deformation\n if (uPointerActive > 0.5) {\n vec2 pointerDir = uPointer - uv;\n float pointerDist = length(pointerDir);\n float influence = smoothstep(0.4, 0.0, pointerDist) * uPointerAttraction * uPointerStrength;\n uv -= normalize(pointerDir + 1e-6) * influence;\n }\n\n // Main body with pulsation\n float bodyR = uBodyRadius + sin(uPulsePhase) * uPulseAmp;\n\n // FBM displacement for organic watercolor edge\n float noiseVal = fbm(uv * uNoiseFreq + uTime * uNoiseSpeed, 3);\n float bodyDisplacement = (noiseVal - 0.5) * uNoiseAmp;\n\n float d = sdCircle(uv, vec2(0.0), bodyR + bodyDisplacement);\n\n // Satellites\n for (int i = 0; i < MAX_SATS; i++) {\n if (i >= uSatCount) break;\n float satD = sdCircle(uv, uSatPos[i], uSatRadius[i]);\n satD += (1.0 - uSatOpacity[i]) * 0.3;\n d = smin(d, satD, uSmoothK);\n }\n\n // Edit #1 — fwidth-based anti-aliased edge: derive the smoothstep half-width\n // from the SDF screen-space gradient so the edge stays ~1px regardless of zoom.\n float aa = max(fwidth(d), 1e-6);\n float alpha = 1.0 - smoothstep(-aa, aa, d);\n\n if (alpha < 0.001) {\n fragColor = vec4(0.0);\n return;\n }\n\n // Edit #4 — perceptually-uniform OKLCh variation. Gamma base → linear → OKLab\n // → OKLCh; perturb L/C/h; OKLCh → OKLab → linear; hue-preserving gamut clamp.\n vec3 oklch = oklabToOklch(srgbToOklab(uBaseColor));\n\n float colorNoise = fbm(uv * uColorNoiseFreq + uTime * uColorNoiseSpeed, 3);\n oklch.z += (colorNoise - 0.5) * uHueRange * (PI / 180.0); // hue swing, radians\n oklch.y = max(oklch.y + (colorNoise - 0.5) * uSatShift, 0.0); // chroma swing\n oklch.x = clamp(oklch.x + uBrightnessShift, 0.0, 1.0); // lightness bias\n\n // Subtle inner glow near the edge — lifts OKLCh lightness inward.\n float edgeGlow = smoothstep(0.0, -bodyR * 0.6, d);\n oklch.x = mix(oklch.x, min(oklch.x + 0.06, 1.0), 1.0 - edgeGlow);\n\n oklch = gamutClampOklch(oklch);\n\n vec3 lin = oklabToLinearSrgb(oklchToOklab(oklch));\n vec3 rgb = clamp(linearToSrgb(lin), 0.0, 1.0); // MANDATORY OETF — closes the seam\n\n // Edit #8 — premultiply AFTER the OETF: straight-alpha gamma → premultiplied.\n fragColor = vec4(rgb * alpha, alpha);\n}", X = 4, Z = "[GooBlob]", Q = 1 / 1.6, ne = [
366
- "uResolution",
367
- "uTime",
368
- "uBaseColor",
369
- "uPointer",
370
- "uPointerActive",
371
- "uPointerAttraction",
372
- "uPointerStrength",
373
- "uBodyRadius",
374
- "uPulsePhase",
375
- "uPulseAmp",
376
- "uNoiseAmp",
377
- "uNoiseFreq",
378
- "uNoiseSpeed",
379
- "uSmoothK",
380
- "uHueRange",
381
- "uSatShift",
382
- "uBrightnessShift",
383
- "uColorNoiseFreq",
384
- "uColorNoiseSpeed",
385
- "uSatCount"
386
- ];
387
- function $(e) {
388
- let { canvasRef: t, color: i, mood: o, pointer: l, satellites: u, config: d, colorResolver: f } = e;
389
- if (typeof f != "function") throw Error("[GooBlob] a `colorResolver` is required. Pass `defaultBlobColorResolver` from `@mkbabb/glass-ui/color` (or your own `ColorResolver`) — the blob resolves its base CSS color through this seam and will not paint without it.");
390
- let p = 0, m = /* @__PURE__ */ new Map();
391
- function h(e) {
392
- let t = m.get(e);
516
+ ` + oe + X + "\n// AX.W15 — de-synced breath. The body throb was a single sin(uPulsePhase) — a\n// mechanical pulse that re-syncs every cycle. Three DETUNED sines at IRRATIONAL\n// frequency ratios (1, 0.13/0.09 ≈ 1.444, 0.31) never re-phase, so the membrane\n// breathes like a living creature (an asymmetric slower-exhale calm band) rather\n// than a metronome. Normalized so the composite stays in ~[-1, 1].\nfloat breath(float phase) {\n return (sin(phase)\n + 0.5 * sin(phase * 1.4444 + 1.7)\n + 0.28 * sin(phase * 0.31 + 4.1)) / 1.78;\n}\n\n// AX.W15 — the composite SDF field WITH its ANALYTIC GRADIENT, returned as\n// vec3(dist, ∂d/∂x, ∂d/∂y). The domain-warped body membrane smin-merged with the\n// satellites + trail; the gradient propagates through sminG's mix(a.yz, b.yz, h)\n// so the surface normal reads the field gradient DIRECTLY (the 4-tap finite\n// difference is DELETED — its 4 full evals per lit pixel are gone).\n//\n// The ANISOTROPIC SQUASH (W10 volume-preserving stretch) is a linear map\n// bodyUv = D·R·uv (R rotates world→(motion-axis, perp); D = diag(1/sa, sa)). The\n// body field's gradient is computed in bodyUv space, so it MUST be transformed back\n// to uv space by M^T = R^T·D (the inverse-transpose handling the SOTA-deepening [2]\n// warns the 4-tap did implicitly by sampling in screen space).\nvec3 sceneDistG(vec2 uv) {\n // De-synced pulsing body radius.\n float bodyR = uBodyRadius + breath(uPulsePhase) * uPulseAmp;\n\n // Velocity-driven VOLUME-PRESERVING squash-and-stretch (W10). sa = 1 + |v|·k\n // along motion, EXACTLY 1/sa perpendicular (area-preserving). The basis (ax,\n // perp) is captured so the gradient can be transformed back below.\n vec2 bodyUv = uv;\n vec2 ax = vec2(1.0, 0.0);\n vec2 perp = vec2(0.0, 1.0);\n float sa = 1.0;\n float speed = length(uVelocity);\n bool squashed = uStretch > 0.0 && speed > 1e-4;\n if (squashed) {\n ax = uVelocity / speed;\n perp = vec2(-ax.y, ax.x);\n sa = 1.0 + speed * uStretch;\n bodyUv = vec2(dot(uv, ax) / sa, dot(uv, perp) * sa);\n }\n\n // Domain-warped FBM displacement WITH its analytic gradient (the warp-Jacobian\n // approximation per [2]). disp = (noiseVal - 0.5) · uNoiseAmp; its gradient in\n // bodyUv space is uNoiseAmp · uNoiseFreq · fbmGrad (the uNoiseFreq chain factor\n // from the bodyUv·uNoiseFreq argument).\n vec3 fbmv = fbmWarpedG(bodyUv * uNoiseFreq + uTime * uNoiseSpeed, 3, uWarpAmp);\n float bodyDisplacement = (fbmv.x - 0.5) * uNoiseAmp;\n vec2 dispGradBody = uNoiseAmp * uNoiseFreq * fbmv.yz;\n\n // Body circle WITH gradient (in bodyUv space). The displaced radius subtracts\n // the displacement, so the body gradient is circleGrad - dispGrad (sign per\n // [2]: d = circleDist - displacement ⇒ grad = circleGrad - dispGrad).\n vec3 bodyG = sdgCircle(bodyUv, vec2(0.0), bodyR + bodyDisplacement);\n vec2 bodyGradBody = bodyG.yz - dispGradBody;\n\n // Transform the body gradient back to uv space: g_uv = R^T · D · g_body, i.e.\n // scale by D = diag(1/sa, sa) in the (ax, perp) frame then reconstruct in world.\n vec2 bodyGradUv;\n if (squashed) {\n vec2 scaled = vec2(bodyGradBody.x / sa, bodyGradBody.y * sa);\n bodyGradUv = scaled.x * ax + scaled.y * perp;\n } else {\n bodyGradUv = bodyGradBody;\n }\n vec3 d = vec3(bodyG.x, bodyGradUv);\n\n // Satellites — smin-merged into the body (uMerge selects quadratic/circular).\n for (int i = 0; i < MAX_SATS; i++) {\n if (i >= uSatCount) break;\n vec3 satG = sdgCircle(uv, uSatPos[i], uSatRadius[i]);\n satG.x += (1.0 - uSatOpacity[i]) * 0.3;\n d = sminG(d, satG, uSmoothK);\n }\n\n // Pointer trail — a decaying-radius pseudopod reaching toward the cursor,\n // smin-merged so it stretches an elastic limb and snaps back.\n for (int i = 0; i < TRAIL_N; i++) {\n if (i >= uTrailCount) break;\n vec3 trailG = sdgCircle(uv, uTrailPos[i], uTrailRadius[i]);\n d = sminG(d, trailG, uSmoothK);\n }\n return d;\n}\n\n// AX.W15 — the analytic surface normal. The field gradient grad2d arrives\n// DIRECTLY from sceneDistG (no 4-tap). The smin field is sub-unit (the CD family\n// |grad| ≤ 1) so the gradient is NOT unit-length — normalize() before the dome\n// lift (the unit contract is on the FINAL lifted normal N, not the raw field\n// gradient). The Z dome: 'interior' is the normalized depth inward from the rim\n// (-d/bodyR); z = sqrt(1 - (1 - interior)^2) is the unit half-sphere profile (flat\n// centre, steep rim). N tilts outward along the field gradient near the rim and\n// points at the viewer deep inside.\nvec3 surfaceNormalFromGrad(vec2 grad2d, float d, float bodyR) {\n vec2 g = normalize(grad2d + vec2(1e-6));\n float interior = clamp(-d / max(bodyR, 1e-4), 0.0, 1.0);\n float z = sqrt(max(0.0, 1.0 - (1.0 - interior) * (1.0 - interior)));\n return normalize(vec3(g * (1.0 - z), z) + vec3(0.0, 0.0, 1e-6));\n}\n\n// W11.b — sample the multi-stop palette at t in [0,1], interpolating adjacent\n// stops in OKLab with a MIDPOINT CHROMA-BUMP (a linear OKLab mix of a vivid pair\n// dips chroma through grey; the bump lifts it back). Falls back to uBaseColor when\n// uStopCount <= 1. Returns an OKLCh stop [L, C, h(rad)].\nvec3 samplePaletteOklch(float t) {\n if (uStopCount <= 1) return oklabToOklch(srgbToOklab(uBaseColor));\n float n = float(uStopCount);\n float ft = clamp(t, 0.0, 1.0) * (n - 1.0);\n int i0 = int(floor(ft));\n int i1 = min(i0 + 1, uStopCount - 1);\n float f = ft - float(i0);\n // Fetch adjacent stops (uPalette is gamma sRGB) → OKLab.\n vec3 labA = srgbToOklab(uPalette[i0]);\n vec3 labB = srgbToOklab(uPalette[i1]);\n vec3 lab = mix(labA, labB, f);\n vec3 lch = oklabToOklch(lab);\n // Midpoint chroma-bump: a bell (peaks at f=0.5) lifts C off the grey midpoint.\n lch.y += 0.03 * sin(PI * f);\n return lch;\n}\n\nvoid main() {\n vec2 uv = vUv - 0.5;\n\n // AX.W16 (arm 5) — PRE-FBM bounding early-out. The oversized canvas (1.6x the\n // wrapper) runs the full fragment ALU — two 3-octave FBM evals + the OKLCh\n // round-trip + the lit/iridescence/SSS block — on a large transparent border\n // otherwise (~60% of the canvas is outside the droplet reach). Any fragment beyond\n // uMaxReach (the PADDED worst-case painted reach, uploaded so it never clips the\n // wet meniscus) writes transparent and returns BEFORE any of that work. This is a\n // transparent WRITE, NOT a GLSL discard: the pass is a pure premultiplied blend\n // with no depth, and discard disables the tiled-renderer fast path on mobile GPUs.\n // No fwidth is computed before the return, so there is no\n // derivative-in-non-uniform-control-flow hazard (the kept pixels compute their own\n // fwidth normally below). The pad covers the pointer-lean uv shift, so testing the\n // pre-deform uv is safe.\n if (dot(uv, uv) > uMaxReach * uMaxReach) {\n fragColor = vec4(0.0);\n return;\n }\n\n // Pointer deformation — honor the SIGN of uPointerAttraction (W10): a positive\n // attraction leans the body IN toward the cursor, a negative shies it AWAY. The\n // signed influence flows straight into the UV shift (no hardcoded repulsion).\n //\n // AX.W15 REDRESS — the falloff radius WIDENS 0.4 to 0.65. The flick lands the\n // pointer at ~0.32 uv from the body centre; with the old 0.4 cutoff the body sat\n // deep in the dead smoothstep tail (~0.10 weight), so even a strong strength left\n // a sub-floor centroid shift (the live 0.0011 vs the 0.012 gate). 0.65 reaches the\n // whole creature coherently — the body, satellites and trail all tilt toward the\n // cursor as one — so the lean READS. Paired with pointerStrength 0.45 (types.ts).\n if (uPointerActive > 0.5) {\n vec2 pointerDir = uPointer - uv;\n float pointerDist = length(pointerDir);\n float influence = smoothstep(0.65, 0.0, pointerDist) * uPointerAttraction * uPointerStrength;\n uv -= normalize(pointerDir + 1e-6) * influence;\n }\n\n // The de-synced pulsing body radius — also reused below for the inner-glow scale.\n float bodyR = uBodyRadius + breath(uPulsePhase) * uPulseAmp;\n\n // Composite domain-warped membrane field WITH its analytic gradient (AX.W15).\n vec3 scene = sceneDistG(uv);\n float d = scene.x;\n vec2 fieldGrad = scene.yz;\n\n // Edit #1 — fwidth-based anti-aliased edge: derive the smoothstep half-width\n // from the SDF screen-space gradient so the edge stays ~1px regardless of zoom.\n float aa = max(fwidth(d), 1e-6);\n float alpha = 1.0 - smoothstep(-aa, aa, d);\n\n if (alpha < 0.001) {\n fragColor = vec4(0.0);\n return;\n }\n\n // Edit #4 — perceptually-uniform OKLCh variation. Gamma base → linear → OKLab\n // → OKLCh; perturb L/C/h; OKLCh → OKLab → linear; hue-preserving gamut clamp.\n // The base is the multi-stop palette sample (W11.b) — distributed across the\n // body/satellites by the color noise field — or uBaseColor when single-stop.\n float colorNoise = fbm(uv * uColorNoiseFreq + uTime * uColorNoiseSpeed, 3);\n vec3 oklch = samplePaletteOklch(colorNoise);\n\n oklch.z += (colorNoise - 0.5) * uHueRange * (PI / 180.0); // hue swing, radians\n oklch.y = max(oklch.y + (colorNoise - 0.5) * uSatShift, 0.0); // chroma swing\n oklch.x = clamp(oklch.x + uBrightnessShift, 0.0, 1.0); // lightness bias\n\n // Surface normal — from the ANALYTIC field gradient (AX.W15: the 4-tap is\n // deleted). Computed ONCE here and reused by the iridescence (W11.a), the\n // fake-SSS (W11.a), and the lit glass block (W9.b).\n vec3 N = surfaceNormalFromGrad(fieldGrad, d, bodyR);\n vec3 V = vec3(0.0, 0.0, 1.0);\n float thickness = clamp(-d / max(bodyR, 1e-4), 0.0, 1.0); // 0 at rim, ~1 deep in\n float fres = pow(1.0 - max(dot(N, V), 0.0), 2.5); // rim-weighted angle\n\n // ── W11.a iridescence — warm-biased IQ cosine palette driving OKLCh HUE ──\n //\n // A thin-film-like sheen on the RIM (fres-weighted), NOT the cold-blue default:\n // an IQ cosine palette (a + b*cos(2pi(c*t + d))) maps the Fresnel/edge angle +\n // the FBM color field + an animated thickness onto a HUE OFFSET biased to the\n // warm arc (uIridHue), with the chroma clamped to a warm-pearl band so the rim\n // reads cream/gold (congruent with the warm-cream-glass identity). Mixed into\n // OKLCh BEFORE the gamut clamp. Default LOW.\n if (uIridescence > 0.0) {\n float t = fres + 0.3 * colorNoise + uTime * uIridSpeed;\n // Cosine palette in HUE space, centred on the warm uIridHue (~0.18 turn of\n // warm sweep so the sheen shimmers gold→peach, never swinging to cold blue).\n float iridHue = uIridHue + 0.18 * PI * cos(2.0 * PI * t);\n float w = fres * uIridescence; // rim-weighted blend\n oklch.z = mix(oklch.z, iridHue, w);\n // Warm-pearl chroma cap: lift chroma toward a pale-pearl band, clamped.\n oklch.y = min(oklch.y + 0.04 * w, oklch.y + 0.08);\n oklch.x = min(oklch.x + 0.05 * w, 1.0); // a touch brighter at the sheen\n }\n\n // ── W11.a fake subsurface translucency — thickness inner-glow + back-light ──\n //\n // A bright translucent CORE fading to a light-leaking EDGE (the -d ramp) plus\n // the fast-SSS back-light (light wrapping through the thin rim). Both lift OKLCh\n // L and warm the hue, consuming the W9 normal. In OKLCh before the gamut clamp.\n if (uCoreGlow > 0.0 || uSssScale > 0.0) {\n // Beer-Lambert inner luminosity (AX.W15): a SATURATING 1 - exp(-k·thickness)\n // curve — a flat thick core with a fast warm rim falloff — NOT the linear\n // coreGlow·thickness ramp (which over-brightens deep interiors). k ≈ 3 reads\n // as glass depth.\n oklch.x = min(oklch.x + uCoreGlow * (1.0 - exp(-3.0 * thickness)), 1.0);\n // Fast-SSS back-light: light wrapping through the thin (low-thickness) rim.\n vec3 L = normalize(uLightDir + vec3(1e-6));\n float back = pow(clamp(dot(V, -(L + N * thickness)), 0.0, 1.0), uSssPower);\n float sss = back * uSssScale * (1.0 - thickness);\n oklch.x = min(oklch.x + sss, 1.0);\n // Warm the THIN leaking rim only (scale by 1 - thickness): the SSS hue-warm\n // shift rides the rim, not the core (AX.W15 — only the thin rim warms).\n oklch.z += sss * 0.1 * (1.0 - thickness);\n }\n\n oklch = gamutClampOklch(oklch);\n\n vec3 lin = oklabToLinearSrgb(oklchToOklab(oklch));\n\n // ── W9.b lit glass surface — Blinn-Phong glint + Fresnel rim, in LINEAR ──\n //\n // The lit terms enter lin in LINEAR space BEFORE the OETF (linearToSrgb)\n // and BEFORE the * alpha premultiply — a post-OETF apply double-gammas the\n // highlight and fringes the premultiplied edge (the named A5/A2 trap). The\n // prior flat inner-glow lift is SUBSUMED by the Fresnel rim (the curvature\n // read now comes from the surface normal, not a flat smoothstep). Gated behind\n // uLit so the flat fill stays the default (zero regression).\n if (uLit > 0.5) {\n // N, V, thickness are already computed in main() (reused by iridescence/SSS).\n vec3 L = normalize(uLightDir + vec3(1e-6)); // light direction\n vec3 H = normalize(L + V); // Blinn-Phong half-vector\n\n // Warm-cream specular glint — a near-white OKLCh TINT (L~0.97, C~0.03,\n // hue~85°) routed through the SAME spliced OKLCh matrices, NOT hardcoded\n // sRGB white (pure white reads cheap-CG). Linearized for the linear add.\n vec3 warmCream = oklabToLinearSrgb(oklchToOklab(vec3(0.97, 0.03, radians(85.0))));\n\n // ENERGY-CONSERVING Blinn-Phong (AX.W15 [9]): the (shininess+2)/8 factor\n // DECOUPLES shininess from strength (without it, raising shininess dims the\n // glint, so the two knobs fight). SPECULAR ANTIALIASING: the FBM membrane\n // makes the normal vary fast, so a tight glint (16-64) STROBES on small\n // dock-grid blobs. Widen the effective lobe where the normal varies\n // (Toksvig-style fwidth clamp) — drop shininess, NOT raise it. nVar reads\n // the screen-space normal derivative; a high-variance pixel softens the\n // exponent so the glint stays stable.\n float nVar = length(fwidth(N));\n float shininess = uSpecShininess / (1.0 + 24.0 * nVar);\n float energyNorm = (shininess + 2.0) / 8.0;\n float spec = pow(max(dot(N, H), 0.0), shininess) * uSpecStrength * energyNorm;\n\n // Fresnel/Schlick rim — fed uRimColor (the --foreground warm rim via the\n // injected ColorResolver). FOREGROUND-AWARE MIN-CONTRAST GUARD (AX.W15 [10]):\n // a var(--primary) blob in dark mode resolves a rim near the BODY color, so\n // the rim washes out (no contrast). When the rim's luminance sits too close\n // to the body's, the guard CHROMA-REDUCES and L-LIFTS the rim stop (a\n // perceptual move, NOT a re-tint) so the curved rim always reads. Computed in\n // OKLCh so the lift is perceptual.\n vec3 rimOkl = oklabToOklch(srgbToOklab(uRimColor));\n float bodyL = oklch.x; // the post-perturb body lightness\n float dL = abs(rimOkl.x - bodyL);\n // If the rim is within 0.22 L of the body, push it AWAY (lift if the body is\n // dark, the dark-mode primary case; the chroma-reduce keeps it neutral-warm).\n float lack = clamp((0.22 - dL) / 0.22, 0.0, 1.0);\n rimOkl.x = clamp(mix(rimOkl.x, (bodyL < 0.5 ? 0.92 : 0.18), lack), 0.0, 1.0);\n rimOkl.y *= mix(1.0, 0.5, lack); // chroma-reduce toward a pale pearl\n vec3 rimLin = oklabToLinearSrgb(oklchToOklab(rimOkl));\n\n float rimFres = pow(1.0 - max(dot(N, V), 0.0), uRimPower);\n float rim = rimFres * uRimStrength * (1.0 - 0.6 * thickness);\n\n // Combine the two warm highlights and add in LINEAR. max(spec, rim*scale)\n // keeps the glint from stacking on the rim into a blown hotspot.\n vec3 highlight = max(warmCream * spec, rimLin * rim);\n lin += highlight;\n }\n\n vec3 rgb = clamp(linearToSrgb(lin), 0.0, 1.0); // MANDATORY OETF — closes the seam\n\n // IGN dither (AX.W15 [2][9]) — the low-chroma warm-cream dome BANDS on 8-bit\n // panels (visible Mach steps in the smooth L roll). Interleaved-gradient noise at\n // 1/255, applied AFTER linearToSrgb and BEFORE the *alpha premultiply (aurora\n // ships the same splice). A triangular ±0.5 LSB dither decorrelates the steps.\n float ign = fract(52.9829189 * fract(dot(gl_FragCoord.xy, vec2(0.06711056, 0.00583715))));\n rgb = clamp(rgb + (ign - 0.5) / 255.0, 0.0, 1.0);\n\n // Edit #8 — premultiply AFTER the OETF: straight-alpha gamma → premultiplied.\n fragColor = vec4(rgb * alpha, alpha);\n}", ce = 4, le = 15, Z = 4, Q = "[GooBlob]", $ = 1 / 1.6, ue = /* @__PURE__ */ "uResolution.uTime.uBaseColor.uPointer.uPointerActive.uPointerAttraction.uPointerStrength.uBodyRadius.uPulsePhase.uPulseAmp.uNoiseAmp.uNoiseFreq.uNoiseSpeed.uWarpAmp.uSmoothK.uMerge.uMaxReach.uLit.uRimColor.uLightDir.uSpecStrength.uSpecShininess.uRimPower.uRimStrength.uIridescence.uIridHue.uIridSpeed.uSssScale.uSssPower.uCoreGlow.uHueRange.uSatShift.uBrightnessShift.uColorNoiseFreq.uColorNoiseSpeed.uStopCount.uSatCount.uTrailCount.uVelocity.uStretch".split(".");
517
+ function de(e) {
518
+ let { canvasRef: t, color: n, rimColor: r, paletteStops: s, mood: u, pointer: d, satellites: f, config: p, colorResolver: m } = e;
519
+ if (typeof m != "function") throw Error("[GooBlob] a `colorResolver` is required. Pass `defaultBlobColorResolver` from `@mkbabb/glass-ui/color` (or your own `ColorResolver`) — the blob resolves its base CSS color through this seam and will not paint without it.");
520
+ let h = 0, g = 0, _ = /* @__PURE__ */ new Map();
521
+ function v(e) {
522
+ let t = _.get(e);
393
523
  if (t) return t;
394
- let n = f(e);
395
- return m.size > 256 && m.clear(), m.set(e, n), n;
524
+ let n = m(e);
525
+ return _.size > 256 && _.clear(), _.set(e, n), n;
526
+ }
527
+ let b = null, x = !1, S = null;
528
+ function C() {
529
+ S !== null && (clearTimeout(S), S = null);
530
+ }
531
+ function T(e) {
532
+ if (C(), typeof setTimeout > "u") return;
533
+ let t = Math.min(Math.max(e - g, 16), 3e4);
534
+ S = setTimeout(() => {
535
+ S = null, b?.wake();
536
+ }, t);
396
537
  }
397
- let g = null, _ = !1;
398
- c(t, {
399
- pause: () => g?.suspend("off-screen"),
400
- resume: () => g?.resume("off-screen")
538
+ l(t, {
539
+ pause: () => b?.suspend("off-screen-io"),
540
+ resume: () => b?.resume("off-screen-io")
401
541
  }, {
402
542
  rootMargin: "200px",
403
543
  pauseWhenHidden: !1
404
544
  });
405
- function y(e) {
406
- g = a(e, {
545
+ function E(e) {
546
+ b = o(e, {
407
547
  contextAttrs: {
408
548
  alpha: !0,
409
549
  premultipliedAlpha: !0,
@@ -411,12 +551,12 @@ function $(e) {
411
551
  preserveDrawingBuffer: !1
412
552
  },
413
553
  setup: (t) => {
414
- let a = s(t, t.VERTEX_SHADER, te, Z), c = s(t, t.FRAGMENT_SHADER, Y, Z), f = r(t, a, c, Z);
415
- t.useProgram(f);
416
- let m = t.createVertexArray();
417
- t.bindVertexArray(m);
418
- let g = t.createBuffer();
419
- t.bindBuffer(t.ARRAY_BUFFER, g), t.bufferData(t.ARRAY_BUFFER, new Float32Array([
554
+ let o = c(t, t.VERTEX_SHADER, ne, Q), l = c(t, t.FRAGMENT_SHADER, se, Q), m = i(t, o, l, Q);
555
+ t.useProgram(m);
556
+ let _ = t.createVertexArray();
557
+ t.bindVertexArray(_);
558
+ let y = t.createBuffer();
559
+ t.bindBuffer(t.ARRAY_BUFFER, y), t.bufferData(t.ARRAY_BUFFER, new Float32Array([
420
560
  -1,
421
561
  -1,
422
562
  1,
@@ -430,128 +570,173 @@ function $(e) {
430
570
  1,
431
571
  1
432
572
  ]), t.STATIC_DRAW);
433
- let v = t.getAttribLocation(f, "aPosition");
434
- t.enableVertexAttribArray(v), t.vertexAttribPointer(v, 2, t.FLOAT, !1, 0, 0);
435
- let y = {};
436
- for (let e of ne) y[e] = t.getUniformLocation(f, e);
437
- let b = [], x = [], S = [];
438
- for (let e = 0; e < X; e++) b.push(t.getUniformLocation(f, `uSatPos[${e}]`)), x.push(t.getUniformLocation(f, `uSatRadius[${e}]`)), S.push(t.getUniformLocation(f, `uSatOpacity[${e}]`));
573
+ let S = t.getAttribLocation(m, "aPosition");
574
+ t.enableVertexAttribArray(S), t.vertexAttribPointer(S, 2, t.FLOAT, !1, 0, 0);
575
+ let w = {};
576
+ for (let e of ue) w[e] = t.getUniformLocation(m, e);
577
+ let E = [], D = [], O = [];
578
+ for (let e = 0; e < ce; e++) E.push(t.getUniformLocation(m, `uSatPos[${e}]`)), D.push(t.getUniformLocation(m, `uSatRadius[${e}]`)), O.push(t.getUniformLocation(m, `uSatOpacity[${e}]`));
579
+ let k = [], A = [];
580
+ for (let e = 0; e < le; e++) k.push(t.getUniformLocation(m, `uTrailPos[${e}]`)), A.push(t.getUniformLocation(m, `uTrailRadius[${e}]`));
581
+ let j = [];
582
+ for (let e = 0; e < Z; e++) j.push(t.getUniformLocation(m, `uPalette[${e}]`));
439
583
  t.enable(t.BLEND), t.blendFunc(t.ONE, t.ONE_MINUS_SRC_ALPHA);
440
- function C() {
441
- let r = n(), i = e.clientWidth || d.canvasSize, a = e.clientHeight || d.canvasSize, o = Math.round(i * r), s = Math.round(a * r);
442
- (e.width !== o || e.height !== s) && (e.width = o, e.height = s), t.viewport(0, 0, o, s);
584
+ function M() {
585
+ let n = a(), r = p.quality === "half" ? .5 : 1, i = e.clientWidth || p.canvasSize, o = e.clientHeight || p.canvasSize, s = Math.max(1, Math.round(i * n * r)), c = Math.max(1, Math.round(o * n * r));
586
+ (e.width !== s || e.height !== c) && (e.width = s, e.height = c), t.viewport(0, 0, s, c);
443
587
  }
444
- function w(n) {
445
- let r = performance.now(), a = p ? (n - p) * 1e3 : 16;
446
- p = n, o.tick(a), l.tick(), u.tick(r, o.params.value);
447
- let s = o.params.value, c = h(i.value);
448
- t.useProgram(f), t.bindVertexArray(m), t.uniform2f(y.uResolution, e.width, e.height), t.uniform1f(y.uTime, n), t.uniform3f(y.uBaseColor, c[0], c[1], c[2]);
449
- let g = l.pointer.value;
450
- t.uniform2f(y.uPointer, g.x * .5 * Q, g.y * .5 * Q), t.uniform1f(y.uPointerActive, +!!l.active.value), t.uniform1f(y.uPointerAttraction, d.pointerAttraction + s.pointerAttraction), t.uniform1f(y.uPointerStrength, d.pointerStrength * Q), t.uniform1f(y.uBodyRadius, d.bodyRadius * Q), t.uniform1f(y.uPulsePhase, n * d.pulseFreq * s.pulseFreq * Math.PI * 2), t.uniform1f(y.uPulseAmp, d.pulseAmp * s.pulseAmp / .015 * Q), t.uniform1f(y.uNoiseAmp, d.noiseAmp * s.noiseAmp / .025 * Q), t.uniform1f(y.uNoiseFreq, d.noiseFreq), t.uniform1f(y.uNoiseSpeed, d.noiseSpeed), t.uniform1f(y.uSmoothK, d.smoothK * s.smoothK / .22 * Q), t.uniform1f(y.uHueRange, d.hueRange + s.hueRange), t.uniform1f(y.uSatShift, d.satShift + s.satShift), t.uniform1f(y.uBrightnessShift, d.brightnessShift + s.brightnessShift), t.uniform1f(y.uColorNoiseFreq, d.colorNoiseFreq), t.uniform1f(y.uColorNoiseSpeed, d.colorNoiseSpeed);
451
- let _ = u.sources;
452
- t.uniform1i(y.uSatCount, _.length);
453
- for (let e = 0; e < X; e++) {
454
- let n = b[e] ?? null, r = x[e] ?? null, i = S[e] ?? null, a = _[e];
455
- a ? (t.uniform2f(n, a.x * Q, a.y * Q), t.uniform1f(r, a.radius * Q), t.uniform1f(i, a.opacity)) : (t.uniform2f(n, 0, 0), t.uniform1f(r, 0), t.uniform1f(i, 0));
588
+ function N(i) {
589
+ let a = h ? (i - h) * 1e3 : 16;
590
+ h = i;
591
+ let o = Math.min(a, 50), c = b?.reducedMotion ?? !1, l = (c || x ? 0 : p.tempo) * o;
592
+ g += l, c || u.update({
593
+ pointerActive: d.active.value,
594
+ clicked: d.consumeClick(),
595
+ idleMs: d.idleMs()
596
+ }), u.tick(l), c ? d.rest() : d.tick(l), f.tick(g, u.params.value);
597
+ let y = u.params.value, S = v(n.value);
598
+ t.useProgram(m), t.bindVertexArray(_), t.uniform2f(w.uResolution, e.width, e.height), t.uniform1f(w.uTime, g / 1e3), t.uniform3f(w.uBaseColor, S[0], S[1], S[2]);
599
+ let C = s.value, T = Math.min(C.length, Z);
600
+ t.uniform1i(w.uStopCount, T);
601
+ for (let e = 0; e < Z; e++) {
602
+ let n = j[e] ?? null, r = C[e];
603
+ if (r) {
604
+ let e = v(r);
605
+ t.uniform3f(n, e[0], e[1], e[2]);
606
+ } else t.uniform3f(n, S[0], S[1], S[2]);
607
+ }
608
+ let M = d.pointer.value;
609
+ t.uniform2f(w.uPointer, M.x * .5 * $, M.y * .5 * $), t.uniform1f(w.uPointerActive, +!!d.active.value), t.uniform1f(w.uPointerAttraction, p.pointerAttraction + y.pointerAttraction), t.uniform1f(w.uPointerStrength, p.pointerStrength * $);
610
+ let N = d.velocity.value;
611
+ t.uniform2f(w.uVelocity, N.x * .5 * $, N.y * .5 * $), t.uniform1f(w.uStretch, p.stretch);
612
+ let P = d.trailSources(p.satelliteRadius * .7);
613
+ t.uniform1i(w.uTrailCount, P.count);
614
+ for (let e = 0; e < le; e++) {
615
+ let n = k[e] ?? null, r = A[e] ?? null, i = P.sources[e];
616
+ i ? (t.uniform2f(n, i.x * .5 * $, i.y * .5 * $), t.uniform1f(r, i.radius * $)) : (t.uniform2f(n, 0, 0), t.uniform1f(r, 0));
617
+ }
618
+ t.uniform1f(w.uBodyRadius, p.bodyRadius * $), t.uniform1f(w.uPulsePhase, i * p.pulseFreq * y.pulseFreq * Math.PI * 2);
619
+ let F = d.pulse.value * p.clickImpulse;
620
+ t.uniform1f(w.uPulseAmp, (p.pulseAmp * y.pulseAmp / .015 + F) * $), t.uniform1f(w.uNoiseAmp, p.noiseAmp * y.noiseAmp / .025 * $), t.uniform1f(w.uNoiseFreq, p.noiseFreq), t.uniform1f(w.uNoiseSpeed, p.noiseSpeed), t.uniform1f(w.uWarpAmp, p.warpAmp), t.uniform1f(w.uSmoothK, p.smoothK * y.smoothK * $), t.uniform1f(w.uMerge, +(p.merge === "circular"));
621
+ let I = p.orbitRadius * 1.2 * (1 + p.eccentricity) + p.satelliteRadius, L = (Math.max(p.bodyRadius, I) + p.smoothK * y.smoothK + p.noiseAmp * y.noiseAmp / .025 + Math.abs(d.pulse.value) * p.clickImpulse) * $ + .1;
622
+ t.uniform1f(w.uMaxReach, L), t.uniform1f(w.uHueRange, p.hueRange + y.hueRange), t.uniform1f(w.uSatShift, p.satShift + y.satShift), t.uniform1f(w.uBrightnessShift, p.brightnessShift + y.brightnessShift), t.uniform1f(w.uColorNoiseFreq, p.colorNoiseFreq), t.uniform1f(w.uColorNoiseSpeed, p.colorNoiseSpeed), t.uniform1f(w.uLit, +!!p.lit);
623
+ let R = v(r.value);
624
+ t.uniform3f(w.uRimColor, R[0], R[1], R[2]), t.uniform3f(w.uLightDir, p.lightDir[0], p.lightDir[1], p.lightDir[2]), t.uniform1f(w.uSpecStrength, p.specStrength), t.uniform1f(w.uSpecShininess, p.specShininess), t.uniform1f(w.uRimPower, p.rimPower), t.uniform1f(w.uRimStrength, p.rimStrength), t.uniform1f(w.uIridescence, p.iridescence * y.iridScale), t.uniform1f(w.uIridHue, p.iridHue * (Math.PI / 180)), t.uniform1f(w.uIridSpeed, p.iridSpeed), t.uniform1f(w.uSssScale, p.sssScale * y.iridScale), t.uniform1f(w.uSssPower, p.sssPower), t.uniform1f(w.uCoreGlow, p.coreGlow);
625
+ let z = f.sources;
626
+ t.uniform1i(w.uSatCount, z.length);
627
+ for (let e = 0; e < ce; e++) {
628
+ let n = E[e] ?? null, r = D[e] ?? null, i = O[e] ?? null, a = z[e];
629
+ a ? (t.uniform2f(n, a.x * $, a.y * $), t.uniform1f(r, a.radius * $), t.uniform1f(i, a.opacity)) : (t.uniform2f(n, 0, 0), t.uniform1f(r, 0), t.uniform1f(i, 0));
456
630
  }
457
631
  t.clearColor(0, 0, 0, 0), t.clear(t.COLOR_BUFFER_BIT), t.drawArrays(t.TRIANGLES, 0, 6), t.bindVertexArray(null);
458
632
  }
459
- function T() {
460
- return !_;
633
+ function P() {
634
+ if (x) return !1;
635
+ if (!u.isSettled() || !d.isAtRest() || !f.isQuiescent()) return C(), !0;
636
+ let e = f.nextEventMs(g), t = u.nextAutoMoodMs(), n = Number.isFinite(t) ? g + t : Infinity;
637
+ return T(Math.min(e, n)), !1;
461
638
  }
462
639
  return {
463
- frame: w,
464
- shouldContinue: T,
465
- resize: C,
640
+ frame: N,
641
+ shouldContinue: P,
642
+ resize: M,
466
643
  teardown: () => {
467
- t.deleteProgram(f), t.deleteShader(a), t.deleteShader(c), t.deleteBuffer(g), t.deleteVertexArray(m);
644
+ t.deleteProgram(m), t.deleteShader(o), t.deleteShader(l), t.deleteBuffer(y), t.deleteVertexArray(_);
468
645
  }
469
646
  };
470
647
  }
471
- }), g.arm();
648
+ }), b.arm();
472
649
  }
473
- return C(t, (e) => {
474
- e && !g && y(e);
475
- }, { immediate: !0 }), C(i, () => g?.wake()), v(() => {
476
- g?.dispose(), g = null;
650
+ return w(t, (e) => {
651
+ e && !b && E(e);
652
+ }, { immediate: !0 }), w(n, () => b?.wake()), y(() => {
653
+ C(), b?.dispose(), b = null;
477
654
  }), {
478
655
  pause: () => {
479
- _ = !0, g?.suspend("manual");
656
+ x = !0, b?.suspend("manual");
480
657
  },
481
658
  resume: () => {
482
- _ = !1, g?.resume("manual");
659
+ x = !1, b?.resume("manual");
483
660
  }
484
661
  };
485
662
  }
486
663
  //#endregion
487
664
  //#region src/components/custom/goo-blob/GooBlob.vue
488
- var re = /* @__PURE__ */ e(/* @__PURE__ */ m({
665
+ var fe = /* @__PURE__ */ e(/* @__PURE__ */ h({
489
666
  __name: "GooBlob",
490
667
  props: {
491
668
  color: {},
492
669
  colorResolver: { type: Function },
493
670
  config: {},
494
- seed: { default: "" }
495
- },
496
- emits: ["click"],
497
- setup(e, { expose: t, emit: n }) {
498
- let r = n, i = h(T, null), a = e.config ?? i;
499
- if (!a) throw Error("[glass-ui] GooBlob: no blob config. Pass an explicit `config` prop (e.g. BLOB_CONFIG_DEFAULTS) or provide(BLOB_CONFIG_KEY, cfg) from an ancestor. There is no silent defaults synthesis.");
500
- let o = S("canvasRef"), s = S("wrapperRef"), c = j(), l = N(s), u = U(a, e.color + e.seed), m = x(e.color);
501
- function v(e) {
502
- if (!e.includes("var(")) return e;
503
- let t = s.value;
504
- if (typeof window > "u" || !t) return e;
505
- let n = t.style.color;
506
- t.style.color = e;
507
- let r = getComputedStyle(t).color;
508
- return t.style.color = n, r || e;
671
+ seed: { default: "" },
672
+ paused: {
673
+ type: Boolean,
674
+ default: !1
509
675
  }
510
- function b() {
511
- m.value = v(e.color);
676
+ },
677
+ emits: ["click", "update:paused"],
678
+ setup(e, { expose: n, emit: r }) {
679
+ let i = r, a = g(D, null), o = e.config ?? a;
680
+ if (!o) throw Error("[glass-ui] GooBlob: no blob config. Pass an explicit `config` prop (e.g. BLOB_CONFIG_DEFAULTS) or provide(BLOB_CONFIG_KEY, cfg) from an ancestor. There is no silent defaults synthesis.");
681
+ let s = C("canvasRef"), c = C("wrapperRef"), l = R(), u = z(c), d = q(o, e.color + e.seed), h = t(), y = S(e.color), x = S(o.rimColor), T = S([...o.paletteStops]);
682
+ function E() {
683
+ let t = c.value;
684
+ h.invalidate(), y.value = h.resolve(e.color, t), x.value = h.resolve(o.rimColor, t), T.value = o.paletteStops.map((e) => h.resolve(e, t));
512
685
  }
513
- $({
514
- canvasRef: o,
515
- color: m,
516
- mood: c,
517
- pointer: l,
518
- satellites: u,
519
- config: a,
686
+ let O = de({
687
+ canvasRef: s,
688
+ color: y,
689
+ rimColor: x,
690
+ paletteStops: T,
691
+ mood: l,
692
+ pointer: u,
693
+ satellites: d,
694
+ config: o,
520
695
  colorResolver: e.colorResolver
521
- }), C(s, b, { immediate: !0 });
522
- let w = null;
523
- typeof document < "u" && (w = new MutationObserver(b), w.observe(document.documentElement, {
696
+ });
697
+ w(c, E, { immediate: !0 });
698
+ let k = null;
699
+ typeof document < "u" && (k = new MutationObserver(E), k.observe(document.documentElement, {
524
700
  attributes: !0,
525
701
  attributeFilter: ["class"]
526
- })), C(d(() => e.color), (t) => {
527
- b(), u.reseed(t + e.seed);
528
- }), _(() => {
529
- w?.disconnect(), w = null;
702
+ })), w(f(() => e.color), (t) => {
703
+ E(), d.reseed(t + e.seed);
704
+ }), w(() => e.paused, (e) => e ? O.pause() : O.resume(), { immediate: !0 }), v(() => {
705
+ k?.disconnect(), k = null;
530
706
  });
531
- function E() {
532
- u.nudge();
707
+ function A() {
708
+ d.nudge();
709
+ }
710
+ function j(e) {
711
+ l.setMood(e);
712
+ }
713
+ function M() {
714
+ u.click(o.clickImpulse);
533
715
  }
534
- function D(e) {
535
- c.setMood(e);
716
+ function N() {
717
+ M(), i("click");
536
718
  }
537
- return t({
538
- nudge: E,
539
- setMood: D,
540
- currentMood: c.currentMood
541
- }), (t, n) => (y(), f("div", {
719
+ return n({
720
+ nudge: A,
721
+ setMood: j,
722
+ pulse: M,
723
+ currentMood: l.currentMood,
724
+ pause: O.pause,
725
+ resume: O.resume
726
+ }), (t, n) => (b(), p("div", {
542
727
  ref_key: "wrapperRef",
543
- ref: s,
728
+ ref: c,
544
729
  class: "goo-blob-wrapper",
545
- style: g({ "--blob-color": e.color }),
546
- onClick: n[0] ||= (e) => r("click")
547
- }, [p("canvas", {
730
+ style: _({ "--blob-color": e.color }),
731
+ onClick: N
732
+ }, [m("canvas", {
548
733
  ref_key: "canvasRef",
549
- ref: o,
734
+ ref: s,
550
735
  class: "goo-blob-canvas",
551
736
  "aria-hidden": "true",
552
737
  "data-testid": "goo-blob-canvas"
553
738
  }, null, 512)], 4));
554
739
  }
555
- }), [["__scopeId", "data-v-bb3e5830"]]);
740
+ }), [["__scopeId", "data-v-d2901aa9"]]);
556
741
  //#endregion
557
- export { w as BLOB_CONFIG_DEFAULTS, T as BLOB_CONFIG_KEY, re as GooBlob, j as useBlobMood, N as useBlobPointer, U as useBlobSatellites, $ as useMetaballRenderer };
742
+ export { E as BLOB_CONFIG_DEFAULTS, D as BLOB_CONFIG_KEY, fe as GooBlob, R as useBlobMood, z as useBlobPointer, q as useBlobSatellites, de as useMetaballRenderer };