@pyreon/zero 0.12.2 → 0.12.4
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/lib/actions.js +97 -0
- package/lib/actions.js.map +1 -0
- package/lib/ai.js +503 -0
- package/lib/ai.js.map +1 -0
- package/lib/api-routes.js +137 -0
- package/lib/api-routes.js.map +1 -0
- package/lib/compression.js +80 -0
- package/lib/compression.js.map +1 -0
- package/lib/cors.js +57 -0
- package/lib/cors.js.map +1 -0
- package/lib/csp.js +119 -0
- package/lib/csp.js.map +1 -0
- package/lib/env.js +217 -0
- package/lib/env.js.map +1 -0
- package/lib/favicon.js +424 -0
- package/lib/favicon.js.map +1 -0
- package/lib/i18n-routing.js +167 -0
- package/lib/i18n-routing.js.map +1 -0
- package/lib/index.js +340 -4015
- package/lib/index.js.map +1 -1
- package/lib/link.js +5 -0
- package/lib/link.js.map +1 -1
- package/lib/logger.js +78 -0
- package/lib/logger.js.map +1 -0
- package/lib/meta.js +310 -0
- package/lib/meta.js.map +1 -0
- package/lib/middleware.js +53 -0
- package/lib/middleware.js.map +1 -0
- package/lib/og-image.js +233 -0
- package/lib/og-image.js.map +1 -0
- package/lib/rate-limit.js +76 -0
- package/lib/rate-limit.js.map +1 -0
- package/lib/server.js +1534 -0
- package/lib/server.js.map +1 -0
- package/lib/testing.js +179 -0
- package/lib/testing.js.map +1 -0
- package/lib/theme.js +11 -2
- package/lib/theme.js.map +1 -1
- package/lib/types/actions.d.ts +27 -24
- package/lib/types/actions.d.ts.map +1 -1
- package/lib/types/ai.d.ts +76 -95
- package/lib/types/ai.d.ts.map +1 -1
- package/lib/types/api-routes.d.ts +37 -33
- package/lib/types/api-routes.d.ts.map +1 -1
- package/lib/types/cache.d.ts +26 -22
- package/lib/types/cache.d.ts.map +1 -1
- package/lib/types/client.d.ts +13 -9
- package/lib/types/client.d.ts.map +1 -1
- package/lib/types/compression.d.ts +14 -10
- package/lib/types/compression.d.ts.map +1 -1
- package/lib/types/config.d.ts +39 -4
- package/lib/types/config.d.ts.map +1 -1
- package/lib/types/cors.d.ts +20 -16
- package/lib/types/cors.d.ts.map +1 -1
- package/lib/types/csp.d.ts +42 -61
- package/lib/types/csp.d.ts.map +1 -1
- package/lib/types/env.d.ts +26 -26
- package/lib/types/env.d.ts.map +1 -1
- package/lib/types/favicon.d.ts +58 -54
- package/lib/types/favicon.d.ts.map +1 -1
- package/lib/types/font.d.ts +68 -65
- package/lib/types/font.d.ts.map +1 -1
- package/lib/types/i18n-routing.d.ts +43 -37
- package/lib/types/i18n-routing.d.ts.map +1 -1
- package/lib/types/image-plugin.d.ts +49 -45
- package/lib/types/image-plugin.d.ts.map +1 -1
- package/lib/types/image.d.ts +47 -36
- package/lib/types/image.d.ts.map +1 -1
- package/lib/types/index.d.ts +594 -56
- package/lib/types/index.d.ts.map +1 -1
- package/lib/types/link.d.ts +61 -56
- package/lib/types/link.d.ts.map +1 -1
- package/lib/types/logger.d.ts +37 -48
- package/lib/types/logger.d.ts.map +1 -1
- package/lib/types/meta.d.ts +145 -105
- package/lib/types/meta.d.ts.map +1 -1
- package/lib/types/middleware.d.ts +8 -4
- package/lib/types/middleware.d.ts.map +1 -1
- package/lib/types/og-image.d.ts +63 -59
- package/lib/types/og-image.d.ts.map +1 -1
- package/lib/types/rate-limit.d.ts +20 -16
- package/lib/types/rate-limit.d.ts.map +1 -1
- package/lib/types/script.d.ts +23 -19
- package/lib/types/script.d.ts.map +1 -1
- package/lib/types/seo.d.ts +47 -43
- package/lib/types/seo.d.ts.map +1 -1
- package/lib/types/server.d.ts +455 -0
- package/lib/types/server.d.ts.map +1 -0
- package/lib/types/testing.d.ts +64 -27
- package/lib/types/testing.d.ts.map +1 -1
- package/lib/types/theme.d.ts +22 -12
- package/lib/types/theme.d.ts.map +1 -1
- package/package.json +17 -12
- package/src/actions.ts +1 -3
- package/src/adapters/bun.ts +2 -0
- package/src/adapters/cloudflare.ts +2 -0
- package/src/adapters/netlify.ts +2 -0
- package/src/adapters/node.ts +2 -0
- package/src/adapters/validate.ts +16 -0
- package/src/adapters/vercel.ts +2 -0
- package/src/compression.ts +19 -3
- package/src/entry-server.ts +28 -5
- package/src/index.ts +20 -182
- package/src/link.tsx +6 -0
- package/src/meta.tsx +78 -16
- package/src/rate-limit.ts +11 -9
- package/src/server.ts +70 -0
- package/src/theme.tsx +12 -1
- package/src/vite-plugin.ts +5 -1
- package/lib/fs-router-Dil4IKZR.js +0 -290
- package/lib/fs-router-Dil4IKZR.js.map +0 -1
- package/lib/types/adapters/bun.d.ts +0 -6
- package/lib/types/adapters/bun.d.ts.map +0 -1
- package/lib/types/adapters/cloudflare.d.ts +0 -26
- package/lib/types/adapters/cloudflare.d.ts.map +0 -1
- package/lib/types/adapters/index.d.ts +0 -13
- package/lib/types/adapters/index.d.ts.map +0 -1
- package/lib/types/adapters/netlify.d.ts +0 -21
- package/lib/types/adapters/netlify.d.ts.map +0 -1
- package/lib/types/adapters/node.d.ts +0 -6
- package/lib/types/adapters/node.d.ts.map +0 -1
- package/lib/types/adapters/static.d.ts +0 -7
- package/lib/types/adapters/static.d.ts.map +0 -1
- package/lib/types/adapters/vercel.d.ts +0 -21
- package/lib/types/adapters/vercel.d.ts.map +0 -1
- package/lib/types/app.d.ts +0 -24
- package/lib/types/app.d.ts.map +0 -1
- package/lib/types/entry-server.d.ts +0 -37
- package/lib/types/entry-server.d.ts.map +0 -1
- package/lib/types/error-overlay.d.ts +0 -6
- package/lib/types/error-overlay.d.ts.map +0 -1
- package/lib/types/fs-router.d.ts +0 -47
- package/lib/types/fs-router.d.ts.map +0 -1
- package/lib/types/isr.d.ts +0 -9
- package/lib/types/isr.d.ts.map +0 -1
- package/lib/types/not-found.d.ts +0 -7
- package/lib/types/not-found.d.ts.map +0 -1
- package/lib/types/types.d.ts +0 -111
- package/lib/types/types.d.ts.map +0 -1
- package/lib/types/utils/use-intersection-observer.d.ts +0 -10
- package/lib/types/utils/use-intersection-observer.d.ts.map +0 -1
- package/lib/types/utils/with-headers.d.ts +0 -6
- package/lib/types/utils/with-headers.d.ts.map +0 -1
- package/lib/types/vite-plugin.d.ts +0 -17
- package/lib/types/vite-plugin.d.ts.map +0 -1
|
@@ -1,51 +1,55 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
1
|
+
import * as _pyreon_core0 from "@pyreon/core";
|
|
2
|
+
import * as _pyreon_reactivity0 from "@pyreon/reactivity";
|
|
3
|
+
import { Plugin } from "vite";
|
|
4
|
+
|
|
5
|
+
//#region src/i18n-routing.d.ts
|
|
6
|
+
interface I18nRoutingConfig {
|
|
7
|
+
/** Supported locales. e.g. ["en", "de", "cs"] */
|
|
8
|
+
locales: string[];
|
|
9
|
+
/** Default locale — served without prefix (/ instead of /en/). */
|
|
10
|
+
defaultLocale: string;
|
|
11
|
+
/** Redirect root to detected locale. Default: true */
|
|
12
|
+
detectLocale?: boolean;
|
|
13
|
+
/** Cookie name to persist locale preference. Default: "locale" */
|
|
14
|
+
cookieName?: string;
|
|
15
|
+
/** URL strategy. Default: "prefix-except-default" */
|
|
16
|
+
strategy?: 'prefix' | 'prefix-except-default';
|
|
13
17
|
}
|
|
14
|
-
|
|
15
|
-
|
|
18
|
+
interface LocaleContext {
|
|
19
|
+
/** Current locale code. e.g. "en", "de" */
|
|
20
|
+
locale: string;
|
|
21
|
+
/** All supported locales. */
|
|
22
|
+
locales: string[];
|
|
23
|
+
/** Default locale. */
|
|
24
|
+
defaultLocale: string;
|
|
25
|
+
/** Build a localized path. e.g. localePath("/about", "de") → "/de/about" */
|
|
26
|
+
localePath: (path: string, locale?: string) => string;
|
|
27
|
+
/** Get hreflang alternates for the current path. */
|
|
28
|
+
alternates: () => Array<{
|
|
16
29
|
locale: string;
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
/** Default locale. */
|
|
20
|
-
defaultLocale: string;
|
|
21
|
-
/** Build a localized path. e.g. localePath("/about", "de") → "/de/about" */
|
|
22
|
-
localePath: (path: string, locale?: string) => string;
|
|
23
|
-
/** Get hreflang alternates for the current path. */
|
|
24
|
-
alternates: () => Array<{
|
|
25
|
-
locale: string;
|
|
26
|
-
url: string;
|
|
27
|
-
}>;
|
|
30
|
+
url: string;
|
|
31
|
+
}>;
|
|
28
32
|
}
|
|
29
33
|
/**
|
|
30
34
|
* Detect preferred locale from Accept-Language header.
|
|
31
35
|
*/
|
|
32
|
-
|
|
36
|
+
declare function detectLocaleFromHeader(acceptLanguage: string | null | undefined, locales: string[], defaultLocale: string): string;
|
|
33
37
|
/**
|
|
34
38
|
* Extract locale from a URL path.
|
|
35
39
|
* Returns { locale, pathWithoutLocale }.
|
|
36
40
|
*/
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
41
|
+
declare function extractLocaleFromPath(path: string, locales: string[], defaultLocale: string): {
|
|
42
|
+
locale: string;
|
|
43
|
+
pathWithoutLocale: string;
|
|
40
44
|
};
|
|
41
45
|
/**
|
|
42
46
|
* Build a localized path.
|
|
43
47
|
*/
|
|
44
|
-
|
|
48
|
+
declare function buildLocalePath(path: string, locale: string, defaultLocale: string, strategy: 'prefix' | 'prefix-except-default'): string;
|
|
45
49
|
/**
|
|
46
50
|
* Create a LocaleContext for use in components and loaders.
|
|
47
51
|
*/
|
|
48
|
-
|
|
52
|
+
declare function createLocaleContext(locale: string, path: string, config: I18nRoutingConfig): LocaleContext;
|
|
49
53
|
/**
|
|
50
54
|
* I18n routing middleware for Zero's server.
|
|
51
55
|
*
|
|
@@ -68,11 +72,11 @@ export declare function createLocaleContext(locale: string, path: string, config
|
|
|
68
72
|
* })
|
|
69
73
|
* ```
|
|
70
74
|
*/
|
|
71
|
-
|
|
75
|
+
declare function i18nRouting(config: I18nRoutingConfig): Plugin;
|
|
72
76
|
/** @internal Context for the current locale. */
|
|
73
|
-
|
|
77
|
+
declare const LocaleCtx: _pyreon_core0.Context<string>;
|
|
74
78
|
/** Current locale signal — set by the server middleware or client-side detection. */
|
|
75
|
-
|
|
79
|
+
declare const localeSignal: _pyreon_reactivity0.Signal<string>;
|
|
76
80
|
/**
|
|
77
81
|
* Read the current locale reactively.
|
|
78
82
|
*
|
|
@@ -85,7 +89,7 @@ export declare const localeSignal: import("@pyreon/reactivity").Signal<string>;
|
|
|
85
89
|
* const locale = useLocale() // "en", "de", etc.
|
|
86
90
|
* ```
|
|
87
91
|
*/
|
|
88
|
-
|
|
92
|
+
declare function useLocale(): string;
|
|
89
93
|
/**
|
|
90
94
|
* Set the locale client-side and update the URL.
|
|
91
95
|
*
|
|
@@ -94,5 +98,7 @@ export declare function useLocale(): string;
|
|
|
94
98
|
* <button onClick={() => setLocale('de')}>Deutsch</button>
|
|
95
99
|
* ```
|
|
96
100
|
*/
|
|
97
|
-
|
|
98
|
-
//#
|
|
101
|
+
declare function setLocale(locale: string, config: I18nRoutingConfig): void;
|
|
102
|
+
//#endregion
|
|
103
|
+
export { I18nRoutingConfig, LocaleContext, LocaleCtx, buildLocalePath, createLocaleContext, detectLocaleFromHeader, extractLocaleFromPath, i18nRouting, localeSignal, setLocale, useLocale };
|
|
104
|
+
//# sourceMappingURL=i18n-routing2.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"i18n-
|
|
1
|
+
{"version":3,"file":"i18n-routing2.d.ts","names":[],"sources":["../../../src/i18n-routing.ts"],"mappings":";;;;;UAiBiB,iBAAA;;EAEf,OAAA;;EAEA,aAAA;EAJgC;EAMhC,YAAA;EANgC;EAQhC,UAAA;EAJA;EAMA,QAAA;AAAA;AAAA,UAGe,aAAA;EAHP;EAKR,MAAA;EAFe;EAIf,OAAA;;EAEA,aAAA;EAJA;EAMA,UAAA,GAAa,IAAA,UAAc,MAAA;EAF3B;EAIA,UAAA,QAAkB,KAAA;IAAQ,MAAA;IAAgB,GAAA;EAAA;AAAA;;;;iBAM5B,sBAAA,CACd,cAAA,6BACA,OAAA,YACA,aAAA;AAHF;;;;AAAA,iBA8BgB,qBAAA,CACd,IAAA,UACA,OAAA,YACA,aAAA;EACG,MAAA;EAAgB,iBAAA;AAAA;;AAJrB;;iBAqBgB,eAAA,CACd,IAAA,UACA,MAAA,UACA,aAAA,UACA,QAAA;;;;iBAYc,mBAAA,CACd,MAAA,UACA,IAAA,UACA,MAAA,EAAQ,iBAAA,GACP,aAAA;;;;;AApBH;;;;;;;;;;AAgBA;;;;;;;;iBAyDgB,WAAA,CAAY,MAAA,EAAQ,iBAAA,GAAoB,MAAA;;cA2E3C,SAAA,EAAuC,aAAA,CAA9B,OAAA;AA3EtB;AAAA,cA8Ea,YAAA,EAA2B,mBAAA,CAAf,MAAA;;;;;;;;AAHzB;;;;;iBAiBgB,SAAA,CAAA;;;;;AAAhB;;;;iBAYgB,SAAA,CACd,MAAA,UACA,MAAA,EAAQ,iBAAA"}
|
|
@@ -1,45 +1,47 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
1
|
+
import { Plugin } from "vite";
|
|
2
|
+
|
|
3
|
+
//#region src/image-plugin.d.ts
|
|
4
|
+
interface ImagePluginConfig {
|
|
5
|
+
/** Output directory for processed images. Default: "assets/img" */
|
|
6
|
+
outDir?: string;
|
|
7
|
+
/** Default widths for responsive images. Default: [640, 1024, 1920] */
|
|
8
|
+
widths?: number[];
|
|
9
|
+
/** Output formats. Default: ["webp"] */
|
|
10
|
+
formats?: ImageFormat[];
|
|
11
|
+
/** Quality for lossy formats (1-100). Default: 80 */
|
|
12
|
+
quality?: number;
|
|
13
|
+
/** Blur placeholder size in px. Default: 16 */
|
|
14
|
+
placeholderSize?: number;
|
|
15
|
+
/** File patterns to process. Default: /\.(jpe?g|png|webp|avif)$/i */
|
|
16
|
+
include?: RegExp;
|
|
15
17
|
}
|
|
16
|
-
|
|
18
|
+
type ImageFormat = 'webp' | 'avif' | 'jpeg' | 'png';
|
|
17
19
|
/** Per-format source set for <picture> <source> elements. */
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
20
|
+
interface FormatSource {
|
|
21
|
+
/** MIME type. e.g. "image/webp", "image/avif" */
|
|
22
|
+
type: string;
|
|
23
|
+
/** srcset string for this format. e.g. "/img-640.webp 640w, /img-1920.webp 1920w" */
|
|
24
|
+
srcset: string;
|
|
23
25
|
}
|
|
24
|
-
|
|
25
|
-
|
|
26
|
+
interface ProcessedImage {
|
|
27
|
+
/** Fallback source path (last format, largest width). */
|
|
28
|
+
src: string;
|
|
29
|
+
/** Fallback srcset string (last format). */
|
|
30
|
+
srcset: string;
|
|
31
|
+
/** Intrinsic width. */
|
|
32
|
+
width: number;
|
|
33
|
+
/** Intrinsic height. */
|
|
34
|
+
height: number;
|
|
35
|
+
/** Base64 blur placeholder data URI. */
|
|
36
|
+
placeholder: string;
|
|
37
|
+
/** Per-format source sets for <picture> element. Ordered by priority (best format first). */
|
|
38
|
+
formats: FormatSource[];
|
|
39
|
+
/** Flat list of all sources. */
|
|
40
|
+
sources: Array<{
|
|
26
41
|
src: string;
|
|
27
|
-
/** Fallback srcset string (last format). */
|
|
28
|
-
srcset: string;
|
|
29
|
-
/** Intrinsic width. */
|
|
30
42
|
width: number;
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
/** Base64 blur placeholder data URI. */
|
|
34
|
-
placeholder: string;
|
|
35
|
-
/** Per-format source sets for <picture> element. Ordered by priority (best format first). */
|
|
36
|
-
formats: FormatSource[];
|
|
37
|
-
/** Flat list of all sources. */
|
|
38
|
-
sources: Array<{
|
|
39
|
-
src: string;
|
|
40
|
-
width: number;
|
|
41
|
-
format: string;
|
|
42
|
-
}>;
|
|
43
|
+
format: string;
|
|
44
|
+
}>;
|
|
43
45
|
}
|
|
44
46
|
/**
|
|
45
47
|
* Zero image processing Vite plugin.
|
|
@@ -65,15 +67,17 @@ export interface ProcessedImage {
|
|
|
65
67
|
*
|
|
66
68
|
* <Image {...hero} alt="Hero" priority />
|
|
67
69
|
*/
|
|
68
|
-
|
|
70
|
+
declare function imagePlugin(config?: ImagePluginConfig): Plugin;
|
|
69
71
|
/** @internal Exported for testing */
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
72
|
+
declare function parseJpegDimensions(buffer: Buffer): {
|
|
73
|
+
width: number;
|
|
74
|
+
height: number;
|
|
73
75
|
};
|
|
74
76
|
/** @internal Exported for testing */
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
77
|
+
declare function parseWebPDimensions(buffer: Buffer): {
|
|
78
|
+
width: number;
|
|
79
|
+
height: number;
|
|
78
80
|
};
|
|
79
|
-
//#
|
|
81
|
+
//#endregion
|
|
82
|
+
export { FormatSource, ImageFormat, ImagePluginConfig, ProcessedImage, imagePlugin, parseJpegDimensions, parseWebPDimensions };
|
|
83
|
+
//# sourceMappingURL=image-plugin2.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"image-
|
|
1
|
+
{"version":3,"file":"image-plugin2.d.ts","names":[],"sources":["../../../src/image-plugin.ts"],"mappings":";;;UA+BiB,iBAAA;;EAEf,MAAA;EAFgC;EAIhC,MAAA;EAQgB;EANhB,OAAA,GAAU,WAAA;EAFV;EAIA,OAAA;EAFU;EAIV,eAAA;EAAA;EAEA,OAAA,GAAU,MAAA;AAAA;AAAA,KAGA,WAAA;;UAGK,YAAA;EAHM;EAKrB,IAAA;EALqB;EAOrB,MAAA;AAAA;AAAA,UAGe,cAAA;;EAEf,GAAA;EALM;EAON,MAAA;EAJ6B;EAM7B,KAAA;EAQc;EANd,MAAA;EAJA;EAMA,WAAA;EAFA;EAIA,OAAA,EAAS,YAAA;EAAT;EAEA,OAAA,EAAS,KAAA;IAAQ,GAAA;IAAa,KAAA;IAAe,MAAA;EAAA;AAAA;;;AA6B/C;;;;;;;;;AA4NA;;;;;;;;;;AAqBA;;;iBAjPgB,WAAA,CAAY,MAAA,GAAQ,iBAAA,GAAyB,MAAA;;iBA4N7C,mBAAA,CAAoB,MAAA,EAAQ,MAAA;EAC1C,KAAA;EACA,MAAA;AAAA;;iBAmBc,mBAAA,CAAoB,MAAA,EAAQ,MAAA;EAC1C,KAAA;EACA,MAAA;AAAA"}
|
package/lib/types/image.d.ts
CHANGED
|
@@ -1,38 +1,47 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
width: number;
|
|
10
|
-
/** Intrinsic height of the image. */
|
|
11
|
-
height: number;
|
|
12
|
-
/** Responsive sizes attribute. Default: "100vw" */
|
|
13
|
-
sizes?: string;
|
|
14
|
-
/** Responsive srcset string or source array. */
|
|
15
|
-
srcset?: string | ImageSource[];
|
|
16
|
-
/** Per-format source sets for <picture>. Provided automatically by imagePlugin. */
|
|
17
|
-
formats?: FormatSource[];
|
|
18
|
-
/** Loading strategy. "lazy" uses IntersectionObserver, "eager" loads immediately. Default: "lazy" */
|
|
19
|
-
loading?: 'lazy' | 'eager';
|
|
20
|
-
/** Mark as priority (LCP image). Disables lazy loading, adds fetchPriority="high". */
|
|
21
|
-
priority?: boolean;
|
|
22
|
-
/** Low-quality placeholder image URL or base64 data URI for blur-up effect. */
|
|
23
|
-
placeholder?: string;
|
|
24
|
-
/** CSS class name. */
|
|
25
|
-
class?: string;
|
|
26
|
-
/** Inline styles. */
|
|
27
|
-
style?: string;
|
|
28
|
-
/** CSS object-fit. Default: "cover" */
|
|
29
|
-
fit?: 'cover' | 'contain' | 'fill' | 'none' | 'scale-down';
|
|
30
|
-
/** Decode async. Default: true */
|
|
31
|
-
decoding?: 'sync' | 'async' | 'auto';
|
|
1
|
+
import { VNodeChild } from "@pyreon/core";
|
|
2
|
+
//#region src/image-plugin.d.ts
|
|
3
|
+
/** Per-format source set for <picture> <source> elements. */
|
|
4
|
+
interface FormatSource {
|
|
5
|
+
/** MIME type. e.g. "image/webp", "image/avif" */
|
|
6
|
+
type: string;
|
|
7
|
+
/** srcset string for this format. e.g. "/img-640.webp 640w, /img-1920.webp 1920w" */
|
|
8
|
+
srcset: string;
|
|
32
9
|
}
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
10
|
+
//#endregion
|
|
11
|
+
//#region src/image.d.ts
|
|
12
|
+
interface ImageProps {
|
|
13
|
+
/** Image source URL. */
|
|
14
|
+
src: string;
|
|
15
|
+
/** Alt text (required for accessibility). */
|
|
16
|
+
alt: string;
|
|
17
|
+
/** Intrinsic width of the image. */
|
|
18
|
+
width: number;
|
|
19
|
+
/** Intrinsic height of the image. */
|
|
20
|
+
height: number;
|
|
21
|
+
/** Responsive sizes attribute. Default: "100vw" */
|
|
22
|
+
sizes?: string;
|
|
23
|
+
/** Responsive srcset string or source array. */
|
|
24
|
+
srcset?: string | ImageSource[];
|
|
25
|
+
/** Per-format source sets for <picture>. Provided automatically by imagePlugin. */
|
|
26
|
+
formats?: FormatSource[];
|
|
27
|
+
/** Loading strategy. "lazy" uses IntersectionObserver, "eager" loads immediately. Default: "lazy" */
|
|
28
|
+
loading?: 'lazy' | 'eager';
|
|
29
|
+
/** Mark as priority (LCP image). Disables lazy loading, adds fetchPriority="high". */
|
|
30
|
+
priority?: boolean;
|
|
31
|
+
/** Low-quality placeholder image URL or base64 data URI for blur-up effect. */
|
|
32
|
+
placeholder?: string;
|
|
33
|
+
/** CSS class name. */
|
|
34
|
+
class?: string;
|
|
35
|
+
/** Inline styles. */
|
|
36
|
+
style?: string;
|
|
37
|
+
/** CSS object-fit. Default: "cover" */
|
|
38
|
+
fit?: 'cover' | 'contain' | 'fill' | 'none' | 'scale-down';
|
|
39
|
+
/** Decode async. Default: true */
|
|
40
|
+
decoding?: 'sync' | 'async' | 'auto';
|
|
41
|
+
}
|
|
42
|
+
interface ImageSource {
|
|
43
|
+
src: string;
|
|
44
|
+
width: number;
|
|
36
45
|
}
|
|
37
46
|
/**
|
|
38
47
|
* Optimized image component with lazy loading, responsive images,
|
|
@@ -47,5 +56,7 @@ export interface ImageSource {
|
|
|
47
56
|
* // Manual usage
|
|
48
57
|
* <Image src="/hero.jpg" alt="Hero" width={1200} height={630} />
|
|
49
58
|
*/
|
|
50
|
-
|
|
51
|
-
//#
|
|
59
|
+
declare function Image(props: ImageProps): VNodeChild;
|
|
60
|
+
//#endregion
|
|
61
|
+
export { Image, ImageProps, ImageSource };
|
|
62
|
+
//# sourceMappingURL=image2.d.ts.map
|
package/lib/types/image.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"
|
|
1
|
+
{"version":3,"file":"image2.d.ts","names":[],"sources":["../../../src/image-plugin.ts","../../../src/image.tsx"],"mappings":";;;UAiDiB,YAAA;EC3Bf;ED6BA,IAAA;ECzBA;ED2BA,MAAA;AAAA;;;UCrCe,UAAA;;EAEf,GAAA;ED+B2B;EC7B3B,GAAA;ED+BA;EC7BA,KAAA;;EAEA,MAAA;;EAEA,KAAA;EAVyB;EAYzB,MAAA,YAAkB,WAAA;EAEI;EAAtB,OAAA,GAAU,YAAA;EAVV;EAYA,OAAA;EARA;EAUA,QAAA;EANA;EAQA,WAAA;EANA;EAQA,KAAA;EANA;EAQA,KAAA;EAJA;EAMA,GAAA;EAFA;EAIA,QAAA;AAAA;AAAA,UAGe,WAAA;EACf,GAAA;EACA,KAAA;AAAA;;;;AAgBF;;;;;;;;;;iBAAgB,KAAA,CAAM,KAAA,EAAO,UAAA,GAAa,UAAA"}
|