@dropins/tools 1.3.1-alpha02 → 1.4.0-alpha2

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/package.json CHANGED
@@ -1 +1 @@
1
- {"name": "@dropins/tools", "version": "1.3.1-alpha02", "license": "SEE LICENSE IN LICENSE.md"}
1
+ {"name": "@dropins/tools", "version": "1.4.0-alpha2", "license": "SEE LICENSE IN LICENSE.md"}
package/preact-compat.js CHANGED
@@ -1,4 +1,4 @@
1
1
  /*! Copyright 2025 Adobe
2
2
  All Rights Reserved. */
3
- import{N as a,b as t,k as n,C as r,e as u,L as o,U as d,o as l,f as c,G as i,_ as m,i as f,j as E,m as _,R as S,n as p,r as C,s as R,u as y,v as I,w as L,z as N,I as O,F as T,J as b,K as h,M as x,O as D,Q as F,q as M,x as g,P as U,V,y as v,a as A,g as P,c as k,W as w,d as z,T as B,p as W,A as Y,h as j,X as q,Y as G,Z as H}from"./chunks/icons/Add.js";export{a as Children,t as Component,n as Fragment,r as PureComponent,u as StrictMode,o as Suspense,d as SuspenseList,l as __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,c as cloneElement,i as createContext,m as createElement,f as createFactory,E as createPortal,_ as createRef,S as default,p as findDOMNode,C as flushSync,R as forwardRef,y as hydrate,I as isElement,L as isFragment,N as isMemo,O as isValidElement,T as lazy,b as memo,h as render,x as startTransition,D as unmountComponentAtNode,F as unstable_batchedUpdates,M as useCallback,g as useContext,U as useDebugValue,V as useDeferredValue,v as useEffect,A as useErrorBoundary,P as useId,k as useImperativeHandle,w as useInsertionEffect,z as useLayoutEffect,B as useMemo,W as useReducer,Y as useRef,j as useState,q as useSyncExternalStore,G as useTransition,H as version};
3
+ import{N as a,b as t,k as n,C as r,e as u,L as o,U as d,o as l,f as c,G as i,_ as m,i as f,j as E,m as _,R as S,n as p,r as C,s as R,u as y,v as I,w as L,z as N,I as O,F as T,J as b,K as h,M as x,O as D,Q as F,q as M,x as g,P as U,V,y as v,c as A,g as P,d as k,W as w,a as z,T as B,p as W,A as Y,h as j,X as q,Y as G,Z as H}from"./chunks/icons/Add.js";export{a as Children,t as Component,n as Fragment,r as PureComponent,u as StrictMode,o as Suspense,d as SuspenseList,l as __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,c as cloneElement,i as createContext,m as createElement,f as createFactory,E as createPortal,_ as createRef,S as default,p as findDOMNode,C as flushSync,R as forwardRef,y as hydrate,I as isElement,L as isFragment,N as isMemo,O as isValidElement,T as lazy,b as memo,h as render,x as startTransition,D as unmountComponentAtNode,F as unstable_batchedUpdates,M as useCallback,g as useContext,U as useDebugValue,V as useDeferredValue,v as useEffect,A as useErrorBoundary,P as useId,k as useImperativeHandle,w as useInsertionEffect,z as useLayoutEffect,B as useMemo,W as useReducer,Y as useRef,j as useState,q as useSyncExternalStore,G as useTransition,H as version};
4
4
  //# sourceMappingURL=preact-compat.js.map
package/preact-hooks.js CHANGED
@@ -1,4 +1,4 @@
1
1
  /*! Copyright 2025 Adobe
2
2
  All Rights Reserved. */
3
- import{q as a,x as u,P as t,y as r,a as o,g as f,c,d,T as l,p as m,A as n,h as p}from"./chunks/icons/Add.js";export{a as useCallback,u as useContext,t as useDebugValue,r as useEffect,o as useErrorBoundary,f as useId,c as useImperativeHandle,d as useLayoutEffect,l as useMemo,m as useReducer,n as useRef,p as useState};
3
+ import{q as a,x as u,P as t,y as r,c as o,g as f,d as c,a as d,T as l,p as m,A as n,h as p}from"./chunks/icons/Add.js";export{a as useCallback,u as useContext,t as useDebugValue,r as useEffect,o as useErrorBoundary,f as useId,c as useImperativeHandle,d as useLayoutEffect,l as useMemo,m as useReducer,n as useRef,p as useState};
4
4
  //# sourceMappingURL=preact-hooks.js.map
@@ -3,9 +3,9 @@ import { SVGProps } from 'preact/compat';
3
3
 
4
4
  export type IconType = keyof typeof import('@adobe-commerce/elsie/icons');
