@thyn/core 0.0.344 → 0.0.347

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 (105) hide show
  1. package/.github/workflows/static.yml +48 -0
  2. package/.github/workflows/test.yml +39 -0
  3. package/LICENSE +21 -0
  4. package/README.md +50 -0
  5. package/dist/{element.js → core/element.js} +14 -36
  6. package/dist/core/index.d.ts +1 -0
  7. package/dist/core/index.js +1 -0
  8. package/dist/{router.d.ts → core/router.d.ts} +1 -1
  9. package/dist/{router.js → core/router.js} +22 -5
  10. package/dist/index.d.ts +5 -2
  11. package/dist/index.js +5 -2
  12. package/dist/plugin/html-parser.d.ts +31 -0
  13. package/dist/plugin/html-parser.js +275 -0
  14. package/dist/plugin/index.d.ts +24 -0
  15. package/dist/plugin/index.js +1009 -0
  16. package/dist/plugin/utils.d.ts +12 -0
  17. package/dist/plugin/utils.js +194 -0
  18. package/docs/CNAME +1 -0
  19. package/docs/index.html +18 -0
  20. package/docs/package-lock.json +980 -0
  21. package/docs/package.json +15 -0
  22. package/docs/public/thyn.png +0 -0
  23. package/docs/public/thyn.svg +1 -0
  24. package/docs/src/App.thyn +10 -0
  25. package/docs/src/components/Button.thyn +3 -0
  26. package/docs/src/docs/GettingStarted.thyn +8 -0
  27. package/docs/src/main.css +17 -0
  28. package/docs/src/main.js +5 -0
  29. package/docs/src/pages/Home.thyn +147 -0
  30. package/docs/vite.config.js +7 -0
  31. package/package.json +18 -10
  32. package/src/{element.ts → core/element.ts} +14 -34
  33. package/src/core/index.ts +1 -0
  34. package/src/{router.ts → core/router.ts} +22 -6
  35. package/src/{signals.ts → core/signals.ts} +1 -1
  36. package/src/index.ts +5 -15
  37. package/src/plugin/html-parser.ts +332 -0
  38. package/src/plugin/index.ts +1127 -0
  39. package/src/plugin/utils.ts +213 -0
  40. package/tests/Bind.test.ts +14 -0
  41. package/tests/Bind.thyn +7 -0
  42. package/tests/ConsecInterps.test.ts +9 -0
  43. package/tests/ConsecInterps.thyn +9 -0
  44. package/tests/Counter.test.ts +12 -0
  45. package/tests/Counter.thyn +7 -0
  46. package/tests/DoubleQuotes.test.ts +9 -0
  47. package/tests/DoubleQuotes.thyn +3 -0
  48. package/tests/Escape.test.ts +9 -0
  49. package/tests/Escape.thyn +3 -0
  50. package/tests/EscapeDollar.test.ts +9 -0
  51. package/tests/EscapeDollar.thyn +5 -0
  52. package/tests/EventPipes.test.ts +13 -0
  53. package/tests/EventPipes.thyn +11 -0
  54. package/tests/List.test.ts +21 -0
  55. package/tests/List.thyn +15 -0
  56. package/tests/ListV2.test.ts +20 -0
  57. package/tests/ListV2.thyn +16 -0
  58. package/tests/MixElemAndText.test.ts +9 -0
  59. package/tests/MixElemAndText.thyn +12 -0
  60. package/tests/Show.test.ts +13 -0
  61. package/tests/Show.thyn +8 -0
  62. package/tests/Template.test.ts +9 -0
  63. package/tests/Template.thyn +8 -0
  64. package/tests/list/comprehensive.test.ts +659 -0
  65. package/tests/list/operations/ChildrenAppend.thyn +11 -0
  66. package/tests/list/operations/ChildrenFilter.thyn +11 -0
  67. package/tests/list/operations/ChildrenInsert.thyn +11 -0
  68. package/tests/list/operations/ChildrenNoneToSome.thyn +11 -0
  69. package/tests/list/operations/ChildrenPrepend.thyn +11 -0
  70. package/tests/list/operations/ChildrenRemove.thyn +11 -0
  71. package/tests/list/operations/ChildrenReplaceAll.thyn +11 -0
  72. package/tests/list/operations/ChildrenSomeToNone.thyn +11 -0
  73. package/tests/list/operations/ChildrenSort.thyn +11 -0
  74. package/tests/list/operations/IsolatedAppend.thyn +10 -0
  75. package/tests/list/operations/IsolatedFilter.thyn +16 -0
  76. package/tests/list/operations/IsolatedInsert.thyn +10 -0
  77. package/tests/list/operations/IsolatedMove.thyn +16 -0
  78. package/tests/list/operations/IsolatedNoneToSome.thyn +16 -0
  79. package/tests/list/operations/IsolatedPrepend.thyn +10 -0
  80. package/tests/list/operations/IsolatedRemove.thyn +17 -0
  81. package/tests/list/operations/IsolatedReplaceAll.thyn +10 -0
  82. package/tests/list/operations/IsolatedSomeToNone.thyn +10 -0
  83. package/tests/list/operations/IsolatedSort.thyn +16 -0
  84. package/tests/list/operations/TerminalAppend.thyn +12 -0
  85. package/tests/list/operations/TerminalFilter.thyn +12 -0
  86. package/tests/list/operations/TerminalInsert.thyn +12 -0
  87. package/tests/list/operations/TerminalNoneToSome.thyn +12 -0
  88. package/tests/list/operations/TerminalPrepend.thyn +12 -0
  89. package/tests/list/operations/TerminalRemove.thyn +12 -0
  90. package/tests/list/operations/TerminalReplaceAll.thyn +12 -0
  91. package/tests/list/operations/TerminalSomeToNone.thyn +12 -0
  92. package/tests/list/operations/TerminalSort.thyn +12 -0
  93. package/tests/tsconfig.json +14 -0
  94. package/tsconfig.json +11 -6
  95. package/types/thyn.d.ts +4 -0
  96. package/vitest.config.ts +7 -2
  97. package/tests/fx.test.ts +0 -31
  98. package/tests/lists.test.ts +0 -184
  99. package/tests/router.test.ts +0 -69
  100. package/tests/show.test.ts +0 -66
  101. package/tests/utils.ts +0 -3
  102. package/tsconfig.tsbuildinfo +0 -1
  103. /package/dist/{element.d.ts → core/element.d.ts} +0 -0
  104. /package/dist/{signals.d.ts → core/signals.d.ts} +0 -0
  105. /package/dist/{signals.js → core/signals.js} +0 -0
