UNPKG

@aspectus/vue-utils

Version:

Vue related utilities that makes development easier.

6 lines 4.42 kB
/*! * vue-utils v0.10.21 * (c) 2023 Alex Tkachenko * Released under the MIT License. */ !function(t,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("@vue/babel-helper-vue-jsx-merge-props")):"function"==typeof define&&define.amd?define(["exports","@vue/babel-helper-vue-jsx-merge-props"],n):n((t=t||self).VueUtils={},t.propsMergerFunction)}(this,function(t,r){"use strict";function o(){for(var t=arguments.length,n=new Array(t),e=0;e<t;e++)n[e]=arguments[e];return r(n)}r=r&&r.hasOwnProperty("default")?r.default:r;function u(t){return"function"==typeof t?t.options:t}function n(t,n,e,r){var o=3<arguments.length&&void 0!==r?r:{};return Object.assign(o,{name:e,functional:!0,props:n,render:t})}function i(t){if(!t)return{};if(Array.isArray(t)){var n={};return t.forEach(function(t){"string"==typeof t&&(n[t]={})}),n}return Object.assign({},t)}function c(t,n){var e=1<arguments.length&&void 0!==n?n:{};return t&&t.length?t.reduce(function(t,n){var e=Object.assign({},c(n.mixins,t),i(n.props));return Object.assign({},t,e)},e):e}function s(t){var n=u(t),e=i(n.props),r=c(n.mixins);return Object.assign({},r,e)}function a(t,n,e){return"value"===e&&p[t]&&"button"!==n||"selected"===e&&"option"===t||"checked"===e&&"input"===t||"muted"===e&&"video"===t}var p={input:!0,textarea:!0,option:!0,select:!0,progress:!0},f=["value","selected","checked","muted"];function e(t){return(e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var l=function(t){return null!=t&&"object"===e(t)&&!0===t["@@functional/placeholder"]};var d=function(e){return function t(n){return 0===arguments.length||l(n)?t:e.apply(this,arguments)}};var h=function(t,p){switch(t){case 0:return function(){return p.apply(this,arguments)};case 1:return function(t){return p.apply(this,arguments)};case 2:return function(t,n){return p.apply(this,arguments)};case 3:return function(t,n,e){return p.apply(this,arguments)};case 4:return function(t,n,e,r){return p.apply(this,arguments)};case 5:return function(t,n,e,r,o){return p.apply(this,arguments)};case 6:return function(t,n,e,r,o,u){return p.apply(this,arguments)};case 7:return function(t,n,e,r,o,u,i){return p.apply(this,arguments)};case 8:return function(t,n,e,r,o,u,i,c){return p.apply(this,arguments)};case 9:return function(t,n,e,r,o,u,i,c,s){return p.apply(this,arguments)};case 10:return function(t,n,e,r,o,u,i,c,s,a){return p.apply(this,arguments)};default:throw new Error("First argument to _arity must be a non-negative integer no greater than ten")}};var y=function u(i,c,s){return function(){for(var t=[],n=0,e=i,r=0;r<c.length||n<arguments.length;){var o;r<c.length&&(!l(c[r])||arguments.length<=n)?o=c[r]:(o=arguments[n],n+=1),t[r]=o,l(o)||--e,r+=1}return e<=0?s.apply(this,t):h(e,u(i,t,s))}},g=function(r){return function t(n,e){switch(arguments.length){case 0:return t;case 1:return l(n)?t:d(function(t){return r(n,t)});default:return l(n)&&l(e)?t:l(n)?d(function(t){return r(t,e)}):l(e)?d(function(t){return r(n,t)}):r(n,e)}}}(function(t,n){return 1===t?d(n):h(t,y(t,[],n))}),v=d(function(t){return g(t.length,t)})(function(e,r){return n(function(t,n){return t(r,o(n.data,{attrs:n.props}),n.children)},Object.keys(e).reduce(function(t,n){return t[n]={default:e[n]},t},s(r)))});t.DOM_PROP_ATTRS=f,t.VALUE_TAG_MAP=p,t.getComponentOptions=u,t.getProps=s,t.internalPropsMagicTransform=function(n,e){function r(t){return e.props&&e.props[t]||e.attrs&&e.attrs[t]}var o=r("type"),u=!!e.domProps;return f.forEach(function(t){if(a(n,o,t)){if(u&&void 0!==e.domProps[t])return;e.domProps=e.domProps||{},e.domProps[t]=r(t),e.props&&delete e.props[t],e.attrs&&delete e.attrs[t]}}),e},t.isEmpty=function(t){return null===t||""===t||void 0===t||Array.isArray(t)&&0===t.length||Object(t)===t&&0===Object.keys(t).length},t.makeF=n,t.mergeContext=o,t.mergeMixinProps=c,t.mustBeDOM=a,t.normalizeProps=i,t.renderSlim=function(t,n){var e=2<arguments.length&&void 0!==arguments[2]?arguments[2]:"div",r=3<arguments.length?arguments[3]:void 0;return 0===t.length?null:1===t.length?t[0]:n(e,r,t)},t.resolveInjection=function(t,n){for(var e=n;e;){if(e._provided&&Object.prototype.hasOwnProperty.call(e._provided,t))return e._provided[t];e=e.$parent}return null},t.withDefaultProps=v,Object.defineProperty(t,"__esModule",{value:!0})});