@vue-interface/badge 1.1.0 → 2.0.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/badge.es.js +41 -97
- package/dist/badge.umd.js +1 -1
- package/package.json +15 -13
- package/src/Badge.vue +14 -9
package/dist/badge.es.js
CHANGED
|
@@ -1,87 +1,27 @@
|
|
|
1
|
-
|
|
1
|
+
import { openBlock as s, createBlock as o, resolveDynamicComponent as c, normalizeClass as f, withCtx as l, renderSlot as h } from "vue";
|
|
2
|
+
const p = {
|
|
2
3
|
props: {
|
|
4
|
+
componentPrefix: String,
|
|
3
5
|
variant: String,
|
|
4
|
-
variantPrefix:
|
|
5
|
-
type: String,
|
|
6
|
-
default() {
|
|
7
|
-
return this.$options.name && this.$options.name.toLowerCase();
|
|
8
|
-
}
|
|
9
|
-
}
|
|
6
|
+
variantPrefix: String
|
|
10
7
|
},
|
|
11
8
|
computed: {
|
|
12
9
|
variantClassPrefix() {
|
|
13
|
-
return this.variantPrefix;
|
|
10
|
+
return this.variantPrefix || this.componentPrefix;
|
|
11
|
+
},
|
|
12
|
+
hasVariantPrefix() {
|
|
13
|
+
return this.variant && !!this.variant.match(
|
|
14
|
+
new RegExp(`^${this.variantClassPrefix}`)
|
|
15
|
+
);
|
|
14
16
|
},
|
|
15
17
|
variantClass() {
|
|
16
|
-
|
|
17
|
-
return "";
|
|
18
|
-
}
|
|
19
|
-
return `${this.variantClassPrefix}-${this.variant}`;
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
};
|
|
23
|
-
var render = function() {
|
|
24
|
-
var _vm = this;
|
|
25
|
-
var _h = _vm.$createElement;
|
|
26
|
-
var _c = _vm._self._c || _h;
|
|
27
|
-
return _c(_vm.component || _vm.type, { tag: "component", staticClass: "badge", class: _vm.classes, attrs: { "href": _vm.href, "to": _vm.to } }, [_vm._t("default")], 2);
|
|
28
|
-
};
|
|
29
|
-
var staticRenderFns = [];
|
|
30
|
-
function normalizeComponent(scriptExports, render2, staticRenderFns2, functionalTemplate, injectStyles, scopeId, moduleIdentifier, shadowMode) {
|
|
31
|
-
var options = typeof scriptExports === "function" ? scriptExports.options : scriptExports;
|
|
32
|
-
if (render2) {
|
|
33
|
-
options.render = render2;
|
|
34
|
-
options.staticRenderFns = staticRenderFns2;
|
|
35
|
-
options._compiled = true;
|
|
36
|
-
}
|
|
37
|
-
if (functionalTemplate) {
|
|
38
|
-
options.functional = true;
|
|
39
|
-
}
|
|
40
|
-
if (scopeId) {
|
|
41
|
-
options._scopeId = "data-v-" + scopeId;
|
|
42
|
-
}
|
|
43
|
-
var hook;
|
|
44
|
-
if (moduleIdentifier) {
|
|
45
|
-
hook = function(context) {
|
|
46
|
-
context = context || this.$vnode && this.$vnode.ssrContext || this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext;
|
|
47
|
-
if (!context && typeof __VUE_SSR_CONTEXT__ !== "undefined") {
|
|
48
|
-
context = __VUE_SSR_CONTEXT__;
|
|
49
|
-
}
|
|
50
|
-
if (injectStyles) {
|
|
51
|
-
injectStyles.call(this, context);
|
|
52
|
-
}
|
|
53
|
-
if (context && context._registeredComponents) {
|
|
54
|
-
context._registeredComponents.add(moduleIdentifier);
|
|
55
|
-
}
|
|
56
|
-
};
|
|
57
|
-
options._ssrRegister = hook;
|
|
58
|
-
} else if (injectStyles) {
|
|
59
|
-
hook = shadowMode ? function() {
|
|
60
|
-
injectStyles.call(this, (options.functional ? this.parent : this).$root.$options.shadowRoot);
|
|
61
|
-
} : injectStyles;
|
|
62
|
-
}
|
|
63
|
-
if (hook) {
|
|
64
|
-
if (options.functional) {
|
|
65
|
-
options._injectStyles = hook;
|
|
66
|
-
var originalRender = options.render;
|
|
67
|
-
options.render = function renderWithStyleInjection(h, context) {
|
|
68
|
-
hook.call(context);
|
|
69
|
-
return originalRender(h, context);
|
|
70
|
-
};
|
|
71
|
-
} else {
|
|
72
|
-
var existing = options.beforeCreate;
|
|
73
|
-
options.beforeCreate = existing ? [].concat(existing, hook) : [hook];
|
|
18
|
+
return this.variant ? !this.variantClassPrefix || this.hasVariantPrefix ? this.variant : `${this.variantClassPrefix}-${this.variant}` : "";
|
|
74
19
|
}
|
|
75
20
|
}
|
|
76
|
-
|
|
77
|
-
exports: scriptExports,
|
|
78
|
-
options
|
|
79
|
-
};
|
|
80
|
-
}
|
|
81
|
-
const __vue2_script = {
|
|
21
|
+
}, u = {
|
|
82
22
|
name: "Badge",
|
|
83
23
|
mixins: [
|
|
84
|
-
|
|
24
|
+
p
|
|
85
25
|
],
|
|
86
26
|
props: {
|
|
87
27
|
component: String,
|
|
@@ -94,35 +34,39 @@ const __vue2_script = {
|
|
|
94
34
|
}
|
|
95
35
|
},
|
|
96
36
|
computed: {
|
|
37
|
+
classes() {
|
|
38
|
+
return [
|
|
39
|
+
"badge-pill",
|
|
40
|
+
"badge-secondary",
|
|
41
|
+
this.variantClass
|
|
42
|
+
];
|
|
43
|
+
},
|
|
97
44
|
type() {
|
|
98
|
-
|
|
99
|
-
return "router-link";
|
|
100
|
-
}
|
|
101
|
-
if (this.href) {
|
|
102
|
-
return "a";
|
|
103
|
-
}
|
|
104
|
-
return "span";
|
|
45
|
+
return this.to ? "router-link" : this.href ? "a" : "span";
|
|
105
46
|
},
|
|
106
47
|
variantClass() {
|
|
107
48
|
return `bg-${this.variant}`;
|
|
108
|
-
},
|
|
109
|
-
classes() {
|
|
110
|
-
return {
|
|
111
|
-
"badge-pill": this.pill,
|
|
112
|
-
"badge-secondary": this.secondary,
|
|
113
|
-
[this.variantClass]: !!this.variant
|
|
114
|
-
};
|
|
115
49
|
}
|
|
116
50
|
}
|
|
51
|
+
}, v = (r, a) => {
|
|
52
|
+
const t = r.__vccOpts || r;
|
|
53
|
+
for (const [e, n] of a)
|
|
54
|
+
t[e] = n;
|
|
55
|
+
return t;
|
|
117
56
|
};
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
}
|
|
57
|
+
function m(r, a, t, e, n, i) {
|
|
58
|
+
return s(), o(c(t.component || i.type), {
|
|
59
|
+
href: t.href,
|
|
60
|
+
to: t.to,
|
|
61
|
+
class: f(["badge", i.classes])
|
|
62
|
+
}, {
|
|
63
|
+
default: l(() => [
|
|
64
|
+
h(r.$slots, "default")
|
|
65
|
+
]),
|
|
66
|
+
_: 3
|
|
67
|
+
}, 8, ["href", "to", "class"]);
|
|
124
68
|
}
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
69
|
+
const g = /* @__PURE__ */ v(u, [["render", m]]);
|
|
70
|
+
export {
|
|
71
|
+
g as Badge
|
|
72
|
+
};
|
package/dist/badge.umd.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(e,t){typeof exports=="object"&&typeof module<"u"?t(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],t):(e=typeof globalThis<"u"?globalThis:e||self,t(e.Badge={},e.Vue))})(this,function(e,t){"use strict";const f={name:"Badge",mixins:[{props:{componentPrefix:String,variant:String,variantPrefix:String},computed:{variantClassPrefix(){return this.variantPrefix||this.componentPrefix},hasVariantPrefix(){return this.variant&&!!this.variant.match(new RegExp(`^${this.variantClassPrefix}`))},variantClass(){return this.variant?!this.variantClassPrefix||this.hasVariantPrefix?this.variant:`${this.variantClassPrefix}-${this.variant}`:""}}}],props:{component:String,href:String,pill:Boolean,to:[Object,String],variant:{type:String,default:"primary"}},computed:{classes(){return["badge-pill","badge-secondary",this.variantClass]},type(){return this.to?"router-link":this.href?"a":"span"},variantClass(){return`bg-${this.variant}`}}},c=(n,i)=>{const r=n.__vccOpts||n;for(const[a,s]of i)r[a]=s;return r};function l(n,i,r,a,s,o){return t.openBlock(),t.createBlock(t.resolveDynamicComponent(r.component||o.type),{href:r.href,to:r.to,class:t.normalizeClass(["badge",o.classes])},{default:t.withCtx(()=>[t.renderSlot(n.$slots,"default")]),_:3},8,["href","to","class"])}const u=c(f,[["render",l]]);e.Badge=u,Object.defineProperties(e,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vue-interface/badge",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0-beta.0",
|
|
4
4
|
"description": "A Vue badge component.",
|
|
5
5
|
"files": [
|
|
6
6
|
"index.js",
|
|
@@ -37,24 +37,26 @@
|
|
|
37
37
|
"bugs": {
|
|
38
38
|
"url": "https://github.com/vue-interface/badge/issues"
|
|
39
39
|
},
|
|
40
|
-
"homepage": "https://github.com/vue-interface/badge
|
|
40
|
+
"homepage": "https://github.com/vue-interface/badge",
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@vue-interface/variant": "^
|
|
43
|
-
|
|
42
|
+
"@vue-interface/variant": "^2.0.0-beta.0"
|
|
43
|
+
},
|
|
44
|
+
"peerDependencies": {
|
|
45
|
+
"vue": "^3.0.0"
|
|
44
46
|
},
|
|
45
47
|
"devDependencies": {
|
|
46
|
-
"@rollup/plugin-babel": "^
|
|
47
|
-
"
|
|
48
|
+
"@rollup/plugin-babel": "^6.0.0",
|
|
49
|
+
"@vitejs/plugin-vue": "^3.0.3",
|
|
50
|
+
"autoprefixer": "^10.4.8",
|
|
48
51
|
"babel-eslint": "^10.1.0",
|
|
49
52
|
"babel-preset-vue": "^2.0.2",
|
|
50
53
|
"change-case": "^4.1.2",
|
|
51
|
-
"eslint": "^
|
|
52
|
-
"eslint-plugin-vue": "^
|
|
54
|
+
"eslint": "^8.22.0",
|
|
55
|
+
"eslint-plugin-vue": "^9.4.0",
|
|
53
56
|
"pascalcase": "^2.0.0",
|
|
54
|
-
"postcss": "^8.4.
|
|
55
|
-
"tailwindcss": "^3.
|
|
56
|
-
"vite": "^
|
|
57
|
-
"
|
|
58
|
-
"vue-router": "^3.5.3"
|
|
57
|
+
"postcss": "^8.4.16",
|
|
58
|
+
"tailwindcss": "^3.1.8",
|
|
59
|
+
"vite": "^3.0.9",
|
|
60
|
+
"vue": "^3.2.37"
|
|
59
61
|
}
|
|
60
62
|
}
|
package/src/Badge.vue
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
</component>
|
|
10
10
|
</template>
|
|
11
11
|
|
|
12
|
-
<script>
|
|
12
|
+
<script lang="ts">
|
|
13
13
|
import { Variant } from '@vue-interface/variant';
|
|
14
14
|
|
|
15
15
|
export default {
|
|
@@ -63,6 +63,19 @@ export default {
|
|
|
63
63
|
|
|
64
64
|
computed: {
|
|
65
65
|
|
|
66
|
+
/**
|
|
67
|
+
* Get the button classes.
|
|
68
|
+
*
|
|
69
|
+
* @property {string}
|
|
70
|
+
*/
|
|
71
|
+
classes(): Array<string> {
|
|
72
|
+
return [
|
|
73
|
+
'badge-pill',
|
|
74
|
+
'badge-secondary',
|
|
75
|
+
this.variantClass
|
|
76
|
+
];
|
|
77
|
+
},
|
|
78
|
+
|
|
66
79
|
type() {
|
|
67
80
|
if(this.to) {
|
|
68
81
|
return 'router-link';
|
|
@@ -78,14 +91,6 @@ export default {
|
|
|
78
91
|
variantClass() {
|
|
79
92
|
return `bg-${this.variant}`;
|
|
80
93
|
},
|
|
81
|
-
|
|
82
|
-
classes() {
|
|
83
|
-
return {
|
|
84
|
-
'badge-pill': this.pill,
|
|
85
|
-
'badge-secondary': this.secondary,
|
|
86
|
-
[this.variantClass]: !!this.variant,
|
|
87
|
-
};
|
|
88
|
-
}
|
|
89
94
|
}
|
|
90
95
|
};
|
|
91
96
|
</script>
|