node_modules/svelte2tsx/index.js
/**
 * Transform bind:xxx into something that conforms to JSX
 */
Transform bind:xxx into something that conforms to JSX
Transform bind : xxx into something that conforms to JSX
function handleBinding(htmlx, str, attr, el) {
    if (attr.name == 'group' && el.name == 'input') {
        str.remove(attr.start, attr.expression.start);
        str.appendLeft(attr.expression.start, '{...__sveltets_empty(');
        const endBrackets = ')}';
        if (isShortHandAttribute(attr)) {
            str.prependRight(attr.end, endBrackets);
        }
        else {
            str.overwrite(attr.expression.end, attr.end, endBrackets);
        }
        return;
    }
    const supportsBindThis = [
        'InlineComponent',
        'Element',
        'Body',
        'Slot' 
    ];
    if (attr.name === 'this' && supportsBindThis.includes(el.type)) {
        const thisType = getThisType(el);
        if (thisType) {
            str.remove(attr.start, attr.expression.start);
            str.appendLeft(attr.expression.start, `{...__sveltets_ensureType(${thisType}, `);
            str.overwrite(attr.expression.end, attr.end, ')}');
            return;
        }
    }
    if (oneWayBindingAttributes.has(attr.name) && el.type === 'Element') {
        str.remove(attr.start, attr.expression.start);
        str.appendLeft(attr.expression.start, '{...__sveltets_empty(');
        if (isShortHandAttribute(attr)) {
            str.appendLeft(attr.end, `=__sveltets_instanceOf(${oneWayBindingAttributes.get(attr.name)}).${attr.name})}`);
        }
        else {
            str.overwrite(attr.expression.end, attr.end, `=__sveltets_instanceOf(${oneWayBindingAttributes.get(attr.name)}).${attr.name})}`);
        }
        return;
    }
    str.remove(attr.start, attr.start + 'bind:'.length);
    if (attr.expression.start === attr.start + 'bind:'.length) {
        str.prependLeft(attr.expression.start, `${attr.name}={`);
        str.appendLeft(attr.end, '}');
        return;
    }
    const lastChar = htmlx[attr.end - 1];
    if (isQuote(lastChar)) {
        const firstQuote = htmlx.indexOf(lastChar, attr.start);
        str.remove(firstQuote, firstQuote + 1);
        str.remove(attr.end - 1, attr.end);
    }
}
function handleBinding ( htmlx , str , attr , el ) { if ( attr . name == 'group' && el . name == 'input' ) { str . remove ( attr . start , attr . expression . start ) ; str . appendLeft ( attr . expression . start , '{...__sveltets_empty(' ) ; const endBrackets = ')}' ; if ( isShortHandAttribute ( attr ) ) { str . prependRight ( attr . end , endBrackets ) ; } else { str . overwrite ( attr . expression . end , attr . end , endBrackets ) ; } return ; } const supportsBindThis = [ 'InlineComponent' , 'Element' , 'Body' , 'Slot' ] ; if ( attr . name === 'this' && supportsBindThis . includes ( el . type ) ) { const thisType = getThisType ( el ) ; if ( thisType ) { str . remove ( attr . start , attr . expression . start ) ; str . appendLeft ( attr . expression . start , ` ${ thisType } ` ) ; str . overwrite ( attr . expression . end , attr . end , ')}' ) ; return ; } } if ( oneWayBindingAttributes . has ( attr . name ) && el . type === 'Element' ) { str . remove ( attr . start , attr . expression . start ) ; str . appendLeft ( attr . expression . start , '{...__sveltets_empty(' ) ; if ( isShortHandAttribute ( attr ) ) { str . appendLeft ( attr . end , ` ${ oneWayBindingAttributes . get ( attr . name ) } ${ attr . name } ` ) ; } else { str . overwrite ( attr . expression . end , attr . end , ` ${ oneWayBindingAttributes . get ( attr . name ) } ${ attr . name } ` ) ; } return ; } str . remove ( attr . start , attr . start + 'bind:' . length ) ; if ( attr . expression . start === attr . start + 'bind:' . length ) { str . prependLeft ( attr . expression . start , ` ${ attr . name } ` ) ; str . appendLeft ( attr . end , '}' ) ; return ; } const lastChar = htmlx [ attr . end - 1 ] ; if ( isQuote ( lastChar ) ) { const firstQuote = htmlx . indexOf ( lastChar , attr . start ) ; str . remove ( firstQuote , firstQuote + 1 ) ; str . remove ( attr . end - 1 , attr . end ) ; } }
Transform bind:xxx into something that conforms to JSX
Transform bind : xxx into something that conforms to JSX
//bind group on input // only valid for Web Components compile target //bind this //one way binding // eslint-disable-next-line max-len // eslint-disable-next-line max-len //remove possible quotes