@@ -0,0 +1,15 @@
1
+ {
2
+ "name": "thyn-app",
3
+ "private": true,
4
+ "version": "0.0.0",
5
+ "type": "module",
6
+ "scripts": {
7
+ "dev": "vite",
8
+ "build": "vite build",
9
+ "preview": "vite preview"
10
+ },
11
+ "devDependencies": {
12
+ "@thyn/core": "^0.0.345",
13
+ "vite": "^6.3.5"
14
+ }
15
+ }
Binary file
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" height="1024px" viewBox="120 -840 720 720" width="1024px" fill="#58c4dc"><path d="m338.77-480 65.92-65.92q8.92-8.93 9.12-20.89.19-11.96-9.12-21.27-9.31-9.3-21.38-9.3-12.08 0-21.39 9.3l-82.77 82.77q-5.61 5.62-7.92 11.85-2.31 6.23-2.31 13.46t2.31 13.46q2.31 6.23 7.92 11.85l83.16 83.15q8.92 8.92 21.19 9.12 12.27.19 21.58-9.12 9.3-9.31 9.3-21.08 0-11.76-9.3-21.07L338.77-480Zm282.46 0-66.31 66.31q-8.92 8.92-9.11 20.88-.19 11.96 9.11 21.27 9.31 9.31 21.39 9.31 12.07 0 21.38-9.31l83.16-83.15q5.61-5.62 7.92-11.85 2.31-6.23 2.31-13.46t-2.31-13.46q-2.31-6.23-7.92-11.85l-83.16-83.15q-4.46-4.46-10.04-6.69-5.57-2.23-11.15-2.23t-11.35 2.23q-5.76 2.23-10.23 6.69-9.3 9.31-9.3 21.08 0 11.76 9.3 21.07L621.23-480ZM212.31-140Q182-140 161-161q-21-21-21-51.31v-535.38Q140-778 161-799q21-21 51.31-21h535.38Q778-820 799-799q21 21 21 51.31v535.38Q820-182 799-161q-21 21-51.31 21H212.31Zm0-60h535.38q4.62 0 8.46-3.85 3.85-3.84 3.85-8.46v-535.38q0-4.62-3.85-8.46-3.84-3.85-8.46-3.85H212.31q-4.62 0-8.46 3.85-3.85 3.84-3.85 8.46v535.38q0 4.62 3.85 8.46 3.84 3.85 8.46 3.85ZM200-760v560-560Z"/></svg>
@@ -0,0 +1,10 @@
1
+ <script>
2
+ import { Router } from "@thyn/core/router";
3
+ import Home from "./pages/Home.thyn";
4
+ import GettingStarted from "./docs/GettingStarted.thyn";
5
+ </script>
6
+
7
+ <Router routes={[
8
+ { path: "/", component: Home },
9
+ { path: "/docs/getting-started", component: GettingStarted },
10
+ ]} />
@@ -0,0 +1,3 @@
1
+ <button onclick={$props.onclick}>
2
+ <slot />
3
+ </button>
@@ -0,0 +1,8 @@
1
+ <script>
2
+ import { Link } from "@thyn/core/router";
3
+ </script>
4
+
5
+ <main>
6
+ Getting Started
7
+ <Link to="/">Home</Link>
8
+ </main>
@@ -0,0 +1,17 @@
1
+ html,
2
+ body {
3
+ height: 100%;
4
+ text-align: center;
5
+ position: relative;
6
+ margin: 0;
7
+ background: #24272f;
8
+ color: #fff;
9
+ font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", Arial, sans-serif;
10
+ -webkit-font-smoothing: antialiased;
11
+ -moz-osx-font-smoothing: grayscale;
12
+ }
13
+
14
+ * {
15
+ box-sizing: border-box;
16
+ font-weight: 200;
17
+ }
@@ -0,0 +1,5 @@
1
+ import { mount } from "@thyn/core";
2
+ import "./main.css";
3
+ import App from "./App.thyn";
4
+
5
+ mount(App, document.body);
@@ -0,0 +1,147 @@
1
+ <script>
2
+ import Button from "../components/Button.thyn";
3
+ const count = $signal(0);
4
+
5
+ const taglines = [
6
+ "The healthy choice for your codebase.",
7
+ "Thyn is in. Bloat is out.",
8
+ "So thyn, it barely exists.",
9
+ ];
10
+
11
+ const tagline = $signal(0);
12
+ $effect(() => {
13
+ const interval = setInterval(() => tagline(t => t + 1), 5000);
14
+ return () => clearInterval(interval);
15
+ });
16
+
17
+ setTimeout(() => {
18
+ Prism.highlightAll();
19
+ });
20
+ </script>
21
+
22
+ <div class="main">
23
+ <h1>
24
+ <img src="/thyn.svg" />
25
+ thyn
26
+ </h1>
27
+ <p class="tagline">{{ taglines[tagline() % taglines.length] }}</p>
28
+ <div class="compiled-wrapper">
29
+ <div>
30
+ <h4>source</h4>
31
+ <pre>
32
+ <code class="code language-javascript">
33
+ // App.thyn
34
+ &lt;script&gt;
35
+ const count = $signal(0);
36
+ &lt;/script&gt;
37
+
38
+ &lt;button onclick={() =&gt; count(c =&gt; c + 1)}&gt;
39
+ Count: \{{ count() \}}
40
+ &lt;/button&gt;
41
+
42
+ &lt;style&gt;
43
+ button {
44
+ background: #333;
45
+ }
46
+ &lt;/style&gt;
47
+
48
+ // main.js
49
+ import { mount } from '@thyn/core';
50
+ import App from './App.thyn';
51
+
52
+ mount(App, document.body);
53
+ </code>
54
+ </pre>
55
+ </div>
56
+ <div>
57
+ <h4>compiled</h4>
58
+ <pre>
59
+ <code class="compiled language-javascript">
60
+ let u,s;const r=[];function l(t){r.push(t),s||(s=!0,queueMicrotask(()=&gt;{for(const n of r)f(n);r.length=0,s=!1}))}function p(t){const n=new Set;return(...e)=&gt;{if(!e.length)return u&amp;&amp;(n.add(u),u.deps.add(n)),t;const o=e[0],i=typeof o==&quot;function&quot;?o(t):o;if(i!==t){t=i;for(const d of n)l(d)}}}function f(t,n){n||a(t);const e=u;u=t;const o=t.run();o&amp;&amp;(t.td?t.td.push(o):t.td=[o]),u=e}function _(t,n){const e={run:t,deps:new Set,show:n};return f(e,!0),e}function a(t){const{deps:n,td:e}=t;if(n.size){for(const o of n)o.delete(t);n.clear()}if(e){for(const o of e)o();t.td=null}}function h(t,n){n.appendChild(t())}let c;function m(){if(!c){c=document.createElement(&quot;button&quot;),c.className=&quot;thyn-0&quot;;const t=document.createTextNode(&quot;&quot;);return c.appendChild(t),c}return c.cloneNode(!0)}function N(t){const n=p(0),e=m();return e.onclick=()=&gt;n(o=&gt;o+1),_(()=&gt;{e.firstChild.nodeValue=`Count: ${n()}`}),e}h(N,document.body);
61
+ </code>
62
+ </pre>
63
+ </div>
64
+ </div>
65
+ <a href="https://github.com/thynjs/thyn">GitHub</a>
66
+ </div>
67
+
68
+ <style>
69
+ .main {
70
+ width: 100%;
71
+ margin: auto;
72
+ max-width: 1200px;
73
+ padding-top: 5%;
74
+ }
75
+
76
+ h1 {
77
+ font-size: 48px;
78
+ letter-spacing: 2px;
79
+ display: flex;
80
+ align-items: center;
81
+ justify-content: center;
82
+ gap: 12px;
83
+ }
84
+
85
+ h1 img {
86
+ width: 50px;
87
+ position: relative;
88
+ top: 2px;
89
+ }
90
+
91
+ h4 {
92
+ margin: 0;
93
+ }
94
+
95
+ .compiled-wrapper {
96
+ display: flex;
97
+ gap: 20px;
98
+ flex-direction: column;
99
+ }
100
+
101
+ @media (min-width:800px) {
102
+ .compiled-wrapper {
103
+ flex-direction: row;
104
+ }
105
+ }
106
+
107
+ .compiled-wrapper>* {
108
+ flex-grow: 1;
109
+ flex-basis: 1px;
110
+ display: flex;
111
+ gap: 10px;
112
+ flex-direction: column;
113
+ }
114
+
115
+ pre {
116
+ flex-grow: 1;
117
+ width: 100%;
118
+ max-width: calc(100vw - 40px);
119
+ font-size: 14px !important;
120
+ margin: auto !important;
121
+ text-align: left;
122
+ padding: 10px 20px !important;
123
+ border-radius: 10px;
124
+ margin-bottom: 20px !important;
125
+ background: rgba(0, 0, 0, 0.25) !important;
126
+ }
127
+
128
+ code {
129
+ word-break: break-all !important;
130
+ white-space: pre-wrap !important;
131
+ line-height: 1.25 !important;
132
+ }
133
+
134
+ .code {
135
+ font-size: 12px !important;
136
+ }
137
+
138
+ .compiled {
139
+ font-size: 12px !important;
140
+ }
141
+
142
+ a {
143
+ color: #fff;
144
+ margin: 20px 0;
145
+ display: inline-block;
146
+ }
147
+ </style>
@@ -0,0 +1,7 @@
1
+ import thyn from "@thyn/core";
2
+ import { defineConfig } from "vite";
3
+
4
+ export default defineConfig({
5
+ plugins: [thyn()],
6
+ build: { modulePreload: false },
7
+ });
package/package.json CHANGED
@@ -1,28 +1,36 @@
1
1
  {
2
2
  "name": "@thyn/core",
3
- "version": "0.0.344",
3
+ "version": "0.0.347",
4
+ "type": "module",
5
+ "main": "dist/index.js",
6
+ "exports": {
7
+ ".": "./dist/index.js",
8
+ "./router": "./dist/router.js"
9
+ },
10
+ "sideEffects": false,
4
11
  "scripts": {
5
12
  "build": "tsc",
6
13
  "pub": "tsc && npm version patch -f && npm -f publish --access=public",
7
14
  "test": "vitest"
8
15
  },
9
- "type": "module",
10
- "main": "dist/index.js",
11
16
  "repository": {
12
17
  "type": "git",
13
18
  "url": "git+https://github.com/thynjs/thyn.git"
14
19
  },
15
- "exports": {
16
- ".": "./dist/index.js",
17
- "./router": "./dist/router.js"
18
- },
19
- "sideEffects": false,
20
20
  "author": "harmtrav@gmail.com",
21
21
  "license": "MIT",
22
+ "dependencies": {
23
+ "acorn": "^8.15.0",
24
+ "acorn-walk": "^8.3.4",
25
+ "esbuild": "^0.27.2",
26
+ "magic-string": "^0.30.21",
27
+ "postcss": "^8.5.6",
28
+ "postcss-selector-parser": "^7.1.1"
29
+ },
22
30
  "devDependencies": {
23
- "jsdom": "^27.4.0",
31
+ "happy-dom": "^20.6.1",
24
32
  "typescript": "^5.9.3",
25
33
  "vite": "^7.3.1",
26
- "vitest": "^4.0.16"
34
+ "vitest": "^4.0.18"
27
35
  }
28
36
  }
