nuclo 0.1.38 → 0.1.39

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.
Files changed (2) hide show
  1. package/README.md +57 -40
  2. package/package.json +14 -6
package/README.md CHANGED
@@ -1,10 +1,8 @@
1
1
  # nuclo
2
2
 
3
- **A DOM library for people who peaked in the jQuery era and never looked back.**
3
+ **A simple, explicit DOM library for building reactive user interfaces.**
4
4
 
5
- _Yes, this is yet another JavaScript library. We're aware. The ecosystem now has more libraries than actual developers. We're sorry. Or you're welcome? We're still figuring it out._
6
-
7
- Build reactive UIs without the magic tricks. Just functions, mutations, and a single `update()` call when you feel like it.
5
+ Build reactive UIs without the magic. Just functions, plain JavaScript objects, and explicit `update()` calls. No virtual DOM, no complex state management, no build configuration required.
8
6
 
9
7
  ```ts
10
8
  import 'nuclo';
@@ -24,12 +22,12 @@ render(counter, document.body);
24
22
 
25
23
  ## Why nuclo?
26
24
 
27
- - **Zero magic** – Like a microwave with just one button. You press `update()`, stuff happens.
28
- - **No virtual DOM** – Why simulate the DOM when you can just... use the DOM? *taps forehead*
29
- - **Tiny footprint** – Smaller than your average React component's prop types
30
- - **Global API** – `div()` is everywhere, like that one friend who shows up uninvited but makes everything fun
31
- - **TypeScript-first** – All 140+ tags typed. Yes, even `<bdi>`. You're welcome.
32
- - **Real reactivity** – Updates only what changed. Your browser's repaint budget will thank you.
25
+ - **Explicit and Predictable** – You control when updates happen with a simple `update()` call
26
+ - **Direct DOM Manipulation** – Work directly with the DOM, no virtual layer in between
27
+ - **Tiny Footprint** – Minimal bundle size, maximum performance
28
+ - **Global Tag Builders** – Natural API with global functions for all HTML and SVG elements
29
+ - **TypeScript-First** – Full type definitions for all 140+ HTML and SVG tags
30
+ - **Fine-Grained Reactivity** – Only updates what changed, nothing more
33
31
 
34
32
  ---
35
33
 
@@ -206,7 +204,7 @@ import 'nuclo';
206
204
  type Product = { id: number; title: string; category: string };
207
205
  type State = { status: 'idle' | 'loading' | 'error'; products: Product[]; error?: string };
208
206
 
209
- let state: State = { status: 'idle', products: [] };
207
+ const state: State = { status: 'idle', products: [] };
210
208
  let searchQuery = 'phone';
211
209
 
212
210
  async function fetchProducts() {
@@ -270,7 +268,7 @@ render(app, document.body);
270
268
 
271
269
  ### 1. **Explicit Updates**
272
270
 
273
- Unlike React or Vue, nuclo doesn't auto-detect changes. You call `update()` when ready:
271
+ nuclo doesn't auto-detect changes. You call `update()` when ready:
274
272
 
275
273
  ```ts
276
274
  let name = 'World';
@@ -285,11 +283,11 @@ update();
285
283
 
286
284
  **Advantages of explicit `update()`:**
287
285
 
288
- - **Performance**: Batch mutations like a responsible adult. One `update()` > ten thousand proxy getters watching your every variable assignment like helicopter parents.
289
- - **Control**: You're the boss of when pixels change. Perfect for animations, async chaos, or coordinating changes without asking a framework permission.
290
- - **Predictability**: Zero surprise re-renders. No "why did this component update 47 times?!" sessions in DevTools.
291
- - **Simplicity**: No proxies, no dependency graphs, no PhD required. Just objects and a function named `update()`. Revolutionary, we know.
292
- - **Debugging**: Put a breakpoint at `update()`. That's it. That's the whole debugging strategy.
286
+ - **Performance**: Batch multiple mutations into a single update cycle
287
+ - **Control**: You decide exactly when the UI should refresh
288
+ - **Predictability**: Zero surprise re-renders, explicit update flow
289
+ - **Simplicity**: No proxies, no dependency graphs, just objects and functions
290
+ - **Debugging**: Set a breakpoint at `update()` to trace all state changes
293
291
 
