xote 6.4.0 → 7.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 (46) hide show
  1. package/README.md +146 -36
  2. package/dist/RuntimeAttr.res-Cr5Qmz0i.js +1 -0
  3. package/dist/RuntimeAttr.res-DAZkL5CF.mjs +539 -0
  4. package/dist/RuntimeHydrationMarkers.res-C5-ieaOS.js +1 -0
  5. package/dist/RuntimeHydrationMarkers.res-DHikAvHr.mjs +6 -0
  6. package/dist/RuntimeJsxProp.res-A6N-qWoK.js +1 -0
  7. package/dist/RuntimeJsxProp.res-D3W5GXqT.mjs +64 -0
  8. package/dist/Stdlib_Array-1YCQzU_Y.mjs +22 -0
  9. package/dist/Stdlib_Array-BeBVUIuY.js +1 -0
  10. package/dist/View.res-C36--SJD.js +1 -0
  11. package/dist/View.res-SuqJrQPC.mjs +777 -0
  12. package/dist/client.cjs +1 -0
  13. package/dist/client.mjs +131 -0
  14. package/dist/hydration.cjs +1 -0
  15. package/dist/hydration.mjs +385 -0
  16. package/dist/mdx.cjs +1 -0
  17. package/dist/mdx.mjs +50 -0
  18. package/dist/router.cjs +1 -0
  19. package/dist/router.mjs +276 -0
  20. package/dist/ssr.cjs +17 -0
  21. package/dist/ssr.mjs +321 -0
  22. package/dist/xote.cjs +1 -17
  23. package/dist/xote.mjs +1456 -2467
  24. package/dist/xote.umd.js +1 -17
  25. package/package.json +42 -10
  26. package/rescript.json +2 -2
  27. package/src/Mdx.res +77 -0
  28. package/src/Mdx.res.mjs +93 -0
  29. package/src/Router.res +62 -8
  30. package/src/Router.res.mjs +60 -6
  31. package/src/RuntimeDom.res +7 -0
  32. package/src/RuntimeDom.res.mjs +8 -0
  33. package/src/RuntimeJsxProp.res +5 -8
  34. package/src/RuntimeJsxProp.res.mjs +9 -10
  35. package/src/RuntimeValue.res +35 -0
  36. package/src/RuntimeValue.res.mjs +67 -0
  37. package/src/SSRState.res +1 -4
  38. package/src/SSRState.res.mjs +4 -10
  39. package/src/View.res +224 -34
  40. package/src/View.res.mjs +306 -32
  41. package/src/jsx-dev-runtime.mjs +7 -0
  42. package/src/jsx-runtime.mjs +276 -0
  43. package/src/Node.res +0 -2
  44. package/src/Node.res.mjs +0 -82
  45. package/src/ReactiveProp.res +0 -2
  46. package/src/ReactiveProp.res.mjs +0 -19
