Spaces:
Paused
Paused
Download node_modules/@plotly/mapbox-gl/src/style-spec/composite.js from Leon4gr45/UserSyncFrontend: direct link, hf CLI and curl.
- Browser
- Download file 1.21 kB
-
https://huggingface.co/spaces/Leon4gr45/UserSyncFrontend/resolve/main/node_modules/%40plotly/mapbox-gl/src/style-spec/composite.js
- Command line
-
hf download hf://spaces/Leon4gr45/UserSyncFrontend/node_modules/@plotly/mapbox-gl/src/style-spec/composite.js
-
curl -L -o composite.js https://huggingface.co/spaces/Leon4gr45/UserSyncFrontend/resolve/main/node_modules/%40plotly/mapbox-gl/src/style-spec/composite.js
1.21 kB
| export default function (style) { | |
| const styleIDs = []; | |
| const sourceIDs = []; | |
| const compositedSourceLayers = []; | |
| for (const id in style.sources) { | |
| const source = style.sources[id]; | |
| if (source.type !== "vector") | |
| continue; | |
| const match = /^mapbox:\/\/(.*)/.exec(source.url); | |
| if (!match) | |
| continue; | |
| styleIDs.push(id); | |
| sourceIDs.push(match[1]); | |
| } | |
| if (styleIDs.length < 2) | |
| return style; | |
| styleIDs.forEach((id) => { | |
| delete style.sources[id]; | |
| }); | |
| const compositeID = sourceIDs.join(","); | |
| style.sources[compositeID] = { | |
| "type": "vector", | |
| "url": `mapbox://${compositeID}` | |
| }; | |
| style.layers.forEach((layer) => { | |
| if (styleIDs.indexOf(layer.source) >= 0) { | |
| layer.source = compositeID; | |
| if ('source-layer' in layer) { | |
| if (compositedSourceLayers.indexOf(layer['source-layer']) >= 0) { | |
| throw new Error('Conflicting source layer names'); | |
| } else { | |
| compositedSourceLayers.push(layer['source-layer']); | |
| } | |
| } | |
| } | |
| }); | |
| return style; | |
| } | |