@@ -320,8 +320,8 @@ export function list(props, terminal = false) {
320
320
  }
321
321
 
322
322
  if (start < 0) {
323
- for (let i = nextItems.length; i < oldLength; i++) {
324
- const e = childNodes[offset + --oldLength];
323
+ for (let i = oldLength - 1; i >= nextItems.length; i--) {
324
+ const e = childNodes[offset + i];
325
325
  teardownNode(e);
326
326
  remove(e);
327
327
  }
@@ -352,7 +352,7 @@ export function list(props, terminal = false) {
352
352
  for (const e of removalQueue) {
353
353
  remove(e);
354
354
  }
355
- if (oldLength - start === removalQueue.length) {
355
+ if (oldLength - start === removalQueue.length && newLength === oldLength) {
356
356
  prevItems = nextItems;
357
357
  nextItems = null;
358
358
  return;
@@ -364,10 +364,7 @@ export function list(props, terminal = false) {
364
364
  (!nextItems[i] ||
365
365
  prevItems[i] !== nextItems[i])
366
366
  ) {
367
- keyMap.set(prevItems[i], {
368
- el: childNodes[i + offset],
369
- item: prevItems[i],
370
- });
367
+ keyMap.set(prevItems[i], childNodes[i + offset]);
371
368
  }
372
369
  }
373
370
  while (start <= newLength) {
@@ -378,20 +375,17 @@ export function list(props, terminal = false) {
378
375
  continue;
379
376
  }
380
377
  if (oldChd === undefined) {
381
- parent.insertBefore(render(newChd), endBookend);
378
+ parent.insertBefore(render(newChd), childNodeList[start + offset] ?? endBookend);
382
379
  start++;
383
380
  continue;
384
381
  }
385
382
  const mappedOld = keyMap.get(newChd);
386
383
  if (mappedOld) {
387
384
  const oldDom = childNodeList[start + offset];
388
- const { el, item } = mappedOld;
389
- if (oldDom !== el) {
390
- const tmp = el.nextSibling;
391
- parent.insertBefore(el, oldDom);
385
+ if (oldDom !== mappedOld) {
386
+ const tmp = mappedOld.nextSibling;
387
+ parent.insertBefore(mappedOld, oldDom);
392
388
  parent.insertBefore(oldDom, tmp);
393
- } else if (item !== newChd) {
394
- replaceWith(newChd, el, render);
395
389
  }
396
390
  keyMap.delete(newChd);
397
391
  } else if (oldChd !== newChd) {
@@ -399,10 +393,6 @@ export function list(props, terminal = false) {
399
393
  }
400
394
  start++;
401
395
  }
402
- for (const { el } of keyMap.values()) {
403
- teardownNode(el);
404
- remove(el);
405
- }
406
396
  keyMap = null;
407
397
  prevItems = nextItems;
408
398
  nextItems = null;
@@ -537,7 +527,7 @@ export function isolatedTerminalList(props) {
537
527
  ch.remove();
538
528
  childNodes[i] = null;
539
529
  }
540
- if (oldLength - start === removalQueueIndices.length) {
530
+ if (oldLength - start === removalQueueIndices.length && newLength === oldLength) {
541
531
  prevItems = nextItems;
542
532
  nextItems = null;
543
533
  childNodes = null;
@@ -550,10 +540,7 @@ export function isolatedTerminalList(props) {
550
540
  (!nextItems[i] ||
551
541
  prevItems[i] !== nextItems[i])
552
542
  ) {
553
- keyMap.set(prevItems[i], {
554
- el: childNodes[i + 1],
555
- item: prevItems[i],
556
- });
543
+ keyMap.set(prevItems[i], childNodes[i + 1]);
557
544
  }
558
545
  }
559
546
  while (start <= newLength) {
@@ -564,22 +551,19 @@ export function isolatedTerminalList(props) {
564
551
  continue;
565
552
  }
566
553
  if (oldChd === undefined) {
567
- parent.insertBefore(render(newChd), endBookend);
554
+ parent.insertBefore(render(newChd), childNodeList[start + 1]);
568
555
  start++;
569
556
  continue;
570
557
  }
571
558
  const mappedOld = keyMap.get(newChd);
572
559
  if (mappedOld) {
573
560
  const oldDom = childNodeList[start + 1];
574
- const { el, item } = mappedOld;
575
- if (oldDom !== el) {
576
- const tmp = el.nextSibling;
577
- parent.insertBefore(el, oldDom);
561
+ if (oldDom !== mappedOld) {
562
+ const tmp = mappedOld.nextSibling;
563
+ parent.insertBefore(mappedOld, oldDom);
578
564
  if (oldDom !== tmp) {
579
565
  parent.insertBefore(oldDom, tmp);
580
566
  }
581
- } else if (item !== newChd) {
582
- replaceWith(newChd, el, render);
583
567
  }
584
568
  keyMap.delete(newChd);
585
569
  } else if (oldChd !== newChd) {
@@ -587,10 +571,6 @@ export function isolatedTerminalList(props) {
587
571
  }
588
572
  start++;
589
573
  }
590
- for (const { el } of keyMap.values()) {
591
- shallowTeardown(el);
592
- el.remove();
593
- }
594
574
  keyMap = null;
595
575
  prevItems = nextItems;
596
576
  nextItems = null;
@@ -0,0 +1 @@
1
+ export * from "./router.js";
@@ -1,20 +1,35 @@
1
1
  import { component, show } from "./element.js";
2
2
  import { $signal, staticEffect } from "./signals.js";
3
3
 
4
- const params = $signal({} as any);
4
+ let params = null;
5
+ let routerPath = null;
6
+ let initialized = false;
7
+
8
+ function initRouter() {
9
+ if (initialized) return;
10
+ params = $signal({} as any);
11
+ routerPath = $signal(location.pathname);
12
+ initialized = true;
13
+ }
5
14
 
6
15
  export const router = {
7
- path: $signal(location.pathname),
8
- param: (name: string): string | undefined => params()[name],
16
+ get path() {
17
+ initRouter();
18
+ return routerPath;
19
+ },
20
+ param: (name: string): string | undefined => {
21
+ initRouter();
22
+ return params()[name];
23
+ },
9
24
  };
10
25
 
11
-
12
26
  interface Route {
13
27
  path: string;
14
28
  component: () => Node;
15
29
  }
16
30
 
17
31
  export function Router({ routes }: { routes: Route[] }) {
32
+ initRouter();
18
33
  const current = $signal(null);
19
34
  const compiledRoutes = routes.map(route => {
20
35
  const compiledRoute = {
@@ -31,7 +46,7 @@ export function Router({ routes }: { routes: Route[] }) {
31
46
  });
32
47
 
33
48
  staticEffect(() => {
34
- const pn = router.path();
49
+ const pn = routerPath();
35
50
  if (pn !== location.pathname) {
36
51
  history.pushState({}, "", pn);
37
52
  }
@@ -61,6 +76,7 @@ export function Router({ routes }: { routes: Route[] }) {
61
76
  }
62
77
 
63
78
  export function Link({ slot, to }) {
79
+ initRouter();
64
80
  const a = document.createElement("a");
65
81
  a.href = to;
66
82
  for (const ch of slot) {
@@ -74,7 +90,7 @@ export function Link({ slot, to }) {
74
90
  ) {
75
91
  e.preventDefault();
76
92
  history.pushState({}, "", to);
77
- router.path(to);
93
+ routerPath(to);
78
94
  }
79
95
  };
80
96
  return a;
@@ -120,4 +120,4 @@ export function cleanup(ef) {
120
120
  } else {
121
121
  for (const f of td) typeof f === "function" ? f() : f.delete(ef);
122
122
  }
123
- }
123
+ }
package/src/index.ts CHANGED
@@ -1,15 +1,5 @@
1
- export {
2
- addChildren,
3
- addEffect,
4
- component, createReactiveTextNode, fixedComponent, isolatedTerminalList, list,
5
- markAsReactive,
6
- mount,
7
- setAttribute,
8
- setProperty,
9
- setReactiveAttribute,
10
- setReactiveProperty,
11
- show,
12
- terminalList
13
- } from "./element.js";
14
- export { $effect, $signal, staticEffect } from "./signals.js";
15
-
1
+ export * from "./core/signals.js";
2
+ export * from "./core/element.js";
3
+ export * from "./core/router.js";
4
+ export { default } from "./plugin/index.js";
5
+ export { transformSFC, compileSFC } from "./plugin/index.js";