import React from "react" ; import { WCComponent } from "." ; import { generateElementName } from "./generateElementName" ; import { HtmlComponentProps } from "./HtmlComponentProps" ; import { makeChildren } from "./makeChildren" ; import { Slot } from "./Slot" ; import { slotNameSymbol } from "./symbol" ; import { HtmlInterpolationValue , resolveTemplateString , } from "./util/resolveTemplateString" ; deprecated export function html < SlotName extends string > ( html , ... values ) { const elementName = generateElementName ( ) ; let initFlag = false ; const template = document . createDocumentFragment ( ) ; const [ templateString , slotNames ] = resolveTemplateString ( html , values ) ; return Object . assign ( ( props ) => { if ( ! initFlag ) { initFlag = true ; const div = document . createElement ( "div" ) ; div . insertAdjacentHTML ( "afterbegin" , templateString ) ; template . append ( ... div . childNodes ) ; class Elm extends HTMLElement { constructor ( ) { super ( ) ; this . attachShadow ( { mode : "open" , } ) . appendChild ( template . cloneNode ( true ) ) ; } } window . customElements . define ( elementName , Elm ) ; } const children = makeChildren ( props , slotNames ) ; return React . createElement ( elementName , { } , children ) ; } , { elementName , } ) ; } deprecated export function slot ( ) ; export function slot < Name extends string > ( name ) ; export function slot ( name ? ) { return { [ slotNameSymbol ] : name || "" , } ; }