remove only top level files to keep the legacy extensions

This commit is contained in:
Carson Gross 2024-07-12 11:12:56 -06:00
parent ee13ae744a
commit f751aba86f
10 changed files with 28 additions and 14 deletions

View File

@ -1,5 +1,11 @@
# Changelog
## [2.0.1] - 2024-07-12
* Make the `/dist/htmx.esm.js` file the `main` file in `package.json` to make installing htmx smoother
* Update `htmx.d.ts` & include it in the distribution
## [2.0.0] - 2024-06-17
* Removed extensions and moved to their own repos linked off of <https://extensions.htmx.org>

View File

@ -32,7 +32,7 @@ By removing these arbitrary constraints htmx completes HTML as a
## quick start
```html
<script src="https://unpkg.com/htmx.org@2.0.0"></script>
<script src="https://unpkg.com/htmx.org@2.0.1"></script>
<!-- have a button POST a click via AJAX -->
<button hx-post="/clicked" hx-swap="outerHTML">
Click Me

View File

@ -5,7 +5,7 @@ set -euo pipefail
HTMX_SRC="src/htmx.js"
# Clean the dist directory
rm -rf dist/*
rm -rf dist/*.js dist/*.ts dist/*.gz
# Regular IIFE script
cp $HTMX_SRC dist/htmx.js
@ -35,3 +35,4 @@ cat > dist/htmx.esm.js << EOF
$(cat $HTMX_SRC)
export default htmx
EOF

View File

@ -277,7 +277,7 @@ var htmx = (function() {
parseInterval: null,
/** @type {typeof internalEval} */
_: null,
version: '2.0.0'
version: '2.0.1'
}
// Tsc madness part 2
htmx.onLoad = onLoadHelper

View File

@ -119,7 +119,7 @@ By removing these constraints, htmx completes HTML as a [hypertext](https://en.w
<h2>quick start</h2>
```html
<script src="https://unpkg.com/htmx.org@2.0.0"></script>
<script src="https://unpkg.com/htmx.org@2.0.1"></script>
<!-- have a button POST a click via AJAX -->
<button hx-post="/clicked" hx-swap="outerHTML">
Click Me

View File

