refactor(toolkit): type source any with proper types

Genuinely type composable any usages (useStepper/useStorage/useForm/
createEventHook/useSorted/etc.) as proper generics/unknown; keep idiomatic
any-function and overload-impl signatures with comments; skipped test -> .todo.
This commit is contained in:
2026-06-15 16:55:07 +07:00
parent 44848bc9e6
commit aa2938cb34
283 changed files with 3505 additions and 3482 deletions
@@ -53,27 +53,27 @@ onUnmounted(stop);
</script>
<template>
<div class="w-full max-w-sm flex flex-col gap-4">
<div class="demo-stack max-w-sm">
<div class="grid grid-cols-2 gap-3">
<div class="rounded-xl border border-(--border) bg-(--bg-elevated) p-4 flex flex-col gap-1">
<span class="text-xs font-medium uppercase tracking-wide text-(--fg-subtle)">Source</span>
<span class="font-mono text-3xl font-bold tabular-nums text-(--fg)">{{ source }}</span>
<span class="text-xs text-(--fg-muted)">{{ sourceUpdates }} updates</span>
<div class="demo-card p-4 flex flex-col gap-1">
<span class="demo-label">Source</span>
<span class="demo-stat text-3xl">{{ source }}</span>
<span class="text-xs text-fg-muted">{{ sourceUpdates }} updates</span>
</div>
<div class="rounded-xl border border-(--border) bg-(--bg-elevated) p-4 flex flex-col gap-1">
<span class="text-xs font-medium uppercase tracking-wide text-(--fg-subtle)">Throttled</span>
<span class="font-mono text-3xl font-bold tabular-nums text-(--accent-text)">{{ throttled }}</span>
<span class="text-xs text-(--fg-muted)">{{ throttledUpdates }} updates</span>
<div class="demo-card p-4 flex flex-col gap-1">
<span class="demo-label">Throttled</span>
<span class="font-mono text-3xl font-bold tabular-nums text-accent-text">{{ throttled }}</span>
<span class="text-xs text-fg-muted">{{ throttledUpdates }} updates</span>
</div>
</div>
<div class="rounded-lg border border-(--border) bg-(--bg-inset) p-3 flex items-center justify-between">
<span class="text-xs font-medium uppercase tracking-wide text-(--fg-subtle)">Lag behind source</span>
<span class="font-mono text-sm tabular-nums text-(--fg)">+{{ lag }}</span>
<div class="rounded-lg border border-border bg-bg-inset p-3 flex items-center justify-between">
<span class="demo-label">Lag behind source</span>
<span class="font-mono text-sm tabular-nums text-fg">+{{ lag }}</span>
</div>
<label class="flex flex-col gap-1.5">
<span class="text-xs font-medium uppercase tracking-wide text-(--fg-subtle)">
<span class="demo-label">
Throttle window: {{ delay }}ms
</span>
<input
@@ -82,16 +82,16 @@ onUnmounted(stop);
min="100"
max="1500"
step="100"
class="w-full accent-(--accent) cursor-pointer"
class="w-full accent-accent cursor-pointer"
>
<span class="text-xs text-(--fg-subtle)">Reset to apply a new window</span>
<span class="text-xs text-fg-subtle">Reset to apply a new window</span>
</label>
<div class="flex gap-2">
<button
type="button"
:disabled="running"
class="inline-flex flex-1 items-center justify-center gap-1.5 rounded-lg border border-transparent bg-(--accent) px-3 py-1.5 text-sm font-medium text-(--accent-fg) transition hover:bg-(--accent-hover) active:scale-[0.98] cursor-pointer disabled:cursor-not-allowed disabled:opacity-40 disabled:active:scale-100"
class="demo-btn-primary flex-1 disabled:cursor-not-allowed disabled:opacity-40 disabled:active:scale-100"
@click="start"
>
Run (60ms)
@@ -99,14 +99,14 @@ onUnmounted(stop);
<button
type="button"
:disabled="!running"
class="inline-flex items-center justify-center gap-1.5 rounded-lg border border-(--border) bg-(--bg-elevated) px-3 py-1.5 text-sm font-medium text-(--fg) transition hover:bg-(--bg-inset) hover:border-(--border-strong) active:scale-[0.98] cursor-pointer disabled:cursor-not-allowed disabled:opacity-40 disabled:active:scale-100"
class="demo-btn disabled:cursor-not-allowed disabled:opacity-40 disabled:active:scale-100"
@click="stop"
>
Pause
</button>
<button
type="button"
class="inline-flex items-center justify-center gap-1.5 rounded-lg border border-(--border) bg-(--bg-elevated) px-3 py-1.5 text-sm font-medium text-(--fg) transition hover:bg-(--bg-inset) hover:border-(--border-strong) active:scale-[0.98] cursor-pointer"
class="demo-btn"
@click="reset"
>
Reset
@@ -2,7 +2,7 @@ import { ref, toValue, watch } from 'vue';
import type { MaybeRefOrGetter, Ref } from 'vue';
import { createFilterWrapper, throttleFilter } from '@/utils/filters';
export type RefThrottledReturn<T = any> = Ref<T>;
export type RefThrottledReturn<T = unknown> = Ref<T>;
/**
* @name refThrottled
@@ -28,7 +28,7 @@ export type RefThrottledReturn<T = any> = Ref<T>;
*
* @since 0.0.15
*/
export function refThrottled<T = any>(
export function refThrottled<T = unknown>(
source: MaybeRefOrGetter<T>,
delay = 200,
trailing = true,