Skip to content

Commit

Permalink
chore: minor housekeeping 🧹
Browse files Browse the repository at this point in the history
  • Loading branch information
vinayakkulkarni committed Mar 9, 2024
1 parent c8558bc commit 5d0d576
Show file tree
Hide file tree
Showing 48 changed files with 7,946 additions and 10,766 deletions.
2 changes: 2 additions & 0 deletions certs/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*.*
!.gitignore
52 changes: 50 additions & 2 deletions config/index.ts
Original file line number Diff line number Diff line change
@@ -1,21 +1,54 @@
import type { NuxtConfig } from 'nuxt/schema';
import { head } from './head';

const DEV = process.env.NODE_ENV !== 'production';

const app: NuxtConfig['app'] = {
head,
};

const components: NuxtConfig['components'] = false;

const css: NuxtConfig['css'] = [
'maplibre-gl/dist/maplibre-gl.css',
'maplibre-gl.css',
'v-mapbox/dist/v-mapbox.css',
'~/assets/css/global.css',
'~/assets/css/fonts.css',
];

const debug: NuxtConfig['debug'] = DEV;

const dev: NuxtConfig['dev'] = DEV;

const devtools: NuxtConfig['devtools'] = {
enabled: DEV,
};

const devServer: NuxtConfig['devServer'] = {
port: Number(process.env.NITRO_PORT) || 3000,
https: {
key: process.env.NITRO_SSL_KEY || './certs/localhost-key.pem',
cert: process.env.NITRO_SSL_CERT || './certs/localhost.pem',
},
};

const experimental: NuxtConfig['experimental'] = {
asyncEntry: true,
emitRouteChunkError: 'automatic',
viewTransition: true,
componentIslands: true,
payloadExtraction: true,
typedPages: true,
};

const nitro: NuxtConfig['nitro'] = {
preset: 'netlify',
preset: !DEV ? 'netlify' : 'static',
future: {
nativeSWR: true,
},
prerender: {
crawlLinks: true,
},
};

const plugins: NuxtConfig['plugins'] = [
Expand Down Expand Up @@ -51,15 +84,30 @@ const typescript: NuxtConfig['typescript'] = {
shim: false,
};

const vite: NuxtConfig['vite'] = {
resolve: {
alias: {
'maplibre-gl': 'maplibre-gl/dist/maplibre-gl-dev.js',
'maplibre-gl.css': 'maplibre-gl/dist/maplibre-gl.css',
},
},
};

export { modules } from './modules';
export {
app,
components,
css,
debug,
dev,
devServer,
devtools,
experimental,
nitro,
plugins,
routeRules,
runtimeConfig,
ssr,
typescript,
vite,
};
52 changes: 0 additions & 52 deletions lib/v-mapbox/controls/VControlAttribution.vue

This file was deleted.

41 changes: 0 additions & 41 deletions lib/v-mapbox/controls/VControlFullscreen.vue

This file was deleted.

47 changes: 0 additions & 47 deletions lib/v-mapbox/controls/VControlGeolocate.vue

This file was deleted.

41 changes: 0 additions & 41 deletions lib/v-mapbox/controls/VControlNavigation.vue

This file was deleted.

41 changes: 0 additions & 41 deletions lib/v-mapbox/controls/VControlScale.vue

This file was deleted.

49 changes: 49 additions & 0 deletions lib/v-mapbox/controls/attribution/VControlAttribution.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
<script setup lang="ts">
import type { AttributionOptions, ControlPosition } from './types';
import { AttributionControl } from 'maplibre-gl';
import { onMounted } from 'vue';
import { MapKey, injectStrict } from '../../utils';
const defaultOptions: AttributionOptions = {
compact: false,
customAttribution: undefined,
};
const props = withDefaults(
defineProps<{
options?: AttributionOptions;
position?: ControlPosition;
}>(),
{
options: undefined,
position: 'bottom-right',
},
);
const slots = useSlots();
let map = injectStrict(MapKey);
onMounted(() => {
addControl();
});
const addControl = (): void => {
let options = defaultOptions;
if (props.options) {
options = {
...props.options,
};
}
if (slots && slots.default?.()) {
options.customAttribution = slots.default()[0]
.children as unknown as string;
}
const control = new AttributionControl(options);
map.value.addControl(control, props.position);
};
</script>

<template>
<slot />
</template>
1 change: 1 addition & 0 deletions lib/v-mapbox/controls/attribution/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { default as AttributionControl } from './VControlAttribution.vue';
1 change: 1 addition & 0 deletions lib/v-mapbox/controls/attribution/types.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export type { AttributionOptions, ControlPosition } from 'maplibre-gl';
Loading

0 comments on commit 5d0d576

Please sign in to comment.