@measured/puck 0.20.0-canary.14d96817 → 0.20.0-canary.158d52dd

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.
@@ -2072,7 +2072,6 @@ var replace = (list, index, newItem) => {
2072
2072
 
2073
2073
  // lib/use-reset-auto-zoom.ts
2074
2074
  init_react_import();
2075
- import { useCallback as useCallback2 } from "react";
2076
2075
 
2077
2076
  // lib/get-zoom-config.ts
2078
2077
  init_react_import();
@@ -2226,56 +2225,18 @@ var getZoomConfig = (uiViewport, frame, zoom) => {
2226
2225
  };
2227
2226
 
2228
2227
  // lib/use-reset-auto-zoom.ts
2229
- import { useShallow } from "zustand/react/shallow";
2230
2228
  var useResetAutoZoom = (frameRef) => {
2231
- const { viewports, zoomConfig, setZoomConfig } = useAppStore(
2232
- useShallow((s) => ({
2233
- viewports: s.state.ui.viewports,
2234
- zoomConfig: s.zoomConfig,
2235
- setZoomConfig: s.setZoomConfig
2236
- }))
2237
- );
2238
- const resetAutoZoom = useCallback2(
2239
- (options) => {
2240
- const newViewports = (options == null ? void 0 : options.viewports) || viewports;
2241
- if (!(options == null ? void 0 : options.isResettingRef)) {
2242
- if (frameRef.current) {
2243
- setZoomConfig(
2244
- getZoomConfig(
2245
- newViewports == null ? void 0 : newViewports.current,
2246
- frameRef.current,
2247
- zoomConfig.zoom
2248
- )
2249
- );
2250
- }
2251
- return;
2252
- }
2253
- const {
2254
- isResettingRef,
2255
- setShowTransition,
2256
- showTransition = false
2257
- } = options;
2258
- if (!isResettingRef.current) {
2259
- isResettingRef.current = true;
2260
- if (setShowTransition) {
2261
- setShowTransition(showTransition);
2262
- }
2263
- if (frameRef.current) {
2264
- setZoomConfig(
2265
- getZoomConfig(
2266
- newViewports == null ? void 0 : newViewports.current,
2267
- frameRef.current,
2268
- zoomConfig.zoom
2269
- )
2270
- );
2271
- }
2272
- setTimeout(() => {
2273
- isResettingRef.current = false;
2274
- }, 0);
2275
- }
2276
- },
2277
- [frameRef, zoomConfig, viewports, setZoomConfig]
2278
- );
2229
+ const appStoreApi = useAppStoreApi();
2230
+ const resetAutoZoom = (options) => {
2231
+ const { state, zoomConfig, setZoomConfig } = appStoreApi.getState();
2232
+ const { viewports } = state.ui;
2233
+ const newViewports = (options == null ? void 0 : options.viewports) || viewports;
2234
+ if (frameRef.current) {
2235
+ setZoomConfig(
2236
+ getZoomConfig(newViewports == null ? void 0 : newViewports.current, frameRef.current, zoomConfig.zoom)
2237
+ );
2238
+ }
2239
+ };
2279
2240
  return resetAutoZoom;
2280
2241
  };
2281
2242