balises 0.7.2 → 0.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -4,7 +4,7 @@
4
4
  <img alt="balises" src="./assets/logo.svg" width="280">
5
5
  </picture>
6
6
 
7
- ### A minimal reactive HTML templating library for building websites and web components. ~2.8KB gzipped.
7
+ ### A minimal reactive HTML templating library for building websites and web components. ~3.2KB gzipped.
8
8
 
9
9
  Balises gives you reactive signals and HTML templates without the framework overhead. Works great with custom elements, vanilla JavaScript projects, or anywhere you need dynamic UIs but don't want to pull in React.
10
10
 
@@ -523,6 +523,34 @@ count.value = 1; // logs "count changed to 1"
523
523
  unsubscribe(); // Stop listening
524
524
  ```
525
525
 
526
+ ### `.is(value)`
527
+
528
+ Checks equality with O(1) update performance - ideal for selection patterns.
529
+
530
+ When you have a signal representing a selected item (like `selectedId`), using `.is()` inside computed/templates creates optimized subscriptions. Only computeds checking the **previous** or **new** value are notified on change, not all of them.
531
+
532
+ ```ts
533
+ import { html, signal } from "balises";
534
+
535
+ const selected = signal<number | null>(null);
536
+
537
+ // In a list of 1000 rows, only 2 rows update when selection changes
538
+ // (the previously selected and newly selected)
539
+ function Row({ id, label }) {
540
+ return html`
541
+ <tr class=${() => (selected.is(id) ? "danger" : "")}>
542
+ <td>${id}</td>
543
+ <td>${label}</td>
544
+ </tr>
545
+ `;
546
+ }
547
+
548
+ selected.value = 5; // Only row 5 gets "danger" class
549
+ selected.value = 10; // Only rows 5 and 10 update
550
+ ```
551
+
552
+ Works on both `Signal` and `Computed`. Uses `Object.is()` for equality checks.
553
+
526
554
  ### `.dispose()`
527
555
 
528
556
  Stops a computed from tracking dependencies and frees memory.
@@ -537,7 +565,7 @@ doubled.dispose(); // Stops tracking, frees memory
537
565
  You can import just what you need to keep bundle size down:
538
566
 
539
567
  ```ts
540
- // Full library (~2.8KB gzipped)
568
+ // Full library (~3.2KB gzipped)
541
569
  import { html, signal, computed, effect } from "balises";
542
570
 
543
571
  // Signals only (no HTML templating - use in any JS project)
@@ -689,23 +717,23 @@ Performance comparison of Balises against other popular reactive libraries. Benc
689
717
  ┌───────┬───────────────────┬───────┬───────────────┬──────────────────┐
690
718
  │ Rank │ Library │ Score │ Avg Time (μs) │ vs Fastest │
691
719
  ├───────┼───────────────────┼───────┼───────────────┼──────────────────┤
692
- │ #1 🏆 │ preact@1.12.1 │ 0.000 │ 64.17 │ 1.00x (baseline) │
720
+ │ #1 🏆 │ preact@1.12.1 │ 0.000 │ 64.00 │ 1.00x (baseline) │
693
721
  ├───────┼───────────────────┼───────┼───────────────┼──────────────────┤
694
- │ #2 │ balises@0.7.0 │ 0.033 │ 85.48 │ 1.33x
722
+ │ #2 │ balises@0.7.2 │ 0.022 │ 85.76 │ 1.34x
695
723
  ├───────┼───────────────────┼───────┼───────────────┼──────────────────┤
696
- │ #3 │ vue@3.5.26 │ 0.095 │ 94.27 │ 1.47x
724
+ │ #3 │ vue@3.5.26 │ 0.080 │ 94.69 │ 1.48x
697
725
  ├───────┼───────────────────┼───────┼───────────────┼──────────────────┤
698
- │ #4 │ maverick@6.0.0 │ 0.146 │ 124.89 │ 1.95x
726
+ │ #4 │ maverick@6.0.0 │ 0.142 │ 124.28 │ 1.94x
699
727
  ├───────┼───────────────────┼───────┼───────────────┼──────────────────┤
700
- │ #5 │ usignal@0.10.0 │ 0.175133.48 │ 2.08x
728
+ │ #5 │ usignal@0.10.0 │ 0.190135.64 │ 2.12x
701
729
  ├───────┼───────────────────┼───────┼───────────────┼──────────────────┤
702
- │ #6 │ angular@19.2.17 │ 0.214169.86 │ 2.65x
730
+ │ #6 │ angular@19.2.17 │ 0.205163.90 │ 2.56x
703
731
  ├───────┼───────────────────┼───────┼───────────────┼──────────────────┤
704
- │ #7 │ solid@1.9.10 │ 0.343260.01 │ 4.05x
732
+ │ #7 │ solid@1.9.10 │ 0.341269.71 │ 4.21x
705
733
  ├───────┼───────────────────┼───────┼───────────────┼──────────────────┤
