mirror of
https://github.com/bigskysoftware/htmx.git
synced 2025-09-28 21:41:40 +00:00
Co-authored-by: Alexandre Spaeth <alex_erson@users.noreply.github.com>
This commit is contained in:
parent
81b401a83d
commit
6a800e8085
277
dist/htmx.d.ts → dist/htmx.esm.d.ts
vendored
277
dist/htmx.d.ts → dist/htmx.esm.d.ts
vendored
@ -1,3 +1,145 @@
|
|||||||
|
export default htmx;
|
||||||
|
export type HttpVerb = 'get' | 'head' | 'post' | 'put' | 'delete' | 'connect' | 'options' | 'trace' | 'patch';
|
||||||
|
export type SwapOptions = {
|
||||||
|
select?: string;
|
||||||
|
selectOOB?: string;
|
||||||
|
eventInfo?: any;
|
||||||
|
anchor?: string;
|
||||||
|
contextElement?: Element;
|
||||||
|
afterSwapCallback?: swapCallback;
|
||||||
|
afterSettleCallback?: swapCallback;
|
||||||
|
};
|
||||||
|
export type swapCallback = () => any;
|
||||||
|
export type HtmxSwapStyle = 'innerHTML' | 'outerHTML' | 'beforebegin' | 'afterbegin' | 'beforeend' | 'afterend' | 'delete' | 'none' | string;
|
||||||
|
export type HtmxSwapSpecification = {
|
||||||
|
swapStyle: HtmxSwapStyle;
|
||||||
|
swapDelay: number;
|
||||||
|
settleDelay: number;
|
||||||
|
transition?: boolean;
|
||||||
|
ignoreTitle?: boolean;
|
||||||
|
head?: string;
|
||||||
|
scroll?: 'top' | 'bottom';
|
||||||
|
scrollTarget?: string;
|
||||||
|
show?: string;
|
||||||
|
showTarget?: string;
|
||||||
|
focusScroll?: boolean;
|
||||||
|
};
|
||||||
|
export type ConditionalFunction = ((this: Node, evt: Event) => boolean) & {
|
||||||
|
source: string;
|
||||||
|
};
|
||||||
|
export type HtmxTriggerSpecification = {
|
||||||
|
trigger: string;
|
||||||
|
pollInterval?: number;
|
||||||
|
eventFilter?: ConditionalFunction;
|
||||||
|
changed?: boolean;
|
||||||
|
once?: boolean;
|
||||||
|
consume?: boolean;
|
||||||
|
delay?: number;
|
||||||
|
from?: string;
|
||||||
|
target?: string;
|
||||||
|
throttle?: number;
|
||||||
|
queue?: string;
|
||||||
|
root?: string;
|
||||||
|
threshold?: string;
|
||||||
|
};
|
||||||
|
export type HtmxElementValidationError = {
|
||||||
|
elt: Element;
|
||||||
|
message: string;
|
||||||
|
validity: ValidityState;
|
||||||
|
};
|
||||||
|
export type HtmxHeaderSpecification = Record<string, string>;
|
||||||
|
export type HtmxAjaxHelperContext = {
|
||||||
|
source?: Element | string;
|
||||||
|
event?: Event;
|
||||||
|
handler?: HtmxAjaxHandler;
|
||||||
|
target?: Element | string;
|
||||||
|
swap?: HtmxSwapStyle;
|
||||||
|
values?: any | FormData;
|
||||||
|
headers?: Record<string, string>;
|
||||||
|
select?: string;
|
||||||
|
};
|
||||||
|
export type HtmxRequestConfig = {
|
||||||
|
boosted: boolean;
|
||||||
|
useUrlParams: boolean;
|
||||||
|
formData: FormData;
|
||||||
|
/**
|
||||||
|
* formData proxy
|
||||||
|
*/
|
||||||
|
parameters: any;
|
||||||
|
unfilteredFormData: FormData;
|
||||||
|
/**
|
||||||
|
* unfilteredFormData proxy
|
||||||
|
*/
|
||||||
|
unfilteredParameters: any;
|
||||||
|
headers: HtmxHeaderSpecification;
|
||||||
|
target: Element;
|
||||||
|
verb: HttpVerb;
|
||||||
|
errors: HtmxElementValidationError[];
|
||||||
|
withCredentials: boolean;
|
||||||
|
timeout: number;
|
||||||
|
path: string;
|
||||||
|
triggeringEvent: Event;
|
||||||
|
};
|
||||||
|
export type HtmxResponseInfo = {
|
||||||
|
xhr: XMLHttpRequest;
|
||||||
|
target: Element;
|
||||||
|
requestConfig: HtmxRequestConfig;
|
||||||
|
etc: HtmxAjaxEtc;
|
||||||
|
boosted: boolean;
|
||||||
|
select: string;
|
||||||
|
pathInfo: {
|
||||||
|
requestPath: string;
|
||||||
|
finalRequestPath: string;
|
||||||
|
responsePath: string | null;
|
||||||
|
anchor: string;
|
||||||
|
};
|
||||||
|
failed?: boolean;
|
||||||
|
successful?: boolean;
|
||||||
|
};
|
||||||
|
export type HtmxAjaxEtc = {
|
||||||
|
returnPromise?: boolean;
|
||||||
|
handler?: HtmxAjaxHandler;
|
||||||
|
select?: string;
|
||||||
|
targetOverride?: Element;
|
||||||
|
swapOverride?: HtmxSwapStyle;
|
||||||
|
headers?: Record<string, string>;
|
||||||
|
values?: any | FormData;
|
||||||
|
credentials?: boolean;
|
||||||
|
timeout?: number;
|
||||||
|
};
|
||||||
|
export type HtmxResponseHandlingConfig = {
|
||||||
|
code?: string;
|
||||||
|
swap: boolean;
|
||||||
|
error?: boolean;
|
||||||
|
ignoreTitle?: boolean;
|
||||||
|
select?: string;
|
||||||
|
target?: string;
|
||||||
|
swapOverride?: string;
|
||||||
|
event?: string;
|
||||||
|
};
|
||||||
|
export type HtmxBeforeSwapDetails = HtmxResponseInfo & {
|
||||||
|
shouldSwap: boolean;
|
||||||
|
serverResponse: any;
|
||||||
|
isError: boolean;
|
||||||
|
ignoreTitle: boolean;
|
||||||
|
selectOverride: string;
|
||||||
|
};
|
||||||
|
export type HtmxAjaxHandler = (elt: Element, responseInfo: HtmxResponseInfo) => any;
|
||||||
|
export type HtmxSettleTask = (() => void);
|
||||||
|
export type HtmxSettleInfo = {
|
||||||
|
tasks: HtmxSettleTask[];
|
||||||
|
elts: Element[];
|
||||||
|
title?: string;
|
||||||
|
};
|
||||||
|
export type HtmxExtension = {
|
||||||
|
init: (api: any) => void;
|
||||||
|
onEvent: (name: string, event: Event | CustomEvent) => boolean;
|
||||||
|
transformResponse: (text: string, xhr: XMLHttpRequest, elt: Element) => string;
|
||||||
|
isInlineSwap: (swapStyle: HtmxSwapStyle) => boolean;
|
||||||
|
handleSwap: (swapStyle: HtmxSwapStyle, target: Node, fragment: Node, settleInfo: HtmxSettleInfo) => boolean | Node[];
|
||||||
|
encodeParameters: (xhr: XMLHttpRequest, parameters: FormData, elt: Node) => any | string | null;
|
||||||
|
getSelectors: () => string[] | null;
|
||||||
|
};
|
||||||
declare namespace htmx {
|
declare namespace htmx {
|
||||||
const onLoad: (callback: (elt: Node) => void) => EventListener;
|
const onLoad: (callback: (elt: Node) => void) => EventListener;
|
||||||
const process: (elt: string | Element) => void;
|
const process: (elt: string | Element) => void;
|
||||||
@ -15,7 +157,7 @@ declare namespace htmx {
|
|||||||
const toggleClass: (elt: string | Element, clazz: string) => void;
|
const toggleClass: (elt: string | Element, clazz: string) => void;
|
||||||
const takeClass: (elt: string | Node, clazz: string) => void;
|
const takeClass: (elt: string | Node, clazz: string) => void;
|
||||||
const swap: (target: string | Element, content: string, swapSpec: HtmxSwapSpecification, swapOptions?: SwapOptions) => void;
|
const swap: (target: string | Element, content: string, swapSpec: HtmxSwapSpecification, swapOptions?: SwapOptions) => void;
|
||||||
const defineExtension: (name: string, extension: any) => void;
|
const defineExtension: (name: string, extension: HtmxExtension) => void;
|
||||||
const removeExtension: (name: string) => void;
|
const removeExtension: (name: string) => void;
|
||||||
const logAll: () => void;
|
const logAll: () => void;
|
||||||
const logNone: () => void;
|
const logNone: () => void;
|
||||||
@ -60,136 +202,3 @@ declare namespace htmx {
|
|||||||
const _: (str: string) => any;
|
const _: (str: string) => any;
|
||||||
const version: string;
|
const version: string;
|
||||||
}
|
}
|
||||||
type HttpVerb = 'get' | 'head' | 'post' | 'put' | 'delete' | 'connect' | 'options' | 'trace' | 'patch';
|
|
||||||
type SwapOptions = {
|
|
||||||
select?: string;
|
|
||||||
selectOOB?: string;
|
|
||||||
eventInfo?: any;
|
|
||||||
anchor?: string;
|
|
||||||
contextElement?: Element;
|
|
||||||
afterSwapCallback?: swapCallback;
|
|
||||||
afterSettleCallback?: swapCallback;
|
|
||||||
};
|
|
||||||
type swapCallback = () => any;
|
|
||||||
type HtmxSwapStyle = 'innerHTML' | 'outerHTML' | 'beforebegin' | 'afterbegin' | 'beforeend' | 'afterend' | 'delete' | 'none' | string;
|
|
||||||
type HtmxSwapSpecification = {
|
|
||||||
swapStyle: HtmxSwapStyle;
|
|
||||||
swapDelay: number;
|
|
||||||
settleDelay: number;
|
|
||||||
transition?: boolean;
|
|
||||||
ignoreTitle?: boolean;
|
|
||||||
head?: string;
|
|
||||||
scroll?: 'top' | 'bottom';
|
|
||||||
scrollTarget?: string;
|
|
||||||
show?: string;
|
|
||||||
showTarget?: string;
|
|
||||||
focusScroll?: boolean;
|
|
||||||
};
|
|
||||||
type ConditionalFunction = ((this: Node, evt: Event) => boolean) & {
|
|
||||||
source: string;
|
|
||||||
};
|
|
||||||
type HtmxTriggerSpecification = {
|
|
||||||
trigger: string;
|
|
||||||
pollInterval?: number;
|
|
||||||
eventFilter?: ConditionalFunction;
|
|
||||||
changed?: boolean;
|
|
||||||
once?: boolean;
|
|
||||||
consume?: boolean;
|
|
||||||
delay?: number;
|
|
||||||
from?: string;
|
|
||||||
target?: string;
|
|
||||||
throttle?: number;
|
|
||||||
queue?: string;
|
|
||||||
root?: string;
|
|
||||||
threshold?: string;
|
|
||||||
};
|
|
||||||
type HtmxElementValidationError = {
|
|
||||||
elt: Element;
|
|
||||||
message: string;
|
|
||||||
validity: ValidityState;
|
|
||||||
};
|
|
||||||
type HtmxHeaderSpecification = Record<string, string>;
|
|
||||||
type HtmxAjaxHelperContext = {
|
|
||||||
source?: Element | string;
|
|
||||||
event?: Event;
|
|
||||||
handler?: HtmxAjaxHandler;
|
|
||||||
target?: Element | string;
|
|
||||||
swap?: HtmxSwapStyle;
|
|
||||||
values?: any | FormData;
|
|
||||||
headers?: Record<string, string>;
|
|
||||||
select?: string;
|
|
||||||
};
|
|
||||||
type HtmxRequestConfig = {
|
|
||||||
boosted: boolean;
|
|
||||||
useUrlParams: boolean;
|
|
||||||
formData: FormData;
|
|
||||||
/**
|
|
||||||
* formData proxy
|
|
||||||
*/
|
|
||||||
parameters: any;
|
|
||||||
unfilteredFormData: FormData;
|
|
||||||
/**
|
|
||||||
* unfilteredFormData proxy
|
|
||||||
*/
|
|
||||||
unfilteredParameters: any;
|
|
||||||
headers: HtmxHeaderSpecification;
|
|
||||||
target: Element;
|
|
||||||
verb: HttpVerb;
|
|
||||||
errors: HtmxElementValidationError[];
|
|
||||||
withCredentials: boolean;
|
|
||||||
timeout: number;
|
|
||||||
path: string;
|
|
||||||
triggeringEvent: Event;
|
|
||||||
};
|
|
||||||
type HtmxResponseInfo = {
|
|
||||||
xhr: XMLHttpRequest;
|
|
||||||
target: Element;
|
|
||||||
requestConfig: HtmxRequestConfig;
|
|
||||||
etc: HtmxAjaxEtc;
|
|
||||||
boosted: boolean;
|
|
||||||
select: string;
|
|
||||||
pathInfo: {
|
|
||||||
requestPath: string;
|
|
||||||
finalRequestPath: string;
|
|
||||||
responsePath: string | null;
|
|
||||||
anchor: string;
|
|
||||||
};
|
|
||||||
failed?: boolean;
|
|
||||||
successful?: boolean;
|
|
||||||
};
|
|
||||||
type HtmxAjaxEtc = {
|
|
||||||
returnPromise?: boolean;
|
|
||||||
handler?: HtmxAjaxHandler;
|
|
||||||
select?: string;
|
|
||||||
targetOverride?: Element;
|
|
||||||
swapOverride?: HtmxSwapStyle;
|
|
||||||
headers?: Record<string, string>;
|
|
||||||
values?: any | FormData;
|
|
||||||
credentials?: boolean;
|
|
||||||
timeout?: number;
|
|
||||||
};
|
|
||||||
type HtmxResponseHandlingConfig = {
|
|
||||||
code?: string;
|
|
||||||
swap: boolean;
|
|
||||||
error?: boolean;
|
|
||||||
ignoreTitle?: boolean;
|
|
||||||
select?: string;
|
|
||||||
target?: string;
|
|
||||||
swapOverride?: string;
|
|
||||||
event?: string;
|
|
||||||
};
|
|
||||||
type HtmxBeforeSwapDetails = HtmxResponseInfo & {
|
|
||||||
shouldSwap: boolean;
|
|
||||||
serverResponse: any;
|
|
||||||
isError: boolean;
|
|
||||||
ignoreTitle: boolean;
|
|
||||||
selectOverride: string;
|
|
||||||
};
|
|
||||||
type HtmxAjaxHandler = (elt: Element, responseInfo: HtmxResponseInfo) => any;
|
|
||||||
type HtmxSettleTask = (() => void);
|
|
||||||
type HtmxSettleInfo = {
|
|
||||||
tasks: HtmxSettleTask[];
|
|
||||||
elts: Element[];
|
|
||||||
title?: string;
|
|
||||||
};
|
|
||||||
type HtmxExtension = any;
|
|
@ -21,7 +21,7 @@
|
|||||||
"editors/jetbrains/htmx.web-types.json"
|
"editors/jetbrains/htmx.web-types.json"
|
||||||
],
|
],
|
||||||
"main": "dist/htmx.esm.js",
|
"main": "dist/htmx.esm.js",
|
||||||
"types": "dist/htmx.d.ts",
|
"types": "dist/htmx.esm.d.ts",
|
||||||
"unpkg": "dist/htmx.min.js",
|
"unpkg": "dist/htmx.min.js",
|
||||||
"web-types": "editors/jetbrains/htmx.web-types.json",
|
"web-types": "editors/jetbrains/htmx.web-types.json",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
@ -29,7 +29,7 @@
|
|||||||
"lint": "eslint src/htmx.js test/attributes/ test/core/ test/util/",
|
"lint": "eslint src/htmx.js test/attributes/ test/core/ test/util/",
|
||||||
"format": "eslint --fix src/htmx.js test/attributes/ test/core/ test/util/",
|
"format": "eslint --fix src/htmx.js test/attributes/ test/core/ test/util/",
|
||||||
"types-check": "tsc src/htmx.js --noEmit --checkJs --target es6 --lib dom,dom.iterable",
|
"types-check": "tsc src/htmx.js --noEmit --checkJs --target es6 --lib dom,dom.iterable",
|
||||||
"types-generate": "tsc src/htmx.js --declaration --emitDeclarationOnly --allowJs --outDir dist",
|
"types-generate": "tsc dist/htmx.esm.js --declaration --emitDeclarationOnly --allowJs --outDir dist",
|
||||||
"test": "npm run lint && npm run types-check && mocha-chrome test/index.html",
|
"test": "npm run lint && npm run types-check && mocha-chrome test/index.html",
|
||||||
"type-declarations": "tsc --project ./jsconfig.json",
|
"type-declarations": "tsc --project ./jsconfig.json",
|
||||||
"ws-tests": "cd ./test/ws-sse && node ./server.js",
|
"ws-tests": "cd ./test/ws-sse && node ./server.js",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user