@stacksjs/stx
Version:
A performant UI Framework. Powered by Bun.
34 lines • 1.16 kB
TypeScript
import { } from './signature';
import type { ProtectedMediaProps, } from '../types';
/**
* Render a protected image component
*
* @example
* ```typescript
* const html = await renderProtectedImg({
* src: '/api/media/secure-image.jpg',
* alt: 'Secure content',
* signatureEndpoint: '/api/sign',
* auth: { role: 'premium' },
* })
* ```
*/
export declare function renderProtectedImg(props: ProtectedMediaProps): Promise<{ html: string; script?: string }>;
/**
* Render a protected video component
*/
export declare function renderProtectedVideo(props: ProtectedMediaProps & {
poster?: string
controls?: boolean
autoplay?: boolean
muted?: boolean
loop?: boolean
}): Promise<{ html: string; script?: string }>;
/**
* Collect all protected media elements from content and batch sign
*/
export declare function processProtectedMedia(content: string, signatureEndpoint: string): Promise<{ html: string; script: string }>;
/**
* Parse @protected directive arguments
*/
export declare function parseProtectedArgs(content: string, params: Record<string, unknown>, context: Record<string, unknown>): ProtectedMediaProps;