294
292
  ```ts
295
293
  // Example: Batch updates for better performance
@@ -443,16 +441,16 @@ div({
443
441
 
444
442
  ### Batch Updates
445
443
 
446
- Mutate like you're stress-testing the array, then update once like you meant to do that:
444
+ Make multiple changes, then update once:
447
445
 
448
446
  ```ts
449
- // Galaxy brain
447
+ // Efficient: One update for all changes
450
448
  items.push(item1);
451
449
  items.push(item2);
452
450
  items.sort();
453
451
  update();
454
452
 
455
- // Smooth brain (but hey, it works)
453
+ // Works but inefficient: Multiple updates
456
454
  items.push(item1);
457
455
  update();
458
456
  items.push(item2);
@@ -461,14 +459,14 @@ update();
461
459
 
462
460
  ### Object Identity for Lists
463
461
 
464
- Lists track items by reference. Mutate the object, not your soul:
462
+ Lists track items by reference. Mutate objects in place:
465
463
 
466
464
  ```ts
467
- // The way
465
+ // Good: Mutate the object
468
466
  todos[0].done = true;
469
467
  update();
470
468
 
471
- // The dark side (RIP that DOM element, we hardly knew ye)
469
+ // Avoid: Creates new object, DOM element recreated
472
470
  todos[0] = { ...todos[0], done: true };
473
471
  update();
474
472
  ```
