UNPKG

comic-plus

Version:

<p align="center"> <img width="200px" src="./logo.png"/> </p>

60 lines (59 loc) 2.23 kB
"use strict"; Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } }); const vue = require("vue"); const bullet_props = require("./bullet.props.js"); const type = require("./type.js"); require("../../../utils/config.js"); const typescript = require("../../../utils/typescript.js"); require("@vueuse/core"); const _hoisted_1 = { class: "cu-bullet-content" }; const _sfc_main = /* @__PURE__ */ vue.defineComponent({ ...{ name: "CuBullet" }, __name: "bullet", props: bullet_props.bulletProps, setup(__props) { const props = __props; const instance = vue.getCurrentInstance(); const { addBullet, removeBullet, itemHandleClick, bullets, pistolStyle, props: injectProps } = vue.inject(type.PISTOL_PROVIDE); const getInstanceIdx = vue.computed(() => { return Object.keys(bullets).indexOf(instance.uid.toString()); }); const bulletInstance = vue.reactive({ sign: props.sign, uid: instance.uid, style: {} }); addBullet(bulletInstance); function bulletClick() { if (props.disabled) return; itemHandleClick(props.sign); } vue.onUnmounted(() => { removeBullet(instance.uid); }); return (_ctx, _cache) => { return vue.openBlock(), vue.createElementBlock("li", { class: vue.normalizeClass(["cu-bullet", { "is-disabled": _ctx.disabled }]), style: vue.normalizeStyle([ bulletInstance.style, vue.unref(pistolStyle), { "--cu-pistol-delay": (vue.unref(injectProps).iteration ? getInstanceIdx.value * (50 + (vue.unref(injectProps).dept ?? 0)) : 0) + "ms" }, { "--pistol-custom-color": _ctx.color ?? vue.unref(injectProps).color } ]), onClick: bulletClick }, [ vue.renderSlot(_ctx.$slots, "default", {}, () => [ vue.createElementVNode("div", _hoisted_1, [ vue.unref(typescript.isVueComponent)(_ctx.icon) ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.icon), { key: 0, class: "cu-bullet__icon" })) : vue.createCommentVNode("", true) ]) ]) ], 6); }; } }); exports.default = _sfc_main;