@vuesax-alpha/nightly
Version:
A Component Library for Vue 3
38 lines (33 loc) • 1.12 kB
JavaScript
;
Object.defineProperty(exports, '__esModule', { value: true });
var vue = require('vue');
require('../../hooks/index.js');
require('../../constants/index.js');
var color$1 = require('../color.js');
var error = require('../error.js');
var index = require('../../hooks/use-attrs/index.js');
var color = require('../../constants/color.js');
const getComponentColor = () => {
const instance = vue.getCurrentInstance();
if (!instance) {
error.debugWarn(
"use-attrs",
"getCurrentInstance() returned null. getComponentColor() must be called at the top of a setup function"
);
return vue.computed(() => null);
}
const attrs = index.useAttrs({ excludeListeners: true });
return vue.computed(() => {
const propColor = color.componentColors.find(
(color) => attrs.value[color] === true
);
if (propColor)
return propColor;
const hasColorString = attrs.value["color"];
if (!hasColorString)
return null;
return color$1.getVsColor(hasColorString);
});
};
exports.getComponentColor = getComponentColor;
//# sourceMappingURL=color.js.map