@vue-interface/badge 0.9.3 → 1.0.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.
Files changed (49) hide show
  1. package/dist/badge.es.js +128 -0
  2. package/dist/badge.umd.js +1 -0
  3. package/index.js +5 -2
  4. package/package.json +27 -25
  5. package/src/Badge.vue +12 -16
  6. package/tailwindcss/index.js +14 -9
  7. package/tailwindcss/safelist.js +4 -0
  8. package/.eslintrc.js +0 -53
  9. package/babel.config.js +0 -5
  10. package/dist/Badge.common.js +0 -2786
  11. package/dist/Badge.common.js.map +0 -1
  12. package/dist/Badge.css +0 -1
  13. package/dist/Badge.umd.js +0 -2796
  14. package/dist/Badge.umd.js.map +0 -1
  15. package/dist/Badge.umd.min.js +0 -2
  16. package/dist/Badge.umd.min.js.map +0 -1
  17. package/dist/demo.html +0 -19
  18. package/docs/.vuepress/config.js +0 -44
  19. package/docs/.vuepress/dist/404.html +0 -19
  20. package/docs/.vuepress/dist/assets/css/0.styles.275ee968.css +0 -1
  21. package/docs/.vuepress/dist/assets/img/search.83621669.svg +0 -1
  22. package/docs/.vuepress/dist/assets/js/10.5d93d289.js +0 -1
  23. package/docs/.vuepress/dist/assets/js/11.97ab3884.js +0 -1
  24. package/docs/.vuepress/dist/assets/js/2.f3d148c3.js +0 -1
  25. package/docs/.vuepress/dist/assets/js/3.81681fff.js +0 -1
  26. package/docs/.vuepress/dist/assets/js/4.82fa7382.js +0 -1
  27. package/docs/.vuepress/dist/assets/js/5.3dae6ad4.js +0 -1
  28. package/docs/.vuepress/dist/assets/js/6.6a04f815.js +0 -1
  29. package/docs/.vuepress/dist/assets/js/7.c033cb49.js +0 -1
  30. package/docs/.vuepress/dist/assets/js/8.6d6eb599.js +0 -1
  31. package/docs/.vuepress/dist/assets/js/9.eaefe866.js +0 -1
  32. package/docs/.vuepress/dist/assets/js/app.7ed065d3.js +0 -13
  33. package/docs/.vuepress/dist/examples/index.html +0 -21
  34. package/docs/.vuepress/dist/examples/test.html +0 -17
  35. package/docs/.vuepress/dist/index.html +0 -53
  36. package/docs/.vuepress/dist/options.html +0 -41
  37. package/docs/.vuepress/dist/tailwindcss.html +0 -85
  38. package/docs/README.md +0 -23
  39. package/docs/examples/README.md +0 -3
  40. package/docs/options.md +0 -46
  41. package/docs/tailwindcss.md +0 -76
  42. package/index.html +0 -65
  43. package/main.vue +0 -5
  44. package/postcss.config.js +0 -1
  45. package/public/favicon.ico +0 -0
  46. package/public/index.html +0 -17
  47. package/src/css/Badge.css +0 -2
  48. package/tailwind.config.js +0 -20
  49. package/vue.config.js +0 -11
