htmx.org 2.0.3 → 2.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -8,6 +8,9 @@ export type SwapOptions = {
8
8
  contextElement?: Element;
9
9
  afterSwapCallback?: swapCallback;
10
10
  afterSettleCallback?: swapCallback;
11
+ beforeSwapCallback?: swapCallback;
12
+ title?: string;
13
+ historyRequest?: boolean;
11
14
  };
12
15
  export type swapCallback = () => any;
13
16
  export type HtmxSwapStyle = "innerHTML" | "outerHTML" | "beforebegin" | "afterbegin" | "beforeend" | "afterend" | "delete" | "none" | string;
@@ -18,7 +21,7 @@ export type HtmxSwapSpecification = {
18
21
  transition?: boolean;
19
22
  ignoreTitle?: boolean;
20
23
  head?: string;
21
- scroll?: "top" | "bottom";
24
+ scroll?: "top" | "bottom" | number;
22
25
  scrollTarget?: string;
23
26
  show?: string;
24
27
  showTarget?: string;
@@ -72,6 +75,7 @@ export type HtmxRequestConfig = {
72
75
  */
73
76
  unfilteredParameters: any;
74
77
  headers: HtmxHeaderSpecification;
78
+ elt: Element;
75
79
  target: Element;
76
80
  verb: HttpVerb;
77
81
  errors: HtmxElementValidationError[];
@@ -135,7 +139,7 @@ export type HtmxSettleInfo = {
135
139
  };
136
140
  export type HtmxExtension = {
137
141
  init: (api: any) => void;
138
- onEvent: (name: string, event: Event | CustomEvent) => boolean;
142
+ onEvent: (name: string, event: CustomEvent) => boolean;
139
143
  transformResponse: (text: string, xhr: XMLHttpRequest, elt: Element) => string;
140
144
  isInlineSwap: (swapStyle: HtmxSwapStyle) => boolean;
141
145
  handleSwap: (swapStyle: HtmxSwapStyle, target: Node, fragment: Node, settleInfo: HtmxSettleInfo) => boolean | Node[];
@@ -159,7 +163,7 @@ declare namespace htmx {
159
163
  let toggleClass: (elt: Element | string, clazz: string) => void;
160
164
  let takeClass: (elt: Node | string, clazz: string) => void;
161
165
  let swap: (target: string | Element, content: string, swapSpec: HtmxSwapSpecification, swapOptions?: SwapOptions) => void;
162
- let defineExtension: (name: string, extension: HtmxExtension) => void;
166
+ let defineExtension: (name: string, extension: Partial<HtmxExtension>) => void;
163
167
  let removeExtension: (name: string) => void;
164
168
  let logAll: () => void;
165
169
  let logNone: () => void;
@@ -199,8 +203,10 @@ declare namespace htmx {
199
203
  let disableInheritance: boolean;
200
204
  let responseHandling: HtmxResponseHandlingConfig[];
201
205
  let allowNestedOobSwaps: boolean;
206
+ let historyRestoreAsHxRequest: boolean;
202
207
  }
203
208
  let parseInterval: (str: string) => number | undefined;
209
+ let location: Location;
204
210
  let _: (str: string) => any;
205
211
  let version: string;
206
212
  }