@yannosay/sinth 0.16.0 → 0.16.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/README.md CHANGED
@@ -133,7 +133,7 @@ Button(onClick: isFullscreen = !isFullscreen, fullscreen: isFullscreen, fullscre
133
133
  Without fullscreenSync, pressing Escape exits fullscreen but the variable stays true.
134
134
  With it, Escape resets the variable to false — button text updates automatically.
135
135
 
136
- ### Opt-in DOM Diffing
136
+ #### Opt-in DOM Diffing
137
137
 
138
138
  Skip re-executing expressions when their variables haven't changed. Perfect for expensive calculations or side effects you only want to fire once.
139
139
 
@@ -149,7 +149,7 @@ Main {
149
149
  Button(onClick: count = += 1) { "Increment" }
150
150
  }
151
151
  ```
152
- Count updates every click because count changed. The alert fires only on page load — zero dependencies means it's cached forever. No library import. No window pollution. Just a meta flag.
152
+ Count updates every click because count changed. The alert fires only on page load — zero dependencies means it's cached forever. Just a meta flag.
153
153
 
154
154
 
155
155
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yannosay/sinth",
3
- "version": "0.16.0",
3
+ "version": "0.16.1",
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",
@@ -1071,10 +1071,13 @@ export function buildRuntime(opts: {
1071
1071
  let vars = [];
1072
1072
  syncedEls.forEach(function(el) { vars.push(el.dataset.sinthFullscreenSync); });
1073
1073
  document.addEventListener('fullscreenchange', function() {
1074
- if (!document.fullscreenElement) {
1075
- vars.forEach(function(v) { window[v] = false; });
1076
- sinthRender();
1077
- }
1074
+ let state = !!document.fullscreenElement;
1075
+ vars.forEach(function(varName) {
1076
+ switch(varName) {
1077
+ ${[...new Set(varDecls.filter(v => v.name).map(v => `case '${v.name}': ${v.name} = state; break;`))].join('\n ')}
1078
+ }
1079
+ });
1080
+ sinthRender();
1078
1081
  });
1079
1082
  }
1080
1083
  })();`;