@radiofrance/svelte-leaflet 1.0.0-next.1 → 1.0.0-next.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (66) hide show
  1. package/README.md +55 -70
  2. package/dist/Circle.svelte +45 -0
  3. package/dist/Circle.svelte.d.ts +8 -0
  4. package/dist/CircleMarker.svelte +49 -0
  5. package/dist/CircleMarker.svelte.d.ts +8 -0
  6. package/dist/ImageOverlay.svelte +66 -0
  7. package/dist/ImageOverlay.svelte.d.ts +10 -0
  8. package/dist/LayersControl.svelte +23 -0
  9. package/dist/LayersControl.svelte.d.ts +6 -0
  10. package/dist/Map.svelte +39 -24
  11. package/dist/Map.svelte.d.ts +2 -4
  12. package/dist/Marker.svelte +1 -1
  13. package/dist/Marker.svelte.d.ts +1 -1
  14. package/dist/MarkerClusterGroup.svelte +1 -4
  15. package/dist/MarkerClusterGroup.svelte.d.ts +19 -19
  16. package/dist/Polygon.svelte +1 -1
  17. package/dist/Polygon.svelte.d.ts +1 -1
  18. package/dist/Polyline.svelte +1 -1
  19. package/dist/Polyline.svelte.d.ts +1 -1
  20. package/dist/Popup.svelte +1 -1
  21. package/dist/Popup.svelte.d.ts +1 -1
  22. package/dist/Rectangle.svelte +48 -0
  23. package/dist/Rectangle.svelte.d.ts +8 -0
  24. package/dist/SVGOverlay.svelte +52 -0
  25. package/dist/SVGOverlay.svelte.d.ts +8 -0
  26. package/dist/TileLayer.svelte +34 -0
  27. package/dist/TileLayer.svelte.d.ts +8 -0
  28. package/dist/TileLayerWMS.svelte +36 -0
  29. package/dist/TileLayerWMS.svelte.d.ts +8 -0
  30. package/dist/Tooltip.svelte +73 -0
  31. package/dist/Tooltip.svelte.d.ts +10 -0
  32. package/dist/VideoOverlay.svelte +66 -0
  33. package/dist/VideoOverlay.svelte.d.ts +10 -0
  34. package/dist/ZoomControl.svelte +21 -0
  35. package/dist/ZoomControl.svelte.d.ts +8 -0
  36. package/dist/circleMarker.d.ts +4 -0
  37. package/dist/circleMarker.js +8 -0
  38. package/dist/contexts.d.ts +8 -0
  39. package/dist/contexts.js +18 -0
  40. package/dist/events.d.ts +1 -1
  41. package/dist/events.js +1 -1
  42. package/dist/imageOverlay.d.ts +5 -0
  43. package/dist/imageOverlay.js +25 -0
  44. package/dist/{map.svelte.js → map.js} +2 -2
  45. package/dist/{marker.svelte.js → marker.js} +2 -2
  46. package/dist/{markerClusterGroup.svelte.d.ts → markerClusterGroup.d.ts} +2 -2
  47. package/dist/{markerClusterGroup.svelte.js → markerClusterGroup.js} +1 -1
  48. package/dist/{polyline.svelte.js → polyline.js} +2 -2
  49. package/dist/{popup.svelte.js → popup.js} +2 -2
  50. package/dist/tileLayer.d.ts +5 -0
  51. package/dist/tileLayer.js +1 -0
  52. package/dist/tileLayerWMS.d.ts +7 -0
  53. package/dist/tileLayerWMS.js +1 -0
  54. package/dist/tooltip.d.ts +10 -0
  55. package/dist/tooltip.js +34 -0
  56. package/dist/utils.d.ts +1 -0
  57. package/dist/utils.js +7 -0
  58. package/dist/videoOverlay.d.ts +5 -0
  59. package/dist/videoOverlay.js +25 -0
  60. package/package.json +1 -1
  61. /package/dist/{map.svelte.d.ts → map.d.ts} +0 -0
  62. /package/dist/{marker.svelte.d.ts → marker.d.ts} +0 -0
  63. /package/dist/{polygon.svelte.d.ts → polygon.d.ts} +0 -0
  64. /package/dist/{polygon.svelte.js → polygon.js} +0 -0
  65. /package/dist/{polyline.svelte.d.ts → polyline.d.ts} +0 -0
  66. /package/dist/{popup.svelte.d.ts → popup.d.ts} +0 -0
