@numueg/theme-sdk 0.13.0 → 0.13.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/dist/index.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  export { resolveThemeSettings } from './chunk-XF2FGIVS.mjs';
2
- export { KNOWN_SETTING_TYPES, KNOWN_TEMPLATES, REQUIRED_TEMPLATES, SDK_VERSION, THEME_CONTRACT_VERSION, mergeResults, validateBuiltManifest, validateManifest, validateSectionSchema, validateSettingsAgainstSchema } from './chunk-QPXMBK5U.mjs';
3
- import { ShopContext, ThemeSettingsContext, CurrentTemplateContext, PageContext, LocalizationContext, CurrencyContext, CartContext, CustomerContext, NavigationContext, CollectionContext, ProductContext, useShop, useLocalization, useCustomer, useThemeSettings } from './chunk-ZYZZG4JR.mjs';
4
- export { CartContext, CollectionContext, CurrencyContext, CustomerContext, LocalizationContext, NavigationContext, PageContext, ProductContext, ShopContext, ThemeSettingsContext, useCollections, useCustomer, useDirection, useFieldTranslation, useLocale, useLocalization, useNumberFormat, usePage, useProducts, useShop, useThemeSettings, useTranslation } from './chunk-ZYZZG4JR.mjs';
2
+ export { KNOWN_SETTING_TYPES, KNOWN_TEMPLATES, REQUIRED_TEMPLATES, SDK_VERSION, THEME_CONTRACT_VERSION, mergeResults, validateBuiltManifest, validateManifest, validateSectionSchema, validateSettingsAgainstSchema } from './chunk-AFOLV2U5.mjs';
3
+ import { ShopContext, ThemeSettingsContext, CurrentTemplateContext, PageContext, LocalizationContext, CurrencyContext, CartContext, CustomerContext, NavigationContext, CollectionContext, ProductContext, useShop, useLocalization, useCustomer, useThemeSettings } from './chunk-VZO2WMEM.mjs';
4
+ export { CartContext, CollectionContext, CurrencyContext, CustomerContext, LocalizationContext, NavigationContext, PageContext, ProductContext, ShopContext, ThemeSettingsContext, useCollections, useCustomer, useDirection, useFieldTranslation, useLocale, useLocalization, useNumberFormat, usePage, useProducts, useShop, useThemeSettings, useTranslation } from './chunk-VZO2WMEM.mjs';
5
5
  import { createContext, forwardRef, useState, useImperativeHandle, useEffect, useCallback, useMemo, useRef, useContext, useSyncExternalStore, StrictMode, createElement, Component } from 'react';
6
6
  import { hydrateRoot, createRoot } from 'react-dom/client';
7
7
  import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
@@ -2606,16 +2606,20 @@ function applyImageTransform(t, fit = "cover") {
2606
2606
  return style;
2607
2607
  }
2608
2608
  var clamp01 = (n) => Math.min(1, Math.max(0, n));
2609
+ function hostHonorsCropParams() {
2610
+ return globalThis.__NUMU_CF_IMAGE_RESIZING__ === true;
2611
+ }
2609
2612
  function focalSrc(url, options = {}) {
2610
2613
  if (!url) return "";
2611
2614
  if (url.startsWith("data:") || /[?&](fp-x|fp-y)=/.test(url)) return url;
2615
+ const crop = hostHonorsCropParams();
2612
2616
  const p = new URLSearchParams();
2613
2617
  p.set("url", url);
2614
2618
  if (options.width) p.set("w", String(Math.round(options.width)));
2615
- if (options.focal?.x != null) p.set("fp-x", String(clamp01(options.focal.x)));
2616
- if (options.focal?.y != null) p.set("fp-y", String(clamp01(options.focal.y)));
2617
- if (options.aspect) p.set("ar", options.aspect);
2618
- if (options.fit) p.set("fit", options.fit);
2619
+ if (crop && options.focal?.x != null) p.set("fp-x", String(clamp01(options.focal.x)));
2620
+ if (crop && options.focal?.y != null) p.set("fp-y", String(clamp01(options.focal.y)));
2621
+ if (crop && options.aspect) p.set("ar", options.aspect);
2622
+ if (crop && options.fit) p.set("fit", options.fit);
2619
2623
  if (options.quality) p.set("q", String(Math.min(100, Math.max(1, Math.round(options.quality)))));
2620
2624
  if (options.format) p.set("f", options.format.toLowerCase());
2621
2625
  return `/api/image-transform?${p.toString()}`;