├── .editorconfig ├── .env.example ├── .eslintrc.js ├── .gitignore ├── .npmignore ├── .storybook ├── main.js ├── manager.js ├── preview-head.html └── theme.js ├── README.md ├── package.json ├── src ├── BoxSelect.svelte ├── Layer.svelte ├── Map.svelte ├── Marker.svelte ├── Popup.svelte ├── context.js ├── controls │ ├── AttributionControl.svelte │ ├── FullscreenControl.svelte │ ├── GeolocateControl.svelte │ ├── NavigationControl.svelte │ ├── ScaleControl.svelte │ └── SvelteControl.svelte ├── index.js ├── sources │ ├── GeoJSONSource.svelte │ └── VectorSource.svelte └── utils.js └── stories ├── a_general.stories.js ├── config.js ├── controls.stories.js ├── data.js ├── markers.stories.js ├── popups.stories.js ├── sources.stories.js └── views ├── BindLoadProps.svelte ├── BindPositionalProps.svelte ├── ChangeStyle.svelte ├── EaseTo.svelte ├── Layout.svelte ├── MapWithAllControls.svelte ├── MapWithAttributionControl.svelte ├── MapWithFullscreenControl.svelte ├── MapWithGeolocateControl.svelte ├── MapWithNavigationControl.svelte ├── MapWithScaleControl.svelte ├── MapWithSvelteControl.svelte ├── markers ├── ManyMarkersView.svelte ├── MarkerAttachPopupView.svelte ├── MarkerBindOpenOfAttachedPopupView.svelte ├── MarkerMountAttachedPopupView.svelte ├── MarkerMountView.svelte ├── MarkerUpdateCoordinatesView.svelte └── MarkerView.svelte ├── popups ├── PopupBindOpenView.svelte ├── PopupMountView.svelte ├── PopupUpdateContentView.svelte ├── PopupUpdateCoordinatesView.svelte └── PopupView.svelte └── sources ├── GeoJSONClusterView.svelte ├── GeoJSONFilterView.svelte ├── GeoJSONSourceMountView.svelte ├── GeoJSONSourceUpdateData.svelte ├── GeoJSONSourceUpdateLayout.svelte ├── GeoJSONSourceVisibilityView.svelte ├── GeoJSONSourceWithSymbolLayerView.svelte └── VectorSourceWithCircleLayerView.svelte /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | charset = utf-8 5 | end_of_line = lf 6 | insert_final_newline = true 7 | trim_trailing_whitespace = true 8 | 9 | [*.{js,json,md,svelte}] 10 | indent_style = space 11 | indent_size = 2 12 | -------------------------------------------------------------------------------- /.env.example: -------------------------------------------------------------------------------- 1 | # From https://docs.mapbox.com/mapbox-gl-js/example/simple-map/ 2 | # Replace it with a real token for the application, cf https://docs.mapbox.com/help/glossary/access-token/ 3 | MAPBOX_ACCESS_TOKEN=pk.eyJ1IjoiY2JlbnoiLCJhIjoiY2p0M2FnN2M3MHNuMTQ1cDNod2N4YXFhdSJ9.pGJLTkAD8lBnDVrxlRO_yg 4 | -------------------------------------------------------------------------------- /.eslintrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | "env": { 3 | "browser": true, 4 | "es6": true 5 | }, 6 | "extends": "eslint:recommended", 7 | "globals": { 8 | "Atomics": "readonly", 9 | "SharedArrayBuffer": "readonly" 10 | }, 11 | "parser": "babel-eslint", 12 | "parserOptions": { 13 | "ecmaVersion": 2018, 14 | "sourceType": "module" 15 | }, 16 | "plugins": ['svelte3'], 17 | "overrides": [ 18 | { 19 | "files": ['**/*.svelte'], 20 | "processor": 'svelte3/svelte3' 21 | } 22 | ], 23 | "rules": { 24 | }, 25 | }; 26 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /.vscode 2 | /node_modules/ 3 | /storybook-static/ 4 | .env 5 | -------------------------------------------------------------------------------- /.npmignore: -------------------------------------------------------------------------------- 1 | stories 2 | -------------------------------------------------------------------------------- /.storybook/main.js: -------------------------------------------------------------------------------- 1 | const path = require('path'); 2 | 3 | const projectPath = path.resolve(__dirname, '..'); 4 | 5 | module.exports = { 6 | stories: ['../stories/**/*.stories.js'], 7 | addons: [], 8 | webpackFinal: async (config) => { 9 | config.resolve.alias = { 10 | ...config.resolve.alias, 11 | _src: path.resolve(projectPath, "src"), 12 | _stories: path.resolve(projectPath, "stories"), 13 | }; 14 | return config; 15 | }, 16 | }; 17 | -------------------------------------------------------------------------------- /.storybook/manager.js: -------------------------------------------------------------------------------- 1 | import { addons } from '@storybook/addons'; 2 | import theme from './theme.js'; 3 | 4 | addons.setConfig({ theme }); 5 | -------------------------------------------------------------------------------- /.storybook/preview-head.html: -------------------------------------------------------------------------------- 1 | 2 | 14 | -------------------------------------------------------------------------------- /.storybook/theme.js: -------------------------------------------------------------------------------- 1 | import { create } from '@storybook/theming/create'; 2 | import packageJson from "../package.json"; 3 | 4 | export default create({ 5 | base: 'light', 6 | 7 | brandTitle: `${packageJson.name} demos`, 8 | brandUrl: packageJson.homepage, 9 | }); 10 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # svelte-mapbox-gl 2 | 3 | Svelte 3 components for Mapbox GL. 4 | 5 | This work is built on top of [Jailbreak's Gitlab Repo](https://gitlab.com/jailbreak/svelte-mapbox-gl). This fork will add bug fixes and further add functionality useful for working with maps. It is notable that deck.gl Mapbox Layer integration is fully possible. 6 | 7 | [Mapbox GL JS](https://docs.mapbox.com/mapbox-gl-js) is a JavaScript library that uses WebGL to render interactive maps from vector tiles and Mapbox styles. 8 | 9 | [Svelte](https://svelte.dev/) is a JavaScript compiler used to build user interfaces similar to React or Vue, but lighter because components are compiled. 10 | 11 | The provided components follow Svelte idioms as much as possible (declarative props, etc.), while keeping the same namings used by Mapbox GL JS (for objects, options and events). 12 | 13 | ## Usage 14 | 15 | See Storybook: https://jailbreak.gitlab.io/svelte-mapbox-gl 16 | 17 | Basic usage: 18 | 19 | ```javascript 20 | 29 | 30 | 35 | 36 | 37 | I'm a popup attached to a marker! 38 | 39 | 40 | ``` 41 | 42 | ### Mapbox GL Javascript and CSS 43 | 44 | This package defines [mapbox-gl](https://www.npmjs.com/package/mapbox-gl) as a peer dependency. 45 | It needs it, but it's the responsibility of the application using it to provide the `mapbox-gl` module. 46 | 47 | About JavaScript two scenarios are possible: 48 | 49 | - source Mapbox GL script in the DOM via a ` 106 | -------------------------------------------------------------------------------- /src/Layer.svelte: -------------------------------------------------------------------------------- 1 | 112 | -------------------------------------------------------------------------------- /src/Map.svelte: -------------------------------------------------------------------------------- 1 | 212 | 213 |
214 | {#if map} 215 | {#if boxSelect} 216 | 217 | {/if} 218 | 219 | {/if} 220 |
221 | 222 | 228 | -------------------------------------------------------------------------------- /src/Marker.svelte: -------------------------------------------------------------------------------- 1 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /src/Popup.svelte: -------------------------------------------------------------------------------- 1 | 106 | 107 | 108 | 109 | 110 | -------------------------------------------------------------------------------- /src/context.js: -------------------------------------------------------------------------------- 1 | export const mapKey = {} 2 | export const markerKey = {} 3 | export const sourceKey = {} 4 | -------------------------------------------------------------------------------- /src/controls/AttributionControl.svelte: -------------------------------------------------------------------------------- 1 | 25 | 26 | 31 | 32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /src/controls/FullscreenControl.svelte: -------------------------------------------------------------------------------- 1 | 21 | -------------------------------------------------------------------------------- /src/controls/GeolocateControl.svelte: -------------------------------------------------------------------------------- 1 | 56 | -------------------------------------------------------------------------------- /src/controls/NavigationControl.svelte: -------------------------------------------------------------------------------- 1 | 27 | -------------------------------------------------------------------------------- /src/controls/ScaleControl.svelte: -------------------------------------------------------------------------------- 1 | 24 | -------------------------------------------------------------------------------- /src/controls/SvelteControl.svelte: -------------------------------------------------------------------------------- 1 | 25 | 26 |
27 | 28 |
29 | -------------------------------------------------------------------------------- /src/index.js: -------------------------------------------------------------------------------- 1 | export { default as Map } from "./Map.svelte" 2 | 3 | // Controls 4 | export { default as AttributionControl } from "./controls/AttributionControl.svelte" 5 | export { default as FullscreenControl } from "./controls/FullscreenControl.svelte" 6 | export { default as GeolocateControl } from "./controls/GeolocateControl.svelte" 7 | export { default as NavigationControl } from "./controls/NavigationControl.svelte" 8 | export { default as ScaleControl } from "./controls/ScaleControl.svelte" 9 | export { default as SvelteControl } from "./controls/SvelteControl.svelte" 10 | 11 | // Sources 12 | export { default as GeoJSONSource } from "./sources/GeoJSONSource.svelte" 13 | export { default as VectorSource } from "./sources/VectorSource.svelte" 14 | 15 | // Other components 16 | export { default as Layer } from "./Layer.svelte" 17 | export { default as Marker } from "./Marker.svelte" 18 | export { default as Popup } from "./Popup.svelte" 19 | 20 | // Other modules 21 | import * as context from "./context.js" 22 | import * as utils from "./utils.js" 23 | export { context, utils } 24 | -------------------------------------------------------------------------------- /src/sources/GeoJSONSource.svelte: -------------------------------------------------------------------------------- 1 | 90 | 91 | 92 | -------------------------------------------------------------------------------- /src/sources/VectorSource.svelte: -------------------------------------------------------------------------------- 1 | 88 | 89 | 90 | -------------------------------------------------------------------------------- /src/utils.js: -------------------------------------------------------------------------------- 1 | export function coordinatesAtClick(coordinates, { lng }) { 2 | // Ensure that if the map is zoomed out such that 3 | // multiple copies of the feature are visible, the 4 | // popup appears over the copy being pointed to. 5 | let newLng = coordinates[0] 6 | while (Math.abs(lng - newLng) > 180) { 7 | newLng += lng > newLng ? 360 : -360; 8 | } 9 | return [newLng, coordinates[1]] 10 | } 11 | 12 | export function omitUndefinedValues(object) { 13 | const result = {}; 14 | for (const key in object) { 15 | if (object[key] !== undefined) { 16 | result[key] = object[key]; 17 | } 18 | } 19 | return result; 20 | } 21 | -------------------------------------------------------------------------------- /stories/a_general.stories.js: -------------------------------------------------------------------------------- 1 | import BindLoadProps from "./views/BindLoadProps.svelte" 2 | import BindPositionalProps from "./views/BindPositionalProps.svelte" 3 | import ChangeStyle from "./views/ChangeStyle.svelte" 4 | import EaseTo from "./views/EaseTo.svelte" 5 | import Map from "_src/Map.svelte"; 6 | import { defaultMapProps } from "./config.js" 7 | 8 | export default { 9 | title: 'General', 10 | }; 11 | 12 | export const basic = () => ({ 13 | Component: Map, 14 | props: defaultMapProps, 15 | }); 16 | 17 | export const initialCenterAndZoom = () => ({ 18 | Component: Map, 19 | props: { 20 | ...defaultMapProps, 21 | center: { lng: 3.7792968750030695, lat: 48.935777757603375 }, 22 | zoom: 5 23 | }, 24 | }); 25 | 26 | export const bindPositionalProps = () => ({ Component: BindPositionalProps }); 27 | 28 | export const bindLoadProps = () => ({ Component: BindLoadProps }); 29 | 30 | export const changeStyle = () => ({ Component: ChangeStyle }); 31 | 32 | export const easeTo = () => ({ Component: EaseTo }); 33 | -------------------------------------------------------------------------------- /stories/config.js: -------------------------------------------------------------------------------- 1 | export const accessToken = process.env.MAPBOX_ACCESS_TOKEN; 2 | export const globalMapboxGL = true; 3 | 4 | export const defaultMapProps = { 5 | accessToken, 6 | globalMapboxGL, 7 | style: "mapbox://styles/mapbox/streets-v11", 8 | } 9 | -------------------------------------------------------------------------------- /stories/controls.stories.js: -------------------------------------------------------------------------------- 1 | import MapWithAllControls from './views/MapWithAllControls.svelte'; 2 | import MapWithAttributionControl from './views/MapWithAttributionControl.svelte'; 3 | import MapWithFullscreenControl from './views/MapWithFullscreenControl.svelte'; 4 | import MapWithGeolocateControl from './views/MapWithGeolocateControl.svelte'; 5 | import MapWithNavigationControl from './views/MapWithNavigationControl.svelte'; 6 | import MapWithScaleControl from './views/MapWithScaleControl.svelte'; 7 | import MapWithSvelteControl from './views/MapWithSvelteControl.svelte'; 8 | 9 | export default { 10 | title: 'Controls', 11 | }; 12 | 13 | export const attribution = () => ({ Component: MapWithAttributionControl }); 14 | export const fullscreen = () => ({ Component: MapWithFullscreenControl }); 15 | export const geolocate = () => ({ Component: MapWithGeolocateControl }); 16 | export const navigation = () => ({ Component: MapWithNavigationControl }); 17 | export const scale = () => ({ Component: MapWithScaleControl }); 18 | export const all = () => ({ Component: MapWithAllControls }); 19 | export const svelte = () => ({ Component: MapWithSvelteControl }); 20 | -------------------------------------------------------------------------------- /stories/data.js: -------------------------------------------------------------------------------- 1 | export const myGeoJSON = { 2 | type: "FeatureCollection", 3 | features: [ 4 | { 5 | type: "Feature", 6 | geometry: { 7 | type: "Point", 8 | coordinates: [-77.03238901390978, 38.913188059745586] 9 | }, 10 | properties: { 11 | title: "Mapbox DC", 12 | icon: "monument" 13 | } 14 | }, 15 | { 16 | type: "Feature", 17 | geometry: { 18 | type: "Point", 19 | coordinates: [-122.414, 37.776] 20 | }, 21 | properties: { 22 | title: "Mapbox SF", 23 | icon: "harbor" 24 | } 25 | } 26 | ] 27 | }; 28 | -------------------------------------------------------------------------------- /stories/markers.stories.js: -------------------------------------------------------------------------------- 1 | import ManyMarkersView from "./views/markers/ManyMarkersView.svelte" 2 | import MarkerAttachPopupView from "./views/markers/MarkerAttachPopupView.svelte" 3 | import MarkerBindOpenOfAttachedPopupView from "./views/markers/MarkerBindOpenOfAttachedPopupView.svelte" 4 | import MarkerMountAttachedPopupView from "./views/markers/MarkerMountAttachedPopupView.svelte" 5 | import MarkerMountView from "./views/markers/MarkerMountView.svelte" 6 | import MarkerUpdateCoordinatesView from "./views/markers/MarkerUpdateCoordinatesView.svelte" 7 | import MarkerView from "./views/markers/MarkerView.svelte" 8 | 9 | export default { 10 | title: 'Markers', 11 | }; 12 | 13 | export const basic = () => ({ Component: MarkerView }); 14 | 15 | export const updateCoordinates = () => ({ Component: MarkerUpdateCoordinatesView }); 16 | 17 | export const mount = () => ({ Component: MarkerMountView }); 18 | 19 | export const attachPopup = () => ({ Component: MarkerAttachPopupView }); 20 | 21 | export const mountAttachedPopup = () => ({ Component: MarkerMountAttachedPopupView }); 22 | 23 | export const bindOpenOfAttachedPopup = () => ({ Component: MarkerBindOpenOfAttachedPopupView }); 24 | 25 | export const manyMarkers = () => ({ Component: ManyMarkersView }); 26 | -------------------------------------------------------------------------------- /stories/popups.stories.js: -------------------------------------------------------------------------------- 1 | import PopupBindOpenView from "./views/popups/PopupBindOpenView.svelte" 2 | import PopupMountView from "./views/popups/PopupMountView.svelte" 3 | import PopupUpdateContentView from "./views/popups/PopupUpdateContentView.svelte" 4 | import PopupUpdateCoordinatesView from "./views/popups/PopupUpdateCoordinatesView.svelte" 5 | import PopupView from "./views/popups/PopupView.svelte" 6 | 7 | export default { 8 | title: 'Popups', 9 | }; 10 | 11 | export const basic = () => ({ Component: PopupView }); 12 | 13 | export const noCloseButton = () => ({ 14 | Component: PopupView, 15 | props: { closeButton: false } 16 | }); 17 | 18 | export const noCloseOnClick = () => ({ 19 | Component: PopupView, 20 | props: { closeOnClick: false } 21 | }); 22 | 23 | export const htmlContent = () => ({ 24 | Component: PopupView, 25 | props: { content: "I'm a popup with HTML content!" } 26 | }); 27 | 28 | export const bindOpen = () => ({ Component: PopupBindOpenView }); 29 | 30 | export const updateContent = () => ({ Component: PopupUpdateContentView }); 31 | 32 | export const updateCoordinates = () => ({ Component: PopupUpdateCoordinatesView }); 33 | 34 | export const mount = () => ({ Component: PopupMountView }); 35 | -------------------------------------------------------------------------------- /stories/sources.stories.js: -------------------------------------------------------------------------------- 1 | import GeoJSONClusterView from './views/sources/GeoJSONClusterView.svelte'; 2 | import GeoJSONFilterView from './views/sources/GeoJSONFilterView.svelte'; 3 | import GeoJSONSourceMountView from './views/sources/GeoJSONSourceMountView.svelte'; 4 | import GeoJSONSourceUpdateData from './views/sources/GeoJSONSourceUpdateData.svelte'; 5 | import GeoJSONSourceUpdateLayout from './views/sources/GeoJSONSourceUpdateLayout.svelte'; 6 | import GeoJSONSourceVisibilityView from './views/sources/GeoJSONSourceVisibilityView.svelte'; 7 | import GeoJSONSourceWithSymbolLayerView from './views/sources/GeoJSONSourceWithSymbolLayerView.svelte'; 8 | import VectorSourceWithCircleLayerView from './views/sources/VectorSourceWithCircleLayerView.svelte'; 9 | 10 | export default { 11 | title: 'Sources', 12 | }; 13 | 14 | export const geoJSONSourceWithSymbolLayer = () => ({ Component: GeoJSONSourceWithSymbolLayerView }); 15 | 16 | export const geoJSONSourceMount = () => ({ Component: GeoJSONSourceMountView }); 17 | 18 | export const geoJSONSourceVisibility = () => ({ Component: GeoJSONSourceVisibilityView }); 19 | 20 | export const geoJSONSourceUpdateLayout = () => ({ Component: GeoJSONSourceUpdateLayout }); 21 | 22 | export const geoJSONSourceUpdateData = () => ({ Component: GeoJSONSourceUpdateData }); 23 | 24 | export const vectorSourceWithCircleLayer = () => ({ Component: VectorSourceWithCircleLayerView }); 25 | 26 | export const cluster = () => ({ Component: GeoJSONClusterView }); 27 | 28 | export const filter = () => ({ Component: GeoJSONFilterView }); 29 | -------------------------------------------------------------------------------- /stories/views/BindLoadProps.svelte: -------------------------------------------------------------------------------- 1 | 9 | 10 | 11 | 12 |
{JSON.stringify({ loaded, styleLoaded }, null, 2)}
13 |
14 | 15 | 16 | 17 |
18 | -------------------------------------------------------------------------------- /stories/views/BindPositionalProps.svelte: -------------------------------------------------------------------------------- 1 | 11 | 12 | 13 | 14 |
{JSON.stringify({ bearing, center, pitch, zoom }, null, 2)}
15 |
16 | 17 | 18 | 19 |
20 | -------------------------------------------------------------------------------- /stories/views/ChangeStyle.svelte: -------------------------------------------------------------------------------- 1 | 20 | 21 | 22 | 23 | 31 | 32 | 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /stories/views/EaseTo.svelte: -------------------------------------------------------------------------------- 1 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /stories/views/Layout.svelte: -------------------------------------------------------------------------------- 1 | 19 | 20 |
21 |
22 | 23 |
24 |
25 | 26 |
27 |
28 | -------------------------------------------------------------------------------- /stories/views/MapWithAllControls.svelte: -------------------------------------------------------------------------------- 1 | 19 | 20 | 21 | 22 |

23 | 27 |

28 |

29 | 33 |

34 |

35 | 36 |

37 |

38 | 42 |

43 |

44 | 48 |

49 |

50 | 54 |

55 |
56 | 57 | 58 | {#if fullscreen} 59 | 60 | {/if} 61 | {#if geolocate} 62 | 63 | {/if} 64 | {#if navigation} 65 | 66 | {/if} 67 | {#if scale} 68 | 69 | {/if} 70 | {#if attribution} 71 | 72 | Custom content, 73 | HTML 74 | supported 75 | 76 | {/if} 77 | 78 | 79 |
80 | -------------------------------------------------------------------------------- /stories/views/MapWithAttributionControl.svelte: -------------------------------------------------------------------------------- 1 | 6 | 7 | 8 | 9 | Custom content, 10 | HTML 11 | supported 12 | 13 | 14 | -------------------------------------------------------------------------------- /stories/views/MapWithFullscreenControl.svelte: -------------------------------------------------------------------------------- 1 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /stories/views/MapWithGeolocateControl.svelte: -------------------------------------------------------------------------------- 1 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /stories/views/MapWithNavigationControl.svelte: -------------------------------------------------------------------------------- 1 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /stories/views/MapWithScaleControl.svelte: -------------------------------------------------------------------------------- 1 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /stories/views/MapWithSvelteControl.svelte: -------------------------------------------------------------------------------- 1 | 6 | 7 | 14 | 15 | 16 | 17 |
hello, I'm a Svelte component!
18 |
19 |
20 | -------------------------------------------------------------------------------- /stories/views/markers/ManyMarkersView.svelte: -------------------------------------------------------------------------------- 1 | 42 | 43 | 48 | 49 | 50 | 51 | 57 | 58 |
59 |
    60 | {#each features as { title, coordinates, id } (id)} 61 |
  • 62 | {title} 63 |
    {JSON.stringify({ coordinates }, null, 2)}
    64 | {#if open[id]} 65 | 66 | {:else} 67 | 68 | {/if} 69 | 70 |
  • 71 | {/each} 72 |
73 |
74 | 75 | 76 | {#each features as { title, coordinates, id } (id)} 77 | 78 | {title} 79 | 80 | {/each} 81 | 82 | 83 |
84 | -------------------------------------------------------------------------------- /stories/views/markers/MarkerAttachPopupView.svelte: -------------------------------------------------------------------------------- 1 | 9 | 10 | 11 | 12 | 13 | I'm a popup attached to a marker! 14 |
15 | I don't need coordinates because I reuse the marker ones. 16 |
17 |
18 | Small detail: the mouse cursor is set to "pointer". 19 |
20 |
21 | 22 |
23 | -------------------------------------------------------------------------------- /stories/views/markers/MarkerBindOpenOfAttachedPopupView.svelte: -------------------------------------------------------------------------------- 1 | 12 | 13 | 14 | 15 | 19 | 20 | 21 | 22 | 23 | 24 | I'm a popup attached to a marker! 25 |
26 | The "open" property of the popup is bound to a Svelte property. 27 |
28 |
29 |
30 |
31 |
32 | -------------------------------------------------------------------------------- /stories/views/markers/MarkerMountAttachedPopupView.svelte: -------------------------------------------------------------------------------- 1 | 12 | 13 | 14 | 15 | 19 | 20 | 21 | 22 | 23 | {#if mounted} 24 | 25 | I'm a popup attached to a marker, placed inside a {'{#if mounted}'} 26 | clause. ! 27 |
28 |
29 | Small detail: the mouse cursor is set to "pointer" when popup is 30 | mounted, and restored when unmounted. 31 |
32 | {/if} 33 |
34 |
35 |
36 |
37 | -------------------------------------------------------------------------------- /stories/views/markers/MarkerMountView.svelte: -------------------------------------------------------------------------------- 1 | 11 | 12 | 13 | 14 | 18 | 19 | 20 | 21 | {#if mounted} 22 | 23 | {/if} 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /stories/views/markers/MarkerUpdateCoordinatesView.svelte: -------------------------------------------------------------------------------- 1 | 9 | 10 | 11 | 12 |

13 | 18 | {coordinates.lat} 19 |

20 |

21 | 26 | {coordinates.lng} 27 |

28 |
29 | 30 | 31 | 32 | 33 | 34 |
35 | -------------------------------------------------------------------------------- /stories/views/markers/MarkerView.svelte: -------------------------------------------------------------------------------- 1 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /stories/views/popups/PopupBindOpenView.svelte: -------------------------------------------------------------------------------- 1 | 11 | 12 | 13 | 14 | 18 | 19 | 20 | 21 | 22 | My open status is bound to a Svelte property! 23 |
24 | You can uncheck the checkbox, and see me being closed. 25 |
26 | Or you can close me, and see the checkbox being unchecked. 27 |
28 |
29 |
30 |
31 | -------------------------------------------------------------------------------- /stories/views/popups/PopupMountView.svelte: -------------------------------------------------------------------------------- 1 | 11 | 12 | 13 | 14 | 18 | 19 | 20 | 21 | {#if mounted} 22 | 23 | I am placed inside a {'{#if mounted}'} clause. 24 |
25 | You can close me, and see the checkbox still being checked. 26 |
27 | {/if} 28 |
29 |
30 |
31 | -------------------------------------------------------------------------------- /stories/views/popups/PopupUpdateContentView.svelte: -------------------------------------------------------------------------------- 1 | 12 | 13 | 14 | 15 |