UNPKG

views-morph

Version:
22 lines (15 loc) 662 B
import { isUnsupportedShorthand, isStyle, isSlot } from './helpers.js' const SLOT_PROPS = ['from', 'when', 'onClick', 'onFocus', 'onWhen'] const shouldBeSlot = prop => SLOT_PROPS.includes(prop) || /^on[A-Z]/.test(prop) export default ({ name, isSlot, slotName, slotIsNot, value, block }) => { const tags = {} if (isStyle(name)) tags.style = true if (isUnsupportedShorthand(name) && block.isBasic) { tags.unsupportedShorthand = true } if (shouldBeSlot(name)) tags.shouldBeSlot = true if (isSlot) tags.slot = true if (slotIsNot) tags.slotIsNot = true tags.validSlot = tags.slot || (tags.shouldBeSlot && tags.slot) || null return tags }