Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# EditorConfig is awesome: https://EditorConfig.org

# top-most EditorConfig file
root = true

[*]
indent_style = space
indent_size = 2
end_of_line = LF
charset = utf-8
trim_trailing_whitespace = false
insert_final_newline = true
max_line_length = 180
31 changes: 24 additions & 7 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,29 @@ yarn-error.log*
pnpm-debug.log*
lerna-debug.log*

node_modules
dist
dist.svelte
*.local
.svelte-kit
# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json

# Dependency directories
node_modules/

# TypeScript cache
*.tsbuildinfo

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# Editor directories and files
.vscode/*
Expand All @@ -24,5 +42,4 @@ dist.svelte
*.sln
*.sw?

*.tgz
src/info.json
dist
2 changes: 1 addition & 1 deletion .lintstagedrc.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"*": ["prettier --check"],
"*.{ts,svelte}": ["eslint"]
"*.{ts}": ["eslint"]
}
12 changes: 12 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
images
demos
public
src
!dist/src
*.tgz
.github
.husky
.vscode
vite*
.*
tsconfig.json
3 changes: 1 addition & 2 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
{
"plugins": ["prettier-plugin-svelte", "prettier-plugin-organize-imports"],
"overrides": [{ "files": "*.svelte", "options": { "parser": "svelte" } }],
"plugins": ["prettier-plugin-organize-imports"],
"organizeImportsSkipDestructiveCodeActions": true
}
4 changes: 3 additions & 1 deletion .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
{
"recommendations": ["svelte.svelte-vscode"]
"recommendations": [
"runem.lit-plugin"
]
}
29 changes: 0 additions & 29 deletions create-cdn-pr.sh

This file was deleted.

2 changes: 2 additions & 0 deletions demos/.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
VITE_API_URL=https://api.maptiler.com/geocoding
VITE_LIB_VERSION=$npm_package_version
11 changes: 11 additions & 0 deletions demos/eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// @ts-nocheck

import tseslint from "typescript-eslint";
import baseConfig from "../eslint.config.js";

export default tseslint.config(baseConfig, {
rules: {
"@typescript-eslint/no-unsafe-argument": "off",
"@typescript-eslint/no-unsafe-assignment": "off",
},
});
20 changes: 20 additions & 0 deletions demos/public/01-standalone.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<html>

<head>
<title>MapTiler Geocoding Control example</title>
<style>
body {
display: flex;
flex-direction: row;
justify-content: space-between;
}
</style>
</head>

<body>
<maptiler-geocoder class="first"></maptiler-geocoder>
<maptiler-geocoder class="second"></maptiler-geocoder>
<script type="module" src="/src/01-standalone.ts"></script>
</body>

</html>
32 changes: 32 additions & 0 deletions demos/public/02-maptiler-sdk.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<html>

<head>
<title>MapTiler Geocoding Control example</title>
<style>
html,
body {
margin: 0;
}

#map {
position: absolute;
width: 100vw;
height: 100vh;
background: #ccc;
}

#style-picker-container {
position: absolute;
z-index: 2;
margin: 10px;
}
</style>
</head>

<body>
<div id="map"></div>
<script type="module" src="/src/02-maptiler-sdk.ts"></script>
</body>

</html>

32 changes: 32 additions & 0 deletions demos/public/03-maplibregl.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<html>

<head>
<title>MapTiler Geocoding Control example</title>
<style>
html,
body {
margin: 0;
}

#map {
position: absolute;
width: 100vw;
height: 100vh;
background: #ccc;
}

#style-picker-container {
position: absolute;
z-index: 2;
margin: 10px;
}
</style>
</head>

<body>
<div id="map"></div>
<script type="module" src="/src/03-maplibregl.ts"></script>
</body>

</html>

60 changes: 60 additions & 0 deletions demos/public/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
<!DOCTYPE html>
<html lang="en">

<head>
<meta charset="UTF-8" />

<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>MapTiler Geocoding Control Demos</title>

<style>
body {
position: relative;
background: #ffaa07;
display: flex;
justify-content: center;
}

#container {
position: relative;
top: 20%;
padding: 20px 32px 32px 32px;
background: white;
border: black 3px solid;
filter: drop-shadow(12px 12px 0px rgba(0, 0, 0, 0.33));
display: flex;
flex-direction: column;
align-items: center;
text-align: center;
justify-content: center;
gap: 24px;
}

a {
text-decoration: none;
color: rgba(0, 0, 0, 0.5);
transition: all 0.3s;
text-transform: uppercase;
font-weight: 400;
}

a:hover {
color: #000;
}
</style>
</head>

<body>
<div>

<div id="container">
<img src="/maptiler-sdk-logo.svg" width="400px" />
<a href="01-standalone.html">Standalone →</a>
<a href="02-maptiler-sdk.html">MapTiler SDK →</a>
<a href="03-maplibregl.html">MapLibre GL →</a>
</div>
</div>
</body>

</html>

66 changes: 66 additions & 0 deletions demos/public/maptiler-sdk-logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 7 additions & 0 deletions demos/src/01-standalone.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import "../../src";

import { getApiKey } from "./demo-utils";

for (const el of document.querySelectorAll("maptiler-geocoder")) {
el.apiKey = getApiKey();
}
35 changes: 35 additions & 0 deletions demos/src/02-maptiler-sdk.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import { Map, MapStyle } from "@maptiler/sdk";
import "@maptiler/sdk/dist/maptiler-sdk.css";

import { MaptilerGeocodingControl } from "../../src/maptilersdk";

import { getApiKey } from "./demo-utils";

const map = new Map({
container: "map",
apiKey: getApiKey(),
style: MapStyle.BASIC,
hash: true,
});

map.addControl(
new MaptilerGeocodingControl({
keepListOpen: true,
enableReverse: "button",
collapsed: false,
pickedResultStyle: "full-geometry",
types: ["locality"],
fullGeometryStyle: true,
}),
"top-right",
);

map.addControl(
new MaptilerGeocodingControl({
keepListOpen: false,
enableReverse: "button",
collapsed: false,
showResultsWhileTyping: false,
}),
"top-left",
);
Loading
Loading