@zalify/storefront-kit 0.1.11 → 0.1.12

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.
@@ -161,6 +161,13 @@ export function mountFrameBridge(options) {
161
161
  }
162
162
  options.onDeviceChange?.(message.payload.device);
163
163
  setSelection(message.payload.selectedPath);
164
+ // The first measurement can run before bridge:init arrives. It is
165
+ // intentionally not posted until the editor origin is pinned, so
166
+ // invalidate the cached value and publish it now.
167
+ queueMicrotask(() => {
168
+ lastHeight = 0;
169
+ measure();
170
+ });
164
171
  break;
165
172
  }
166
173
  case 'block:select':
@@ -285,7 +292,7 @@ export function mountFrameBridge(options) {
285
292
  });
286
293
  };
287
294
  })();
288
- const measure = () => {
295
+ function measure() {
289
296
  // documentElement.scrollHeight never drops below the viewport, so a
290
297
  // full-height host iframe would ratchet upward forever; the body's
291
298
  // border box tracks actual content in both directions.
@@ -296,7 +303,7 @@ export function mountFrameBridge(options) {
296
303
  lastHeight = height;
297
304
  syncSelectionHighlight();
298
305
  post({ type: 'height:changed', payload: { height } });
299
- };
306
+ }
300
307
  const resizeObserver = new win.ResizeObserver(measure);
301
308
  resizeObserver.observe(doc.documentElement);
302
309
  if (doc.body)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zalify/storefront-kit",
3
- "version": "0.1.11",
3
+ "version": "0.1.12",
4
4
  "type": "module",
5
5
  "description": "The Zalify storefront SDK: framework-agnostic commerce logic (/commerce), the theme contract types and validators (/schemas), the canvas-editor bridge (/editor), and the React theme engine + shared components (/ui, /react/server). Consumed as TypeScript source inside the zalify-storefronts monorepo; published as compiled ESM + d.ts.",
6
6
  "license": "SEE LICENSE IN LICENSE.md",
@@ -233,6 +233,13 @@ export function mountFrameBridge(
233
233
  }
234
234
  options.onDeviceChange?.(message.payload.device);
235
235
  setSelection(message.payload.selectedPath);
236
+ // The first measurement can run before bridge:init arrives. It is
237
+ // intentionally not posted until the editor origin is pinned, so
238
+ // invalidate the cached value and publish it now.
239
+ queueMicrotask(() => {
240
+ lastHeight = 0;
241
+ measure();
242
+ });
236
243
  break;
237
244
  }
238
245
  case 'block:select':
@@ -358,7 +365,7 @@ export function mountFrameBridge(
358
365
  };
359
366
  })();
360
367
 
361
- const measure = (): void => {
368
+ function measure(): void {
362
369
  // documentElement.scrollHeight never drops below the viewport, so a
363
370
  // full-height host iframe would ratchet upward forever; the body's
364
371
  // border box tracks actual content in both directions.
@@ -370,7 +377,7 @@ export function mountFrameBridge(
370
377
  lastHeight = height;
371
378
  syncSelectionHighlight();
372
379
  post({type: 'height:changed', payload: {height}});
373
- };
380
+ }
374
381
  const resizeObserver = new win.ResizeObserver(measure);
375
382
  resizeObserver.observe(doc.documentElement);
376
383
  if (doc.body) resizeObserver.observe(doc.body);