@@ -537,12 +535,12 @@ div(
537
535
 
538
536
  ## Performance
539
537
 
540
- - **No virtual DOM diffing** – We skip the middle-manager and talk directly to the DOM
541
- - **Fine-grained updates** – Only updates what changed. Like a surgeon, not a bulldozer.
542
- - **Element reuse** – Lists are smart enough to move elements instead of yeeting them into the void
543
- - **Branch preservation** – `when` branches stay alive unless conditions change. Low-key immortal.
538
+ - **No virtual DOM diffing** – Direct DOM manipulation for maximum efficiency
539
+ - **Fine-grained updates** – Only updates what changed, nothing more
540
+ - **Element reuse** – Lists intelligently reuse DOM elements when items move
541
+ - **Branch preservation** – Conditional branches persist until conditions change
544
542
 
545
- For high-frequency updates (animations, game loops, existential crises), batch mutations before calling `update()`.
543
+ For high-frequency updates (animations, game loops), batch mutations before calling `update()`.
546
544
 
547
545
  ---
548
546
 
@@ -550,7 +548,7 @@ For high-frequency updates (animations, game loops, existential crises), batch m
550
548
 
551
549
  ### Inspect Markers
552
550
 
553
- Open DevTools, stare at the DOM like it owes you money:
551
+ Open DevTools to see comment markers that help you understand the structure:
554
552
 
555
553
  ```html
556
554
  <!-- when-start-1 -->
@@ -563,26 +561,45 @@ Open DevTools, stare at the DOM like it owes you money:
563
561
  <!-- list-end -->
564
562
  ```
565
563
 
566
- These comment markers are your breadcrumbs. Follow them to victory.
564
+ These markers identify conditional and list boundaries in the DOM.
567
565
 
568
566
  ### Common Issues
569
567
 
570
568
  **Content not updating?**
571
- - Did you call `update()`? (Asking because 80% of the time, you didn't)
572
- - Are your conditions/functions returning what you think they are? `console.log()` is your friend.
569
+ - Ensure you're calling `update()` after state changes
570
+ - Verify your reactive functions are returning the expected values
573
571
 
574
572
  **List items not reusing elements?**
575
- - Stop spreading objects like it's 2018. Mutate them.
576
- - Item references need to be stable, not having an identity crisis on every render.
573
+ - Keep object references stable (mutate instead of replacing)
574
+ - Avoid creating new objects when updating properties
577
575
 
578
576
  ---
579
577
 
580
578
  ## Roadmap
581
579
 
582
- - Keyed list variant (for when object identity isn't your thing)
583
- - Transition/animation helpers (make things swoosh)
584
- - Dev mode diagnostics (we'll yell at you when you forget `update()`)
585
- - SSR support (because apparently servers need to render HTML now)
580
+ - Keyed list variant for explicit key-based tracking
581
+ - Transition and animation helpers
582
+ - Dev mode diagnostics and warnings
583
+ - Server-side rendering (SSR) support
584
+
585
+ ---
586
+
587
+ ## Documentation
588
+
589
+ Full documentation is available at [https://dan2dev.github.io/nuclo/](https://dan2dev.github.io/nuclo/)
590
+
591
+ - [Getting Started](https://dan2dev.github.io/nuclo/getting-started.html)
592
+ - [API Reference](https://dan2dev.github.io/nuclo/api.html)
593
+ - [Examples](https://dan2dev.github.io/nuclo/examples.html)
594
+
595
+ ---
596
+
597
+ ## Author
598
+
599
+ Created by **Danilo Celestino de Castro**
600
+
601
+ - GitHub: [@dan2dev](https://github.com/dan2dev)
602
+ - Twitter: [@dan2dev](https://twitter.com/dan2dev)
586
603
 
587
604
  ---
588
605
 
@@ -590,6 +607,6 @@ These comment markers are your breadcrumbs. Follow them to victory.
590
607
 
591
608
  MIT License - see [LICENSE.md](LICENSE.md) for details.
592
609
 
593
- This library is free and open source. When using nuclo, please include attribution in your documentation, application, or source code. See the [LICENSE.md](LICENSE.md) file for attribution examples.
610
+ This library is free and open source. When using nuclo, please include attribution in your documentation or application.
594
611
 
595
- **TL;DR:** Use it freely, just give credit. It helps others discover this library!
612
+ **TL;DR:** Use it freely, give credit where it's due!
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "nuclo",
3
3
  "private": false,
4
- "version": "0.1.38",
4
+ "version": "0.1.39",
5
5
  "type": "module",
6
6
  "main": "./dist/nuclo.cjs",
7
7
  "module": "./dist/nuclo.js",
@@ -22,14 +22,21 @@
22
22
  "types"
23
23
  ],
24
24
  "devDependencies": {
25
+ "@eslint/css": "^0.14.0",
26
+ "@eslint/js": "^9.39.0",
27
+ "@eslint/json": "^0.13.2",
28
+ "@eslint/markdown": "^7.5.0",
25
29
  "@rollup/plugin-terser": "^0.4.4",
26
- "@rollup/plugin-typescript": "^12.1.4",
27
- "@types/node": "^24.7.0",
30
+ "@rollup/plugin-typescript": "^12.3.0",
31
+ "@types/node": "^24.9.2",
28
32
  "@vitest/coverage-v8": "3.2.4",
29
- "jsdom": "^27.0.0",
30
- "rollup": "^4.52.4",
33
+ "eslint": "^9.39.0",
34
+ "globals": "^16.4.0",
35
+ "jsdom": "^27.1.0",
36
+ "rollup": "^4.52.5",
31
37
  "tslib": "^2.8.1",
32
38
  "typescript": "^5.9.3",
39
+ "typescript-eslint": "^8.46.2",
33
40
  "vitest": "^3.2.4"
34
41
  },
35
42
  "repository": {
@@ -49,6 +56,7 @@
49
56
  "build:types": "tsc --emitDeclarationOnly",
50
57
  "clean": "rm -rf dist *.tsbuildinfo",
51
58
  "test": "vitest run --coverage",
52
- "test:watch": "vitest --watch"
59
+ "test:watch": "vitest --watch",
60
+ "lint": "eslint . --ext .ts,.js,.json,.jsonc,.json5,.md,.css"
53
61
  }
54
62
  }