@yannosay/sinth 0.14.5 → 0.14.6
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/package.json
CHANGED
package/src/core/compiler.ts
CHANGED
|
@@ -783,7 +783,9 @@ export function renderCompUse(
|
|
|
783
783
|
const rhs = (varDecl && varDecl.varType === "int")
|
|
784
784
|
? `Number(e.target.value) || 0`
|
|
785
785
|
: `e.target.value`;
|
|
786
|
+
const initialVal = varDecl?.value ? litToString(varDecl.value).replace(/"/g, '"') : "";
|
|
786
787
|
attrParts.push(`oninput="(function(e){ ${vName} = ${rhs}; sinthRender(); })(event)"`);
|
|
788
|
+
attrParts.push(`value="${escAttr(initialVal)}"`);
|
|
787
789
|
attrParts.push(`data-sinth-value="${escAttr(vName)}"`);
|
|
788
790
|
}
|
|
789
791
|
}
|
|
@@ -54,7 +54,7 @@ export function buildRenderBody(opts: {
|
|
|
54
54
|
renderBody += ` document.querySelectorAll('template[data-sinth-for]').forEach(sinthForBlock);\n`;
|
|
55
55
|
}
|
|
56
56
|
renderBody += ` document.querySelectorAll('[data-sinth-value]').forEach(function(el) {
|
|
57
|
-
try { if (document.activeElement !== el) el.value =
|
|
57
|
+
try { if (document.activeElement !== el) { el.value = Function('"use strict"; return (' + el.dataset.sinthValue + ')')(); } } catch(e) {}
|
|
58
58
|
});\n`;
|
|
59
59
|
renderBody += ` document.querySelectorAll('[data-sinth-step]').forEach(function(el) {
|
|
60
60
|
try { el.step = window[el.dataset.sinthStep] || 1; } catch(e) {}
|