@ -121,13 +121,13 @@ The fastest way to get going with htmx is to load it via a CDN. You can simply a
your head tag and get going:
```html
<script src="https://unpkg.com/htmx.org@2.0.0" integrity="sha384-wS5l5IKJBvK6sPTKa2WZ1js3d947pvWXbPJ1OmWfEuxLgeHcEbjUUA5i9V5ZkpCw" crossorigin="anonymous"></script>
<script src="https://unpkg.com/htmx.org@2.0.1" integrity="sha384-Kuy3zzgrd0iLfD2M/Bid8+jwLls454XKE9xFQE7OPj4VIwd1vlTS/4oNMxjpTtOw" crossorigin="anonymous"></script>
```
An unminified version is also available for debugging as well:
```html
<script src="https://unpkg.com/htmx.org@2.0.0/dist/htmx.js" integrity="sha384-Xh+GLLi0SMFPwtHQjT72aPG19QvKB8grnyRbYBNIdHWc2NkCrz65jlU7YrzO6qRp" crossorigin="anonymous"></script>
<script src="https://unpkg.com/htmx.org@2.0.1/dist/htmx.js" integrity="sha384-ELJB0CrwJPIruxvwhqogOAeh84D/QrihzCpaCO63RB/OlBPyezKvFpceNNOra4PG" crossorigin="anonymous"></script>
```
While the CDN approach is extremely simple, you may want to consider
@ -149,7 +149,7 @@ and include it where necessary with a `<script>` tag:
For npm-style build systems, you can install htmx via [npm](https://www.npmjs.com/):
```sh
npm install htmx.org
npm install htmx.org@2.0.1
```
After installing, youll need to use appropriate tooling to use `node_modules/htmx.org/dist/htmx.js` (or `.min.js`).

View File

@ -113,7 +113,7 @@ type HtmxAjaxHelperContext = {
source?: Element | string;
event?: Event;
handler?: HtmxAjaxHandler;
target: Element | string;
target?: Element | string;
swap?: HtmxSwapStyle;
values?: any | FormData;
headers?: Record<string, string>;

View File

@ -277,7 +277,7 @@ var htmx = (function() {
parseInterval: null,
/** @type {typeof internalEval} */
_: null,
version: '2.0.0'
version: '2.0.1'
}
// Tsc madness part 2
htmx.onLoad = onLoadHelper
@ -1626,6 +1626,9 @@ var htmx = (function() {
* @param {HtmxSettleInfo} settleInfo
*/
function swapOuterHTML(target, fragment, settleInfo) {
if (target instanceof Element && target.tagName === 'BODY') { // special case the body to innerHTML because DocumentFragments can't contain a body elt unfortunately
return swapInnerHTML(target, fragment, settleInfo)
}
/** @type {Node} */
let newElt
const eltBeforeNewContent = target.previousSibling
@ -1851,7 +1854,7 @@ var htmx = (function() {
findAndSwapOobElements(fragment, settleInfo)
forEach(findAll(fragment, 'template'), /** @param {HTMLTemplateElement} template */function(template) {
findAndSwapOobElements(template.content, settleInfo)
if (template.content.childElementCount === 0) {
if (template.content.childElementCount === 0 && template.content.textContent.trim() === '') {
// Avoid polluting the DOM with empty templates that were only used to encapsulate oob swap
template.remove()
}
@ -5033,7 +5036,7 @@ var htmx = (function() {
* @property {Element|string} [source]
* @property {Event} [event]
* @property {HtmxAjaxHandler} [handler]
* @property {Element|string} target
* @property {Element|string} [target]
* @property {HtmxSwapStyle} [swap]
* @property {Object|FormData} [values]
* @property {Record<string,string>} [headers]

View File

@ -17,6 +17,7 @@
<li><a href="poll-condition-test.html">Poll Conditionals</a></li>
<li><a href="poll-clears-on-reinit-test.html">Polling Cancels On Reprocessing</a></li>
<li><a href="cache-buster">Cache Busting Test</a></li>
<li><a href="body-swap">Body Swap Test</a></li>
<li>Scroll Tests
<ul>
<li><a href="scroll-test-eventHandler.html">Scroll Event Handler</a></li>

View File

@ -277,7 +277,7 @@ var htmx = (function() {
parseInterval: null,
/** @type {typeof internalEval} */
_: null,
version: '2.0.0'
version: '2.0.1'
}
// Tsc madness part 2
htmx.onLoad = onLoadHelper
@ -1626,6 +1626,9 @@ var htmx = (function() {
* @param {HtmxSettleInfo} settleInfo
*/
function swapOuterHTML(target, fragment, settleInfo) {
if (target instanceof Element && target.tagName === 'BODY') { // special case the body to innerHTML because DocumentFragments can't contain a body elt unfortunately
return swapInnerHTML(target, fragment, settleInfo)
}
/** @type {Node} */
let newElt
const eltBeforeNewContent = target.previousSibling
@ -1851,7 +1854,7 @@ var htmx = (function() {
findAndSwapOobElements(fragment, settleInfo)
forEach(findAll(fragment, 'template'), /** @param {HTMLTemplateElement} template */function(template) {
findAndSwapOobElements(template.content, settleInfo)
if (template.content.childElementCount === 0) {
if (template.content.childElementCount === 0 && template.content.textContent.trim() === '') {
// Avoid polluting the DOM with empty templates that were only used to encapsulate oob swap
template.remove()
}
@ -5033,7 +5036,7 @@ var htmx = (function() {
* @property {Element|string} [source]
* @property {Event} [event]
* @property {HtmxAjaxHandler} [handler]
* @property {Element|string} target
* @property {Element|string} [target]
* @property {HtmxSwapStyle} [swap]
* @property {Object|FormData} [values]
* @property {Record<string,string>} [headers]