@@ -0,0 +1,34 @@
1
+ import { interactiveLayerEvents, layerEvents, tooltipSpecificEvents } from './events.js';
2
+ export function updateTooltipProps(instance, options) {
3
+ if (!options)
4
+ return;
5
+ for (const [key, value] of Object.entries(options)) {
6
+ if (instance.options[key] === value)
7
+ continue;
8
+ instance.options[key] = value;
9
+ switch (key) {
10
+ case 'className':
11
+ case 'interactive':
12
+ case 'pane':
13
+ throw new Error(`mutation of ${key} option is not supported`);
14
+ case 'direction':
15
+ case 'permanent':
16
+ case 'sticky':
17
+ case 'opacity':
18
+ if (instance.isOpen()) {
19
+ const source = instance._source;
20
+ source.closeTooltip();
21
+ source.openTooltip();
22
+ }
23
+ break;
24
+ case 'content':
25
+ instance.setContent(value);
26
+ break;
27
+ }
28
+ }
29
+ }
30
+ export const tooltipEvents = [
31
+ ...interactiveLayerEvents,
32
+ ...layerEvents,
33
+ ...tooltipSpecificEvents,
34
+ ];
package/dist/utils.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import type { LeafletEventHandlerFnMap } from 'leaflet';
2
2
  export declare function capitalize<T extends string>(str: T): Capitalize<T>;
3
+ export declare function getRandomString(length: number): string;
3
4
  export declare function getFirstNonCommentChild(element: HTMLElement): HTMLElement | null;
4
5
  export type PickOptionByType<Options, Type> = keyof {
5
6
  [K in keyof Options as true extends UnionContainsType<Options[K], Type> ? K : never]: Options[K];
package/dist/utils.js CHANGED
@@ -1,6 +1,13 @@
1
1
  export function capitalize(str) {
2
2
  return (str[0].toUpperCase() + str.slice(1));
3
3
  }
4
+ const chars = 'abcdefghijklmnopqrstuvwxyz0123456789';
5
+ function getRandomChar() {
6
+ return chars[Math.floor(Math.random() * chars.length)];
7
+ }
8
+ export function getRandomString(length) {
9
+ return Array.from({ length }, getRandomChar).join('');
10
+ }
4
11
  export function getFirstNonCommentChild(element) {
5
12
  let child = element.firstChild;
6
13
  while (child && child.nodeType !== Node.ELEMENT_NODE) {
@@ -0,0 +1,5 @@
1
+ import type { VideoOverlay as LeafletVideoOverlay, VideoOverlayOptions } from 'leaflet';
2
+ import type { CreateSvelteEventsMap } from './utils.js';
3
+ export declare function updateVideoOverlayProps(instance: LeafletVideoOverlay, options: VideoOverlayOptions): void;
4
+ export declare const videoOverlayEvents: readonly ["click", "dblclick", "mousedown", "mouseup", "mouseover", "mouseout", "contextmenu", "add", "remove", "popupopen", "popupclose", "tooltipopen", "tooltipclose"];
5
+ export type VideoOverlayEvents = CreateSvelteEventsMap<typeof videoOverlayEvents, LeafletVideoOverlay>;
@@ -0,0 +1,25 @@
1
+ import { interactiveLayerEvents, layerEvents, popupSpecificEvents, tooltipSpecificEvents, } from './events.js';
2
+ export function updateVideoOverlayProps(instance, options) {
3
+ if (!options)
4
+ return;
5
+ for (const [key, value] of Object.entries(options)) {
6
+ if (instance.options[key] === value)
7
+ continue;
8
+ instance.options[key] = value;
9
+ switch (key) {
10
+ case 'opacity':
11
+ case 'alt':
12
+ instance.setOpacity(value);
13
+ break;
14
+ case 'interactive':
15
+ case 'attribution':
16
+ throw new Error(`mutation of ${key} option is not supported`);
17
+ }
18
+ }
19
+ }
20
+ export const videoOverlayEvents = [
21
+ ...interactiveLayerEvents,
22
+ ...layerEvents,
23
+ ...popupSpecificEvents,
24
+ ...tooltipSpecificEvents,
25
+ ];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@radiofrance/svelte-leaflet",
3
- "version": "1.0.0-next.1",
3
+ "version": "1.0.0-next.3",
4
4
  "scripts": {
5
5
  "dev": "vite dev",
6
6
  "build": "vite build && npm run package",
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes