UNPKG

@builder.io/mitosis

Version:

Write components once, run everywhere. Compiles to Vue, React, Solid, and Liquid. Import code from Figma and Builder.io

116 lines (115 loc) 2.47 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.checkIsBindingNativeEvent = exports.getEventNameWithoutOn = exports.checkIsEvent = void 0; const lodash_1 = require("lodash"); const checkIsEvent = (code) => code.startsWith('on'); exports.checkIsEvent = checkIsEvent; const getEventNameWithoutOn = (code) => (0, lodash_1.camelCase)(code.replace('on', '')); exports.getEventNameWithoutOn = getEventNameWithoutOn; const nativeEvents = [ 'abort', 'animationcancel', 'animationend', 'animationiteration', 'animationstart', 'auxclick', 'beforeinput', 'beforetoggle', 'blur', 'cancel', 'canplay', 'canplaythrough', 'change', 'click', 'close', 'compositionend', 'compositionstart', 'compositionupdate', 'contextlost', 'contextmenu', 'contextrestored', 'copy', 'cuechange', 'cut', 'dblclick', 'drag', 'dragend', 'dragenter', 'dragleave', 'dragover', 'dragstart', 'drop', 'durationchange', 'emptied', 'ended', 'error', 'focus', 'focusin', 'focusout', 'formdata', 'gotpointercapture', 'input', 'invalid', 'keydown', 'keypress', 'keyup', 'load', 'loadeddata', 'loadedmetadata', 'loadstart', 'lostpointercapture', 'mousedown', 'mouseenter', 'mouseleave', 'mousemove', 'mouseout', 'mouseover', 'mouseup', 'paste', 'pause', 'play', 'playing', 'pointercancel', 'pointerdown', 'pointerenter', 'pointerleave', 'pointermove', 'pointerout', 'pointerover', 'pointerup', 'progress', 'ratechange', 'reset', 'resize', 'scroll', 'scrollend', 'securitypolicyviolation', 'seeked', 'seeking', 'select', 'selectionchange', 'selectstart', 'slotchange', 'stalled', 'submit', 'suspend', 'timeupdate', 'toggle', 'touchcancel', 'touchend', 'touchmove', 'touchstart', 'transitioncancel', 'transitionend', 'transitionrun', 'transitionstart', 'volumechange', 'waiting', 'webkitanimationend', 'webkitanimationiteration', 'webkitanimationstart', 'webkittransitionend', 'wheel', ]; const checkIsBindingNativeEvent = (code) => !!nativeEvents.find((nativeEvent) => nativeEvent === code.toLowerCase()); exports.checkIsBindingNativeEvent = checkIsBindingNativeEvent;