@thyn/core 0.0.343 → 0.0.346
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/.github/workflows/static.yml +48 -0
- package/.github/workflows/test.yml +39 -0
- package/LICENSE +21 -0
- package/README.md +50 -0
- package/dist/{element.js → core/element.js} +14 -36
- package/dist/core/index.d.ts +1 -0
- package/dist/core/index.js +1 -0
- package/dist/index.d.ts +5 -2
- package/dist/index.js +5 -2
- package/dist/plugin/html-parser.d.ts +31 -0
- package/dist/plugin/html-parser.js +275 -0
- package/dist/plugin/index.d.ts +24 -0
- package/dist/plugin/index.js +1009 -0
- package/dist/plugin/utils.d.ts +12 -0
- package/dist/plugin/utils.js +194 -0
- package/docs/CNAME +1 -0
- package/docs/index.html +18 -0
- package/docs/package-lock.json +980 -0
- package/docs/package.json +15 -0
- package/docs/public/thyn.png +0 -0
- package/docs/public/thyn.svg +1 -0
- package/docs/src/App.thyn +10 -0
- package/docs/src/components/Button.thyn +3 -0
- package/docs/src/docs/GettingStarted.thyn +8 -0
- package/docs/src/main.css +17 -0
- package/docs/src/main.js +5 -0
- package/docs/src/pages/Home.thyn +147 -0
- package/docs/vite.config.js +7 -0
- package/package.json +18 -10
- package/src/{element.ts → core/element.ts} +14 -34
- package/src/core/index.ts +1 -0
- package/src/{signals.ts → core/signals.ts} +1 -1
- package/src/index.ts +5 -15
- package/src/plugin/html-parser.ts +332 -0
- package/src/plugin/index.ts +1127 -0
- package/src/plugin/utils.ts +213 -0
- package/tests/Bind.test.ts +14 -0
- package/tests/Bind.thyn +7 -0
- package/tests/ConsecInterps.test.ts +9 -0
- package/tests/ConsecInterps.thyn +9 -0
- package/tests/Counter.test.ts +12 -0
- package/tests/Counter.thyn +7 -0
- package/tests/DoubleQuotes.test.ts +9 -0
- package/tests/DoubleQuotes.thyn +3 -0
- package/tests/Escape.test.ts +9 -0
- package/tests/Escape.thyn +3 -0
- package/tests/EscapeDollar.test.ts +9 -0
- package/tests/EscapeDollar.thyn +5 -0
- package/tests/EventPipes.test.ts +13 -0
- package/tests/EventPipes.thyn +11 -0
- package/tests/List.test.ts +21 -0
- package/tests/List.thyn +15 -0
- package/tests/ListV2.test.ts +20 -0
- package/tests/ListV2.thyn +16 -0
- package/tests/MixElemAndText.test.ts +9 -0
- package/tests/MixElemAndText.thyn +12 -0
- package/tests/Show.test.ts +13 -0
- package/tests/Show.thyn +8 -0
- package/tests/Template.test.ts +9 -0
- package/tests/Template.thyn +8 -0
- package/tests/list/comprehensive.test.ts +659 -0
- package/tests/list/operations/ChildrenAppend.thyn +11 -0
- package/tests/list/operations/ChildrenFilter.thyn +11 -0
- package/tests/list/operations/ChildrenInsert.thyn +11 -0
- package/tests/list/operations/ChildrenNoneToSome.thyn +11 -0
- package/tests/list/operations/ChildrenPrepend.thyn +11 -0
- package/tests/list/operations/ChildrenRemove.thyn +11 -0
- package/tests/list/operations/ChildrenReplaceAll.thyn +11 -0
- package/tests/list/operations/ChildrenSomeToNone.thyn +11 -0
- package/tests/list/operations/ChildrenSort.thyn +11 -0
- package/tests/list/operations/IsolatedAppend.thyn +10 -0
- package/tests/list/operations/IsolatedFilter.thyn +16 -0
- package/tests/list/operations/IsolatedInsert.thyn +10 -0
- package/tests/list/operations/IsolatedMove.thyn +16 -0
- package/tests/list/operations/IsolatedNoneToSome.thyn +16 -0
- package/tests/list/operations/IsolatedPrepend.thyn +10 -0
- package/tests/list/operations/IsolatedRemove.thyn +17 -0
- package/tests/list/operations/IsolatedReplaceAll.thyn +10 -0
- package/tests/list/operations/IsolatedSomeToNone.thyn +10 -0
- package/tests/list/operations/IsolatedSort.thyn +16 -0
- package/tests/list/operations/TerminalAppend.thyn +12 -0
- package/tests/list/operations/TerminalFilter.thyn +12 -0
- package/tests/list/operations/TerminalInsert.thyn +12 -0
- package/tests/list/operations/TerminalNoneToSome.thyn +12 -0
- package/tests/list/operations/TerminalPrepend.thyn +12 -0
- package/tests/list/operations/TerminalRemove.thyn +12 -0
- package/tests/list/operations/TerminalReplaceAll.thyn +12 -0
- package/tests/list/operations/TerminalSomeToNone.thyn +12 -0
- package/tests/list/operations/TerminalSort.thyn +12 -0
- package/tests/tsconfig.json +14 -0
- package/tsconfig.json +11 -6
- package/types/thyn.d.ts +4 -0
- package/vitest.config.ts +7 -2
- package/tests/fx.test.ts +0 -31
- package/tests/lists.test.ts +0 -184
- package/tests/router.test.ts +0 -69
- package/tests/show.test.ts +0 -66
- package/tests/utils.ts +0 -3
- package/tsconfig.tsbuildinfo +0 -1
- /package/dist/{element.d.ts → core/element.d.ts} +0 -0
- /package/dist/{router.d.ts → core/router.d.ts} +0 -0
- /package/dist/{router.js → core/router.js} +0 -0
- /package/dist/{signals.d.ts → core/signals.d.ts} +0 -0
- /package/dist/{signals.js → core/signals.js} +0 -0
- /package/src/{router.ts → core/router.ts} +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,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
|
+
}
|
package/docs/src/main.js
ADDED
|
@@ -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
|
+
<script>
|
|
35
|
+
const count = $signal(0);
|
|
36
|
+
</script>
|
|
37
|
+
|
|
38
|
+
<button onclick={() => count(c => c + 1)}>
|
|
39
|
+
Count: \{{ count() \}}
|
|
40
|
+
</button>
|
|
41
|
+
|
|
42
|
+
<style>
|
|
43
|
+
button {
|
|
44
|
+
background: #333;
|
|
45
|
+
}
|
|
46
|
+
</style>
|
|
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(()=>{for(const n of r)f(n);r.length=0,s=!1}))}function p(t){const n=new Set;return(...e)=>{if(!e.length)return u&&(n.add(u),u.deps.add(n)),t;const o=e[0],i=typeof o=="function"?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&&(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("button"),c.className="thyn-0";const t=document.createTextNode("");return c.appendChild(t),c}return c.cloneNode(!0)}function N(t){const n=p(0),e=m();return e.onclick=()=>n(o=>o+1),_(()=>{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>
|
package/package.json
CHANGED
|
@@ -1,28 +1,36 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@thyn/core",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.346",
|
|
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
|
-
"
|
|
31
|
+
"happy-dom": "^20.6.1",
|
|
24
32
|
"typescript": "^5.9.3",
|
|
25
33
|
"vite": "^7.3.1",
|
|
26
|
-
"vitest": "^4.0.
|
|
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 =
|
|
324
|
-
const e = childNodes[offset +
|
|
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
|
-
|
|
389
|
-
|
|
390
|
-
|
|
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),
|
|
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
|
-
|
|
575
|
-
|
|
576
|
-
|
|
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";
|
package/src/index.ts
CHANGED
|
@@ -1,15 +1,5 @@
|
|
|
1
|
-
export
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
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";
|