mirror of
https://github.com/bigskysoftware/htmx.git
synced 2025-09-30 14:31:47 +00:00
Merge remote-tracking branch 'origin/circleci-project-setup' into dev
This commit is contained in:
commit
a68ff19d31
17
.circleci/config.yml
Normal file
17
.circleci/config.yml
Normal file
@ -0,0 +1,17 @@
|
||||
version: 2.1
|
||||
orbs:
|
||||
node: circleci/node@1.1.6
|
||||
jobs:
|
||||
build-and-test:
|
||||
executor:
|
||||
name: node/default
|
||||
steps:
|
||||
- checkout
|
||||
- node/with-cache:
|
||||
steps:
|
||||
- run: npm install
|
||||
- run: npm test
|
||||
workflows:
|
||||
build-and-test:
|
||||
jobs:
|
||||
- build-and-test
|
@ -1,14 +1,17 @@
|
||||

|
||||

|
||||
|
||||
*high power tools for HTML*
|
||||
|
||||
[](https://gitter.im/intercooler-js/Lobby?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)
|
||||
[](https://app.netlify.com/sites/htmx/deploys)
|
||||
|
||||
## Introduction
|
||||
|
||||
htmx is a set of extensions (attributes, request headers, etc.) that help you build
|
||||
[modern UI](https://htmx.org/examples) with the [simplicity](https://en.wikipedia.org/wiki/HATEOAS) and
|
||||
[power](https://www.ics.uci.edu/~fielding/pubs/dissertation/rest_arch_style.htm) of HTML.
|
||||
|
||||
Htmx is small ([~6k min.gz'd](https://unpkg.com/htmx.org/dist/)), IE11 compatible, [dependency-free](https://github.com/bigskysoftware/htmx/blob/master/package.json)
|
||||
htmx is small ([~6k min.gz'd](https://unpkg.com/htmx.org/dist/)), IE11 compatible, [dependency-free](https://github.com/bigskysoftware/htmx/blob/master/package.json)
|
||||
& you can try it out quickly, without a huge rewrite.
|
||||
|
||||
## Quick Start
|
||||
|
@ -6,7 +6,7 @@ layout: demo_layout.njk
|
||||
|
||||
This example shows how to implement a delete button that removes a table row upon completion.
|
||||
|
||||
Each row has a button with a `kt-delete` attribute containing the url on which to issue a DELETE request to delete the row from the server.
|
||||
Each row has a button with a `hx-delete` attribute containing the url on which to issue a DELETE request to delete the row from the server.
|
||||
This request should respond with empty content.
|
||||
|
||||
```html
|
||||
@ -15,19 +15,19 @@ This request should respond with empty content.
|
||||
<td>angie@macdowell.org</td>
|
||||
<td>Active</td>
|
||||
<td>
|
||||
<button class="btn btn-danger" kt-delete="/contact/1">
|
||||
<button class="btn btn-danger" hx-delete="/contact/1">
|
||||
Delete
|
||||
</button>
|
||||
</td>
|
||||
</tr>
|
||||
```
|
||||
|
||||
In order to tell where to put this empty content, the table body has an `kt-target` attribute set to `closest tr` . This will target the row containing the button which triggred the action, replacing it by... nothing.
|
||||
In order to tell where to put this empty content, the table body has an `hx-target` attribute set to `closest tr` . This will target the row containing the button which triggred the action, replacing it by... nothing.
|
||||
|
||||
It also has a `kt-swap` attribute set to `outerHTML 1s` in order to replace the row itself, with a 1 second delay allowing for a CSS3 transition to fade the row out.
|
||||
It also has a `hx-swap` attribute set to `outerHTML 1s` in order to replace the row itself, with a 1 second delay allowing for a CSS3 transition to fade the row out.
|
||||
During this one second delay, the class "kutty-swapping" is added to `tr` element about to be replaced.
|
||||
|
||||
Finally, the body also has a `kt-confirm` attribute so that a confirmation popup is shown before triggering the action for real.
|
||||
Finally, the body also has a `hx-confirm` attribute so that a confirmation popup is shown before triggering the action for real.
|
||||
|
||||
```html
|
||||
<table class="table delete-row-example">
|
||||
@ -39,7 +39,7 @@ Finally, the body also has a `kt-confirm` attribute so that a confirmation popup
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody kt-confirm="Are you sure?" kt-target="closest tr" kt-swap="outerHTML swap:1s">
|
||||
<tbody hx-confirm="Are you sure?" hx-target="closest tr" hx-swap="outerHTML swap:1s">
|
||||
...
|
||||
</tbody>
|
||||
</table>
|
||||
@ -92,7 +92,7 @@ Finally, the body also has a `kt-confirm` attribute so that a confirmation popup
|
||||
<td>${contact["email"]}</td>
|
||||
<td>${contact["status"]}</td>
|
||||
<td>
|
||||
<button class="btn btn-danger" kt-delete="/contact/${i}">
|
||||
<button class="btn btn-danger" hx-delete="/contact/${i}">
|
||||
Delete
|
||||
</button>
|
||||
</td>
|
||||
@ -116,7 +116,7 @@ Finally, the body also has a `kt-confirm` attribute so that a confirmation popup
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody kt-confirm="Are you sure?" kt-target="closest tr" kt-swap="outerHTML swap:1s">
|
||||
<tbody hx-confirm="Are you sure?" hx-target="closest tr" hx-swap="outerHTML swap:1s">
|
||||
${rows}
|
||||
</tbody>
|
||||
</table>`;
|
||||
|
@ -30,6 +30,7 @@ This div is then replaced with a new div that reloads itself every 600ms:
|
||||
</div>
|
||||
</div>
|
||||
```
|
||||
|
||||
This HTML is rerendered every 600 milliseconds, with the "width" style attribute on the progress bar being updated.
|
||||
Because there is an id on the progress bar div, htmx will smoothly transition between requests by settling the
|
||||
style attribute into its new value. This, when coupled with CSS transitions, make the visual transition continuous
|
||||
@ -52,6 +53,34 @@ Finally, when the process is complete, a restart button is added to the UI:
|
||||
</button>
|
||||
```
|
||||
|
||||
This example uses styling cribbed from the bootstrap progress bar:
|
||||
|
||||
```css
|
||||
.progress {
|
||||
height: 20px;
|
||||
margin-bottom: 20px;
|
||||
overflow: hidden;
|
||||
background-color: #f5f5f5;
|
||||
border-radius: 4px;
|
||||
box-shadow: inset 0 1px 2px rgba(0,0,0,.1);
|
||||
}
|
||||
.progress-bar {
|
||||
float: left;
|
||||
width: 0%;
|
||||
height: 100%;
|
||||
font-size: 12px;
|
||||
line-height: 20px;
|
||||
color: #fff;
|
||||
text-align: center;
|
||||
background-color: #337ab7;
|
||||
-webkit-box-shadow: inset 0 -1px 0 rgba(0,0,0,.15);
|
||||
box-shadow: inset 0 -1px 0 rgba(0,0,0,.15);
|
||||
-webkit-transition: width .6s ease;
|
||||
-o-transition: width .6s ease;
|
||||
transition: width .6s ease;
|
||||
}
|
||||
```
|
||||
|
||||
{% include demo_ui.html.liquid %}
|
||||
|
||||
<style>
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 6.8 KiB After Width: | Height: | Size: 14 KiB |
@ -2,7 +2,7 @@
|
||||
layout: layout.njk
|
||||
tags: post
|
||||
title: kutty 0.0.1 has been released!
|
||||
date: 2020-05-16
|
||||
date: 2020-05-15
|
||||
---
|
||||
|
||||
## Kutty 0.0.1 Release
|
||||
|
@ -2,12 +2,12 @@
|
||||
layout: layout.njk
|
||||
tags: post
|
||||
title: kutty, er, htmx 0.0.3 has been released!
|
||||
date: 2020-05-18
|
||||
date: 2020-05-17
|
||||
---
|
||||
|
||||
## htmx 0.0.3 Release
|
||||
|
||||
I'm pleased to announce the [0.0.2 release](https://unpkg.com/browse/htmx.org@0.0.3/) of kutty, the successor
|
||||
I'm pleased to announce the [0.0.3 release](https://unpkg.com/browse/htmx.org@0.0.3/) of kutty, er, htmx, the successor
|
||||
to [intercooler.js](http://intercoolerjs.org)!
|
||||
|
||||
#### Why not kutty 0.0.2?
|
||||
|
Loading…
x
Reference in New Issue
Block a user