5
5
  export interface IconProps extends Omit<SVGProps<SVGSVGElement>, 'size'> {
6
- source: FunctionComponent<SVGProps<SVGSVGElement> & {
6
+ source?: FunctionComponent<SVGProps<SVGSVGElement> & {
7
7
  title?: string;
8
- }> | IconType;
8
+ }> | IconType | string;
9
9
  size?: '12' | '16' | '24' | '32' | '64' | '80';
10
10
  stroke?: '1' | '2' | '3' | '4';
11
11
  className?: string;
@@ -0,0 +1,9 @@
1
+ import { ComponentChildren } from 'preact';
2
+ import { FunctionComponent } from 'preact/compat';
3
+
4
+ interface PortalProps {
5
+ children: ComponentChildren;
6
+ }
7
+ export declare const Portal: FunctionComponent<PortalProps>;
8
+ export {};
9
+ //# sourceMappingURL=Portal.d.ts.map
@@ -40,4 +40,5 @@ export { default as EmptyBox } from './EmptyBox.svg';
40
40
  export { default as Coupon } from './Coupon.svg';
41
41
  export { default as Gift } from './Gift.svg';
42
42
  export { default as GiftCard } from './GiftCard.svg';
43
+ export { default as Edit } from './Edit.svg';
43
44
  //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,91 @@
1
+ import { ImageProps } from '../../components';
2
+
3
+ declare const AEM_ASSETS_FORMATS: readonly ["gif", "jpg", "jpeg", "png", "webp"];
4
+ declare const AEM_ASSETS_ALLOWED_ROTATIONS: readonly [90, 180, 270];
5
+ declare const AEM_ASSETS_ALLOWED_FLIPS: readonly ["h", "v", "hv"];
6
+ /** The allowed formats for the `AEM Assets` image optimization API. */
7
+ export type AemAssetsFormat = (typeof AEM_ASSETS_FORMATS)[number];
8
+ /** The allowed rotations for the `AEM Assets` image optimization API. */
9
+ export type AemAssetsRotation = (typeof AEM_ASSETS_ALLOWED_ROTATIONS)[number];
10
+ /** The allowed flips for the `AEM Assets` image optimization API. */
11
+ export type AemAssetsFlip = (typeof AEM_ASSETS_ALLOWED_FLIPS)[number];
12
+ /**
13
+ * Defines a crop region of an image.
14
+ * @example
15
+ * ```ts
16
+ * // Crop the image to a 80% width and height, starting at 10% from the top and left.
17
+ * const cropSettings: AemAssetsCropSettings = {
18
+ * xOrigin: 10,
19
+ * yOrigin: 10,
20
+ * width: 80,
21
+ * height: 80,
22
+ * };
23
+ */
24
+ export interface AemAssetsCropSettings {
25
+ /** The (relative) x origin of the crop (between 0 and 100) */
26
+ xOrigin?: number;
27
+ /** The (relative) y origin of the crop (between 0 and 100) */
28
+ yOrigin?: number;
29
+ /** The width of the crop (between 0 and 100) */
30
+ width?: number;
31
+ /** The height of the crop (between 0 and 100) */
32
+ height?: number;
33
+ }
34
+ /**
35
+ * The parameters accepted by the `AEM Assets` image optimization API.
36
+ * @see https://adobe-aem-assets-delivery-experimental.redoc.ly/
37
+ */
38
+ export interface AemAssetsParams {
39
+ format: AemAssetsFormat;
40
+ rotate?: AemAssetsRotation;
41
+ flip?: AemAssetsFlip;
42
+ crop?: AemAssetsCropSettings;
43
+ width?: number;
44
+ height?: number;
45
+ quality?: number;
46
+ attachment?: boolean;
47
+ sharpen?: boolean;
48
+ blur?: number;
49
+ dpr?: number;
50
+ smartCrop?: string;
51
+ [key: string]: unknown;
52
+ }
53
+ type WithRequired<T, K extends keyof T> = T & {
54
+ [P in K]-?: T[P];
55
+ };
56
+ /** The parameters to be applied to the asset (known width required when using a slot) */
57
+ export type AemAssetsImageSlotConfigParams = WithRequired<Partial<AemAssetsParams>, 'width'>;
58
+ /** The configuration for an image slot. */
59
+ export interface AemAssetsImageSlotConfig {
60
+ /** The alias (i.e. seoName) of the image */
61
+ alias: string;
62
+ /** The props to be applied to the underlying {@link Image} component */
63
+ imageProps: Partial<Omit<ImageProps, 'params' | 'width' | 'height'>> & {
64
+ src: string;
65
+ };
66
+ /** The parameters to be applied to the asset (known width required when using a slot) */
67
+ params: AemAssetsImageSlotConfigParams;
68
+ /** The element that will contain the image in the slot */
69
+ wrapper?: HTMLElement;
70
+ }
71
+ interface RenderContext {
72
+ replaceWith: (element: HTMLElement) => void;
73
+ }
74
+ /** Returns whether AEM Assets is enabled in the Storefront. */
75
+ export declare function isAemAssetsEnabled(): boolean;
76
+ /** The default optimization parameters used globally, unless overriden (per use). */
77
+ export declare function getDefaultAemAssetsOptimizationParams(): AemAssetsParams;
78
+ /** Returns true if the given URL is an AEM Assets URL. */
79
+ export declare function isAemAssetsUrl(url: string | URL): boolean;
80
+ /** Generates an optimized URL for AEM Assets. */
81
+ export declare function generateAemAssetsOptimizedUrl(assetUrl: string, alias: string, params?: Partial<AemAssetsParams>): string;
82
+ /**
83
+ * Tries to generate an optimized URL for AEM Assets. Returns the given
84
+ * url if AEM Assets is not enabled or is not an AEM Assets URL.
85
+ */
86
+ export declare function tryGenerateAemAssetsOptimizedUrl(assetUrl: string, alias: string, params?: Partial<AemAssetsParams>): string;
87
+ /** Creates a slot that renders an AEM Assets image. */
88
+ export declare function makeAemAssetsImageSlot(config: AemAssetsImageSlotConfig): (ctx: RenderContext) => void;
89
+ export declare function tryRenderAemAssetsImage(ctx: RenderContext, config: AemAssetsImageSlotConfig): void;
90
+ export {};
91
+ //# sourceMappingURL=assets.d.ts.map