@opencode/ui 0.0.0-dev-21873 → 0.0.0-dev-21876

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.
@@ -1,4 +1,4 @@
1
- import type { SpringOptions } from "motion";
1
+ import { type SpringOptions } from "@kitlangton/solid-motion";
2
2
  type Opt = Partial<Pick<SpringOptions, "visualDuration" | "bounce" | "stiffness" | "damping" | "mass" | "velocity">>;
3
- export declare function useSpring(target: () => number, options?: Opt | (() => Opt), snapKey?: () => unknown): import("solid-js").Accessor<number>;
3
+ export declare function useSpring<K>(target: () => number, options?: Opt | (() => Opt), snapKey?: () => K): import("solid-js").Accessor<number>;
4
4
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opencode/ui",
3
- "version": "0.0.0-dev-21873",
3
+ "version": "0.0.0-dev-21876",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -255,7 +255,6 @@
255
255
  "fuzzysort": "3.1.0",
256
256
  "katex": "0.16.47",
257
257
  "marked": "18.0.11",
258
- "motion": "12.34.5",
259
258
  "solid-list": "0.3.0",
260
259
  "solid-sonner": "0.3.1"
261
260
  },
@@ -1,5 +1,4 @@
1
- import { attachSpring, motionValue } from "motion"
2
- import type { SpringOptions } from "motion"
1
+ import { attachSpring, motionValue, type SpringOptions } from "@kitlangton/solid-motion"
3
2
  import { createComputed, createEffect, createSignal, onCleanup } from "solid-js"
4
3
 
5
4
  type Opt = Partial<Pick<SpringOptions, "visualDuration" | "bounce" | "stiffness" | "damping" | "mass" | "velocity">>
@@ -12,8 +11,8 @@ const eq = (a: Opt | undefined, b: Opt | undefined) =>
12
11
  a?.mass === b?.mass &&
13
12
  a?.velocity === b?.velocity
14
13
 
15
- export function useSpring(target: () => number, options?: Opt | (() => Opt), snapKey?: () => unknown) {
16
- const read = () => (typeof options === "function" ? options() : options)
14
+ export function useSpring<K>(target: () => number, options?: Opt | (() => Opt), snapKey?: () => K) {
15
+ const read = () => (options instanceof Function ? options() : options)
17
16
  const [value, setValue] = createSignal(target())
18
17
  const source = motionValue(value())
19
18
  const spring = motionValue(value())
@@ -48,7 +47,10 @@ export function useSpring(target: () => number, options?: Opt | (() => Opt), sna
48
47
  if (eq(config, next)) return
49
48
  config = next
50
49
  stop()
50
+ // attachSpring's cleanup only unsubscribes from the source; the running animation keeps ticking until stopped.
51
+ spring.stop()
51
52
  stop = attachSpring(spring, source, next)
53
+ spring.set(source.get())
52
54
  setValue(spring.get())
53
55
  })
54
56