Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add documentation #14

Merged
merged 3 commits into from
Aug 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 1 addition & 1 deletion .changeset/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@
"access": "public",
"baseBranch": "main",
"updateInternalDependencies": "patch",
"ignore": []
"ignore": ["demo"]
}
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ This monorepo manages the source code for `@watergis/maplibre-gl-sky`.

| repository | version | description | changelog |
|---|---|---|---|
|[@watergis/maplibre-gl-sky](./packages/maplibre-gl-sky/)| [![version](https://img.shields.io/npm/v/@watergis/maplibre-gl-sky.svg)](https://www.npmjs.com/package/@watergis/maplibre-gl-sky) | To manage maplibre export plugin source code|[CHANGELOG](./packages/maplibre-gl-sky/CHANGELOG.md)|
|[@watergis/maplibre-gl-sky](./packages/maplibre-gl-sky/)| [![version](https://img.shields.io/npm/v/@watergis/maplibre-gl-sky.svg)](https://www.npmjs.com/package/@watergis/maplibre-gl-sky) | To manage maplibre sky plugin source code|[CHANGELOG](./packages/maplibre-gl-sky/CHANGELOG.md)|
|[Demo & Documentation](./sites/demo/)| - | Demo website code for maplibre sky plugin |-|

## Contribution

Expand Down
2,008 changes: 2,001 additions & 7 deletions pnpm-lock.yaml

Large diffs are not rendered by default.

21 changes: 21 additions & 0 deletions sites/demo/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
node_modules

# Output
.output
.vercel
/.svelte-kit
/build

# OS
.DS_Store
Thumbs.db

# Env
.env
.env.*
!.env.example
!.env.test

# Vite
vite.config.js.timestamp-*
vite.config.ts.timestamp-*
1 change: 1 addition & 0 deletions sites/demo/.npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
engine-strict=true
4 changes: 4 additions & 0 deletions sites/demo/.prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Package Managers
package-lock.json
pnpm-lock.yaml
yarn.lock
8 changes: 8 additions & 0 deletions sites/demo/.prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"useTabs": true,
"singleQuote": true,
"trailingComma": "none",
"printWidth": 100,
"plugins": ["prettier-plugin-svelte"],
"overrides": [{ "files": "*.svelte", "options": { "parser": "svelte" } }]
}
38 changes: 38 additions & 0 deletions sites/demo/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# create-svelte

Everything you need to build a Svelte project, powered by [`create-svelte`](https://github.com/sveltejs/kit/tree/main/packages/create-svelte).

## Creating a project

If you're seeing this, you've probably already done this step. Congrats!

```bash
# create a new project in the current directory
npm create svelte@latest

# create a new project in my-app
npm create svelte@latest my-app
```

## Developing

Once you've created a project and installed dependencies with `npm install` (or `pnpm install` or `yarn`), start a development server:

```bash
npm run dev

# or start the server and open the app in a new browser tab
npm run dev -- --open
```

## Building

To create a production version of your app:

```bash
npm run build
```

You can preview the production build with `npm run preview`.

> To deploy your app, you may need to install an [adapter](https://kit.svelte.dev/docs/adapters) for your target environment.
33 changes: 33 additions & 0 deletions sites/demo/eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import js from '@eslint/js';
import ts from 'typescript-eslint';
import svelte from 'eslint-plugin-svelte';
import prettier from 'eslint-config-prettier';
import globals from 'globals';

/** @type {import('eslint').Linter.Config[]} */
export default [
js.configs.recommended,
...ts.configs.recommended,
...svelte.configs['flat/recommended'],
prettier,
...svelte.configs['flat/prettier'],
{
languageOptions: {
globals: {
...globals.browser,
...globals.node
}
}
},
{
files: ['**/*.svelte'],
languageOptions: {
parserOptions: {
parser: ts.parser
}
}
},
{
ignores: ['build/', '.svelte-kit/', 'dist/']
}
];
48 changes: 48 additions & 0 deletions sites/demo/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
{
"name": "demo",
"version": "0.0.1",
"private": true,
"scripts": {
"dev": "vite dev",
"build": "vite build",
"preview": "vite preview",
"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",
"lint": "prettier --check . && eslint .",
"format": "prettier --write ."
},
"devDependencies": {
"@skeletonlabs/skeleton": "2.10.2",
"@skeletonlabs/tw-plugin": "0.4.0",
"@sveltejs/adapter-auto": "^3.0.0",
"@sveltejs/kit": "^2.0.0",
"@sveltejs/vite-plugin-svelte": "^3.0.0",
"@tailwindcss/forms": "0.5.7",
"@tailwindcss/typography": "0.5.14",
"@types/eslint": "^9.6.0",
"@types/node": "22.2.0",
"@watergis/maplibre-gl-sky": "workspace:^",
"autoprefixer": "10.4.20",
"eslint": "^9.0.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-svelte": "^2.36.0",
"globals": "^15.0.0",
"maplibre-gl": "^4.5.1",
"postcss": "8.4.41",
"prettier": "^3.1.1",
"prettier-plugin-svelte": "^3.1.2",
"sass-embedded": "^1.77.8",
"svelte": "^4.2.7",
"svelte-check": "^3.6.0",
"tailwindcss": "3.4.9",
"typescript": "^5.0.0",
"typescript-eslint": "^8.0.0",
"vite": "^5.0.3",
"vite-plugin-tailwind-purgecss": "0.3.3"
},
"type": "module",
"dependencies": {
"@floating-ui/dom": "1.6.10",
"highlight.js": "11.10.0"
}
}
6 changes: 6 additions & 0 deletions sites/demo/postcss.config.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
module.exports = {
plugins: {
tailwindcss: {},
autoprefixer: {}
}
};
9 changes: 9 additions & 0 deletions sites/demo/src/app.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// See https://kit.svelte.dev/docs/types#app
// for information about these interfaces
// and what to do when importing types
declare namespace App {
// interface Locals {}
// interface PageData {}
// interface Error {}
// interface Platform {}
}
12 changes: 12 additions & 0 deletions sites/demo/src/app.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<!doctype html>
<html lang="en" class="dark">
<head>
<meta charset="utf-8" />
<link rel="icon" href="%sveltekit.assets%/favicon.png" />
<meta name="viewport" content="width=device-width" />
%sveltekit.head%
</head>
<body data-sveltekit-preload-data="hover" data-theme="wintry">
<div style="display: contents" class="h-full overflow-hidden">%sveltekit.body%</div>
</body>
</html>
9 changes: 9 additions & 0 deletions sites/demo/src/app.postcss
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
@tailwind base;
@tailwind components;
@tailwind utilities;
@tailwind variants;

html,
body {
@apply h-full overflow-hidden;
}
31 changes: 31 additions & 0 deletions sites/demo/src/lib/Navigation.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<script>
import { LightSwitch } from '@skeletonlabs/skeleton';
import { getDrawerStore } from '@skeletonlabs/skeleton';
const drawerStore = getDrawerStore();
const drawerClose = () => {
drawerStore.close();
};
</script>

<nav class="list-nav p-4">
<ul>
<li><a href="/" on:click={drawerClose}>Homepage</a></li>
<li>
<a href="https://twitter.com/j_igarashi" target="_blank" on:click={drawerClose}> Twitter </a>
</li>
<li>
<a href="https://github.com/watergis/maplibre-gl-sky" target="_blank" on:click={drawerClose}>
GitHub
</a>
</li>
<li>
<div class="flex items-center px-4">
<span class="pr-4">Light/Dark switch</span>
<span><LightSwitch /></span>
</div>
</li>
</ul>
</nav>
27 changes: 27 additions & 0 deletions sites/demo/src/routes/(demo)/+layout.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<script lang="ts">
import '../../app.postcss';
</script>

<svelte:head>
<link
rel="stylesheet"
href="https://cdnjs.cloudflare.com/ajax/libs/github-fork-ribbon-css/0.2.3/gh-fork-ribbon.min.css"
/>

<style>
html,
body {
padding: 0;
margin: 0;
}
</style>
</svelte:head>

<a
class="github-fork-ribbon left-top"
href="https://github.com/watergis/maplibre-gl-sky"
data-ribbon="Fork me on GitHub"
title="Fork me on GitHub">Fork me on GitHub</a
>

<slot />
91 changes: 91 additions & 0 deletions sites/demo/src/routes/(demo)/maplibre/+page.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
<script lang="ts">
import { Map, AttributionControl, NavigationControl, GeolocateControl } from 'maplibre-gl';
import { onMount } from 'svelte';
import 'maplibre-gl/dist/maplibre-gl.css';
import type { PageData } from './$types';
import {
AvailableTimeTypes,
SkyControl,
type AddToOptions,
type TimeType
} from '@watergis/maplibre-gl-sky';
export let data: PageData;
let map: Map;
let activeTime: TimeType | 'auto' = 'auto';
onMount(() => {
map = new Map({
container: 'map',
style: data.style,
maxPitch: 85,
hash: true,
attributionControl: false
});
map.addControl(new NavigationControl({ visualizePitch: true }), 'top-right');
map.addControl(new AttributionControl({ compact: false }), 'bottom-right');
map.addControl(
new GeolocateControl({
positionOptions: {
enableHighAccuracy: true
},
trackUserLocation: true
}),
'top-right'
);
initSky();
});
const initSky = (type?: TimeType) => {
if (!map) return;
const sky = new SkyControl();
let options: AddToOptions = {};
if (type) {
options.timeType = type;
}
activeTime = type ?? 'auto';
sky.addTo(map, options);
};
</script>

<div id="map" />

<div class="overlay">
<div class="btn-group-vertical variant-filled">
<button
class="btn {activeTime === 'auto' ? 'variant-filled-primary' : ''} capitalize"
on:click={() => {
initSky();
}}>Auto</button
>
{#each AvailableTimeTypes as type}
<button
class="btn {activeTime === type ? 'variant-filled-primary' : ''} capitalize"
on:click={() => {
initSky(type);
}}>{type}</button
>
{/each}
</div>
</div>

<style lang="scss">
#map {
position: absolute;
top: 0;
bottom: 0;
width: 100%;
z-index: 10;
}
.overlay {
position: absolute;
bottom: 20px;
left: 10px;
z-index: 10;
}
</style>
Loading