wc-mixin/examples/modules.d.ts
Buddy 76d78e1925 Accept a CSSStyleSheet as css; move example CSS and templates into files
css is now string | CSSStyleSheet. A sheet is adopted as-is: into its own
shadow root, an enclosing shadow root, or document.adoptedStyleSheets for
light DOM at the document level. Strings behave as before.

The examples import their styles with `with { type: 'css' }` and their
static templates with `with { type: 'text' }`. Safari doesn't support those
yet, so vite.config.ts rewrites them into modules Vite builds: a constructed
CSSStyleSheet, or the file's text. npm run examples now just runs vite,
with root set in the config.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-10 11:44:27 -08:00

12 lines
323 B
TypeScript

// `import sheet from './x.css' with { type: 'css' }` gives a constructed stylesheet.
declare module '*.css' {
const sheet: CSSStyleSheet;
export default sheet;
}
// `import text from './x.html' with { type: 'text' }` gives the file's contents.
declare module '*.html' {
const text: string;
export default text;
}