@thexjs/core 1.2.4 → 1.3.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.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as react from 'react';
2
- import { ComponentType, ReactNode, AnchorHTMLAttributes } from 'react';
2
+ import { ComponentType, ReactNode, CSSProperties, AnchorHTMLAttributes } from 'react';
3
3
 
4
4
  type RouteMode = "static" | "server";
5
5
  interface BuildOptions {
@@ -523,6 +523,48 @@ declare function createApp(options: CreateAppOptions): Promise<AppServeOptions>;
523
523
 
524
524
  declare function renderErrorOverlay(error: unknown): string;
525
525
 
526
+ interface ImageProps {
527
+ src: string;
528
+ alt: string;
529
+ /** Intrinsic width in px. Omitted when using `fill`. */
530
+ width?: number;
531
+ /** Intrinsic height in px. Omitted when using `fill`. */
532
+ height?: number;
533
+ /** `sizes` attribute for responsive srcset. */
534
+ sizes?: string;
535
+ /** LCP image — skips lazy-loading, adds fetchpriority="high". */
536
+ priority?: boolean;
537
+ /** Absolutely-fill the parent (hero/card layouts). Mutually exclusive with width/height. */
538
+ fill?: boolean;
539
+ /** Blur placeholder mode. Requires blurDataURL for a visible effect. */
540
+ placeholder?: "blur" | "empty";
541
+ /** Tiny base64 image used as the blur placeholder until the real image loads. */
542
+ blurDataURL?: string;
543
+ /** 1-100, forwarded to the proxy as `&q=` (validated-and-ignored until a resizer exists). */
544
+ quality?: number;
545
+ className?: string;
546
+ style?: CSSProperties;
547
+ children?: ReactNode;
548
+ }
549
+ /** Candidate widths for srcset generation (px), spread across common breakpoints/DPR. */
550
+ declare const SRCSET_WIDTHS: number[];
551
+ /**
552
+ * Generates a responsive srcset for a remote image by appending width params
553
+ * to the proxy URL (`/_x/image?url=...&w=640`, ...) — only when the src is
554
+ * remote and its host is in the allow-list. Local images have no resize
555
+ * pipeline, so they return undefined and use the intrinsic src.
556
+ */
557
+ declare function buildSrcSet(src: string, opts?: {
558
+ quality?: number;
559
+ remoteHosts?: string[];
560
+ }): string | undefined;
561
+ /**
562
+ * Set an explicit remote-host allow-list so dev-mode warnings can fail fast
563
+ * on a remote src whose host isn't configured. Mirrors x.config images.remoteHosts.
564
+ */
565
+ declare function setImageRemoteHosts(hosts: string[]): void;
566
+ declare function Image(props: ImageProps): ReactNode;
567
+
526
568
  type IslandMode = "idle" | "visible" | "load";
527
569
  interface IslandEntry {
528
570
  name: string;
@@ -626,4 +668,4 @@ declare function resetServerFunctions(): void;
626
668
  declare function registerServerFunctions(routePath: string, paramNames: string[], fns: Record<string, (...args: unknown[]) => Promise<unknown>>): void;
627
669
  declare function getServerFunctionHandler(csrfOptions?: CsrfOptions): (req: Request) => Promise<Response | null>;
628
670
 
629
- export { type BuildOptions, CLIENT_NAV_SCRIPT, type ContentEntry, type CounterSeries, type CreateAppOptions, type CsrfOptions, type CsrfResult, DEFAULT_HISTOGRAM_BUCKETS_MS, DefaultNotFound, EnvLeakageError, type ErrorContext, type ErrorReporter, type Frontmatter, type HealthCheck, type HealthCheckOptions, type HistogramSeries, type ImageProxyOptions, type InMemoryMetricsOptions, type InMemoryMetricsReporter, Island, type IslandEntry, type IslandMode, IslandProvider, type LayoutEntry, Link, type LinkProps, type LoaderArgs, type LoaderReturn, type LogFields, type Logger, type MetricLabels, type MetricsReporter, type MetricsSnapshot, type MiddlewareContext, type MiddlewareEntry, type MiddlewareFn, type MiddlewareNext, type NotFoundEntry, type OtelMeterLike, type OtelTracerLike, PUBLIC_ENV_PREFIX, type RateLimitOptions, type RateLimitResult, type RateLimitStore, type ReadinessResult, type RevalidateOptions, type RouteEntry, type RouteMode, type RouteProps, type SecurityHeadersOptions, type SentryLike, applySecurityHeaders, assertNoEnvLeakage, build, buildSecurityHeaders, checkCsrf, combineReporters, composeMiddleware, createApp, createHealthCheckHandler, createImageProxyHandler, createInMemoryMetrics, createOtelReporter, createOtlpMetricsReporter, createRateLimiter, createRedisRateLimitStore, createSentryReporter, defineConfig, escapeHtml, findLayoutChain, findLeakedEnvKeys, findMiddlewareChain, generateCsrfToken, generateManifestSource, generateServerFunctionClient, getErrorReporter, getServerFunctionHandler, logger, noopMetrics, noopReporter, rateLimitMiddleware, registerServerFunctions, renderErrorOverlay, renderMarkdown, renderPage, renderStaticPage, renderStreamingPage, reportException, resetServerFunctions, scanApiDir, scanContent, scanLayouts, scanLayoutsDir, scanMiddleware, scanNotFound, scanPages, scanRoutes, setErrorReporter, verifyCsrfToken, verifyOrigin, withCsrfCookie, withRequestLogging, withRequestMetrics, writeManifest };
671
+ export { type BuildOptions, CLIENT_NAV_SCRIPT, type ContentEntry, type CounterSeries, type CreateAppOptions, type CsrfOptions, type CsrfResult, DEFAULT_HISTOGRAM_BUCKETS_MS, DefaultNotFound, EnvLeakageError, type ErrorContext, type ErrorReporter, type Frontmatter, type HealthCheck, type HealthCheckOptions, type HistogramSeries, Image, type ImageProps, type ImageProxyOptions, type InMemoryMetricsOptions, type InMemoryMetricsReporter, Island, type IslandEntry, type IslandMode, IslandProvider, type LayoutEntry, Link, type LinkProps, type LoaderArgs, type LoaderReturn, type LogFields, type Logger, type MetricLabels, type MetricsReporter, type MetricsSnapshot, type MiddlewareContext, type MiddlewareEntry, type MiddlewareFn, type MiddlewareNext, type NotFoundEntry, type OtelMeterLike, type OtelTracerLike, PUBLIC_ENV_PREFIX, type RateLimitOptions, type RateLimitResult, type RateLimitStore, type ReadinessResult, type RevalidateOptions, type RouteEntry, type RouteMode, type RouteProps, SRCSET_WIDTHS, type SecurityHeadersOptions, type SentryLike, applySecurityHeaders, assertNoEnvLeakage, build, buildSecurityHeaders, buildSrcSet, checkCsrf, combineReporters, composeMiddleware, createApp, createHealthCheckHandler, createImageProxyHandler, createInMemoryMetrics, createOtelReporter, createOtlpMetricsReporter, createRateLimiter, createRedisRateLimitStore, createSentryReporter, defineConfig, escapeHtml, findLayoutChain, findLeakedEnvKeys, findMiddlewareChain, generateCsrfToken, generateManifestSource, generateServerFunctionClient, getErrorReporter, getServerFunctionHandler, logger, noopMetrics, noopReporter, rateLimitMiddleware, registerServerFunctions, renderErrorOverlay, renderMarkdown, renderPage, renderStaticPage, renderStreamingPage, reportException, resetServerFunctions, scanApiDir, scanContent, scanLayouts, scanLayoutsDir, scanMiddleware, scanNotFound, scanPages, scanRoutes, setErrorReporter, setImageRemoteHosts, verifyCsrfToken, verifyOrigin, withCsrfCookie, withRequestLogging, withRequestMetrics, writeManifest };