From b9fbf1898c0aa34e90468adea21f0cdac1db92da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Garapich?= Date: Tue, 10 Dec 2024 11:02:25 +0100 Subject: [PATCH] fix: add typings for the htmx preload extension --- .changeset/angry-news-warn.md | 5 +++++ packages/html/htmx.d.ts | 23 +++++++++++++++++++++++ 2 files changed, 28 insertions(+) create mode 100644 .changeset/angry-news-warn.md diff --git a/.changeset/angry-news-warn.md b/.changeset/angry-news-warn.md new file mode 100644 index 000000000..5d4bfec2c --- /dev/null +++ b/.changeset/angry-news-warn.md @@ -0,0 +1,5 @@ +--- +'@kitajs/html': patch +--- + +add typings for the htmx preload extension diff --git a/packages/html/htmx.d.ts b/packages/html/htmx.d.ts index 06e971781..a48b68d35 100644 --- a/packages/html/htmx.d.ts +++ b/packages/html/htmx.d.ts @@ -195,6 +195,15 @@ declare namespace Htmx { * @see https://htmx.org/extensions/morphdom-swap/ */ morphdom: 'morphdom'; + + /** + * Support for the [preload](https://htmx.org/extensions/preload/) extension. + * + * CDN: https://unpkg.com/htmx-ext-preload@2.0.1/preload.js + * + * @see https://htmx.org/extensions/preload/ + */ + preload: 'preload'; } /** Definitions for htmx attributes up to 1.9.3. */ @@ -521,6 +530,20 @@ declare namespace Htmx { */ 'hx-head'?: 'merge' | 'append' | 're-eval'; + /** + * Configures strategy of preloading the given resource. + * + * @see https://htmx.org/extensions/preload/ + */ + preload?: 'mousedown' | 'mouseover' | 'preload:init' | AnyStr; + + /** + * Enables preloading linked image resources. + * + * @see https://htmx.org/extensions/preload/ + */ + 'preload-images'?: boolean; + /** * Hyperscript expression *