@@ -313,17 +313,19 @@ type Ds =
313313 /// https://data-star.dev/reference/attributes#data-on-intersect
314314 /// </summary >
315315 /// <param name =" expression " >Expression to run when element is intersected</param >
316- /// <param name =" visibility " >Sets it to trigger only if the element is half or fully viewed</param >
316+ /// <param name =" visibility " >Sets it to trigger only if the element is exited, or half or fully viewed</param >
317317 /// <param name =" onlyOnce " >Only triggers the event once</param >
318318 /// <param name =" delayMs " >The time to wait before executing the expression in milliseconds; default = 0</param >
319- /// <param name =" debounce " ></param >
320- /// <param name =" throttle " ></param >
319+ /// <param name =" debounce " >Debounce the event listener </param >
320+ /// <param name =" throttle " >Throttle the event listener </param >
321321 /// <param name =" viewTransition " >Wrap expression in document.startViewTransition(); default = false</param >
322+ /// <param name =" threshold " >Triggers when the element is visible by a certain percentage (0-100)</param >
322323 /// <returns >Attribute</returns >
323- static member onIntersect ( expression , ? visibility , ? onlyOnce , ? delayMs : int , ? debounce : Debounce , ? throttle : Throttle , ? viewTransition : bool ) =
324+ static member onIntersect ( expression , ? visibility , ? onlyOnce , ? delayMs : int , ? debounce : Debounce , ? throttle : Throttle , ? viewTransition : bool , ? threshold : int ) =
324325 DsAttr.start " on-intersect"
325326 |> ( fun dsAttr ->
326327 match visibility with
328+ | Some vis when vis = IntersectsVisibility.Exit -> DsAttr.addModifierName " exit" dsAttr
327329 | Some vis when vis = IntersectsVisibility.Full -> DsAttr.addModifierName " full" dsAttr
328330 | Some vis when vis = IntersectsVisibility.Half -> DsAttr.addModifierName " half" dsAttr
329331 | _ -> dsAttr
@@ -333,6 +335,7 @@ type Ds =
333335 |> DsAttr.addModifierOption ( delayMs |> Option.toValueOption |> ValueOption.map DsAttrModifier.DelayMs)
334336 |> DsAttr.addModifierOption ( debounce |> Option.toValueOption |> ValueOption.map DsAttrModifier.Debounce)
335337 |> DsAttr.addModifierOption ( throttle |> Option.toValueOption |> ValueOption.map DsAttrModifier.Throttle)
338+ |> DsAttr.addModifierOption ( threshold |> Option.toValueOption |> ValueOption.map ( fun vv -> DsAttrModifier.Threshold ( Math.Clamp( vv, 0 , 100 ))))
336339 |> DsAttr.addValue expression
337340 |> DsAttr.create
338341
0 commit comments