1 Commits

Author SHA1 Message Date
Renovate Bot 63b3c5f2fd chore(deps): update pnpm to v11
CI / Discover packages (pull_request) Failing after 53s
CI / ${{ matrix.package }} (pull_request) Has been skipped
CI / CI (pull_request) Failing after 5s
2026-06-15 22:06:55 +00:00
221 changed files with 3840 additions and 3118 deletions
+30 -23
View File
@@ -13,40 +13,47 @@ env:
NODE_VERSION: 24.x NODE_VERSION: 24.x
jobs: jobs:
# Enumerate the workspace packages so the matrix below fans out one job per
# package (kept dynamic so new packages are picked up automatically).
discover:
name: Discover packages
runs-on: ubuntu-latest
outputs:
packages: ${{ steps.list.outputs.packages }}
steps:
- uses: actions/checkout@v6
- name: Install pnpm
uses: pnpm/action-setup@v6
with:
run_install: false
- uses: actions/setup-node@v6
with:
node-version: ${{ env.NODE_VERSION }}
cache: pnpm
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: List workspace packages
id: list
run: echo "packages=$(pnpm -r ls --depth -1 --json | jq -c '[.[] | select(.name != "tools") | .name]')" >> "$GITHUB_OUTPUT"
# One job per package — build (with its workspace deps), lint and test run in # One job per package — build (with its workspace deps), lint and test run in
# parallel across packages. fail-fast: false so every package is reported. # parallel across packages. fail-fast: false so every package is reported.
#
# The list is static: Gitea's act_runner does not expand a dynamic matrix
# built from a previous job's outputs (the strategy is evaluated before the
# producing job runs), so `matrix.package` came out empty. When you add a
# workspace package, add a line here.
check: check:
name: ${{ matrix.package }} name: ${{ matrix.package }}
needs: discover
runs-on: ubuntu-latest runs-on: ubuntu-latest
permissions: permissions:
contents: read contents: read
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
package: package: ${{ fromJSON(needs.discover.outputs.packages) }}
- "@robonen/eslint"
- "@robonen/tsconfig"
- "@robonen/tsdown"
- "@robonen/crdt"
- "@robonen/encoding"
- "@robonen/fetch"
- "@robonen/platform"
- "@robonen/stdlib"
- "@robonen/docs"
- "@robonen/renovate"
- "@robonen/primitives"
- "@robonen/primitives-playground"
- "@robonen/stories"
- "@robonen/vue"
- "@robonen/writekit"
- "@robonen/writekit-playground"
steps: steps:
- uses: actions/checkout@v7 - uses: actions/checkout@v6
- name: Install pnpm - name: Install pnpm
uses: pnpm/action-setup@v6 uses: pnpm/action-setup@v6
+1 -1
View File
@@ -13,7 +13,7 @@ jobs:
name: Check version changes and publish name: Check version changes and publish
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v7 - uses: actions/checkout@v6
with: with:
fetch-depth: 0 fetch-depth: 0
+3 -4
View File
@@ -22,7 +22,6 @@
"node": ">=24.16.0" "node": ">=24.16.0"
}, },
"type": "module", "type": "module",
"sideEffects": false,
"files": [ "files": [
"dist" "dist"
], ],
@@ -48,15 +47,15 @@
"dependencies": { "dependencies": {
"@eslint/js": "^10.0.1", "@eslint/js": "^10.0.1",
"@stylistic/eslint-plugin": "catalog:", "@stylistic/eslint-plugin": "catalog:",
"@vitest/eslint-plugin": "^1.6.20", "@vitest/eslint-plugin": "^1.6.19",
"eslint-plugin-import-x": "^4.16.2", "eslint-plugin-import-x": "^4.16.2",
"eslint-plugin-n": "^18.1.0", "eslint-plugin-n": "^18.1.0",
"eslint-plugin-regexp": "^3.1.0", "eslint-plugin-regexp": "^3.1.0",
"eslint-plugin-unicorn": "^67.0.0", "eslint-plugin-unicorn": "^65.0.1",
"eslint-plugin-vue": "^10.9.2", "eslint-plugin-vue": "^10.9.2",
"globals": "^17.6.0", "globals": "^17.6.0",
"jiti": "^2.7.0", "jiti": "^2.7.0",
"typescript-eslint": "^8.61.1", "typescript-eslint": "^8.61.0",
"vue-eslint-parser": "^10.4.1" "vue-eslint-parser": "^10.4.1"
}, },
"devDependencies": { "devDependencies": {
-1
View File
@@ -22,7 +22,6 @@
"node": ">=24.16.0" "node": ">=24.16.0"
}, },
"type": "module", "type": "module",
"sideEffects": false,
"files": [ "files": [
"dist" "dist"
], ],
-1
View File
@@ -18,7 +18,6 @@
"node": ">=24.16.0" "node": ">=24.16.0"
}, },
"type": "module", "type": "module",
"sideEffects": false,
"files": [ "files": [
"dist" "dist"
], ],
+1 -1
View File
@@ -15,7 +15,7 @@ const ASCII_ZERO = 0x30;
* luhn('4111 1111 1111 1111'); // true * luhn('4111 1111 1111 1111'); // true
* luhn('4111 1111 1111 1112'); // false * luhn('4111 1111 1111 1112'); // false
* *
* @since 0.0.1 * @since 0.0.2
*/ */
export function luhn(value: string): boolean { export function luhn(value: string): boolean {
const digits = value.replaceAll(NON_DIGIT, ''); const digits = value.replaceAll(NON_DIGIT, '');
-1
View File
@@ -20,7 +20,6 @@
"node": ">=24.16.0" "node": ">=24.16.0"
}, },
"type": "module", "type": "module",
"sideEffects": false,
"files": [ "files": [
"dist" "dist"
], ],
+3 -3
View File
@@ -128,7 +128,7 @@ import type { FetchExecuteMiddleware, FetchHook, FetchHooks, FetchOptions, Fetch
* }); * });
* await billing('/invoices', { method: 'POST', body: { amount: 100 } }); * await billing('/invoices', { method: 'POST', body: { amount: 100 } });
* *
* @since 0.0.1 * @since 0.1.0
*/ */
export function definePlugin< export function definePlugin<
const Name extends string, const Name extends string,
@@ -228,7 +228,7 @@ function applyDefaults(
* Ordering: plugin defaults (in declaration order) → user defaults (user wins). * Ordering: plugin defaults (in declaration order) → user defaults (user wins).
* Headers are merged independently through a single Headers instance. * Headers are merged independently through a single Headers instance.
* *
* @since 0.0.1 * @since 0.1.0
*/ */
export function composePlugins( export function composePlugins(
plugins: readonly FetchPlugin[] | undefined, 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 * @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. * optional user per-request hook(s). Avoids allocating an intermediate array per call.
* *
* @since 0.0.1 * @since 0.1.0
*/ */
export async function runHookPhase<C>( export async function runHookPhase<C>(
instance: ReadonlyArray<FetchHook<C>> | undefined, instance: ReadonlyArray<FetchHook<C>> | undefined,
+1 -1
View File
@@ -44,7 +44,7 @@ function shouldRetryStatus(options: ResolvedFetchOptions, status: number): boole
* *
* Auto-registered by `createFetch`; disable per-request via `retry: false`. * Auto-registered by `createFetch`; disable per-request via `retry: false`.
* *
* @since 0.0.1 * @since 0.1.0
*/ */
export function retryPlugin() { export function retryPlugin() {
return definePlugin({ return definePlugin({
+1 -1
View File
@@ -20,7 +20,7 @@ const baseSignals = new WeakMap<object, AbortSignal | undefined>();
* *
* Auto-registered by `createFetch`; no-op when `timeout` is unset. * Auto-registered by `createFetch`; no-op when `timeout` is unset.
* *
* @since 0.0.1 * @since 0.1.0
*/ */
export function timeoutPlugin() { export function timeoutPlugin() {
return definePlugin({ return definePlugin({
+1 -2
View File
@@ -1,6 +1,6 @@
{ {
"name": "@robonen/platform", "name": "@robonen/platform",
"version": "0.0.5", "version": "0.0.4",
"license": "Apache-2.0", "license": "Apache-2.0",
"description": "Platform dependent utilities for javascript development", "description": "Platform dependent utilities for javascript development",
"keywords": [ "keywords": [
@@ -23,7 +23,6 @@
"node": ">=24.16.0" "node": ">=24.16.0"
}, },
"type": "module", "type": "module",
"sideEffects": false,
"files": [ "files": [
"dist" "dist"
], ],
+2 -2
View File
@@ -5,7 +5,7 @@
* @category Multi * @category Multi
* @description Global object that works in any environment * @description Global object that works in any environment
* *
* @since 0.0.2 * @since 0.0.1
*/ */
export const _global export const _global
= typeof globalThis !== 'undefined' = typeof globalThis !== 'undefined'
@@ -23,6 +23,6 @@ export const _global
* @category Multi * @category Multi
* @description Check if the current environment is the client * @description Check if the current environment is the client
* *
* @since 0.0.2 * @since 0.0.1
*/ */
export const isClient = typeof window !== 'undefined' && typeof document !== 'undefined'; export const isClient = typeof window !== 'undefined' && typeof document !== 'undefined';
+1 -2
View File
@@ -1,6 +1,6 @@
{ {
"name": "@robonen/stdlib", "name": "@robonen/stdlib",
"version": "0.0.10", "version": "0.0.9",
"license": "Apache-2.0", "license": "Apache-2.0",
"description": "A collection of tools, utilities, and helpers for TypeScript", "description": "A collection of tools, utilities, and helpers for TypeScript",
"keywords": [ "keywords": [
@@ -23,7 +23,6 @@
"node": ">=24.16.0" "node": ">=24.16.0"
}, },
"type": "module", "type": "module",
"sideEffects": false,
"files": [ "files": [
"dist" "dist"
], ],
+2 -2
View File
@@ -26,11 +26,11 @@
"@nuxt/fonts": "^0.14.0", "@nuxt/fonts": "^0.14.0",
"@nuxt/kit": "^4.4.8", "@nuxt/kit": "^4.4.8",
"@robonen/eslint": "workspace:*", "@robonen/eslint": "workspace:*",
"@tailwindcss/vite": "^4.3.1", "@tailwindcss/vite": "^4.3.0",
"eslint": "catalog:", "eslint": "catalog:",
"jiti": "^2.7.0", "jiti": "^2.7.0",
"nuxt": "catalog:", "nuxt": "catalog:",
"tailwindcss": "^4.3.1", "tailwindcss": "^4.3.0",
"ts-morph": "^28.0.0", "ts-morph": "^28.0.0",
"vue": "catalog:", "vue": "catalog:",
"vue-router": "^5.1.0" "vue-router": "^5.1.0"
+1 -1
View File
@@ -27,6 +27,6 @@
"test": "renovate-config-validator ./default.json" "test": "renovate-config-validator ./default.json"
}, },
"devDependencies": { "devDependencies": {
"renovate": "^43.228.0" "renovate": "^43.216.1"
} }
} }
+1 -1
View File
@@ -21,7 +21,7 @@
}, },
"type": "module", "type": "module",
"devDependencies": { "devDependencies": {
"@types/node": "^25.9.3", "@types/node": "^25.9.2",
"@vitest/coverage-v8": "catalog:", "@vitest/coverage-v8": "catalog:",
"@vitest/ui": "catalog:", "@vitest/ui": "catalog:",
"citty": "^0.2.2", "citty": "^0.2.2",
+3535 -2765
View File
File diff suppressed because it is too large Load Diff
+8 -22
View File
@@ -6,34 +6,20 @@ packages:
- vue/*/playground - vue/*/playground
- docs - docs
allowBuilds:
'@parcel/watcher': true
core-js-pure: true
dtrace-provider: true
esbuild: true
re2: true
unrs-resolver: true
catalog: catalog:
'@stylistic/eslint-plugin': ^5.10.0 '@stylistic/eslint-plugin': ^5.10.0
'@vitest/browser': ^4.1.9 '@vitest/browser': ^4.1.8
'@vitest/coverage-v8': ^4.1.9 '@vitest/coverage-v8': ^4.1.8
'@vitest/ui': ^4.1.9 '@vitest/ui': ^4.1.8
'@vue/shared': ^3.5.38 '@vue/shared': ^3.5.35
'@vue/test-utils': ^2.4.11 '@vue/test-utils': ^2.4.11
eslint: ^10.5.0 eslint: ^10.4.1
jsdom: ^29.1.1 jsdom: ^29.1.1
nuxt: ^4.4.8 nuxt: ^4.4.8
tsdown: ^0.22.3 tsdown: ^0.22.2
vitest: ^4.1.9 vitest: ^4.1.8
vue: ^3.5.38 vue: ^3.5.35
ignoredBuiltDependencies: ignoredBuiltDependencies:
- '@parcel/watcher' - '@parcel/watcher'
- esbuild - esbuild
minimumReleaseAgeExclude:
- ast-kit@3.0.0
- renovate@43.228.0
- rolldown-plugin-dts@0.26.0
- tsdown@0.22.3
+7 -11
View File
@@ -20,7 +20,6 @@
"node": ">=24.16.0" "node": ">=24.16.0"
}, },
"type": "module", "type": "module",
"sideEffects": false,
"files": [ "files": [
"dist" "dist"
], ],
@@ -59,26 +58,23 @@
"@robonen/tsconfig": "workspace:*", "@robonen/tsconfig": "workspace:*",
"@robonen/tsdown": "workspace:*", "@robonen/tsdown": "workspace:*",
"@vitest/browser": "catalog:", "@vitest/browser": "catalog:",
"@vitest/browser-playwright": "^4.1.9", "@vitest/browser-playwright": "^4.1.8",
"@vue/test-utils": "catalog:", "@vue/test-utils": "catalog:",
"axe-core": "^4.12.1", "axe-core": "^4.12.0",
"eslint": "catalog:", "eslint": "catalog:",
"playwright": "^1.61.0", "playwright": "^1.60.0",
"tsdown": "catalog:", "tsdown": "catalog:",
"unplugin-vue": "^7.2.0", "unplugin-vue": "^7.2.0",
"vitest-browser-vue": "^2.1.0", "vitest-browser-vue": "^2.1.0",
"vue": "catalog:", "vue-tsc": "^3.3.4"
"vue-tsc": "^3.3.5"
}, },
"dependencies": { "dependencies": {
"@floating-ui/vue": "^2.0.0", "@floating-ui/vue": "^1.1.11",
"@robonen/encoding": "workspace:*", "@robonen/encoding": "workspace:*",
"@robonen/platform": "workspace:*", "@robonen/platform": "workspace:*",
"@robonen/stdlib": "workspace:*", "@robonen/stdlib": "workspace:*",
"@robonen/vue": "workspace:*", "@robonen/vue": "workspace:*",
"@vue/shared": "catalog:" "@vue/shared": "catalog:",
}, "vue": "catalog:"
"peerDependencies": {
"vue": "^3.5"
} }
} }
+3 -3
View File
@@ -17,10 +17,10 @@
}, },
"devDependencies": { "devDependencies": {
"@robonen/tsconfig": "workspace:*", "@robonen/tsconfig": "workspace:*",
"@tailwindcss/vite": "^4.3.1", "@tailwindcss/vite": "^4.3.0",
"@vitejs/plugin-vue": "^6.0.7", "@vitejs/plugin-vue": "^6.0.7",
"tailwindcss": "^4.3.1", "tailwindcss": "^4.3.0",
"vite": "^8.0.16", "vite": "^8.0.16",
"vue-tsc": "^3.3.5" "vue-tsc": "^3.3.4"
} }
} }
@@ -12,14 +12,8 @@ import {
CalendarHeadCell, CalendarHeadCell,
CalendarRoot, CalendarRoot,
} from '../index'; } from '../index';
import { nativeDateAdapter } from '../../../utilities/config-provider';
import { findFirstFocusableDate, getLocaleWeekStartsOn, toIsoDate } from '../utils'; import { findFirstFocusableDate, getLocaleWeekStartsOn, toIsoDate } from '../utils';
// A date adapter whose "today" sits far outside any month exercised below, so
// the roving-tabindex fallback never anchors on the real system date (which
// would otherwise make date-sensitive expectations flaky).
const fixedTodayAdapter = { ...nativeDateAdapter, now: () => new Date(2020, 0, 1) };
function mountCalendar( function mountCalendar(
props: Record<string, unknown> = {}, props: Record<string, unknown> = {},
options: Record<string, unknown> = {}, options: Record<string, unknown> = {},
@@ -209,7 +203,6 @@ describe('Calendar — roving fallback tabindex', () => {
const w = mountCalendar({ const w = mountCalendar({
defaultPlaceholder: new Date(2026, 5, 1), defaultPlaceholder: new Date(2026, 5, 1),
isDateDisabled: (d: Date) => d.getMonth() === 5 && d.getDate() < 16, isDateDisabled: (d: Date) => d.getMonth() === 5 && d.getDate() < 16,
dateAdapter: fixedTodayAdapter,
}); });
const focusable = w.findAll('[data-primitives-calendar-cell-trigger][tabindex="0"]'); const focusable = w.findAll('[data-primitives-calendar-cell-trigger][tabindex="0"]');
expect(focusable).toHaveLength(1); expect(focusable).toHaveLength(1);
@@ -149,27 +149,19 @@ describe('scroll-area — ref forwarding', () => {
describe('scroll-area — glimpse type', () => { describe('scroll-area — glimpse type', () => {
it('accepts type="glimpse" and reveals scrollbars on pointer enter', async () => { it('accepts type="glimpse" and reveals scrollbars on pointer enter', async () => {
const w = track(mount(makeApp({ type: 'glimpse', scrollHideDelay: 5000 }), { attachTo: document.body })); track(mount(makeApp({ type: 'glimpse', scrollHideDelay: 5000 }), { attachTo: document.body }));
await waitFrames(); await waitFrames();
const root = w.element as HTMLElement; const root = document.querySelector('[dir]') as HTMLElement;
root.dispatchEvent(new PointerEvent('pointerenter')); root.dispatchEvent(new PointerEvent('pointerenter'));
await waitFrames(); await waitFrames();
// Scope to this component's root: browser-mode suites share one document, expect(document.querySelectorAll('[data-state="visible"]').length).toBeGreaterThan(0);
// 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 when the pointer is away', async () => { it('glimpse stays hidden before any interaction', async () => {
const w = track(mount(makeApp({ type: 'glimpse', scrollHideDelay: 5000 }), { attachTo: document.body })); track(mount(makeApp({ type: 'glimpse', scrollHideDelay: 5000 }), { attachTo: document.body }));
const root = w.element as HTMLElement;
// Browser mode uses a real cursor: the area mounts at the top-left, so a
// leftover pointer from a previous suite can land on it and fire a stray
// `pointerenter` (revealing the glimpse). Let that settle, then assert the
// deterministic "pointer not over the area" state via `pointerleave`.
await waitFrames(); await waitFrames();
root.dispatchEvent(new PointerEvent('pointerleave')); // No pointer enter / scroll => no visible scrollbar yet.
await waitFrames(); expect(document.querySelectorAll('[data-state="visible"]').length).toBe(0);
expect(root.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 * @param {MaybeComputedElementRef} target Element whose siblings should be aria-hidden
* *
* @since 0.0.1 * @since 0.0.14
*/ */
export function useHideOthers(target: MaybeComputedElementRef): void { export function useHideOthers(target: MaybeComputedElementRef): void {
if (!defaultWindow) return; if (!defaultWindow) return;
+1 -4
View File
@@ -11,10 +11,7 @@ export default defineConfig({
dts: { vue: true }, dts: { vue: true },
deps: { deps: {
neverBundle: ['vue'], neverBundle: ['vue'],
// `@robonen/*` stay external (deduped by the package manager); only the alwaysBundle: [/^@robonen\//, '@vue/shared'],
// stateless `@vue/shared` helpers are inlined (a Vue internal consumers
// don't install directly, so it can't be externalized reliably).
alwaysBundle: ['@vue/shared'],
}, },
inputOptions: { inputOptions: {
resolve: { resolve: {
-3
View File
@@ -13,9 +13,6 @@ export default defineConfig({
'@': resolve(__dirname, './src'), '@': resolve(__dirname, './src'),
}, },
}, },
optimizeDeps: {
include: ['@robonen/vue'],
},
test: { test: {
browser: { browser: {
enabled: true, enabled: true,
+4 -4
View File
@@ -19,12 +19,12 @@
"devDependencies": { "devDependencies": {
"@robonen/eslint": "workspace:*", "@robonen/eslint": "workspace:*",
"@robonen/tsconfig": "workspace:*", "@robonen/tsconfig": "workspace:*",
"@storybook/addon-a11y": "^10.4.6", "@storybook/addon-a11y": "^10.4.2",
"@storybook/addon-docs": "^10.4.6", "@storybook/addon-docs": "^10.4.2",
"@storybook/vue3-vite": "^10.4.6", "@storybook/vue3-vite": "^10.4.2",
"@vitejs/plugin-vue": "^6.0.7", "@vitejs/plugin-vue": "^6.0.7",
"eslint": "catalog:", "eslint": "catalog:",
"storybook": "^10.4.6", "storybook": "^10.4.2",
"vite": "^8.0.16" "vite": "^8.0.16"
} }
} }
+4 -8
View File
@@ -1,6 +1,6 @@
{ {
"name": "@robonen/vue", "name": "@robonen/vue",
"version": "0.0.14", "version": "0.0.13",
"license": "Apache-2.0", "license": "Apache-2.0",
"description": "Collection of powerful tools for Vue", "description": "Collection of powerful tools for Vue",
"keywords": [ "keywords": [
@@ -21,7 +21,6 @@
"node": ">=24.16.0" "node": ">=24.16.0"
}, },
"type": "module", "type": "module",
"sideEffects": false,
"files": [ "files": [
"dist" "dist"
], ],
@@ -50,14 +49,11 @@
"@robonen/tsdown": "workspace:*", "@robonen/tsdown": "workspace:*",
"@vue/test-utils": "catalog:", "@vue/test-utils": "catalog:",
"eslint": "catalog:", "eslint": "catalog:",
"tsdown": "catalog:", "tsdown": "catalog:"
"vue": "catalog:"
}, },
"dependencies": { "dependencies": {
"@robonen/platform": "workspace:*", "@robonen/platform": "workspace:*",
"@robonen/stdlib": "workspace:*" "@robonen/stdlib": "workspace:*",
}, "vue": "catalog:"
"peerDependencies": {
"vue": "^3.5"
} }
} }
@@ -167,7 +167,7 @@ const RESERVED_KEYS = [
* // Shorthand: third argument is the duration in milliseconds * // Shorthand: third argument is the duration in milliseconds
* useAnimate(el, { opacity: [0, 1] }, 500); * useAnimate(el, { opacity: [0, 1] }, 500);
* *
* @since 0.0.14 * @since 0.0.15
*/ */
export function useAnimate( export function useAnimate(
target: MaybeComputedElementRef, target: MaybeComputedElementRef,
@@ -81,7 +81,7 @@ export interface UseCountdownReturn extends ResumableActions {
* onComplete: () => console.log('done'), * onComplete: () => console.log('done'),
* }); * });
* *
* @since 0.0.14 * @since 0.0.15
*/ */
export function useCountdown( export function useCountdown(
initialCountdown: MaybeRefOrGetter<number>, initialCountdown: MaybeRefOrGetter<number>,
@@ -44,15 +44,15 @@ export type UseDateFormatReturn = ComputedRef<string>;
// Matches a token, or a `[literal]` escape that is emitted verbatim. // Matches a token, or a `[literal]` escape that is emitted verbatim.
const REGEX_FORMAT const REGEX_FORMAT
= /[YMDHhms]o|\[([^\]]+)\]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a{1,2}|A{1,2}|m{1,2}|s{1,2}|z{1,4}|SSS/g; = /* #__PURE__ */ /[YMDHhms]o|\[([^\]]+)\]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a{1,2}|A{1,2}|m{1,2}|s{1,2}|z{1,4}|SSS/g;
// Loose ISO-ish parser used for date strings without a trailing `Z`. The optional // Loose ISO-ish parser used for date strings without a trailing `Z`. The optional
// separators make adjacent digit groups technically "misleading" to the linter, // separators make adjacent digit groups technically "misleading" to the linter,
// but this is the deliberate lenient dayjs parser (accepts `2024-01-01` and // but this is the deliberate lenient dayjs parser (accepts `2024-01-01` and
// `20240101`); JS lacks possessive quantifiers to disambiguate it. // `20240101`); JS lacks possessive quantifiers to disambiguate it.
// eslint-disable-next-line regexp/no-misleading-capturing-group // eslint-disable-next-line regexp/no-misleading-capturing-group
const REGEX_PARSE = /^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[T\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/i; const REGEX_PARSE = /* #__PURE__ */ /^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[T\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/i;
const REGEX_ISO_SUFFIX = /z$/i; const REGEX_ISO_SUFFIX = /* #__PURE__ */ /z$/i;
const ORDINAL_SUFFIXES = ['th', 'st', 'nd', 'rd'] as const; const ORDINAL_SUFFIXES = ['th', 'st', 'nd', 'rd'] as const;
@@ -207,7 +207,7 @@ export function formatDate(
* customMeridiem: (h) => (h < 12 ? 'morning' : 'evening'), * customMeridiem: (h) => (h < 12 ? 'morning' : 'evening'),
* }); * });
* *
* @since 0.0.14 * @since 0.0.15
*/ */
export function useDateFormat( export function useDateFormat(
date: MaybeRefOrGetter<DateLike>, date: MaybeRefOrGetter<DateLike>,
@@ -59,7 +59,7 @@ export type UseIntervalReturn = Readonly<ShallowRef<number>> | UseIntervalContro
* @example * @example
* const { counter, isActive, pause, resume, reset } = useInterval(1000, { controls: true }); * const { counter, isActive, pause, resume, reset } = useInterval(1000, { controls: true });
* *
* @since 0.0.14 * @since 0.0.15
*/ */
export function useInterval(interval?: MaybeRefOrGetter<number>, options?: UseIntervalOptions<false>): Readonly<ShallowRef<number>>; export function useInterval(interval?: MaybeRefOrGetter<number>, options?: UseIntervalOptions<false>): Readonly<ShallowRef<number>>;
export function useInterval(interval: MaybeRefOrGetter<number>, options: UseIntervalOptions<true>): UseIntervalControls; 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 * // Run a callback on every update
* useNow({ interval: 1000, callback: date => console.log(date.toISOString()) }); * useNow({ interval: 1000, callback: date => console.log(date.toISOString()) });
* *
* @since 0.0.14 * @since 0.0.15
*/ */
export function useNow(options?: UseNowOptions<false>): Ref<Date>; export function useNow(options?: UseNowOptions<false>): Ref<Date>;
export function useNow(options: UseNowOptions<true>): UseNowControls; export function useNow(options: UseNowOptions<true>): UseNowControls;
@@ -165,7 +165,7 @@ const DEFAULT_UNITS: Array<UseTimeAgoUnit<UseTimeAgoUnitName>> = [
{ max: Number.POSITIVE_INFINITY, value: 31536000000, name: 'year' }, { max: Number.POSITIVE_INFINITY, value: 31536000000, name: 'year' },
]; ];
const REGEX_DIGIT = /\d/; const REGEX_DIGIT = /* #__PURE__ */ /\d/;
const DEFAULT_MESSAGES: UseTimeAgoMessages<UseTimeAgoUnitName> = { const DEFAULT_MESSAGES: UseTimeAgoMessages<UseTimeAgoUnitName> = {
justNow: 'just now', justNow: 'just now',
@@ -197,7 +197,7 @@ function defaultFullDateFormatter(date: Date): string {
* @example * @example
* formatTimeAgo(new Date(Date.now() - 3 * 60_000)); // '3 minutes ago' * formatTimeAgo(new Date(Date.now() - 3 * 60_000)); // '3 minutes ago'
* *
* @since 0.0.14 * @since 0.0.15
*/ */
export function formatTimeAgo<UnitNames extends string = UseTimeAgoUnitName>( export function formatTimeAgo<UnitNames extends string = UseTimeAgoUnitName>(
from: Date, from: Date,
@@ -303,7 +303,7 @@ export function formatTimeAgo<UnitNames extends string = UseTimeAgoUnitName>(
* fullDateFormatter: d => d.toLocaleDateString('fr-FR'), * fullDateFormatter: d => d.toLocaleDateString('fr-FR'),
* }); * });
* *
* @since 0.0.14 * @since 0.0.15
*/ */
export function useTimeAgo<UnitNames extends string = UseTimeAgoUnitName>( export function useTimeAgo<UnitNames extends string = UseTimeAgoUnitName>(
time: MaybeRefOrGetter<Date | number | string>, time: MaybeRefOrGetter<Date | number | string>,
@@ -61,7 +61,7 @@ export type UseTimeoutReturn
* // Run a callback when the timeout elapses * // Run a callback when the timeout elapses
* useTimeout(5000, { callback: refresh }); * useTimeout(5000, { callback: refresh });
* *
* @since 0.0.14 * @since 0.0.15
*/ */
export function useTimeout(interval?: MaybeRefOrGetter<number>, options?: UseTimeoutOptions<false>): ComputedRef<boolean>; export function useTimeout(interval?: MaybeRefOrGetter<number>, options?: UseTimeoutOptions<false>): ComputedRef<boolean>;
export function useTimeout(interval: MaybeRefOrGetter<number>, options: UseTimeoutOptions<true>): UseTimeoutControls; 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 * // Fire once now and again after the delay
* useTimeoutFn(refresh, 5000, { immediateCallback: true }); * useTimeoutFn(refresh, 5000, { immediateCallback: true });
* *
* @since 0.0.14 * @since 0.0.15
*/ */
export function useTimeoutFn<T extends AnyFunction>( export function useTimeoutFn<T extends AnyFunction>(
cb: T, cb: T,
@@ -82,7 +82,7 @@ export type UseTimestampReturn<Controls extends boolean> = Controls extends true
* const offset = ref(0); * const offset = ref(0);
* const now = useTimestamp({ offset }); * const now = useTimestamp({ offset });
* *
* @since 0.0.14 * @since 0.0.15
*/ */
export function useTimestamp(options?: UseTimestampOptions<false>): Ref<number>; export function useTimestamp(options?: UseTimestampOptions<false>): Ref<number>;
export function useTimestamp(options: UseTimestampOptions<true>): UseTimestampControls; 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 color = ref([0, 0, 0]);
* const animated = useTransition(color, { duration: 1000 }); * const animated = useTransition(color, { duration: 1000 });
* *
* @since 0.0.14 * @since 0.0.15
*/ */
export function useTransition<T extends TransitionValue>( export function useTransition<T extends TransitionValue>(
source: MaybeRefOrGetter<T>, source: MaybeRefOrGetter<T>,
@@ -58,7 +58,7 @@ function isArrayDifferenceOptions<T>(value: unknown): value is UseArrayDifferenc
* const b = ref([2, 3, 4]); * const b = ref([2, 3, 4]);
* const symmetric = useArrayDifference(a, b, { symmetric: true }); // [1, 4] * const symmetric = useArrayDifference(a, b, { symmetric: true }); // [1, 4]
* *
* @since 0.0.14 * @since 0.0.15
*/ */
export function useArrayDifference<T>( export function useArrayDifference<T>(
list: MaybeRefOrGetter<T[]>, list: MaybeRefOrGetter<T[]>,
@@ -20,7 +20,7 @@ export type UseArrayEveryReturn = ComputedRef<boolean>;
* const items = [ref(2), ref(4), ref(6)]; * const items = [ref(2), ref(4), ref(6)];
* const allEven = useArrayEvery(items, n => n % 2 === 0); // true * const allEven = useArrayEvery(items, n => n % 2 === 0); // true
* *
* @since 0.0.14 * @since 0.0.15
*/ */
export function useArrayEvery<T>( export function useArrayEvery<T>(
list: MaybeRefOrGetter<Array<MaybeRefOrGetter<T>>>, list: MaybeRefOrGetter<Array<MaybeRefOrGetter<T>>>,
@@ -14,7 +14,7 @@ import type { ComputedRef, MaybeRefOrGetter } from 'vue';
* const list = ref([1, 2, 3, 4]); * const list = ref([1, 2, 3, 4]);
* const even = useArrayFilter(list, n => n % 2 === 0); // [2, 4] * const even = useArrayFilter(list, n => n % 2 === 0); // [2, 4]
* *
* @since 0.0.14 * @since 0.0.15
*/ */
export function useArrayFilter<T>( export function useArrayFilter<T>(
list: MaybeRefOrGetter<Array<MaybeRefOrGetter<T>>>, list: MaybeRefOrGetter<Array<MaybeRefOrGetter<T>>>,
@@ -14,7 +14,7 @@ import type { ComputedRef, MaybeRefOrGetter } from 'vue';
* const list = ref([1, 2, 3]); * const list = ref([1, 2, 3]);
* const found = useArrayFind(list, n => n > 1); // 2 * const found = useArrayFind(list, n => n > 1); // 2
* *
* @since 0.0.14 * @since 0.0.15
*/ */
export function useArrayFind<T>( export function useArrayFind<T>(
list: MaybeRefOrGetter<Array<MaybeRefOrGetter<T>>>, list: MaybeRefOrGetter<Array<MaybeRefOrGetter<T>>>,
@@ -16,7 +16,7 @@ export type UseArrayFindIndexReturn = ComputedRef<number>;
* const list = ref([1, 2, 3]); * const list = ref([1, 2, 3]);
* const index = useArrayFindIndex(list, n => n > 1); // 1 * const index = useArrayFindIndex(list, n => n > 1); // 1
* *
* @since 0.0.14 * @since 0.0.15
*/ */
export function useArrayFindIndex<T>( export function useArrayFindIndex<T>(
list: MaybeRefOrGetter<Array<MaybeRefOrGetter<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 list = ref([1, 2, 3, 4]);
* const found = useArrayFindLast(list, n => n % 2 === 0); // 4 * const found = useArrayFindLast(list, n => n % 2 === 0); // 4
* *
* @since 0.0.14 * @since 0.0.15
*/ */
export function useArrayFindLast<T>( export function useArrayFindLast<T>(
list: MaybeRefOrGetter<Array<MaybeRefOrGetter<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 list = ref(['a', 'b', 'a']);
* const fromSecond = useArrayIncludes(list, 'a', { fromIndex: 1 }); // true * const fromSecond = useArrayIncludes(list, 'a', { fromIndex: 1 }); // true
* *
* @since 0.0.14 * @since 0.0.15
*/ */
export function useArrayIncludes<T, V = T>( export function useArrayIncludes<T, V = T>(
list: MaybeRefOrGetter<Array<MaybeRefOrGetter<T>>>, list: MaybeRefOrGetter<Array<MaybeRefOrGetter<T>>>,
@@ -18,7 +18,7 @@ export type UseArrayJoinReturn = ComputedRef<string>;
* const sep = ref('-'); * const sep = ref('-');
* const joined = useArrayJoin(list, sep); // 'a-b-c' * const joined = useArrayJoin(list, sep); // 'a-b-c'
* *
* @since 0.0.14 * @since 0.0.15
*/ */
export function useArrayJoin( export function useArrayJoin(
list: MaybeRefOrGetter<Array<MaybeRefOrGetter<unknown>>>, list: MaybeRefOrGetter<Array<MaybeRefOrGetter<unknown>>>,
@@ -14,7 +14,7 @@ import type { ComputedRef, MaybeRefOrGetter } from 'vue';
* const list = ref([1, 2, 3]); * const list = ref([1, 2, 3]);
* const doubled = useArrayMap(list, n => n * 2); // [2, 4, 6] * const doubled = useArrayMap(list, n => n * 2); // [2, 4, 6]
* *
* @since 0.0.14 * @since 0.0.15
*/ */
export function useArrayMap<T, U = T>( export function useArrayMap<T, U = T>(
list: MaybeRefOrGetter<Array<MaybeRefOrGetter<T>>>, list: MaybeRefOrGetter<Array<MaybeRefOrGetter<T>>>,
@@ -19,7 +19,7 @@ export type UseArrayReduceReturn<T> = ComputedRef<T>;
* const list = ref([1, 2, 3, 4]); * const list = ref([1, 2, 3, 4]);
* const sum = useArrayReduce(list, (acc, n) => acc + n); // 10 * const sum = useArrayReduce(list, (acc, n) => acc + n); // 10
* *
* @since 0.0.14 * @since 0.0.15
*/ */
export function useArrayReduce<T>( export function useArrayReduce<T>(
list: MaybeRefOrGetter<Array<MaybeRefOrGetter<T>>>, list: MaybeRefOrGetter<Array<MaybeRefOrGetter<T>>>,
@@ -40,7 +40,7 @@ export function useArrayReduce<T>(
* const list = ref([1, 2, 3, 4]); * const list = ref([1, 2, 3, 4]);
* const sum = useArrayReduce(list, (acc, n) => acc + n, 100); // 110 * const sum = useArrayReduce(list, (acc, n) => acc + n, 100); // 110
* *
* @since 0.0.14 * @since 0.0.15
*/ */
export function useArrayReduce<T, U>( export function useArrayReduce<T, U>(
list: MaybeRefOrGetter<Array<MaybeRefOrGetter<T>>>, list: MaybeRefOrGetter<Array<MaybeRefOrGetter<T>>>,
@@ -20,7 +20,7 @@ export type UseArraySomeReturn = ComputedRef<boolean>;
* const items = [ref(1), ref(3), ref(5)]; * const items = [ref(1), ref(3), ref(5)];
* const hasEven = useArraySome(items, n => n % 2 === 0); // false * const hasEven = useArraySome(items, n => n % 2 === 0); // false
* *
* @since 0.0.14 * @since 0.0.15
*/ */
export function useArraySome<T>( export function useArraySome<T>(
list: MaybeRefOrGetter<Array<MaybeRefOrGetter<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 list = ref([1.1, 1.4, 2.2]);
* const byFloor = useArrayUnique(list, (a, b) => Math.floor(a) === Math.floor(b)); // [1.1, 2.2] * const byFloor = useArrayUnique(list, (a, b) => Math.floor(a) === Math.floor(b)); // [1.1, 2.2]
* *
* @since 0.0.14 * @since 0.0.15
*/ */
export function useArrayUnique<T>( export function useArrayUnique<T>(
list: MaybeRefOrGetter<Array<MaybeRefOrGetter<T>>>, list: MaybeRefOrGetter<Array<MaybeRefOrGetter<T>>>,
@@ -99,7 +99,7 @@ const defaultSortFn: UseSortedFn = <T>(source: T[], compareFn: UseSortedCompareF
* useSorted(list, { dirty: true }); * useSorted(list, { dirty: true });
* // list.value is now [1, 2, 3] * // list.value is now [1, 2, 3]
* *
* @since 0.0.14 * @since 0.0.15
*/ */
export function useSorted<T = unknown>(source: Ref<T[]>, compareFn?: UseSortedCompareFn<T>): Ref<T[]>; 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[]>; 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 bp = useBreakpoints({ mobile: 0, tablet: 640, desktop: 1024 });
* const active = bp.active(); // ComputedRef<'mobile' | 'tablet' | 'desktop' | ''> * const active = bp.active(); // ComputedRef<'mobile' | 'tablet' | 'desktop' | ''>
* *
* @since 0.0.14 * @since 0.0.15
*/ */
export function useBreakpoints<K extends string>( export function useBreakpoints<K extends string>(
breakpoints: Breakpoints<K>, breakpoints: Breakpoints<K>,
@@ -76,7 +76,7 @@ export interface UseClipboardReturn<Optional extends boolean> {
* // Copy a lazily/asynchronously resolved value * // Copy a lazily/asynchronously resolved value
* copy(async () => (await fetch('/token').then(r => r.text()))); * copy(async () => (await fetch('/token').then(r => r.text())));
* *
* @since 0.0.14 * @since 0.0.15
*/ */
export function useClipboard(options?: UseClipboardOptions<undefined>): UseClipboardReturn<false>; export function useClipboard(options?: UseClipboardOptions<undefined>): UseClipboardReturn<false>;
export function useClipboard(options: UseClipboardOptions<MaybeRefOrGetter<string>>): UseClipboardReturn<true>; export function useClipboard(options: UseClipboardOptions<MaybeRefOrGetter<string>>): UseClipboardReturn<true>;
@@ -96,7 +96,7 @@ export interface UseClipboardItemsReturn<Optional extends boolean> {
* const { content } = useClipboardItems({ read: true }); * const { content } = useClipboardItems({ read: true });
* copy(async () => buildClipboardItems()); * copy(async () => buildClipboardItems());
* *
* @since 0.0.14 * @since 0.0.15
*/ */
export function useClipboardItems(options?: UseClipboardItemsOptions<undefined>): UseClipboardItemsReturn<false>; export function useClipboardItems(options?: UseClipboardItemsOptions<undefined>): UseClipboardItemsReturn<false>;
export function useClipboardItems(options: UseClipboardItemsOptions<MaybeRefOrGetter<ClipboardItems>>): UseClipboardItemsReturn<true>; export function useClipboardItems(options: UseClipboardItemsOptions<MaybeRefOrGetter<ClipboardItems>>): UseClipboardItemsReturn<true>;
@@ -76,7 +76,7 @@ export interface UseCloseWatcherReturn {
* // Programmatically request a close * // Programmatically request a close
* close(); * close();
* *
* @since 0.0.14 * @since 0.0.15
*/ */
export function useCloseWatcher(options: UseCloseWatcherOptions = {}): UseCloseWatcherReturn { export function useCloseWatcher(options: UseCloseWatcherOptions = {}): UseCloseWatcherReturn {
const { window = defaultWindow } = options; const { window = defaultWindow } = options;
@@ -120,7 +120,7 @@ const CSS_DISABLE_TRANS = '*,*::before,*::after{-webkit-transition:none!importan
* // Read the resolved system + effective state * // Read the resolved system + effective state
* const { system, state } = useColorMode(); * const { system, state } = useColorMode();
* *
* @since 0.0.14 * @since 0.0.15
*/ */
export function useColorMode<T extends string = BasicColorMode>( export function useColorMode<T extends string = BasicColorMode>(
options: UseColorModeOptions<T> = {}, options: UseColorModeOptions<T> = {},
@@ -42,7 +42,7 @@ export interface UseCssVarReturn extends WritableComputedRef<string | null | und
* @example * @example
* const theme = useCssVar('--theme', null, { initialValue: 'light', observe: true }); * const theme = useCssVar('--theme', null, { initialValue: 'light', observe: true });
* *
* @since 0.0.14 * @since 0.0.15
*/ */
export function useCssVar( export function useCssVar(
prop: MaybeRefOrGetter<string | null | undefined>, prop: MaybeRefOrGetter<string | null | undefined>,
@@ -58,7 +58,7 @@ export type UseDarkReturn = WritableComputedRef<boolean>;
* const isDark = useDark(); * const isDark = useDark();
* const toggleDark = useToggle(isDark); * const toggleDark = useToggle(isDark);
* *
* @since 0.0.14 * @since 0.0.15
*/ */
export function useDark(options: UseDarkOptions = {}): UseDarkReturn { export function useDark(options: UseDarkOptions = {}): UseDarkReturn {
const { const {
@@ -109,7 +109,7 @@ export interface UseDocumentPiPReturn {
* pipWindow.value.document.body.append(playerEl); * pipWindow.value.document.body.append(playerEl);
* }); * });
* *
* @since 0.0.14 * @since 0.0.15
*/ */
export function useDocumentPiP(options: UseDocumentPiPOptions = {}): UseDocumentPiPReturn { export function useDocumentPiP(options: UseDocumentPiPOptions = {}): UseDocumentPiPReturn {
const { const {
@@ -67,7 +67,7 @@ export interface UseEyeDropperReturn {
* if (isSupported.value) * if (isSupported.value)
* await open(); * await open();
* *
* @since 0.0.14 * @since 0.0.15
*/ */
export function useEyeDropper(options: UseEyeDropperOptions = {}): UseEyeDropperReturn { export function useEyeDropper(options: UseEyeDropperOptions = {}): UseEyeDropperReturn {
const { const {
@@ -44,7 +44,7 @@ const FILE_EXTENSION_RE = /\.([a-z0-9]+)$/i;
* const isDark = useDark(); * const isDark = useDark();
* const favicon = useFavicon(() => isDark.value ? '/dark.png' : '/light.png'); * const favicon = useFavicon(() => isDark.value ? '/dark.png' : '/light.png');
* *
* @since 0.0.14 * @since 0.0.15
*/ */
export function useFavicon( export function useFavicon(
newIcon: MaybeRefOrGetter<string | null | undefined>, newIcon: MaybeRefOrGetter<string | null | undefined>,
@@ -159,7 +159,7 @@ function toFileList(files: File[] | FileList | undefined): FileList | null {
* const { open } = useFileDialog(); * const { open } = useFileDialog();
* open({ multiple: false, accept: '.pdf' }); * open({ multiple: false, accept: '.pdf' });
* *
* @since 0.0.14 * @since 0.0.15
*/ */
export function useFileDialog(options: UseFileDialogOptions = {}): UseFileDialogReturn { export function useFileDialog(options: UseFileDialogOptions = {}): UseFileDialogReturn {
const { const {
@@ -186,7 +186,7 @@ export interface UseFileSystemAccessReturn<T = string | ArrayBuffer | Blob> {
* // Read raw bytes * // Read raw bytes
* const { data } = useFileSystemAccess({ dataType: 'ArrayBuffer' }); * const { data } = useFileSystemAccess({ dataType: 'ArrayBuffer' });
* *
* @since 0.0.14 * @since 0.0.15
*/ */
export function useFileSystemAccess(): UseFileSystemAccessReturn<string | ArrayBuffer | Blob>; export function useFileSystemAccess(): UseFileSystemAccessReturn<string | ArrayBuffer | Blob>;
export function useFileSystemAccess(options: UseFileSystemAccessOptions & { dataType: 'Text' }): UseFileSystemAccessReturn<string>; 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 * // Fullscreen the whole page
* const { toggle } = useFullscreen(); * const { toggle } = useFullscreen();
* *
* @since 0.0.14 * @since 0.0.15
*/ */
export function useFullscreen( export function useFullscreen(
target?: MaybeComputedElementRef, target?: MaybeComputedElementRef,
@@ -113,7 +113,7 @@ function loadImage(options: UseImageOptions, ctx: LoadImageContext): Promise<HTM
* const src = ref('/a.png'); * const src = ref('/a.png');
* const { state } = useImage(() => ({ src: src.value, alt: 'photo' })); * const { state } = useImage(() => ({ src: src.value, alt: 'photo' }));
* *
* @since 0.0.14 * @since 0.0.15
*/ */
export function useImage( export function useImage(
options: MaybeRefOrGetter<UseImageOptions>, options: MaybeRefOrGetter<UseImageOptions>,
@@ -113,7 +113,7 @@ export interface UseLocalFontsReturn {
* const { fonts, query } = useLocalFonts(); * const { fonts, query } = useLocalFonts();
* await query({ postscriptNames: ['Arial-BoldMT'] }); * await query({ postscriptNames: ['Arial-BoldMT'] });
* *
* @since 0.0.14 * @since 0.0.15
*/ */
export function useLocalFonts(options: UseLocalFontsOptions = {}): UseLocalFontsReturn { export function useLocalFonts(options: UseLocalFontsOptions = {}): UseLocalFontsReturn {
const { const {
@@ -61,7 +61,7 @@ function matchSsrWidth(query: string, width: number): boolean {
* // Resolve width queries during SSR to avoid hydration flicker * // Resolve width queries during SSR to avoid hydration flicker
* const isWide = useMediaQuery('(min-width: 1024px)', { ssrWidth: 1280 }); * const isWide = useMediaQuery('(min-width: 1024px)', { ssrWidth: 1280 });
* *
* @since 0.0.14 * @since 0.0.15
*/ */
export function useMediaQuery( export function useMediaQuery(
query: MaybeRefOrGetter<string>, query: MaybeRefOrGetter<string>,
@@ -21,7 +21,7 @@ export type UseObjectUrlReturn = Readonly<ShallowRef<string | undefined>>;
* const file = shallowRef<File>(); * const file = shallowRef<File>();
* const url = useObjectUrl(file); * const url = useObjectUrl(file);
* *
* @since 0.0.14 * @since 0.0.15
*/ */
export function useObjectUrl( export function useObjectUrl(
object: MaybeRefOrGetter<Blob | MediaSource | null | undefined>, object: MaybeRefOrGetter<Blob | MediaSource | null | undefined>,
@@ -151,7 +151,7 @@ const DEFAULT_TRANSPORT: OTPTransportType[] = ['sms'];
* const { receive } = useOtpCredentials(); * const { receive } = useOtpCredentials();
* receive({ signal: AbortSignal.timeout(30_000) }); * receive({ signal: AbortSignal.timeout(30_000) });
* *
* @since 0.0.14 * @since 0.0.15
*/ */
export function useOtpCredentials(options: UseOtpCredentialsOptions = {}): UseOtpCredentialsReturn { export function useOtpCredentials(options: UseOtpCredentialsOptions = {}): UseOtpCredentialsReturn {
const { const {
@@ -79,7 +79,7 @@ export interface UsePermissionReturnWithControls {
* @example * @example
* const { state, isSupported, query } = usePermission('camera', { controls: true }); * const { state, isSupported, query } = usePermission('camera', { controls: true });
* *
* @since 0.0.14 * @since 0.0.15
*/ */
export function usePermission( export function usePermission(
permissionDesc: GeneralPermissionDescriptor | GeneralPermissionDescriptor['name'], permissionDesc: GeneralPermissionDescriptor | GeneralPermissionDescriptor['name'],
@@ -16,7 +16,7 @@ export type ColorSchemePreference = 'dark' | 'light' | 'no-preference';
* @example * @example
* const scheme = usePreferredColorScheme(); * const scheme = usePreferredColorScheme();
* *
* @since 0.0.14 * @since 0.0.15
*/ */
export function usePreferredColorScheme( export function usePreferredColorScheme(
options: ConfigurableWindow = {}, options: ConfigurableWindow = {},
@@ -32,7 +32,7 @@ export interface UsePreferredContrastOptions extends UseMediaQueryOptions {
* // Provide an SSR fallback to avoid hydration flicker * // Provide an SSR fallback to avoid hydration flicker
* const contrast = usePreferredContrast({ ssrContrast: 'more' }); * const contrast = usePreferredContrast({ ssrContrast: 'more' });
* *
* @since 0.0.14 * @since 0.0.15
*/ */
export function usePreferredContrast( export function usePreferredContrast(
options: UsePreferredContrastOptions = {}, options: UsePreferredContrastOptions = {},
@@ -13,7 +13,7 @@ import { useMediaQuery } from '@/composables/browser/useMediaQuery';
* @example * @example
* const isDark = usePreferredDark(); * const isDark = usePreferredDark();
* *
* @since 0.0.14 * @since 0.0.15
*/ */
export function usePreferredDark(options: ConfigurableWindow = {}): Ref<boolean> { export function usePreferredDark(options: ConfigurableWindow = {}): Ref<boolean> {
return useMediaQuery('(prefers-color-scheme: dark)', options); 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) * // Pass a custom window (e.g. an iframe)
* const languages = usePreferredLanguages({ window: iframe.contentWindow }); * const languages = usePreferredLanguages({ window: iframe.contentWindow });
* *
* @since 0.0.14 * @since 0.0.15
*/ */
export function usePreferredLanguages(options: ConfigurableWindow = {}): ShallowRef<readonly string[]> { export function usePreferredLanguages(options: ConfigurableWindow = {}): ShallowRef<readonly string[]> {
const { window = defaultWindow } = options; const { window = defaultWindow } = options;
@@ -30,7 +30,7 @@ export type UsePreferredReducedMotionReturn = ComputedRef<ReducedMotionType>;
* transitionDuration.value = motion.value === 'reduce' ? 0 : 200; * transitionDuration.value = motion.value === 'reduce' ? 0 : 200;
* }); * });
* *
* @since 0.0.14 * @since 0.0.15
*/ */
export function usePreferredReducedMotion( export function usePreferredReducedMotion(
options: UsePreferredReducedMotionOptions = {}, options: UsePreferredReducedMotionOptions = {},
@@ -19,7 +19,7 @@ export type ReducedTransparencyType
* const transparency = usePreferredReducedTransparency(); * const transparency = usePreferredReducedTransparency();
* // transparency.value === 'reduce' | 'no-preference' * // transparency.value === 'reduce' | 'no-preference'
* *
* @since 0.0.14 * @since 0.0.15
*/ */
export function usePreferredReducedTransparency( export function usePreferredReducedTransparency(
options: ConfigurableWindow = {}, options: ConfigurableWindow = {},
@@ -140,7 +140,7 @@ export interface UseScriptTagReturn {
* await load(); * await load();
* unload(); * unload();
* *
* @since 0.0.14 * @since 0.0.15
*/ */
export function useScriptTag( export function useScriptTag(
src: MaybeRefOrGetter<string>, src: MaybeRefOrGetter<string>,
@@ -67,7 +67,7 @@ export interface UseShareReturn {
* const { share } = useShare({ title: 'Default' }); * const { share } = useShare({ title: 'Default' });
* share({ text: 'One-off message' }); * share({ text: 'One-off message' });
* *
* @since 0.0.14 * @since 0.0.15
*/ */
export function useShare( export function useShare(
shareOptions: MaybeRefOrGetter<UseShareOptions> = {}, shareOptions: MaybeRefOrGetter<UseShareOptions> = {},
@@ -101,7 +101,7 @@ const _refCount = new WeakMap<HTMLStyleElement, number>();
* load(); * load();
* unload(); * unload();
* *
* @since 0.0.14 * @since 0.0.15
*/ */
export function useStyleTag( export function useStyleTag(
css: MaybeRefOrGetter<string>, css: MaybeRefOrGetter<string>,
@@ -85,7 +85,7 @@ export interface UseTextareaAutosizeReturn {
* @example * @example
* const { textarea, input, triggerResize } = useTextareaAutosize({ maxHeight: 320 }); * const { textarea, input, triggerResize } = useTextareaAutosize({ maxHeight: 320 });
* *
* @since 0.0.14 * @since 0.0.15
*/ */
export function useTextareaAutosize(options: UseTextareaAutosizeOptions = {}): UseTextareaAutosizeReturn { export function useTextareaAutosize(options: UseTextareaAutosizeOptions = {}): UseTextareaAutosizeReturn {
const { const {
@@ -61,7 +61,7 @@ export type UseTitleReturn = Ref<string | null | undefined> | ComputedRef<string
* // Restore the previous title when the component unmounts * // Restore the previous title when the component unmounts
* useTitle('Checkout', { restoreOnUnmount: (original) => original }); * useTitle('Checkout', { restoreOnUnmount: (original) => original });
* *
* @since 0.0.14 * @since 0.0.15
*/ */
export function useTitle( export function useTitle(
newTitle: () => string | null | undefined, newTitle: () => string | null | undefined,
@@ -88,7 +88,7 @@ export type UseUrlSearchParamsReturn<T extends Record<string, any> = UrlParams>
* const params = useUrlSearchParams<{ ids: string[] }>('history'); * const params = useUrlSearchParams<{ ids: string[] }>('history');
* params.ids = ['1', '2']; // -> ?ids=1&ids=2 * params.ids = ['1', '2']; // -> ?ids=1&ids=2
* *
* @since 0.0.14 * @since 0.0.15
*/ */
// `Record<string, any>` constraint mirrors `UseUrlSearchParamsReturn`: caller-supplied // `Record<string, any>` constraint mirrors `UseUrlSearchParamsReturn`: caller-supplied
// `T` flows back out, so interface types must satisfy the bound (see note above). // `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 }); * const { vibrate, stop, intervalControls } = useVibrate({ pattern: [300, 100], interval: 2000 });
* intervalControls?.resume(); * intervalControls?.resume();
* *
* @since 0.0.14 * @since 0.0.15
*/ */
export function useVibrate(options: UseVibrateOptions = {}): UseVibrateReturn { export function useVibrate(options: UseVibrateOptions = {}): UseVibrateReturn {
const { const {
@@ -72,7 +72,7 @@ export interface UseWakeLockReturn {
* const { forceRequest } = useWakeLock(); * const { forceRequest } = useWakeLock();
* await forceRequest('screen'); * await forceRequest('screen');
* *
* @since 0.0.14 * @since 0.0.15
*/ */
export function useWakeLock(options: UseWakeLockOptions = {}): UseWakeLockReturn { export function useWakeLock(options: UseWakeLockOptions = {}): UseWakeLockReturn {
const { const {
@@ -163,7 +163,7 @@ export interface UseWebNotificationReturn {
* const { show } = useWebNotification(); * const { show } = useWebNotification();
* show({ title: 'Override', body: 'Per-call body' }); * show({ title: 'Override', body: 'Per-call body' });
* *
* @since 0.0.14 * @since 0.0.15
*/ */
export function useWebNotification( export function useWebNotification(
options: UseWebNotificationOptions = {}, options: UseWebNotificationOptions = {},
@@ -117,7 +117,7 @@ function makePair<
* // <DefineItem v-slot="{ label }">{{ label }}</DefineItem> * // <DefineItem v-slot="{ label }">{{ label }}</DefineItem>
* // <ReuseItem label="A" /> <ReuseItem label="B" /> * // <ReuseItem label="A" /> <ReuseItem label="B" />
* *
* @since 0.0.14 * @since 0.0.15
*/ */
export function createReusableTemplate< export function createReusableTemplate<
Bindings extends Record<string, any>, Bindings extends Record<string, any>,
@@ -50,7 +50,7 @@ export type UseCurrentElementReturn<
* const child = useTemplateRef('child'); * const child = useTemplateRef('child');
* const el = useCurrentElement(child); * const el = useCurrentElement(child);
* *
* @since 0.0.14 * @since 0.0.15
*/ */
export function useCurrentElement< export function useCurrentElement<
T extends MaybeElement = MaybeElement, T extends MaybeElement = MaybeElement,
@@ -198,7 +198,7 @@ function createMetrics(length: number, itemSize: UseVirtualListItemSize): UseVir
* // Variable heights and a wider overscan buffer. * // Variable heights and a wider overscan buffer.
* const { list } = useVirtualList(items, { itemHeight: i => (i % 2 ? 40 : 80), overscan: 10 }); * const { list } = useVirtualList(items, { itemHeight: i => (i % 2 ? 40 : 80), overscan: 10 });
* *
* @since 0.0.14 * @since 0.0.15
*/ */
export function useVirtualList<T = unknown>( export function useVirtualList<T = unknown>(
list: MaybeRefOrGetter<readonly T[]>, list: MaybeRefOrGetter<readonly T[]>,
@@ -32,7 +32,7 @@ export type OnElementRemovalReturn = VoidFunction;
* @example * @example
* const stop = onElementRemoval(el, (records) => report(records), { flush: 'post' }); * const stop = onElementRemoval(el, (records) => report(records), { flush: 'post' });
* *
* @since 0.0.14 * @since 0.0.15
*/ */
export function onElementRemoval( export function onElementRemoval(
target: MaybeComputedElementRef, 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 * // keep tracking even if the focused node is detached from the DOM
* const active = useActiveElement({ triggerOnRemoval: true }); * const active = useActiveElement({ triggerOnRemoval: true });
* *
* @since 0.0.14 * @since 0.0.15
*/ */
export function useActiveElement<T extends HTMLElement>( export function useActiveElement<T extends HTMLElement>(
options: UseActiveElementOptions = {}, options: UseActiveElementOptions = {},
@@ -41,7 +41,7 @@ export type UseDocumentReadyStateReturn = ShallowRef<DocumentReadyState>;
* }, * },
* }); * });
* *
* @since 0.0.14 * @since 0.0.15
*/ */
export function useDocumentReadyState( export function useDocumentReadyState(
options: UseDocumentReadyStateOptions = {}, options: UseDocumentReadyStateOptions = {},
@@ -41,7 +41,7 @@ export type UseDocumentVisibilityReturn = ShallowRef<DocumentVisibilityState>;
* }, * },
* }); * });
* *
* @since 0.0.14 * @since 0.0.15
*/ */
export function useDocumentVisibility( export function useDocumentVisibility(
options: UseDocumentVisibilityOptions = {}, options: UseDocumentVisibilityOptions = {},
@@ -167,7 +167,7 @@ export interface UseDraggableReturn {
* // Lock to the horizontal axis and only drag from a handle. * // Lock to the horizontal axis and only drag from a handle.
* const { position } = useDraggable(el, { axis: 'x', handle: handleEl }); * const { position } = useDraggable(el, { axis: 'x', handle: handleEl });
* *
* @since 0.0.14 * @since 0.0.15
*/ */
export function useDraggable( export function useDraggable(
target: MaybeComputedElementRef, target: MaybeComputedElementRef,
@@ -79,7 +79,7 @@ type DropZoneEventType = 'enter' | 'over' | 'leave' | 'drop';
* onDrop: (files) => console.log(files), * onDrop: (files) => console.log(files),
* }); * });
* *
* @since 0.0.14 * @since 0.0.15
*/ */
export function useDropZone( export function useDropZone(
target: MaybeComputedElementRef | MaybeRefOrGetter<Document | null | undefined>, target: MaybeComputedElementRef | MaybeRefOrGetter<Document | null | undefined>,
@@ -84,7 +84,7 @@ export interface UseElementBoundingReturn {
* // Batch rapid scroll/resize reads into one measurement per frame * // Batch rapid scroll/resize reads into one measurement per frame
* const bounds = useElementBounding(el, { updateTiming: 'next-frame' }); * const bounds = useElementBounding(el, { updateTiming: 'next-frame' });
* *
* @since 0.0.14 * @since 0.0.15
*/ */
export function useElementBounding( export function useElementBounding(
target: MaybeComputedElementRef, target: MaybeComputedElementRef,
@@ -41,7 +41,7 @@ export interface UseElementSizeReturn {
* @example * @example
* const { width, height, stop } = useElementSize(el, { width: 100, height: 100 }, { box: 'border-box' }); * const { width, height, stop } = useElementSize(el, { width: 100, height: 100 }, { box: 'border-box' });
* *
* @since 0.0.14 * @since 0.0.15
*/ */
export function useElementSize( export function useElementSize(
target: MaybeComputedElementRef, target: MaybeComputedElementRef,
@@ -56,7 +56,7 @@ export type UseElementVisibilityReturn<Controls extends boolean = false>
* @example * @example
* const { isVisible, stop } = useElementVisibility(el, { controls: true, once: true }); * const { isVisible, stop } = useElementVisibility(el, { controls: true, once: true });
* *
* @since 0.0.14 * @since 0.0.15
*/ */
export function useElementVisibility( export function useElementVisibility(
target: MaybeComputedElementRef, target: MaybeComputedElementRef,
@@ -18,7 +18,7 @@ let counter = 0;
* @example * @example
* useFocusGuard('my-namespace'); * useFocusGuard('my-namespace');
* *
* @since 0.0.3 * @since 0.0.2
*/ */
export function useFocusGuard(namespace?: string) { export function useFocusGuard(namespace?: string) {
const manager = focusGuard(namespace); const manager = focusGuard(namespace);
@@ -62,7 +62,7 @@ export interface UseIntersectionObserverReturn {
* visible.value = isIntersecting; * visible.value = isIntersecting;
* }); * });
* *
* @since 0.0.14 * @since 0.0.15
*/ */
export function useIntersectionObserver( export function useIntersectionObserver(
target: MaybeComputedElementRef | MaybeComputedElementRef[] | MaybeRefOrGetter<MaybeElement[]>, target: MaybeComputedElementRef | MaybeComputedElementRef[] | MaybeRefOrGetter<MaybeElement[]>,
@@ -61,7 +61,7 @@ export interface UseMutationObserverReturn {
* @example * @example
* const { pause, resume } = useMutationObserver([elA, elB], onMutate, { childList: true }); * const { pause, resume } = useMutationObserver([elA, elB], onMutate, { childList: true });
* *
* @since 0.0.14 * @since 0.0.15
*/ */
export function useMutationObserver( export function useMutationObserver(
target: MaybeComputedElementRef | MaybeComputedElementRef[] | MaybeRefOrGetter<MaybeElement[]>, target: MaybeComputedElementRef | MaybeComputedElementRef[] | MaybeRefOrGetter<MaybeElement[]>,

Some files were not shown because too many files have changed in this diff Show More