diff --git a/README.md b/README.md index 69fc695..2c75388 100644 --- a/README.md +++ b/README.md @@ -46,8 +46,6 @@ With this, the map view will automatically be centered on the result geometry, a ## Developing -To develop this plugin, it is recommended to set up a test app according to the instructions below, and use [npm link](https://docs.npmjs.com/cli/v10/commands/npm-link). When that is setup properly, use +To develop this plugin, an example has been set up in `example/`. To run the example with dynamically built plugin, run - npm run watch - -to automatically update the linked package in the test application. + npm run dev:example diff --git a/eslint.config.js b/eslint.config.js index 273d051..5a8c80b 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -35,6 +35,7 @@ export default [ rules: { 'no-unused-vars': 'off', 'import/no-dynamic-require': 'warn', + 'import/no-unresolved': 'off', }, }, ]; diff --git a/example/index.html b/example/index.html new file mode 100644 index 0000000..28e6792 --- /dev/null +++ b/example/index.html @@ -0,0 +1,13 @@ + + + + + + + Vue Place Search + + +
+ + + diff --git a/example/src/App.vue b/example/src/App.vue new file mode 100644 index 0000000..d52a5ed --- /dev/null +++ b/example/src/App.vue @@ -0,0 +1,51 @@ + + + + + diff --git a/example/src/main.js b/example/src/main.js new file mode 100644 index 0000000..3588894 --- /dev/null +++ b/example/src/main.js @@ -0,0 +1,20 @@ +import 'vuetify/styles'; +import { createVuetify } from 'vuetify'; +import App from './App.vue'; +import { createApp } from 'vue'; +import { aliases, mdi } from 'vuetify/iconsets/mdi-svg'; + +const vuetify = createVuetify({ + icons: { + defaultSet: 'mdi', + aliases, + sets: { + mdi, + }, + }, +}); + +const app = createApp(App); +app.use(vuetify); + +app.mount('#app'); diff --git a/example/src/plugins/index.js b/example/src/plugins/index.js new file mode 100644 index 0000000..1f52686 --- /dev/null +++ b/example/src/plugins/index.js @@ -0,0 +1,5 @@ +import vuetify from './vuetify'; + +export function registerPlugins(app) { + app.use(vuetify); +} diff --git a/example/src/plugins/vuetify.js b/example/src/plugins/vuetify.js new file mode 100644 index 0000000..9b00951 --- /dev/null +++ b/example/src/plugins/vuetify.js @@ -0,0 +1,18 @@ +/** + * plugins/vuetify.js + * + * Framework documentation: https://vuetifyjs.com` + */ + +// Styles +import 'vuetify/styles'; + +// Composables +import { createVuetify } from 'vuetify'; + +// https://vuetifyjs.com/en/introduction/why-vuetify/#feature-guides +export default createVuetify({ + theme: { + defaultTheme: 'dark', + }, +}); diff --git a/example/vite.config.mjs b/example/vite.config.mjs new file mode 100644 index 0000000..c8e8a80 --- /dev/null +++ b/example/vite.config.mjs @@ -0,0 +1,34 @@ +import Vue from '@vitejs/plugin-vue'; +import Vuetify, { transformAssetUrls } from 'vite-plugin-vuetify'; + +// Utilities +import { defineConfig } from 'vite'; +import { fileURLToPath, URL } from 'node:url'; +import { join, resolve } from 'node:path'; + +const root = fileURLToPath(new URL('.', import.meta.url)); + +// https://vitejs.dev/config/ +export default defineConfig({ + root, + plugins: [ + Vue({ + template: { transformAssetUrls }, + }), + Vuetify(), + ], + define: { 'process.env': {} }, + resolve: { + extensions: ['.js', '.json', '.jsx', '.mjs', '.ts', '.tsx', '.vue'], + }, + server: { + port: 3000, + }, + css: { + preprocessorOptions: { + sass: { + api: 'modern-compiler', + }, + }, + }, +}); diff --git a/package-lock.json b/package-lock.json index ef1fe35..d37d59c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -29,6 +29,7 @@ "vue-tsc": "^2.0.21" }, "peerDependencies": { + "@mdi/js": "^7.4.47", "@types/geojson": "^7946.0.14", "ol": "*", "vue": "^3.0.0", @@ -1071,6 +1072,13 @@ "@jridgewell/sourcemap-codec": "^1.4.14" } }, + "node_modules/@mdi/js": { + "version": "7.4.47", + "resolved": "https://registry.npmjs.org/@mdi/js/-/js-7.4.47.tgz", + "integrity": "sha512-KPnNOtm5i2pMabqZxpUz7iQf+mfrYZyKCZ8QNz85czgEt7cuHcGorWfdzUMWYA0SD+a6Hn4FmJ+YhzzzjkTZrQ==", + "license": "Apache-2.0", + "peer": true + }, "node_modules/@microsoft/api-extractor": { "version": "7.47.11", "resolved": "https://registry.npmjs.org/@microsoft/api-extractor/-/api-extractor-7.47.11.tgz", @@ -1261,15 +1269,15 @@ } }, "node_modules/@rollup/pluginutils": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/@rollup/pluginutils/-/pluginutils-5.1.0.tgz", - "integrity": "sha512-XTIWOPPcpvyKI6L1NHo0lFlCyznUEyPmPY1mc3KpPVDYulHSTvyeLNVW00QTLIAFNhR3kYnJTQHeGqU4M3n09g==", + "version": "5.1.4", + "resolved": "https://registry.npmjs.org/@rollup/pluginutils/-/pluginutils-5.1.4.tgz", + "integrity": "sha512-USm05zrsFxYLPdWWq+K3STlWiT/3ELn3RcV5hJMghpeAIhxfsUIg6mt12CBJBInWMV4VneoV7SfGv8xIwo2qNQ==", "dev": true, "license": "MIT", "dependencies": { "@types/estree": "^1.0.0", "estree-walker": "^2.0.2", - "picomatch": "^2.3.1" + "picomatch": "^4.0.2" }, "engines": { "node": ">=14.0.0" @@ -1283,6 +1291,19 @@ } } }, + "node_modules/@rollup/pluginutils/node_modules/picomatch": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.2.tgz", + "integrity": "sha512-M7BAV6Rlcy5u+m6oPhAPFgJTzAioX/6B0DxyvDlo9l8+T3nLKbrczg2WLUyzd45L8RqfUMyGPzekbMvX2Ldkwg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, "node_modules/@rollup/rollup-android-arm-eabi": { "version": "4.24.3", "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.24.3.tgz", @@ -2593,9 +2614,9 @@ "license": "MIT" }, "node_modules/debug": { - "version": "4.3.7", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.7.tgz", - "integrity": "sha512-Er2nc/H7RrMXZBFCEim6TCmMk02Z8vLC2Rbi1KEBggpo0fS6l0S1nnapwmIi3yW/+GOJap1Krg4w0Hg80oCqgQ==", + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.0.tgz", + "integrity": "sha512-6WTZ/IxCY/T6BALoZHaE4ctp9xm+Z5kY/pzYaCHRFeyVhojxlrm+46y68HA6hr0TcwEssoxNiDEUJQjfPZ/RYA==", "devOptional": true, "license": "MIT", "dependencies": { @@ -4640,14 +4661,14 @@ } }, "node_modules/local-pkg": { - "version": "0.5.0", - "resolved": "https://registry.npmjs.org/local-pkg/-/local-pkg-0.5.0.tgz", - "integrity": "sha512-ok6z3qlYyCDS4ZEU27HaU6x/xZa9Whf8jD4ptH5UZTQYZVYeb9bnZ3ojVhiJNLiXK1Hfc0GNbLXcmZ5plLDDBg==", + "version": "0.5.1", + "resolved": "https://registry.npmjs.org/local-pkg/-/local-pkg-0.5.1.tgz", + "integrity": "sha512-9rrA30MRRP3gBD3HTGnC6cDFpaE1kVDWxWgqWJUN0RvDNAo+Nz/9GxB+nHOH0ifbVFy0hSA1V6vFDvnx54lTEQ==", "dev": true, "license": "MIT", "dependencies": { - "mlly": "^1.4.2", - "pkg-types": "^1.0.3" + "mlly": "^1.7.3", + "pkg-types": "^1.2.1" }, "engines": { "node": ">=14" @@ -4700,9 +4721,9 @@ } }, "node_modules/magic-string": { - "version": "0.30.12", - "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.30.12.tgz", - "integrity": "sha512-Ea8I3sQMVXr8JhN4z+H/d8zwo+tYDgHE9+5G4Wnrwhs0gaK9fXTKx0Tw5Xwsd/bCPTTZNRAdpyzvoeORe9LYpw==", + "version": "0.30.17", + "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.30.17.tgz", + "integrity": "sha512-sNPKHvyjVf7gyjwS4xGTaW/mCnF8wnjtifKBEhxfZ7E/S8tQ0rssrwGNn6q8JH/ohItJfSQp9mBtQYuTlH5QnA==", "license": "MIT", "dependencies": { "@jridgewell/sourcemap-codec": "^1.5.0" @@ -4745,15 +4766,15 @@ } }, "node_modules/mlly": { - "version": "1.7.2", - "resolved": "https://registry.npmjs.org/mlly/-/mlly-1.7.2.tgz", - "integrity": "sha512-tN3dvVHYVz4DhSXinXIk7u9syPYaJvio118uomkovAtWBT+RdbP6Lfh/5Lvo519YMmwBafwlh20IPTXIStscpA==", + "version": "1.7.4", + "resolved": "https://registry.npmjs.org/mlly/-/mlly-1.7.4.tgz", + "integrity": "sha512-qmdSIPC4bDJXgZTCR7XosJiNKySV7O215tsPtDN9iEO/7q/76b/ijtgRu/+epFXSJhijtTCCGp3DWS549P3xKw==", "dev": true, "license": "MIT", "dependencies": { - "acorn": "^8.12.1", - "pathe": "^1.1.2", - "pkg-types": "^1.2.0", + "acorn": "^8.14.0", + "pathe": "^2.0.1", + "pkg-types": "^1.3.0", "ufo": "^1.5.4" } }, @@ -5148,9 +5169,9 @@ "license": "MIT" }, "node_modules/pathe": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/pathe/-/pathe-1.1.2.tgz", - "integrity": "sha512-whLdWMYL2TwI08hn8/ZqAbrVemu0LNaNNJZX73O6qaIdCTfXutsLhMkjdENX0qhsQ9uIimo4/aQOmXkoon2nDQ==", + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/pathe/-/pathe-2.0.2.tgz", + "integrity": "sha512-15Ztpk+nov8DR524R4BF7uEuzESgzUEAV4Ah7CUMNGXdE5ELuvxElxGXndBl32vMSsWa1jpNf22Z+Er3sKwq+w==", "dev": true, "license": "MIT" }, @@ -5188,15 +5209,15 @@ } }, "node_modules/pkg-types": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/pkg-types/-/pkg-types-1.2.1.tgz", - "integrity": "sha512-sQoqa8alT3nHjGuTjuKgOnvjo4cljkufdtLMnO2LBP/wRwuDlo1tkaEdMxCRhyGRPacv/ztlZgDPm2b7FAmEvw==", + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/pkg-types/-/pkg-types-1.3.1.tgz", + "integrity": "sha512-/Jm5M4RvtBFVkKWRu2BLUTNP8/M2a+UwuAX+ae4770q1qVGtfjG+WTCupoZixokjmHiry8uI+dlY8KXYV5HVVQ==", "dev": true, "license": "MIT", "dependencies": { "confbox": "^0.1.8", - "mlly": "^1.7.2", - "pathe": "^1.1.2" + "mlly": "^1.7.4", + "pathe": "^2.0.1" } }, "node_modules/possible-typed-array-names": { diff --git a/package.json b/package.json index 1dd74b8..20edc1b 100644 --- a/package.json +++ b/package.json @@ -35,6 +35,7 @@ "preview": "vite preview", "prepublishOnly": "npm run build", "watch": "nodemon --watch src -e js,json,mjs,vue --exec 'npm run build'", + "dev:example": "npm run watch & vite -c example/vite.config.mjs", "test": "npm run lint && npm run typecheck", "lint": "eslint .", "typecheck": "vue-tsc --noEmit" @@ -58,6 +59,7 @@ "vue-tsc": "^2.0.21" }, "peerDependencies": { + "@mdi/js": "^7.4.47", "@types/geojson": "^7946.0.14", "ol": "*", "vue": "^3.0.0", diff --git a/src/components/PlaceSearch.vue b/src/components/PlaceSearch.vue index 5e0d432..8235f0f 100644 --- a/src/components/PlaceSearch.vue +++ b/src/components/PlaceSearch.vue @@ -1,67 +1,69 @@