@lowdefy/client-core 0.0.0-experimental-20261027111447 → 7.2.0
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.
|
@@ -27,7 +27,8 @@
|
|
|
27
27
|
// trigger an event.
|
|
28
28
|
//
|
|
29
29
|
// The same resize listener keeps _media current: once a resize settles, the
|
|
30
|
-
// engine re-evaluates the blocks that read a media value that changed.
|
|
30
|
+
// engine re-evaluates the blocks that read a media value that changed. Media is
|
|
31
|
+
// also updated when the listeners attach and when the page becomes visible.
|
|
31
32
|
const VISIBILITY_DEBOUNCE_MS = 300;
|
|
32
33
|
const RESIZE_DEBOUNCE_MS = 150;
|
|
33
34
|
function createPageLifecycleManager() {
|
|
@@ -156,6 +157,17 @@ function createPageLifecycleManager() {
|
|
|
156
157
|
resizeTimeout = setTimer(flush, RESIZE_DEBOUNCE_MS);
|
|
157
158
|
});
|
|
158
159
|
}
|
|
160
|
+
if (watchMedia) {
|
|
161
|
+
// The engine reads the viewport when it creates the context, and the page's
|
|
162
|
+
// onInit runs before these listeners attach, so a resize in between is missed.
|
|
163
|
+
context._internal.updateMedia();
|
|
164
|
+
// A page loaded in a hidden tab reads a width of 0. The browser may not fire
|
|
165
|
+
// resize when the tab is shown, so showing the page updates media too.
|
|
166
|
+
listen(doc, 'visibilitychange', ()=>{
|
|
167
|
+
if (destroyed || doc.visibilityState === 'hidden') return;
|
|
168
|
+
context._internal.updateMedia();
|
|
169
|
+
});
|
|
170
|
+
}
|
|
159
171
|
}
|
|
160
172
|
function destroy() {
|
|
161
173
|
destroyed = true;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lowdefy/client-core",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "7.2.0",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"description": "Lowdefy Client Core - the platform-free half of the Lowdefy client, shared by its renderers",
|
|
6
6
|
"homepage": "https://lowdefy.com",
|
|
@@ -33,10 +33,10 @@
|
|
|
33
33
|
"dist/*"
|
|
34
34
|
],
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@lowdefy/engine": "
|
|
37
|
-
"@lowdefy/errors": "
|
|
38
|
-
"@lowdefy/helpers": "
|
|
39
|
-
"@lowdefy/logger": "
|
|
36
|
+
"@lowdefy/engine": "7.2.0",
|
|
37
|
+
"@lowdefy/errors": "7.2.0",
|
|
38
|
+
"@lowdefy/helpers": "7.2.0",
|
|
39
|
+
"@lowdefy/logger": "7.2.0"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
42
|
"@swc/cli": "0.8.1",
|