sibujs 3.4.0 → 4.0.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.
Files changed (98) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +118 -15
  3. package/dist/browser.cjs +410 -101
  4. package/dist/browser.d.cts +50 -5
  5. package/dist/browser.d.ts +50 -5
  6. package/dist/browser.js +8 -6
  7. package/dist/build.cjs +777 -385
  8. package/dist/build.js +15 -15
  9. package/dist/cdn.global.js +11 -7
  10. package/dist/{chunk-JCO7AHNU.js → chunk-3EKJK5FZ.js} +73 -34
  11. package/dist/chunk-4MFZMLUU.js +147 -0
  12. package/dist/chunk-52XFPGSN.js +123 -0
  13. package/dist/chunk-5INI7D2L.js +194 -0
  14. package/dist/{chunk-OAVXAFAY.js → chunk-6LG2T7LO.js} +5 -5
  15. package/dist/{chunk-OOUQUCNN.js → chunk-ACBT6UZS.js} +57 -22
  16. package/dist/{chunk-F7HW2NI5.js → chunk-AW6HPJ3L.js} +1 -1
  17. package/dist/chunk-DHDZ7IVN.js +109 -0
  18. package/dist/{chunk-JNGGM2XE.js → chunk-DQVUBVNX.js} +16 -25
  19. package/dist/{chunk-AXFWGY32.js → chunk-DR7H6UGM.js} +232 -67
  20. package/dist/{chunk-WSGLJYFI.js → chunk-E62UADKL.js} +9 -3
  21. package/dist/{chunk-3Z2NGWQI.js → chunk-ES2GERY2.js} +1 -1
  22. package/dist/{chunk-S3V6ZXPI.js → chunk-EWEE7NBF.js} +115 -41
  23. package/dist/{chunk-3DVGCW7O.js → chunk-F64ZPCFE.js} +8 -8
  24. package/dist/{chunk-APFRCIRI.js → chunk-GCSGGA3Q.js} +295 -198
  25. package/dist/{chunk-EX77FXTT.js → chunk-HYCCIYNS.js} +228 -51
  26. package/dist/{chunk-ELXMRSVN.js → chunk-NF3LYCQH.js} +259 -124
  27. package/dist/chunk-O3QQ3XOL.js +61 -0
  28. package/dist/{chunk-BUKYCWHX.js → chunk-PBQEW5VW.js} +14 -10
  29. package/dist/{chunk-H5FI5WDP.js → chunk-RRIDJQ5C.js} +3 -3
  30. package/dist/{chunk-S3NFJO6L.js → chunk-TIRZCERI.js} +36 -5
  31. package/dist/{chunk-ODXVQ3CS.js → chunk-VFHIVEPF.js} +309 -188
  32. package/dist/chunk-VPP2FONR.js +142 -0
  33. package/dist/{chunk-KZBEVFXZ.js → chunk-W55YHPEP.js} +5 -3
  34. package/dist/{chunk-FKQG7FTY.js → chunk-WN6WDFCB.js} +4 -4
  35. package/dist/{chunk-CEBWDD63.js → chunk-WOOMUJFT.js} +228 -86
  36. package/dist/{chunk-ITWCTZYH.js → chunk-Z2CE42DB.js} +19 -25
  37. package/dist/{contracts-ey_Qh8ef.d.cts → contracts-Hg6ITAEF.d.cts} +6 -6
  38. package/dist/{contracts-ey_Qh8ef.d.ts → contracts-Hg6ITAEF.d.ts} +6 -6
  39. package/dist/{customElement-CPfIrbvg.d.ts → customElement-CKLoO63w.d.cts} +73 -11
  40. package/dist/{customElement-CPfIrbvg.d.cts → customElement-CKLoO63w.d.ts} +73 -11
  41. package/dist/data.cjs +483 -205
  42. package/dist/data.d.cts +139 -7
  43. package/dist/data.d.ts +139 -7
  44. package/dist/data.js +9 -9
  45. package/dist/devtools.cjs +222 -87
  46. package/dist/devtools.js +8 -8
  47. package/dist/dispose-4FZ6OFXR.js +19 -0
  48. package/dist/ecosystem.cjs +419 -175
  49. package/dist/ecosystem.js +11 -11
  50. package/dist/extras.cjs +1981 -765
  51. package/dist/extras.d.cts +7 -7
  52. package/dist/extras.d.ts +7 -7
  53. package/dist/extras.js +29 -26
  54. package/dist/index.cjs +784 -385
  55. package/dist/index.d.cts +299 -28
  56. package/dist/index.d.ts +299 -28
  57. package/dist/index.js +33 -18
  58. package/dist/motion.cjs +180 -50
  59. package/dist/motion.d.cts +26 -0
  60. package/dist/motion.d.ts +26 -0
  61. package/dist/motion.js +5 -5
  62. package/dist/patterns.cjs +437 -170
  63. package/dist/patterns.d.cts +60 -13
  64. package/dist/patterns.d.ts +60 -13
  65. package/dist/patterns.js +7 -7
  66. package/dist/performance.cjs +333 -148
  67. package/dist/performance.d.cts +55 -7
  68. package/dist/performance.d.ts +55 -7
  69. package/dist/performance.js +9 -9
  70. package/dist/plugins.cjs +1374 -576
  71. package/dist/plugins.d.cts +227 -9
  72. package/dist/plugins.d.ts +227 -9
  73. package/dist/plugins.js +613 -321
  74. package/dist/{ssr-D62yFwuw.d.cts → ssr-BiPRdZ6n.d.cts} +44 -15
  75. package/dist/{ssr-D62yFwuw.d.ts → ssr-BiPRdZ6n.d.ts} +44 -15
  76. package/dist/{ssr-2PPULEK2.js → ssr-JFP5535P.js} +5 -4
  77. package/dist/ssr.cjs +1104 -443
  78. package/dist/ssr.d.cts +230 -20
  79. package/dist/ssr.d.ts +230 -20
  80. package/dist/ssr.js +15 -12
  81. package/dist/{startup-0Qv6aosO.d.cts → startup-BMpaiMhP.d.cts} +1 -1
  82. package/dist/{startup-0Qv6aosO.d.ts → startup-BMpaiMhP.d.ts} +1 -1
  83. package/dist/testing.cjs +205 -63
  84. package/dist/testing.d.cts +1 -1
  85. package/dist/testing.d.ts +1 -1
  86. package/dist/testing.js +8 -10
  87. package/dist/ui.cjs +640 -199
  88. package/dist/ui.d.cts +2 -2
  89. package/dist/ui.d.ts +2 -2
  90. package/dist/ui.js +10 -10
  91. package/dist/widgets.cjs +207 -82
  92. package/dist/widgets.js +9 -9
  93. package/package.json +12 -7
  94. package/dist/chunk-5VGSK6D2.js +0 -80
  95. package/dist/chunk-COY6PUD2.js +0 -34
  96. package/dist/chunk-K35BAR4P.js +0 -96
  97. package/dist/chunk-L3GAGWCC.js +0 -111
  98. package/dist/chunk-RT3IYFN2.js +0 -38
