1847889021bf068f73e7279efae3db4f28b4a99f82f595b8335e9422cd9f9cd321c27a46fef3e00a7d6c99087569a5eb1c40bea7a90ed9b24467e9bd7d6340 917 B

1234567891011121314151617181920212223242526
  1. 'use strict';
  2. Object.defineProperty(exports, '__esModule', { value: true });
  3. var vue = require('vue');
  4. var lodashUnified = require('lodash-unified');
  5. const DEFAULT_EXCLUDE_KEYS = ["class", "style"];
  6. const LISTENER_PREFIX = /^on[A-Z]/;
  7. const useAttrs = (params = {}) => {
  8. const { excludeListeners = false, excludeKeys } = params;
  9. const allExcludeKeys = vue.computed(() => {
  10. return ((excludeKeys == null ? void 0 : excludeKeys.value) || []).concat(DEFAULT_EXCLUDE_KEYS);
  11. });
  12. const instance = vue.getCurrentInstance();
  13. if (!instance) {
  14. return vue.computed(() => ({}));
  15. }
  16. return vue.computed(() => {
  17. var _a;
  18. return lodashUnified.fromPairs(Object.entries((_a = instance.proxy) == null ? void 0 : _a.$attrs).filter(([key]) => !allExcludeKeys.value.includes(key) && !(excludeListeners && LISTENER_PREFIX.test(key))));
  19. });
  20. };
  21. exports.useAttrs = useAttrs;
  22. //# sourceMappingURL=index.js.map