Skip to content

Commit

Permalink
Main commit to create everything that is needed
Browse files Browse the repository at this point in the history
  • Loading branch information
HarelM committed Mar 12, 2024
1 parent f109189 commit ba8d70f
Show file tree
Hide file tree
Showing 31 changed files with 3,410 additions and 13,407 deletions.
1 change: 0 additions & 1 deletion .github/workflows/lint-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,3 @@ jobs:
- run: npm ci
- run: npm run lint
- run: npm run build
- run: npm run build-compat
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -95,5 +95,5 @@ jobs:
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: dist
publish_dir: docs
commit_message: 'deploy docs: ${{ steps.tag_version.outputs.new_tag }}'
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,4 @@ jspm_packages
.node_repl_history

dist
docs
70 changes: 0 additions & 70 deletions API.md

This file was deleted.

17 changes: 17 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// @ts-check

import eslint from '@eslint/js';
import tseslint from 'typescript-eslint';

export default tseslint.config(
eslint.configs.recommended,
...tseslint.configs.recommended,
{
rules: {
indent: [
2,
2
]
}
}
);
4 changes: 2 additions & 2 deletions examples/custom-color-1.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
<meta charset='utf-8' />
<title>Maplibre GL Inspect</title>
<meta name='viewport' content='initial-scale=1,maximum-scale=1,user-scalable=no' />
<script src='https://unpkg.com/maplibre-gl@1.15.2/dist/maplibre-gl.js'></script>
<link href='https://unpkg.com/maplibre-gl@1.15.2/dist/maplibre-gl.css' rel='stylesheet' />
<script src='https://unpkg.com/maplibre-gl@latest/dist/maplibre-gl.js'></script>
<link href='https://unpkg.com/maplibre-gl@latest/dist/maplibre-gl.css' rel='stylesheet' />
<script src='../dist/maplibre-gl-inspect.min.js'></script>
<link href='../dist/maplibre-gl-inspect.css' rel='stylesheet' />
<style>
Expand Down
4 changes: 2 additions & 2 deletions examples/custom-color-2.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
<meta charset='utf-8' />
<title>Maplibre GL Inspect</title>
<meta name='viewport' content='initial-scale=1,maximum-scale=1,user-scalable=no' />
<script src='https://unpkg.com/maplibre-gl@1.15.2/dist/maplibre-gl.js'></script>
<link href='https://unpkg.com/maplibre-gl@1.15.2/dist/maplibre-gl.css' rel='stylesheet' />
<script src='https://unpkg.com/maplibre-gl@latest/dist/maplibre-gl.js'></script>
<link href='https://unpkg.com/maplibre-gl@latest/dist/maplibre-gl.css' rel='stylesheet' />
<script src='../dist/maplibre-gl-inspect.min.js'></script>
<link href='../dist/maplibre-gl-inspect.css' rel='stylesheet' />
<style>
Expand Down
4 changes: 2 additions & 2 deletions examples/custom-popup.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
<meta charset='utf-8' />
<title>Maplibre GL Inspect</title>
<meta name='viewport' content='initial-scale=1,maximum-scale=1,user-scalable=no' />
<script src='https://unpkg.com/maplibre-gl@1.15.2/dist/maplibre-gl.js'></script>
<link href='https://unpkg.com/maplibre-gl@1.15.2/dist/maplibre-gl.css' rel='stylesheet' />
<script src='https://unpkg.com/maplibre-gl@latest/dist/maplibre-gl.js'></script>
<link href='https://unpkg.com/maplibre-gl@latest/dist/maplibre-gl.css' rel='stylesheet' />
<script src='../dist/maplibre-gl-inspect.min.js'></script>
<link href='../dist/maplibre-gl-inspect.css' rel='stylesheet' />
<style>
Expand Down
32 changes: 32 additions & 0 deletions examples/generate-docs.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import fs from 'fs';

const files = fs.readdirSync('./examples');
if (!fs.existsSync('./docs')) {
fs.mkdirSync('./docs');
}

