feat: massively expand motion module and core utilities - #94
Conversation
There was a problem hiding this comment.
Pull request overview
This PR significantly expands @bquery/bquery/motion and @bquery/bquery/core utilities with a broad set of new, additive APIs (easing presets/factories, tweens, spring vector helpers, timelines, scroll/in-view primitives, micro-interactions, and many new utility helpers), and wires them through the public barrels, /full entry, docs, changelog, and tests.
Changes:
- Adds major new motion primitives (Penner easing family + factories, rAF tweens, timeline labels/repeat/yoyo/playbackRate, scroll progress + in-view, and micro-interaction effects).
- Massively expands core utils (array/function/object/string/number/misc + type guards) and exposes them via
utils,src/core/index.ts, andsrc/full.ts. - Adds extensive test coverage plus docs and changelog updates for the new surfaces.
Reviewed changes
Copilot reviewed 36 out of 37 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/utils-type-guards-extras.test.ts | Tests for new core type-guard utilities. |
| tests/utils-string-extras.test.ts | Tests for new string utilities (case conversion, template, stripHtml, randomString, lines). |
| tests/utils-object-extras.test.ts | Tests for deep object helpers (get/set/has, deepEqual, freeze, defaults, typed keys/entries). |
| tests/utils-number-extras.test.ts | Tests for new number utilities (rounding, mapping, formatBytes, stats, angle conversion). |
| tests/utils-misc-extras.test.ts | Tests for uuid/tryCatch/times/pollUntil/nextFrame/nextTick. |
| tests/utils-function-extras.test.ts | Tests for memoize/compose/pipe/curry/partial/retry and enhanced debounce/throttle. |
| tests/utils-array-extras.test.ts | Tests for new array utilities (groupBy/keyBy/partition/zip/range/etc). |
| tests/motion-tween.test.ts | Tests for animateValue() and tween() controls (pause/seek/stop/abort/delay). |
| tests/motion-timeline-extras.test.ts | Tests for timeline extras, stagger grid/axis/random, reduced-motion subscriptions/signals. |
| tests/motion-scroll-progress.test.ts | Tests for scrollProgress() and inView() behavior and cleanup. |
| tests/motion-effects.test.ts | Tests for magnetic/tilt/shake/pulse/countUp and reduced-motion behavior. |
| tests/motion-easing.test.ts | Tests for new easing family, cubicBezier/steps, mix/chain, presets wiring. |
| src/motion/types.ts | Extends public motion types (Spring velocity/set, SpringVector, timeline labels/repeat/yoyo/progress/onUpdate, AbortSignal/playbackRate options). |
| src/motion/tween.ts | New DOM-free tweening primitives (animateValue/tween) backed by rAF with controls + abort. |
| src/motion/timeline.ts | Timeline enhancements (label parsing, repeat/yoyo, reverse/playbackRate, onUpdate loop). |
| src/motion/stagger.ts | Adds grid/axis/randomized stagger computation (seeded option). |
| src/motion/spring.ts | Adds spring velocity/set, more presets, and new springVector() helper. |
| src/motion/scroll-progress.ts | New scrollProgress() and inView() primitives with cleanup and DOM-less fallbacks. |
| src/motion/reduced-motion.ts | Adds reduced-motion change subscriptions and reducedMotionSignal() reactive adapter. |
| src/motion/index.ts | Re-exports all new motion symbols/types from the motion entry point. |
| src/motion/effects.ts | New micro-interaction effects (magnetic/tilt/shake/pulse/countUp). |
| src/motion/easing.ts | Adds full Penner easing family, cubicBezier/steps factories, mix/chain, and expanded easingPresets. |
| src/motion/animate.ts | Adds AbortSignal cancellation + playbackRate, plus new animateTo() CSS wrapper. |
| src/full.ts | Wires all new core utils + motion exports/types into the /full bundle entry. |
| src/core/utils/type-guards.ts | Adds new type guards (Error/Map/Set/RegExp/Symbol/BigInt/AsyncFunction/Iterable/etc). |
| src/core/utils/string.ts | Adds many string helpers including stripHtml/template/randomString/lines and case conversions. |
| src/core/utils/object.ts | Adds prototype-pollution-safe get/set/has and many object helpers (deepEqual/freeze/defaults/etc). |
| src/core/utils/number.ts | Adds rounding, interpolation helpers, formatBytes, stats helpers, and angle conversions. |
| src/core/utils/misc.ts | Adds uuid/tryCatch/times/pollUntil/nextFrame/nextTick helpers. |
| src/core/utils/index.ts | Expands the utils namespace and BQueryUtils interface with all new utilities. |
| src/core/utils/function.ts | Adds memoize/compose/pipe/curry/partial/retry and enhanced debounce/throttle options + flush. |
| src/core/utils/array.ts | Adds many new array helpers (groupBy/keyBy/sortBy/shuffle/etc). |
| src/core/index.ts | Re-exports all new core utilities + types from the core entry point. |
| docs/guide/motion.md | Documentation updates covering new motion APIs (tweens, timeline labels/repeat/yoyo, scroll/inView, effects, springVector, etc). |
| docs/guide/api-core.md | Documentation updates for expanded utils surface and updated debounce/throttle signatures. |
| CHANGELOG.md | Populates [Unreleased] with detailed entries for motion + utils expansions. |
| bun.lock | Updates lockfile entries for dev tooling versions. |
Agent-Logs-Url: https://github.com/bQuery/bQuery/sessions/341d3775-d78d-4c49-a871-21a72619497b Co-authored-by: JosunLP <[email protected]>
Agent-Logs-Url: https://github.com/bQuery/bQuery/sessions/341d3775-d78d-4c49-a871-21a72619497b Co-authored-by: JosunLP <[email protected]>
Agent-Logs-Url: https://github.com/bQuery/bQuery/sessions/341d3775-d78d-4c49-a871-21a72619497b Co-authored-by: JosunLP <[email protected]>
|
@copilot the tests are failing |
Agent-Logs-Url: https://github.com/bQuery/bQuery/sessions/7f985a0a-50ad-46e6-b1d7-c022f31f14ef Co-authored-by: JosunLP <[email protected]>
…n, and playbackRate Agent-Logs-Url: https://github.com/bQuery/bQuery/sessions/dce551f8-62bb-46e3-827d-36d9a97602a5 Co-authored-by: JosunLP <[email protected]>
|
@copilot tests and ssr cross runtime build are failing |
Agent-Logs-Url: https://github.com/bQuery/bQuery/sessions/287b6814-bad7-4b6a-b09a-24b73d7e9f9f Co-authored-by: JosunLP <[email protected]>
Fixed in 1228f8b. I investigated the failing Test and SSR cross-runtime runs, and both were failing on the same TypeScript error ( |
…allocate record interpolator output Agent-Logs-Url: https://github.com/bQuery/bQuery/sessions/6a54e495-6635-439a-b52c-241df04ffdb4 Co-authored-by: JosunLP <[email protected]>
Agent-Logs-Url: https://github.com/bQuery/bQuery/sessions/1c468754-fb34-4074-b8c0-cb7df9735846 Co-authored-by: JosunLP <[email protected]>
Agent-Logs-Url: https://github.com/bQuery/bQuery/sessions/d39c75c2-1e3f-47a4-be4e-70990160dfb4 Co-authored-by: JosunLP <[email protected]>
|
Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details. Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
Agent-Logs-Url: https://github.com/bQuery/bQuery/sessions/539e3b31-182a-43be-9ce1-331fbde76be7 Co-authored-by: JosunLP <[email protected]>
Agent-Logs-Url: https://github.com/bQuery/bQuery/sessions/322c05f2-0ec1-4748-a782-45339630ca35 Co-authored-by: JosunLP <[email protected]>
Agent-Logs-Url: https://github.com/bQuery/bQuery/sessions/eee78581-7919-46df-80e0-82c966e08e1a Co-authored-by: JosunLP <[email protected]>
Agent-Logs-Url: https://github.com/bQuery/bQuery/sessions/5e7d035d-0785-4f81-8240-6c59d7c36fca Co-authored-by: JosunLP <[email protected]>
…ctor subscriptions Agent-Logs-Url: https://github.com/bQuery/bQuery/sessions/37a2972e-c815-4036-847a-44a79f6ac4b2 Co-authored-by: JosunLP <[email protected]>
Expand
@bquery/bquery/motionand the core utility surface with broad additive APIs. All changes are backward-compatible; no new runtime dependencies.Motion (
@bquery/bquery/motion)cubicBezier(x1,y1,x2,y2),steps(n, position?),mix(a,b,w),chain(...easings). All registered ineasingPresets.animateValue(from,to,opts)rAF driver (numeric/array/object);tween()withpause/resume/reverse/seek/onUpdate/finished;animateTo(el, styles, opts)CSS wrapper;animate()now acceptssignal: AbortSignalandplaybackRate..velocity(v),.set(v), multi-dimensionalspringVector(dims); newwobbly/slow/molassespresets.addLabel(name, at?)and'label+=100'relative offsets;reverse(),playbackRate(),repeat(n|'infinite'),yoyo(bool),onUpdate(),progress()getter.scrollProgress,inView(promise + signal variant),magnetic,tilt,shake,pulse,countUp.grid: [columns, rows],from: { x, y }grid origins,axis: 'x' | 'y', andrandomdistance options.onReducedMotionChange(cb)subscription,reducedMotionSignal()reactive signal.Utilities (
@bquery/bquery/core)groupBy,keyBy,partition,zip,range,first,last,take,drop,sample,shuffle(Fisher–Yates),uniqueBy,sortBy(single/multi-selector),intersection,difference,flattenDeep,move,chunkBy.memoize(.clear()/.delete()),compose/pipe,curry,partial,retry(backoff + jitter +AbortSignal+shouldRetry).debounceandthrottlegain{ leading?, trailing?, maxWait? }(debounce) /{ leading?, trailing? }(throttle) plus.flush(). The existing(fn, ms)signatures keep identical behavior.get(obj, path, default?),set(obj, path, value),has(obj, path)(dot + bracket syntax, dynamic assignment viaObject.defineProperty). AddsmapValues,mapKeys,invert,deepEqual(aliasisEqual), deepfreeze,defaults, typedentriesTyped/keysTyped.toSnakeCase,toPascalCase,toTitleCase,pad/padStart/padEnd,wordCount, safetemplate(str, vars)(string substitution only, 200-char placeholder cap), DOM-free linear-scanstripHtml(not a sanitizer — use@bquery/bquery/securityfor that), crypto-backedrandomString,lines.round,roundTo,lerp,inverseLerp,mapRange,formatBytes(decimal/binary, locale-aware viaIntl.NumberFormat),randomFloat,sum,average,median,degToRad,radToDeg.uuid()(crypto.randomUUID()/getRandomValues()fast paths,Math.random()fallback), Go-style sync+asynctryCatch,times,pollUntil(timeout +AbortSignal),nextFrame,nextTick.isError,isMap,isSet,isRegExp,isSymbol,isBigInt,isAsyncFunction,isIterable,isAsyncIterable,isNullish,isDefined.BQueryUtilsinterface and theutilsnamespace include every new entry.Wiring
src/full.tsandsrc/core/index.tsre-export the new motion/core symbols/types socheck:full-bundlestays in sync.CHANGELOG.md[Unreleased]populated;docs/guide/motion.mdanddocs/guide/api-core.mdupdated.Notes / deliberate non-changes
formatNumberis not added undercore/utilsto avoid colliding with the existing@bquery/bquery/i18nexport;utils.formatBytes()accepts alocaleoption that usesIntl.NumberFormatdirectly.escapeHtmlis not duplicated — continue to import it from@bquery/bquery/security.forms.composeis not re-exported from root or/fullto avoid colliding withcore.compose; import the validator combinator from@bquery/bquery/forms.Example