@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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yannosay/sinth",
3
- "version": "0.14.5",
3
+ "version": "0.14.6",
4
4
  "description": "A declarative & reactive language that compiles to pure HTML, CSS, and JavaScript.",
5
5
  "author": "Yannosay Productions",
6
6
  "license": "AGPL-3.0",
@@ -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 = window[el.dataset.sinthValue] || ''; } catch(e) {}
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) {}