@elurjs/core 3.5.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 (191) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +157 -0
  3. package/dist/lib/async.cjs +16 -0
  4. package/dist/lib/async.js +123 -0
  5. package/dist/lib/component.cjs +2 -0
  6. package/dist/lib/component.js +66 -0
  7. package/dist/lib/context.cjs +2 -0
  8. package/dist/lib/context.js +52 -0
  9. package/dist/lib/devtools.cjs +59 -0
  10. package/dist/lib/devtools.js +419 -0
  11. package/dist/lib/elur/async.cjs +16 -0
  12. package/dist/lib/elur/async.cjs.map +1 -0
  13. package/dist/lib/elur/async.d.cts +32 -0
  14. package/dist/lib/elur/async.d.ts +32 -0
  15. package/dist/lib/elur/async.js +123 -0
  16. package/dist/lib/elur/async.js.map +1 -0
  17. package/dist/lib/elur/component.cjs +2 -0
  18. package/dist/lib/elur/component.cjs.map +1 -0
  19. package/dist/lib/elur/component.d.cts +17 -0
  20. package/dist/lib/elur/component.d.ts +17 -0
  21. package/dist/lib/elur/component.js +66 -0
  22. package/dist/lib/elur/component.js.map +1 -0
  23. package/dist/lib/elur/context.cjs +2 -0
  24. package/dist/lib/elur/context.cjs.map +1 -0
  25. package/dist/lib/elur/context.d.cts +29 -0
  26. package/dist/lib/elur/context.d.ts +29 -0
  27. package/dist/lib/elur/context.js +52 -0
  28. package/dist/lib/elur/context.js.map +1 -0
  29. package/dist/lib/elur/devtools.cjs +59 -0
  30. package/dist/lib/elur/devtools.cjs.map +1 -0
  31. package/dist/lib/elur/devtools.d.cts +24 -0
  32. package/dist/lib/elur/devtools.d.ts +24 -0
  33. package/dist/lib/elur/devtools.js +419 -0
  34. package/dist/lib/elur/devtools.js.map +1 -0
  35. package/dist/lib/elur/form.cjs +2 -0
  36. package/dist/lib/elur/form.cjs.map +1 -0
  37. package/dist/lib/elur/form.d.cts +283 -0
  38. package/dist/lib/elur/form.d.ts +283 -0
  39. package/dist/lib/elur/form.js +315 -0
  40. package/dist/lib/elur/form.js.map +1 -0
  41. package/dist/lib/elur/hydrate/index.cjs +2 -0
  42. package/dist/lib/elur/hydrate/index.cjs.map +1 -0
  43. package/dist/lib/elur/hydrate/index.d.cts +13 -0
  44. package/dist/lib/elur/hydrate/index.d.ts +13 -0
  45. package/dist/lib/elur/hydrate/index.js +410 -0
  46. package/dist/lib/elur/hydrate/index.js.map +1 -0
  47. package/dist/lib/elur/index.d.cts +19 -0
  48. package/dist/lib/elur/index.d.ts +19 -0
  49. package/dist/lib/elur/lifecycle.cjs +2 -0
  50. package/dist/lib/elur/lifecycle.cjs.map +1 -0
  51. package/dist/lib/elur/lifecycle.d.cts +45 -0
  52. package/dist/lib/elur/lifecycle.d.ts +45 -0
  53. package/dist/lib/elur/lifecycle.js +39 -0
  54. package/dist/lib/elur/lifecycle.js.map +1 -0
  55. package/dist/lib/elur/plugins.cjs +2 -0
  56. package/dist/lib/elur/plugins.cjs.map +1 -0
  57. package/dist/lib/elur/plugins.d.cts +48 -0
  58. package/dist/lib/elur/plugins.d.ts +48 -0
  59. package/dist/lib/elur/plugins.js +59 -0
  60. package/dist/lib/elur/plugins.js.map +1 -0
  61. package/dist/lib/elur/reactivity.cjs +2 -0
  62. package/dist/lib/elur/reactivity.cjs.map +1 -0
  63. package/dist/lib/elur/reactivity.d.cts +60 -0
  64. package/dist/lib/elur/reactivity.d.ts +60 -0
  65. package/dist/lib/elur/reactivity.js +188 -0
  66. package/dist/lib/elur/reactivity.js.map +1 -0
  67. package/dist/lib/elur/router.cjs +12 -0
  68. package/dist/lib/elur/router.cjs.map +1 -0
  69. package/dist/lib/elur/router.d.cts +137 -0
  70. package/dist/lib/elur/router.d.ts +137 -0
  71. package/dist/lib/elur/router.js +513 -0
  72. package/dist/lib/elur/router.js.map +1 -0
  73. package/dist/lib/elur/server/index.cjs +2 -0
  74. package/dist/lib/elur/server/index.cjs.map +1 -0
  75. package/dist/lib/elur/server/index.d.cts +44 -0
  76. package/dist/lib/elur/server/index.d.ts +44 -0
  77. package/dist/lib/elur/server/index.js +307 -0
  78. package/dist/lib/elur/server/index.js.map +1 -0
  79. package/dist/lib/elur/store.cjs +2 -0
  80. package/dist/lib/elur/store.cjs.map +1 -0
  81. package/dist/lib/elur/store.d.cts +137 -0
  82. package/dist/lib/elur/store.d.ts +137 -0
  83. package/dist/lib/elur/store.js +143 -0
  84. package/dist/lib/elur/store.js.map +1 -0
  85. package/dist/lib/elur/template/bindings.cjs +2 -0
  86. package/dist/lib/elur/template/bindings.cjs.map +1 -0
  87. package/dist/lib/elur/template/bindings.d.cts +40 -0
  88. package/dist/lib/elur/template/bindings.d.ts +40 -0
  89. package/dist/lib/elur/template/bindings.js +214 -0
  90. package/dist/lib/elur/template/bindings.js.map +1 -0
  91. package/dist/lib/elur/template/dom-write.cjs +2 -0
  92. package/dist/lib/elur/template/dom-write.cjs.map +1 -0
  93. package/dist/lib/elur/template/dom-write.d.cts +5 -0
  94. package/dist/lib/elur/template/dom-write.d.ts +5 -0
  95. package/dist/lib/elur/template/dom-write.js +16 -0
  96. package/dist/lib/elur/template/dom-write.js.map +1 -0
  97. package/dist/lib/elur/template/error-boundary.cjs +2 -0
  98. package/dist/lib/elur/template/error-boundary.cjs.map +1 -0
  99. package/dist/lib/elur/template/error-boundary.d.cts +7 -0
  100. package/dist/lib/elur/template/error-boundary.d.ts +7 -0
  101. package/dist/lib/elur/template/error-boundary.js +90 -0
  102. package/dist/lib/elur/template/error-boundary.js.map +1 -0
  103. package/dist/lib/elur/template/html.cjs +2 -0
  104. package/dist/lib/elur/template/html.cjs.map +1 -0
  105. package/dist/lib/elur/template/html.d.cts +8 -0
  106. package/dist/lib/elur/template/html.d.ts +8 -0
  107. package/dist/lib/elur/template/html.js +104 -0
  108. package/dist/lib/elur/template/html.js.map +1 -0
  109. package/dist/lib/elur/template/index.cjs +1 -0
  110. package/dist/lib/elur/template/index.d.cts +15 -0
  111. package/dist/lib/elur/template/index.d.ts +15 -0
  112. package/dist/lib/elur/template/index.js +13 -0
  113. package/dist/lib/elur/template/keyed-diff.cjs +2 -0
  114. package/dist/lib/elur/template/keyed-diff.cjs.map +1 -0
  115. package/dist/lib/elur/template/keyed-diff.d.cts +32 -0
  116. package/dist/lib/elur/template/keyed-diff.d.ts +32 -0
  117. package/dist/lib/elur/template/keyed-diff.js +100 -0
  118. package/dist/lib/elur/template/keyed-diff.js.map +1 -0
  119. package/dist/lib/elur/template/keyed.cjs +2 -0
  120. package/dist/lib/elur/template/keyed.cjs.map +1 -0
  121. package/dist/lib/elur/template/keyed.d.cts +27 -0
  122. package/dist/lib/elur/template/keyed.d.ts +27 -0
  123. package/dist/lib/elur/template/keyed.js +52 -0
  124. package/dist/lib/elur/template/keyed.js.map +1 -0
  125. package/dist/lib/elur/template/mount-helpers.cjs +2 -0
  126. package/dist/lib/elur/template/mount-helpers.cjs.map +1 -0
  127. package/dist/lib/elur/template/mount-helpers.d.cts +29 -0
  128. package/dist/lib/elur/template/mount-helpers.d.ts +29 -0
  129. package/dist/lib/elur/template/mount-helpers.js +132 -0
  130. package/dist/lib/elur/template/mount-helpers.js.map +1 -0
  131. package/dist/lib/elur/template/node-binding.cjs +2 -0
  132. package/dist/lib/elur/template/node-binding.cjs.map +1 -0
  133. package/dist/lib/elur/template/node-binding.d.cts +6 -0
  134. package/dist/lib/elur/template/node-binding.d.ts +6 -0
  135. package/dist/lib/elur/template/node-binding.js +95 -0
  136. package/dist/lib/elur/template/node-binding.js.map +1 -0
  137. package/dist/lib/elur/template/portal.cjs +2 -0
  138. package/dist/lib/elur/template/portal.cjs.map +1 -0
  139. package/dist/lib/elur/template/portal.d.cts +19 -0
  140. package/dist/lib/elur/template/portal.d.ts +19 -0
  141. package/dist/lib/elur/template/portal.js +49 -0
  142. package/dist/lib/elur/template/portal.js.map +1 -0
  143. package/dist/lib/elur/template/raw.cjs +2 -0
  144. package/dist/lib/elur/template/raw.cjs.map +1 -0
  145. package/dist/lib/elur/template/raw.d.cts +9 -0
  146. package/dist/lib/elur/template/raw.d.ts +9 -0
  147. package/dist/lib/elur/template/raw.js +29 -0
  148. package/dist/lib/elur/template/raw.js.map +1 -0
  149. package/dist/lib/elur/template/sanitize.cjs +2 -0
  150. package/dist/lib/elur/template/sanitize.cjs.map +1 -0
  151. package/dist/lib/elur/template/sanitize.d.cts +16 -0
  152. package/dist/lib/elur/template/sanitize.d.ts +16 -0
  153. package/dist/lib/elur/template/sanitize.js +29 -0
  154. package/dist/lib/elur/template/sanitize.js.map +1 -0
  155. package/dist/lib/elur/template/transitions.cjs +2 -0
  156. package/dist/lib/elur/template/transitions.cjs.map +1 -0
  157. package/dist/lib/elur/template/transitions.d.cts +43 -0
  158. package/dist/lib/elur/template/transitions.d.ts +43 -0
  159. package/dist/lib/elur/template/transitions.js +96 -0
  160. package/dist/lib/elur/template/transitions.js.map +1 -0
  161. package/dist/lib/elur/template/types.cjs +2 -0
  162. package/dist/lib/elur/template/types.cjs.map +1 -0
  163. package/dist/lib/elur/template/types.d.cts +114 -0
  164. package/dist/lib/elur/template/types.d.ts +114 -0
  165. package/dist/lib/elur/template/types.js +23 -0
  166. package/dist/lib/elur/template/types.js.map +1 -0
  167. package/dist/lib/elur.cjs +1 -0
  168. package/dist/lib/elur.js +18 -0
  169. package/dist/lib/form.cjs +2 -0
  170. package/dist/lib/form.js +315 -0
  171. package/dist/lib/hydrate.cjs +2 -0
  172. package/dist/lib/hydrate.js +410 -0
  173. package/dist/lib/index.cjs +1 -0
  174. package/dist/lib/index.d.cts +2 -0
  175. package/dist/lib/index.d.ts +2 -0
  176. package/dist/lib/index.js +18 -0
  177. package/dist/lib/lifecycle.cjs +2 -0
  178. package/dist/lib/lifecycle.js +39 -0
  179. package/dist/lib/plugins.cjs +2 -0
  180. package/dist/lib/plugins.js +59 -0
  181. package/dist/lib/router.cjs +12 -0
  182. package/dist/lib/router.js +513 -0
  183. package/dist/lib/server.cjs +2 -0
  184. package/dist/lib/server.js +307 -0
  185. package/dist/lib/signals.cjs +2 -0
  186. package/dist/lib/signals.js +188 -0
  187. package/dist/lib/store.cjs +2 -0
  188. package/dist/lib/store.js +143 -0
  189. package/dist/lib/template.cjs +1 -0
  190. package/dist/lib/template.js +13 -0
  191. package/package.json +216 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Deiver Vasquez
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 ADDED
@@ -0,0 +1,157 @@
1
+ # Elur
2
+
3
+ [![npm version](https://img.shields.io/npm/v/elur.svg)](https://www.npmjs.com/package/elur)
4
+ [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)
5
+ [![Tests](https://img.shields.io/badge/tests-886%20passing-brightgreen.svg)]()
6
+ [![Coverage](https://img.shields.io/badge/coverage-95.86%25-brightgreen.svg)]()
7
+ [![Bundle size](https://img.shields.io/badge/min%2Bgzip-~15%20KB-orange.svg)]()
8
+ [![Zero Dependencies](https://img.shields.io/badge/dependencies-0-success.svg)]()
9
+ [![Website](https://img.shields.io/badge/website-elur-indigo.svg)](https://elur.dev/)
10
+
11
+ A lightweight, fully reactive framework for building modern web UIs — no virtual DOM, no compiler, no build-time magic. Just signals, tagged templates, and pure TypeScript.
12
+
13
+ **[→ Documentation & Live Demo](https://elur.dev/)**
14
+
15
+ ```
16
+ ~24 KB minified · ~15 KB gzipped · zero dependencies · TypeScript-first · ES2022
17
+ ```
18
+
19
+ ## Installation
20
+
21
+ ```bash
22
+ npm install elur
23
+ ```
24
+
25
+ ## Subpath Imports (Tree-Shaking)
26
+
27
+ When you only need one module, import from subpaths:
28
+
29
+ ```typescript
30
+ import { signal, effect } from "elur/signals";
31
+ import { createRouter } from "elur/router";
32
+ import { createStore } from "elur/store";
33
+ import { createForm } from "elur/form";
34
+ import { suspend, lazy } from "elur/async";
35
+ import { html, repeat, transition } from "elur/template";
36
+ import { mount } from "elur/component";
37
+ import { ElurComponent } from "elur/lifecycle";
38
+ import { provide, inject, createInjectionKey } from "elur/context";
39
+ import { enableDevTools } from "elur/devtools";
40
+ ```
41
+
42
+ This is optional: `import { ... } from "elur"` remains fully supported.
43
+
44
+ ## Quick Start
45
+
46
+ ```typescript
47
+ import { signal, html, ElurTemplate, ElurComponent, mount, createRouter, RouterView, Link, elurRouter } from "elur";
48
+
49
+ // --- Pages as function components (ElurTemplate) ---
50
+ // Plain functions returning html`` are recommended for pages and
51
+ // display-only components — no class needed, signals just work.
52
+
53
+ function HomePage(): ElurTemplate {
54
+ const count = signal(0);
55
+ return html`
56
+ <h1>Home</h1>
57
+ <p>Count: ${() => count.value}</p>
58
+ <button @click=${() => count.value++}>+1</button>
59
+ `;
60
+ }
61
+
62
+ function UserPage(): ElurTemplate {
63
+ const router = elurRouter();
64
+ return html`<h1>User: ${() => router.params.value.id}</h1>`;
65
+ }
66
+
67
+ // --- Stateful component as class component (ElurComponent) ---
68
+ // Use a class when you need lifecycle hooks: onInit / onMount / onUnmount.
69
+
70
+ class Clock extends ElurComponent {
71
+ private time = signal(new Date().toLocaleTimeString());
72
+ private _id = 0;
73
+
74
+ onMount() {
75
+ this._id = setInterval(() => {
76
+ this.time.value = new Date().toLocaleTimeString();
77
+ }, 1000);
78
+ return () => clearInterval(this._id); // auto-cleanup on unmount
79
+ }
80
+
81
+ render() {
82
+ return html`<p>Clock: ${() => this.time.value}</p>`;
83
+ }
84
+ }
85
+
86
+ // --- Router ---
87
+
88
+ const router = createRouter([
89
+ { path: "/", component: () => HomePage() },
90
+ { path: "/user/:id", component: () => UserPage() },
91
+ ]);
92
+
93
+ // --- App shell (function component) ---
94
+
95
+ function App(): ElurTemplate {
96
+ return html`
97
+ <nav>${new Link("/", "Home")} ${new Link("/user/42", "User 42")}</nav>
98
+ ${new Clock()}
99
+ ${new RouterView()}
100
+ `;
101
+ }
102
+
103
+ mount(App(), "#app", { router });
104
+ ```
105
+
106
+ ## What's Included
107
+
108
+ Everything ships in a single zero-dependency import:
109
+
110
+ | Category | APIs |
111
+ |---|---|
112
+ | **Reactivity** | `signal`, `computed`, `effect`, `batch`, `watch`, `untrack`, `nextTick` |
113
+ | **Templates** | `` html` ` ``, `repeat`, `ref`, `portal`, `transition`, `showWhen` |
114
+ | **Components** | `ElurTemplate` (function components), `ElurComponent` (lifecycle class), `mount`, children & named slots |
115
+ | **Router** | `createRouter`, `RouterView`, `Link`, `elurRouter`, `RouterKey`, guards, nested routes, named routes (`name` + `navigate({ name })`), `mount(..., { router })` |
116
+ | **Forms** | `elurField`, `createForm`, `elurFieldArray`, built-in validators, programmatic value setting, Zod/Valibot interop |
117
+ | **State** | `createStore`, `provide`, `inject`, `createInjectionKey` |
118
+ | **Async** | `suspend` (with `invalidate` for re-fetching), `lazy` |
119
+ | **Error handling** | `createErrorBoundary` |
120
+
121
+ ## Server-side rendering & hydration (v3)
122
+
123
+ ```bash
124
+ npm install elur
125
+ ```
126
+
127
+ ```typescript
128
+ import { renderToString, renderToChunks, createServerRenderScope } from "elur/server";
129
+ import { hydrate } from "elur/hydrate";
130
+ import { raw } from "elur";
131
+ ```
132
+
133
+ - DOM-free SSR (`renderToString`), incremental streaming (`renderToChunks`) and
134
+ isolated render scopes (`createServerRenderScope`).
135
+ - Real hydration over existing SSR DOM: preserves nodes, focus, input state and
136
+ scroll; keyed `repeat()` lists are adopted without recreating nodes.
137
+ - Render protocols (`renderServer` / `mountDom` / `hydrateDom`) and `raw()` for
138
+ explicit trusted HTML.
139
+ - Minified with Oxc; validated by `npm run test:artifact`.
140
+
141
+ ## Documentation
142
+
143
+ ## Query Package
144
+
145
+ `createQuery` and query cache utilities now live in `@elurjs/query`.
146
+
147
+ ```bash
148
+ npm install @elurjs/query
149
+ ```
150
+
151
+ Full API reference, guides, and examples:
152
+
153
+ **→ [github.com/elurjs/elur](https://github.com/elurjs/elur)**
154
+
155
+ ## License
156
+
157
+ MIT
@@ -0,0 +1,16 @@
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./signals.cjs`),t=require(`./elur/template/types.cjs`),n=require(`./lifecycle.cjs`),r=require(`./elur/template/html.cjs`);function i(){return r.html`
2
+ <span style="color:#52525b;font-size:13px;display:inline-flex;align-items:center;gap:6px">
3
+ <span class="elur-spinner" style="
4
+ display:inline-block;width:14px;height:14px;border-radius:50%;
5
+ border:2px solid #38bdf840;border-top-color:#38bdf8;
6
+ animation:elur-spin .7s linear infinite
7
+ "></span>
8
+ Loading…
9
+ </span>
10
+ <style>@keyframes elur-spin{to{transform:rotate(360deg)}}</style>
11
+ `}function a(e){return r.html`
12
+ <span style="color:#f87171;font-size:13px">
13
+ ⚠ ${e instanceof Error?e.message:String(e)}
14
+ </span>
15
+ `}var o=new Map,s=300*1e3,c=null,l=s;function u(){c===null&&(c=setInterval(()=>{let e=Date.now();for(let[t,n]of o)n.subscribers<=0&&e-n.fetchedAt>l&&o.delete(t);o.size===0&&c!==null&&(clearInterval(c),c=null)},6e4))}function d(e){let t=o.get(e);if(t&&t.fetchedAt>0)return t}function f(e,t){let n=o.get(e);o.set(e,{data:t,fetchedAt:Date.now(),subscribers:n?.subscribers??0}),u()}function p(e){let t=o.get(e);t?t.subscribers++:o.set(e,{fetchedAt:0,subscribers:1})}function m(e){let t=o.get(e);t&&(t.subscribers=Math.max(0,t.subscribers-1))}function h(e,t){let n=o.get(e);return n?Date.now()-n.fetchedAt<t:!1}function g(t,s,c={}){let{fallback:l,errorFallback:u,resetOnRefresh:g=!1,invalidate:_,cacheKey:v,staleTime:y=0}=c,b=l??i(),x=u??a;class S extends n.ElurComponent{_state;_disposeWatcher;constructor(){super();let t=v?d(v):void 0;this._state=e.signal(t&&t.data!==void 0?{status:`resolved`,data:t.data}:{status:`pending`})}onMount(){v&&p(v);let t=v?d(v):void 0;if(t&&h(v,y)||(t?this._fetch():this._run()),_){let t=!0;this._disposeWatcher=e.effect(()=>{if(_.value,t){t=!1;return}v&&o.delete(v),this._run()})}return()=>{this._disposeWatcher?.(),v&&m(v)}}_run(){(g||this._state.peek().status===`pending`)&&(this._state.value={status:`pending`}),this._fetch()}_fetch(){t().then(e=>{v&&f(v,e),this._state.value={status:`resolved`,data:e}},e=>{this._state.value={status:`error`,error:e}})}render(){return r.html`<div class="elur-suspense" style="display:contents">${()=>{let e=this._state.value;return e.status===`pending`?b:e.status===`error`?x(e.error):s(e.data)}}</div>`}}return new S}function _(e,n){let r=n===void 0||t.isElurTemplate(n)?{fallback:n}:n,i=r.selector??(e=>e.default),a=null;return()=>a?new a:g(async()=>(a=i(await e()),a),e=>new e,{fallback:r.fallback})}exports.lazy=_,exports.suspend=g;
16
+ //# sourceMappingURL=async.cjs.map
@@ -0,0 +1,123 @@
1
+ import { effect as e, signal as t } from "./signals.js";
2
+ import { isElurTemplate as n } from "./elur/template/types.js";
3
+ import { ElurComponent as r } from "./lifecycle.js";
4
+ import { html as i } from "./elur/template/html.js";
5
+ //#region src/elur/async.ts
6
+ function a() {
7
+ return i`
8
+ <span style="color:#52525b;font-size:13px;display:inline-flex;align-items:center;gap:6px">
9
+ <span class="elur-spinner" style="
10
+ display:inline-block;width:14px;height:14px;border-radius:50%;
11
+ border:2px solid #38bdf840;border-top-color:#38bdf8;
12
+ animation:elur-spin .7s linear infinite
13
+ "></span>
14
+ Loading…
15
+ </span>
16
+ <style>@keyframes elur-spin{to{transform:rotate(360deg)}}</style>
17
+ `;
18
+ }
19
+ function o(e) {
20
+ return i`
21
+ <span style="color:#f87171;font-size:13px">
22
+ ⚠ ${e instanceof Error ? e.message : String(e)}
23
+ </span>
24
+ `;
25
+ }
26
+ var s = /* @__PURE__ */ new Map(), c = 300 * 1e3, l = null, u = c;
27
+ function d() {
28
+ l === null && (l = setInterval(() => {
29
+ let e = Date.now();
30
+ for (let [t, n] of s) n.subscribers <= 0 && e - n.fetchedAt > u && s.delete(t);
31
+ s.size === 0 && l !== null && (clearInterval(l), l = null);
32
+ }, 6e4));
33
+ }
34
+ function f(e) {
35
+ let t = s.get(e);
36
+ if (t && t.fetchedAt > 0) return t;
37
+ }
38
+ function p(e, t) {
39
+ let n = s.get(e);
40
+ s.set(e, {
41
+ data: t,
42
+ fetchedAt: Date.now(),
43
+ subscribers: n?.subscribers ?? 0
44
+ }), d();
45
+ }
46
+ function m(e) {
47
+ let t = s.get(e);
48
+ t ? t.subscribers++ : s.set(e, {
49
+ fetchedAt: 0,
50
+ subscribers: 1
51
+ });
52
+ }
53
+ function h(e) {
54
+ let t = s.get(e);
55
+ t && (t.subscribers = Math.max(0, t.subscribers - 1));
56
+ }
57
+ function g(e, t) {
58
+ let n = s.get(e);
59
+ return n ? Date.now() - n.fetchedAt < t : !1;
60
+ }
61
+ function _(n, c, l = {}) {
62
+ let { fallback: u, errorFallback: d, resetOnRefresh: _ = !1, invalidate: v, cacheKey: y, staleTime: b = 0 } = l, x = u ?? a(), S = d ?? o;
63
+ class C extends r {
64
+ _state;
65
+ _disposeWatcher;
66
+ constructor() {
67
+ super();
68
+ let e = y ? f(y) : void 0;
69
+ this._state = t(e && e.data !== void 0 ? {
70
+ status: "resolved",
71
+ data: e.data
72
+ } : { status: "pending" });
73
+ }
74
+ onMount() {
75
+ y && m(y);
76
+ let t = y ? f(y) : void 0;
77
+ if (t && g(y, b) || (t ? this._fetch() : this._run()), v) {
78
+ let t = !0;
79
+ this._disposeWatcher = e(() => {
80
+ if (v.value, t) {
81
+ t = !1;
82
+ return;
83
+ }
84
+ y && s.delete(y), this._run();
85
+ });
86
+ }
87
+ return () => {
88
+ this._disposeWatcher?.(), y && h(y);
89
+ };
90
+ }
91
+ _run() {
92
+ (_ || this._state.peek().status === "pending") && (this._state.value = { status: "pending" }), this._fetch();
93
+ }
94
+ _fetch() {
95
+ n().then((e) => {
96
+ y && p(y, e), this._state.value = {
97
+ status: "resolved",
98
+ data: e
99
+ };
100
+ }, (e) => {
101
+ this._state.value = {
102
+ status: "error",
103
+ error: e
104
+ };
105
+ });
106
+ }
107
+ render() {
108
+ return i`<div class="elur-suspense" style="display:contents">${() => {
109
+ let e = this._state.value;
110
+ return e.status === "pending" ? x : e.status === "error" ? S(e.error) : c(e.data);
111
+ }}</div>`;
112
+ }
113
+ }
114
+ return new C();
115
+ }
116
+ function v(e, t) {
117
+ let r = t === void 0 || n(t) ? { fallback: t } : t, i = r.selector ?? ((e) => e.default), a = null;
118
+ return () => a ? new a() : _(async () => (a = i(await e()), a), (e) => new e(), { fallback: r.fallback });
119
+ }
120
+ //#endregion
121
+ export { v as lazy, _ as suspend };
122
+
123
+ //# sourceMappingURL=async.js.map
@@ -0,0 +1,2 @@
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./lifecycle.cjs`),t=require(`./context.cjs`),n=require(`./router.cjs`);function r(e){let t=typeof e==`string`?document.querySelector(e):e;if(!t)throw Error(`[elur] mount: container not found: ${e}`);return t}function i(i,a,o){if(e.isElurComponent(i)){let s=r(a);e._debugComponentMountStart(i),t._pushComponentContext();let c=()=>{},l=!1;try{o?.router&&(t.provide(n.RouterKey,o.router),n._debugRegisterRouter(o.router));try{i.onInit?.()}catch(e){if(i.onError)i.onError(e);else throw e}try{c=i.render()._render(s,null)}catch(e){if(i.onError)i.onError(e),c=()=>{},l=!0;else throw e}}finally{e._debugComponentMountEnd(i),t._popComponentContext()}let u;if(!l)try{let e=i.onMount?.();typeof e==`function`&&(u=e)}catch(e){if(i.onError)i.onError(e);else throw e}return{unmount(){try{i.onUnmount?.()}catch{}try{u?.()}catch{}c(),o?.router&&n._debugUnregisterRouter(o.router),e._debugComponentUnmount(i)}}}if(!o?.router)return i.mount(a);let s=r(a);t._pushComponentContext();let c;try{t.provide(n.RouterKey,o.router),n._debugRegisterRouter(o.router),c=i._render(s,null)}finally{t._popComponentContext()}return{unmount(){c(),n._debugUnregisterRouter(o.router)}}}exports.mount=i;
2
+ //# sourceMappingURL=component.cjs.map
@@ -0,0 +1,66 @@
1
+ import { _debugComponentMountEnd as e, _debugComponentMountStart as t, _debugComponentUnmount as n, isElurComponent as r } from "./lifecycle.js";
2
+ import { _popComponentContext as i, _pushComponentContext as a, provide as o } from "./context.js";
3
+ import { RouterKey as s, _debugRegisterRouter as c, _debugUnregisterRouter as l } from "./router.js";
4
+ //#region src/elur/component.ts
5
+ function u(e) {
6
+ let t = typeof e == "string" ? document.querySelector(e) : e;
7
+ if (!t) throw Error(`[elur] mount: container not found: ${e}`);
8
+ return t;
9
+ }
10
+ function d(d, f, p) {
11
+ if (r(d)) {
12
+ let r = u(f);
13
+ t(d), a();
14
+ let m = () => {}, h = !1;
15
+ try {
16
+ p?.router && (o(s, p.router), c(p.router));
17
+ try {
18
+ d.onInit?.();
19
+ } catch (e) {
20
+ if (d.onError) d.onError(e);
21
+ else throw e;
22
+ }
23
+ try {
24
+ m = d.render()._render(r, null);
25
+ } catch (e) {
26
+ if (d.onError) d.onError(e), m = () => {}, h = !0;
27
+ else throw e;
28
+ }
29
+ } finally {
30
+ e(d), i();
31
+ }
32
+ let g;
33
+ if (!h) try {
34
+ let e = d.onMount?.();
35
+ typeof e == "function" && (g = e);
36
+ } catch (e) {
37
+ if (d.onError) d.onError(e);
38
+ else throw e;
39
+ }
40
+ return { unmount() {
41
+ try {
42
+ d.onUnmount?.();
43
+ } catch {}
44
+ try {
45
+ g?.();
46
+ } catch {}
47
+ m(), p?.router && l(p.router), n(d);
48
+ } };
49
+ }
50
+ if (!p?.router) return d.mount(f);
51
+ let m = u(f);
52
+ a();
53
+ let h;
54
+ try {
55
+ o(s, p.router), c(p.router), h = d._render(m, null);
56
+ } finally {
57
+ i();
58
+ }
59
+ return { unmount() {
60
+ h(), l(p.router);
61
+ } };
62
+ }
63
+ //#endregion
64
+ export { d as mount };
65
+
66
+ //# sourceMappingURL=component.js.map
@@ -0,0 +1,2 @@
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});function e(e){return Symbol(e)}var t=[],n;function r(){return n?.()??t}function i(e){n=e}function a(){return[...r()]}function o(e,t){let n=r(),i=n.splice(0);e.forEach(e=>n.push(e));try{return t()}finally{n.splice(0),i.forEach(e=>n.push(e))}}function s(){r().push(new Map)}function c(){r().pop()}function l(e,t){let n=r(),i=n.splice(0);e.forEach(e=>n.push(e)),n.push(new Map);try{return t()}finally{n.splice(0),i.forEach(e=>n.push(e))}}function u(e,t){let n=r(),i=n[n.length-1];if(!i)throw Error(`[elur] provide() must be called inside onInit() of a ElurComponent.`);i.set(e,t)}function d(e,t){let n=r();for(let t=n.length-1;t>=0;t--)if(n[t].has(e))return n[t].get(e);return t}exports._captureContextSnapshot=a,exports._popComponentContext=c,exports._pushComponentContext=s,exports._setContextScopeResolver=i,exports._withComponentContext=l,exports._withContextSnapshot=o,exports.createInjectionKey=e,exports.inject=d,exports.provide=u;
2
+ //# sourceMappingURL=context.cjs.map
@@ -0,0 +1,52 @@
1
+ //#region src/elur/context.ts
2
+ function e(e) {
3
+ return Symbol(e);
4
+ }
5
+ var t = [], n;
6
+ function r() {
7
+ return n?.() ?? t;
8
+ }
9
+ function i(e) {
10
+ n = e;
11
+ }
12
+ function a() {
13
+ return [...r()];
14
+ }
15
+ function o(e, t) {
16
+ let n = r(), i = n.splice(0);
17
+ e.forEach((e) => n.push(e));
18
+ try {
19
+ return t();
20
+ } finally {
21
+ n.splice(0), i.forEach((e) => n.push(e));
22
+ }
23
+ }
24
+ function s() {
25
+ r().push(/* @__PURE__ */ new Map());
26
+ }
27
+ function c() {
28
+ r().pop();
29
+ }
30
+ function l(e, t) {
31
+ let n = r(), i = n.splice(0);
32
+ e.forEach((e) => n.push(e)), n.push(/* @__PURE__ */ new Map());
33
+ try {
34
+ return t();
35
+ } finally {
36
+ n.splice(0), i.forEach((e) => n.push(e));
37
+ }
38
+ }
39
+ function u(e, t) {
40
+ let n = r(), i = n[n.length - 1];
41
+ if (!i) throw Error("[elur] provide() must be called inside onInit() of a ElurComponent.");
42
+ i.set(e, t);
43
+ }
44
+ function d(e, t) {
45
+ let n = r();
46
+ for (let t = n.length - 1; t >= 0; t--) if (n[t].has(e)) return n[t].get(e);
47
+ return t;
48
+ }
49
+ //#endregion
50
+ export { a as _captureContextSnapshot, c as _popComponentContext, s as _pushComponentContext, i as _setContextScopeResolver, l as _withComponentContext, o as _withContextSnapshot, e as createInjectionKey, d as inject, u as provide };
51
+
52
+ //# sourceMappingURL=context.js.map
@@ -0,0 +1,59 @@
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./signals.cjs`),t=require(`./lifecycle.cjs`),n=require(`./router.cjs`);var r={enabled:!1,activeTab:`signals`,renderedTab:null,refreshId:null,root:null,panel:null,content:null,dispose:null,renderKeys:{signals:``,components:``,router:``},scrollMemo:{signals:{top:0,left:0},components:{top:0,left:0},router:{top:0,left:0}}},i=new Set,a=new WeakMap,o=1,s=50,c=new WeakMap,l=new Map,u=[],d=1;function f(e){return typeof WeakRef<`u`?new WeakRef(e):{deref:()=>e}}function p(e){return typeof WeakRef<`u`?new WeakRef(e):{deref:()=>e}}function m(e){e.history.length>s&&e.history.splice(0,e.history.length-s)}function h(e,t){let n=a.get(e);if(n)return m(n),n;let r=Date.now(),s={id:o++,createdAt:r,lastUpdated:r,history:[{at:r,value:t}]};return a.set(e,s),i.add(f(e)),s}function g(){let e=[];for(let t of Array.from(i)){let n=t.deref();if(!n){i.delete(t);continue}let r=a.get(n);if(!r)continue;let o=n._subs?.size??0;e.push({id:r.id,value:n.peek(),subscriberCount:o,createdAt:r.createdAt,lastUpdated:r.lastUpdated,history:r.history.slice()})}return e.sort((e,t)=>t.lastUpdated-e.lastUpdated),e}function _(e){let t=e._debugName;if(t&&t.trim())return t;let n=e.constructor;return n?.name&&n.name.trim()?n.name:`AnonymousComponent`}function v(e){let t=e._slots;return t instanceof Map?Array.from(t.keys()).map(e=>String(e)):[]}function y(e){let t={};for(let n of Object.keys(e)){if(n===`__isElurComponent`||n===`children`||n===`_debugName`||n.startsWith(`_`))continue;let r=e[n];typeof r!=`function`&&(t[n]=r)}return t}function b(e){if(!e)return[];if(e===`*`)return[`*`];let t=e.split(`/`).filter(Boolean),n=[],r=``;for(let e of t)r+=`/`+e,n.push(r);return n.length>0?n:[`/`]}function x(){let e=[];for(let[t,n]of l){let r=n.ref.deref();if(!r){l.delete(t);continue}n.debugName=_(r),n.hasDefaultSlot=r.children!=null,n.slotNames=v(r),n.props=y(r),e.push({id:n.id,parentId:n.parentId,debugName:n.debugName,mountedAt:n.mountedAt,hasDefaultSlot:n.hasDefaultSlot,slotNames:[...n.slotNames],props:{...n.props}})}return e.sort((e,t)=>e.id-t.id),e}function S(e){let t=[e];for(;t.length>0;){let e=t.pop();for(let[n,r]of l)r.parentId===e&&t.push(n);l.delete(e)}}function C(){i.clear(),a=new WeakMap,o=1,c=new WeakMap,l.clear(),u.length=0,d=1}function w(e){if(typeof e==`string`)return e;if(typeof e==`number`||typeof e==`boolean`||e==null)return String(e);try{return JSON.stringify(e)}catch{return Object.prototype.toString.call(e)}}function T(e){return e.replace(/&/g,`&amp;`).replace(/</g,`&lt;`).replace(/>/g,`&gt;`).replace(/\"/g,`&quot;`).replace(/'/g,`&#39;`)}function E(e,t=90){let n=w(e);return n.length<=t?n:n.slice(0,t-1)+`…`}function D(e){if(!e)return`-`;let t=Date.now()-e;return t<1e3?`${t}ms ago`:t<6e4?`${Math.floor(t/1e3)}s ago`:`${Math.floor(t/6e4)}m ago`}function O(e){let t=g(),n=`${t.length}:${t.map(e=>`${e.id}-${e.lastUpdated}-${e.subscriberCount}`).join(`|`)}`;if(r.renderedTab===`signals`&&r.renderKeys.signals===n)return;r.renderKeys.signals=n,r.renderedTab=`signals`;let i=t.map(e=>{let t=w(e.value),n=E(e.value,120);return`<tr data-elur-devtools-signal-id="${e.id}">
2
+ <td style="padding:6px 8px;white-space:nowrap;">${e.id}</td>
3
+ <td style="padding:6px 8px;max-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-family:ui-monospace, SFMono-Regular, Menlo, monospace;" title="${T(t)}">${T(n)}</td>
4
+ <td>${e.subscriberCount}</td>
5
+ <td data-elur-devtools-history-count="${e.history.length}">${e.history.length}</td>
6
+ <td>${D(e.lastUpdated)}</td>
7
+ </tr>`}).join(``);e.innerHTML=`
8
+ <div style="display:flex;justify-content:space-between;align-items:center;margin-bottom:8px;">
9
+ <strong>Signals</strong>
10
+ <span style="opacity:.8">${t.length} active</span>
11
+ </div>
12
+ <div data-elur-devtools-scroll="signals" style="max-height:260px;overflow:auto;overscroll-behavior:contain;border:1px solid #2f2f35;border-radius:8px;">
13
+ <table style="width:100%;border-collapse:collapse;font-size:12px;table-layout:fixed;">
14
+ <thead>
15
+ <tr style="background:#1f1f24;">
16
+ <th style="text-align:left;padding:6px 8px;width:42px;">ID</th>
17
+ <th style="text-align:left;padding:6px 8px;">Value</th>
18
+ <th style="text-align:left;padding:6px 8px;width:50px;">Subs</th>
19
+ <th style="text-align:left;padding:6px 8px;width:50px;">History</th>
20
+ <th style="text-align:left;padding:6px 8px;width:84px;">Updated</th>
21
+ </tr>
22
+ </thead>
23
+ <tbody>${i}</tbody>
24
+ </table>
25
+ </div>
26
+ <p style="margin:8px 0 0 0;font-size:11px;opacity:.75;">Click a row to log full history in console.</p>
27
+ `;for(let n of e.querySelectorAll(`tr[data-elur-devtools-signal-id]`))n.style.cursor=`pointer`,n.addEventListener(`click`,()=>{let e=Number(n.dataset.elurDevtoolsSignalId),r=t.find(t=>t.id===e);r&&(console.group(`[Elur DevTools] Signal #${r.id}`),console.log(`Current value:`,r.value),console.log(`Subscribers:`,r.subscriberCount),console.table(r.history.map(e=>({at:new Date(e.at).toISOString(),value:e.value}))),console.groupEnd())})}function k(e){let t=new Map,n=[];for(let n of e)t.set(n.id,{...n,children:[]});for(let e of t.values()){if(e.parentId==null){n.push(e);continue}let r=t.get(e.parentId);if(!r){n.push(e);continue}r.children.push(e)}return n}function A(e,t){let n=10+t*14,r=Object.keys(e.props).length>0?w(e.props):`{}`,i=e.slotNames.length>0?e.slotNames.join(`, `):`none`;return`<div style="padding:6px 8px 6px ${n}px;border-bottom:1px solid #24242b;">
28
+ <div><strong>${T(e.debugName)}</strong> <span style="opacity:.7">#${e.id}</span></div>
29
+ <div style="font-size:11px;opacity:.8;">slots: ${i} | default-slot: ${e.hasDefaultSlot?`yes`:`no`}</div>
30
+ <div style="font-size:11px;opacity:.8;">props: ${T(E(r,180))}</div>
31
+ </div>`+e.children.map(e=>A(e,t+1)).join(``)}function j(e){let t=x(),i=n._debugGetRouterInternal(),a=`${i?`${i.currentPath}|${i.matchedPath??``}`:`no-router`}:${t.length}:${t.map(e=>`${e.id}-${e.parentId}-${e.debugName}-${e.hasDefaultSlot}-${e.slotNames.join(`,`)}-${w(e.props)}`).join(`|`)}`;if(r.renderedTab===`components`&&r.renderKeys.components===a)return;r.renderKeys.components=a,r.renderedTab=`components`;let o=k(t);e.innerHTML=`
32
+ <div style="display:flex;justify-content:space-between;align-items:center;margin-bottom:8px;">
33
+ <strong>Component Tree</strong>
34
+ <span style="opacity:.8">${t.length} mounted</span>
35
+ </div>
36
+ <div style="font-size:11px;opacity:.82;margin-bottom:8px;display:flex;gap:8px;flex-wrap:wrap;">
37
+ <span><b>current:</b> ${T(i?.currentPath??`-`)}</span>
38
+ <span><b>matched:</b> ${T(i?.matchedPath??`none`)}</span>
39
+ </div>
40
+ <div data-elur-devtools-scroll="components" style="max-height:280px;overflow:auto;overscroll-behavior:contain;border:1px solid #2f2f35;border-radius:8px;">
41
+ ${o.length>0?o.map(e=>A(e,0)).join(``):`<div style='padding:10px;opacity:.75'>No mounted components tracked. Enable devtools before your first mount() to capture initial tree.</div>`}
42
+ </div>
43
+ `}function M(e){let t=n._debugGetRouterInternal(),i=t?`${t.mode}|${t.base}|${t.currentPath}|${JSON.stringify(t.params)}|${JSON.stringify(t.query)}|${t.matchedPath}|${t.activeGuards.names.join(`,`)}`:`none`;if(r.renderedTab===`router`&&r.renderKeys.router===i)return;if(r.renderKeys.router=i,r.renderedTab=`router`,!t){e.innerHTML=`
44
+ <strong>Router State</strong>
45
+ <div style="margin-top:8px;opacity:.75">No active Elur router instance. Ensure your app uses createRouter()/RouterView from elur/router.</div>
46
+ `;return}let a=b(t.matchedPath);e.innerHTML=`
47
+ <strong>Router State</strong>
48
+ <div data-elur-devtools-scroll="router" style="margin-top:8px;font-size:12px;line-height:1.55;max-height:280px;overflow:auto;overscroll-behavior:contain;border:1px solid #2f2f35;border-radius:8px;padding:8px;">
49
+ <div><b>mode</b>: ${t.mode}</div>
50
+ <div><b>base</b>: ${t.base}</div>
51
+ <div><b>current</b>: ${T(t.currentPath)}</div>
52
+ <div><b>params</b>: ${T(w(t.params))}</div>
53
+ <div><b>query</b>: ${T(w(t.query))}</div>
54
+ <div><b>matched</b>: ${T(t.matchedPath??`none`)}</div>
55
+ <div><b>matched chain</b>: ${a.length>0?T(a.join(` -> `)):`none`}</div>
56
+ <div><b>guards</b>: ${t.activeGuards.names.length>0?T(t.activeGuards.names.join(`, `)):`none`}</div>
57
+ </div>
58
+ `}function N(e){if(!r.content)return;let t=r.content.querySelector(`[data-elur-devtools-scroll='${e}']`);t&&(r.scrollMemo[e]={top:t.scrollTop,left:t.scrollLeft})}function P(e){if(!r.content)return;let t=r.content.querySelector(`[data-elur-devtools-scroll='${e}']`);if(!t)return;let n=r.scrollMemo[e];t.scrollTop=n.top,t.scrollLeft=n.left,t.dataset.elurDevtoolsScrollBound!==`1`&&(t.addEventListener(`scroll`,()=>{r.scrollMemo[e]={top:t.scrollTop,left:t.scrollLeft}},{passive:!0}),t.dataset.elurDevtoolsScrollBound=`1`)}function F(e=!1){if(!r.content)return;let t=r.activeTab;if(e||N(t),r.activeTab===`signals`){O(r.content),P(`signals`);return}if(r.activeTab===`components`){j(r.content),P(`components`);return}M(r.content),P(`router`)}function I(){if(r.panel)for(let e of r.panel.querySelectorAll(`button[data-elur-devtools-tab]`)){let t=e.dataset.elurDevtoolsTab===r.activeTab;e.style.background=t?`#2d4c7a`:`#1f1f24`}}function L(e){let t=document.createElement(`div`);t.setAttribute(`data-elur-devtools-root`,``),t.style.position=`fixed`,t.style.zIndex=`2147483647`,t.style.bottom=`16px`,t.style.right=e.position===`bottom-right`?`16px`:`auto`,t.style.left=e.position===`bottom-left`?`16px`:`auto`,t.style.fontFamily=`ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, sans-serif`;let n=document.createElement(`button`);n.type=`button`,n.textContent=`Elur DevTools`,n.setAttribute(`data-elur-devtools-button`,``),n.style.background=`#111827`,n.style.color=`#f9fafb`,n.style.border=`1px solid #374151`,n.style.borderRadius=`999px`,n.style.padding=`8px 12px`,n.style.cursor=`pointer`,n.style.boxShadow=`0 6px 18px rgba(0,0,0,.3)`;let i=document.createElement(`div`);i.setAttribute(`data-elur-devtools-panel`,``),i.style.marginTop=`8px`,i.style.width=`460px`,i.style.maxWidth=`min(92vw, 460px)`,i.style.background=`#15151b`,i.style.color=`#e5e7eb`,i.style.border=`1px solid #2f2f35`,i.style.borderRadius=`12px`,i.style.padding=`10px`,i.style.display=`none`,i.style.boxShadow=`0 14px 28px rgba(0,0,0,.35)`;let a=document.createElement(`div`);a.style.display=`flex`,a.style.gap=`6px`,a.style.marginBottom=`10px`;let o=document.createElement(`div`);o.setAttribute(`data-elur-devtools-content`,``);let s=(e,t)=>{let n=document.createElement(`button`);return n.type=`button`,n.textContent=t,n.setAttribute(`data-elur-devtools-tab`,e),n.style.border=`1px solid #353543`,n.style.borderRadius=`8px`,n.style.padding=`6px 9px`,n.style.background=`#1f1f24`,n.style.color=`#d1d5db`,n.style.cursor=`pointer`,n.addEventListener(`click`,()=>{r.activeTab=e,I(),F(!0)}),n};a.appendChild(s(`signals`,`Signals`)),a.appendChild(s(`components`,`Components`)),a.appendChild(s(`router`,`Router`)),n.addEventListener(`click`,()=>{i.style.display=i.style.display===`none`?`block`:`none`,i.style.display===`block`&&(I(),F(!0))}),i.appendChild(a),i.appendChild(o),t.appendChild(n),t.appendChild(i),document.body.appendChild(t),r.root=t,r.panel=i,r.content=o}function R(){r.enabled&&(r.enabled=!1,r.refreshId!=null&&(clearInterval(r.refreshId),r.refreshId=null),e._setSignalDebugHooks(null),t._setComponentDebugHooks(null),C(),r.root?.parentNode&&r.root.parentNode.removeChild(r.root),r.root=null,r.panel=null,r.content=null,r.dispose=null,r.renderedTab=null,r.renderKeys={signals:``,components:``,router:``},r.scrollMemo={signals:{top:0,left:0},components:{top:0,left:0},router:{top:0,left:0}})}function z(n={}){if(typeof document>`u`)return{disable:()=>void 0};if(r.enabled&&r.dispose)return{disable:r.dispose};let o=Math.max(100,n.refreshMs??350);s=Math.max(1,n.historyLimit??50);let f=n.position??`bottom-right`;r.enabled=!0,r.activeTab=`signals`;for(let e of Array.from(i)){let t=e.deref();if(!t){i.delete(e);continue}let n=a.get(t);n&&m(n)}e._setSignalDebugHooks({onCreate(e,t){h(e,t)},onWrite(e,t){let n=h(e,t),r=Date.now();n.lastUpdated=r,n.history.push({at:r,value:t}),m(n)}}),t._setComponentDebugHooks({onMountStart(e){let t=c.get(e);t??(t=d++,c.set(e,t));let n=u.length>0?u[u.length-1]:null;l.set(t,{id:t,parentId:n,debugName:_(e),mountedAt:Date.now(),hasDefaultSlot:e.children!=null,slotNames:v(e),props:y(e),ref:p(e)}),u.push(t)},onMountEnd(e){let t=c.get(e);if(t==null)return;let n=l.get(t);if(n&&(n.debugName=_(e),n.hasDefaultSlot=e.children!=null,n.slotNames=v(e),n.props=y(e)),u[u.length-1]===t){u.pop();return}let r=u.lastIndexOf(t);r>=0&&u.splice(r,1)},onUnmount(e){let t=c.get(e);if(t==null)return;S(t);let n=u.lastIndexOf(t);n>=0&&u.splice(n,1)}}),L({position:f}),r.refreshId=setInterval(()=>{r.panel?.style.display===`block`&&F()},o),n.initiallyOpen&&r.panel&&(r.panel.style.display=`block`,I(),F(!0));let g=()=>R();return r.dispose=g,{disable:g}}exports._listSignals=g,exports.disableDevTools=R,exports.enableDevTools=z;
59
+ //# sourceMappingURL=devtools.cjs.map