mirror of
https://github.com/bigskysoftware/htmx.git
synced 2025-09-27 13:01:03 +00:00
add warning if people aren't using the correct version of extensions
This commit is contained in:
parent
dc1c0fad1a
commit
ddb7597629
6
dist/ext/ajax-header.js
vendored
6
dist/ext/ajax-header.js
vendored
@ -1,7 +1,11 @@
|
||||
if (htmx.version && !htmx.version.startsWith("1.")) {
|
||||
console.warn("WARNING: You are using an htmx 1 extension with htmx " + htmx.version +
|
||||
". It is recommended that you move to the version of this extension found on https://extensions.htmx.org")
|
||||
}
|
||||
htmx.defineExtension('ajax-header', {
|
||||
onEvent: function (name, evt) {
|
||||
if (name === "htmx:configRequest") {
|
||||
evt.detail.headers['X-Requested-With'] = 'XMLHttpRequest';
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
6
dist/ext/alpine-morph.js
vendored
6
dist/ext/alpine-morph.js
vendored
@ -1,3 +1,7 @@
|
||||
if (htmx.version && !htmx.version.startsWith("1.")) {
|
||||
console.warn("WARNING: You are using an htmx 1 extension with htmx " + htmx.version +
|
||||
". It is recommended that you move to the version of this extension found on https://extensions.htmx.org")
|
||||
}
|
||||
htmx.defineExtension('alpine-morph', {
|
||||
isInlineSwap: function (swapStyle) {
|
||||
return swapStyle === 'morph';
|
||||
@ -13,4 +17,4 @@ htmx.defineExtension('alpine-morph', {
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
7
dist/ext/class-tools.js
vendored
7
dist/ext/class-tools.js
vendored
@ -1,5 +1,10 @@
|
||||
(function () {
|
||||
|
||||
if (htmx.version && !htmx.version.startsWith("1.")) {
|
||||
console.warn("WARNING: You are using an htmx 1 extension with htmx " + htmx.version +
|
||||
". It is recommended that you move to the version of this extension found on https://extensions.htmx.org")
|
||||
}
|
||||
|
||||
function splitOnWhitespace(trigger) {
|
||||
return trigger.split(/\s+/);
|
||||
}
|
||||
@ -89,4 +94,4 @@
|
||||
}
|
||||
}
|
||||
});
|
||||
})();
|
||||
})();
|
||||
|
4
dist/ext/client-side-templates.js
vendored
4
dist/ext/client-side-templates.js
vendored
@ -1,3 +1,7 @@
|
||||
if (htmx.version && !htmx.version.startsWith("1.")) {
|
||||
console.warn("WARNING: You are using an htmx 1 extension with htmx " + htmx.version +
|
||||
". It is recommended that you move to the version of this extension found on https://extensions.htmx.org")
|
||||
}
|
||||
htmx.defineExtension('client-side-templates', {
|
||||
transformResponse : function(text, xhr, elt) {
|
||||
|
||||
|
4
dist/ext/debug.js
vendored
4
dist/ext/debug.js
vendored
@ -1,3 +1,7 @@
|
||||
if (htmx.version && !htmx.version.startsWith("1.")) {
|
||||
console.warn("WARNING: You are using an htmx 1 extension with htmx " + htmx.version +
|
||||
". It is recommended that you move to the version of this extension found on https://extensions.htmx.org")
|
||||
}
|
||||
htmx.defineExtension('debug', {
|
||||
onEvent: function (name, evt) {
|
||||
if (console.debug) {
|
||||
|
8
dist/ext/disable-element.js
vendored
8
dist/ext/disable-element.js
vendored
@ -1,5 +1,7 @@
|
||||
"use strict";
|
||||
|
||||
if (htmx.version && !htmx.version.startsWith("1.")) {
|
||||
console.warn("WARNING: You are using an htmx 1 extension with htmx " + htmx.version +
|
||||
". It is recommended that you move to the version of this extension found on https://extensions.htmx.org")
|
||||
}
|
||||
// Disable Submit Button
|
||||
htmx.defineExtension('disable-element', {
|
||||
onEvent: function (name, evt) {
|
||||
@ -15,4 +17,4 @@ htmx.defineExtension('disable-element', {
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
4
dist/ext/event-header.js
vendored
4
dist/ext/event-header.js
vendored
@ -1,4 +1,8 @@
|
||||
(function(){
|
||||
if (htmx.version && !htmx.version.startsWith("1.")) {
|
||||
console.warn("WARNING: You are using an htmx 1 extension with htmx " + htmx.version +
|
||||
". It is recommended that you move to the version of this extension found on https://extensions.htmx.org")
|
||||
}
|
||||
function stringifyEvent(event) {
|
||||
var obj = {};
|
||||
for (var key in event) {
|
||||
|
7
dist/ext/head-support.js
vendored
7
dist/ext/head-support.js
vendored
@ -5,6 +5,11 @@
|
||||
//==========================================================
|
||||
(function(){
|
||||
|
||||
if (htmx.version && !htmx.version.startsWith("1.")) {
|
||||
console.warn("WARNING: You are using an htmx 1 extension with htmx " + htmx.version +
|
||||
". It is recommended that you move to the version of this extension found on https://extensions.htmx.org")
|
||||
}
|
||||
|
||||
var api = null;
|
||||
|
||||
function log() {
|
||||
@ -138,4 +143,4 @@
|
||||
}
|
||||
});
|
||||
|
||||
})()
|
||||
})()
|
||||
|
4
dist/ext/include-vals.js
vendored
4
dist/ext/include-vals.js
vendored
@ -1,4 +1,8 @@
|
||||
(function(){
|
||||
if (htmx.version && !htmx.version.startsWith("1.")) {
|
||||
console.warn("WARNING: You are using an htmx 1 extension with htmx " + htmx.version +
|
||||
". It is recommended that you move to the version of this extension found on https://extensions.htmx.org")
|
||||
}
|
||||
|
||||
function mergeObjects(obj1, obj2) {
|
||||
for (var key in obj2) {
|
||||
|
8
dist/ext/json-enc.js
vendored
8
dist/ext/json-enc.js
vendored
@ -1,12 +1,16 @@
|
||||
if (htmx.version && !htmx.version.startsWith("1.")) {
|
||||
console.warn("WARNING: You are using an htmx 1 extension with htmx " + htmx.version +
|
||||
". It is recommended that you move to the version of this extension found on https://extensions.htmx.org")
|
||||
}
|
||||
htmx.defineExtension('json-enc', {
|
||||
onEvent: function (name, evt) {
|
||||
if (name === "htmx:configRequest") {
|
||||
evt.detail.headers['Content-Type'] = "application/json";
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
encodeParameters : function(xhr, parameters, elt) {
|
||||
xhr.overrideMimeType('text/json');
|
||||
return (JSON.stringify(parameters));
|
||||
}
|
||||
});
|
||||
});
|
||||
|
6
dist/ext/loading-states.js
vendored
6
dist/ext/loading-states.js
vendored
@ -1,4 +1,10 @@
|
||||
;(function () {
|
||||
|
||||
if (htmx.version && !htmx.version.startsWith("1.")) {
|
||||
console.warn("WARNING: You are using an htmx 1 extension with htmx " + htmx.version +
|
||||
". It is recommended that you move to the version of this extension found on https://extensions.htmx.org")
|
||||
}
|
||||
|
||||
let loadingStatesUndoQueue = []
|
||||
|
||||
function loadingStateContainer(target) {
|
||||
|
4
dist/ext/method-override.js
vendored
4
dist/ext/method-override.js
vendored
@ -1,3 +1,7 @@
|
||||
if (htmx.version && !htmx.version.startsWith("1.")) {
|
||||
console.warn("WARNING: You are using an htmx 1 extension with htmx " + htmx.version +
|
||||
". It is recommended that you move to the version of this extension found on https://extensions.htmx.org")
|
||||
}
|
||||
htmx.defineExtension('method-override', {
|
||||
onEvent: function (name, evt) {
|
||||
if (name === "htmx:configRequest") {
|
||||
|
4
dist/ext/morphdom-swap.js
vendored
4
dist/ext/morphdom-swap.js
vendored
@ -1,3 +1,7 @@
|
||||
if (htmx.version && !htmx.version.startsWith("1.")) {
|
||||
console.warn("WARNING: You are using an htmx 1 extension with htmx " + htmx.version +
|
||||
". It is recommended that you move to the version of this extension found on https://extensions.htmx.org")
|
||||
}
|
||||
htmx.defineExtension('morphdom-swap', {
|
||||
isInlineSwap: function(swapStyle) {
|
||||
return swapStyle === 'morphdom';
|
||||
|
7
dist/ext/multi-swap.js
vendored
7
dist/ext/multi-swap.js
vendored
@ -1,5 +1,10 @@
|
||||
(function () {
|
||||
|
||||
if (htmx.version && !htmx.version.startsWith("1.")) {
|
||||
console.warn("WARNING: You are using an htmx 1 extension with htmx " + htmx.version +
|
||||
". It is recommended that you move to the version of this extension found on https://extensions.htmx.org")
|
||||
}
|
||||
|
||||
/** @type {import("../htmx").HtmxInternalApi} */
|
||||
var api;
|
||||
|
||||
@ -42,4 +47,4 @@
|
||||
}
|
||||
}
|
||||
});
|
||||
})();
|
||||
})();
|
||||
|
17
dist/ext/path-deps.js
vendored
17
dist/ext/path-deps.js
vendored
@ -1,9 +1,12 @@
|
||||
(function(undefined){
|
||||
'use strict';
|
||||
|
||||
if (htmx.version && !htmx.version.startsWith("1.")) {
|
||||
console.warn("WARNING: You are using an htmx 1 extension with htmx " + htmx.version +
|
||||
". It is recommended that you move to the version of this extension found on https://extensions.htmx.org")
|
||||
}
|
||||
// Save a reference to the global object (window in the browser)
|
||||
var _root = this;
|
||||
|
||||
|
||||
function dependsOn(pathSpec, url) {
|
||||
if (pathSpec === "ignore") {
|
||||
return false;
|
||||
@ -30,8 +33,8 @@
|
||||
if (dependsOn(elt.getAttribute('path-deps'), path)) {
|
||||
htmx.trigger(elt, "path-deps");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
htmx.defineExtension('path-deps', {
|
||||
onEvent: function (name, evt) {
|
||||
@ -41,7 +44,7 @@
|
||||
if (config.verb !== "get" && evt.target.getAttribute('path-deps') !== 'ignore') {
|
||||
refreshPath(config.path);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@ -49,12 +52,12 @@
|
||||
* ********************
|
||||
* Expose functionality
|
||||
* ********************
|
||||
*/
|
||||
*/
|
||||
|
||||
_root.PathDeps = {
|
||||
refresh: function(path) {
|
||||
refreshPath(path);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
}).call(this);
|
||||
|
6
dist/ext/path-params.js
vendored
6
dist/ext/path-params.js
vendored
@ -1,3 +1,7 @@
|
||||
if (htmx.version && !htmx.version.startsWith("1.")) {
|
||||
console.warn("WARNING: You are using an htmx 1 extension with htmx " + htmx.version +
|
||||
". It is recommended that you move to the version of this extension found on https://extensions.htmx.org")
|
||||
}
|
||||
htmx.defineExtension('path-params', {
|
||||
onEvent: function(name, evt) {
|
||||
if (name === "htmx:configRequest") {
|
||||
@ -8,4 +12,4 @@ htmx.defineExtension('path-params', {
|
||||
})
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
24
dist/ext/preload.js
vendored
24
dist/ext/preload.js
vendored
@ -1,5 +1,9 @@
|
||||
// This adds the "preload" extension to htmx. By default, this will
|
||||
// preload the targets of any tags with `href` or `hx-get` attributes
|
||||
if (htmx.version && !htmx.version.startsWith("1.")) {
|
||||
console.warn("WARNING: You are using an htmx 1 extension with htmx " + htmx.version +
|
||||
". It is recommended that you move to the version of this extension found on https://extensions.htmx.org")
|
||||
}
|
||||
// This adds the "preload" extension to htmx. By default, this will
|
||||
// preload the targets of any tags with `href` or `hx-get` attributes
|
||||
// if they also have a `preload` attribute as well. See documentation
|
||||
// for more details
|
||||
htmx.defineExtension("preload", {
|
||||
@ -18,8 +22,8 @@ htmx.defineExtension("preload", {
|
||||
if (node == undefined) {return undefined;}
|
||||
return node.getAttribute(property) || node.getAttribute("data-" + property) || attr(node.parentElement, property)
|
||||
}
|
||||
|
||||
// load handles the actual HTTP fetch, and uses htmx.ajax in cases where we're
|
||||
|
||||
// load handles the actual HTTP fetch, and uses htmx.ajax in cases where we're
|
||||
// preloading an htmx resource (this sends the same HTTP headers as a regular htmx request)
|
||||
var load = function(node) {
|
||||
|
||||
@ -43,7 +47,7 @@ htmx.defineExtension("preload", {
|
||||
}
|
||||
|
||||
// Special handling for HX-GET - use built-in htmx.ajax function
|
||||
// so that headers match other htmx requests, then set
|
||||
// so that headers match other htmx requests, then set
|
||||
// node.preloadState = TRUE so that requests are not duplicated
|
||||
// in the future
|
||||
var hxGet = node.getAttribute("hx-get") || node.getAttribute("data-hx-get")
|
||||
@ -57,8 +61,8 @@ htmx.defineExtension("preload", {
|
||||
return;
|
||||
}
|
||||
|
||||
// Otherwise, perform a standard xhr request, then set
|
||||
// node.preloadState = TRUE so that requests are not duplicated
|
||||
// Otherwise, perform a standard xhr request, then set
|
||||
// node.preloadState = TRUE so that requests are not duplicated
|
||||
// in the future.
|
||||
if (node.getAttribute("href")) {
|
||||
var r = new XMLHttpRequest();
|
||||
@ -83,16 +87,16 @@ htmx.defineExtension("preload", {
|
||||
if (node.preloadState !== undefined) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// Get event name from config.
|
||||
var on = attr(node, "preload") || "mousedown"
|
||||
const always = on.indexOf("always") !== -1
|
||||
if (always) {
|
||||
on = on.replace('always', '').trim()
|
||||
}
|
||||
|
||||
|
||||
// FALL THROUGH to here means we need to add an EventListener
|
||||
|
||||
|
||||
// Apply the listener to the node
|
||||
node.addEventListener(on, function(evt) {
|
||||
if (node.preloadState === "PAUSE") { // Only add one event listener
|
||||
|
4
dist/ext/rails-method.js
vendored
4
dist/ext/rails-method.js
vendored
@ -1,3 +1,7 @@
|
||||
if (htmx.version && !htmx.version.startsWith("1.")) {
|
||||
console.warn("WARNING: You are using an htmx 1 extension with htmx " + htmx.version +
|
||||
". It is recommended that you move to the version of this extension found on https://extensions.htmx.org")
|
||||
}
|
||||
htmx.defineExtension('rails-method', {
|
||||
onEvent: function (name, evt) {
|
||||
if (name === "configRequest.htmx") {
|
||||
|
4
dist/ext/remove-me.js
vendored
4
dist/ext/remove-me.js
vendored
@ -1,4 +1,8 @@
|
||||
(function(){
|
||||
if (htmx.version && !htmx.version.startsWith("1.")) {
|
||||
console.warn("WARNING: You are using an htmx 1 extension with htmx " + htmx.version +
|
||||
". It is recommended that you move to the version of this extension found on https://extensions.htmx.org")
|
||||
}
|
||||
function maybeRemoveMe(elt) {
|
||||
var timing = elt.getAttribute("remove-me") || elt.getAttribute("data-remove-me");
|
||||
if (timing) {
|
||||
|
7
dist/ext/response-targets.js
vendored
7
dist/ext/response-targets.js
vendored
@ -1,5 +1,10 @@
|
||||
(function(){
|
||||
|
||||
if (htmx.version && !htmx.version.startsWith("1.")) {
|
||||
console.warn("WARNING: You are using an htmx 1 extension with htmx " + htmx.version +
|
||||
". It is recommended that you move to the version of this extension found on https://extensions.htmx.org")
|
||||
}
|
||||
|
||||
/** @type {import("../htmx").HtmxInternalApi} */
|
||||
var api;
|
||||
|
||||
@ -58,7 +63,7 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
6
dist/ext/restored.js
vendored
6
dist/ext/restored.js
vendored
@ -1,3 +1,7 @@
|
||||
if (htmx.version && !htmx.version.startsWith("1.")) {
|
||||
console.warn("WARNING: You are using an htmx 1 extension with htmx " + htmx.version +
|
||||
". It is recommended that you move to the version of this extension found on https://extensions.htmx.org")
|
||||
}
|
||||
htmx.defineExtension('restored', {
|
||||
onEvent : function(name, evt) {
|
||||
if (name === 'htmx:restored'){
|
||||
@ -12,4 +16,4 @@ htmx.defineExtension('restored', {
|
||||
}
|
||||
return;
|
||||
}
|
||||
})
|
||||
})
|
||||
|
39
dist/ext/sse.js
vendored
39
dist/ext/sse.js
vendored
@ -7,6 +7,11 @@ This extension adds support for Server Sent Events to htmx. See /www/extensions
|
||||
|
||||
(function() {
|
||||
|
||||
if (htmx.version && !htmx.version.startsWith("1.")) {
|
||||
console.warn("WARNING: You are using an htmx 1 extension with htmx " + htmx.version +
|
||||
". It is recommended that you move to the version of this extension found on https://extensions.htmx.org")
|
||||
}
|
||||
|
||||
/** @type {import("../htmx").HtmxInternalApi} */
|
||||
var api;
|
||||
|
||||
@ -14,8 +19,8 @@ This extension adds support for Server Sent Events to htmx. See /www/extensions
|
||||
|
||||
/**
|
||||
* Init saves the provided reference to the internal HTMX API.
|
||||
*
|
||||
* @param {import("../htmx").HtmxInternalApi} api
|
||||
*
|
||||
* @param {import("../htmx").HtmxInternalApi} api
|
||||
* @returns void
|
||||
*/
|
||||
init: function(apiRef) {
|
||||
@ -30,9 +35,9 @@ This extension adds support for Server Sent Events to htmx. See /www/extensions
|
||||
|
||||
/**
|
||||
* onEvent handles all events passed to this extension.
|
||||
*
|
||||
* @param {string} name
|
||||
* @param {Event} evt
|
||||
*
|
||||
* @param {string} name
|
||||
* @param {Event} evt
|
||||
* @returns void
|
||||
*/
|
||||
onEvent: function(name, evt) {
|
||||
@ -64,8 +69,8 @@ This extension adds support for Server Sent Events to htmx. See /www/extensions
|
||||
/**
|
||||
* createEventSource is the default method for creating new EventSource objects.
|
||||
* it is hoisted into htmx.config.createEventSource to be overridden by the user, if needed.
|
||||
*
|
||||
* @param {string} url
|
||||
*
|
||||
* @param {string} url
|
||||
* @returns EventSource
|
||||
*/
|
||||
function createEventSource(url) {
|
||||
@ -105,7 +110,7 @@ This extension adds support for Server Sent Events to htmx. See /www/extensions
|
||||
}
|
||||
|
||||
/**
|
||||
* registerSSE looks for attributes that can contain sse events, right
|
||||
* registerSSE looks for attributes that can contain sse events, right
|
||||
* now hx-trigger and sse-swap and adds listeners based on these attributes too
|
||||
* the closest event source
|
||||
*
|
||||
@ -183,7 +188,7 @@ This extension adds support for Server Sent Events to htmx. See /www/extensions
|
||||
if (sseEventName.slice(0, 4) != "sse:") {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// remove the sse: prefix from here on out
|
||||
sseEventName = sseEventName.substr(4);
|
||||
|
||||
@ -269,8 +274,8 @@ This extension adds support for Server Sent Events to htmx. See /www/extensions
|
||||
/**
|
||||
* maybeCloseSSESource confirms that the parent element still exists.
|
||||
* If not, then any associated SSE source is closed and the function returns true.
|
||||
*
|
||||
* @param {HTMLElement} elt
|
||||
*
|
||||
* @param {HTMLElement} elt
|
||||
* @returns boolean
|
||||
*/
|
||||
function maybeCloseSSESource(elt) {
|
||||
@ -287,9 +292,9 @@ This extension adds support for Server Sent Events to htmx. See /www/extensions
|
||||
|
||||
/**
|
||||
* queryAttributeOnThisOrChildren returns all nodes that contain the requested attributeName, INCLUDING THE PROVIDED ROOT ELEMENT.
|
||||
*
|
||||
* @param {HTMLElement} elt
|
||||
* @param {string} attributeName
|
||||
*
|
||||
* @param {HTMLElement} elt
|
||||
* @param {string} attributeName
|
||||
*/
|
||||
function queryAttributeOnThisOrChildren(elt, attributeName) {
|
||||
|
||||
@ -310,7 +315,7 @@ This extension adds support for Server Sent Events to htmx. See /www/extensions
|
||||
|
||||
/**
|
||||
* @param {HTMLElement} elt
|
||||
* @param {string} content
|
||||
* @param {string} content
|
||||
*/
|
||||
function swap(elt, content) {
|
||||
|
||||
@ -340,10 +345,10 @@ This extension adds support for Server Sent Events to htmx. See /www/extensions
|
||||
}
|
||||
|
||||
/**
|
||||
* doSettle mirrors much of the functionality in htmx that
|
||||
* doSettle mirrors much of the functionality in htmx that
|
||||
* settles elements after their content has been swapped.
|
||||
* TODO: this should be published by htmx, and not duplicated here
|
||||
* @param {import("../htmx").HtmxSettleInfo} settleInfo
|
||||
* @param {import("../htmx").HtmxSettleInfo} settleInfo
|
||||
* @returns () => void
|
||||
*/
|
||||
function doSettle(settleInfo) {
|
||||
|
5
dist/ext/ws.js
vendored
5
dist/ext/ws.js
vendored
@ -6,6 +6,11 @@ This extension adds support for WebSockets to htmx. See /www/extensions/ws.md f
|
||||
|
||||
(function () {
|
||||
|
||||
if (htmx.version && !htmx.version.startsWith("1.")) {
|
||||
console.warn("WARNING: You are using an htmx 1 extension with htmx " + htmx.version +
|
||||
". It is recommended that you move to the version of this extension found on https://extensions.htmx.org")
|
||||
}
|
||||
|
||||
/** @type {import("../htmx").HtmxInternalApi} */
|
||||
var api;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user