From 92158f7d9394ee010abe22798579ad58100904d7 Mon Sep 17 00:00:00 2001 From: Joe Pea Date: Mon, 27 Oct 2025 01:59:17 -0700 Subject: [PATCH] prefix any attribute with a lightsaber `!`, or wrap a value with `force()`, to force updates, bypassing equality checks. For text content interpolations, only `force()` can be used. run only unit tests in CI to avoid perf test flakes --- .github/workflows/test.yml | 4 +- CONTRIBUTING.md | 2 +- README.md | 169 +++++++++++- examples/images/grogu-runs.jpg | Bin 0 -> 20933 bytes examples/images/grogu.webp | Bin 0 -> 23372 bytes examples/images/lightsabers.png | Bin 0 -> 31023 bytes examples/images/mando.webp | Bin 0 -> 21556 bytes html.js | 255 +++++++++++++---- test/force.test.js | 466 ++++++++++++++++++++++++++++++++ 9 files changed, 829 insertions(+), 67 deletions(-) create mode 100644 examples/images/grogu-runs.jpg create mode 100644 examples/images/grogu.webp create mode 100644 examples/images/lightsabers.png create mode 100644 examples/images/mando.webp create mode 100644 test/force.test.js diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 9a770c2..9ecc914 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -26,7 +26,7 @@ jobs: run: npm clean-install - name: Create declarations for library consumers - run: npm build + run: npm run build - name: Run tests - run: npm test + run: npm run test:unit diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 510a145..07a40ca 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -78,7 +78,7 @@ reference, using `describe` and `it` functions to describe unit tests. - Always prefer `const` for variables that don't change, and `let` only for variables that change. Never use `var` unless absolutely necessary for special hoisting reasons. -- Always prefer for-of over items.forEach +- Always prefer for-of over `items.forEach` - Always prefer `element.remove()` instead of `element.parentNode.removeChild(element)`. - Always prefer `parentElement.append(childElement)` instead of `parentElement.appendChild(childElement)`. diff --git a/README.md b/README.md index d62bfee..ad8f3de 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,11 @@ # nimble-html -A light-weight template tag library with `html`, `svg`, and `mathml` functions for writing declarative-reactive web apps. +A light-weight single-file dependency-free template tag library with `html`, +`svg`, and `mathml` functions for writing declarative-reactive web apps. + +Nimble like Grogu. + + ## At a glance @@ -71,8 +76,8 @@ console.log(div.textContent) // "Message: Hello Webdev" # Examples -- [Basic](https://rawcdn.githack.com/lume/nimble-html/c250c4f8db47d623fb4643613f1370dbac2d936f/examples/basic.html) - [source](./examples/basic.html) -- [Custom Elements](https://rawcdn.githack.com/lume/nimble-html/c250c4f8db47d623fb4643613f1370dbac2d936f/examples/custom-elements/index.html) - [source](./examples/custom-elements/index.html) +- [Basic](https://raw.githack.com/lume/nimble-html/main/examples/basic.html) - [source](./examples/basic.html) +- [Custom Elements](https://raw.githack.com/lume/nimble-html/main/examples/custom-elements/index.html) - [source](./examples/custom-elements/index.html) # Installation @@ -81,7 +86,7 @@ from GitHub into your JS code (f.e. using the raw.githack.com proxy): ```html