for (const file of files) {
if (file.endsWith('.html')) {
let content = fs.readFileSync(`./examples/${file}`, 'utf8');
content = content.replaceAll("../", 'https://unpkg.com/@maplibre/maplibre-gl-inspect@latest/');
fs.writeFileSync(`./docs/${file}`, content);
}
}

const index = `
<!DOCTYPE html>
<html>
<head>
<meta charset='utf-8' />
<title>Maplibre GL Inspect Docs</title>
<meta name='viewport' content='initial-scale=1,maximum-scale=1,user-scalable=no' />
</head>
<body>
<H1>Maplibre GL Inspect Docs</H1>
<ul>
${files.map(f => ' <li><a href="' + f +'">' + f + '</a></li>').join('\n')}
</body>
</html>`

fs.writeFileSync(`./docs/index.html`, index);
4 changes: 2 additions & 2 deletions examples/geojson-source.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
<meta charset='utf-8' />
<title>Maplibre GL Inspect</title>
<meta name='viewport' content='initial-scale=1,maximum-scale=1,user-scalable=no' />
<script src='https://unpkg.com/maplibre-gl@1.15.2/dist/maplibre-gl.js'></script>
<link href='https://unpkg.com/maplibre-gl@1.15.2/dist/maplibre-gl.css' rel='stylesheet' />
<script src='https://unpkg.com/maplibre-gl@latest/dist/maplibre-gl.js'></script>
<link href='https://unpkg.com/maplibre-gl@latest/dist/maplibre-gl.css' rel='stylesheet' />
<script src='../dist/maplibre-gl-inspect.min.js'></script>
<link href='../dist/maplibre-gl-inspect.css' rel='stylesheet' />
<style>
Expand Down
4 changes: 2 additions & 2 deletions examples/inspect-only.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
<meta charset='utf-8' />
<title>Maplibre GL Inspect</title>
<meta name='viewport' content='initial-scale=1,maximum-scale=1,user-scalable=no' />
<script src='https://unpkg.com/maplibre-gl@1.15.2/dist/maplibre-gl.js'></script>
<link href='https://unpkg.com/maplibre-gl@1.15.2/dist/maplibre-gl.css' rel='stylesheet' />
<script src='https://unpkg.com/maplibre-gl@latest/dist/maplibre-gl.js'></script>
<link href='https://unpkg.com/maplibre-gl@latest/dist/maplibre-gl.css' rel='stylesheet' />
<script src='../dist/maplibre-gl-inspect.min.js'></script>
<link href='../dist/maplibre-gl-inspect.css' rel='stylesheet' />
<style>
Expand Down
4 changes: 2 additions & 2 deletions examples/less-fidly.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
<meta charset='utf-8' />
<title>Maplibre GL Inspect</title>
<meta name='viewport' content='initial-scale=1,maximum-scale=1,user-scalable=no' />
<script src='https://unpkg.com/maplibre-gl@1.15.2/dist/maplibre-gl.js'></script>
<link href='https://unpkg.com/maplibre-gl@1.15.2/dist/maplibre-gl.css' rel='stylesheet' />
<script src='https://unpkg.com/maplibre-gl@latest/dist/maplibre-gl.js'></script>
<link href='https://unpkg.com/maplibre-gl@latest/dist/maplibre-gl.css' rel='stylesheet' />
<script src='../dist/maplibre-gl-inspect.min.js'></script>
<link href='../dist/maplibre-gl-inspect.css' rel='stylesheet' />
<style>
Expand Down
4 changes: 2 additions & 2 deletions examples/many-sources.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
<meta charset='utf-8' />
<title>Maplibre GL Inspect</title>
<meta name='viewport' content='initial-scale=1,maximum-scale=1,user-scalable=no' />
<script src='https://unpkg.com/maplibre-gl@1.15.2/dist/maplibre-gl.js'></script>
<link href='https://unpkg.com/maplibre-gl@1.15.2/dist/maplibre-gl.css' rel='stylesheet' />
<script src='https://unpkg.com/maplibre-gl@latest/dist/maplibre-gl.js'></script>
<link href='https://unpkg.com/maplibre-gl@latest/dist/maplibre-gl.css' rel='stylesheet' />
<script src='../dist/maplibre-gl-inspect.min.js'></script>
<link href='../dist/maplibre-gl-inspect.css' rel='stylesheet' />
<style>
Expand Down
4 changes: 2 additions & 2 deletions examples/map-popup.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
<meta charset='utf-8' />
<title>Maplibre GL Inspect</title>
<meta name='viewport' content='initial-scale=1,maximum-scale=1,user-scalable=no' />
<script src='https://unpkg.com/maplibre-gl@1.15.2/dist/maplibre-gl.js'></script>
<link href='https://unpkg.com/maplibre-gl@1.15.2/dist/maplibre-gl.css' rel='stylesheet' />
<script src='https://unpkg.com/maplibre-gl@latest/dist/maplibre-gl.js'></script>
<link href='https://unpkg.com/maplibre-gl@latest/dist/maplibre-gl.css' rel='stylesheet' />
<script src='../dist/maplibre-gl-inspect.min.js'></script>
<link href='../dist/maplibre-gl-inspect.css' rel='stylesheet' />
<style>
Expand Down
4 changes: 2 additions & 2 deletions examples/no-inspect-style.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
<meta charset='utf-8' />
<title>Maplibre GL Inspect</title>
<meta name='viewport' content='initial-scale=1,maximum-scale=1,user-scalable=no' />
<script src='https://unpkg.com/maplibre-gl@1.15.2/dist/maplibre-gl.js'></script>
<link href='https://unpkg.com/maplibre-gl@1.15.2/dist/maplibre-gl.css' rel='stylesheet' />
<script src='https://unpkg.com/maplibre-gl@latest/dist/maplibre-gl.js'></script>
<link href='https://unpkg.com/maplibre-gl@latest/dist/maplibre-gl.css' rel='stylesheet' />
<script src='../dist/maplibre-gl-inspect.min.js'></script>
<link href='../dist/maplibre-gl-inspect.css' rel='stylesheet' />
<style>
Expand Down
4 changes: 2 additions & 2 deletions examples/no-options.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
<meta charset='utf-8' />
<title>Maplibre GL Inspect</title>
<meta name='viewport' content='initial-scale=1,maximum-scale=1,user-scalable=no' />
<script src='https://unpkg.com/maplibre-gl@1.15.2/dist/maplibre-gl.js'></script>
<link href='https://unpkg.com/maplibre-gl@1.15.2/dist/maplibre-gl.css' rel='stylesheet' />
<script src='https://unpkg.com/maplibre-gl@latest/dist/maplibre-gl.js'></script>
<link href='https://unpkg.com/maplibre-gl@latest/dist/maplibre-gl.css' rel='stylesheet' />
<script src='../dist/maplibre-gl-inspect.min.js'></script>
<link href='../dist/maplibre-gl-inspect.css' rel='stylesheet' />
<style>
Expand Down
4 changes: 2 additions & 2 deletions examples/no-popup.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
<meta charset='utf-8' />
<title>Maplibre GL Inspect</title>
<meta name='viewport' content='initial-scale=1,maximum-scale=1,user-scalable=no' />
<script src='https://unpkg.com/maplibre-gl@1.15.2/dist/maplibre-gl.js'></script>
<link href='https://unpkg.com/maplibre-gl@1.15.2/dist/maplibre-gl.css' rel='stylesheet' />
<script src='https://unpkg.com/maplibre-gl@latest/dist/maplibre-gl.js'></script>
<link href='https://unpkg.com/maplibre-gl@latest/dist/maplibre-gl.css' rel='stylesheet' />
<script src='../dist/maplibre-gl-inspect.min.js'></script>
<link href='../dist/maplibre-gl-inspect.css' rel='stylesheet' />
<style>
Expand Down
4 changes: 2 additions & 2 deletions examples/popup-on-click.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
<meta charset='utf-8' />
<title>Maplibre GL Inspect</title>
<meta name='viewport' content='initial-scale=1,maximum-scale=1,user-scalable=no' />
<script src='https://unpkg.com/maplibre-gl@1.15.2/dist/maplibre-gl.js'></script>
<link href='https://unpkg.com/maplibre-gl@1.15.2/dist/maplibre-gl.css' rel='stylesheet' />
<script src='https://unpkg.com/maplibre-gl@latest/dist/maplibre-gl.js'></script>
<link href='https://unpkg.com/maplibre-gl@latest/dist/maplibre-gl.css' rel='stylesheet' />
<script src='../dist/maplibre-gl-inspect.min.js'></script>
<link href='../dist/maplibre-gl-inspect.css' rel='stylesheet' />
<style>
Expand Down
4 changes: 2 additions & 2 deletions examples/query-params.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
<meta charset='utf-8' />
<title>Maplibre GL Inspect</title>
<meta name='viewport' content='initial-scale=1,maximum-scale=1,user-scalable=no' />
<script src='https://unpkg.com/maplibre-gl@1.15.2/dist/maplibre-gl.js'></script>
<link href='https://unpkg.com/maplibre-gl@1.15.2/dist/maplibre-gl.css' rel='stylesheet' />
<script src='https://unpkg.com/maplibre-gl@latest/dist/maplibre-gl.js'></script>
<link href='https://unpkg.com/maplibre-gl@latest/dist/maplibre-gl.css' rel='stylesheet' />
<script src='../dist/maplibre-gl-inspect.min.js'></script>
<link href='../dist/maplibre-gl-inspect.css' rel='stylesheet' />
<style>
Expand Down
4 changes: 2 additions & 2 deletions examples/raster.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
<meta charset='utf-8' />
<title>Maplibre GL Inspect</title>
<meta name='viewport' content='initial-scale=1,maximum-scale=1,user-scalable=no' />
<script src='https://unpkg.com/maplibre-gl@1.15.2/dist/maplibre-gl.js'></script>
<link href='https://unpkg.com/maplibre-gl@1.15.2/dist/maplibre-gl.css' rel='stylesheet' />
<script src='https://unpkg.com/maplibre-gl@latest/dist/maplibre-gl.js'></script>
<link href='https://unpkg.com/maplibre-gl@latest/dist/maplibre-gl.css' rel='stylesheet' />
<script src='../dist/maplibre-gl-inspect.min.js'></script>
<link href='../dist/maplibre-gl-inspect.css' rel='stylesheet' />
<style>
Expand Down
4 changes: 2 additions & 2 deletions examples/url-hash-toggle-callback.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
<meta charset='utf-8' />
<title>Maplibre GL Inspect</title>
<meta name='viewport' content='initial-scale=1,maximum-scale=1,user-scalable=no' />
<script src='https://unpkg.com/maplibre-gl@1.15.2/dist/maplibre-gl.js'></script>
<link href='https://unpkg.com/maplibre-gl@1.15.2/dist/maplibre-gl.css' rel='stylesheet' />
<script src='https://unpkg.com/maplibre-gl@latest/dist/maplibre-gl.js'></script>
<link href='https://unpkg.com/maplibre-gl@latest/dist/maplibre-gl.css' rel='stylesheet' />
<script src='../dist/maplibre-gl-inspect.min.js'></script>
<link href='../dist/maplibre-gl-inspect.css' rel='stylesheet' />
<style>
Expand Down
36 changes: 0 additions & 36 deletions index.html

This file was deleted.

11 changes: 8 additions & 3 deletions lib/InspectButton.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
type InspectButtonOptions = {
show: boolean;
onToggle: () => void;
};

class InspectButton {
_btn: HTMLButtonElement;
elem: HTMLDivElement;

constructor(options: any) {
constructor(options: InspectButtonOptions) {
options = Object.assign({
show: true,
onToggle() {}
Expand Down Expand Up @@ -33,10 +38,10 @@ class InspectButton {

public setInspectIcon() {
this._btn.className = 'maplibregl-ctrl-icon maplibregl-ctrl-inspect';
};
}

public setMapIcon() {
this._btn.className = 'maplibregl-ctrl-icon maplibregl-ctrl-map';
};
}
}
export default InspectButton;
Loading

0 comments on commit ba8d70f

Please sign in to comment.