@ketvietlab/ketjs-view 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +18 -0
- package/dist/host.d.ts +45 -0
- package/dist/host.d.ts.map +1 -0
- package/dist/host.js +177 -0
- package/dist/host.js.map +1 -0
- package/dist/index.d.ts +14 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +7 -0
- package/dist/index.js.map +1 -0
- package/dist/island.d.ts +74 -0
- package/dist/island.d.ts.map +1 -0
- package/dist/island.js +278 -0
- package/dist/island.js.map +1 -0
- package/dist/jsx-dev-runtime.d.ts +3 -0
- package/dist/jsx-dev-runtime.d.ts.map +1 -0
- package/dist/jsx-dev-runtime.js +2 -0
- package/dist/jsx-dev-runtime.js.map +1 -0
- package/dist/jsx-runtime.d.ts +46 -0
- package/dist/jsx-runtime.d.ts.map +1 -0
- package/dist/jsx-runtime.js +117 -0
- package/dist/jsx-runtime.js.map +1 -0
- package/dist/mount.d.ts +13 -0
- package/dist/mount.d.ts.map +1 -0
- package/dist/mount.js +44 -0
- package/dist/mount.js.map +1 -0
- package/dist/render.d.ts +39 -0
- package/dist/render.d.ts.map +1 -0
- package/dist/render.js +536 -0
- package/dist/render.js.map +1 -0
- package/dist/signal.d.ts +18 -0
- package/dist/signal.d.ts.map +1 -0
- package/dist/signal.js +132 -0
- package/dist/signal.js.map +1 -0
- package/dist/ssr.d.ts +30 -0
- package/dist/ssr.d.ts.map +1 -0
- package/dist/ssr.js +145 -0
- package/dist/ssr.js.map +1 -0
- package/dist/template.d.ts +27 -0
- package/dist/template.d.ts.map +1 -0
- package/dist/template.js +129 -0
- package/dist/template.js.map +1 -0
- package/package.json +54 -0
package/dist/render.js
ADDED
|
@@ -0,0 +1,536 @@
|
|
|
1
|
+
// Surgical rendering: no virtual DOM, no whole-tree diff. A first render walks the
|
|
2
|
+
// parsed static structure once to build nodes; every later update writes only to
|
|
3
|
+
// the holes whose value actually changed.
|
|
4
|
+
import { templateFor } from './template.js';
|
|
5
|
+
import { HOLE_MARKER, HOLE_OPEN, HydrationMismatch, isMarkup } from './ssr.js';
|
|
6
|
+
const RESULT = Symbol('ket.result');
|
|
7
|
+
const EACH = Symbol('ket.each');
|
|
8
|
+
export function html(strings, ...values) {
|
|
9
|
+
return { [RESULT]: true, strings, values };
|
|
10
|
+
}
|
|
11
|
+
export const isResult = (v) => !!v?.[RESULT];
|
|
12
|
+
export function each(items, keyOf, render) {
|
|
13
|
+
return {
|
|
14
|
+
[EACH]: true,
|
|
15
|
+
items: [...items],
|
|
16
|
+
keyOf: keyOf,
|
|
17
|
+
render: render,
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
export const isEach = (v) => !!v?.[EACH];
|
|
21
|
+
export function when(cond, render, otherwise) {
|
|
22
|
+
return cond ? render() : otherwise ? otherwise() : '';
|
|
23
|
+
}
|
|
24
|
+
export const EVENT_PREFIX = 'on:';
|
|
25
|
+
const isEventAttr = (name) => name.startsWith(EVENT_PREFIX);
|
|
26
|
+
function bindEvent(host, node, name, initial) {
|
|
27
|
+
const box = {
|
|
28
|
+
fn: typeof initial === 'function' ? initial : null,
|
|
29
|
+
};
|
|
30
|
+
const detach = host.listen(node, name.slice(EVENT_PREFIX.length), (e) => box.fn?.(e));
|
|
31
|
+
return { event: true, detach, box };
|
|
32
|
+
}
|
|
33
|
+
class Part {
|
|
34
|
+
attr = false;
|
|
35
|
+
host;
|
|
36
|
+
parent;
|
|
37
|
+
anchor;
|
|
38
|
+
kind = null;
|
|
39
|
+
node = null;
|
|
40
|
+
child = null;
|
|
41
|
+
keyed = null;
|
|
42
|
+
keys = [];
|
|
43
|
+
markupNodes = [];
|
|
44
|
+
markupHtml = '';
|
|
45
|
+
constructor(host, parent, anchor) {
|
|
46
|
+
this.host = host;
|
|
47
|
+
this.parent = parent;
|
|
48
|
+
this.anchor = anchor;
|
|
49
|
+
}
|
|
50
|
+
clear() {
|
|
51
|
+
if (this.node) {
|
|
52
|
+
this.host.remove(this.node);
|
|
53
|
+
this.node = null;
|
|
54
|
+
}
|
|
55
|
+
if (this.child) {
|
|
56
|
+
this.child.remove();
|
|
57
|
+
this.child = null;
|
|
58
|
+
}
|
|
59
|
+
if (this.keyed) {
|
|
60
|
+
for (const inst of this.keyed.values())
|
|
61
|
+
inst.remove();
|
|
62
|
+
this.keyed = null;
|
|
63
|
+
this.keys = [];
|
|
64
|
+
}
|
|
65
|
+
for (const node of this.markupNodes)
|
|
66
|
+
this.host.remove(node);
|
|
67
|
+
this.markupNodes = [];
|
|
68
|
+
this.markupHtml = '';
|
|
69
|
+
this.kind = null;
|
|
70
|
+
}
|
|
71
|
+
disposeBehavior() {
|
|
72
|
+
this.child?.dispose(false);
|
|
73
|
+
if (this.keyed)
|
|
74
|
+
for (const instance of this.keyed.values())
|
|
75
|
+
instance.dispose(false);
|
|
76
|
+
}
|
|
77
|
+
commit(value) {
|
|
78
|
+
if (isResult(value)) {
|
|
79
|
+
this.commitResult(value);
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
if (isEach(value)) {
|
|
83
|
+
this.commitEach(value);
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
if (isMarkup(value)) {
|
|
87
|
+
this.commitMarkup(value.html);
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
this.commitText(value);
|
|
91
|
+
}
|
|
92
|
+
commitMarkup(html) {
|
|
93
|
+
if (this.kind === 'markup' && this.markupHtml === html)
|
|
94
|
+
return;
|
|
95
|
+
this.clear();
|
|
96
|
+
this.kind = 'markup';
|
|
97
|
+
this.markupHtml = html;
|
|
98
|
+
this.markupNodes = this.host.insertMarkup(this.parent, html, this.anchor);
|
|
99
|
+
}
|
|
100
|
+
commitText(value) {
|
|
101
|
+
const str = value == null || value === false ? '' : String(value);
|
|
102
|
+
if (this.kind === 'text' && this.node) {
|
|
103
|
+
if (this.node.text !== str)
|
|
104
|
+
this.host.setText(this.node, str);
|
|
105
|
+
return;
|
|
106
|
+
}
|
|
107
|
+
this.clear();
|
|
108
|
+
this.kind = 'text';
|
|
109
|
+
this.node = this.host.createText(str);
|
|
110
|
+
this.host.insert(this.parent, this.node, this.anchor);
|
|
111
|
+
}
|
|
112
|
+
commitResult(result) {
|
|
113
|
+
if (this.kind === 'result' && this.child && this.child.strings === result.strings) {
|
|
114
|
+
this.child.update(result.values);
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
this.clear();
|
|
118
|
+
this.kind = 'result';
|
|
119
|
+
this.child = new Instance(this.host, result.strings);
|
|
120
|
+
this.child.mount(this.parent, this.anchor);
|
|
121
|
+
this.child.update(result.values);
|
|
122
|
+
}
|
|
123
|
+
// Keyed list reconciliation.
|
|
124
|
+
//
|
|
125
|
+
// Removals happen first so stale nodes never poison the sibling chain, then a
|
|
126
|
+
// longest-increasing-subsequence over the surviving order decides which entries
|
|
127
|
+
// are already in relative order. Only entries outside that subsequence move, so
|
|
128
|
+
// a swap costs one move rather than cascading through the whole list.
|
|
129
|
+
commitEach(list) {
|
|
130
|
+
if (this.kind !== 'each') {
|
|
131
|
+
this.clear();
|
|
132
|
+
this.kind = 'each';
|
|
133
|
+
this.keyed = new Map();
|
|
134
|
+
this.keys = [];
|
|
135
|
+
}
|
|
136
|
+
const keyed = this.keyed;
|
|
137
|
+
const prevKeys = this.keys;
|
|
138
|
+
const n = list.items.length;
|
|
139
|
+
const nextKeys = new Array(n);
|
|
140
|
+
const results = new Array(n);
|
|
141
|
+
// Same length and same keys in the same places is by far the most common
|
|
142
|
+
// render: a value changed, nothing moved. Detecting it here skips the Set, the
|
|
143
|
+
// Map, the LIS and the anchor walk below — six N-sized structures that existed
|
|
144
|
+
// only to answer a question already answered.
|
|
145
|
+
let sameOrder = prevKeys.length === n;
|
|
146
|
+
for (let i = 0; i < n; i++) {
|
|
147
|
+
const key = list.keyOf(list.items[i], i);
|
|
148
|
+
nextKeys[i] = key;
|
|
149
|
+
results[i] = list.render(list.items[i], i);
|
|
150
|
+
if (sameOrder && prevKeys[i] !== key)
|
|
151
|
+
sameOrder = false;
|
|
152
|
+
}
|
|
153
|
+
if (sameOrder) {
|
|
154
|
+
for (let i = 0; i < n; i++) {
|
|
155
|
+
const inst = keyed.get(nextKeys[i]);
|
|
156
|
+
const result = results[i];
|
|
157
|
+
if (inst && inst.strings === result.strings) {
|
|
158
|
+
inst.update(result.values);
|
|
159
|
+
continue;
|
|
160
|
+
}
|
|
161
|
+
sameOrder = false; // a template swapped shape; fall through to the full path
|
|
162
|
+
break;
|
|
163
|
+
}
|
|
164
|
+
if (sameOrder) {
|
|
165
|
+
for (let i = 0; i < n; i++)
|
|
166
|
+
keyed.get(nextKeys[i]).pos = i;
|
|
167
|
+
this.keys = nextKeys;
|
|
168
|
+
return;
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
// Where each surviving entry used to sit is carried on the instance itself, so
|
|
172
|
+
// this pass needs no Map — and counting the reused ones tells us whether
|
|
173
|
+
// anything was removed at all, so it needs no Set either. Both used to be built
|
|
174
|
+
// on every reorder of every list, to answer questions the pass already knew.
|
|
175
|
+
const oldIndex = new Array(n);
|
|
176
|
+
let reused = 0;
|
|
177
|
+
for (let i = 0; i < n; i++) {
|
|
178
|
+
const inst = keyed.get(nextKeys[i]);
|
|
179
|
+
if (inst && inst.strings === results[i].strings) {
|
|
180
|
+
oldIndex[i] = inst.pos;
|
|
181
|
+
reused++;
|
|
182
|
+
}
|
|
183
|
+
else
|
|
184
|
+
oldIndex[i] = -1;
|
|
185
|
+
}
|
|
186
|
+
// Every existing entry accounted for means nothing disappeared; only then is the
|
|
187
|
+
// removal scan worth its own walk over the map.
|
|
188
|
+
if (reused !== keyed.size) {
|
|
189
|
+
const wanted = new Set(nextKeys);
|
|
190
|
+
for (const [k, inst] of keyed) {
|
|
191
|
+
if (!wanted.has(k)) {
|
|
192
|
+
inst.remove();
|
|
193
|
+
keyed.delete(k);
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
// Entries in the longest increasing subsequence are already in relative order.
|
|
198
|
+
const stay = lisIndices(oldIndex);
|
|
199
|
+
// 4. one back-to-front pass: only entries outside the subsequence touch the host
|
|
200
|
+
let nextAnchor = this.anchor;
|
|
201
|
+
for (let i = nextKeys.length - 1; i >= 0; i--) {
|
|
202
|
+
const key = nextKeys[i];
|
|
203
|
+
const result = results[i];
|
|
204
|
+
let inst = keyed.get(key);
|
|
205
|
+
const reusable = !!inst && inst.strings === result.strings;
|
|
206
|
+
if (reusable && inst) {
|
|
207
|
+
inst.update(result.values);
|
|
208
|
+
if (stay[i] !== 1)
|
|
209
|
+
inst.moveBefore(this.parent, nextAnchor);
|
|
210
|
+
}
|
|
211
|
+
else {
|
|
212
|
+
if (inst)
|
|
213
|
+
inst.remove();
|
|
214
|
+
inst = new Instance(this.host, result.strings);
|
|
215
|
+
inst.mount(this.parent, nextAnchor);
|
|
216
|
+
inst.update(result.values);
|
|
217
|
+
keyed.set(key, inst);
|
|
218
|
+
}
|
|
219
|
+
;
|
|
220
|
+
inst.pos = i;
|
|
221
|
+
nextAnchor = inst.firstNode() ?? nextAnchor;
|
|
222
|
+
}
|
|
223
|
+
this.keys = nextKeys;
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
// Longest increasing subsequence over positions; -1 marks a brand new entry and can
|
|
227
|
+
// never be part of it. Returns a flag per index rather than a Set: the caller reads
|
|
228
|
+
// it once per entry, which a typed array does without allocating a hash.
|
|
229
|
+
function lisIndices(arr) {
|
|
230
|
+
const piles = [];
|
|
231
|
+
const parent = new Array(arr.length).fill(-1);
|
|
232
|
+
const tails = [];
|
|
233
|
+
for (let i = 0; i < arr.length; i++) {
|
|
234
|
+
const v = arr[i];
|
|
235
|
+
if (v < 0)
|
|
236
|
+
continue;
|
|
237
|
+
let lo = 0, hi = piles.length;
|
|
238
|
+
while (lo < hi) {
|
|
239
|
+
const mid = (lo + hi) >> 1;
|
|
240
|
+
if (arr[piles[mid]] < v)
|
|
241
|
+
lo = mid + 1;
|
|
242
|
+
else
|
|
243
|
+
hi = mid;
|
|
244
|
+
}
|
|
245
|
+
if (lo > 0)
|
|
246
|
+
parent[i] = piles[lo - 1];
|
|
247
|
+
piles[lo] = i;
|
|
248
|
+
tails[lo] = v;
|
|
249
|
+
}
|
|
250
|
+
const out = new Uint8Array(arr.length);
|
|
251
|
+
let k = piles.length ? piles[piles.length - 1] : -1;
|
|
252
|
+
while (k >= 0) {
|
|
253
|
+
out[k] = 1;
|
|
254
|
+
k = parent[k];
|
|
255
|
+
}
|
|
256
|
+
return out;
|
|
257
|
+
}
|
|
258
|
+
class Instance {
|
|
259
|
+
host;
|
|
260
|
+
strings;
|
|
261
|
+
tpl;
|
|
262
|
+
parts = [];
|
|
263
|
+
roots = [];
|
|
264
|
+
values = [];
|
|
265
|
+
/** Position among its siblings at the last render, for the reordering pass. */
|
|
266
|
+
pos = -1;
|
|
267
|
+
constructor(host, strings) {
|
|
268
|
+
this.host = host;
|
|
269
|
+
this.strings = strings;
|
|
270
|
+
this.tpl = templateFor(strings);
|
|
271
|
+
}
|
|
272
|
+
mount(parent, anchor) {
|
|
273
|
+
const build = (node, target) => {
|
|
274
|
+
const atRoot = target === parent;
|
|
275
|
+
if (node.type === 'text') {
|
|
276
|
+
const t = this.host.createText(node.value);
|
|
277
|
+
this.host.insert(target, t, atRoot ? anchor : null);
|
|
278
|
+
if (atRoot)
|
|
279
|
+
this.roots.push(t);
|
|
280
|
+
return;
|
|
281
|
+
}
|
|
282
|
+
if (node.type === 'hole') {
|
|
283
|
+
const marker = this.host.createText('');
|
|
284
|
+
this.host.insert(target, marker, atRoot ? anchor : null);
|
|
285
|
+
if (atRoot)
|
|
286
|
+
this.roots.push(marker);
|
|
287
|
+
this.parts[node.index] = new Part(this.host, target, marker);
|
|
288
|
+
return;
|
|
289
|
+
}
|
|
290
|
+
const el = this.host.createElement(node.tag);
|
|
291
|
+
for (const a of node.attrs) {
|
|
292
|
+
if (a.hole == null) {
|
|
293
|
+
this.host.setAttribute(el, a.name, a.value ?? '');
|
|
294
|
+
continue;
|
|
295
|
+
}
|
|
296
|
+
this.parts[a.hole] = isEventAttr(a.name)
|
|
297
|
+
? bindEvent(this.host, el, a.name, undefined)
|
|
298
|
+
: { attr: true, node: el, name: a.name, last: undefined };
|
|
299
|
+
}
|
|
300
|
+
this.host.insert(target, el, atRoot ? anchor : null);
|
|
301
|
+
if (atRoot)
|
|
302
|
+
this.roots.push(el);
|
|
303
|
+
for (const c of node.children)
|
|
304
|
+
build(c, el);
|
|
305
|
+
};
|
|
306
|
+
for (const n of this.tpl.children)
|
|
307
|
+
build(n, parent);
|
|
308
|
+
}
|
|
309
|
+
update(values) {
|
|
310
|
+
for (let i = 0; i < values.length; i++) {
|
|
311
|
+
const p = this.parts[i];
|
|
312
|
+
if (!p)
|
|
313
|
+
continue;
|
|
314
|
+
const v = values[i];
|
|
315
|
+
if ('event' in p) {
|
|
316
|
+
p.box.fn = typeof v === 'function' ? v : null;
|
|
317
|
+
continue;
|
|
318
|
+
}
|
|
319
|
+
if (p.attr) {
|
|
320
|
+
if (!Object.is(p.last, v)) {
|
|
321
|
+
this.host.setAttribute(p.node, p.name, v);
|
|
322
|
+
p.last = v;
|
|
323
|
+
}
|
|
324
|
+
continue;
|
|
325
|
+
}
|
|
326
|
+
if (Object.is(this.values[i], v) && !isResult(v) && !isEach(v))
|
|
327
|
+
continue;
|
|
328
|
+
p.commit(v);
|
|
329
|
+
}
|
|
330
|
+
this.values = values;
|
|
331
|
+
}
|
|
332
|
+
firstNode() {
|
|
333
|
+
return this.roots[0] ?? null;
|
|
334
|
+
}
|
|
335
|
+
nextSibling() {
|
|
336
|
+
const last = this.roots[this.roots.length - 1];
|
|
337
|
+
if (!last)
|
|
338
|
+
return null;
|
|
339
|
+
// A real DOM node knows its own neighbour; the counting mock keeps an array.
|
|
340
|
+
const native = last.nextSibling;
|
|
341
|
+
if (native !== undefined)
|
|
342
|
+
return native ?? null;
|
|
343
|
+
if (!last.parent)
|
|
344
|
+
return null;
|
|
345
|
+
const sibs = last.parent.children ?? [];
|
|
346
|
+
return sibs[sibs.indexOf(last) + 1] ?? null;
|
|
347
|
+
}
|
|
348
|
+
moveBefore(parent, anchor) {
|
|
349
|
+
for (const n of this.roots)
|
|
350
|
+
this.host.move(parent, n, anchor);
|
|
351
|
+
}
|
|
352
|
+
remove() {
|
|
353
|
+
this.dispose(true);
|
|
354
|
+
}
|
|
355
|
+
dispose(removeNodes) {
|
|
356
|
+
for (const p of this.parts) {
|
|
357
|
+
if (!p)
|
|
358
|
+
continue;
|
|
359
|
+
if ('event' in p) {
|
|
360
|
+
p.detach();
|
|
361
|
+
continue;
|
|
362
|
+
}
|
|
363
|
+
if (!p.attr) {
|
|
364
|
+
if (removeNodes)
|
|
365
|
+
p.clear();
|
|
366
|
+
else
|
|
367
|
+
p.disposeBehavior();
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
if (removeNodes) {
|
|
371
|
+
for (const n of this.roots)
|
|
372
|
+
this.host.remove(n);
|
|
373
|
+
this.roots = [];
|
|
374
|
+
}
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
export function createRoot(host, container) {
|
|
378
|
+
let instance = null;
|
|
379
|
+
return {
|
|
380
|
+
render(result) {
|
|
381
|
+
if (!instance || instance.strings !== result.strings) {
|
|
382
|
+
instance?.remove();
|
|
383
|
+
instance = new Instance(host, result.strings);
|
|
384
|
+
instance.mount(container, null);
|
|
385
|
+
}
|
|
386
|
+
instance.update(result.values);
|
|
387
|
+
},
|
|
388
|
+
dispose(options = {}) {
|
|
389
|
+
instance?.dispose(options.remove === true);
|
|
390
|
+
instance = null;
|
|
391
|
+
},
|
|
392
|
+
};
|
|
393
|
+
}
|
|
394
|
+
const ELEMENT = 1, TEXT = 3, COMMENT = 8;
|
|
395
|
+
const describe = (n) => !n
|
|
396
|
+
? 'nothing'
|
|
397
|
+
: n.nodeType === COMMENT
|
|
398
|
+
? `comment "${n.data ?? ''}"`
|
|
399
|
+
: n.nodeType === TEXT
|
|
400
|
+
? `text "${(n.data ?? '').slice(0, 20)}"`
|
|
401
|
+
: `<${n.nodeName.toLowerCase()}>`;
|
|
402
|
+
function hydrateInstance(host, strings, values, parent, cursor) {
|
|
403
|
+
const instance = new Instance(host, strings);
|
|
404
|
+
let c = cursor;
|
|
405
|
+
const claimValue = (value, part) => {
|
|
406
|
+
// Pre-rendered markup: an unknown number of nodes, so the walk cannot
|
|
407
|
+
// count them. It runs to the marker the server left instead — which is
|
|
408
|
+
// why a hole is fenced on both sides rather than only anchored at the end.
|
|
409
|
+
if (isMarkup(value)) {
|
|
410
|
+
part.kind = 'markup';
|
|
411
|
+
while (c && !(c.nodeType === COMMENT && c.data === HOLE_MARKER)) {
|
|
412
|
+
part.markupNodes.push(c);
|
|
413
|
+
c = c.nextSibling;
|
|
414
|
+
}
|
|
415
|
+
part.markupHtml = value.html;
|
|
416
|
+
return;
|
|
417
|
+
}
|
|
418
|
+
if (isResult(value)) {
|
|
419
|
+
const r = hydrateInstance(host, value.strings, value.values, part.parent, c);
|
|
420
|
+
part.kind = 'result';
|
|
421
|
+
part.child = r.instance;
|
|
422
|
+
c = r.cursor;
|
|
423
|
+
return;
|
|
424
|
+
}
|
|
425
|
+
if (isEach(value)) {
|
|
426
|
+
part.kind = 'each';
|
|
427
|
+
part.keyed = new Map();
|
|
428
|
+
part.keys = [];
|
|
429
|
+
for (let i = 0; i < value.items.length; i++) {
|
|
430
|
+
const item = value.items[i];
|
|
431
|
+
const res = value.render(item, i);
|
|
432
|
+
const r = hydrateInstance(host, res.strings, res.values, part.parent, c);
|
|
433
|
+
part.keyed.set(value.keyOf(item, i), r.instance);
|
|
434
|
+
part.keys.push(value.keyOf(item, i));
|
|
435
|
+
c = r.cursor;
|
|
436
|
+
}
|
|
437
|
+
return;
|
|
438
|
+
}
|
|
439
|
+
// SSR emits no node for an empty string, just as it emits none for null/false.
|
|
440
|
+
// Requiring a text node here makes any initially-empty conditional fail only
|
|
441
|
+
// in a real HTML parser, where zero-length text nodes cannot survive.
|
|
442
|
+
if (value == null || value === false || value === '') {
|
|
443
|
+
part.kind = null;
|
|
444
|
+
return;
|
|
445
|
+
}
|
|
446
|
+
if (!c || c.nodeType !== TEXT)
|
|
447
|
+
throw new HydrationMismatch('a text hole', 'a text node', describe(c));
|
|
448
|
+
part.kind = 'text';
|
|
449
|
+
part.node = c;
|
|
450
|
+
c = c.nextSibling;
|
|
451
|
+
};
|
|
452
|
+
const walk = (node, target) => {
|
|
453
|
+
const atRoot = target === parent;
|
|
454
|
+
if (node.type === 'text') {
|
|
455
|
+
if (!c || c.nodeType !== TEXT)
|
|
456
|
+
throw new HydrationMismatch('static text', JSON.stringify(node.value.slice(0, 20)), describe(c));
|
|
457
|
+
if (atRoot)
|
|
458
|
+
instance.roots.push(c);
|
|
459
|
+
c = c.nextSibling;
|
|
460
|
+
return;
|
|
461
|
+
}
|
|
462
|
+
if (node.type === 'hole') {
|
|
463
|
+
if (!c || c.nodeType !== COMMENT || c.data !== HOLE_OPEN) {
|
|
464
|
+
throw new HydrationMismatch('the start of a hole', `a <!--${HOLE_OPEN}--> marker`, describe(c));
|
|
465
|
+
}
|
|
466
|
+
const opening = c;
|
|
467
|
+
if (atRoot)
|
|
468
|
+
instance.roots.push(opening);
|
|
469
|
+
c = c.nextSibling;
|
|
470
|
+
const part = new Part(host, target, null);
|
|
471
|
+
const startedAt = c;
|
|
472
|
+
claimValue(values[node.index], part);
|
|
473
|
+
if (atRoot && startedAt) {
|
|
474
|
+
for (let n = startedAt; n && n !== c; n = n.nextSibling)
|
|
475
|
+
instance.roots.push(n);
|
|
476
|
+
}
|
|
477
|
+
if (!c || c.nodeType !== COMMENT || c.data !== HOLE_MARKER) {
|
|
478
|
+
throw new HydrationMismatch('a hole', `a <!--${HOLE_MARKER}--> marker`, describe(c));
|
|
479
|
+
}
|
|
480
|
+
part.anchor = c;
|
|
481
|
+
if (atRoot)
|
|
482
|
+
instance.roots.push(c);
|
|
483
|
+
instance.parts[node.index] = part;
|
|
484
|
+
c = c.nextSibling;
|
|
485
|
+
return;
|
|
486
|
+
}
|
|
487
|
+
const el = node;
|
|
488
|
+
if (!c || c.nodeType !== ELEMENT || c.nodeName.toLowerCase() !== el.tag) {
|
|
489
|
+
throw new HydrationMismatch('an element', `<${el.tag}>`, describe(c));
|
|
490
|
+
}
|
|
491
|
+
const element = c;
|
|
492
|
+
if (atRoot)
|
|
493
|
+
instance.roots.push(element);
|
|
494
|
+
for (const a of el.attrs) {
|
|
495
|
+
if (a.hole == null)
|
|
496
|
+
continue;
|
|
497
|
+
// The server never rendered a handler, so hydration is where it first attaches.
|
|
498
|
+
instance.parts[a.hole] = isEventAttr(a.name)
|
|
499
|
+
? bindEvent(host, element, a.name, values[a.hole])
|
|
500
|
+
: { attr: true, node: element, name: a.name, last: values[a.hole] };
|
|
501
|
+
}
|
|
502
|
+
const after = element.nextSibling;
|
|
503
|
+
c = element.firstChild;
|
|
504
|
+
for (const child of el.children)
|
|
505
|
+
walk(child, element);
|
|
506
|
+
c = after;
|
|
507
|
+
};
|
|
508
|
+
for (const n of instance.tpl.children)
|
|
509
|
+
walk(n, parent);
|
|
510
|
+
instance.values = values;
|
|
511
|
+
return { instance, cursor: c };
|
|
512
|
+
}
|
|
513
|
+
/**
|
|
514
|
+
* Attach to server-rendered markup. On a mismatch it throws rather than silently
|
|
515
|
+
* patching over a difference, because a hydration that half-works is worse than one
|
|
516
|
+
* that fails loudly: the caller can fall back to a clean client render.
|
|
517
|
+
*/
|
|
518
|
+
export function hydrateRoot(host, container, result) {
|
|
519
|
+
const { instance: hydrated } = hydrateInstance(host, result.strings, result.values, container, container.firstChild);
|
|
520
|
+
let instance = hydrated;
|
|
521
|
+
return {
|
|
522
|
+
render(next) {
|
|
523
|
+
if (!instance || instance.strings !== next.strings) {
|
|
524
|
+
instance?.remove();
|
|
525
|
+
instance = new Instance(host, next.strings);
|
|
526
|
+
instance.mount(container, null);
|
|
527
|
+
}
|
|
528
|
+
instance.update(next.values);
|
|
529
|
+
},
|
|
530
|
+
dispose(options = {}) {
|
|
531
|
+
instance?.dispose(options.remove === true);
|
|
532
|
+
instance = null;
|
|
533
|
+
},
|
|
534
|
+
};
|
|
535
|
+
}
|
|
536
|
+
//# sourceMappingURL=render.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"render.js","sourceRoot":"","sources":["../../../../../packages/ketjs-view/src/render.ts"],"names":[],"mappings":"AAAA,mFAAmF;AACnF,iFAAiF;AACjF,0CAA0C;AAE1C,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAG3C,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,iBAAiB,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAA;AAG9E,MAAM,MAAM,GAAG,MAAM,CAAC,YAAY,CAAC,CAAA;AACnC,MAAM,IAAI,GAAG,MAAM,CAAC,UAAU,CAAC,CAAA;AAY/B,MAAM,UAAU,IAAI,CAAC,OAA6B,EAAE,GAAG,MAAiB;IACtE,OAAO,EAAE,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,CAAA;AAC5C,CAAC;AACD,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,CAAU,EAAuB,EAAE,CAAC,CAAC,CAAE,CAAoB,EAAE,CAAC,MAAM,CAAC,CAAA;AAE9F,MAAM,UAAU,IAAI,CAClB,KAAkB,EAClB,KAAsC,EACtC,MAA8C;IAE9C,OAAO;QACL,CAAC,IAAI,CAAC,EAAE,IAAI;QACZ,KAAK,EAAE,CAAC,GAAG,KAAK,CAAc;QAC9B,KAAK,EAAE,KAA4B;QACnC,MAAM,EAAE,MAA8B;KACvC,CAAA;AACH,CAAC;AACD,MAAM,CAAC,MAAM,MAAM,GAAG,CAAC,CAAU,EAAmB,EAAE,CAAC,CAAC,CAAE,CAAgB,EAAE,CAAC,IAAI,CAAC,CAAA;AAElF,MAAM,UA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|
6
|
+
};
|
|
7
|
+
export declare function signal<T>(initial: T): Signal<T>;
|
|
8
|
+
export declare function effect(fn: () => Cleanup): () => void;
|
|
9
|
+
export declare function effect(fn: () => void): () => void;
|
|
10
|
+
export type Computed<T> = {
|
|
11
|
+
(): T;
|
|
12
|
+
peek(): T;
|
|
13
|
+
dispose(): void;
|
|
14
|
+
};
|
|
15
|
+
export declare function computed<T>(fn: () => T): Computed<T>;
|
|
16
|
+
export declare function batch<T>(fn: () => T): T;
|
|
17
|
+
export {};
|
|
18
|
+
//# sourceMappingURL=signal.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"signal.d.ts","sourceRoot":"","sources":["../../../../packages/ketjs-view/src/signal.ts"],"names":[],"mappings":"AAIA,KAAK,OAAO,GAAG,MAAM,IAAI,CAAA;AAczB,MAAM,MAAM,MAAM,CAAC,CAAC,IAAI;IACtB,IAAI,CAAC,CAAA;IACL,GAAG,CAAC,IAAI,EAAE,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,CAAA;IAClC,IAAI,IAAI,CAAC,CAAA;CACV,CAAA;AAED,wBAAgB,MAAM,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC,CAoB/C;AAqED,wBAAgB,MAAM,CAAC,EAAE,EAAE,MAAM,OAAO,GAAG,MAAM,IAAI,CAAA;AACrD,wBAAgB,MAAM,CAAC,EAAE,EAAE,MAAM,IAAI,GAAG,MAAM,IAAI,CAAA;AAKlD,MAAM,MAAM,QAAQ,CAAC,CAAC,IAAI;IACxB,IAAI,CAAC,CAAA;IACL,IAAI,IAAI,CAAC,CAAA;IACT,OAAO,IAAI,IAAI,CAAA;CAChB,CAAA;AAED,wBAAgB,QAAQ,CAAC,CAAC,EAAE,EAAE,EAAE,MAAM,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,CASpD;AAED,wBAAgB,KAAK,CAAC,CAAC,EAAE,EAAE,EAAE,MAAM,CAAC,GAAG,CAAC,CAUvC"}
|