-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #40 from jerch/fix_bundling
expose .svelte files in bundle
- Loading branch information
Showing
43 changed files
with
1,223 additions
and
2,595 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,3 +2,7 @@ | |
/build/ | ||
|
||
.DS_Store | ||
|
||
.svelte-kit | ||
package-lock.json | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
<script>import { createEventDispatcher, getContext, onDestroy, setContext } from "svelte"; | ||
import { | ||
Circle, | ||
Layer, | ||
Map | ||
} from "leaflet"; | ||
import EventBridge from "../lib/EventBridge.js"; | ||
const dispatch = createEventDispatcher(); | ||
const mapProvider = getContext(Map); | ||
export let latLng; | ||
export let radius = 10; | ||
export let color = "#3388ff"; | ||
export let weight = 3; | ||
export let opacity = 1; | ||
export let lineCap = "round"; | ||
export let lineJoin = "round"; | ||
export let dashArray = void 0; | ||
export let dashOffset = void 0; | ||
export let fill = true; | ||
export let fillColor = "#3388ff"; | ||
export let fillOpacity = 0.2; | ||
export let fillRule = "evenodd"; | ||
export let options = { | ||
radius: void 0 | ||
}; | ||
export let events = []; | ||
let circle; | ||
let eventBridge; | ||
setContext(Layer, () => circle); | ||
$: { | ||
if (!circle) { | ||
circle = new Circle(latLng, { ...options, ...{ radius } }).addTo(mapProvider()); | ||
eventBridge = new EventBridge(circle, dispatch, events); | ||
} | ||
circle.setLatLng(latLng); | ||
circle.setRadius(radius); | ||
circle.setStyle({ | ||
color, | ||
weight, | ||
opacity, | ||
lineCap, | ||
lineJoin, | ||
dashArray, | ||
dashOffset, | ||
fill, | ||
fillColor, | ||
fillOpacity, | ||
fillRule | ||
}); | ||
} | ||
onDestroy(() => { | ||
eventBridge.unregister(); | ||
circle.removeFrom(mapProvider()); | ||
}); | ||
export function getCircle() { | ||
return circle; | ||
} | ||
</script> | ||
|
||
<div> | ||
{#if circle} | ||
<slot/> | ||
{/if} | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import { SvelteComponent } from "svelte"; | ||
import { Circle, type CircleOptions, type FillRule, type LatLngExpression, type LineCapShape, type LineJoinShape } from 'leaflet'; | ||
declare const __propDef: { | ||
props: { | ||
latLng: LatLngExpression; | ||
radius?: number | undefined; | ||
color?: string | undefined; | ||
weight?: number | undefined; | ||
opacity?: number | undefined; | ||
lineCap?: LineCapShape | undefined; | ||
lineJoin?: LineJoinShape | undefined; | ||
dashArray?: string | number[] | undefined; | ||
dashOffset?: string | undefined; | ||
fill?: boolean | undefined; | ||
fillColor?: string | undefined; | ||
fillOpacity?: number | undefined; | ||
fillRule?: FillRule | undefined; | ||
options?: CircleOptions | undefined; | ||
events?: string[] | undefined; | ||
getCircle?: (() => Circle | undefined) | undefined; | ||
}; | ||
events: { | ||
[evt: string]: CustomEvent<any>; | ||
}; | ||
slots: { | ||
default: {}; | ||
}; | ||
}; | ||
export type CircleProps = typeof __propDef.props; | ||
export type CircleEvents = typeof __propDef.events; | ||
export type CircleSlots = typeof __propDef.slots; | ||
export default class Circle extends SvelteComponent<CircleProps, CircleEvents, CircleSlots> { | ||
get getCircle(): () => Circle<any> | undefined; | ||
} | ||
export {}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
<script>import { createEventDispatcher, getContext, onDestroy, setContext } from "svelte"; | ||
import { | ||
CircleMarker, | ||
Layer, | ||
Map | ||
} from "leaflet"; | ||
import EventBridge from "../lib/EventBridge.js"; | ||
const dispatch = createEventDispatcher(); | ||
const mapProvider = getContext(Map); | ||
export let latLng; | ||
export let radius = 10; | ||
export let color = "#3388ff"; | ||
export let weight = 3; | ||
export let opacity = 1; | ||
export let lineCap = "round"; | ||
export let lineJoin = "round"; | ||
export let dashArray = void 0; | ||
export let dashOffset = void 0; | ||
export let fill = true; | ||
export let fillColor = "#3388ff"; | ||
export let fillOpacity = 0.2; | ||
export let fillRule = "evenodd"; | ||
export let options = {}; | ||
export let events = []; | ||
let circleMarker; | ||
let eventBridge; | ||
setContext(Layer, () => circleMarker); | ||
$: { | ||
if (!circleMarker) { | ||
circleMarker = new CircleMarker(latLng, options).addTo(mapProvider()); | ||
eventBridge = new EventBridge(circleMarker, dispatch, events); | ||
} | ||
circleMarker.setLatLng(latLng); | ||
circleMarker.setRadius(radius); | ||
circleMarker.setStyle({ | ||
color, | ||
weight, | ||
opacity, | ||
lineCap, | ||
lineJoin, | ||
dashArray, | ||
dashOffset, | ||
fill, | ||
fillColor, | ||
fillOpacity, | ||
fillRule | ||
}); | ||
} | ||
onDestroy(() => { | ||
eventBridge.unregister(); | ||
circleMarker.removeFrom(mapProvider()); | ||
}); | ||
export function getCircleMarker() { | ||
return circleMarker; | ||
} | ||
</script> | ||
|
||
<div> | ||
{#if circleMarker} | ||
<slot/> | ||
{/if} | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import { SvelteComponent } from "svelte"; | ||
import { CircleMarker, type CircleMarkerOptions, type FillRule, type LatLngExpression, type LineCapShape, type LineJoinShape } from 'leaflet'; | ||
declare const __propDef: { | ||
props: { | ||
latLng: LatLngExpression; | ||
radius?: number | undefined; | ||
color?: string | undefined; | ||
weight?: number | undefined; | ||
opacity?: number | undefined; | ||
lineCap?: LineCapShape | undefined; | ||
lineJoin?: LineJoinShape | undefined; | ||
dashArray?: string | number[] | undefined; | ||
dashOffset?: string | undefined; | ||
fill?: boolean | undefined; | ||
fillColor?: string | undefined; | ||
fillOpacity?: number | undefined; | ||
fillRule?: FillRule | undefined; | ||
options?: CircleMarkerOptions | undefined; | ||
events?: string[] | undefined; | ||
getCircleMarker?: (() => CircleMarker | undefined) | undefined; | ||
}; | ||
events: { | ||
[evt: string]: CustomEvent<any>; | ||
}; | ||
slots: { | ||
default: {}; | ||
}; | ||
}; | ||
export type CircleMarkerProps = typeof __propDef.props; | ||
export type CircleMarkerEvents = typeof __propDef.events; | ||
export type CircleMarkerSlots = typeof __propDef.slots; | ||
export default class CircleMarker extends SvelteComponent<CircleMarkerProps, CircleMarkerEvents, CircleMarkerSlots> { | ||
get getCircleMarker(): () => CircleMarker<any> | undefined; | ||
} | ||
export {}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<script>import { getContext } from "svelte"; | ||
import { DivIcon, Marker } from "leaflet"; | ||
const markerProvider = getContext(Marker); | ||
export let options = {}; | ||
let icon; | ||
let element; | ||
$: { | ||
let adjustedOptions = options; | ||
if (!adjustedOptions.html) { | ||
adjustedOptions.html = element; | ||
} | ||
icon = new DivIcon(adjustedOptions); | ||
markerProvider().setIcon(icon); | ||
} | ||
export function getDivIcon() { | ||
return icon; | ||
} | ||
</script> | ||
|
||
<div bind:this={element}> | ||
<slot></slot> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { SvelteComponent } from "svelte"; | ||
import { DivIcon, type DivIconOptions } from 'leaflet'; | ||
declare const __propDef: { | ||
props: { | ||
options?: DivIconOptions | undefined; | ||
getDivIcon?: (() => DivIcon | undefined) | undefined; | ||
}; | ||
events: { | ||
[evt: string]: CustomEvent<any>; | ||
}; | ||
slots: { | ||
default: {}; | ||
}; | ||
}; | ||
export type DivIconProps = typeof __propDef.props; | ||
export type DivIconEvents = typeof __propDef.events; | ||
export type DivIconSlots = typeof __propDef.slots; | ||
export default class DivIcon extends SvelteComponent<DivIconProps, DivIconEvents, DivIconSlots> { | ||
get getDivIcon(): () => DivIcon | undefined; | ||
} | ||
export {}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<script>import { createEventDispatcher, getContext, onDestroy, setContext } from "svelte"; | ||
import { GeoJSON, Layer, Map } from "leaflet"; | ||
import EventBridge from "../lib/EventBridge.js"; | ||
const dispatch = createEventDispatcher(); | ||
const mapProvider = getContext(Map); | ||
export let data = void 0; | ||
export let options = {}; | ||
export let events = []; | ||
let geojson; | ||
let eventBridge; | ||
setContext(Layer, () => geojson); | ||
$: { | ||
if (!geojson) { | ||
geojson = new GeoJSON(data, options).addTo(mapProvider()); | ||
eventBridge = new EventBridge(geojson, dispatch, events); | ||
} else if (data) { | ||
geojson.clearLayers(); | ||
geojson.addData(data); | ||
} | ||
} | ||
onDestroy(() => { | ||
eventBridge.unregister(); | ||
geojson.removeFrom(mapProvider()); | ||
}); | ||
export function getGeoJSON() { | ||
return geojson; | ||
} | ||
</script> | ||
|
||
<div> | ||
{#if geojson} | ||
<slot/> | ||
{/if} | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import { SvelteComponent } from "svelte"; | ||
import { GeoJSON, type GeoJSONOptions } from 'leaflet'; | ||
import type { GeoJsonObject } from 'geojson'; | ||
declare const __propDef: { | ||
props: { | ||
data?: GeoJsonObject | undefined; | ||
options?: GeoJSONOptions<any, import("geojson").Geometry> | undefined; | ||
events?: string[] | undefined; | ||
getGeoJSON?: (() => GeoJSON | undefined) | undefined; | ||
}; | ||
events: { | ||
[evt: string]: CustomEvent<any>; | ||
}; | ||
slots: { | ||
default: {}; | ||
}; | ||
}; | ||
export type GeoJsonProps = typeof __propDef.props; | ||
export type GeoJsonEvents = typeof __propDef.events; | ||
export type GeoJsonSlots = typeof __propDef.slots; | ||
export default class GeoJson extends SvelteComponent<GeoJsonProps, GeoJsonEvents, GeoJsonSlots> { | ||
get getGeoJSON(): () => GeoJSON<any, import("geojson").Geometry> | undefined; | ||
} | ||
export {}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<script>import { getContext } from "svelte"; | ||
import { Icon, Marker } from "leaflet"; | ||
const markerProvider = getContext(Marker); | ||
export let iconUrl; | ||
export let options = {}; | ||
let icon; | ||
$: { | ||
if (!icon) { | ||
const adjustedOptions = { | ||
...options, | ||
iconUrl | ||
}; | ||
icon = new Icon(adjustedOptions); | ||
markerProvider().setIcon(icon); | ||
} | ||
} | ||
export function getIcon() { | ||
return icon; | ||
} | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { SvelteComponent } from "svelte"; | ||
import { Icon, type BaseIconOptions, type IconOptions } from 'leaflet'; | ||
declare const __propDef: { | ||
props: { | ||
iconUrl: string; | ||
options?: BaseIconOptions | undefined; | ||
getIcon?: (() => Icon | undefined) | undefined; | ||
}; | ||
events: { | ||
[evt: string]: CustomEvent<any>; | ||
}; | ||
slots: {}; | ||
}; | ||
export type IconProps = typeof __propDef.props; | ||
export type IconEvents = typeof __propDef.events; | ||
export type IconSlots = typeof __propDef.slots; | ||
export default class Icon extends SvelteComponent<IconProps, IconEvents, IconSlots> { | ||
get getIcon(): () => Icon<IconOptions> | undefined; | ||
} | ||
export {}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<script>import { createEventDispatcher, getContext, onDestroy } from "svelte"; | ||
import { ImageOverlay, Map } from "leaflet"; | ||
import EventBridge from "../lib/EventBridge.js"; | ||
const dispatch = createEventDispatcher(); | ||
const mapProvider = getContext(Map); | ||
export let imageUrl; | ||
export let bounds; | ||
export let opacity = 1; | ||
export let zIndex = 1; | ||
export let options = {}; | ||
export let events = []; | ||
let imageOverlay; | ||
let eventBridge; | ||
$: { | ||
if (!imageOverlay) { | ||
imageOverlay = new ImageOverlay(imageUrl, bounds, options).addTo(mapProvider()); | ||
eventBridge = new EventBridge(imageOverlay, dispatch, events); | ||
} | ||
imageOverlay.setUrl(imageUrl); | ||
imageOverlay.setOpacity(opacity); | ||
imageOverlay.setZIndex(zIndex); | ||
} | ||
onDestroy(() => { | ||
eventBridge.unregister(); | ||
imageOverlay.removeFrom(mapProvider()); | ||
}); | ||
export function getImageOverlay() { | ||
return imageOverlay; | ||
} | ||
</script> |
Oops, something went wrong.