thunderous 2.3.2 → 2.3.4
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 +23 -11
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +23 -11
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
@@ -448,6 +448,8 @@ var evaluateBindings = (element, fragment) => {
|
|
448
448
|
child.replaceWith(childFragment);
|
449
449
|
}
|
450
450
|
} else if (child instanceof Element) {
|
451
|
+
const attrRemoveQueue = [];
|
452
|
+
const attrSetQueue = [];
|
451
453
|
for (const attr of child.attributes) {
|
452
454
|
const attrName = attr.name;
|
453
455
|
if (SIGNAL_BINDING_REGEX.test(attr.value)) {
|
@@ -458,21 +460,25 @@ var evaluateBindings = (element, fragment) => {
|
|
458
460
|
let signal;
|
459
461
|
for (const text of textList) {
|
460
462
|
const uniqueKey = text.replace(/\{\{signal:(.+)\}\}/, "$1");
|
461
|
-
|
462
|
-
|
463
|
-
|
464
|
-
|
463
|
+
if (signal === void 0) {
|
464
|
+
signal = uniqueKey !== text ? renderState.signalMap.get(uniqueKey) : void 0;
|
465
|
+
const value = signal !== void 0 ? signal() : text;
|
466
|
+
if (value === null) hasNull = true;
|
467
|
+
newText += String(value);
|
468
|
+
} else {
|
469
|
+
newText += text;
|
470
|
+
}
|
465
471
|
}
|
466
472
|
if (hasNull && newText === "null" || attrName.startsWith("prop:")) {
|
467
|
-
|
473
|
+
attrRemoveQueue.push(attrName);
|
468
474
|
} else {
|
469
|
-
|
475
|
+
attrSetQueue.push([attrName, newText]);
|
470
476
|
}
|
471
477
|
if (attrName.startsWith("prop:")) {
|
472
|
-
|
478
|
+
attrRemoveQueue.push(attrName);
|
473
479
|
const propName = attrName.replace("prop:", "");
|
474
|
-
if (!(propName in child)) logPropertyWarning(propName, child);
|
475
480
|
const newValue = hasNull && newText === "null" ? null : newText;
|
481
|
+
if (!(propName in child)) logPropertyWarning(propName, child);
|
476
482
|
child[propName] = signal !== void 0 ? signal() : newValue;
|
477
483
|
}
|
478
484
|
});
|
@@ -496,21 +502,27 @@ var evaluateBindings = (element, fragment) => {
|
|
496
502
|
}
|
497
503
|
}
|
498
504
|
if (uniqueKey !== "" && !attrName.startsWith("prop:")) {
|
499
|
-
|
505
|
+
attrSetQueue.push([attrName, `this.__customCallbackFns.get('${uniqueKey}')(event)`]);
|
500
506
|
} else if (attrName.startsWith("prop:")) {
|
501
|
-
|
507
|
+
attrRemoveQueue.push(attrName);
|
502
508
|
const propName = attrName.replace("prop:", "");
|
503
509
|
if (!(propName in child)) logPropertyWarning(propName, child);
|
504
510
|
child[propName] = child.__customCallbackFns.get(uniqueKey);
|
505
511
|
}
|
506
512
|
});
|
507
513
|
} else if (attrName.startsWith("prop:")) {
|
508
|
-
|
514
|
+
attrRemoveQueue.push(attrName);
|
509
515
|
const propName = attrName.replace("prop:", "");
|
510
516
|
if (!(propName in child)) logPropertyWarning(propName, child);
|
511
517
|
child[propName] = attr.value;
|
512
518
|
}
|
513
519
|
}
|
520
|
+
for (const attrName of attrRemoveQueue) {
|
521
|
+
child.removeAttribute(attrName);
|
522
|
+
}
|
523
|
+
for (const [name, value] of attrSetQueue) {
|
524
|
+
child.setAttribute(name, value);
|
525
|
+
}
|
514
526
|
evaluateBindings(child, fragment);
|
515
527
|
}
|
516
528
|
}
|
package/dist/index.d.cts
CHANGED
@@ -46,7 +46,7 @@ type RenderArgs<Props extends CustomElementProps> = {
|
|
46
46
|
customCallback: (fn: () => void) => `this.getRootNode().host.__customCallbackFns.get('${string}')(event)` | '';
|
47
47
|
attrSignals: Record<string, Signal<string | null>>;
|
48
48
|
propSignals: {
|
49
|
-
[K in keyof Props]
|
49
|
+
[K in keyof Props]-?: SignalWithInit<Props[K]>;
|
50
50
|
};
|
51
51
|
refs: Record<string, HTMLElement | null>;
|
52
52
|
adoptStyleSheet: (stylesheet: Styles) => void;
|
package/dist/index.d.ts
CHANGED
@@ -46,7 +46,7 @@ type RenderArgs<Props extends CustomElementProps> = {
|
|
46
46
|
customCallback: (fn: () => void) => `this.getRootNode().host.__customCallbackFns.get('${string}')(event)` | '';
|
47
47
|
attrSignals: Record<string, Signal<string | null>>;
|
48
48
|
propSignals: {
|
49
|
-
[K in keyof Props]
|
49
|
+
[K in keyof Props]-?: SignalWithInit<Props[K]>;
|
50
50
|
};
|
51
51
|
refs: Record<string, HTMLElement | null>;
|
52
52
|
adoptStyleSheet: (stylesheet: Styles) => void;
|
package/dist/index.js
CHANGED
@@ -413,6 +413,8 @@ var evaluateBindings = (element, fragment) => {
|
|
413
413
|
child.replaceWith(childFragment);
|
414
414
|
}
|
415
415
|
} else if (child instanceof Element) {
|
416
|
+
const attrRemoveQueue = [];
|
417
|
+
const attrSetQueue = [];
|
416
418
|
for (const attr of child.attributes) {
|
417
419
|
const attrName = attr.name;
|
418
420
|
if (SIGNAL_BINDING_REGEX.test(attr.value)) {
|
@@ -423,21 +425,25 @@ var evaluateBindings = (element, fragment) => {
|
|
423
425
|
let signal;
|
424
426
|
for (const text of textList) {
|
425
427
|
const uniqueKey = text.replace(/\{\{signal:(.+)\}\}/, "$1");
|
426
|
-
|
427
|
-
|
428
|
-
|
429
|
-
|
428
|
+
if (signal === void 0) {
|
429
|
+
signal = uniqueKey !== text ? renderState.signalMap.get(uniqueKey) : void 0;
|
430
|
+
const value = signal !== void 0 ? signal() : text;
|
431
|
+
if (value === null) hasNull = true;
|
432
|
+
newText += String(value);
|
433
|
+
} else {
|
434
|
+
newText += text;
|
435
|
+
}
|
430
436
|
}
|
431
437
|
if (hasNull && newText === "null" || attrName.startsWith("prop:")) {
|
432
|
-
|
438
|
+
attrRemoveQueue.push(attrName);
|
433
439
|
} else {
|
434
|
-
|
440
|
+
attrSetQueue.push([attrName, newText]);
|
435
441
|
}
|
436
442
|
if (attrName.startsWith("prop:")) {
|
437
|
-
|
443
|
+
attrRemoveQueue.push(attrName);
|
438
444
|
const propName = attrName.replace("prop:", "");
|
439
|
-
if (!(propName in child)) logPropertyWarning(propName, child);
|
440
445
|
const newValue = hasNull && newText === "null" ? null : newText;
|
446
|
+
if (!(propName in child)) logPropertyWarning(propName, child);
|
441
447
|
child[propName] = signal !== void 0 ? signal() : newValue;
|
442
448
|
}
|
443
449
|
});
|
@@ -461,21 +467,27 @@ var evaluateBindings = (element, fragment) => {
|
|
461
467
|
}
|
462
468
|
}
|
463
469
|
if (uniqueKey !== "" && !attrName.startsWith("prop:")) {
|
464
|
-
|
470
|
+
attrSetQueue.push([attrName, `this.__customCallbackFns.get('${uniqueKey}')(event)`]);
|
465
471
|
} else if (attrName.startsWith("prop:")) {
|
466
|
-
|
472
|
+
attrRemoveQueue.push(attrName);
|
467
473
|
const propName = attrName.replace("prop:", "");
|
468
474
|
if (!(propName in child)) logPropertyWarning(propName, child);
|
469
475
|
child[propName] = child.__customCallbackFns.get(uniqueKey);
|
470
476
|
}
|
471
477
|
});
|
472
478
|
} else if (attrName.startsWith("prop:")) {
|
473
|
-
|
479
|
+
attrRemoveQueue.push(attrName);
|
474
480
|
const propName = attrName.replace("prop:", "");
|
475
481
|
if (!(propName in child)) logPropertyWarning(propName, child);
|
476
482
|
child[propName] = attr.value;
|
477
483
|
}
|
478
484
|
}
|
485
|
+
for (const attrName of attrRemoveQueue) {
|
486
|
+
child.removeAttribute(attrName);
|
487
|
+
}
|
488
|
+
for (const [name, value] of attrSetQueue) {
|
489
|
+
child.setAttribute(name, value);
|
490
|
+
}
|
479
491
|
evaluateBindings(child, fragment);
|
480
492
|
}
|
481
493
|
}
|