UNPKG

@opentiny/vue-renderless

Version:

An enterprise-class UI component library, support both Vue.js 2 and Vue.js 3, as well as PC and mobile.

69 lines (68 loc) 1.43 kB
import "../chunk-G2ADBYYC.js"; import { initApi, initState, initWatch, parseCustomRGBA } from "./index"; const api = [ "state", "open", "close", "resetColor", "onConfirm", "onCancel", "submitValue", "clear", "onHueReady", "onSvReady", "onAlphaReady", "onPredefineColorClick", "onHistoryClick", "onClickOutside" ]; const renderless = (props, hooks, utils, ext) => { const state = initState(props, hooks, utils, ext); const { open, close, resetColor, onConfirm, onCancel, submitValue, clear, onHueReady, onSvReady, onAlphaReady, onPredefineColorClick, onHistoryClick, onClickOutside } = initApi(props, state, utils, hooks, ext); const api2 = { state, open, close, resetColor, onConfirm, onCancel, submitValue, clear, onHueReady, onSvReady, onAlphaReady, onPredefineColorClick, onHistoryClick, onClickOutside }; initWatch(state, props, hooks, utils); hooks.onMounted(() => { if (props.modelValue) { state.input = state.currentColor; const result = parseCustomRGBA(state.currentColor, state.currentFormat) || [0, 0, 0, 0]; state.hexInput4 = Math.ceil(Number(result[0])); state.hexInput5 = result[1]; state.hexInput6 = result[2]; state.hexInput7 = `${(Number(result[3]) || 1) * 100}%`; } }); return api2; }; export { api, renderless };