@abi-software/flatmap-viewer 2.7.0 → 2.7.1-a.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/package.json +3 -2
- package/src/interactions.js +6 -0
- package/src/layers/cluster.js +4 -1
- package/src/layers/index.js +5 -1
- package/src/main.js +11 -2
- package/src/types.ts +26 -0
- package/src/utils.js +1 -0
- package/thirdParty/maplibre-gl-svg/CHANGELOG.md +13 -0
- package/thirdParty/maplibre-gl-svg/LICENSE +21 -0
- package/thirdParty/maplibre-gl-svg/LICENSE.md +21 -0
- package/thirdParty/maplibre-gl-svg/README.md +24 -0
- package/thirdParty/maplibre-gl-svg/assets/Add custom SVG template to template manager.jpg +0 -0
- package/thirdParty/maplibre-gl-svg/assets/All built-in SVG templates as HTML markers.jpg +0 -0
- package/thirdParty/maplibre-gl-svg/assets/All built-in SVG templates as symbols.jpg +0 -0
- package/thirdParty/maplibre-gl-svg/assets/Fill polygon with built-in SVG template.jpg +0 -0
- package/thirdParty/maplibre-gl-svg/assets/HTML Marker with Custom SVG Template.jpg +0 -0
- package/thirdParty/maplibre-gl-svg/assets/HTML Marker with built-in SVG template.jpg +0 -0
- package/thirdParty/maplibre-gl-svg/assets/Line layer with built-in SVG template.jpg +0 -0
- package/thirdParty/maplibre-gl-svg/assets/Load SVG from URL.jpg +0 -0
- package/thirdParty/maplibre-gl-svg/assets/SVG template options.jpg +0 -0
- package/thirdParty/maplibre-gl-svg/assets/Smiley_face_changed.svg +37 -0
- package/thirdParty/maplibre-gl-svg/assets/Symbol layer with built-in SVG template.jpg +0 -0
- package/thirdParty/maplibre-gl-svg/assets/image-templates/arrow-up-thin.png +0 -0
- package/thirdParty/maplibre-gl-svg/assets/image-templates/arrow-up.png +0 -0
- package/thirdParty/maplibre-gl-svg/assets/image-templates/car.png +0 -0
- package/thirdParty/maplibre-gl-svg/assets/image-templates/checker-rotated.png +0 -0
- package/thirdParty/maplibre-gl-svg/assets/image-templates/checker.png +0 -0
- package/thirdParty/maplibre-gl-svg/assets/image-templates/circles-spaced.png +0 -0
- package/thirdParty/maplibre-gl-svg/assets/image-templates/circles.png +0 -0
- package/thirdParty/maplibre-gl-svg/assets/image-templates/diagonal-lines-down.png +0 -0
- package/thirdParty/maplibre-gl-svg/assets/image-templates/diagonal-lines-up.png +0 -0
- package/thirdParty/maplibre-gl-svg/assets/image-templates/diagonal-stripes-down.png +0 -0
- package/thirdParty/maplibre-gl-svg/assets/image-templates/diagonal-stripes-up.png +0 -0
- package/thirdParty/maplibre-gl-svg/assets/image-templates/dots.png +0 -0
- package/thirdParty/maplibre-gl-svg/assets/image-templates/flag-triangle.png +0 -0
- package/thirdParty/maplibre-gl-svg/assets/image-templates/flag.png +0 -0
- package/thirdParty/maplibre-gl-svg/assets/image-templates/grid-lines.png +0 -0
- package/thirdParty/maplibre-gl-svg/assets/image-templates/hexagon-rounded-thick.png +0 -0
- package/thirdParty/maplibre-gl-svg/assets/image-templates/hexagon-rounded.png +0 -0
- package/thirdParty/maplibre-gl-svg/assets/image-templates/hexagon-thick.png +0 -0
- package/thirdParty/maplibre-gl-svg/assets/image-templates/hexagon.png +0 -0
- package/thirdParty/maplibre-gl-svg/assets/image-templates/marker-arrow.png +0 -0
- package/thirdParty/maplibre-gl-svg/assets/image-templates/marker-ball-pin.png +0 -0
- package/thirdParty/maplibre-gl-svg/assets/image-templates/marker-circle.png +0 -0
- package/thirdParty/maplibre-gl-svg/assets/image-templates/marker-flat.png +0 -0
- package/thirdParty/maplibre-gl-svg/assets/image-templates/marker-square-cluster.png +0 -0
- package/thirdParty/maplibre-gl-svg/assets/image-templates/marker-square-rounded-cluster.png +0 -0
- package/thirdParty/maplibre-gl-svg/assets/image-templates/marker-square-rounded.png +0 -0
- package/thirdParty/maplibre-gl-svg/assets/image-templates/marker-square.png +0 -0
- package/thirdParty/maplibre-gl-svg/assets/image-templates/marker-thick.png +0 -0
- package/thirdParty/maplibre-gl-svg/assets/image-templates/marker.png +0 -0
- package/thirdParty/maplibre-gl-svg/assets/image-templates/pin-round.png +0 -0
- package/thirdParty/maplibre-gl-svg/assets/image-templates/pin.png +0 -0
- package/thirdParty/maplibre-gl-svg/assets/image-templates/rotated-grid-lines.png +0 -0
- package/thirdParty/maplibre-gl-svg/assets/image-templates/rotated-grid-stripes.png +0 -0
- package/thirdParty/maplibre-gl-svg/assets/image-templates/rounded-square-thick.png +0 -0
- package/thirdParty/maplibre-gl-svg/assets/image-templates/rounded-square.png +0 -0
- package/thirdParty/maplibre-gl-svg/assets/image-templates/triangle-arrow-left.png +0 -0
- package/thirdParty/maplibre-gl-svg/assets/image-templates/triangle-arrow-up.png +0 -0
- package/thirdParty/maplibre-gl-svg/assets/image-templates/triangle-thick.png +0 -0
- package/thirdParty/maplibre-gl-svg/assets/image-templates/triangle.png +0 -0
- package/thirdParty/maplibre-gl-svg/assets/image-templates/x-fill.png +0 -0
- package/thirdParty/maplibre-gl-svg/assets/image-templates/zig-zag-vertical.png +0 -0
- package/thirdParty/maplibre-gl-svg/assets/image-templates/zig-zag.png +0 -0
- package/thirdParty/maplibre-gl-svg/build/build.js +210 -0
- package/thirdParty/maplibre-gl-svg/dist/maplibre-gl-svg.js +339 -0
- package/thirdParty/maplibre-gl-svg/dist/maplibre-gl-svg.min.js +4 -0
- package/thirdParty/maplibre-gl-svg/docs/docs.md +375 -0
- package/thirdParty/maplibre-gl-svg/examples/Add custom SVG template to template manager.html +101 -0
- package/thirdParty/maplibre-gl-svg/examples/All built-in SVG templates as HTML markers.html +82 -0
- package/thirdParty/maplibre-gl-svg/examples/All built-in SVG templates as symbols.html +124 -0
- package/thirdParty/maplibre-gl-svg/examples/Fill polygon with built-in SVG template.html +94 -0
- package/thirdParty/maplibre-gl-svg/examples/HTML Marker with Custom SVG Template.html +86 -0
- package/thirdParty/maplibre-gl-svg/examples/HTML Marker with built-in SVG template.html +83 -0
- package/thirdParty/maplibre-gl-svg/examples/Line layer with built-in SVG template.html +129 -0
- package/thirdParty/maplibre-gl-svg/examples/Load SVG from URL.html +96 -0
- package/thirdParty/maplibre-gl-svg/examples/SVG template options.html +264 -0
- package/thirdParty/maplibre-gl-svg/examples/Symbol layer with built-in SVG template.html +93 -0
- package/thirdParty/maplibre-gl-svg/index.html +151 -0
- package/thirdParty/maplibre-gl-svg/package-lock.json +5882 -0
- package/thirdParty/maplibre-gl-svg/package.json +49 -0
- package/thirdParty/maplibre-gl-svg/src/SvgManager.ts +186 -0
- package/thirdParty/maplibre-gl-svg/src/SvgTemplateManager.ts +144 -0
- package/thirdParty/maplibre-gl-svg/src/index.ts +4 -0
- package/thirdParty/maplibre-gl-svg/tsconfig.json +31 -0
- package/thirdParty/maplibre-gl-svg/typings/index.d.ts +111 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abi-software/flatmap-viewer",
|
|
3
|
-
"version": "2.7.
|
|
3
|
+
"version": "2.7.1-a.2",
|
|
4
4
|
"description": "Flatmap viewer using Maplibre GL",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -11,7 +11,8 @@
|
|
|
11
11
|
"files": [
|
|
12
12
|
"lib",
|
|
13
13
|
"src",
|
|
14
|
-
"static"
|
|
14
|
+
"static",
|
|
15
|
+
"thirdParty"
|
|
15
16
|
],
|
|
16
17
|
"scripts": {
|
|
17
18
|
"test": "echo \"Error: no test specified\" && exit 1",
|
package/src/interactions.js
CHANGED
|
@@ -1020,6 +1020,10 @@ export class UserInteractions
|
|
|
1020
1020
|
// Simulate `mouseenter` events on features
|
|
1021
1021
|
|
|
1022
1022
|
const feature = features[0];
|
|
1023
|
+
|
|
1024
|
+
//is feature a marker??
|
|
1025
|
+
console.log('mm', event.type, feature)
|
|
1026
|
+
|
|
1023
1027
|
const featureModels = ('properties' in feature && 'models' in feature.properties)
|
|
1024
1028
|
? feature.properties.models
|
|
1025
1029
|
: null;
|
|
@@ -1444,6 +1448,7 @@ export class UserInteractions
|
|
|
1444
1448
|
markerMouseEvent_(marker, anatomicalId, event)
|
|
1445
1449
|
//============================================
|
|
1446
1450
|
{
|
|
1451
|
+
console.log('mk', event.type)
|
|
1447
1452
|
// No tooltip when context menu is open
|
|
1448
1453
|
if (this._modal
|
|
1449
1454
|
|| (this.__activeMarker !== null && event.type === 'mouseleave')) {
|
|
@@ -1464,6 +1469,7 @@ export class UserInteractions
|
|
|
1464
1469
|
|
|
1465
1470
|
this.markerEvent_(event, markerId, marker.getLngLat(),
|
|
1466
1471
|
anatomicalId, annotation)
|
|
1472
|
+
console.log('mk handled...')
|
|
1467
1473
|
event.stopPropagation()
|
|
1468
1474
|
}
|
|
1469
1475
|
}
|
package/src/layers/cluster.js
CHANGED
|
@@ -113,6 +113,7 @@ export class ClusteredMarkerLayer
|
|
|
113
113
|
const features = this.#map.queryRenderedFeatures(e.point, {
|
|
114
114
|
layers: ['clustered-markers']
|
|
115
115
|
})
|
|
116
|
+
console.log('Cluster marker', features)
|
|
116
117
|
const clusterId = features[0].properties.cluster_id
|
|
117
118
|
const zoom = await this.#map.getSource('markers').getClusterExpansionZoom(clusterId)
|
|
118
119
|
this.#map.easeTo({
|
|
@@ -121,10 +122,10 @@ export class ClusteredMarkerLayer
|
|
|
121
122
|
})
|
|
122
123
|
})
|
|
123
124
|
|
|
124
|
-
console.log('Unclustered click', e, features)
|
|
125
125
|
this.#map.on('click', 'single-points', this.singleMarkerEvent.bind(this))
|
|
126
126
|
this.#map.on('mouseenter', 'single-points', this.singleMarkerEvent.bind(this))
|
|
127
127
|
this.#map.on('mousemove', 'single-points', this.singleMarkerEvent.bind(this))
|
|
128
|
+
// this.#map.on('mouseleave', 'single-points', this.singleMarkerEvent.bind(this))
|
|
128
129
|
|
|
129
130
|
this.#map.on('mouseenter', 'clustered-markers', () => {
|
|
130
131
|
this.#map.getCanvas().style.cursor = 'pointer'
|
|
@@ -138,6 +139,7 @@ export class ClusteredMarkerLayer
|
|
|
138
139
|
singleMarkerEvent(event)
|
|
139
140
|
//======================
|
|
140
141
|
{
|
|
142
|
+
console.log('cl', event.type)
|
|
141
143
|
const features = this.#map.queryRenderedFeatures(event.point, {
|
|
142
144
|
layers: ['single-points']
|
|
143
145
|
})
|
|
@@ -146,6 +148,7 @@ export class ClusteredMarkerLayer
|
|
|
146
148
|
const position = properties.markerPosition.slice(1, -1).split(',').map(p => +p)
|
|
147
149
|
this.#ui.markerEvent_(event, feature.id, position, properties.models, properties)
|
|
148
150
|
}
|
|
151
|
+
console.log('cl handled...')
|
|
149
152
|
event.originalEvent.stopPropagation()
|
|
150
153
|
}
|
|
151
154
|
|
package/src/layers/index.js
CHANGED
|
@@ -425,10 +425,14 @@ export class LayerManager
|
|
|
425
425
|
mapLayer.setFilter(this.__layerOptions);
|
|
426
426
|
}
|
|
427
427
|
if (this.#flightPathLayer) {
|
|
428
|
+
// * @arg options.layerOptions.sckan {string} Show neuron paths known to SCKAN: values are ``valid`` (default),
|
|
429
|
+
// * ``invalid``, ``all`` or ``none``.
|
|
430
|
+
|
|
431
|
+
|
|
428
432
|
const sckanState = options.sckan || 'valid'
|
|
429
433
|
const sckanFilter = (sckanState == 'none') ? {NOT: {HAS: 'sckan'}} :
|
|
430
434
|
(sckanState == 'valid') ? {sckan: true} :
|
|
431
|
-
(sckanState == 'invalid') ? {NOT: {sckan: true}} :
|
|
435
|
+
(sckanState == 'invalid') ? {NOT: {sckan: true}} : // {sckan: false} is different...
|
|
432
436
|
true
|
|
433
437
|
const featureFilter = new PropertiesFilter(sckanFilter)
|
|
434
438
|
if ('taxons' in options) {
|
package/src/main.js
CHANGED
|
@@ -49,12 +49,15 @@ const ALL_MARKERS = [
|
|
|
49
49
|
'UBERON:0037094',
|
|
50
50
|
'ILX:0738305',
|
|
51
51
|
|
|
52
|
-
'UBERON:0000948', // {className: 'heart-marker'}); // Heart
|
|
52
|
+
// 'UBERON:0000948', // {className: 'heart-marker'}); // Heart
|
|
53
53
|
'UBERON:0002048', // Lung
|
|
54
54
|
'UBERON:0000945', // Stomach
|
|
55
55
|
'UBERON:0001155', // Colon
|
|
56
56
|
'UBERON:0001255', // Bladder
|
|
57
57
|
'UBERON:0001759', // Vagus
|
|
58
|
+
|
|
59
|
+
'UBERON:0016508', // Pelvic ganglion
|
|
60
|
+
|
|
58
61
|
]
|
|
59
62
|
|
|
60
63
|
//==============================================================================
|
|
@@ -172,6 +175,8 @@ export async function standaloneViewer(map_endpoint=null, options={})
|
|
|
172
175
|
mapOptions.background = args[0].value;
|
|
173
176
|
} else if (eventType === 'annotation') {
|
|
174
177
|
drawControl.handleEvent(...args)
|
|
178
|
+
} else if (args[0].type === 'marker') {
|
|
179
|
+
console.log(eventType, ...args)
|
|
175
180
|
}
|
|
176
181
|
}, mapOptions)
|
|
177
182
|
.then(map => {
|
|
@@ -183,7 +188,11 @@ export async function standaloneViewer(map_endpoint=null, options={})
|
|
|
183
188
|
map.addMarker('UBERON:0001255'); // Bladder
|
|
184
189
|
map.addMarker('UBERON:0001759'); // Vagus
|
|
185
190
|
*/
|
|
186
|
-
map.
|
|
191
|
+
map.addMarker('UBERON:0000945', {cluster: true}); // Stomach
|
|
192
|
+
// map.addMarker('UBERON:0016508', {cluster: false}); // Pelvic ganglion
|
|
193
|
+
map.addMarker('UBERON:0016508', {cluster: true}); // Pelvic ganglion
|
|
194
|
+
map.addMarker('UBERON:0000948', {cluster: true, className: 'heart-marker'}); // Heart
|
|
195
|
+
// map.addMarkers(ALL_MARKERS)
|
|
187
196
|
currentMap = map;
|
|
188
197
|
drawControl = new DrawControl(map)
|
|
189
198
|
})
|
package/src/types.ts
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/******************************************************************************
|
|
2
|
+
|
|
3
|
+
Flatmap viewer and annotation tool
|
|
4
|
+
|
|
5
|
+
Copyright (c) 2019 - 2024 David Brooks
|
|
6
|
+
|
|
7
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
8
|
+
you may not use this file except in compliance with the License.
|
|
9
|
+
You may obtain a copy of the License at
|
|
10
|
+
|
|
11
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
12
|
+
|
|
13
|
+
Unless required by applicable law or agreed to in writing, software
|
|
14
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
15
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
16
|
+
See the License for the specific language governing permissions and
|
|
17
|
+
limitations under the License.
|
|
18
|
+
|
|
19
|
+
******************************************************************************/
|
|
20
|
+
|
|
21
|
+
export type Constructor<T> = new(...args: any[]) => T
|
|
22
|
+
|
|
23
|
+
export type ObjectRecord = Record<string, any>
|
|
24
|
+
|
|
25
|
+
//==============================================================================
|
|
26
|
+
|
package/src/utils.js
CHANGED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
## Maplibre GL SVG Plugin Changelog
|
|
2
|
+
|
|
3
|
+
<a name="0.0.1"></a>
|
|
4
|
+
# 0.0.1
|
|
5
|
+
|
|
6
|
+
Initial release.
|
|
7
|
+
|
|
8
|
+
**Features**
|
|
9
|
+
|
|
10
|
+
- Load an SVG into the maps image sprite and use as an icon in a symbol layer, or as an fill pattern.
|
|
11
|
+
- SVG templates manager to easily create reusable customizable icon templates using SVGs. Includes
|
|
12
|
+
- 27 built-in symbol/marker icon templates
|
|
13
|
+
- 15 built-in fill pattern templates.
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2023 Ricky Brundritt
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2023 Ricky Brundritt
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# MapLibre GL SVG Plugin
|
|
2
|
+
|
|
3
|
+
> Status: New plugin, still being validated.
|
|
4
|
+
|
|
5
|
+
A [maplibre-gl-js](https://maplibre.org/maplibre-gl-js/docs/) plugin that adds support for loading SVGs images into the maps image sprite.
|
|
6
|
+
|
|
7
|
+
- [Go to the examples page](https://rbrundritt.github.io/maplibre-gl-svg/index.html)
|
|
8
|
+
- [Read the docs](https://github.com/rbrundritt/maplibre-gl-svg/blob/main/docs/docs.md)
|
|
9
|
+
|
|
10
|
+
**Features:**
|
|
11
|
+
|
|
12
|
+
- Load an SVG into the maps image sprite and use as an icon in a symbol layer, or as an fill pattern.
|
|
13
|
+
- Framework for templatable SVG icons. Great way to create reusable icons that you can programmatically change the styles of.
|
|
14
|
+
- HTML marker support
|
|
15
|
+
|
|
16
|
+
**Known Limitations**
|
|
17
|
+
|
|
18
|
+
- When loaded into the maps image sprite SVG's are converted into a data URI, and loaded as a static image into the maps image sprite. This means animations and CSS classes are not supported. All CSS styles should be embedded within the SVG. SVG's used with HTML markers will support CSS classes and animations as usual.
|
|
19
|
+
|
|
20
|
+
## License
|
|
21
|
+
|
|
22
|
+
MIT
|
|
23
|
+
|
|
24
|
+
See [License](https://github.com/rbrundritt/maplibre-gl-svg/blob/main/LICENSE.md) for full license text.
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
|
2
|
+
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
|
3
|
+
<svg
|
|
4
|
+
xmlns:svg="http://www.w3.org/2000/svg"
|
|
5
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
6
|
+
xmlns:xlink="http://www.w3.org/1999/xlink"
|
|
7
|
+
version="1.0"
|
|
8
|
+
x="0"
|
|
9
|
+
y="0"
|
|
10
|
+
width="194"
|
|
11
|
+
height="200"
|
|
12
|
+
id="Face">
|
|
13
|
+
<path
|
|
14
|
+
d="M 186.11394,98.304237 C 186.62399,134.66870 162.61525,169.70928 128.55578,182.43531 C 95.991320,195.60352 56.276124,187.11517 31.824005,161.93377 C 6.1490073,136.74335 -1.7726986,95.589284 12.895063,62.717752 C 26.131798,30.871489 58.959432,8.6063558 93.435503,8.0498005 C 130.40005,6.5693681 166.62078,30.464084 179.78044,65.055801 C 183.95955,75.607305 186.15088,86.951651 186.11394,98.304237 z "
|
|
15
|
+
style="opacity:1;fill:#ffff00;fill-opacity:1;stroke:#000000;stroke-width:2;stroke-opacity:1"
|
|
16
|
+
id="path1352" />
|
|
17
|
+
<path
|
|
18
|
+
d="M 77.006599,70.918053 C 77.527726,79.716943 64.712340,84.270466 59.707418,76.889791 C 54.124523,70.591110 60.327827,59.897153 68.519803,61.268419 C 73.235680,61.807597 77.099882,66.152789 77.006599,70.918053 z "
|
|
19
|
+
style="opacity:1;fill:#cece00;fill-opacity:1;stroke:#000000;stroke-width:1;stroke-opacity:1"
|
|
20
|
+
id="eye" />
|
|
21
|
+
<use
|
|
22
|
+
transform="translate(57.58983,0.496064)"
|
|
23
|
+
id="eye2"
|
|
24
|
+
x="0"
|
|
25
|
+
y="0"
|
|
26
|
+
width="744.09448"
|
|
27
|
+
height="1052.3622"
|
|
28
|
+
xlink:href="#eye" />
|
|
29
|
+
<path
|
|
30
|
+
d="M 77.814522,115.89286 C 83.829118,103.68413 89.843712,91.475395 95.858307,79.266663 C 101.87290,91.475397 107.88750,103.68413 113.90210,115.89286 C 101.87291,115.89286 89.843714,115.89286 77.814522,115.89286 z "
|
|
31
|
+
style="fill:#0000ff;fill-opacity:1;stroke:#000000;stroke-width:1;stroke-opacity:1"
|
|
32
|
+
id="nose" />
|
|
33
|
+
<path
|
|
34
|
+
d="M 145.14207,136.36044 C 124.78121,151.38904 102.90920,149.14419 79.824122,131.65685 C 70.594385,128.53160 54.906902,141.79498 46.843849,136.36044"
|
|
35
|
+
style="fill:none;stroke:#000000;stroke-width:1.3228360;stroke-opacity:1"
|
|
36
|
+
id="mouth" />
|
|
37
|
+
</svg>
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
const pkg = require("../package.json");
|
|
2
|
+
const fs = require("fs-extra");
|
|
3
|
+
const path = require("path");
|
|
4
|
+
const { rollup } = require("rollup");
|
|
5
|
+
const commonjs = require("rollup-plugin-commonjs");
|
|
6
|
+
const nodeResolve = require("rollup-plugin-node-resolve");
|
|
7
|
+
const { uglify } = require("rollup-plugin-uglify");
|
|
8
|
+
const ts = require("typescript");
|
|
9
|
+
|
|
10
|
+
// Configure any functions/properties used by the drawing tools and
|
|
11
|
+
// exported by a dependency that rollup can't automatically detect.
|
|
12
|
+
const namedExports = {
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
// Parse the command line.
|
|
16
|
+
const args = require("yargs").options({
|
|
17
|
+
"isNpmBuild": {
|
|
18
|
+
describe: "Whether the build is for NPM.",
|
|
19
|
+
type: "boolean"
|
|
20
|
+
}
|
|
21
|
+
}).help().argv;
|
|
22
|
+
|
|
23
|
+
// Host for formating typescript diagnostics.
|
|
24
|
+
const formatDiagnosticHost = {
|
|
25
|
+
getCanonicalFileName: path.normalize,
|
|
26
|
+
getCurrentDirectory: ts.sys.getCurrentDirectory,
|
|
27
|
+
getNewLine: () => ts.sys.newLine
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
// Host for parsing the config file host.
|
|
31
|
+
const parseConfigFileHost = {
|
|
32
|
+
useCaseSensitiveFileNames: false,
|
|
33
|
+
fileExists: ts.sys.fileExists,
|
|
34
|
+
getCurrentDirectory: ts.sys.getCurrentDirectory,
|
|
35
|
+
readDirectory: ts.sys.readDirectory,
|
|
36
|
+
readFile: ts.sys.readFile,
|
|
37
|
+
onUnRecoverableConfigFileDiagnostic: (diag) =>
|
|
38
|
+
console.error(ts.formatDiagnostic(diag, formatDiagnosticHost))
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
// Define and immediately execute the main build function.
|
|
42
|
+
let rollupError = false;
|
|
43
|
+
(async function build() {
|
|
44
|
+
// Cleanup the dist folder where the js packages will be output
|
|
45
|
+
const distDirPath = "./dist";
|
|
46
|
+
fs.emptyDirSync(distDirPath);
|
|
47
|
+
|
|
48
|
+
// Get the major and minor version for the output folder name
|
|
49
|
+
//const [majorVersion, minorVersion] = pkg.version.split(".");
|
|
50
|
+
|
|
51
|
+
// File name and path for non-minified browser js
|
|
52
|
+
const outFilePath = `${distDirPath}/maplibre-gl-svg.js`;
|
|
53
|
+
const outMinFilePath = `${distDirPath}/maplibre-gl-svg.min.js`;
|
|
54
|
+
|
|
55
|
+
const inputPath = "./js/index.js";
|
|
56
|
+
|
|
57
|
+
// Ensure that all necessary output folders are created.
|
|
58
|
+
await fs.ensureDir(path.dirname(outFilePath));
|
|
59
|
+
await fs.ensureDir(path.dirname(outMinFilePath));
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
// Parse the typescript config file.
|
|
63
|
+
console.log("Parsing tsconfig.json");
|
|
64
|
+
const tsConfig = ts.getParsedCommandLineOfConfigFile("./tsconfig.json", {}, parseConfigFileHost);
|
|
65
|
+
if (tsConfig.errors.length > 0) {
|
|
66
|
+
for (const error of tsConfig.errors) {
|
|
67
|
+
console.error(ts.formatDiagnostic(error, formatDiagnosticHost));
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
process.exit(-1);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
// Empty the directory for storing the compiled typescript.
|
|
74
|
+
console.log("Clearing the typescript output folder");
|
|
75
|
+
await fs.emptyDir(tsConfig.options.outDir);
|
|
76
|
+
|
|
77
|
+
// Compile the typescript source.
|
|
78
|
+
console.log("Compiling typescript to javascript");
|
|
79
|
+
const tsProgram = ts.createProgram(tsConfig.fileNames, tsConfig.options);
|
|
80
|
+
const tsResult = tsProgram.emit();
|
|
81
|
+
const tsDiag = ts.getPreEmitDiagnostics(tsProgram).concat(tsResult.diagnostics);
|
|
82
|
+
if (tsDiag.length > 0) {
|
|
83
|
+
for (const error of tsDiag) {
|
|
84
|
+
console.error(ts.formatDiagnostic(error, formatDiagnosticHost));
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
process.exit(-1);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
// Read license.txt to define the banner for the packages.
|
|
91
|
+
let banner = "/*\n";
|
|
92
|
+
banner += (await fs.readFile("./license.md", "utf8")).trim();
|
|
93
|
+
banner += "\n*/\n";
|
|
94
|
+
|
|
95
|
+
let rollupInputOps, rollupOutputOps;
|
|
96
|
+
if (!args.isNpmBuild) {
|
|
97
|
+
// Set rollup options for browser builds.
|
|
98
|
+
rollupInputOps = {
|
|
99
|
+
external: ["maplibregll"],
|
|
100
|
+
onwarn: rollupWarn,
|
|
101
|
+
input: inputPath,
|
|
102
|
+
plugins: [
|
|
103
|
+
nodeResolve({
|
|
104
|
+
browser: true,
|
|
105
|
+
preferBuiltins: false
|
|
106
|
+
}),
|
|
107
|
+
commonjs({
|
|
108
|
+
namedExports: namedExports
|
|
109
|
+
})
|
|
110
|
+
]
|
|
111
|
+
};
|
|
112
|
+
|
|
113
|
+
rollupOutputOps = {
|
|
114
|
+
exports: "named",
|
|
115
|
+
file: outFilePath,
|
|
116
|
+
format: "iife",
|
|
117
|
+
name: "maplibregl",
|
|
118
|
+
extend: true,
|
|
119
|
+
globals: {
|
|
120
|
+
"maplibregl": "maplibregl"
|
|
121
|
+
}
|
|
122
|
+
};
|
|
123
|
+
} else {
|
|
124
|
+
rollupInputOps = {
|
|
125
|
+
external: ["maplibregl"],
|
|
126
|
+
onwarn: rollupWarn,
|
|
127
|
+
input: inputPath,
|
|
128
|
+
plugins: [
|
|
129
|
+
nodeResolve(),
|
|
130
|
+
commonjs({
|
|
131
|
+
namedExports: namedExports
|
|
132
|
+
})
|
|
133
|
+
]
|
|
134
|
+
};
|
|
135
|
+
|
|
136
|
+
rollupOutputOps = {
|
|
137
|
+
file: outFilePath,
|
|
138
|
+
format: "cjs"
|
|
139
|
+
};
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
// Rollup non-minified version.
|
|
143
|
+
console.log("Bundling non-minified javascript package");
|
|
144
|
+
await bundle(rollupInputOps, rollupOutputOps, banner);
|
|
145
|
+
|
|
146
|
+
// Add uglify to the rollup input plugins.
|
|
147
|
+
// Update the output file path for the minified version.
|
|
148
|
+
rollupOutputOps.file = outMinFilePath;
|
|
149
|
+
rollupInputOps.plugins.push(uglify());
|
|
150
|
+
|
|
151
|
+
// Rollup minified version.
|
|
152
|
+
const minifiedLicense = "/* MIT License - Copyright (c) Ricky Brundritt. */\n\n"
|
|
153
|
+
console.log("Bundling minified javascript package");
|
|
154
|
+
await bundle(rollupInputOps, rollupOutputOps, minifiedLicense);
|
|
155
|
+
|
|
156
|
+
//Remove js folder.
|
|
157
|
+
await fs.remove("./js");
|
|
158
|
+
|
|
159
|
+
// Build is done!
|
|
160
|
+
console.log(rollupError ? "Build failed" : "Build completed successfully!");
|
|
161
|
+
process.exit(rollupError ? -1 : 0);
|
|
162
|
+
})()
|
|
163
|
+
|
|
164
|
+
async function bundle(inputOptions, outputOptions) {
|
|
165
|
+
const bundle = await rollup(inputOptions);
|
|
166
|
+
await bundle.write(outputOptions);
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
function rollupWarn(warning) {
|
|
170
|
+
// Print the warning to the console.
|
|
171
|
+
console.warn(warning.toString());
|
|
172
|
+
|
|
173
|
+
// If the warning is about missing export provide more info.
|
|
174
|
+
if (warning.code === "MISSING_EXPORT") {
|
|
175
|
+
console.warn(
|
|
176
|
+
` if '${warning.missing}' is exported by '${warning.exporter}' then try adding\n` +
|
|
177
|
+
` "${warning.exporter}": [${warning.missing}] to namedExports in ${__filename}`
|
|
178
|
+
);
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
async function bundle(rollupInputOps, rollupOutputOps, banner) {
|
|
183
|
+
try {
|
|
184
|
+
const bundle = await rollup(rollupInputOps);
|
|
185
|
+
const { output } = await bundle.generate(rollupOutputOps);
|
|
186
|
+
|
|
187
|
+
const chunk = output.find((chunk) =>
|
|
188
|
+
chunk.fileName === path.basename(rollupOutputOps.file)
|
|
189
|
+
);
|
|
190
|
+
|
|
191
|
+
await fs.writeFile(rollupOutputOps.file, banner + "\n" + chunk.code, "utf8");
|
|
192
|
+
} catch (error) {
|
|
193
|
+
throw new Error(`Failed to bundle the javascript package:\n${error.message}\n` +
|
|
194
|
+
JSON.stringify(error, null, 2));
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
function rollupWarn(warning) {
|
|
199
|
+
// If the warning is about missing export provide more info.
|
|
200
|
+
if (warning.code === "MISSING_EXPORT") {
|
|
201
|
+
rollupError = true;
|
|
202
|
+
console.error("ERROR: " + warning.toString() + "\n" +
|
|
203
|
+
` if '${warning.missing}' is exported by '${warning.exporter}' then try adding\n` +
|
|
204
|
+
` "${warning.exporter}": [${warning.missing}] to namedExports in ${__filename}`
|
|
205
|
+
);
|
|
206
|
+
} else {
|
|
207
|
+
// Print the warning to the console.
|
|
208
|
+
console.warn("WARNING: " + warning.toString());
|
|
209
|
+
}
|
|
210
|
+
}
|