@fayz-ai/shop 0.12.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/data/supabase-provider.d.ts +2 -2
- package/dist/data/supabase-provider.d.ts.map +1 -1
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +99 -6
- package/dist/index.js.map +1 -1
- package/dist/lib/image-delivery.d.ts +28 -0
- package/dist/lib/image-delivery.d.ts.map +1 -0
- package/dist/lib/optimize-upload.d.ts +29 -0
- package/dist/lib/optimize-upload.d.ts.map +1 -0
- package/package.json +4 -4
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export interface ImageVariantOptions {
|
|
2
|
+
/** Target width in CSS pixels; the render keeps the aspect ratio unless `height` is set too. */
|
|
3
|
+
width?: number;
|
|
4
|
+
height?: number;
|
|
5
|
+
/** 20–100. Default 80: visibly lossless for photos at a third of the bytes. */
|
|
6
|
+
quality?: number;
|
|
7
|
+
/** How to fit when both dimensions are given. */
|
|
8
|
+
resize?: 'cover' | 'contain' | 'fill';
|
|
9
|
+
/** Keep the original encoding instead of negotiating WebP. */
|
|
10
|
+
format?: 'origin';
|
|
11
|
+
}
|
|
12
|
+
/** The srcset ladder a product image is offered at. */
|
|
13
|
+
export declare const IMAGE_SRCSET_WIDTHS: readonly number[];
|
|
14
|
+
/** Is this URL a public object in a Supabase Storage bucket (ours or a variant of it)? */
|
|
15
|
+
export declare function isStorageImageUrl(url: string | null | undefined): boolean;
|
|
16
|
+
/**
|
|
17
|
+
* The URL of `url` rendered at `options`, or `url` itself when it is not a
|
|
18
|
+
* storage object (a hotlink, a data URL, a placeholder). Idempotent: a
|
|
19
|
+
* variant URL is re-derived from its object, never stacked.
|
|
20
|
+
*/
|
|
21
|
+
export declare function imageVariantUrl(url: string, options?: ImageVariantOptions): string;
|
|
22
|
+
/**
|
|
23
|
+
* A `srcset` for `url` across `widths`, or undefined when `url` is not a
|
|
24
|
+
* storage object — the caller then leaves the attribute off and the browser
|
|
25
|
+
* loads the one file, as before.
|
|
26
|
+
*/
|
|
27
|
+
export declare function imageSrcSet(url: string, widths?: readonly number[], options?: Omit<ImageVariantOptions, 'width'>): string | undefined;
|
|
28
|
+
//# sourceMappingURL=image-delivery.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"image-delivery.d.ts","sourceRoot":"","sources":["../../src/lib/image-delivery.ts"],"names":[],"mappings":"AAkBA,MAAM,WAAW,mBAAmB;IAClC,gGAAgG;IAChG,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,+EAA+E;IAC/E,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,iDAAiD;IACjD,MAAM,CAAC,EAAE,OAAO,GAAG,SAAS,GAAG,MAAM,CAAA;IACrC,8DAA8D;IAC9D,MAAM,CAAC,EAAE,QAAQ,CAAA;CAClB;AAED,uDAAuD;AACvD,eAAO,MAAM,mBAAmB,EAAE,SAAS,MAAM,EAAoD,CAAA;AAIrG,0FAA0F;AAC1F,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,OAAO,CAEzE;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,GAAE,mBAAwB,GAAG,MAAM,CAWtF;AAED;;;;GAIG;AACH,wBAAgB,WAAW,CACzB,GAAG,EAAE,MAAM,EACX,MAAM,GAAE,SAAS,MAAM,EAAwB,EAC/C,OAAO,GAAE,IAAI,CAAC,mBAAmB,EAAE,OAAO,CAAM,GAC/C,MAAM,GAAG,SAAS,CAGpB"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export interface OptimizeUploadOptions {
|
|
2
|
+
/** The longest edge a source needs. 2000 px covers every slot the storefront draws, at 2×. */
|
|
3
|
+
maxEdge?: number;
|
|
4
|
+
/** WebP quality, 0–1. */
|
|
5
|
+
quality?: number;
|
|
6
|
+
/** Files at most this many bytes AND within bounds are kept as they are. */
|
|
7
|
+
keepUnderBytes?: number;
|
|
8
|
+
}
|
|
9
|
+
export interface UploadPlan {
|
|
10
|
+
action: 'keep' | 'reencode';
|
|
11
|
+
/** Target dimensions when re-encoding. */
|
|
12
|
+
width: number;
|
|
13
|
+
height: number;
|
|
14
|
+
reason: string;
|
|
15
|
+
}
|
|
16
|
+
/** What to do with a file of this type/size/dimensions. */
|
|
17
|
+
export declare function planUpload(meta: {
|
|
18
|
+
type: string;
|
|
19
|
+
size: number;
|
|
20
|
+
width: number;
|
|
21
|
+
height: number;
|
|
22
|
+
}, options?: OptimizeUploadOptions): UploadPlan;
|
|
23
|
+
/**
|
|
24
|
+
* The file to upload: `file` itself, or a WebP re-encoding of it, per
|
|
25
|
+
* `planUpload`. Browser-only; anywhere without `createImageBitmap` and a
|
|
26
|
+
* canvas returns `file` unchanged.
|
|
27
|
+
*/
|
|
28
|
+
export declare function optimizeImageForUpload(file: File, options?: OptimizeUploadOptions): Promise<File>;
|
|
29
|
+
//# sourceMappingURL=optimize-upload.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"optimize-upload.d.ts","sourceRoot":"","sources":["../../src/lib/optimize-upload.ts"],"names":[],"mappings":"AAiBA,MAAM,WAAW,qBAAqB;IACpC,8FAA8F;IAC9F,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,yBAAyB;IACzB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,4EAA4E;IAC5E,cAAc,CAAC,EAAE,MAAM,CAAA;CACxB;AAED,MAAM,WAAW,UAAU;IACzB,MAAM,EAAE,MAAM,GAAG,UAAU,CAAA;IAC3B,0CAA0C;IAC1C,KAAK,EAAE,MAAM,CAAA;IACb,MAAM,EAAE,MAAM,CAAA;IACd,MAAM,EAAE,MAAM,CAAA;CACf;AAID,2DAA2D;AAC3D,wBAAgB,UAAU,CACxB,IAAI,EAAE;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,EACnE,OAAO,GAAE,qBAA0B,GAClC,UAAU,CAiBZ;AAED;;;;GAIG;AACH,wBAAsB,sBAAsB,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,GAAE,qBAA0B,GAAG,OAAO,CAAC,IAAI,CAAC,CA+B3G"}
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"fayz": {
|
|
4
4
|
"status": "beta"
|
|
5
5
|
},
|
|
6
|
-
"version": "0.
|
|
6
|
+
"version": "0.13.1",
|
|
7
7
|
"description": "Fayz SDK ecommerce layer — products, orders, customers, discounts, shipping",
|
|
8
8
|
"type": "module",
|
|
9
9
|
"sideEffects": false,
|
|
@@ -99,10 +99,10 @@
|
|
|
99
99
|
"access": "public"
|
|
100
100
|
},
|
|
101
101
|
"scripts": {
|
|
102
|
-
"build": "tsup && tsc
|
|
102
|
+
"build": "tsup && tsc -b --force",
|
|
103
103
|
"dev": "tsup --watch",
|
|
104
|
-
"typecheck": "tsc
|
|
104
|
+
"typecheck": "tsc -b tsconfig.test.json",
|
|
105
105
|
"test": "vitest run",
|
|
106
|
-
"clean": "rm -rf dist"
|
|
106
|
+
"clean": "rm -rf dist .tsbuildinfo"
|
|
107
107
|
}
|
|
108
108
|
}
|