thunderous 2.0.2 → 2.0.3
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/dist/index.cjs +15 -0
- package/dist/index.js +15 -0
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
@@ -377,6 +377,7 @@ var evaluateBindings = (element, fragment) => {
|
|
377
377
|
newNode.data = signal();
|
378
378
|
});
|
379
379
|
} else if (signal !== void 0 && newNode instanceof DocumentFragment) {
|
380
|
+
let init = false;
|
380
381
|
createEffect(() => {
|
381
382
|
const result = signal();
|
382
383
|
const nextNode = createNewNode(result, element);
|
@@ -386,14 +387,28 @@ var evaluateBindings = (element, fragment) => {
|
|
386
387
|
);
|
387
388
|
}
|
388
389
|
let lastSibling = element.lastChild;
|
390
|
+
for (const child2 of element.children) {
|
391
|
+
const key = child2.getAttribute("key");
|
392
|
+
if (key === null) continue;
|
393
|
+
const matchingNode = nextNode.querySelector(`[key="${key}"]`);
|
394
|
+
if (init && matchingNode === null) {
|
395
|
+
child2.remove();
|
396
|
+
}
|
397
|
+
}
|
389
398
|
for (const child2 of nextNode.children) {
|
390
399
|
const key = child2.getAttribute("key");
|
391
400
|
const matchingNode = element.querySelector(`[key="${key}"]`);
|
392
401
|
if (matchingNode === null) continue;
|
402
|
+
matchingNode.__customCallbackFns = child2.__customCallbackFns;
|
403
|
+
for (const attr of child2.attributes) {
|
404
|
+
matchingNode.setAttribute(attr.name, attr.value);
|
405
|
+
}
|
406
|
+
matchingNode.replaceChildren(...child2.childNodes);
|
393
407
|
lastSibling = matchingNode.nextSibling;
|
394
408
|
child2.replaceWith(matchingNode);
|
395
409
|
}
|
396
410
|
element.insertBefore(nextNode, lastSibling);
|
411
|
+
if (!init) init = true;
|
397
412
|
});
|
398
413
|
}
|
399
414
|
});
|
package/dist/index.js
CHANGED
@@ -342,6 +342,7 @@ var evaluateBindings = (element, fragment) => {
|
|
342
342
|
newNode.data = signal();
|
343
343
|
});
|
344
344
|
} else if (signal !== void 0 && newNode instanceof DocumentFragment) {
|
345
|
+
let init = false;
|
345
346
|
createEffect(() => {
|
346
347
|
const result = signal();
|
347
348
|
const nextNode = createNewNode(result, element);
|
@@ -351,14 +352,28 @@ var evaluateBindings = (element, fragment) => {
|
|
351
352
|
);
|
352
353
|
}
|
353
354
|
let lastSibling = element.lastChild;
|
355
|
+
for (const child2 of element.children) {
|
356
|
+
const key = child2.getAttribute("key");
|
357
|
+
if (key === null) continue;
|
358
|
+
const matchingNode = nextNode.querySelector(`[key="${key}"]`);
|
359
|
+
if (init && matchingNode === null) {
|
360
|
+
child2.remove();
|
361
|
+
}
|
362
|
+
}
|
354
363
|
for (const child2 of nextNode.children) {
|
355
364
|
const key = child2.getAttribute("key");
|
356
365
|
const matchingNode = element.querySelector(`[key="${key}"]`);
|
357
366
|
if (matchingNode === null) continue;
|
367
|
+
matchingNode.__customCallbackFns = child2.__customCallbackFns;
|
368
|
+
for (const attr of child2.attributes) {
|
369
|
+
matchingNode.setAttribute(attr.name, attr.value);
|
370
|
+
}
|
371
|
+
matchingNode.replaceChildren(...child2.childNodes);
|
358
372
|
lastSibling = matchingNode.nextSibling;
|
359
373
|
child2.replaceWith(matchingNode);
|
360
374
|
}
|
361
375
|
element.insertBefore(nextNode, lastSibling);
|
376
|
+
if (!init) init = true;
|
362
377
|
});
|
363
378
|
}
|
364
379
|
});
|