Skip to content

Commit

Permalink
Merge pull request #17 from camptocamp/add-webcomponent
Browse files Browse the repository at this point in the history
Add @geospatial-sdk/elements package with map webcomponent
  • Loading branch information
jahow authored Oct 12, 2024
2 parents 89507d8 + 85f4662 commit e299e56
Show file tree
Hide file tree
Showing 58 changed files with 1,700 additions and 2,379 deletions.
2 changes: 1 addition & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,5 @@
"rules": {
"@typescript-eslint/no-explicit-any": 1
},
"ignorePatterns": ["**/*.test.ts", "apps", "**/mocks"]
"ignorePatterns": ["**/*.test.ts", "apps", "**/mocks", "**/dist/**"]
}
10 changes: 8 additions & 2 deletions .github/workflows/gh-pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,19 @@ jobs:
- name: Build
run: npm run build -- --base=/geospatial-sdk
working-directory: apps/examples
- name: Build docs
run: npm run docs:build -- --base=/geospatial-sdk/docs
working-directory: docs
- name: Setup Pages
uses: actions/configure-pages@v4
- name: Upload artifact
- name: Upload artifact (examples)
uses: actions/upload-pages-artifact@v3
with:
# Upload dist folder
path: apps/examples/dist
- name: Upload artifact (docs)
uses: actions/upload-pages-artifact@v3
with:
path: docs/.vitepress/dist
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
27 changes: 20 additions & 7 deletions apps/examples/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion apps/examples/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
"format": "prettier --write src/"
},
"dependencies": {
"@geospatial-sdk/openlayers": "file:../../packages/openlayers",
"highlight.js": "^11.9.0",
"lodash.debounce": "^4.0.8",
"vue": "^3.3.11"
Expand Down
10 changes: 10 additions & 0 deletions apps/examples/src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ import ExampleZoomToLayer from '@/examples/Example-ZoomToLayer.vue'
import ExampleZoomToLayerRaw from '@/examples/Example-ZoomToLayer.vue?raw'
import ExampleMapEvents from '@/examples/Example-MapEvents.vue'
import ExampleMapEventsRaw from '@/examples/Example-MapEvents.vue?raw'
import ExampleCustomElements from '@/examples/Example-CustomElements.vue'
import ExampleCustomElementsRaw from '@/examples/Example-CustomElements.vue?raw'
import { onMounted } from 'vue'
import hljs from 'highlight.js'
Expand All @@ -22,6 +24,7 @@ onMounted(() => {
<div class="flex flex-col items-center p-4 overflow-x-hidden">
<h1 class="text-5xl font-bold m-6">Geospatial SDK</h1>
<p class="mb-6">An incredible SDK with many examples.</p>
<p class="mb-6"><a href="/docs/">Go to the documentation website</a></p>
<ExampleContainer
example-name="Example 1: simple map"
example-id="example01"
Expand Down Expand Up @@ -57,6 +60,13 @@ onMounted(() => {
>
<ExampleGeocoding></ExampleGeocoding>
</ExampleContainer>
<ExampleContainer
example-name="Example 6: show a map using a custom element"
example-id="example06"
:source-code="ExampleCustomElementsRaw"
>
<ExampleCustomElements></ExampleCustomElements>
</ExampleContainer>
</div>
</template>

Expand Down
27 changes: 27 additions & 0 deletions apps/examples/src/examples/Example-CustomElements.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<script setup lang="ts">
import { onMounted, ref } from 'vue'
import { SdkMapElement } from '@geospatial-sdk/elements'
import '@geospatial-sdk/elements' // this includes the web component
const mapElement = ref<SdkMapElement>()
onMounted(() => {
if (!mapElement.value) return
mapElement.value.context = {
layers: [
{
type: 'maplibre-style',
styleUrl:
'https://data.geopf.fr/annexes/ressources/vectorTiles/styles/PLAN.IGN/standard.json'
}
],
view: {
zoom: 12,
center: [2.33, 48.86]
}
}
})
</script>

<template>
<geosdk-map ref="mapElement"></geosdk-map>
</template>
1 change: 0 additions & 1 deletion apps/examples/src/main.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import './style.css'
import 'highlight.js/styles/base16/railscasts.min.css'

import { createApp } from 'vue'
import App from './App.vue'

Expand Down
2 changes: 0 additions & 2 deletions apps/examples/src/style.css
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
@import 'ol/ol.css';

@tailwind base;
@tailwind components;
@tailwind utilities;
Expand Down
11 changes: 10 additions & 1 deletion apps/examples/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,16 @@ import vue from '@vitejs/plugin-vue'

// https://vitejs.dev/config/
export default defineConfig({
plugins: [vue()],
plugins: [
vue({
template: {
compilerOptions: {
// See https://vuejs.org/guide/extras/web-components
isCustomElement: (tag) => tag.includes('-')
}
}
})
],
resolve: {
alias: {
'@': fileURLToPath(new URL('./src', import.meta.url))
Expand Down
1 change: 1 addition & 0 deletions docs/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
api
7 changes: 4 additions & 3 deletions docs/.vitepress/config.mts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { defineConfig } from 'vitepress'
import typedocSidebar from '../api/typedoc-sidebar.json';
import {defineConfig} from 'vitepress'
import typedocSidebar from '../api/typedoc-sidebar.json'

// https://vitepress.dev/reference/site-config
export default defineConfig({
Expand All @@ -9,7 +9,8 @@ export default defineConfig({
// https://vitepress.dev/reference/default-theme-config
nav: [
{ text: 'Home', link: '/' },
{ text: 'API Reference', link: '/api/' }
{ text: 'API Reference', link: '/api/' },
{ text: 'Examples', link: 'https://camptocamp.github.io/geospatial-sdk/', }
],

sidebar: [
Expand Down
42 changes: 0 additions & 42 deletions docs/api/core/functions/computeMapContextDiff.md

This file was deleted.

27 changes: 0 additions & 27 deletions docs/api/core/functions/deepFreeze.md

This file was deleted.

27 changes: 0 additions & 27 deletions docs/api/core/functions/removeSearchParams.md

This file was deleted.

43 changes: 0 additions & 43 deletions docs/api/core/index.md

This file was deleted.

31 changes: 0 additions & 31 deletions docs/api/core/interfaces/MapContext.md

This file was deleted.

Loading

0 comments on commit e299e56

Please sign in to comment.