xote 1.0.2 → 1.2.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/LICENSE +11 -18
- package/README.md +97 -41
- package/dist/xote.cjs +1 -0
- package/dist/xote.mjs +1041 -0
- package/dist/xote.umd.js +1 -0
- package/package.json +23 -3
- package/.gitattributes +0 -2
- package/.github/workflows/release.yml +0 -44
- package/dist/index.cjs +0 -2
- package/dist/index.cjs.map +0 -1
- package/dist/index.mjs +0 -9
- package/dist/index.mjs.map +0 -1
- package/dist/index.umd.js +0 -2
- package/dist/index.umd.js.map +0 -1
- package/docs/CHANGELOG.md +0 -27
- package/index.html +0 -28
- package/rescript.json +0 -18
- package/src/Xote.res +0 -5
- package/src/Xote.res.mjs +0 -21
- package/src/Xote__Component.res +0 -151
- package/src/Xote__Component.res.mjs +0 -202
- package/src/Xote__Computed.res +0 -43
- package/src/Xote__Computed.res.mjs +0 -61
- package/src/Xote__Core.res +0 -105
- package/src/Xote__Core.res.mjs +0 -148
- package/src/Xote__Effect.res +0 -36
- package/src/Xote__Effect.res.mjs +0 -57
- package/src/Xote__Example.res +0 -266
- package/src/Xote__Example.res.mjs +0 -303
- package/src/Xote__Id.res +0 -5
- package/src/Xote__Id.res.mjs +0 -17
- package/src/Xote__Observer.res +0 -12
- package/src/Xote__Observer.res.mjs +0 -12
- package/src/Xote__Signal.res +0 -31
- package/src/Xote__Signal.res.mjs +0 -64
- package/src/demo/TodoApp.res +0 -289
- package/src/demo/TodoApp.res.mjs +0 -326
- package/vite.config.js +0 -45
package/LICENSE
CHANGED
|
@@ -1,21 +1,14 @@
|
|
|
1
|
-
|
|
1
|
+
Copyright (c) 2025 Bernardo Gurgel, Author of Xote
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
This library is free software: you can redistribute it and/or modify it
|
|
4
|
+
under the terms of the GNU Lesser General Public License as published by
|
|
5
|
+
the Free Software Foundation, either version 3 of the License, or
|
|
6
|
+
(at your option) any later version.
|
|
4
7
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
8
|
+
This library is distributed in the hope that it will be useful,
|
|
9
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
10
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
11
|
+
GNU Lesser General Public License for more details.
|
|
11
12
|
|
|
12
|
-
|
|
13
|
-
|
|
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.
|
|
13
|
+
You should have received a copy of the GNU Lesser General Public License
|
|
14
|
+
along with this library. If not, see https://www.gnu.org/licenses/.
|
package/README.md
CHANGED
|
@@ -1,16 +1,18 @@
|
|
|
1
|
-
# xote
|
|
1
|
+
# xote
|
|
2
2
|
[](https://www.npmjs.com/package/xote)
|
|
3
|
+
[](https://bundlephobia.com/package/xote)
|
|
3
4
|
|
|
4
|
-
|
|
5
|
+
Xote is a lightweight, zero-dependency library for ReScript with fine-grained reactivity based on the [TC39 Signals proposal](https://github.com/tc39/proposal-signals). With Xote, you can build reactive web applications with automatic dependency tracking and efficient updates.
|
|
5
6
|
|
|
6
7
|
## Features
|
|
7
8
|
|
|
8
9
|
- Zero dependencies: pure ReScript implementation
|
|
9
|
-
- Lightweight
|
|
10
|
-
- Declarative components for building reactive UIs
|
|
10
|
+
- Lightweight and efficient runtime (~12kb minified)
|
|
11
|
+
- Declarative components for building reactive UIs with JSX support
|
|
11
12
|
- Reactive primitives: signals, computed values, and effects
|
|
12
13
|
- Automatic dependency tracking: no manual subscription management
|
|
13
14
|
- Fine-grained updates: direct DOM updates without a virtual DOM
|
|
15
|
+
- Signal-based router: SPA navigation with pattern matching and dynamic parameters
|
|
14
16
|
|
|
15
17
|
## Getting Started
|
|
16
18
|
|
|
@@ -32,59 +34,113 @@ Then, add it to your ReScript project’s dependencies in `rescript.json`:
|
|
|
32
34
|
}
|
|
33
35
|
```
|
|
34
36
|
|
|
37
|
+
## Philosophy
|
|
38
|
+
|
|
39
|
+
Xote focuses on clarity, control, and performance. It brings reactive programming to ReScript with minimal abstractions and no runtime dependencies. The goal is to offer precise, fine-grained updates and predictable behavior without a virtual DOM.
|
|
40
|
+
|
|
35
41
|
### Quick Example
|
|
36
42
|
|
|
43
|
+
#### Using JSX
|
|
44
|
+
|
|
37
45
|
```rescript
|
|
38
46
|
open Xote
|
|
39
47
|
|
|
40
|
-
|
|
41
|
-
let
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
~children=[Component.text("Increment")],
|
|
61
|
-
()
|
|
62
|
-
)
|
|
63
|
-
],
|
|
64
|
-
()
|
|
65
|
-
)
|
|
48
|
+
module App = {
|
|
49
|
+
let make = () => {
|
|
50
|
+
// Create reactive state
|
|
51
|
+
let count = Signal.make(0)
|
|
52
|
+
|
|
53
|
+
// Event handler
|
|
54
|
+
let increment = (_evt: Dom.event) => Signal.update(count, n => n + 1)
|
|
55
|
+
|
|
56
|
+
// Build the UI with JSX
|
|
57
|
+
<div>
|
|
58
|
+
<h1> {Component.text("Counter")} </h1>
|
|
59
|
+
<p>
|
|
60
|
+
{Component.textSignal(() => `Count: ${Signal.get(count)->Int.toString}`)}
|
|
61
|
+
</p>
|
|
62
|
+
<button onClick={increment}>
|
|
63
|
+
{Component.text("Increment")}
|
|
64
|
+
</button>
|
|
65
|
+
</div>
|
|
66
|
+
}
|
|
67
|
+
}
|
|
66
68
|
|
|
67
69
|
// Mount to the DOM
|
|
68
|
-
Component.mountById(
|
|
70
|
+
Component.mountById(<App />, "app")
|
|
69
71
|
```
|
|
70
72
|
|
|
71
|
-
|
|
73
|
+
## Core Concepts
|
|
72
74
|
|
|
73
|
-
|
|
75
|
+
- **Signal**: Reactive state container
|
|
76
|
+
- **Computed**: Derived reactive value that updates automatically
|
|
77
|
+
- **Effect**: Side-effect functions that re-runs when dependencies change. Dependencies are automatically tracked, unlike React.
|
|
78
|
+
- **Component**: Declarative UI builder using ReScript functions
|
|
79
|
+
- **Router**: Signal-based navigation for single-page applications
|
|
74
80
|
|
|
75
|
-
|
|
81
|
+
### Component Features
|
|
76
82
|
|
|
77
|
-
|
|
83
|
+
- **JSX syntax**: Use HTML tags like `<div>`, `<button>`, `<input>`
|
|
84
|
+
- **Props**: Standard HTML attributes like `class`, `id`, `style`, `value`, `placeholder`
|
|
85
|
+
- **Event handlers**: `onClick`, `onInput`, `onChange`, `onSubmit`, etc.
|
|
86
|
+
- **Reactive content**: Wrap reactive text with `Component.textSignal(() => ...)`
|
|
87
|
+
- **Component functions**: Define reusable components as functions that return JSX
|
|
88
|
+
|
|
89
|
+
### Xote.Router Features
|
|
90
|
+
|
|
91
|
+
- **Initialization**: Call `Router.init()` once at app start
|
|
92
|
+
- **Imperative navigation**: Use `Router.push()` and `Router.replace()` to navigate programmatically
|
|
93
|
+
- **Declarative routing**: Define routes with `Router.routes()` and render components based on URL patterns
|
|
94
|
+
- **Dynamic parameters**: Extract URL parameters using `:param` syntax (e.g., `/users/:id`)
|
|
95
|
+
- **Navigation links**: Use `Router.link()` for SPA navigation without page reload
|
|
96
|
+
- **Reactive location**: Access current route via `Router.location` signal
|
|
97
|
+
|
|
98
|
+
## Examples
|
|
78
99
|
|
|
79
|
-
|
|
80
|
-
- **Computed**: Derived reactive value that updates automatically
|
|
81
|
-
- **Effect**: Function that re-runs when dependencies change
|
|
82
|
-
- **Component**: Declarative UI builder using ReScript functions
|
|
100
|
+
Check some examples of applications built with Xote at https://brnrdog.github.io/xote/demos/.
|
|
83
101
|
|
|
84
|
-
|
|
102
|
+
### Running Examples Locally
|
|
103
|
+
|
|
104
|
+
To run the example demos locally:
|
|
105
|
+
|
|
106
|
+
1. Clone the repository:
|
|
107
|
+
```bash
|
|
108
|
+
git clone https://github.com/brnrdog/xote.git
|
|
109
|
+
cd xote
|
|
110
|
+
```
|
|
85
111
|
|
|
112
|
+
2. Install dependencies:
|
|
113
|
+
```bash
|
|
114
|
+
npm install
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
3. Compile ReScript and start the dev server:
|
|
118
|
+
```bash
|
|
119
|
+
npm run res:dev # In one terminal (watches ReScript files)
|
|
120
|
+
npm run dev # In another terminal (starts Vite dev server)
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
4. Open your browser and navigate to `http://localhost:5173`
|
|
124
|
+
|
|
125
|
+
The demo app includes a navigation menu to explore all examples interactively.
|
|
126
|
+
|
|
127
|
+
## Documentation
|
|
128
|
+
|
|
129
|
+
Comprehensive documentation with live embedded demos is available at:
|
|
130
|
+
|
|
131
|
+
**https://brnrdog.github.io/xote/**
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
### Building Documentation Locally
|
|
135
|
+
|
|
136
|
+
To build and preview the documentation site:
|
|
137
|
+
|
|
138
|
+
```bash
|
|
139
|
+
npm run docs:start
|
|
140
|
+
```
|
|
86
141
|
|
|
142
|
+
This will build the demos and start the documentation server at `http://localhost:3000`.
|
|
87
143
|
|
|
88
144
|
## License
|
|
89
145
|
|
|
90
|
-
|
|
146
|
+
LGPL v3
|
package/dist/xote.cjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});var V={contents:0};function q(){return V.contents=V.contents+1|0,V.contents}var Y=(function(e,n){for(var r in e)n(r)});function z(e,n){if(e===n)return!0;var r=typeof e;if(r==="string"||r==="number"||r==="bigint"||r==="boolean"||r==="undefined"||e===null)return!1;var t=typeof n;if(r==="function"||t==="function")throw{RE_EXN_ID:"Invalid_argument",_1:"equal: functional value",Error:new Error};if(t==="number"||t==="bigint"||t==="undefined"||n===null)return!1;var u=e.TAG,a=n.TAG;if(u===248)return e[1]===n[1];if(u===251)throw{RE_EXN_ID:"Invalid_argument",_1:"equal: abstract value",Error:new Error};if(u!==a)return!1;var o=e.length|0,i=n.length|0;if(o===i)if(Array.isArray(e))for(var f=0;;){var c=f;if(c===o)return!0;if(!z(e[c],n[c]))return!1;f=c+1|0}else{if(e instanceof Date&&n instanceof Date)return!(e>n||e<n);var v={contents:!0},g=function(E){if(!Object.prototype.hasOwnProperty.call(n,E)){v.contents=!1;return}},G=function(E){if(!Object.prototype.hasOwnProperty.call(e,E)||!z(n[E],e[E])){v.contents=!1;return}};return Y(e,g),v.contents&&Y(n,G),v.contents}else return!1}function Z(e,n,r){for(var t=new Array(r),u=0,a=n;u<r;)t[u]=e[a],u=u+1|0,a=a+1|0;return t}function re(e,n){for(;;){var r=n,t=e,u=t.length,a=u===0?1:u,o=r.length,i=a-o|0;if(i===0)return t.apply(null,r);if(i>=0)return(function(f,c){return function(v){return re(f,c.concat([v]))}})(t,r);n=Z(r,a,-i|0),e=t.apply(null,Z(r,0,a))}}function _e(e,n){var r=e.length;if(r===1)return e(n);switch(r){case 1:return e(n);case 2:return function(t){return e(n,t)};case 3:return function(t,u){return e(n,t,u)};case 4:return function(t,u,a){return e(n,t,u,a)};case 5:return function(t,u,a,o){return e(n,t,u,a,o)};case 6:return function(t,u,a,o,i){return e(n,t,u,a,o,i)};case 7:return function(t,u,a,o,i,f){return e(n,t,u,a,o,i,f)};default:return re(e,[n])}}function ge(e){var n=e.length;return n===1?e:function(r){return _e(e,r)}}function Ee(e){return e===void 0?{BS_PRIVATE_NESTED_SOME_NONE:0}:e!==null&&e.BS_PRIVATE_NESTED_SOME_NONE!==void 0?{BS_PRIVATE_NESTED_SOME_NONE:e.BS_PRIVATE_NESTED_SOME_NONE+1|0}:e}function X(e){if(!(e!==null&&e.BS_PRIVATE_NESTED_SOME_NONE!==void 0))return e;var n=e.BS_PRIVATE_NESTED_SOME_NONE;if(n!==0)return{BS_PRIVATE_NESTED_SOME_NONE:n-1|0}}function C(e){return e!==void 0?e.h:0}function p(e,n,r,t){var u=C(e),a=C(t);return{k:n,v:r,h:u>=a?u+1|0:a+1|0,l:e,r:t}}function Se(e,n){return{k:e,v:n,h:1,l:void 0,r:void 0}}function $e(e,n){return e.v===n?e:{k:e.k,v:n,h:e.h,l:e.l,r:e.r}}function k(e,n,r,t){var u=e!==void 0?e.h:0,a=t!==void 0?t.h:0;if(u>(a+2|0)){var o=e.l,i=e.r;return C(o)>=C(i)?p(o,e.k,e.v,p(i,n,r,t)):p(p(o,e.k,e.v,i.l),i.k,i.v,p(i.r,n,r,t))}if(a<=(u+2|0))return{k:n,v:r,h:u>=a?u+1|0:a+1|0,l:e,r:t};var f=t.l,c=t.r;return C(c)>=C(f)?p(p(e,n,r,f),t.k,t.v,c):p(p(e,n,r,f.l),f.k,f.v,p(f.r,t.k,t.v,c))}function te(e,n,r){var t=e.l;return t!==void 0?k(te(t,n,r),e.k,e.v,e.r):(n.contents=e.k,r.contents=e.v,e.r)}function ye(e,n){for(;;){var r=e;if(r===void 0)return;var t=r.k;if(n===t)return Ee(r.v);e=n<t?r.l:r.r}}function b(e,n,r){if(e===void 0)return Se(n,r);var t=e.k;if(n===t)return $e(e,r);var u=e.v;return n<t?k(b(e.l,n,r),t,u,e.r):k(e.l,t,u,b(e.r,n,r))}function L(e,n){var r=e.k,t=e.l,u=e.r;if(n===r){if(t===void 0)return u;if(u===void 0)return t;var a={contents:u.k},o={contents:u.v},i=te(u,a,o);return k(t,a.contents,o.contents,i)}if(n<r){if(t===void 0)return e;var f=L(t,n);return f===t?e:k(f,r,e.v,u)}if(u===void 0)return e;var c=L(u,n);return k(t,r,e.v,c)}function be(e,n){if(e!==void 0)return L(e,n)}var T=ye;function ee(e){if(e!==void 0)return X(e);throw{RE_EXN_ID:"Not_found",Error:new Error}}function m(e,n,r){var t=e!==void 0?e.h:0,u=r!==void 0?r.h:0;return{v:n,h:(t>=u?t:u)+1|0,l:e,r}}function Te(e){return{v:e,h:1,l:void 0,r:void 0}}function ne(e,n){return n!==void 0?e!==void 0?e.h>=n.h:!1:!0}function j(e,n,r){var t=e!==void 0?e.h:0,u=r!==void 0?r.h:0;if(t>(u+2|0)){var a=e.l,o=e.r;return ne(a,o)?m(a,e.v,m(o,n,r)):m(m(a,e.v,o.l),o.v,m(o.r,n,r))}if(u<=(t+2|0))return{v:n,h:(t>=u?t:u)+1|0,l:e,r};var i=r.l,f=r.r;return ne(f,i)?m(m(e,n,i),r.v,f):m(m(e,n,i.l),i.v,m(i.r,r.v,f))}function ue(e,n){var r=e.l;return r!==void 0?j(ue(r,n),e.v,e.r):(n.contents=e.v,e.r)}function ae(e,n){for(;;){var r=e;if(r===void 0)return;ae(r.l,n),n(r.v),e=r.r}}function Ae(e,n){ae(e,ge(n))}function Ce(e,n){for(;;){var r=e;if(r===void 0)return!1;var t=r.v;if(n===t)return!0;e=n<t?r.l:r.r}}function w(e,n){if(e===void 0)return Te(n);var r=e.v;if(n===r)return e;var t=e.l,u=e.r;if(n<r){var a=w(t,n);return a===t?e:j(a,r,u)}var o=w(u,n);return o===u?e:j(t,r,o)}function x(e,n){if(e===void 0)return e;var r=e.v,t=e.l,u=e.r;if(n===r){if(t===void 0)return u;if(u===void 0)return t;var a={contents:u.v},o=ue(u,a);return j(t,a.contents,o)}if(n<r){var i=x(t,n);return i===t?e:j(i,r,u)}var f=x(u,n);return f===u?e:j(t,r,f)}var ke=Ce,B=Ae,_={contents:void 0},h={contents:void 0},je={contents:void 0},s={contents:void 0},S={contents:void 0},M={contents:!1};function F(e){var n=T(h.contents,e);if(n===void 0){h.contents=b(h.contents,e,void 0);return}}function ie(e,n){F(n);var r=ee(T(_.contents,e));if(z(s.contents,e)&&ke(r.deps,n)===!1){r.deps=w(r.deps,n);var t=ee(T(h.contents,n));h.contents=b(h.contents,n,w(t,e))}}function P(e){B(e.deps,(function(n){var r=T(h.contents,n);if(r!==void 0){h.contents=b(h.contents,n,x(X(r),e.id));return}})),e.deps=void 0}function J(e){if(S.contents=w(S.contents,e),M.contents===!1){var n=S.contents;S.contents=void 0,B(n,(function(r){var t=T(_.contents,r);if(t!==void 0){P(t),s.contents=r,t.run(),s.contents=void 0;return}}))}}function oe(e){F(e);var n=T(h.contents,e);if(n!==void 0)return B(X(n),J)}function Oe(e){var n=s.contents;s.contents=void 0;var r=e();return s.contents=n,r}function Ie(e){var n=M.contents;M.contents=!0;var r=e();if(M.contents=n,S.contents!==void 0){var t=S.contents;S.contents=void 0,B(t,(function(u){J(u)}))}return r}var Me,Ne,we,Pe;const Re=Object.freeze(Object.defineProperty({__proto__:null,Id:Pe,IntMap:Ne,IntSet:Me,Observer:we,addDep:ie,batch:Ie,batching:M,clearDeps:P,currentObserverId:s,ensureSignalBucket:F,notify:oe,observers:_,pending:S,schedule:J,signalObservers:h,signalPeeks:je,untrack:Oe},Symbol.toStringTag,{value:"Module"}));function I(e){var n=q(),r={id:n,kind:"Effect",run:(function(){e()}),deps:void 0};_.contents=b(_.contents,n,r),P(r),s.contents=n,r.run(),s.contents=void 0;var t=function(){var u=T(_.contents,n);if(u!==void 0){P(u),_.contents=be(_.contents,n);return}};return{dispose:t}}var Ge,De,Xe,Be,Fe,Ve;const ze=Object.freeze(Object.defineProperty({__proto__:null,Core:Ve,Id:Xe,IntMap:De,IntSet:Ge,Observer:Be,Signal:Fe,run:I},Symbol.toStringTag,{value:"Module"}));function W(e){var n=q();return F(n),{id:n,value:{contents:e},version:{contents:0}}}function $(e){var n=s.contents;return n!==void 0&&ie(n,e.id),e.value.contents}function D(e){return e.value.contents}function y(e,n){e.value.contents=n,e.version.contents=e.version.contents+1|0,oe(e.id)}function Le(e,n){y(e,n(e.value.contents))}var xe,Ke,qe,Je,We;const He=Object.freeze(Object.defineProperty({__proto__:null,Core:We,Id:Je,IntMap:Ke,IntSet:xe,Observer:qe,get:$,make:W,peek:D,set:y,update:Le},Symbol.toStringTag,{value:"Module"}));function O(e){var n=W(),r={contents:!1},t=q(),u=function(){var o=e();return r.contents===!1&&(r.contents=!0),y(n,o)},a={id:t,kind:{NAME:"Computed",VAL:n.id},run:u,deps:void 0};return _.contents=b(_.contents,t,a),P(a),s.contents=t,a.run(),s.contents=void 0,n}var Ue,Qe,Ye,Ze,en,nn;const rn=Object.freeze(Object.defineProperty({__proto__:null,Core:Ze,Id:nn,IntMap:Qe,IntSet:Ue,Observer:en,Signal:Ye,make:O},Symbol.toStringTag,{value:"Module"}));function d(e,n){return[e,{TAG:"Static",_0:n}]}function tn(e,n){return[e,{TAG:"SignalValue",_0:n}]}function un(e,n){return[e,{TAG:"Compute",_0:n}]}function fe(e){return{TAG:"Text",_0:e}}function an(e){var n=O(e);return{TAG:"SignalText",_0:n}}function H(e){return{TAG:"Fragment",_0:e}}function U(e){return{TAG:"SignalFragment",_0:e}}function on(e,n){var r=O(function(){return $(e).map(n)});return{TAG:"SignalFragment",_0:r}}function l(e,n,r,t,u){var a=n!==void 0?n:[].map(function(f){return f}),o=r!==void 0?r:[].map(function(f){return f}),i=t!==void 0?t:[].map(function(f){return f});return{TAG:"Element",tag:e,attrs:a,events:o,children:i}}function fn(e,n,r,t){return l("div",e,n,r)}function cn(e,n,r,t){return l("span",e,n,r)}function vn(e,n,r,t){return l("button",e,n,r)}function dn(e,n,r){return l("input",e,n,void 0)}function sn(e,n,r,t){return l("h1",e,n,r)}function ln(e,n,r,t){return l("h2",e,n,r)}function hn(e,n,r,t){return l("h3",e,n,r)}function pn(e,n,r,t){return l("p",e,n,r)}function mn(e,n,r,t){return l("ul",e,n,r)}function _n(e,n,r,t){return l("li",e,n,r)}function ce(e,n,r,t){return l("a",e,n,r)}function N(e){switch(e.TAG){case"Element":var n=document.createElement(e.tag);return e.attrs.forEach(function(i){var f=i[1],c=i[0];switch(f.TAG){case"Static":n.setAttribute(c,f._0);return;case"SignalValue":var v=f._0;n.setAttribute(c,D(v)),I(function(){var E=$(v);n.setAttribute(c,E)});return;case"Compute":var g=f._0,G=O(function(){return g()});n.setAttribute(c,D(G)),I(function(){var E=$(G);n.setAttribute(c,E)});return}}),e.events.forEach(function(i){n.addEventListener(i[0],i[1])}),e.children.forEach(function(i){var f=N(i);n.appendChild(f)}),n;case"Text":return document.createTextNode(e._0);case"SignalText":var r=e._0,t=document.createTextNode(D(r));return I(function(){var i=$(r);t.textContent=i}),t;case"Fragment":var u=document.createDocumentFragment();return e._0.forEach(function(i){var f=N(i);u.appendChild(f)}),u;case"SignalFragment":var a=e._0,o=document.createElement("div");return o.setAttribute("data-signal-fragment","true"),o.setAttribute("style","display: contents"),I(function(){var i=$(a);o.innerHTML="",i.forEach(function(f){var c=N(f);o.appendChild(c)})}),o}}function ve(e,n){var r=N(e);n.appendChild(r)}function gn(e,n){var r=document.getElementById(n);if(r==null){console.error("Container element not found: "+n);return}else return ve(e,r)}var En,Sn,$n,yn;const bn=Object.freeze(Object.defineProperty({__proto__:null,Computed:yn,Core:$n,Effect:Sn,Signal:En,a:ce,attr:d,button:vn,computedAttr:un,div:fn,element:l,fragment:H,h1:sn,h2:ln,h3:hn,input:dn,li:_n,list:on,mount:ve,mountById:gn,p:pn,render:N,signalAttr:tn,signalFragment:U,span:cn,text:fe,textSignal:an,ul:mn},Symbol.toStringTag,{value:"Module"}));function Tn(e,n){return e(n)}function An(e,n){return e(n)}function Cn(e,n,r,t){return e(n)}function kn(e,n,r,t){return e(n)}function jn(e){var n=e.children;return n!==void 0?n:H([])}function On(e){return H(e)}function In(){return fe("")}function de(e){var n=[],r=e.id;r!==void 0&&n.push(d("id",r));var t=e.class;t!==void 0&&n.push(d("class",t));var u=e.style;u!==void 0&&n.push(d("style",u));var a=e.type;a!==void 0&&n.push(d("type",a));var o=e.value;o!==void 0&&n.push(d("value",o));var i=e.placeholder;i!==void 0&&n.push(d("placeholder",i));var f=e.disabled;f!==void 0&&f&&n.push(d("disabled","true"));var c=e.checked;c!==void 0&&c&&n.push(d("checked","true"));var v=e.href;v!==void 0&&n.push(d("href",v));var g=e.target;return g!==void 0&&n.push(d("target",g)),n}function se(e){var n=[],r=e.onClick;r!==void 0&&n.push(["click",r]);var t=e.onInput;t!==void 0&&n.push(["input",t]);var u=e.onChange;u!==void 0&&n.push(["change",u]);var a=e.onSubmit;a!==void 0&&n.push(["submit",a]);var o=e.onFocus;o!==void 0&&n.push(["focus",o]);var i=e.onBlur;i!==void 0&&n.push(["blur",i]);var f=e.onKeyDown;f!==void 0&&n.push(["keydown",f]);var c=e.onKeyUp;c!==void 0&&n.push(["keyup",c]);var v=e.onMouseEnter;v!==void 0&&n.push(["mouseenter",v]);var g=e.onMouseLeave;return g!==void 0&&n.push(["mouseleave",g]),n}function le(e){var n=e.children;return n!==void 0?n.TAG==="Fragment"?n._0:[n]:[]}function R(e,n){return{TAG:"Element",tag:e,attrs:de(n),events:se(n),children:le(n)}}function Mn(e,n){return R(e,n)}function Nn(e,n){return R(e,n)}function wn(e,n,r,t){return R(e,n)}function Pn(e,n,r,t){return R(e,n)}var Rn={propsToAttrs:de,propsToEvents:se,getChildren:le,createElement:R,jsx:Mn,jsxs:Nn,jsxKeyed:wn,jsxsKeyed:Pn},Gn;const Dn=Object.freeze(Object.defineProperty({__proto__:null,$$null:In,Component:Gn,Elements:Rn,array:On,jsx:Tn,jsxFragment:jn,jsxKeyed:Cn,jsxs:An,jsxsKeyed:kn},Symbol.toStringTag,{value:"Module"}));function Xn(e,n){for(var r=e.length,t=new Array(r),u=0,a=0;a<r;++a){var o=e[a],i=n(o);i!==void 0&&(t[u]=X(i),u=u+1|0)}return t.length=u,t}function Bn(e,n){for(var r=0;;){var t=r;if(t===e.length)return;var u=n(e[t]);if(u!==void 0)return u;r=t+1|0}}function he(e){return Xn(e.split("/"),(function(n){if(n!=="")return n.startsWith(":")?{TAG:"Param",_0:n.slice(1)}:{TAG:"Static",_0:n}}))}function pe(e,n){var r=n.split("/").filter(function(a){return a!==""});if(e.length!==r.length)return"NoMatch";var t={},u=e.every(function(a,o){var i=r[o];return a.TAG==="Static"?i===a._0:(t[a._0]=i,!0)});return u?{TAG:"Match",_0:t}:"NoMatch"}function Q(e,n){return pe(he(e),n)}const Fn=Object.freeze(Object.defineProperty({__proto__:null,match:Q,matchPath:pe,parsePattern:he},Symbol.toStringTag,{value:"Module"}));var A=W({pathname:"/",search:"",hash:""});function K(){return{pathname:window.location.pathname,search:window.location.search,hash:window.location.hash}}function Vn(){y(A,K());var e=function(n){y(A,K())};window.addEventListener("popstate",e)}function me(e,n,r,t){var u=n!==void 0?n:"",a=r!==void 0?r:"",o={pathname:e,search:u,hash:a},i=e+u+a,f={};window.history.pushState(f,"",i),y(A,o)}function zn(e,n,r,t){var u=n!==void 0?n:"",a=r!==void 0?r:"",o={pathname:e,search:u,hash:a},i=e+u+a,f={};window.history.replaceState(f,"",i),y(A,o)}function Ln(e,n){return U(O(function(){var r=$(A),t=Q(e,r.pathname);return typeof t!="object"?[]:[n(t._0)]}))}function xn(e){return U(O(function(){var n=$(A),r=Bn(e,(function(t){var u=Q(t.pattern,n.pathname);if(typeof u=="object")return t.render(u._0)}));return r!==void 0?[r]:[]}))}function Kn(e,n,r,t){var u=n!==void 0?n:[],a=r!==void 0?r:[],o=function(i){i.preventDefault(),me(e,void 0,void 0)};return ce(u.concat([d("href",e)]),[["click",o]],a)}var qn,Jn,Wn,Hn,Un;const Qn=Object.freeze(Object.defineProperty({__proto__:null,$$location:A,Component:Wn,Computed:Jn,Core:Un,Route:Hn,Signal:qn,getCurrentLocation:K,init:Vn,link:Kn,push:me,replace:zn,route:Ln,routes:xn},Symbol.toStringTag,{value:"Module"}));var Yn=bn,Zn=rn,er=Re,nr=ze,rr=Dn,tr=Fn,ur=Qn,ar=He;exports.Component=Yn;exports.Computed=Zn;exports.Core=er;exports.Effect=nr;exports.JSX=rr;exports.Route=tr;exports.Router=ur;exports.Signal=ar;
|