@lblod/ember-rdfa-editor-lblod-plugins 28.2.1 → 28.2.2

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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @lblod/ember-rdfa-editor-lblod-plugins
2
2
 
3
+ ## 28.2.2
4
+
5
+ ### Patch Changes
6
+
7
+ - [`261f2a3`](https://github.com/lblod/ember-rdfa-editor-lblod-plugins/commit/261f2a39b5b67c6ba373e3b35a91c242d27a4277) Thanks [@piemonkey](https://github.com/piemonkey)! - Bundle location plugin marker icons to avoid issues when bundling the code for embeddable
8
+
3
9
  ## 28.2.1
4
10
 
5
11
  ### Patch Changes
@@ -6,6 +6,7 @@ import and from 'ember-truth-helpers/helpers/and';
6
6
  import eq from 'ember-truth-helpers/helpers/eq';
7
7
  import t from 'ember-intl/helpers/t';
8
8
  import {
9
+ Leaflet,
9
10
  LeafletMap,
10
11
  type LeafletMapSig,
11
12
  type LeafletMapStart,
@@ -20,6 +21,38 @@ import {
20
21
  type GlobalCoordinates,
21
22
  } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/location-plugin/utils/geo-helpers';
22
23
 
24
+ // Taken from Leaflet's default icon, with the viewbox tweaked (from 0 0 500 820), so that the icon
25
+ // is a whole number of pixels in size, to make positioning the point easy.
26
+ const ICON_HTML = `<svg viewBox="0 0 500 800" version="1.1" xmlns="http://www.w3.org/2000/svg" xml:space="preserve"
27
+ style="fill-rule: evenodd; clip-rule: evenodd; stroke-linecap: round;">
28
+ <defs>
29
+ <linearGradient x1="0" y1="0" x2="1" y2="0" gradientUnits="userSpaceOnUse" gradientTransform="matrix(2.30025e-15,-37.566,37.566,2.30025e-15,416.455,540.999)" id="map-marker-38-f">
30
+ <stop offset="0" stop-color="rgb(18,111,198)"/>
31
+ <stop offset="1" stop-color="rgb(76,156,209)"/>
32
+ </linearGradient>
33
+ <linearGradient x1="0" y1="0" x2="1" y2="0"
34
+ gradientUnits="userSpaceOnUse"
35
+ gradientTransform="matrix(1.16666e-15,-19.053,19.053,1.16666e-15,414.482,522.486)"
36
+ id="map-marker-38-s">
37
+ <stop offset="0" stop-color="rgb(46,108,151)"/>
38
+ <stop offset="1" stop-color="rgb(56,131,183)"/>
39
+ </linearGradient>
40
+ </defs>
41
+ <g transform="matrix(19.5417,0,0,19.5417,-7889.1,-9807.44)">
42
+ <path fill="#FFFFFF" d="M421.2,515.5c0,2.6-2.1,4.7-4.7,4.7c-2.6,0-4.7-2.1-4.7-4.7c0-2.6,2.1-4.7,4.7-4.7 C419.1,510.8,421.2,512.9,421.2,515.5z"/>
43
+ <path d="M416.544,503.612C409.971,503.612 404.5,509.303 404.5,515.478C404.5,518.256 406.064,521.786 407.194,524.224L416.5,542.096L425.762,524.224C426.892,521.786 428.5,518.433 428.5,515.478C428.5,509.303 423.117,503.612 416.544,503.612ZM416.544,510.767C419.128,510.784 421.223,512.889 421.223,515.477C421.223,518.065 419.128,520.14 416.544,520.156C413.96,520.139 411.865,518.066 411.865,515.477C411.865,512.889 413.96,510.784 416.544,510.767Z" stroke-width="1.1px" fill="url(#map-marker-38-f)" stroke="url(#map-marker-38-s)"/>
44
+ </g>
45
+ </svg>`;
46
+ // We use Leaflet.divIcon directly, as passing arguments to the ember-leaflet helper seems to be
47
+ // broken
48
+ const MARKER_ICON = Leaflet.divIcon({
49
+ html: ICON_HTML,
50
+ // This prevents the default class from being applied, along with the default styling
51
+ className: '',
52
+ iconAnchor: [15, 48],
53
+ iconSize: [30, 48],
54
+ });
55
+
23
56
  export const SUPPORTED_LOCATION_TYPES = ['address', 'place', 'area'] as const;
24
57
  export type LocationType = (typeof SUPPORTED_LOCATION_TYPES)[number];
25
58
 
@@ -248,7 +281,11 @@ export default class LocationPluginMapComponent extends Component<Signature> {
248
281
  }
249
282
 
250
283
  <template>
251
- <div class='map-wrapper' ...attributes>
284
+ <div
285
+ class='map-wrapper
286
+ {{unless (eq @locationType "address") "map-cursor-pointer"}}'
287
+ ...attributes
288
+ >
252
289
  <MapWrapper
253
290
  @mapStart={{this.mapLocation}}
254
291
  @onClick={{this.onMapClick}}
@@ -259,7 +296,11 @@ export default class LocationPluginMapComponent extends Component<Signature> {
259
296
  @attribution={{MAP_TILE_ATTRIBUTION}}
260
297
  />
261
298
  {{#if (and @address (eq @locationType 'address') this.foundAddress)}}
262
- <layers.marker @location={{this.foundAddress}} as |marker|>
299
+ <layers.marker
300
+ @location={{this.foundAddress}}
301
+ @icon={{MARKER_ICON}}
302
+ as |marker|
303
+ >
263
304
  <marker.tooltip>
264
305
  {{@address.formatted}}
265
306
  </marker.tooltip>
@@ -269,6 +310,7 @@ export default class LocationPluginMapComponent extends Component<Signature> {
269
310
  <layers.marker
270
311
  @opacity={{if @location 0.3 1}}
271
312
  @location={{this.existingLocationCoords}}
313
+ @icon={{MARKER_ICON}}
272
314
  as |marker|
273
315
  >
274
316
  <marker.tooltip>
@@ -277,7 +319,7 @@ export default class LocationPluginMapComponent extends Component<Signature> {
277
319
  </layers.marker>
278
320
  {{/if}}
279
321
  {{#if (and @location (eq @locationType 'place'))}}
280
- <layers.marker @location={{@location.global}} />
322
+ <layers.marker @location={{@location.global}} @icon={{MARKER_ICON}} />
281
323
  {{/if}}
282
324
  {{#if (eq @locationType 'area')}}
283
325
  <layers.polyline @locations={{this.vertices}} />
@@ -285,6 +327,7 @@ export default class LocationPluginMapComponent extends Component<Signature> {
285
327
  <layers.marker
286
328
  @location={{vertex}}
287
329
  @onClick={{fn this.onVertexClick index}}
330
+ @icon={{MARKER_ICON}}
288
331
  as |marker|
289
332
  >
290
333
  {{#if (eq index 0)}}
@@ -21,6 +21,11 @@
21
21
  height: 100%;
22
22
  }
23
23
 
24
+ // Override the 'grab' cursor to 'pointer' so we can accurately pick points
25
+ .map-cursor-pointer > .leaflet-grab {
26
+ cursor: pointer;
27
+ }
28
+
24
29
  .leaflet-container {
25
30
  height: 100%;
26
31
  }
package/index.js CHANGED
@@ -33,7 +33,6 @@ module.exports = {
33
33
  // ember-concurrency v4+ requires a custom babel transform. Once we drop ember-concurrency v3 support we can remove this conditional registration.
34
34
  this.options.babel.plugins.push(
35
35
  // require is missing as this lib uses a too old ember-concurrency version
36
- // eslint-disable-next-line node/no-missing-require
37
36
  require.resolve('ember-concurrency/async-arrow-task-transform'),
38
37
  );
39
38
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lblod/ember-rdfa-editor-lblod-plugins",
3
- "version": "28.2.1",
3
+ "version": "28.2.2",
4
4
  "description": "Ember addon providing lblod specific plugins for the ember-rdfa-editor",
5
5
  "keywords": [
6
6
  "ember-addon",
@@ -120,6 +120,7 @@ declare module 'ember-leaflet' {
120
120
  },
121
121
  ];
122
122
  };
123
+ Element: HTMLDivElement;
123
124
  }
124
125
  export class LeafletMap extends Component<LeafletMapSig> {}
125
126