@@ -0,0 +1,128 @@
1
+ var Variant = {
2
+ props: {
3
+ variant: String,
4
+ variantPrefix: {
5
+ type: String,
6
+ default() {
7
+ return this.$options.name && this.$options.name.toLowerCase();
8
+ }
9
+ }
10
+ },
11
+ computed: {
12
+ variantClassPrefix() {
13
+ return this.variantPrefix;
14
+ },
15
+ variantClass() {
16
+ if (!this.variant || !this.variantClassPrefix) {
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];
74
+ }
75
+ }
76
+ return {
77
+ exports: scriptExports,
78
+ options
79
+ };
80
+ }
81
+ const __vue2_script = {
82
+ name: "Badge",
83
+ mixins: [
84
+ Variant
85
+ ],
86
+ props: {
87
+ component: String,
88
+ href: String,
89
+ pill: Boolean,
90
+ to: [Object, String],
91
+ variant: {
92
+ type: String,
93
+ default: "primary"
94
+ }
95
+ },
96
+ computed: {
97
+ type() {
98
+ if (this.to) {
99
+ return "router-link";
100
+ }
101
+ if (this.href) {
102
+ return "a";
103
+ }
104
+ return "span";
105
+ },
106
+ variantClass() {
107
+ return `bg-${this.variant} text-${["muted", "light", "white"].indexOf(this.variant) > -1 ? "dark" : "white"}`;
108
+ },
109
+ classes() {
110
+ return {
111
+ "badge-pill": this.pill,
112
+ "badge-secondary": this.secondary,
113
+ [this.variantClass]: !!this.variant
114
+ };
115
+ }
116
+ }
117
+ };
118
+ const __cssModules = {};
119
+ var __component__ = /* @__PURE__ */ normalizeComponent(__vue2_script, render, staticRenderFns, false, __vue2_injectStyles, null, null, null);
120
+ function __vue2_injectStyles(context) {
121
+ for (let o in __cssModules) {
122
+ this[o] = __cssModules[o];
123
+ }
124
+ }
125
+ var Badge = /* @__PURE__ */ function() {
126
+ return __component__.exports;
127
+ }();
128
+ export { Badge };
@@ -0,0 +1 @@
1
+ (function(a,s){typeof exports=="object"&&typeof module!="undefined"?s(exports):typeof define=="function"&&define.amd?define(["exports"],s):(a=typeof globalThis!="undefined"?globalThis:a||self,s(a.Badge={}))})(this,function(a){"use strict";var s={props:{variant:String,variantPrefix:{type:String,default(){return this.$options.name&&this.$options.name.toLowerCase()}}},computed:{variantClassPrefix(){return this.variantPrefix},variantClass(){return!this.variant||!this.variantClassPrefix?"":`${this.variantClassPrefix}-${this.variant}`}}},_=function(){var e=this,r=e.$createElement,f=e._self._c||r;return f(e.component||e.type,{tag:"component",staticClass:"badge",class:e.classes,attrs:{href:e.href,to:e.to}},[e._t("default")],2)},v=[];function c(e,r,f,y,o,u,d,S){var t=typeof e=="function"?e.options:e;r&&(t.render=r,t.staticRenderFns=f,t._compiled=!0),y&&(t.functional=!0),u&&(t._scopeId="data-v-"+u);var i;if(d?(i=function(n){n=n||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext,!n&&typeof __VUE_SSR_CONTEXT__!="undefined"&&(n=__VUE_SSR_CONTEXT__),o&&o.call(this,n),n&&n._registeredComponents&&n._registeredComponents.add(d)},t._ssrRegister=i):o&&(i=S?function(){o.call(this,(t.functional?this.parent:this).$root.$options.shadowRoot)}:o),i)if(t.functional){t._injectStyles=i;var b=t.render;t.render=function(T,p){return i.call(p),b(T,p)}}else{var h=t.beforeCreate;t.beforeCreate=h?[].concat(h,i):[i]}return{exports:e,options:t}}const m={name:"Badge",mixins:[s],props:{component:String,href:String,pill:Boolean,to:[Object,String],variant:{type:String,default:"primary"}},computed:{type(){return this.to?"router-link":this.href?"a":"span"},variantClass(){return`bg-${this.variant} text-${["muted","light","white"].indexOf(this.variant)>-1?"dark":"white"}`},classes(){return{"badge-pill":this.pill,"badge-secondary":this.secondary,[this.variantClass]:!!this.variant}}}},l={};var g=c(m,_,v,!1,C,null,null,null);function C(e){for(let r in l)this[r]=l[r]}var $=function(){return g.exports}();a.Badge=$,Object.defineProperties(a,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
package/index.js CHANGED
@@ -1,2 +1,5 @@
1
- import Badge from './src/Badge';
2
- export default Badge;
1
+ import Badge from './src/Badge.vue';
2
+
3
+ export {
4
+ Badge
5
+ };
package/package.json CHANGED
@@ -1,22 +1,25 @@
1
1
  {
2
2
  "name": "@vue-interface/badge",
3
- "version": "0.9.3",
4
- "description": "Vue badge component",
5
- "main": "index.js",
3
+ "version": "1.0.0",
4
+ "description": "A Vue badge component.",
5
+ "files": [
6
+ "index.js",
7
+ "dist",
8
+ "src",
9
+ "tailwindcss"
10
+ ],
11
+ "main": "./dist/badge.umd.js",
12
+ "module": "./index.js",
13
+ "browserslist": "last 2 versions, > 0.5%, ie >= 11",
6
14
  "scripts": {
7
- "watch": "npm run serve",
8
- "serve": "vue-cli-service build --target lib --name=Badge ./main.vue --watch",
9
- "build": "vue-cli-service build --target lib --name=Badge ./main.vue",
10
- "lint": "vue-cli-service lint",
11
- "fix": "vue-cli-service lint --fix",
15
+ "dev": "vite",
16
+ "build": "vite build",
17
+ "preview": "vite preview",
12
18
  "pre-release": "npm run build; git add . -A; git commit -m 'pre-release commit'",
13
19
  "release-patch": "npm run pre-release && npm version patch -m \"%s\" && npm run release;",
14
20
  "release-minor": "npm run pre-release && npm version minor -m \"%s\" && npm run release;",
15
21
  "release-major": "npm run pre-release && npm version major -m \"%s\" && npm run release;",
16
- "release": "git add . -A; git commit; git push --tags origin; npm publish;",
17
- "test": "echo \"Error: no test specified\" && exit 1",
18
- "docs:dev": "./node_modules/.bin/vuepress dev docs",
19
- "docs:build": "./node_modules/.bin/vuepress build docs"
22
+ "release": "git add . -A; git commit; git push --tags origin; npm publish;"
20
23
  },
21
24
  "repository": {
22
25
  "type": "git",
@@ -36,23 +39,22 @@
36
39
  },
37
40
  "homepage": "https://github.com/vue-interface/badge/docs#readme",
38
41
  "dependencies": {
39
- "@vue-interface/variant": "^1.0.12",
40
- "core-js": "^3.6.4",
41
- "tailwindcss": "^1.6.0",
42
- "vue": "^2.6.11"
42
+ "@vue-interface/variant": "^1.2.1",
43
+ "vue": "^2.6.14"
43
44
  },
44
45
  "devDependencies": {
45
- "@vue/cli-plugin-babel": "^4.0",
46
- "@vue/cli-plugin-eslint": "^4.0",
47
- "@vue/cli-service": "^4.0",
48
- "@vuepress/plugin-register-components": "^1.5.0",
46
+ "@rollup/plugin-babel": "^5.3.0",
47
+ "autoprefixer": "^10.4.2",
49
48
  "babel-eslint": "^10.1.0",
49
+ "babel-preset-vue": "^2.0.2",
50
+ "change-case": "^4.1.2",
50
51
  "eslint": "^6.7.2",
51
52
  "eslint-plugin-vue": "^6.2.2",
52
- "markdown-it-meta": "0.0.1",
53
- "postcss-cli": "^7.1.1",
54
- "vue-template-compiler": "^2.6.11",
55
- "vuepress": "^1.5.0",
56
- "vuepress-plugin-template-constants": "^0.2.1"
53
+ "pascalcase": "^2.0.0",
54
+ "postcss": "^8.4.6",
55
+ "tailwindcss": "^3.0.0",
56
+ "vite": "^2.7.2",
57
+ "vite-plugin-vue2": "^1.9.3",
58
+ "vue-router": "^3.5.3"
57
59
  }
58
60
  }
package/src/Badge.vue CHANGED
@@ -10,7 +10,7 @@
10
10
  </template>
11
11
 
12
12
  <script>
13
- import Variant from '@vue-interface/variant';
13
+ import { Variant } from '@vue-interface/variant';
14
14
 
15
15
  export default {
16
16
 
@@ -42,13 +42,6 @@ export default {
42
42
  * @property {Boolean}
43
43
  */
44
44
  pill: Boolean,
45
-
46
- /**
47
- * The badge appear as secondary in size to the parent element.
48
- *
49
- * @property {Boolean}
50
- */
51
- secondary: Boolean,
52
45
 
53
46
  /**
54
47
  * The to route. If used, badge will be a router-link component.
@@ -56,6 +49,16 @@ export default {
56
49
  * @property {Object|String}
57
50
  */
58
51
  to: [Object, String],
52
+
53
+ /**
54
+ * The variant name.
55
+ *
56
+ * @param {String}
57
+ */
58
+ variant: {
59
+ type: String,
60
+ default: 'primary'
61
+ }
59
62
  },
60
63
 
61
64
  computed: {
@@ -85,11 +88,4 @@ export default {
85
88
  }
86
89
  }
87
90
  };
88
- </script>
89
-
90
- <style>
91
- a.badge:hover {
92
- color: white;
93
- text-decoration: none;
94
- }
95
- </style>
91
+ </script>
@@ -3,17 +3,17 @@ const { colors } = require('tailwindcss/defaultTheme');
3
3
 
4
4
  module.exports = plugin(function({ addComponents, theme }) {
5
5
  const badge = {
6
- ':root': {
7
- '--badge-font-size': theme('badge.fontSize'),
8
- '--badge-font-weight': theme('badge.fontWeight'),
9
- '--badge-color': theme('badge.color'),
10
- '--badge-padding-y': theme('badge.paddingY'),
11
- '--badge-padding-x': theme('badge.paddingX'),
12
- '--badge-border-radius': theme('badge.borderRadius')
13
- },
6
+ // ':root': {
7
+ // '--badge-font-size': theme('badge.fontSize'),
8
+ // '--badge-font-weight': theme('badge.fontWeight'),
9
+ // '--badge-color': theme('badge.color'),
10
+ // '--badge-padding-y': theme('badge.paddingY'),
11
+ // '--badge-padding-x': theme('badge.paddingX'),
12
+ // '--badge-border-radius': theme('badge.borderRadius')
13
+ // },
14
14
 
15
15
  '.badge': {
16
- display: 'inline-block',
16
+ display: theme('badge.display'),
17
17
  padding: `${theme('badge.paddingY')} ${theme('badge.paddingX')}`,
18
18
  fontSize: theme('badge.fontSize'),
19
19
  fontWeight: theme('badge.fontWeight'),
@@ -24,6 +24,10 @@ module.exports = plugin(function({ addComponents, theme }) {
24
24
  verticalAlign: 'baseline',
25
25
  borderRadius: theme('badge.borderRadius'),
26
26
  },
27
+
28
+ '.badge-pill': {
29
+ borderRadius: '1000rem'
30
+ },
27
31
 
28
32
  '.badge:empty': {
29
33
  display: 'none'
@@ -40,6 +44,7 @@ module.exports = plugin(function({ addComponents, theme }) {
40
44
  }, {
41
45
  theme: {
42
46
  badge: theme => ({
47
+ display: 'inline-block',
43
48
  fontSize: '.75em',
44
49
  fontWeight: 'bold',
45
50
  color: theme('colors.white'),
@@ -0,0 +1,4 @@
1
+ module.exports = () => ([
2
+ 'badge',
3
+ 'badge-pill'
4
+ ]);
package/.eslintrc.js DELETED
@@ -1,53 +0,0 @@
1
- module.exports = {
2
- extends: [
3
- 'plugin:vue/recommended'
4
- ],
5
- parserOptions: {
6
- 'parser': 'babel-eslint'
7
- },
8
- // add your custom rules here
9
- rules: {
10
- 'vue/no-v-html': 0,
11
- 'vue/require-default-prop': 0,
12
- "vue/max-attributes-per-line": ["error", {
13
- "singleline": 5,
14
- "multiline": {
15
- "max": 1,
16
- "allowFirstLine": true
17
- }
18
- }],
19
- "vue/html-indent": ["error", 4, {
20
- "attribute": 1,
21
- "baseIndent": 1,
22
- "closeBracket": 1,
23
- "alignAttributesVertically": false,
24
- "ignores": []
25
- }],
26
- "vue/html-closing-bracket-newline": ["error", {
27
- "singleline": "never",
28
- "multiline": "never"
29
- }],
30
- // Ensure no space after keywords like if.
31
- 'keyword-spacing': ["error", {
32
- "overrides": {
33
- "if": { "after": false },
34
- "for": { "after": false },
35
- "while": { "after": false }
36
- }
37
- }],
38
- // Use alternative brace style
39
- 'brace-style': ['error', 'stroustrup'],
40
- // No spaces before parens
41
- 'space-before-function-paren': ['error', 'never'],
42
- // Indent for tabs because spaces suck
43
- 'indent': ['error', 4],
44
- // Semi colons always where they need to be
45
- 'semi': [2,'always'],
46
- // allow paren-less arrow functions
47
- 'arrow-parens': 0,
48
- // allow async-await
49
- 'generator-star-spacing': 0,
50
- // allow debugger during development
51
- 'no-debugger': process.env.NODE_ENV === 'production' ? 2 : 0
52
- }
53
- }
package/babel.config.js DELETED
@@ -1,5 +0,0 @@
1
- module.exports = {
2
- presets: [
3
- '@vue/cli-plugin-babel/preset'
4
- ]
5
- };