package/LICENSE CHANGED
@@ -1,21 +1,21 @@
1
- MIT License
2
-
3
- Copyright (c) 2025 Fran Ramírez
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Fran Ramírez
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -2,16 +2,27 @@
2
2
 
3
3
  A lightweight, function-based frontend framework with fine-grained reactivity, direct DOM rendering, and zero compilation. **No Virtual DOM. No magic.**
4
4
 
5
- [[NPM Version]](https://www.npmjs.com/package/sibujs)
6
- [[License]](https://github.com/hexplus/sibujs/blob/main/LICENSE)
5
+ [NPM](https://www.npmjs.com/package/sibujs) · [License](https://github.com/hexplus/sibujs/blob/main/LICENSE)
7
6
 
8
7
  ## Why SibuJS?
9
8
 
10
- - **Zero VDOM:** Updates only what changes, directly in the DOM.
11
- - **Function-Based:** Components are just plain functions. No classes, no complex life cycles.
12
- - **Fine-Grained Reactivity:** Powered by lightweight signals.
13
- - **No Build Step Required:** Works natively in the browser, but includes a Vite plugin for advanced optimizations.
14
- - **Modular & Lean:** Core is minimal; features like Router and i18n are optional plugins.
9
+ - **Zero VDOM:** No Virtual DOM and no component-tree reconciliation. Reactive bindings update their exact DOM targets directly; keyed collections reconcile only their own DOM range.
10
+ - **Function-Based:** Components are plain functions returning nodes. No classes, no hooks rules, no compiler-only syntax.
11
+ - **Fine-Grained Reactivity:** `signal`, `derived`, and `effect` track dependencies automatically and update at the value level.
12
+ - **No Build Step Required:** Runs natively in the browser (or via a `<script>` tag), with an optional Vite plugin for template compilation and other build-time optimizations.
13
+ - **Modular & Lean:** The core stays small; every advanced capability ships as a tree-shakeable subpath import, so you pay only for what you use.
14
+ - **Full-Featured:** When you need more, it's already there — router, i18n, SSR with streaming and hydration, islands & progressive enhancement, data fetching, state machines, and reactive wrappers for dozens of browser APIs.
15
+ - **TypeScript-First:** Written in TypeScript with typed props for common elements and full type inference across signals and components.
16
+
17
+ ## Requirements
18
+
19
+ - **Node.js ≥ 22.3.0** for SSR and tooling. Node 18 and 20 are not supported —
20
+ both are end-of-life, and SSR request isolation depends on
21
+ `process.getBuiltinModule`, added in 22.3.
22
+ - **Browsers:** Chrome/Edge ≥ 93, Firefox ≥ 92, Safari ≥ 15.4. The floor is what
23
+ the source actually requires (`Object.hasOwn`, `ParentNode.replaceChildren`
24
+ and `new Error(msg, { cause })`), enforced by a build gate rather than only
25
+ documented.
15
26
 
16
27
  ## Quick Start
17
28
 
@@ -90,15 +101,107 @@ For full documentation, guides, and advanced examples, visit our official websit
90
101
 
91
102
  ---
92
103
 
93
- ## Features at a Glance
104
+ ## Core (`sibujs`)
105
+
106
+ The lean core: reactivity, rendering, and components. Everything below imports from the root.
107
+
108
+ ### Reactivity
109
+ - **`signal`** — reactive value returned as a `[get, set]` tuple; reads inside effects auto-track.
110
+ - **`derived`** — memoized value computed from other signals.
111
+ - **`asyncDerived`** — derived value from an async computation, with loading/error state.
112
+ - **`effect`** — run a side effect whenever its tracked dependencies change.
113
+ - **`watch`** — observe specific sources and react to their new/old values.
114
+ - **`batch`** — group multiple updates into a single flush.
115
+ - **`untracked` / `retrack`** — read signals without subscribing, or re-enable tracking.
116
+ - **`store`** — simple keyed state container.
117
+ - **`deepSignal`** — deep reactive proxy over nested objects/arrays.
118
+ - **`reactiveArray`** — reactive array with fine-grained item tracking.
119
+ - **`writable`** — writable derived (two-way computed).
120
+ - **`ref`** — hold a DOM element or mutable value.
121
+ - **`nextTick`** — await the next reactive flush.
122
+
123
+ ### Rendering & Control Flow
124
+ - **HTML/SVG tag factories** — `div`, `span`, `button`, … and SVG tags with the correct namespace.
125
+ - **`mount`** — render a component into a DOM node.
126
+ - **`html`** — tagged-template authoring (compiler-free, legacy-friendly).
127
+ - **`when`** — conditionally swap subtrees; **`show`** — toggle visibility without unmounting.
128
+ - **`each`** — efficient keyed list rendering (LIS-based diffing).
129
+ - **`match`** — pattern-matching over a value to pick a branch.
130
+ - **`Fragment`** — group children without a wrapper element.
131
+ - **`Portal`** — render a subtree elsewhere in the DOM.
132
+ - **`DynamicComponent`** — render a component chosen at runtime.
133
+ - **`lazy` / `Suspense`** — code-split async components with a fallback.
134
+ - **`slot` / `getSlot`** — named content slots.
135
+ - **`KeepAlive`** — cache and preserve unmounted subtrees.
136
+ - **Directives** — `clickOutside`, `longPress`, `copyOnClick`, `autoResize`, `trapFocus`.
137
+ - **`action`** — register reusable element behaviors.
138
+
139
+ ### Components & Lifecycle
140
+ - **Functional components** — plain functions returning nodes.
141
+ - **Lifecycle** — `onMount`, `onUnmount`, `onCleanup`.
142
+ - **`context`** — dependency injection down the tree.
143
+ - **`ErrorBoundary` / `ErrorDisplay`** — catch and render render-time errors.
144
+ - **`Loading`** — standard loading placeholder.
145
+ - **`catchError` / `catchErrorAsync`** — scoped error handling helpers.
146
+
147
+ ### Islands & Progressive Enhancement
148
+ - **`enhance` / `enhanceAll`** — attach fine-grained reactivity to existing server-rendered HTML with no build step (the third rendering mode alongside `mount` and `hydrate`).
149
+ - **`island` / `registerIsland` / `hydrateIslands`** — hydrate isolated interactive regions on demand.
150
+
151
+ ---
152
+
153
+ ## Subpath Modules
154
+
155
+ Import advanced features from focused entry points for optimal tree-shaking. `sibujs/extras` re-exports all of them for convenience.
156
+
157
+ ### `sibujs/data` — Data fetching & realtime
158
+ `query` (cached async fetching), `mutation`, `infiniteQuery`, `resource`, `routeLoader`, `offlineStore`, `retry`, `debounce`, `throttle`, `previous`, plus `socket` and `stream` for realtime connections.
159
+
160
+ ### `sibujs/browser` — Reactive browser APIs
161
+ Reactive wrappers for `media` queries, `resize`, `scroll`, `online`/`network`, `geo`, `battery`, `idle`, `permissions`, `clipboard`, `dragDrop`, `title`/`favicon`, `colorScheme`, `visibility`, `mouse`/`swipe`, `windowSize`, `urlState`, `broadcast`, `fullscreen`, `wakeLock`, `animationFrame`, `mutationObserver`, `bounds`, `keyboard`, `speech`, `gamepad`, `pointerLock`, `vibrate`, `textSelection`, `imageLoader`, and `format`.
162
+
163
+ ### `sibujs/ui` — UI utilities
164
+ `form` & `formAction` (validation/binding), `virtualList`, `intersection`, `inputMask`, `a11y` / `a11yPrimitives`, `scopedStyle`, `reactiveAttr`, `dialog`, `toast`, `infiniteScroll`, `pagination`, `eventBus`, `timers`, `hover`, `scrollLock`, `lazyEffect`, plus composable/HOC patterns.
165
+
166
+ ### `sibujs/widgets` — Pre-built components
167
+ Accessible `Combobox`, `Tabs`, `Accordion`, `Popover`, `Select`, `Tooltip`, `FileUpload`, `contentEditable`, and `datePicker`.
168
+
169
+ ### `sibujs/motion` — Transitions & animation
170
+ `transition`, `TransitionGroup`, `animationPresets`, `viewTransition`, `springSignal`, and `reducedMotion`.
94
171
 
95
- - **Reactivity:** `signal`, `effect`, `derived`, `watch`, `batch`.
96
- - **Components:** Functional, reusable, and lifecycle-aware (`onMount`, `onUnmount`).
97
- - **Control Flow:** `when` (conditional swaps), `each` (efficient keyed lists), `match` (pattern matching), `show` (toggle visibility).
98
- - **DOM Utilities:** `Portal` (render out-of-tree), `Fragment` (group children), `Suspense` & `lazy` (async components), `ErrorBoundary`.
99
- - **State Management:** `store` (simple state containers), `deepSignal` (object proxies), `ref`.
100
- - **Performance:** Zero VDOM overhead, LIS-based list diffing, and optional template compilation.
101
- - **Plugins:** Official Router (nested routes, guards), i18n (reactive translations), logic patterns (Finite State Machines).
172
+ ### `sibujs/patterns` State & component patterns
173
+ `machine` (finite state machines), `persist`, `optimistic`, `timeTravel`, `globalStore`; plus `hoc`, `composable`, `componentProps`, and `contracts`.
174
+
175
+ ### `sibujs/plugins` First-party plugins
176
+ **Router** `createRouter`, `Route`/`Outlet`/`RouterLink`, nested routes, guards (`beforeEach`, `beforeResolve`, `afterEach`), programmatic navigation, `preloadRoute`, memory router, and per-route transitions. **i18n** — `setLocale`, `t`, `Trans`, `registerTranslations`, reactive locale switching. Plus the plugin system (`modular`, `ecosystem`, `versioning`, `startup`).
177
+
178
+ ### `sibujs/ssr` Server rendering
179
+ `renderToString`, `renderToReadableStream`, `renderToDocument`, `hydrate`, streaming `Suspense`, `head` management, static site generation, incremental regeneration, route actions/middleware, scroll restoration, service worker & web/wasm workers, and microfrontend helpers.
180
+
181
+ ### `sibujs/performance` — Scheduling & optimization
182
+ Concurrent rendering (`startTransition`, `scheduleUpdate`), cooperative `scheduler`, `domRecycler`, `compiled` templates, `chunkLoader`, `bundleOptimize`, and `normalize`.
183
+
184
+ ### `sibujs/devtools` — Developer tools
185
+ `debug`, `debugValue`, `componentProfiler`, `signalGraph`, `introspect`, `devtoolsOverlay`, HMR support, and source maps.
186
+
187
+ ### `sibujs/build` — Build tooling
188
+ Bundler plugins (`vite`, `webpack`), template compilation, route splitting, static analysis, linting, `.d.ts` declaration generation, CDN helpers, and IDE integration.
189
+
190
+ ### `sibujs/ecosystem` — Adapters
191
+ Adapters bridging third-party state managers (e.g. Redux, MobX) and UI component libraries.
192
+
193
+ ### `sibujs/testing` — Test helpers
194
+ Utilities for testing components and reactivity.
195
+
196
+ ### `sibujs/cdn` — Script-tag bundle
197
+ Self-registering IIFE build exposing `window.Sibu`, for use without a bundler.
198
+
199
+ ```html
200
+ <script src="https://unpkg.com/sibujs@latest/dist/cdn.global.js"></script>
201
+ <script>
202
+ const { signal, effect, div, mount } = window.Sibu;
203
+ </script>
204
+ ```
102
205
 
103
206
  ---
104
207