UNPKG

@htmlbricks/hb-bundle

Version:

Single IIFE loader for all HTML Bricks hb-* web components from the jsDelivr CDN, with optional Subresource Integrity; includes agent/LLM docs and theme CSS variables.

52 lines (45 loc) 1.92 kB
/** * Svelte template typings for `hb-page-checkout` (`SvelteHTMLElements`). * — Host attributes from `Component` (optional strings). * — Custom events from `Events`: `on` + event key, optional `capture` suffix, or quoted `'on:'` + key (same pattern as built-in DOM events in Svelte). * Generated — do not edit by hand. * Requires dependency on `svelte` (for `svelte/elements`). */ import type { HTMLAttributes } from "svelte/elements"; import type { Component, Events } from "./webcomponent.type"; /** * Keys already modeled on `HTMLAttributes` (global attrs + DOM listeners). Exclude these from * `Component` so host props stay plain strings and are not merged with unrelated DOM typings. */ type HtmlReservedAttrKeys = keyof HTMLAttributes<HTMLElement>; type HbSvelteAttrs = { [K in keyof Component as K extends HtmlReservedAttrKeys ? never : K]?: string; }; /** `detail` matches `Events[K]`; `currentTarget` is the host element. */ type HbSvelteCustomEventHandler<TDetail> = ( event: CustomEvent<TDetail> & { currentTarget: EventTarget & HTMLElement } ) => any; type HbSvelteEventAttrs = { [K in keyof Events & string as `on${K}`]?: HbSvelteCustomEventHandler<Events[K]>; } & { [K in keyof Events & string as `on${K}capture`]?: HbSvelteCustomEventHandler<Events[K]>; } & { [K in keyof Events & string as `on:${K}`]?: HbSvelteCustomEventHandler<Events[K]>; }; /** * Strip keys we re-declare from Svelte’s base, then add them back: plain intersection would * merge `on*` / attrs with conflicting DOM typings (`string & EventHandler` → errors or * props treated like listeners). */ type HbSvelteHostAttributes = Omit< HTMLAttributes<HTMLElement>, keyof HbSvelteAttrs | keyof HbSvelteEventAttrs > & HbSvelteAttrs & HbSvelteEventAttrs; declare module "svelte/elements" { export interface SvelteHTMLElements { "hb-page-checkout": HbSvelteHostAttributes; } } export {};