build: bump new versions
Publish to NPM / Check version changes and publish (push) Failing after 10m34s
Publish to NPM / Check version changes and publish (push) Failing after 10m34s
This commit is contained in:
@@ -15,7 +15,7 @@ const ASCII_ZERO = 0x30;
|
||||
* luhn('4111 1111 1111 1111'); // true
|
||||
* luhn('4111 1111 1111 1112'); // false
|
||||
*
|
||||
* @since 0.0.2
|
||||
* @since 0.0.1
|
||||
*/
|
||||
export function luhn(value: string): boolean {
|
||||
const digits = value.replaceAll(NON_DIGIT, '');
|
||||
|
||||
@@ -128,7 +128,7 @@ import type { FetchExecuteMiddleware, FetchHook, FetchHooks, FetchOptions, Fetch
|
||||
* });
|
||||
* await billing('/invoices', { method: 'POST', body: { amount: 100 } });
|
||||
*
|
||||
* @since 0.1.0
|
||||
* @since 0.0.1
|
||||
*/
|
||||
export function definePlugin<
|
||||
const Name extends string,
|
||||
@@ -228,7 +228,7 @@ function applyDefaults(
|
||||
* Ordering: plugin defaults (in declaration order) → user defaults (user wins).
|
||||
* Headers are merged independently through a single Headers instance.
|
||||
*
|
||||
* @since 0.1.0
|
||||
* @since 0.0.1
|
||||
*/
|
||||
export function composePlugins(
|
||||
plugins: readonly FetchPlugin[] | undefined,
|
||||
@@ -331,7 +331,7 @@ function composeExecute(middlewares: readonly FetchExecuteMiddleware[]): FetchEx
|
||||
* @description Runs all instance-level (plugin) hooks for a single phase, then the
|
||||
* optional user per-request hook(s). Avoids allocating an intermediate array per call.
|
||||
*
|
||||
* @since 0.1.0
|
||||
* @since 0.0.1
|
||||
*/
|
||||
export async function runHookPhase<C>(
|
||||
instance: ReadonlyArray<FetchHook<C>> | undefined,
|
||||
|
||||
@@ -44,7 +44,7 @@ function shouldRetryStatus(options: ResolvedFetchOptions, status: number): boole
|
||||
*
|
||||
* Auto-registered by `createFetch`; disable per-request via `retry: false`.
|
||||
*
|
||||
* @since 0.1.0
|
||||
* @since 0.0.1
|
||||
*/
|
||||
export function retryPlugin() {
|
||||
return definePlugin({
|
||||
|
||||
@@ -20,7 +20,7 @@ const baseSignals = new WeakMap<object, AbortSignal | undefined>();
|
||||
*
|
||||
* Auto-registered by `createFetch`; no-op when `timeout` is unset.
|
||||
*
|
||||
* @since 0.1.0
|
||||
* @since 0.0.1
|
||||
*/
|
||||
export function timeoutPlugin() {
|
||||
return definePlugin({
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@robonen/platform",
|
||||
"version": "0.0.4",
|
||||
"version": "0.0.5",
|
||||
"license": "Apache-2.0",
|
||||
"description": "Platform dependent utilities for javascript development",
|
||||
"keywords": [
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
* @category Multi
|
||||
* @description Global object that works in any environment
|
||||
*
|
||||
* @since 0.0.1
|
||||
* @since 0.0.2
|
||||
*/
|
||||
export const _global
|
||||
= typeof globalThis !== 'undefined'
|
||||
@@ -23,6 +23,6 @@ export const _global
|
||||
* @category Multi
|
||||
* @description Check if the current environment is the client
|
||||
*
|
||||
* @since 0.0.1
|
||||
* @since 0.0.2
|
||||
*/
|
||||
export const isClient = typeof window !== 'undefined' && typeof document !== 'undefined';
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@robonen/stdlib",
|
||||
"version": "0.0.9",
|
||||
"version": "0.0.10",
|
||||
"license": "Apache-2.0",
|
||||
"description": "A collection of tools, utilities, and helpers for TypeScript",
|
||||
"keywords": [
|
||||
|
||||
@@ -149,19 +149,22 @@ describe('scroll-area — ref forwarding', () => {
|
||||
|
||||
describe('scroll-area — glimpse type', () => {
|
||||
it('accepts type="glimpse" and reveals scrollbars on pointer enter', async () => {
|
||||
track(mount(makeApp({ type: 'glimpse', scrollHideDelay: 5000 }), { attachTo: document.body }));
|
||||
const w = track(mount(makeApp({ type: 'glimpse', scrollHideDelay: 5000 }), { attachTo: document.body }));
|
||||
await waitFrames();
|
||||
const root = document.querySelector('[dir]') as HTMLElement;
|
||||
const root = w.element as HTMLElement;
|
||||
root.dispatchEvent(new PointerEvent('pointerenter'));
|
||||
await waitFrames();
|
||||
expect(document.querySelectorAll('[data-state="visible"]').length).toBeGreaterThan(0);
|
||||
// Scope to this component's root: browser-mode suites share one document,
|
||||
// so a global query can also count scrollbars mounted by other suites.
|
||||
expect(root.querySelectorAll('[data-state="visible"]').length).toBeGreaterThan(0);
|
||||
});
|
||||
|
||||
it('glimpse stays hidden before any interaction', async () => {
|
||||
track(mount(makeApp({ type: 'glimpse', scrollHideDelay: 5000 }), { attachTo: document.body }));
|
||||
const w = track(mount(makeApp({ type: 'glimpse', scrollHideDelay: 5000 }), { attachTo: document.body }));
|
||||
await waitFrames();
|
||||
// No pointer enter / scroll => no visible scrollbar yet.
|
||||
expect(document.querySelectorAll('[data-state="visible"]').length).toBe(0);
|
||||
// No pointer enter / scroll => no visible scrollbar yet. Scoped to this
|
||||
// component's root (a global query can pick up other suites' scrollbars).
|
||||
expect((w.element as HTMLElement).querySelectorAll('[data-state="visible"]').length).toBe(0);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ function isInClosedPopover(el: Element): boolean {
|
||||
*
|
||||
* @param {MaybeComputedElementRef} target Element whose siblings should be aria-hidden
|
||||
*
|
||||
* @since 0.0.14
|
||||
* @since 0.0.1
|
||||
*/
|
||||
export function useHideOthers(target: MaybeComputedElementRef): void {
|
||||
if (!defaultWindow) return;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@robonen/vue",
|
||||
"version": "0.0.13",
|
||||
"version": "0.0.14",
|
||||
"license": "Apache-2.0",
|
||||
"description": "Collection of powerful tools for Vue",
|
||||
"keywords": [
|
||||
|
||||
@@ -167,7 +167,7 @@ const RESERVED_KEYS = [
|
||||
* // Shorthand: third argument is the duration in milliseconds
|
||||
* useAnimate(el, { opacity: [0, 1] }, 500);
|
||||
*
|
||||
* @since 0.0.15
|
||||
* @since 0.0.14
|
||||
*/
|
||||
export function useAnimate(
|
||||
target: MaybeComputedElementRef,
|
||||
|
||||
@@ -81,7 +81,7 @@ export interface UseCountdownReturn extends ResumableActions {
|
||||
* onComplete: () => console.log('done'),
|
||||
* });
|
||||
*
|
||||
* @since 0.0.15
|
||||
* @since 0.0.14
|
||||
*/
|
||||
export function useCountdown(
|
||||
initialCountdown: MaybeRefOrGetter<number>,
|
||||
|
||||
@@ -207,7 +207,7 @@ export function formatDate(
|
||||
* customMeridiem: (h) => (h < 12 ? 'morning' : 'evening'),
|
||||
* });
|
||||
*
|
||||
* @since 0.0.15
|
||||
* @since 0.0.14
|
||||
*/
|
||||
export function useDateFormat(
|
||||
date: MaybeRefOrGetter<DateLike>,
|
||||
|
||||
@@ -59,7 +59,7 @@ export type UseIntervalReturn = Readonly<ShallowRef<number>> | UseIntervalContro
|
||||
* @example
|
||||
* const { counter, isActive, pause, resume, reset } = useInterval(1000, { controls: true });
|
||||
*
|
||||
* @since 0.0.15
|
||||
* @since 0.0.14
|
||||
*/
|
||||
export function useInterval(interval?: MaybeRefOrGetter<number>, options?: UseIntervalOptions<false>): Readonly<ShallowRef<number>>;
|
||||
export function useInterval(interval: MaybeRefOrGetter<number>, options: UseIntervalOptions<true>): UseIntervalControls;
|
||||
|
||||
@@ -70,7 +70,7 @@ export type UseNowReturn<Controls extends boolean>
|
||||
* // Run a callback on every update
|
||||
* useNow({ interval: 1000, callback: date => console.log(date.toISOString()) });
|
||||
*
|
||||
* @since 0.0.15
|
||||
* @since 0.0.14
|
||||
*/
|
||||
export function useNow(options?: UseNowOptions<false>): Ref<Date>;
|
||||
export function useNow(options: UseNowOptions<true>): UseNowControls;
|
||||
|
||||
@@ -197,7 +197,7 @@ function defaultFullDateFormatter(date: Date): string {
|
||||
* @example
|
||||
* formatTimeAgo(new Date(Date.now() - 3 * 60_000)); // '3 minutes ago'
|
||||
*
|
||||
* @since 0.0.15
|
||||
* @since 0.0.14
|
||||
*/
|
||||
export function formatTimeAgo<UnitNames extends string = UseTimeAgoUnitName>(
|
||||
from: Date,
|
||||
@@ -303,7 +303,7 @@ export function formatTimeAgo<UnitNames extends string = UseTimeAgoUnitName>(
|
||||
* fullDateFormatter: d => d.toLocaleDateString('fr-FR'),
|
||||
* });
|
||||
*
|
||||
* @since 0.0.15
|
||||
* @since 0.0.14
|
||||
*/
|
||||
export function useTimeAgo<UnitNames extends string = UseTimeAgoUnitName>(
|
||||
time: MaybeRefOrGetter<Date | number | string>,
|
||||
|
||||
@@ -61,7 +61,7 @@ export type UseTimeoutReturn
|
||||
* // Run a callback when the timeout elapses
|
||||
* useTimeout(5000, { callback: refresh });
|
||||
*
|
||||
* @since 0.0.15
|
||||
* @since 0.0.14
|
||||
*/
|
||||
export function useTimeout(interval?: MaybeRefOrGetter<number>, options?: UseTimeoutOptions<false>): ComputedRef<boolean>;
|
||||
export function useTimeout(interval: MaybeRefOrGetter<number>, options: UseTimeoutOptions<true>): UseTimeoutControls;
|
||||
|
||||
@@ -58,7 +58,7 @@ export interface UseTimeoutFnReturn<Args extends unknown[]> {
|
||||
* // Fire once now and again after the delay
|
||||
* useTimeoutFn(refresh, 5000, { immediateCallback: true });
|
||||
*
|
||||
* @since 0.0.15
|
||||
* @since 0.0.14
|
||||
*/
|
||||
export function useTimeoutFn<T extends AnyFunction>(
|
||||
cb: T,
|
||||
|
||||
@@ -82,7 +82,7 @@ export type UseTimestampReturn<Controls extends boolean> = Controls extends true
|
||||
* const offset = ref(0);
|
||||
* const now = useTimestamp({ offset });
|
||||
*
|
||||
* @since 0.0.15
|
||||
* @since 0.0.14
|
||||
*/
|
||||
export function useTimestamp(options?: UseTimestampOptions<false>): Ref<number>;
|
||||
export function useTimestamp(options: UseTimestampOptions<true>): UseTimestampControls;
|
||||
|
||||
@@ -218,7 +218,7 @@ function valuesEqual(a: TransitionValue, b: TransitionValue): boolean {
|
||||
* const color = ref([0, 0, 0]);
|
||||
* const animated = useTransition(color, { duration: 1000 });
|
||||
*
|
||||
* @since 0.0.15
|
||||
* @since 0.0.14
|
||||
*/
|
||||
export function useTransition<T extends TransitionValue>(
|
||||
source: MaybeRefOrGetter<T>,
|
||||
|
||||
@@ -58,7 +58,7 @@ function isArrayDifferenceOptions<T>(value: unknown): value is UseArrayDifferenc
|
||||
* const b = ref([2, 3, 4]);
|
||||
* const symmetric = useArrayDifference(a, b, { symmetric: true }); // [1, 4]
|
||||
*
|
||||
* @since 0.0.15
|
||||
* @since 0.0.14
|
||||
*/
|
||||
export function useArrayDifference<T>(
|
||||
list: MaybeRefOrGetter<T[]>,
|
||||
|
||||
@@ -20,7 +20,7 @@ export type UseArrayEveryReturn = ComputedRef<boolean>;
|
||||
* const items = [ref(2), ref(4), ref(6)];
|
||||
* const allEven = useArrayEvery(items, n => n % 2 === 0); // true
|
||||
*
|
||||
* @since 0.0.15
|
||||
* @since 0.0.14
|
||||
*/
|
||||
export function useArrayEvery<T>(
|
||||
list: MaybeRefOrGetter<Array<MaybeRefOrGetter<T>>>,
|
||||
|
||||
@@ -14,7 +14,7 @@ import type { ComputedRef, MaybeRefOrGetter } from 'vue';
|
||||
* const list = ref([1, 2, 3, 4]);
|
||||
* const even = useArrayFilter(list, n => n % 2 === 0); // [2, 4]
|
||||
*
|
||||
* @since 0.0.15
|
||||
* @since 0.0.14
|
||||
*/
|
||||
export function useArrayFilter<T>(
|
||||
list: MaybeRefOrGetter<Array<MaybeRefOrGetter<T>>>,
|
||||
|
||||
@@ -14,7 +14,7 @@ import type { ComputedRef, MaybeRefOrGetter } from 'vue';
|
||||
* const list = ref([1, 2, 3]);
|
||||
* const found = useArrayFind(list, n => n > 1); // 2
|
||||
*
|
||||
* @since 0.0.15
|
||||
* @since 0.0.14
|
||||
*/
|
||||
export function useArrayFind<T>(
|
||||
list: MaybeRefOrGetter<Array<MaybeRefOrGetter<T>>>,
|
||||
|
||||
@@ -16,7 +16,7 @@ export type UseArrayFindIndexReturn = ComputedRef<number>;
|
||||
* const list = ref([1, 2, 3]);
|
||||
* const index = useArrayFindIndex(list, n => n > 1); // 1
|
||||
*
|
||||
* @since 0.0.15
|
||||
* @since 0.0.14
|
||||
*/
|
||||
export function useArrayFindIndex<T>(
|
||||
list: MaybeRefOrGetter<Array<MaybeRefOrGetter<T>>>,
|
||||
|
||||
@@ -35,7 +35,7 @@ const hasNativeFindLast = typeof Array.prototype.findLast === 'function';
|
||||
* const list = ref([1, 2, 3, 4]);
|
||||
* const found = useArrayFindLast(list, n => n % 2 === 0); // 4
|
||||
*
|
||||
* @since 0.0.15
|
||||
* @since 0.0.14
|
||||
*/
|
||||
export function useArrayFindLast<T>(
|
||||
list: MaybeRefOrGetter<Array<MaybeRefOrGetter<T>>>,
|
||||
|
||||
@@ -50,7 +50,7 @@ function isArrayIncludesOptions<T, V>(value: unknown): value is UseArrayIncludes
|
||||
* const list = ref(['a', 'b', 'a']);
|
||||
* const fromSecond = useArrayIncludes(list, 'a', { fromIndex: 1 }); // true
|
||||
*
|
||||
* @since 0.0.15
|
||||
* @since 0.0.14
|
||||
*/
|
||||
export function useArrayIncludes<T, V = T>(
|
||||
list: MaybeRefOrGetter<Array<MaybeRefOrGetter<T>>>,
|
||||
|
||||
@@ -18,7 +18,7 @@ export type UseArrayJoinReturn = ComputedRef<string>;
|
||||
* const sep = ref('-');
|
||||
* const joined = useArrayJoin(list, sep); // 'a-b-c'
|
||||
*
|
||||
* @since 0.0.15
|
||||
* @since 0.0.14
|
||||
*/
|
||||
export function useArrayJoin(
|
||||
list: MaybeRefOrGetter<Array<MaybeRefOrGetter<unknown>>>,
|
||||
|
||||
@@ -14,7 +14,7 @@ import type { ComputedRef, MaybeRefOrGetter } from 'vue';
|
||||
* const list = ref([1, 2, 3]);
|
||||
* const doubled = useArrayMap(list, n => n * 2); // [2, 4, 6]
|
||||
*
|
||||
* @since 0.0.15
|
||||
* @since 0.0.14
|
||||
*/
|
||||
export function useArrayMap<T, U = T>(
|
||||
list: MaybeRefOrGetter<Array<MaybeRefOrGetter<T>>>,
|
||||
|
||||
@@ -19,7 +19,7 @@ export type UseArrayReduceReturn<T> = ComputedRef<T>;
|
||||
* const list = ref([1, 2, 3, 4]);
|
||||
* const sum = useArrayReduce(list, (acc, n) => acc + n); // 10
|
||||
*
|
||||
* @since 0.0.15
|
||||
* @since 0.0.14
|
||||
*/
|
||||
export function useArrayReduce<T>(
|
||||
list: MaybeRefOrGetter<Array<MaybeRefOrGetter<T>>>,
|
||||
@@ -40,7 +40,7 @@ export function useArrayReduce<T>(
|
||||
* const list = ref([1, 2, 3, 4]);
|
||||
* const sum = useArrayReduce(list, (acc, n) => acc + n, 100); // 110
|
||||
*
|
||||
* @since 0.0.15
|
||||
* @since 0.0.14
|
||||
*/
|
||||
export function useArrayReduce<T, U>(
|
||||
list: MaybeRefOrGetter<Array<MaybeRefOrGetter<T>>>,
|
||||
|
||||
@@ -20,7 +20,7 @@ export type UseArraySomeReturn = ComputedRef<boolean>;
|
||||
* const items = [ref(1), ref(3), ref(5)];
|
||||
* const hasEven = useArraySome(items, n => n % 2 === 0); // false
|
||||
*
|
||||
* @since 0.0.15
|
||||
* @since 0.0.14
|
||||
*/
|
||||
export function useArraySome<T>(
|
||||
list: MaybeRefOrGetter<Array<MaybeRefOrGetter<T>>>,
|
||||
|
||||
@@ -42,7 +42,7 @@ export type UseArrayUniqueReturn<T = unknown> = ComputedRef<T[]>;
|
||||
* const list = ref([1.1, 1.4, 2.2]);
|
||||
* const byFloor = useArrayUnique(list, (a, b) => Math.floor(a) === Math.floor(b)); // [1.1, 2.2]
|
||||
*
|
||||
* @since 0.0.15
|
||||
* @since 0.0.14
|
||||
*/
|
||||
export function useArrayUnique<T>(
|
||||
list: MaybeRefOrGetter<Array<MaybeRefOrGetter<T>>>,
|
||||
|
||||
@@ -99,7 +99,7 @@ const defaultSortFn: UseSortedFn = <T>(source: T[], compareFn: UseSortedCompareF
|
||||
* useSorted(list, { dirty: true });
|
||||
* // list.value is now [1, 2, 3]
|
||||
*
|
||||
* @since 0.0.15
|
||||
* @since 0.0.14
|
||||
*/
|
||||
export function useSorted<T = unknown>(source: Ref<T[]>, compareFn?: UseSortedCompareFn<T>): Ref<T[]>;
|
||||
export function useSorted<T = unknown>(source: MaybeRefOrGetter<T[]>, compareFn?: UseSortedCompareFn<T>): ComputedRef<T[]>;
|
||||
|
||||
@@ -104,7 +104,7 @@ function increaseWithUnit(target: number | string, delta: number): number | stri
|
||||
* const bp = useBreakpoints({ mobile: 0, tablet: 640, desktop: 1024 });
|
||||
* const active = bp.active(); // ComputedRef<'mobile' | 'tablet' | 'desktop' | ''>
|
||||
*
|
||||
* @since 0.0.15
|
||||
* @since 0.0.14
|
||||
*/
|
||||
export function useBreakpoints<K extends string>(
|
||||
breakpoints: Breakpoints<K>,
|
||||
|
||||
@@ -76,7 +76,7 @@ export interface UseClipboardReturn<Optional extends boolean> {
|
||||
* // Copy a lazily/asynchronously resolved value
|
||||
* copy(async () => (await fetch('/token').then(r => r.text())));
|
||||
*
|
||||
* @since 0.0.15
|
||||
* @since 0.0.14
|
||||
*/
|
||||
export function useClipboard(options?: UseClipboardOptions<undefined>): UseClipboardReturn<false>;
|
||||
export function useClipboard(options: UseClipboardOptions<MaybeRefOrGetter<string>>): UseClipboardReturn<true>;
|
||||
|
||||
@@ -96,7 +96,7 @@ export interface UseClipboardItemsReturn<Optional extends boolean> {
|
||||
* const { content } = useClipboardItems({ read: true });
|
||||
* copy(async () => buildClipboardItems());
|
||||
*
|
||||
* @since 0.0.15
|
||||
* @since 0.0.14
|
||||
*/
|
||||
export function useClipboardItems(options?: UseClipboardItemsOptions<undefined>): UseClipboardItemsReturn<false>;
|
||||
export function useClipboardItems(options: UseClipboardItemsOptions<MaybeRefOrGetter<ClipboardItems>>): UseClipboardItemsReturn<true>;
|
||||
|
||||
@@ -76,7 +76,7 @@ export interface UseCloseWatcherReturn {
|
||||
* // Programmatically request a close
|
||||
* close();
|
||||
*
|
||||
* @since 0.0.15
|
||||
* @since 0.0.14
|
||||
*/
|
||||
export function useCloseWatcher(options: UseCloseWatcherOptions = {}): UseCloseWatcherReturn {
|
||||
const { window = defaultWindow } = options;
|
||||
|
||||
@@ -120,7 +120,7 @@ const CSS_DISABLE_TRANS = '*,*::before,*::after{-webkit-transition:none!importan
|
||||
* // Read the resolved system + effective state
|
||||
* const { system, state } = useColorMode();
|
||||
*
|
||||
* @since 0.0.15
|
||||
* @since 0.0.14
|
||||
*/
|
||||
export function useColorMode<T extends string = BasicColorMode>(
|
||||
options: UseColorModeOptions<T> = {},
|
||||
|
||||
@@ -42,7 +42,7 @@ export interface UseCssVarReturn extends WritableComputedRef<string | null | und
|
||||
* @example
|
||||
* const theme = useCssVar('--theme', null, { initialValue: 'light', observe: true });
|
||||
*
|
||||
* @since 0.0.15
|
||||
* @since 0.0.14
|
||||
*/
|
||||
export function useCssVar(
|
||||
prop: MaybeRefOrGetter<string | null | undefined>,
|
||||
|
||||
@@ -58,7 +58,7 @@ export type UseDarkReturn = WritableComputedRef<boolean>;
|
||||
* const isDark = useDark();
|
||||
* const toggleDark = useToggle(isDark);
|
||||
*
|
||||
* @since 0.0.15
|
||||
* @since 0.0.14
|
||||
*/
|
||||
export function useDark(options: UseDarkOptions = {}): UseDarkReturn {
|
||||
const {
|
||||
|
||||
@@ -109,7 +109,7 @@ export interface UseDocumentPiPReturn {
|
||||
* pipWindow.value.document.body.append(playerEl);
|
||||
* });
|
||||
*
|
||||
* @since 0.0.15
|
||||
* @since 0.0.14
|
||||
*/
|
||||
export function useDocumentPiP(options: UseDocumentPiPOptions = {}): UseDocumentPiPReturn {
|
||||
const {
|
||||
|
||||
@@ -67,7 +67,7 @@ export interface UseEyeDropperReturn {
|
||||
* if (isSupported.value)
|
||||
* await open();
|
||||
*
|
||||
* @since 0.0.15
|
||||
* @since 0.0.14
|
||||
*/
|
||||
export function useEyeDropper(options: UseEyeDropperOptions = {}): UseEyeDropperReturn {
|
||||
const {
|
||||
|
||||
@@ -44,7 +44,7 @@ const FILE_EXTENSION_RE = /\.([a-z0-9]+)$/i;
|
||||
* const isDark = useDark();
|
||||
* const favicon = useFavicon(() => isDark.value ? '/dark.png' : '/light.png');
|
||||
*
|
||||
* @since 0.0.15
|
||||
* @since 0.0.14
|
||||
*/
|
||||
export function useFavicon(
|
||||
newIcon: MaybeRefOrGetter<string | null | undefined>,
|
||||
|
||||
@@ -159,7 +159,7 @@ function toFileList(files: File[] | FileList | undefined): FileList | null {
|
||||
* const { open } = useFileDialog();
|
||||
* open({ multiple: false, accept: '.pdf' });
|
||||
*
|
||||
* @since 0.0.15
|
||||
* @since 0.0.14
|
||||
*/
|
||||
export function useFileDialog(options: UseFileDialogOptions = {}): UseFileDialogReturn {
|
||||
const {
|
||||
|
||||
@@ -186,7 +186,7 @@ export interface UseFileSystemAccessReturn<T = string | ArrayBuffer | Blob> {
|
||||
* // Read raw bytes
|
||||
* const { data } = useFileSystemAccess({ dataType: 'ArrayBuffer' });
|
||||
*
|
||||
* @since 0.0.15
|
||||
* @since 0.0.14
|
||||
*/
|
||||
export function useFileSystemAccess(): UseFileSystemAccessReturn<string | ArrayBuffer | Blob>;
|
||||
export function useFileSystemAccess(options: UseFileSystemAccessOptions & { dataType: 'Text' }): UseFileSystemAccessReturn<string>;
|
||||
|
||||
@@ -106,7 +106,7 @@ const listenerOptions = { capture: false, passive: true } as const;
|
||||
* // Fullscreen the whole page
|
||||
* const { toggle } = useFullscreen();
|
||||
*
|
||||
* @since 0.0.15
|
||||
* @since 0.0.14
|
||||
*/
|
||||
export function useFullscreen(
|
||||
target?: MaybeComputedElementRef,
|
||||
|
||||
@@ -113,7 +113,7 @@ function loadImage(options: UseImageOptions, ctx: LoadImageContext): Promise<HTM
|
||||
* const src = ref('/a.png');
|
||||
* const { state } = useImage(() => ({ src: src.value, alt: 'photo' }));
|
||||
*
|
||||
* @since 0.0.15
|
||||
* @since 0.0.14
|
||||
*/
|
||||
export function useImage(
|
||||
options: MaybeRefOrGetter<UseImageOptions>,
|
||||
|
||||
@@ -113,7 +113,7 @@ export interface UseLocalFontsReturn {
|
||||
* const { fonts, query } = useLocalFonts();
|
||||
* await query({ postscriptNames: ['Arial-BoldMT'] });
|
||||
*
|
||||
* @since 0.0.15
|
||||
* @since 0.0.14
|
||||
*/
|
||||
export function useLocalFonts(options: UseLocalFontsOptions = {}): UseLocalFontsReturn {
|
||||
const {
|
||||
|
||||
@@ -61,7 +61,7 @@ function matchSsrWidth(query: string, width: number): boolean {
|
||||
* // Resolve width queries during SSR to avoid hydration flicker
|
||||
* const isWide = useMediaQuery('(min-width: 1024px)', { ssrWidth: 1280 });
|
||||
*
|
||||
* @since 0.0.15
|
||||
* @since 0.0.14
|
||||
*/
|
||||
export function useMediaQuery(
|
||||
query: MaybeRefOrGetter<string>,
|
||||
|
||||
@@ -21,7 +21,7 @@ export type UseObjectUrlReturn = Readonly<ShallowRef<string | undefined>>;
|
||||
* const file = shallowRef<File>();
|
||||
* const url = useObjectUrl(file);
|
||||
*
|
||||
* @since 0.0.15
|
||||
* @since 0.0.14
|
||||
*/
|
||||
export function useObjectUrl(
|
||||
object: MaybeRefOrGetter<Blob | MediaSource | null | undefined>,
|
||||
|
||||
@@ -151,7 +151,7 @@ const DEFAULT_TRANSPORT: OTPTransportType[] = ['sms'];
|
||||
* const { receive } = useOtpCredentials();
|
||||
* receive({ signal: AbortSignal.timeout(30_000) });
|
||||
*
|
||||
* @since 0.0.15
|
||||
* @since 0.0.14
|
||||
*/
|
||||
export function useOtpCredentials(options: UseOtpCredentialsOptions = {}): UseOtpCredentialsReturn {
|
||||
const {
|
||||
|
||||
@@ -79,7 +79,7 @@ export interface UsePermissionReturnWithControls {
|
||||
* @example
|
||||
* const { state, isSupported, query } = usePermission('camera', { controls: true });
|
||||
*
|
||||
* @since 0.0.15
|
||||
* @since 0.0.14
|
||||
*/
|
||||
export function usePermission(
|
||||
permissionDesc: GeneralPermissionDescriptor | GeneralPermissionDescriptor['name'],
|
||||
|
||||
@@ -16,7 +16,7 @@ export type ColorSchemePreference = 'dark' | 'light' | 'no-preference';
|
||||
* @example
|
||||
* const scheme = usePreferredColorScheme();
|
||||
*
|
||||
* @since 0.0.15
|
||||
* @since 0.0.14
|
||||
*/
|
||||
export function usePreferredColorScheme(
|
||||
options: ConfigurableWindow = {},
|
||||
|
||||
@@ -32,7 +32,7 @@ export interface UsePreferredContrastOptions extends UseMediaQueryOptions {
|
||||
* // Provide an SSR fallback to avoid hydration flicker
|
||||
* const contrast = usePreferredContrast({ ssrContrast: 'more' });
|
||||
*
|
||||
* @since 0.0.15
|
||||
* @since 0.0.14
|
||||
*/
|
||||
export function usePreferredContrast(
|
||||
options: UsePreferredContrastOptions = {},
|
||||
|
||||
@@ -13,7 +13,7 @@ import { useMediaQuery } from '@/composables/browser/useMediaQuery';
|
||||
* @example
|
||||
* const isDark = usePreferredDark();
|
||||
*
|
||||
* @since 0.0.15
|
||||
* @since 0.0.14
|
||||
*/
|
||||
export function usePreferredDark(options: ConfigurableWindow = {}): Ref<boolean> {
|
||||
return useMediaQuery('(prefers-color-scheme: dark)', options);
|
||||
|
||||
@@ -24,7 +24,7 @@ import { useEventListener } from '@/composables/browser/useEventListener';
|
||||
* // Pass a custom window (e.g. an iframe)
|
||||
* const languages = usePreferredLanguages({ window: iframe.contentWindow });
|
||||
*
|
||||
* @since 0.0.15
|
||||
* @since 0.0.14
|
||||
*/
|
||||
export function usePreferredLanguages(options: ConfigurableWindow = {}): ShallowRef<readonly string[]> {
|
||||
const { window = defaultWindow } = options;
|
||||
|
||||
@@ -30,7 +30,7 @@ export type UsePreferredReducedMotionReturn = ComputedRef<ReducedMotionType>;
|
||||
* transitionDuration.value = motion.value === 'reduce' ? 0 : 200;
|
||||
* });
|
||||
*
|
||||
* @since 0.0.15
|
||||
* @since 0.0.14
|
||||
*/
|
||||
export function usePreferredReducedMotion(
|
||||
options: UsePreferredReducedMotionOptions = {},
|
||||
|
||||
@@ -19,7 +19,7 @@ export type ReducedTransparencyType
|
||||
* const transparency = usePreferredReducedTransparency();
|
||||
* // transparency.value === 'reduce' | 'no-preference'
|
||||
*
|
||||
* @since 0.0.15
|
||||
* @since 0.0.14
|
||||
*/
|
||||
export function usePreferredReducedTransparency(
|
||||
options: ConfigurableWindow = {},
|
||||
|
||||
@@ -140,7 +140,7 @@ export interface UseScriptTagReturn {
|
||||
* await load();
|
||||
* unload();
|
||||
*
|
||||
* @since 0.0.15
|
||||
* @since 0.0.14
|
||||
*/
|
||||
export function useScriptTag(
|
||||
src: MaybeRefOrGetter<string>,
|
||||
|
||||
@@ -67,7 +67,7 @@ export interface UseShareReturn {
|
||||
* const { share } = useShare({ title: 'Default' });
|
||||
* share({ text: 'One-off message' });
|
||||
*
|
||||
* @since 0.0.15
|
||||
* @since 0.0.14
|
||||
*/
|
||||
export function useShare(
|
||||
shareOptions: MaybeRefOrGetter<UseShareOptions> = {},
|
||||
|
||||
@@ -101,7 +101,7 @@ const _refCount = new WeakMap<HTMLStyleElement, number>();
|
||||
* load();
|
||||
* unload();
|
||||
*
|
||||
* @since 0.0.15
|
||||
* @since 0.0.14
|
||||
*/
|
||||
export function useStyleTag(
|
||||
css: MaybeRefOrGetter<string>,
|
||||
|
||||
@@ -85,7 +85,7 @@ export interface UseTextareaAutosizeReturn {
|
||||
* @example
|
||||
* const { textarea, input, triggerResize } = useTextareaAutosize({ maxHeight: 320 });
|
||||
*
|
||||
* @since 0.0.15
|
||||
* @since 0.0.14
|
||||
*/
|
||||
export function useTextareaAutosize(options: UseTextareaAutosizeOptions = {}): UseTextareaAutosizeReturn {
|
||||
const {
|
||||
|
||||
@@ -61,7 +61,7 @@ export type UseTitleReturn = Ref<string | null | undefined> | ComputedRef<string
|
||||
* // Restore the previous title when the component unmounts
|
||||
* useTitle('Checkout', { restoreOnUnmount: (original) => original });
|
||||
*
|
||||
* @since 0.0.15
|
||||
* @since 0.0.14
|
||||
*/
|
||||
export function useTitle(
|
||||
newTitle: () => string | null | undefined,
|
||||
|
||||
@@ -88,7 +88,7 @@ export type UseUrlSearchParamsReturn<T extends Record<string, any> = UrlParams>
|
||||
* const params = useUrlSearchParams<{ ids: string[] }>('history');
|
||||
* params.ids = ['1', '2']; // -> ?ids=1&ids=2
|
||||
*
|
||||
* @since 0.0.15
|
||||
* @since 0.0.14
|
||||
*/
|
||||
// `Record<string, any>` constraint mirrors `UseUrlSearchParamsReturn`: caller-supplied
|
||||
// `T` flows back out, so interface types must satisfy the bound (see note above).
|
||||
|
||||
@@ -76,7 +76,7 @@ export interface UseVibrateReturn {
|
||||
* const { vibrate, stop, intervalControls } = useVibrate({ pattern: [300, 100], interval: 2000 });
|
||||
* intervalControls?.resume();
|
||||
*
|
||||
* @since 0.0.15
|
||||
* @since 0.0.14
|
||||
*/
|
||||
export function useVibrate(options: UseVibrateOptions = {}): UseVibrateReturn {
|
||||
const {
|
||||
|
||||
@@ -72,7 +72,7 @@ export interface UseWakeLockReturn {
|
||||
* const { forceRequest } = useWakeLock();
|
||||
* await forceRequest('screen');
|
||||
*
|
||||
* @since 0.0.15
|
||||
* @since 0.0.14
|
||||
*/
|
||||
export function useWakeLock(options: UseWakeLockOptions = {}): UseWakeLockReturn {
|
||||
const {
|
||||
|
||||
@@ -163,7 +163,7 @@ export interface UseWebNotificationReturn {
|
||||
* const { show } = useWebNotification();
|
||||
* show({ title: 'Override', body: 'Per-call body' });
|
||||
*
|
||||
* @since 0.0.15
|
||||
* @since 0.0.14
|
||||
*/
|
||||
export function useWebNotification(
|
||||
options: UseWebNotificationOptions = {},
|
||||
|
||||
@@ -117,7 +117,7 @@ function makePair<
|
||||
* // <DefineItem v-slot="{ label }">{{ label }}</DefineItem>
|
||||
* // <ReuseItem label="A" /> <ReuseItem label="B" />
|
||||
*
|
||||
* @since 0.0.15
|
||||
* @since 0.0.14
|
||||
*/
|
||||
export function createReusableTemplate<
|
||||
Bindings extends Record<string, any>,
|
||||
|
||||
@@ -50,7 +50,7 @@ export type UseCurrentElementReturn<
|
||||
* const child = useTemplateRef('child');
|
||||
* const el = useCurrentElement(child);
|
||||
*
|
||||
* @since 0.0.15
|
||||
* @since 0.0.14
|
||||
*/
|
||||
export function useCurrentElement<
|
||||
T extends MaybeElement = MaybeElement,
|
||||
|
||||
@@ -198,7 +198,7 @@ function createMetrics(length: number, itemSize: UseVirtualListItemSize): UseVir
|
||||
* // Variable heights and a wider overscan buffer.
|
||||
* const { list } = useVirtualList(items, { itemHeight: i => (i % 2 ? 40 : 80), overscan: 10 });
|
||||
*
|
||||
* @since 0.0.15
|
||||
* @since 0.0.14
|
||||
*/
|
||||
export function useVirtualList<T = unknown>(
|
||||
list: MaybeRefOrGetter<readonly T[]>,
|
||||
|
||||
@@ -32,7 +32,7 @@ export type OnElementRemovalReturn = VoidFunction;
|
||||
* @example
|
||||
* const stop = onElementRemoval(el, (records) => report(records), { flush: 'post' });
|
||||
*
|
||||
* @since 0.0.15
|
||||
* @since 0.0.14
|
||||
*/
|
||||
export function onElementRemoval(
|
||||
target: MaybeComputedElementRef,
|
||||
|
||||
@@ -38,7 +38,7 @@ export type UseActiveElementReturn<T extends HTMLElement = HTMLElement> = Shallo
|
||||
* // keep tracking even if the focused node is detached from the DOM
|
||||
* const active = useActiveElement({ triggerOnRemoval: true });
|
||||
*
|
||||
* @since 0.0.15
|
||||
* @since 0.0.14
|
||||
*/
|
||||
export function useActiveElement<T extends HTMLElement>(
|
||||
options: UseActiveElementOptions = {},
|
||||
|
||||
@@ -41,7 +41,7 @@ export type UseDocumentReadyStateReturn = ShallowRef<DocumentReadyState>;
|
||||
* },
|
||||
* });
|
||||
*
|
||||
* @since 0.0.15
|
||||
* @since 0.0.14
|
||||
*/
|
||||
export function useDocumentReadyState(
|
||||
options: UseDocumentReadyStateOptions = {},
|
||||
|
||||
@@ -41,7 +41,7 @@ export type UseDocumentVisibilityReturn = ShallowRef<DocumentVisibilityState>;
|
||||
* },
|
||||
* });
|
||||
*
|
||||
* @since 0.0.15
|
||||
* @since 0.0.14
|
||||
*/
|
||||
export function useDocumentVisibility(
|
||||
options: UseDocumentVisibilityOptions = {},
|
||||
|
||||
@@ -167,7 +167,7 @@ export interface UseDraggableReturn {
|
||||
* // Lock to the horizontal axis and only drag from a handle.
|
||||
* const { position } = useDraggable(el, { axis: 'x', handle: handleEl });
|
||||
*
|
||||
* @since 0.0.15
|
||||
* @since 0.0.14
|
||||
*/
|
||||
export function useDraggable(
|
||||
target: MaybeComputedElementRef,
|
||||
|
||||
@@ -79,7 +79,7 @@ type DropZoneEventType = 'enter' | 'over' | 'leave' | 'drop';
|
||||
* onDrop: (files) => console.log(files),
|
||||
* });
|
||||
*
|
||||
* @since 0.0.15
|
||||
* @since 0.0.14
|
||||
*/
|
||||
export function useDropZone(
|
||||
target: MaybeComputedElementRef | MaybeRefOrGetter<Document | null | undefined>,
|
||||
|
||||
@@ -84,7 +84,7 @@ export interface UseElementBoundingReturn {
|
||||
* // Batch rapid scroll/resize reads into one measurement per frame
|
||||
* const bounds = useElementBounding(el, { updateTiming: 'next-frame' });
|
||||
*
|
||||
* @since 0.0.15
|
||||
* @since 0.0.14
|
||||
*/
|
||||
export function useElementBounding(
|
||||
target: MaybeComputedElementRef,
|
||||
|
||||
@@ -41,7 +41,7 @@ export interface UseElementSizeReturn {
|
||||
* @example
|
||||
* const { width, height, stop } = useElementSize(el, { width: 100, height: 100 }, { box: 'border-box' });
|
||||
*
|
||||
* @since 0.0.15
|
||||
* @since 0.0.14
|
||||
*/
|
||||
export function useElementSize(
|
||||
target: MaybeComputedElementRef,
|
||||
|
||||
@@ -56,7 +56,7 @@ export type UseElementVisibilityReturn<Controls extends boolean = false>
|
||||
* @example
|
||||
* const { isVisible, stop } = useElementVisibility(el, { controls: true, once: true });
|
||||
*
|
||||
* @since 0.0.15
|
||||
* @since 0.0.14
|
||||
*/
|
||||
export function useElementVisibility(
|
||||
target: MaybeComputedElementRef,
|
||||
|
||||
@@ -18,7 +18,7 @@ let counter = 0;
|
||||
* @example
|
||||
* useFocusGuard('my-namespace');
|
||||
*
|
||||
* @since 0.0.2
|
||||
* @since 0.0.3
|
||||
*/
|
||||
export function useFocusGuard(namespace?: string) {
|
||||
const manager = focusGuard(namespace);
|
||||
|
||||
@@ -62,7 +62,7 @@ export interface UseIntersectionObserverReturn {
|
||||
* visible.value = isIntersecting;
|
||||
* });
|
||||
*
|
||||
* @since 0.0.15
|
||||
* @since 0.0.14
|
||||
*/
|
||||
export function useIntersectionObserver(
|
||||
target: MaybeComputedElementRef | MaybeComputedElementRef[] | MaybeRefOrGetter<MaybeElement[]>,
|
||||
|
||||
@@ -61,7 +61,7 @@ export interface UseMutationObserverReturn {
|
||||
* @example
|
||||
* const { pause, resume } = useMutationObserver([elA, elB], onMutate, { childList: true });
|
||||
*
|
||||
* @since 0.0.15
|
||||
* @since 0.0.14
|
||||
*/
|
||||
export function useMutationObserver(
|
||||
target: MaybeComputedElementRef | MaybeComputedElementRef[] | MaybeRefOrGetter<MaybeElement[]>,
|
||||
|
||||
@@ -30,7 +30,7 @@ export type UseParentElementReturn
|
||||
* const el = useTemplateRef<HTMLElement>('el');
|
||||
* const parent = useParentElement(el);
|
||||
*
|
||||
* @since 0.0.15
|
||||
* @since 0.0.14
|
||||
*/
|
||||
export function useParentElement(
|
||||
element: MaybeComputedElementRef | MaybeRefOrGetter<HTMLElement | SVGElement | null | undefined> = useCurrentElement<HTMLElement | SVGAElement>(),
|
||||
|
||||
@@ -79,7 +79,7 @@ export interface UseResizeObserverReturn {
|
||||
* // react to multiple targets
|
||||
* }, { box: 'border-box' });
|
||||
*
|
||||
* @since 0.0.15
|
||||
* @since 0.0.14
|
||||
*/
|
||||
export function useResizeObserver(
|
||||
target: MaybeComputedElementRef | MaybeComputedElementRef[],
|
||||
|
||||
@@ -19,7 +19,7 @@ export type UseWindowFocusReturn = ShallowRef<boolean>;
|
||||
* @example
|
||||
* const focused = useWindowFocus();
|
||||
*
|
||||
* @since 0.0.15
|
||||
* @since 0.0.14
|
||||
*/
|
||||
export function useWindowFocus(options: UseWindowFocusOptions = {}): UseWindowFocusReturn {
|
||||
const { window = defaultWindow } = options;
|
||||
|
||||
@@ -124,7 +124,7 @@ export interface UseWindowScrollReturn {
|
||||
* @example
|
||||
* const { x, y, isScrolling, arrivedState, directions } = useWindowScroll();
|
||||
*
|
||||
* @since 0.0.15
|
||||
* @since 0.0.14
|
||||
*/
|
||||
export function useWindowScroll(options: UseWindowScrollOptions = {}): UseWindowScrollReturn {
|
||||
const {
|
||||
|
||||
@@ -76,7 +76,7 @@ export interface UseWindowSizeReturn {
|
||||
* // Track the pinch-zoom aware visual viewport on mobile
|
||||
* const { width, height } = useWindowSize({ type: 'visual' });
|
||||
*
|
||||
* @since 0.0.15
|
||||
* @since 0.0.14
|
||||
*/
|
||||
export function useWindowSize(options: UseWindowSizeOptions = {}): UseWindowSizeReturn {
|
||||
const {
|
||||
|
||||
@@ -177,7 +177,7 @@ export class MaskModel implements ElementState {
|
||||
* maskTransform('1234567890', maskPhoneOptions({ template: '+1 (###) ###-####' }));
|
||||
* // '+1 (123) 456-7890'
|
||||
*
|
||||
* @since 0.0.17
|
||||
* @since 0.0.14
|
||||
*/
|
||||
export function maskTransform(value: string, options: MaskOptions): string;
|
||||
export function maskTransform(state: ElementState, options: MaskOptions): ElementState;
|
||||
@@ -210,7 +210,7 @@ export function maskTransform(valueOrState: string | ElementState, options: Mask
|
||||
* unmask('+1 (123) 456-7890', maskPhoneOptions({ template: '+1 (###) ###-####' }));
|
||||
* // '1234567890'
|
||||
*
|
||||
* @since 0.0.17
|
||||
* @since 0.0.14
|
||||
*/
|
||||
export function unmask(maskedValue: string, options: MaskOptions): string {
|
||||
const resolved = resolveMaskOptions(options);
|
||||
|
||||
@@ -48,7 +48,7 @@ export interface MaskCardParams {
|
||||
* const card = useMaskedInput({ mask: maskCardOptions() });
|
||||
* // <input v-bind="card.bind"> — 4111… → '4111 1111 1111 1111', 3714… → Amex 4-6-5
|
||||
*
|
||||
* @since 0.0.17
|
||||
* @since 0.0.14
|
||||
*/
|
||||
export function maskCardOptions(params: MaskCardParams = {}): MaskOptions {
|
||||
const brands = params.brands ?? CARD_BRANDS;
|
||||
|
||||
@@ -63,7 +63,7 @@ function clampDateSegments(segments: readonly DateSegment[], separator: string):
|
||||
* @example
|
||||
* maskDateOptions({ mode: 'dd/mm/yyyy' });
|
||||
*
|
||||
* @since 0.0.17
|
||||
* @since 0.0.14
|
||||
*/
|
||||
export function maskDateOptions(params: MaskDateParams = {}): MaskOptions {
|
||||
const mode = params.mode ?? 'dd/mm/yyyy';
|
||||
|
||||
@@ -210,7 +210,7 @@ function numberPostprocessor(params: ResolvedNumberParams): MaskPostprocessor {
|
||||
* maskNumberOptions({ thousandSeparator: ',', precision: 2, prefix: '$' });
|
||||
* // typing 1234.5 → '$1,234.5'
|
||||
*
|
||||
* @since 0.0.17
|
||||
* @since 0.0.14
|
||||
*/
|
||||
export function maskNumberOptions(params: MaskNumberParams = {}): MaskOptions {
|
||||
const resolved: ResolvedNumberParams = {
|
||||
|
||||
@@ -56,7 +56,7 @@ export interface MaskPhoneCountryParams {
|
||||
* fallback: '+#############',
|
||||
* });
|
||||
*
|
||||
* @since 0.0.17
|
||||
* @since 0.0.14
|
||||
*/
|
||||
export function maskPhoneCountryOptions(params: MaskPhoneCountryParams = {}): MaskOptions {
|
||||
const countries = params.countries ?? PHONE_COUNTRIES;
|
||||
|
||||
@@ -28,7 +28,7 @@ export interface MaskPhoneParams {
|
||||
* @example
|
||||
* maskPhoneOptions({ template: '+1 (###) ###-####' });
|
||||
*
|
||||
* @since 0.0.17
|
||||
* @since 0.0.14
|
||||
*/
|
||||
export function maskPhoneOptions(params: MaskPhoneParams): MaskOptions {
|
||||
return { mask: maskFromTemplate(params.template, params.tokens) };
|
||||
|
||||
@@ -37,7 +37,7 @@ function compileTemplate(template: string, tokens: Readonly<Record<string, RegEx
|
||||
* @example
|
||||
* maskFromTemplate('##/##/####'); // [/\d/, /\d/, '/', /\d/, /\d/, '/', /\d/, /\d/, /\d/, /\d/]
|
||||
*
|
||||
* @since 0.0.17
|
||||
* @since 0.0.14
|
||||
*/
|
||||
export function maskFromTemplate(
|
||||
template: string,
|
||||
|
||||
@@ -38,7 +38,7 @@ import type {
|
||||
* // Standalone (no form ancestor)
|
||||
* const { value, errors } = useField('search', { initialValue: '', schema });
|
||||
*
|
||||
* @since 0.0.16
|
||||
* @since 0.0.14
|
||||
*/
|
||||
export function useField<T = unknown>(
|
||||
path: MaybeRefOrGetter<string>,
|
||||
|
||||
@@ -29,7 +29,7 @@ import type {
|
||||
* // </div>
|
||||
* // <button @click="push({ name: '' })">add</button>
|
||||
*
|
||||
* @since 0.0.16
|
||||
* @since 0.0.14
|
||||
*/
|
||||
export function useFieldArray<T = unknown>(
|
||||
path: MaybeRefOrGetter<string>,
|
||||
|
||||
@@ -95,7 +95,7 @@ function deepAssign(target: Record<string, unknown>, source: Record<string, unkn
|
||||
* const [name, nameProps] = form.defineField('name');
|
||||
* // <input v-model="name" v-bind="nameProps">
|
||||
*
|
||||
* @since 0.0.16
|
||||
* @since 0.0.14
|
||||
*/
|
||||
export function useForm<TInput extends object, TOutput = TInput>(
|
||||
options: UseFormOptions<TInput, TOutput> = {},
|
||||
|
||||
@@ -16,7 +16,7 @@ import type { UseFormReturn } from '../useForm';
|
||||
* if (form)
|
||||
* form.setFieldValue('email', 'a@b.com');
|
||||
*
|
||||
* @since 0.0.16
|
||||
* @since 0.0.14
|
||||
*/
|
||||
export function useFormContext<TInput extends object = Record<string, unknown>, TOutput = TInput>(): UseFormReturn<TInput, TOutput> | null {
|
||||
return injectFormContext<TInput, TOutput>();
|
||||
|
||||
@@ -24,7 +24,7 @@ export type { UseMaskedFieldOptions, UseMaskedFieldReturn } from './types';
|
||||
* const { bind, errorMessage } = useMaskedField('phone', { mask: '+1 (###) ###-####' });
|
||||
* // <input v-bind="bind"> — the form stores the raw digits
|
||||
*
|
||||
* @since 0.0.17
|
||||
* @since 0.0.14
|
||||
*/
|
||||
export function useMaskedField<T = string>(
|
||||
path: MaybeRefOrGetter<string>,
|
||||
|
||||
@@ -40,7 +40,7 @@ export type { MaskInputBindings, UseMaskedInputOptions, UseMaskedInputReturn } f
|
||||
* onAccept: ({ unmasked }) => save(unmasked),
|
||||
* });
|
||||
*
|
||||
* @since 0.0.17
|
||||
* @since 0.0.14
|
||||
*/
|
||||
export function useMaskedInput(options: UseMaskedInputOptions): UseMaskedInputReturn {
|
||||
const masked = shallowRef('');
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user