706
- │ #8 │ mobx@6.15.0 │ 0.854910.41 │ 14.19x
734
+ │ #8 │ mobx@6.15.0 │ 0.846915.30 │ 14.30x
707
735
  ├───────┼───────────────────┼───────┼───────────────┼──────────────────┤
708
- │ #9 │ hyperactiv@0.11.3 │ 1.000 │ 1051.12 │ 16.38x
736
+ │ #9 │ hyperactiv@0.11.3 │ 1.000 │ 1067.91 │ 16.69x
709
737
  └───────┴───────────────────┴───────┴───────────────┴──────────────────┘
710
738
  ```
711
739
 
@@ -715,19 +743,19 @@ Performance comparison of Balises against other popular reactive libraries. Benc
715
743
  ┌───────────────────┬───────────────┬─────────────┬────────────────┬────────────────────┬─────────────┬──────────────┬──────────┐
716
744
  │ Library │ S1: 1: Layers │ S2: 2: Wide │ S3: 3: Diamond │ S4: 4: Conditional │ S5: 5: List │ S6: 6: Batch │ Avg Rank │
717
745
  ├───────────────────┼───────────────┼─────────────┼────────────────┼────────────────────┼─────────────┼──────────────┼──────────┤
718
- │ preact@1.12.1 │ #1 🏆 │ #1 🏆 │ #2 │ #1 🏆 │ #1 🏆 │ #2 │ 1.3
746
+ │ preact@1.12.1 │ #1 🏆 │ #2 │ #2 │ #1 🏆 │ #1 🏆 │ #2 │ 1.5
719
747
  ├───────────────────┼───────────────┼─────────────┼────────────────┼────────────────────┼─────────────┼──────────────┼──────────┤
720
- │ balises@0.7.0 │ #3 │ #2 │ #1 🏆 │ #2 │ #2 │ #1 🏆 │ 1.8
748
+ │ balises@0.7.2 │ #3 │ #1 🏆 │ #1 🏆 │ #2 │ #2 │ #1 🏆 │ 1.7
721
749
  ├───────────────────┼───────────────┼─────────────┼────────────────┼────────────────────┼─────────────┼──────────────┼──────────┤
722
- │ vue@3.5.26 │ #2 │ #3 │ #5 │ #3 │ #3 │ #5 │ 3.5
750
+ │ vue@3.5.26 │ #2 │ #3 │ #4 │ #3 │ #3 │ #4 │ 3.2
723
751
  ├───────────────────┼───────────────┼─────────────┼────────────────┼────────────────────┼─────────────┼──────────────┼──────────┤
724
- │ maverick@6.0.0 │ #5 │ #5 │ #4 │ #4 │ #4 │ #4 │ 4.3 │
752
+ │ maverick@6.0.0 │ #5 │ #5 │ #3 │ #4 │ #4 │ #5 │ 4.3 │
725
753
  ├───────────────────┼───────────────┼─────────────┼────────────────┼────────────────────┼─────────────┼──────────────┼──────────┤
726
- │ usignal@0.10.0 │ #4 │ #4 │ #3 │ #5 │ #8 │ #6 │ 5.0
754
+ │ usignal@0.10.0 │ #4 │ #4 │ #5 │ #5 │ #8 │ #7 │ 5.5
727
755
  ├───────────────────┼───────────────┼─────────────┼────────────────┼────────────────────┼─────────────┼──────────────┼──────────┤
728
756
  │ angular@19.2.17 │ #6 │ #6 │ #6 │ #6 │ #5 │ #3 │ 5.3 │
729
757
  ├───────────────────┼───────────────┼─────────────┼────────────────┼────────────────────┼─────────────┼──────────────┼──────────┤
730
- │ solid@1.9.10 │ #7 │ #8 │ #7 │ #7 │ #7 │ #7 │ 7.2
758
+ │ solid@1.9.10 │ #7 │ #8 │ #7 │ #7 │ #7 │ #6 │ 7.0
731
759
  ├───────────────────┼───────────────┼─────────────┼────────────────┼────────────────────┼─────────────┼──────────────┼──────────┤
732
760
  │ mobx@6.15.0 │ #9 │ #7 │ #8 │ #8 │ #6 │ #8 │ 7.7 │
733
761
  ├───────────────────┼───────────────┼─────────────┼────────────────┼────────────────────┼─────────────┼──────────────┼──────────┤
@@ -750,7 +778,7 @@ Performance comparison of Balises against other popular reactive libraries. Benc
750
778
  - These are synthetic benchmarks measuring pure reactivity - real apps should consider the whole picture (ecosystem, docs, community, etc.)
751
779
  - Lower rank = better performance
752
780
 
753
- _Last updated: 2026-01-05_
781
+ _Last updated: 2026-01-07_
754
782
 
755
783
  <!-- BENCHMARK_RESULTS_END -->
756
784