package/README.md CHANGED
@@ -1,7 +1,18 @@
1
- # [xote](https://brnrdog.github.io/xote/)
2
- ![NPM Version](https://img.shields.io/npm/v/xote)
3
- ![npm bundle size](https://badgen.net/bundlephobia/min/xote)
4
- ![npm bundle size](https://badgen.net/bundlephobia/minzip/xote)
1
+ <p>
2
+ <a href="https://xote.dev/">
3
+ <picture>
4
+ <source media="(prefers-color-scheme: dark)" srcset="docs/banner.svg">
5
+ <source media="(prefers-color-scheme: light)" srcset="docs/banner-light.svg">
6
+ <img src="docs/banner.svg" alt="xote - Fine-grained reactivity for ReScript" width="400" />
7
+ </picture>
8
+ </a>
9
+ </p>
10
+
11
+ <p>
12
+ <a href="https://www.npmjs.com/package/xote"><img src="https://img.shields.io/npm/v/xote" alt="NPM Version" /></a>
13
+ <a href="https://bundlephobia.com/package/xote"><img src="https://badgen.net/bundlephobia/min/xote" alt="Bundle size" /></a>
14
+ <a href="https://bundlephobia.com/package/xote"><img src="https://badgen.net/bundlephobia/minzip/xote" alt="Bundle size (gzip)" /></a>
15
+ </p>
5
16
 
6
17
  xote is a lightweight [ReScript](https://rescript-lang.org/) library that combines fine-grained reactivity and a declarative component system for building user interfaces for the web.
7
18
 
@@ -28,13 +39,11 @@ Then, add it to your ReScript project's `rescript.json`. You'll need to declare
28
39
 
29
40
  The compiler flag `-open Xote` is optional, it makes the Xote modules available unqualified inside your source files.
30
41
 
31
- This README uses the application-facing names introduced for public code:
42
+ This README uses the application-facing names for public code:
32
43
 
33
- - `View` is the official module for building and mounting DOM nodes.
34
- - `Node` is a deprecated compatibility alias for `View` and will be removed in a future release.
35
- - `Prop` is the official static-or-reactive prop module.
36
- - `ReactiveProp` is a deprecated compatibility alias for `Prop`.
37
- - `View.signalText`, `View.each`, `View.eachWithKey`, `View.Attr.*`, `Router.location`, and `SSRState.signal` are preferred in examples, while the deprecated `Node.signalText`, `Node.list`, `Node.keyedList`, `Node.attr`, `ReactiveProp.*`, and `SSRState.make` names remain supported.
44
+ - `View` is the module for building and mounting DOM nodes.
45
+ - `Prop` is the static-or-reactive prop module.
46
+ - `View.Text`, `View.Int`, `View.For`, `View.Show`, `View.Attr.*`, `Router.location`, and `SSRState.signal` are the building blocks used throughout these examples.
38
47
 
39
48
  ### Quick Example
40
49
 
@@ -57,15 +66,17 @@ module App = {
57
66
 
58
67
  // Build the UI with JSX
59
68
  <div>
60
- <h1> {View.text("Counter")} </h1>
69
+ <h1> <View.Text> "Counter" </View.Text> </h1>
61
70
  <p>
62
- {View.signalText(() => "Count: " ++ Signal.get(count)->Int.toString)}
71
+ <View.Text> "Count: " </View.Text>
72
+ <View.Int> {count} </View.Int>
63
73
  </p>
64
74
  <p>
65
- {View.signalText(() => "Doubled: " ++ Signal.get(doubled)->Int.toString)}
75
+ <View.Text> "Doubled: " </View.Text>
76
+ <View.Int> {doubled} </View.Int>
66
77
  </p>
67
78
  <button onClick={(_evt: Dom.event) => Signal.update(count, n => n + 1)}>
68
- {View.text("Increment")}
79
+ <View.Text> "Increment" </View.Text>
69
80
  </button>
70
81
  </div>
71
82
  }
@@ -86,7 +97,7 @@ Here's an example of a reusable component with properties:
86
97
  @jsx.component
87
98
  let make = (~name: string, ~greeting: string="Hello") => {
88
99
  <p>
89
- {View.text(greeting ++ ", " ++ name ++ "!")}
100
+ <View.Text> {`${greeting}, ${name}!`} </View.Text>
90
101
  </p>
91
102
  }
92
103
 
@@ -126,17 +137,13 @@ On top of the reactive primitives with signals, Xote provides a declarative view
126
137
  ```rescript
127
138
  let className = Signal.make("card")
128
139
 
129
- Html.div(
130
- ~attrs=[View.Attr.signal("class", className)],
131
- ~children=[
132
- View.text("Status: "),
133
- View.signalText(() => Signal.get(className)),
134
- ],
135
- (),
136
- )
140
+ <div class={Prop.signal(className)}>
141
+ <View.Text> "Status: " </View.Text>
142
+ <View.Text> {className} </View.Text>
143
+ </div>
137
144
  ```
138
145
 
139
- For rendering collections, prefer `View.each` for simple lists and `View.eachWithKey` when items have stable identity:
146
+ For rendering collections in JSX, prefer `View.For`. Add `by` when items have stable identity and should reconcile by key:
140
147
 
141
148
  ```rescript
142
149
  type todo = {id: string, title: string}
@@ -146,11 +153,55 @@ let todos = Signal.make([
146
153
  {id: "2", title: "Ship release"},
147
154
  ])
148
155
 
149
- View.eachWithKey(
150
- todos,
151
- todo => todo.id,
152
- todo => <li> {View.text(todo.title)} </li>,
153
- )
156
+ <View.For
157
+ each={Prop.signal(todos)}
158
+ by={todo => todo.id}
159
+ render={todo => <li> <View.Text> {todo.title} </View.Text> </li>}
160
+ />
161
+ ```
162
+
163
+ `View` also provides component primitives for static or reactive values. Their children can be raw values, signals, `Prop.t` values, or functions.
164
+
165
+ ```rescript
166
+ <View.For
167
+ each={Prop.static(["Draft", "Review", "Ship"])}
168
+ render={label => <span> <View.Text> {label} </View.Text> </span>}
169
+ />
170
+
171
+ <ul>
172
+ <View.For
173
+ each={Prop.signal(todos)}
174
+ by={todo => todo.id}
175
+ render={todo => <li> <View.Text> {todo.title} </View.Text> </li>}
176
+ />
177
+ </ul>
178
+
179
+ <View.Show when_={Prop.signal(isReady)} fallback={<p> <View.Text> "Loading" </View.Text> </p>}>
180
+ <p> <View.Text> "Ready" </View.Text> </p>
181
+ </View.Show>
182
+
183
+ <View.Maybe
184
+ value={Prop.signal(selectedTodo)}
185
+ fallback={<p> <View.Text> "No selection" </View.Text> </p>}
186
+ render={todo => <p> <View.Text> {todo.title} </View.Text> </p>}
187
+ />
188
+
189
+ <View.Value
190
+ value={Prop.signal(count)}
191
+ render={count =>
192
+ <p>
193
+ <View.Text> "Count: " </View.Text>
194
+ <View.Int> {count} </View.Int>
195
+ </p>
196
+ }
197
+ />
198
+
199
+ <p>
200
+ <View.Text> "Count: " </View.Text>
201
+ <View.Int> {count} </View.Int>
202
+ <View.Text> ", ready: " </View.Text>
203
+ <View.Bool> {isReady} </View.Bool>
204
+ </p>
154
205
  ```
155
206
 
156
207
  ### Static or Reactive Props
@@ -166,23 +217,41 @@ let make = (~className: Prop.t<string>=Prop.static("badge"), ~children) => {
166
217
  let tone = Signal.make("badge badge-info")
167
218
 
168
219
  <Badge className={Prop.signal(tone)}>
169
- {View.text("Live")}
220
+ <View.Text> "Live" </View.Text>
170
221
  </Badge>
171
222
  ```
172
223
 
173
- `Prop` is the source module for static-or-reactive props. `ReactiveProp` remains available as a deprecated compatibility alias.
224
+ `Prop` is the module for static-or-reactive props.
174
225
 
175
226
  ### Router and SSR State
176
227
 
177
- Router state is signal-based. Read the shared location signal directly with `Router.location()`:
228
+ Initialize the router once at your app entry, then describe your screens with
229
+ the `Router.routes` component. Each route matches a pattern and receives the
230
+ parsed params:
178
231
 
179
232
  ```rescript
180
233
  Router.init(())
181
234
 
182
- let pathname = View.signalText(() => {
183
- let location = Signal.get(Router.location())
184
- "Current path: " ++ location.pathname
185
- })
235
+ let app = () =>
236
+ Router.routes([
237
+ {pattern: "/", render: _ => <Home />},
238
+ {pattern: "/about", render: _ => <About />},
239
+ {
240
+ pattern: "/users/:id",
241
+ render: params =>
242
+ <UserPage id={params->Dict.get("id")->Option.getOr("")} />,
243
+ },
244
+ ])
245
+ ```
246
+
247
+ Use the `Router.Link` component for client-side navigation without a full page
248
+ reload:
249
+
250
+ ```rescript
251
+ <nav>
252
+ <Router.Link to="/"> <View.Text> "Home" </View.Text> </Router.Link>
253
+ <Router.Link to="/about" class="nav-link"> <View.Text> "About" </View.Text> </Router.Link>
254
+ </nav>
186
255
  ```
187
256
 
188
257
  For server/client state transfer, prefer `SSRState.signal` when creating a synced signal:
@@ -191,8 +260,49 @@ For server/client state transfer, prefer `SSRState.signal` when creating a synce
191
260
  let count = SSRState.signal("count", 0, SSRState.Codec.int)
192
261
  ```
193
262
 
263
+ ### JavaScript Interop
264
+
265
+ Xote is built for ReScript first, but the compiled package can also be used from JavaScript. Import the focused client entry and build nodes with `View` or `Html` helpers:
266
+
267
+ ```js
268
+ import { Signal, Computed, Effect, View } from "xote/client";
269
+
270
+ const count = Signal.make(0);
271
+ const doubled = Computed.make(() => Signal.get(count) * 2);
272
+
273
+ Effect.run(() => {
274
+ console.log("Count:", Signal.get(count));
275
+ });
276
+
277
+ const app = View.element("div", [], [], [
278
+ View.element("h1", [], [], [View.text("Counter")]),
279
+ View.element("p", [], [], [
280
+ View.text("Count: "),
281
+ View.signalText(() => String(Signal.get(count))),
282
+ ]),
283
+ View.element("p", [], [], [
284
+ View.text("Doubled: "),
285
+ View.signalText(() => String(Signal.get(doubled))),
286
+ ]),
287
+ View.element(
288
+ "button",
289
+ [],
290
+ [["click", () => Signal.update(count, n => n + 1)]],
291
+ [View.text("Increment")],
292
+ ),
293
+ ]);
294
+
295
+ View.mountById(app, "app");
296
+ ```
297
+
298
+ Use `xote/client` for browser UI, `xote/router` for routing, `xote/ssr` for server rendering, `xote/hydration` for hydrating server-rendered pages, and `xote/mdx` for MDX integration.
299
+
194
300
  Check the [website](https://brnrdog.github.io/xote/) for more comprehensive documentations about Xote and Signals.
195
301
 
302
+ ## Releasing
303
+
304
+ Releases are automated with semantic-release and published to npm. See [docs/RELEASING.md](docs/RELEASING.md) for the stable and beta channels and the release flow.
305
+
196
306
  ## License
197
307
 
198
308
  LGPL v3
@@ -0,0 +1 @@
1
+ var e=Object.defineProperty,t=(t,n)=>{let r={};for(var i in t)e(r,i,{get:t[i],enumerable:!0});return n||e(r,Symbol.toStringTag,{value:`Module`}),r};function n(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 r(e){if(e!=null)return n(e)}function i(e){if(e===null||e.BS_PRIVATE_NESTED_SOME_NONE===void 0)return e;let t=e.BS_PRIVATE_NESTED_SOME_NONE;if(t!==0)return{BS_PRIVATE_NESTED_SOME_NONE:t-1|0}}var a={contents:0};function o(){return a.contents=a.contents+1|0,a.contents}var s={contents:0},c={contents:0};function l(){return{first:void 0,last:void 0,computedSubscriberCount:0,version:0,compute:void 0,firstDep:void 0,lastDep:void 0,flags:0,level:0,deferEffectsUntilRecompute:!1,lastGlobalVersion:0}}function ee(e,t){return{first:void 0,last:void 0,computedSubscriberCount:0,version:0,compute:e,firstDep:void 0,lastDep:void 0,flags:1,level:0,deferEffectsUntilRecompute:t===void 0?!1:t,lastGlobalVersion:0}}function te(e,t,n,r,i){return{id:e,kind:t,run:n,firstDep:void 0,lastDep:void 0,flags:1,level:0,name:r,backingSubs:i}}function u(e){e.flags&=-2}function ne(e){return(e.flags&2)!=0}function re(e){e.flags|=2}function ie(e){e.flags&=-3}function d(e){return(e.flags&1)!=0}function f(e){e.flags|=1}function p(e){e.flags&=-2}function ae(e){return(e.flags&2)!=0}function m(e){e.flags|=2}function oe(e){e.flags&=-3}function h(e){return e.compute!==void 0}function g(e,t){return{subs:e,observer:t,nextDep:void 0,prevDep:void 0,nextSub:void 0,prevSub:void 0,lastTrackedVersion:0}}function _(e,t){t.prevSub=e.last,t.nextSub=void 0;let n=e.last;if(n===void 0?e.first=t:n.nextSub=t,e.last=t,t.observer.compute!==void 0){e.computedSubscriberCount=e.computedSubscriberCount+1|0;return}}function v(e,t){t.prevDep=e.lastDep,t.nextDep=void 0;let n=e.lastDep;n===void 0?e.firstDep=t:n.nextDep=t,e.lastDep=t}function y(e){let t=e.subs,n=e.prevSub;n===void 0?t.first=e.nextSub:n.nextSub=e.nextSub;let r=e.nextSub;if(r===void 0?t.last=e.prevSub:r.prevSub=e.prevSub,e.prevSub=void 0,e.nextSub=void 0,e.observer.compute!==void 0&&t.computedSubscriberCount>0){t.computedSubscriberCount=t.computedSubscriberCount-1|0;return}}function se(e,t){let n=t.prevDep;n===void 0?e.firstDep=t.nextDep:n.nextDep=t.nextDep;let r=t.nextDep;r===void 0?e.lastDep=t.prevDep:r.prevDep=t.prevDep,t.prevDep=void 0,t.nextDep=void 0}function ce(e,t){let n=t.prevDep;n===void 0?e.firstDep=t.nextDep:n.nextDep=t.nextDep;let r=t.nextDep;r===void 0?e.lastDep=t.prevDep:r.prevDep=t.prevDep,t.prevDep=void 0,t.nextDep=void 0}function le(e){let t=e.firstDep;for(;t!==void 0;){let e=t;if(e!==void 0){let n=e.nextDep;y(e),t=n}}e.firstDep=void 0,e.lastDep=void 0}function ue(e){let t=e.firstDep;for(;t!==void 0;){let e=t;if(e!==void 0){let n=e.nextDep;y(e),t=n}}e.firstDep=void 0,e.lastDep=void 0}function b(e,t){t.prevDep=e.lastDep,t.nextDep=void 0;let n=e.lastDep;n===void 0?e.firstDep=t:n.nextDep=t,e.lastDep=t}var x={contents:void 0},S={contents:void 0},C={contents:0},w={contents:void 0},T={contents:void 0},E=[],D=[],O={contents:!1},k={contents:!1},A={contents:!1},j={contents:0},M={contents:0},N=[],de=(function(e){e.length=0}),P=(function(e,t){if(!(t<=0)){if(t>=e.length){e.length=0;return}e.copyWithin(0,t),e.length-=t}});function F(e){ne(e)||(re(e),E.length===0?k.contents=!1:e.level<j.contents&&(k.contents=!0),E.push(e),j.contents=e.level)}function fe(e){ae(e)||(m(e),D.length===0?A.contents=!1:e.level<M.contents&&(A.contents=!0),D.push(e),M.contents=e.level)}function I(e,t){if(e.firstDep===void 0){let n=g(t,e);n.lastTrackedVersion=C.contents,b(e,n),_(t,n),w.contents=n;return}let n=C.contents,r=!1,i=w.contents;if(i!==void 0)if(i.subs===t&&i.observer===e)i.lastTrackedVersion=n,r=!0;else{let a=i.nextDep;a!==void 0&&a.subs===t&&a.observer===e&&(a.lastTrackedVersion=n,w.contents=a,r=!0)}if(!r){let i=t.last;i!==void 0&&i.lastTrackedVersion===n&&i.observer===e&&(i.lastTrackedVersion=n,w.contents=i,r=!0)}if(r)return;let a=!1,o,s=e.firstDep;for(;s!==void 0&&!a;){let e=s;e!==void 0&&(e.subs===t?(e.lastTrackedVersion=n,o=e,a=!0):s=e.nextDep)}if(a){w.contents=o;return}let c=g(t,e);c.lastTrackedVersion=n,b(e,c),_(t,c),w.contents=c}function L(e,t){if(e.firstDep===void 0){let n=g(t,e);n.lastTrackedVersion=C.contents,v(e,n),_(t,n),T.contents=n;return}let n=C.contents,r=!1,i=T.contents;if(i!==void 0)if(i.subs===t&&i.observer===e)i.lastTrackedVersion=n,r=!0;else{let a=i.nextDep;a!==void 0&&a.subs===t&&a.observer===e&&(a.lastTrackedVersion=n,T.contents=a,r=!0)}if(!r){let i=t.last;i!==void 0&&i.lastTrackedVersion===n&&i.observer===e&&(i.lastTrackedVersion=n,T.contents=i,r=!0)}if(r)return;let a=!1,o,s=e.firstDep;for(;s!==void 0&&!a;){let e=s;e!==void 0&&(e.subs===t?(e.lastTrackedVersion=n,o=e,a=!0):s=e.nextDep)}if(a){T.contents=o;return}let c=g(t,e);c.lastTrackedVersion=n,v(e,c),_(t,c),T.contents=c}function R(e){let t=x.contents;if(t!==void 0)return I(t,e);let n=S.contents;if(n!==void 0)return L(n,e)}function z(e,t){return e.level-t.level|0}function B(e,t){return e.level-t.level|0}function V(e){let t=0,n=e.firstDep;for(;n!==void 0;){let e=n;e!==void 0&&(h(e.subs)&&e.subs.level>t&&(t=e.subs.level),n=e.nextDep)}return t+1|0}function H(e){let t=0,n=e.firstDep;for(;n!==void 0;){let e=n;e!==void 0&&(h(e.subs)&&e.subs.level>t&&(t=e.subs.level),n=e.nextDep)}return t+1|0}function U(e,t){let n=C.contents,r=e.version;s.contents=s.contents+1|0,C.contents=s.contents,t&&oe(e);let i=x.contents,a=w.contents;x.contents=e,w.contents=e.firstDep;try{let t=e.compute;t!==void 0&&t();let o=e.firstDep;for(;o!==void 0;){let t=o;if(t!==void 0){let n=t.nextDep;t.lastTrackedVersion!==C.contents&&(y(t),ce(e,t)),o=n}}if(p(e),e.lastGlobalVersion=c.contents,e.first!==void 0&&e.version!==r){let t=e.first;for(;t!==void 0;){let e=t;if(e!==void 0){let n=e.observer;if(h(n))f(n);else{let t=S.contents;t!==void 0&&t===e.observer||F(e.observer)}t=e.nextSub}}}x.contents=i,w.contents=a,C.contents=n;return}catch(e){throw x.contents=i,w.contents=a,C.contents=n,e}}function pe(e){let t=e.level;if(U(e,!0),t===0){e.level=V(e);return}}function me(e){let t=e.level,n=C.contents;s.contents=s.contents+1|0,C.contents=s.contents,ie(e);let r=S.contents,i=T.contents;S.contents=e,T.contents=e.firstDep;try{e.run();let t=e.firstDep;for(;t!==void 0;){let n=t;if(n!==void 0){let r=n.nextDep;n.lastTrackedVersion!==C.contents&&(y(n),se(e,n)),t=r}}u(e),S.contents=r,T.contents=i,C.contents=n}catch(e){throw S.contents=r,T.contents=i,C.contents=n,e}if(t===0){e.level=H(e);return}}function W(){O.contents=!0;try{for(;E.length!==0||D.length!==0;){if(D.length!==0){let e=D.length;e>1&&A.contents&&(D.sort(B),A.contents=!1);let t=0;for(;t<e;){let e=D[t];e!==void 0&&pe(e),t=t+1|0}P(D,e),D.length===0&&(A.contents=!1)}if(E.length!==0){let e=E.length;e>1&&k.contents&&(E.sort(z),k.contents=!1);let t=0;for(;t<e;){let e=E[t];e!==void 0&&me(e),t=t+1|0}P(E,e),E.length===0&&(k.contents=!1)}}O.contents=!1;return}catch(e){throw O.contents=!1,e}}function he(e){if(e.first!==void 0)if(!h(e)&&e.computedSubscriberCount===0){let t=e.first;for(;t!==void 0;){let e=t;e!==void 0&&(F(e.observer),t=e.nextSub)}}else{N.push(e);let t=0;for(;t<N.length;){let e=N[t];if(t=t+1|0,e!==void 0){let t=e.first;for(;t!==void 0;){let n=t;if(n!==void 0){let r=n.observer;h(r)?d(r)||(f(r),N.push(r)):h(e)&&e.deferEffectsUntilRecompute?fe(e):F(n.observer),t=n.nextSub}}}}de(N)}if((E.length!==0||D.length!==0)&&!O.contents)return W()}function G(e){if(!h(e)||!d(e))return;if(e.lastGlobalVersion===c.contents)return p(e);let t=e.level;if(U(e,!1),t===0){e.level=V(e);return}}function ge(e){let t=O.contents;O.contents=!0;try{let n=e();return t||(O.contents=!1,(E.length!==0||D.length!==0)&&W()),n}catch(e){throw t||(O.contents=!1),e}}function _e(e){let t=x.contents,n=S.contents,r=w.contents,i=T.contents;x.contents=void 0,S.contents=void 0,w.contents=void 0,T.contents=void 0;try{let a=e();return x.contents=t,S.contents=n,w.contents=r,T.contents=i,a}catch(e){throw x.contents=t,S.contents=n,w.contents=r,T.contents=i,e}}function K(e,t){return e===t}function q(e,t){return!1}function ve(e,t,n){return{id:o(),value:e,equals:n===void 0?K:n,name:t,subs:l()}}function ye(e,t){return{id:o(),value:e,equals:q,name:t,subs:l()}}function be(e){return G(e.subs),R(e.subs),e.value}function xe(e){return G(e.subs),e.value}function J(e,t){let n;try{n=!e.equals(e.value,t)}catch{n=!0}if(n)return e.value=t,e.subs.version=e.subs.version+1|0,c.contents=c.contents+1|0,he(e.subs)}function Se(e,t){J(e,t(e.value))}var Ce=ge,we=_e,Te=t({batch:()=>Ae,defaultEquals:()=>Ee,get:()=>X,make:()=>Y,makeForComputed:()=>Oe,neverEquals:()=>De,peek:()=>Z,set:()=>Q,untrack:()=>je,update:()=>ke}),Ee=K,De=q,Y=ve,Oe=ye,X=be,Z=xe,Q=J,ke=Se,Ae=Ce,je=we;function Me(e,t){delete e[t]}function Ne(e,t){if(e!==void 0)return n(t(i(e)))}function $(e,t){return e===void 0?t:i(e)}function Pe(e){return e!==void 0}var Fe=[`checked`,`disabled`,`required`,`readonly`,`multiple`,`aria-hidden`,`aria-expanded`,`aria-selected`,`draggable`,`hidden`,`contenteditable`,`spellcheck`,`autofocus`];function Ie(e){return Fe.includes(e)}function Le(e){return e?`true`:`false`}function Re(e){return e===`true`}Object.defineProperty(exports,"C",{enumerable:!0,get:function(){return o}}),Object.defineProperty(exports,"D",{enumerable:!0,get:function(){return t}}),Object.defineProperty(exports,"E",{enumerable:!0,get:function(){return i}}),Object.defineProperty(exports,"S",{enumerable:!0,get:function(){return te}}),Object.defineProperty(exports,"T",{enumerable:!0,get:function(){return n}}),Object.defineProperty(exports,"_",{enumerable:!0,get:function(){return u}}),Object.defineProperty(exports,"a",{enumerable:!0,get:function(){return Pe}}),Object.defineProperty(exports,"b",{enumerable:!0,get:function(){return c}}),Object.defineProperty(exports,"c",{enumerable:!0,get:function(){return Te}}),Object.defineProperty(exports,"d",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(exports,"f",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(exports,"g",{enumerable:!0,get:function(){return le}}),Object.defineProperty(exports,"h",{enumerable:!0,get:function(){return S}}),Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return $}}),Object.defineProperty(exports,"l",{enumerable:!0,get:function(){return X}}),Object.defineProperty(exports,"m",{enumerable:!0,get:function(){return x}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return Ie}}),Object.defineProperty(exports,"o",{enumerable:!0,get:function(){return Ne}}),Object.defineProperty(exports,"p",{enumerable:!0,get:function(){return H}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return Re}}),Object.defineProperty(exports,"s",{enumerable:!0,get:function(){return Me}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return Le}}),Object.defineProperty(exports,"u",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(exports,"v",{enumerable:!0,get:function(){return ue}}),Object.defineProperty(exports,"w",{enumerable:!0,get:function(){return r}}),Object.defineProperty(exports,"x",{enumerable:!0,get:function(){return ee}}),Object.defineProperty(exports,"y",{enumerable:!0,get:function(){return p}});