@measured/puck 0.19.1 → 0.19.2-canary.37d387bd
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.js +8 -1
- package/dist/index.mjs +8 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
@@ -2180,11 +2180,18 @@ var monitorHotkeys = (doc) => {
|
|
2180
2180
|
}
|
2181
2181
|
}
|
2182
2182
|
};
|
2183
|
+
const onVisibilityChanged = (e) => {
|
2184
|
+
if (document.visibilityState === "hidden") {
|
2185
|
+
useHotkeyStore.getState().reset();
|
2186
|
+
}
|
2187
|
+
};
|
2183
2188
|
doc.addEventListener("keydown", onKeyDown);
|
2184
2189
|
doc.addEventListener("keyup", onKeyUp);
|
2190
|
+
doc.addEventListener("visibilitychange", onVisibilityChanged);
|
2185
2191
|
return () => {
|
2186
2192
|
doc.removeEventListener("keydown", onKeyDown);
|
2187
2193
|
doc.removeEventListener("keyup", onKeyUp);
|
2194
|
+
doc.removeEventListener("visibilitychange", onVisibilityChanged);
|
2188
2195
|
};
|
2189
2196
|
};
|
2190
2197
|
var useMonitorHotkeys = () => {
|
@@ -2279,7 +2286,7 @@ var createHistorySlice = (set, get) => {
|
|
2279
2286
|
const { dispatch, history } = get();
|
2280
2287
|
dispatch({
|
2281
2288
|
type: "set",
|
2282
|
-
state: ((_a =
|
2289
|
+
state: ((_a = histories[histories.length - 1]) == null ? void 0 : _a.state) || history.initialAppState
|
2283
2290
|
});
|
2284
2291
|
set({ history: __spreadProps(__spreadValues({}, history), { histories, index: histories.length - 1 }) });
|
2285
2292
|
},
|
package/dist/index.mjs
CHANGED
@@ -1294,11 +1294,18 @@ var monitorHotkeys = (doc) => {
|
|
1294
1294
|
}
|
1295
1295
|
}
|
1296
1296
|
};
|
1297
|
+
const onVisibilityChanged = (e) => {
|
1298
|
+
if (document.visibilityState === "hidden") {
|
1299
|
+
useHotkeyStore.getState().reset();
|
1300
|
+
}
|
1301
|
+
};
|
1297
1302
|
doc.addEventListener("keydown", onKeyDown);
|
1298
1303
|
doc.addEventListener("keyup", onKeyUp);
|
1304
|
+
doc.addEventListener("visibilitychange", onVisibilityChanged);
|
1299
1305
|
return () => {
|
1300
1306
|
doc.removeEventListener("keydown", onKeyDown);
|
1301
1307
|
doc.removeEventListener("keyup", onKeyUp);
|
1308
|
+
doc.removeEventListener("visibilitychange", onVisibilityChanged);
|
1302
1309
|
};
|
1303
1310
|
};
|
1304
1311
|
var useMonitorHotkeys = () => {
|
@@ -1393,7 +1400,7 @@ var createHistorySlice = (set, get) => {
|
|
1393
1400
|
const { dispatch, history } = get();
|
1394
1401
|
dispatch({
|
1395
1402
|
type: "set",
|
1396
|
-
state: ((_a =
|
1403
|
+
state: ((_a = histories[histories.length - 1]) == null ? void 0 : _a.state) || history.initialAppState
|
1397
1404
|
});
|
1398
1405
|
set({ history: __spreadProps(__spreadValues({}, history), { histories, index: histories.length - 1 }) });
|
1399
1406
|
},
|