From 17c2664321b6a59bc74defb310b3b810b71cc95f Mon Sep 17 00:00:00 2001 From: Peter Pan Date: Sat, 1 May 2021 19:54:46 +0200 Subject: [PATCH] flags loading improved (#56) * setting up android improvements * vue 3 component fixed as well * updated to 2.1.0 --- README.md | 5 +- packages/vue-country-flag-next/.npmignore | 2 - packages/vue-country-flag-next/README.md | 5 +- .../build/rollup.config.js | 10 +- .../vue-country-flag-next/package-lock.json | 301 ++++- packages/vue-country-flag-next/package.json | 5 +- .../src}/flags.png | Bin packages/vue-country-flag/.npmignore | 2 - packages/vue-country-flag/README.md | 5 +- .../vue-country-flag/build/rollup.config.js | 10 +- packages/vue-country-flag/dev/serve.vue | 9 +- packages/vue-country-flag/package-lock.json | 308 ++++- packages/vue-country-flag/package.json | 6 +- packages/vue-country-flag/src/CountryFlag.vue | 1052 ++++++++++++++++- .../vue-country-flag/src/css/flags/flags.css | 1034 ---------------- .../src/css/flags/flags.min.css | 1 - packages/vue-country-flag/src/flags.png | Bin 0 -> 235173 bytes 17 files changed, 1650 insertions(+), 1105 deletions(-) rename packages/{vue-country-flag/src/css/flags => vue-country-flag-next/src}/flags.png (100%) delete mode 100644 packages/vue-country-flag/src/css/flags/flags.css delete mode 100644 packages/vue-country-flag/src/css/flags/flags.min.css create mode 100644 packages/vue-country-flag/src/flags.png diff --git a/README.md b/README.md index 960837f..70d8076 100644 --- a/README.md +++ b/README.md @@ -7,10 +7,10 @@ _Country flags as a Vue Component_

Monthly downloads - Install size + Install size Vue.js 2 compatible Vue.js 3 compatible - Version + Version License TypeScript Supported @@ -86,6 +86,7 @@ Then, after the proper mounting, in your template you can call it like this: |:--|:--|:--|:--| | size | Flag size | `String` | small, normal, big | | rounded | Flag with rounded borders | `Boolean` | `false` by default | +| background | Path where you can upload possible custom flag images | `String` | by default it uses the flags bundled in the component | by default, the flag is displayed at *normal* size. diff --git a/packages/vue-country-flag-next/.npmignore b/packages/vue-country-flag-next/.npmignore index 1d6cb03..b7aa690 100644 --- a/packages/vue-country-flag-next/.npmignore +++ b/packages/vue-country-flag-next/.npmignore @@ -3,7 +3,5 @@ assets/logo.png __tests__ .babelrc jest.config.js -src/flags-min.png -src/flags.png typedefs dev \ No newline at end of file diff --git a/packages/vue-country-flag-next/README.md b/packages/vue-country-flag-next/README.md index 36bfb3f..86806e3 100644 --- a/packages/vue-country-flag-next/README.md +++ b/packages/vue-country-flag-next/README.md @@ -5,9 +5,9 @@ _Country flags as a Vue 3 Component_ vue-country-flag

- Install size + Install size Vue.js 3 compatible - Version + Version License TypeScript Supported @@ -59,6 +59,7 @@ Then, after the proper mounting, in your template you can call it like this: |:--|:--|:--|:--| | size | Flag size | `String` | small, normal, big | | rounded | Flag with rounded borders | `Boolean` | `false` by default | +| background | Path where you can upload possible custom flag images | `String` | by default it uses the flags bundled in the component | by default, the flag is displayed at *normal* size. diff --git a/packages/vue-country-flag-next/build/rollup.config.js b/packages/vue-country-flag-next/build/rollup.config.js index 1049243..ded1eec 100644 --- a/packages/vue-country-flag-next/build/rollup.config.js +++ b/packages/vue-country-flag-next/build/rollup.config.js @@ -10,6 +10,7 @@ import babel from '@rollup/plugin-babel'; import PostCSS from 'rollup-plugin-postcss'; import { terser } from 'rollup-plugin-terser'; import minimist from 'minimist'; +import copy from 'rollup-plugin-copy' // Get browserslist config and remove ie from es build targets const esbrowserslist = fs.readFileSync('./.browserslistrc') @@ -39,6 +40,7 @@ const baseConfig = { ], replace: { 'process.env.NODE_ENV': JSON.stringify('production'), + __name: 'vue-country-flag-next' }, vue: { }, @@ -58,6 +60,9 @@ const baseConfig = { extensions: ['.js', '.jsx', '.ts', '.tsx', '.vue'], babelHelpers: 'bundled', }, + copyTargets: { + targets: [{ src: 'src/flags.png', dest: 'dist' }] + } }, }; @@ -66,7 +71,7 @@ const baseConfig = { const external = [ // list external dependencies, exactly the way it is written in the import statement. // eg. 'jquery' - 'vue', + 'vue' ]; // UMD/IIFE shared settings: output.globals @@ -106,6 +111,7 @@ if (!argv.format || argv.format === 'es') { ], }), commonjs(), + copy(baseConfig.plugins.copyTargets) ], }; buildFormats.push(esConfig); @@ -130,6 +136,7 @@ if (!argv.format || argv.format === 'cjs') { ...baseConfig.plugins.postVue, babel(baseConfig.plugins.babel), commonjs(), + copy(baseConfig.plugins.copyTargets) ], }; buildFormats.push(umdConfig); @@ -154,6 +161,7 @@ if (!argv.format || argv.format === 'iife') { ...baseConfig.plugins.postVue, babel(baseConfig.plugins.babel), commonjs(), + copy(baseConfig.plugins.copyTargets), terser({ output: { ecma: 5, diff --git a/packages/vue-country-flag-next/package-lock.json b/packages/vue-country-flag-next/package-lock.json index 85d52c8..c97d635 100644 --- a/packages/vue-country-flag-next/package-lock.json +++ b/packages/vue-country-flag-next/package-lock.json @@ -1099,12 +1099,40 @@ "glob-to-regexp": "^0.3.0" } }, + "@nodelib/fs.scandir": { + "version": "2.1.4", + "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.4.tgz", + "integrity": "sha512-33g3pMJk3bg5nXbL/+CY6I2eJDzZAni49PfJnL5fghPTggPvBd/pFNSgJsdAgWptuFu7qq/ERvOYFlhvsLTCKA==", + "dev": true, + "requires": { + "@nodelib/fs.stat": "2.0.4", + "run-parallel": "^1.1.9" + }, + "dependencies": { + "@nodelib/fs.stat": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-2.0.4.tgz", + "integrity": "sha512-IYlHJA0clt2+Vg7bccq+TzRdJvv19c2INqBSsoOLp1je7xjtr7J26+WXR72MCdvU9q1qTzIWDfhMf+DRvQJK4Q==", + "dev": true + } + } + }, "@nodelib/fs.stat": { "version": "1.1.3", "resolved": "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-1.1.3.tgz", "integrity": "sha512-shAmDyaQC4H92APFoIaVDHCx5bStIocgvbwQyxPRrbUY20V1EYTbSDchWbuwlMG3V17cprZhA6+78JfB+3DTPw==", "dev": true }, + "@nodelib/fs.walk": { + "version": "1.2.6", + "resolved": "https://registry.npmjs.org/@nodelib/fs.walk/-/fs.walk-1.2.6.tgz", + "integrity": "sha512-8Broas6vTtW4GIXTAHDoE32hnN2M5ykgCpWGbuXHQ15vEMqr23pB76e/GZcYsZCHALv50ktd24qhEyKr6wBtow==", + "dev": true, + "requires": { + "@nodelib/fs.scandir": "2.1.4", + "fastq": "^1.6.0" + } + }, "@rollup/plugin-alias": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/@rollup/plugin-alias/-/plugin-alias-3.1.1.tgz", @@ -1154,9 +1182,9 @@ } }, "@rollup/plugin-replace": { - "version": "2.3.4", - "resolved": "https://registry.npmjs.org/@rollup/plugin-replace/-/plugin-replace-2.3.4.tgz", - "integrity": "sha512-waBhMzyAtjCL1GwZes2jaE9MjuQ/DQF2BatH3fRivUF3z0JBFrU0U6iBNC/4WR+2rLKhaAhPWDNPYp4mI6RqdQ==", + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/@rollup/plugin-replace/-/plugin-replace-2.4.2.tgz", + "integrity": "sha512-IGcu+cydlUMZ5En85jxHH4qj2hta/11BHq95iHEyb2sbgiN0eCdzvUcHw5gt9pBL5lTi4JDYJ1acCoMGpTvEZg==", "dev": true, "requires": { "@rollup/pluginutils": "^3.1.0", @@ -1297,6 +1325,15 @@ "@types/range-parser": "*" } }, + "@types/fs-extra": { + "version": "8.1.1", + "resolved": "https://registry.npmjs.org/@types/fs-extra/-/fs-extra-8.1.1.tgz", + "integrity": "sha512-TcUlBem321DFQzBNuz8p0CLLKp0VvF/XH9E4KHNmgwyp4E3AfgI5cjiIVZWlbfThBop2qxFIh4+LeY6hVWWZ2w==", + "dev": true, + "requires": { + "@types/node": "*" + } + }, "@types/glob": { "version": "7.1.3", "resolved": "https://registry.npmjs.org/@types/glob/-/glob-7.1.3.tgz", @@ -1771,6 +1808,16 @@ "integrity": "sha512-nQyp0o1/mNdbTO1PO6kHkwSrmgZ0MT/jCCpNiwbUjGoRN4dlBhqJtoQuCnEOKzgTVwg0ZWiCoQy6SxMebQVh8A==", "dev": true }, + "ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, + "optional": true, + "requires": { + "color-convert": "^2.0.1" + } + }, "cacache": { "version": "13.0.1", "resolved": "https://registry.npmjs.org/cacache/-/cacache-13.0.1.tgz", @@ -1797,6 +1844,53 @@ "unique-filename": "^1.1.1" } }, + "chalk": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.1.tgz", + "integrity": "sha512-diHzdDKxcU+bAsUboHLPEDQiw0qEe0qd7SYUn3HgcFlWgbDcfLGswOHYeGrHKzG9z6UYf01d9VFMfZxPM1xZSg==", + "dev": true, + "optional": true, + "requires": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + } + }, + "color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "optional": true, + "requires": { + "color-name": "~1.1.4" + } + }, + "color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true, + "optional": true + }, + "has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true, + "optional": true + }, + "loader-utils": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/loader-utils/-/loader-utils-2.0.0.tgz", + "integrity": "sha512-rP4F0h2RaWSvPEkD7BLDFQnvSf+nK+wr3ESUjNTyAGobqrijmW92zc+SO6d4p4B1wh7+B/Jg1mkQe5NYUEHtHQ==", + "dev": true, + "optional": true, + "requires": { + "big.js": "^5.2.2", + "emojis-list": "^3.0.0", + "json5": "^2.1.2" + } + }, "source-map": { "version": "0.6.1", "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", @@ -1813,6 +1907,16 @@ "minipass": "^3.1.1" } }, + "supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dev": true, + "optional": true, + "requires": { + "has-flag": "^4.0.0" + } + }, "terser-webpack-plugin": { "version": "2.3.8", "resolved": "https://registry.npmjs.org/terser-webpack-plugin/-/terser-webpack-plugin-2.3.8.tgz", @@ -1829,6 +1933,18 @@ "terser": "^4.6.12", "webpack-sources": "^1.4.3" } + }, + "vue-loader-v16": { + "version": "npm:vue-loader@16.2.0", + "resolved": "https://registry.npmjs.org/vue-loader/-/vue-loader-16.2.0.tgz", + "integrity": "sha512-TitGhqSQ61RJljMmhIGvfWzJ2zk9m1Qug049Ugml6QP3t0e95o0XJjk29roNEiPKJQBEi8Ord5hFuSuELzSp8Q==", + "dev": true, + "optional": true, + "requires": { + "chalk": "^4.1.0", + "hash-sum": "^2.0.0", + "loader-utils": "^2.0.0" + } } } }, @@ -5333,6 +5449,15 @@ "integrity": "sha512-483XLLxTVIwWK3QTrMGRqUfUpoOs/0hbQrl2oz4J0pAcm3A3bu84wxTFqGqkJzewCLdME38xJLJAxBABfQT8sQ==", "dev": true }, + "fastq": { + "version": "1.11.0", + "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.11.0.tgz", + "integrity": "sha512-7Eczs8gIPDrVzT+EksYBcupqMyxSHXXrHOLRRxU2/DicV8789MRBRR8+Hc2uWzUupOs4YS4JzBmBxjjCVBxD/g==", + "dev": true, + "requires": { + "reusify": "^1.0.4" + } + }, "faye-websocket": { "version": "0.10.0", "resolved": "https://registry.npmjs.org/faye-websocket/-/faye-websocket-0.10.0.tgz", @@ -5636,7 +5761,6 @@ "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.1.tgz", "integrity": "sha512-FnI+VGOpnlGHWZxthPGR+QhR78fuiK0sNLkHQv+bL9fQi57lNNdquIbna/WrfROrolq8GK5Ek6BiMwqL/voRYQ==", "dev": true, - "optional": true, "requires": { "is-glob": "^4.0.1" } @@ -8797,6 +8921,12 @@ "integrity": "sha512-FIqgj2EUvTa7R50u0rGsyTftzjYmv/a3hO345bZNrqabNqjtgiDMgmo4mkUjd+nzU5oF3dClKqFIPUKybUyqoQ==", "dev": true }, + "queue-microtask": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz", + "integrity": "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==", + "dev": true + }, "randombytes": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz", @@ -9160,6 +9290,12 @@ "integrity": "sha1-G0KmJmoh8HQh0bC1S33BZ7AcATs=", "dev": true }, + "reusify": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.0.4.tgz", + "integrity": "sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw==", + "dev": true + }, "rgb-regex": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/rgb-regex/-/rgb-regex-1.0.1.tgz", @@ -9200,6 +9336,152 @@ "fsevents": "~2.1.2" } }, + "rollup-plugin-copy": { + "version": "3.4.0", + "resolved": "https://registry.npmjs.org/rollup-plugin-copy/-/rollup-plugin-copy-3.4.0.tgz", + "integrity": "sha512-rGUmYYsYsceRJRqLVlE9FivJMxJ7X6jDlP79fmFkL8sJs7VVMSVyA2yfyL+PGyO/vJs4A87hwhgVfz61njI+uQ==", + "dev": true, + "requires": { + "@types/fs-extra": "^8.0.1", + "colorette": "^1.1.0", + "fs-extra": "^8.1.0", + "globby": "10.0.1", + "is-plain-object": "^3.0.0" + }, + "dependencies": { + "@nodelib/fs.stat": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-2.0.4.tgz", + "integrity": "sha512-IYlHJA0clt2+Vg7bccq+TzRdJvv19c2INqBSsoOLp1je7xjtr7J26+WXR72MCdvU9q1qTzIWDfhMf+DRvQJK4Q==", + "dev": true + }, + "array-union": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/array-union/-/array-union-2.1.0.tgz", + "integrity": "sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw==", + "dev": true + }, + "braces": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", + "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", + "dev": true, + "requires": { + "fill-range": "^7.0.1" + } + }, + "dir-glob": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/dir-glob/-/dir-glob-3.0.1.tgz", + "integrity": "sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA==", + "dev": true, + "requires": { + "path-type": "^4.0.0" + } + }, + "fast-glob": { + "version": "3.2.5", + "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.2.5.tgz", + "integrity": "sha512-2DtFcgT68wiTTiwZ2hNdJfcHNke9XOfnwmBRWXhmeKM8rF0TGwmC/Qto3S7RoZKp5cilZbxzO5iTNTQsJ+EeDg==", + "dev": true, + "requires": { + "@nodelib/fs.stat": "^2.0.2", + "@nodelib/fs.walk": "^1.2.3", + "glob-parent": "^5.1.0", + "merge2": "^1.3.0", + "micromatch": "^4.0.2", + "picomatch": "^2.2.1" + } + }, + "fill-range": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", + "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", + "dev": true, + "requires": { + "to-regex-range": "^5.0.1" + } + }, + "fs-extra": { + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-8.1.0.tgz", + "integrity": "sha512-yhlQgA6mnOJUKOsRUFsgJdQCvkKhcz8tlZG5HBQfReYZy46OwLcY+Zia0mtdHsOo9y/hP+CxMN0TU9QxoOtG4g==", + "dev": true, + "requires": { + "graceful-fs": "^4.2.0", + "jsonfile": "^4.0.0", + "universalify": "^0.1.0" + } + }, + "globby": { + "version": "10.0.1", + "resolved": "https://registry.npmjs.org/globby/-/globby-10.0.1.tgz", + "integrity": "sha512-sSs4inE1FB2YQiymcmTv6NWENryABjUNPeWhOvmn4SjtKybglsyPZxFB3U1/+L1bYi0rNZDqCLlHyLYDl1Pq5A==", + "dev": true, + "requires": { + "@types/glob": "^7.1.1", + "array-union": "^2.1.0", + "dir-glob": "^3.0.1", + "fast-glob": "^3.0.3", + "glob": "^7.1.3", + "ignore": "^5.1.1", + "merge2": "^1.2.3", + "slash": "^3.0.0" + } + }, + "ignore": { + "version": "5.1.8", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.1.8.tgz", + "integrity": "sha512-BMpfD7PpiETpBl/A6S498BaIJ6Y/ABT93ETbby2fP00v4EbvPBXWEoaR1UBPKs3iR53pJY7EtZk5KACI57i1Uw==", + "dev": true + }, + "is-number": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", + "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", + "dev": true + }, + "is-plain-object": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-3.0.1.tgz", + "integrity": "sha512-Xnpx182SBMrr/aBik8y+GuR4U1L9FqMSojwDQwPMmxyC6bvEqly9UBCxhauBF5vNh2gwWJNX6oDV7O+OM4z34g==", + "dev": true + }, + "micromatch": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.4.tgz", + "integrity": "sha512-pRmzw/XUcwXGpD9aI9q/0XOwLNygjETJ8y0ao0wdqprrzDa4YnxLcz7fQRZr8voh8V10kGhABbNcHVk5wHgWwg==", + "dev": true, + "requires": { + "braces": "^3.0.1", + "picomatch": "^2.2.3" + }, + "dependencies": { + "picomatch": { + "version": "2.2.3", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.2.3.tgz", + "integrity": "sha512-KpELjfwcCDUb9PeigTs2mBJzXUPzAuP2oPcA989He8Rte0+YUAjw1JVedDhuTKPkHjSYzMN3npC9luThGYEKdg==", + "dev": true + } + } + }, + "path-type": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-type/-/path-type-4.0.0.tgz", + "integrity": "sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==", + "dev": true + }, + "to-regex-range": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", + "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", + "dev": true, + "requires": { + "is-number": "^7.0.0" + } + } + } + }, "rollup-plugin-postcss": { "version": "3.1.8", "resolved": "https://registry.npmjs.org/rollup-plugin-postcss/-/rollup-plugin-postcss-3.1.8.tgz", @@ -9401,6 +9683,15 @@ } } }, + "run-parallel": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz", + "integrity": "sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==", + "dev": true, + "requires": { + "queue-microtask": "^1.2.2" + } + }, "run-queue": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/run-queue/-/run-queue-1.0.3.tgz", @@ -10993,6 +11284,7 @@ } } }, + "vue-loader-v16": { "version": "npm:vue-loader@16.2.0", "resolved": "https://registry.npmjs.org/vue-loader/-/vue-loader-16.2.0.tgz", @@ -11066,6 +11358,7 @@ } } }, + "vue-style-loader": { "version": "4.1.2", "resolved": "https://registry.npmjs.org/vue-style-loader/-/vue-style-loader-4.1.2.tgz", diff --git a/packages/vue-country-flag-next/package.json b/packages/vue-country-flag-next/package.json index 5cb3278..8d86b09 100644 --- a/packages/vue-country-flag-next/package.json +++ b/packages/vue-country-flag-next/package.json @@ -1,6 +1,6 @@ { "name": "vue-country-flag-next", - "version": "2.0.4", + "version": "2.1.0", "description": "Simple Vue component for displaying of country flags", "main": "dist/country-flag.ssr.js", "browser": "dist/CountryFlag.esm.js", @@ -46,13 +46,14 @@ "@rollup/plugin-babel": "^5.2.1", "@rollup/plugin-commonjs": "^14.0.0", "@rollup/plugin-node-resolve": "^9.0.0", - "@rollup/plugin-replace": "^2.3.3", + "@rollup/plugin-replace": "^2.4.2", "@vue/cli-plugin-babel": "^4.5.7", "@vue/cli-service": "^4.5.7", "@vue/compiler-sfc": "^3.0.0", "cross-env": "^7.0.2", "minimist": "^1.2.5", "rollup": "^2.30.0", + "rollup-plugin-copy": "^3.4.0", "rollup-plugin-postcss": "^3.1.8", "rollup-plugin-terser": "^7.0.2", "rollup-plugin-vue": "^6.0.0-beta.10", diff --git a/packages/vue-country-flag/src/css/flags/flags.png b/packages/vue-country-flag-next/src/flags.png similarity index 100% rename from packages/vue-country-flag/src/css/flags/flags.png rename to packages/vue-country-flag-next/src/flags.png diff --git a/packages/vue-country-flag/.npmignore b/packages/vue-country-flag/.npmignore index 1d6cb03..b7aa690 100644 --- a/packages/vue-country-flag/.npmignore +++ b/packages/vue-country-flag/.npmignore @@ -3,7 +3,5 @@ assets/logo.png __tests__ .babelrc jest.config.js -src/flags-min.png -src/flags.png typedefs dev \ No newline at end of file diff --git a/packages/vue-country-flag/README.md b/packages/vue-country-flag/README.md index e13e663..03fca41 100644 --- a/packages/vue-country-flag/README.md +++ b/packages/vue-country-flag/README.md @@ -5,9 +5,9 @@ _Country flags as a Vue Component_ vue-country-flag

- Install size + Install size Vue.js 2 compatible - Version + Version License TypeScript Supported @@ -71,6 +71,7 @@ Then, after the proper mounting, in your template you can call it like this: |:--|:--|:--|:--| | size | Flag size | `String` | small, normal, big | | rounded | Flag with rounded borders | `Boolean` | `false` by default | +| background | Path where you can upload possible custom flag images | `String` | by default it uses the flags bundled in the component | by default, the flag is displayed at *normal* size. diff --git a/packages/vue-country-flag/build/rollup.config.js b/packages/vue-country-flag/build/rollup.config.js index 3e85cbd..0553ed0 100644 --- a/packages/vue-country-flag/build/rollup.config.js +++ b/packages/vue-country-flag/build/rollup.config.js @@ -10,6 +10,7 @@ import babel from '@rollup/plugin-babel'; import { terser } from 'rollup-plugin-terser'; import minimist from 'minimist'; import postcss from "rollup-plugin-postcss"; +import copy from 'rollup-plugin-copy'; // Get browserslist config and remove ie from es build targets const esbrowserslist = fs.readFileSync('./.browserslistrc') @@ -42,6 +43,7 @@ const baseConfig = { ], replace: { "process.env.NODE_ENV": JSON.stringify("production"), + __name: 'vue-country-flag' }, vue: { css: true, @@ -55,6 +57,9 @@ const baseConfig = { extensions: [".js", ".jsx", ".ts", ".tsx", ".vue"], babelHelpers: "bundled", }, + copyTargets: { + targets: [{ src: 'src/flags.png', dest: 'dist' }] + } }, }; @@ -63,7 +68,7 @@ const baseConfig = { const external = [ // list external dependencies, exactly the way it is written in the import statement. // eg. 'jquery' - 'vue', + 'vue' ]; // UMD/IIFE shared settings: output.globals @@ -103,6 +108,7 @@ if (!argv.format || argv.format === 'es') { ], }), commonjs(), + copy(baseConfig.plugins.copyTargets) ], }; buildFormats.push(esConfig); @@ -133,6 +139,7 @@ if (!argv.format || argv.format === 'cjs') { ...baseConfig.plugins.postVue, babel(baseConfig.plugins.babel), commonjs(), + copy(baseConfig.plugins.copyTargets) ], }; buildFormats.push(umdConfig); @@ -157,6 +164,7 @@ if (!argv.format || argv.format === 'iife') { ...baseConfig.plugins.postVue, babel(baseConfig.plugins.babel), commonjs(), + copy(baseConfig.plugins.copyTargets), terser({ output: { ecma: 5, diff --git a/packages/vue-country-flag/dev/serve.vue b/packages/vue-country-flag/dev/serve.vue index 2f609e9..6eb1075 100644 --- a/packages/vue-country-flag/dev/serve.vue +++ b/packages/vue-country-flag/dev/serve.vue @@ -6,13 +6,18 @@ export default Vue.extend({ name: 'ServeDev', components: { CountryFlag - } + }, + data() { + return { + items: {value: 'it'} + }; + }, });