diff --git a/dist/main.js b/dist/main.js index 084a8db..f772d60 100644 --- a/dist/main.js +++ b/dist/main.js @@ -7,10 +7,22 @@ $parcel$export(module.exports, "diffStylesSetStyle", () => $8be22f452ef17487$exp const $8be22f452ef17487$var$isEqual = (a, b)=>JSON.stringify(a) === JSON.stringify(b); class $8be22f452ef17487$var$diffTracker { constructor(){ + this.glyphs = null; + this.sprite = null; this.sources = []; this.layers = []; this.layerProps = {}; } + changeGlyphs(change) { + this.glyphs = { + change: change + }; + } + changeSprite(change) { + this.sprite = { + change: change + }; + } changeSource(source, change) { this.sources.push({ source: source, @@ -428,18 +440,36 @@ function $8be22f452ef17487$export$c11d25f35bd6cdfa(before, after) { after.pitch ] }); - if (!$8be22f452ef17487$var$isEqual(before.sprite, after.sprite)) commands.push({ - command: $8be22f452ef17487$var$operations.setSprite, - args: [ - after.sprite - ] - }); - if (!$8be22f452ef17487$var$isEqual(before.glyphs, after.glyphs)) commands.push({ - command: $8be22f452ef17487$var$operations.setGlyphs, - args: [ - after.glyphs - ] - }); + if (!$8be22f452ef17487$var$isEqual(before.sprite, after.sprite)) { + commands.push({ + command: $8be22f452ef17487$var$operations.setSprite, + args: [ + after.sprite + ] + }); + differ.changeSprite({ + command: "setSprite", + args: [ + after.sprite, + before.sprite + ] + }); + } + if (!$8be22f452ef17487$var$isEqual(before.glyphs, after.glyphs)) { + commands.push({ + command: $8be22f452ef17487$var$operations.setGlyphs, + args: [ + after.glyphs + ] + }); + differ.changeGlyphs({ + command: "setGlyphs", + args: [ + after.glyphs, + before.glyphs + ] + }); + } if (!$8be22f452ef17487$var$isEqual(before.transition, after.transition)) commands.push({ command: $8be22f452ef17487$var$operations.setTransition, args: [ @@ -513,7 +543,7 @@ function $8be22f452ef17487$var$detectMovedLayers(commands) { // Added this function to change the output format to be more helpful const $8be22f452ef17487$var$diffStyles = (before, after)=>{ const originalDiff = $8be22f452ef17487$export$c11d25f35bd6cdfa(before, after); - const { layerProps: layerProps , layers: layers , sources: sources } = originalDiff; + const { layerProps: layerProps , layers: layers , sources: sources , glyphs: glyphs , sprite: sprite } = originalDiff; // formatting for source additions and removals const nextSources = sources.reduce((acc, s)=>{ const { change: change , source: source } = s; @@ -605,10 +635,28 @@ const $8be22f452ef17487$var$diffStyles = (before, after)=>{ acc[layerId] = nextLayerChanges; return acc; }, {}); + let nextGlyphs; + if (glyphs?.change?.args) { + const [compareGlyph, currentGlyph] = glyphs?.change?.args; + nextGlyphs = { + current: currentGlyph, + compare: compareGlyph + }; + } + let nextSprite; + if (sprite?.change?.args) { + const [compareSprite, currentSprite] = sprite?.change?.args; + nextSprite = { + current: currentSprite, + compare: compareSprite + }; + } return { layerProps: nextLayerProps, layers: nextLayers, - sources: nextSources + sources: nextSources, + glyphs: nextGlyphs, + sprite: nextSprite }; }; const $8be22f452ef17487$export$a37e3c603d7117e5 = $8be22f452ef17487$var$diffStyles; diff --git a/dist/main.js.map b/dist/main.js.map index 52111a9..fb03a9e 100644 --- a/dist/main.js.map +++ b/dist/main.js.map @@ -1 +1 @@ -{"mappings":";;;;;;ACAA,MAAM,6BAAO,GAAG,CAAC,CAAC,EAAE,CAAC,GAAK,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,AAAC;AAElE,MAAM,iCAAW;IACf,aAAc;QACZ,IAAI,CAAC,OAAO,GAAG,EAAE,CAAC;QAClB,IAAI,CAAC,MAAM,GAAG,EAAE,CAAC;QACjB,IAAI,CAAC,UAAU,GAAG,EAAE,CAAC;KACtB;IAED,YAAY,CAAC,MAAM,EAAE,MAAM,EAAE;QAC3B,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC;YAAE,MAAM,EAAE,MAAM;YAAE,MAAM,EAAE,MAAM;SAAE,CAAC,CAAC;KACvD;IAED,WAAW,CAAC,KAAK,EAAE,MAAM,EAAE;QACzB,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC;YAAE,KAAK,EAAE,KAAK;YAAE,MAAM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AC;KACZ,EAAE,EAAE,CAAC,AAAC;IAEP,OAAO;QACL,UAAU,EAAE,cAAc;QAC1B,MAAM,EAAE,UAAU;QAClB,OAAO,EAAE,WAAW;KACrB,CAAC;CACH,AAAC;AAEK,MAAM,yCAAI,GAAG,gCAAU,AAAC;;ADhtB/B","sources":["src/index.js","src/lib/diff.js"],"sourcesContent":["import { diff, diffStylesSetStyle } from \"./lib/diff\";\n\nexport { diff, diffStylesSetStyle };\n","const isEqual = (a, b) => JSON.stringify(a) === JSON.stringify(b);\n\nclass diffTracker {\n constructor() {\n this.sources = [];\n this.layers = [];\n this.layerProps = {};\n }\n\n changeSource(source, change) {\n this.sources.push({ source: source, change: change });\n }\n\n changeLayer(layer, change) {\n this.layers.push({ layer: layer, change: change });\n }\n\n changeLayerProp(layer, change) {\n if (!this.layerProps[layer]) this.layerProps[layer] = [change];\n else this.layerProps[layer].push(change);\n }\n}\nconst operations = {\n /*\n * { command: 'setStyle', args: [stylesheet] }\n */\n setStyle: 'setStyle',\n\n /*\n * { command: 'addLayer', args: [layer, 'beforeLayerId'] }\n */\n addLayer: 'addLayer',\n\n /*\n * { command: 'removeLayer', args: ['layerId'] }\n */\n removeLayer: 'removeLayer',\n\n moveLayer: 'moveLayer',\n\n /*\n * { command: 'setPaintProperty', args: ['layerId', 'prop', value] }\n */\n setPaintProperty: 'setPaintProperty',\n\n /*\n * { command: 'setLayoutProperty', args: ['layerId', 'prop', value] }\n */\n setLayoutProperty: 'setLayoutProperty',\n\n /*\n * { command: 'setFilter', args: ['layerId', filter] }\n */\n setFilter: 'setFilter',\n\n /*\n * { command: 'addSource', args: ['sourceId', source] }\n */\n addSource: 'addSource',\n\n /*\n * { command: 'removeSource', args: ['sourceId'] }\n */\n removeSource: 'removeSource',\n\n /*\n * { command: 'setGeoJSONSourceData', args: ['sourceId', data] }\n */\n setGeoJSONSourceData: 'setGeoJSONSourceData',\n\n /*\n * { command: 'setLayerZoomRange', args: ['layerId', 0, 22] }\n */\n setLayerZoomRange: 'setLayerZoomRange',\n\n /*\n * { command: 'setLayerProperty', args: ['layerId', 'prop', value] }\n */\n setLayerProperty: 'setLayerProperty',\n\n /*\n * { command: 'setCenter', args: [[lon, lat]] }\n */\n setCenter: 'setCenter',\n\n /*\n * { command: 'setZoom', args: [zoom] }\n */\n setZoom: 'setZoom',\n\n /*\n * { command: 'setBearing', args: [bearing] }\n */\n setBearing: 'setBearing',\n\n /*\n * { command: 'setPitch', args: [pitch] }\n */\n setPitch: 'setPitch',\n\n /*\n * { command: 'setSprite', args: ['spriteUrl'] }\n */\n setSprite: 'setSprite',\n\n /*\n * { command: 'setGlyphs', args: ['glyphsUrl'] }\n */\n setGlyphs: 'setGlyphs',\n\n /*\n * { command: 'setTransition', args: [transition] }\n */\n setTransition: 'setTransition',\n\n /*\n * { command: 'setLighting', args: [lightProperties] }\n */\n setLight: 'setLight',\n\n /*\n * { command: 'setTerrain', args: [terrainProperties] }\n */\n setTerrain: 'setTerrain',\n\n /*\n * { command: 'setFog', args: [fogProperties] }\n */\n setFog: 'setFog',\n\n /*\n * { command: 'setProjection', args: [projectionProperties] }\n */\n setProjection: 'setProjection'\n};\n\nfunction addSource(sourceId, after, commands) {\n commands.push({\n command: operations.addSource,\n args: [sourceId, after[sourceId]]\n });\n}\n\nfunction removeSource(sourceId, commands, sourcesRemoved) {\n commands.push({ command: operations.removeSource, args: [sourceId] });\n sourcesRemoved[sourceId] = true;\n}\n\nfunction updateSource(sourceId, after, commands, sourcesRemoved) {\n removeSource(sourceId, commands, sourcesRemoved);\n addSource(sourceId, after, commands);\n}\n\nfunction canUpdateGeoJSON(before, after, sourceId) {\n let prop;\n for (prop in before[sourceId]) {\n if (!before[sourceId].hasOwnProperty(prop)) continue;\n if (\n prop !== 'data' &&\n !isEqual(before[sourceId][prop], after[sourceId][prop])\n ) {\n return false;\n }\n }\n for (prop in after[sourceId]) {\n if (!after[sourceId].hasOwnProperty(prop)) continue;\n if (\n prop !== 'data' &&\n !isEqual(before[sourceId][prop], after[sourceId][prop])\n ) {\n return false;\n }\n }\n return true;\n}\n\nfunction diffSources(before, after, commands, sourcesRemoved, differ) {\n before = before || {};\n after = after || {};\n\n let sourceId;\n\n // look for sources to remove\n for (sourceId in before) {\n if (!before.hasOwnProperty(sourceId)) continue;\n if (!after.hasOwnProperty(sourceId)) {\n differ.changeSource(sourceId, { command: 'removeSource' });\n removeSource(sourceId, commands, sourcesRemoved);\n }\n }\n\n // look for sources to add/update\n for (sourceId in after) {\n if (!after.hasOwnProperty(sourceId)) continue;\n\n // add sources\n if (!before.hasOwnProperty(sourceId)) {\n differ.changeSource(sourceId, { command: 'addSource' });\n addSource(sourceId, after, commands);\n }\n // update sources\n else if (!isEqual(before[sourceId], after[sourceId])) {\n differ.changeSource(sourceId, { command: 'updateSource' });\n if (\n before[sourceId].type === 'geojson' &&\n after[sourceId].type === 'geojson' &&\n canUpdateGeoJSON(before, after, sourceId)\n ) {\n commands.push({\n command: operations.setGeoJSONSourceData,\n args: [sourceId, after[sourceId].data]\n });\n } else {\n // no update command, must remove then add\n updateSource(sourceId, after, commands, sourcesRemoved);\n }\n }\n }\n}\n\nfunction diffLayerPropertyChanges(\n before,\n after,\n commands,\n layerId,\n klass,\n command,\n differ\n) {\n before = before || {};\n after = after || {};\n\n let prop;\n\n for (prop in before) {\n if (!before.hasOwnProperty(prop)) continue;\n if (!isEqual(before[prop], after[prop])) {\n const cmd = {\n command,\n args: [prop, after[prop], before[prop], klass],\n layer: layerId\n };\n commands.push(cmd);\n differ.changeLayerProp(layerId, cmd);\n }\n }\n for (prop in after) {\n if (!after.hasOwnProperty(prop) || before.hasOwnProperty(prop)) continue;\n if (!isEqual(before[prop], after[prop])) {\n const cmd = {\n command,\n args: [prop, after[prop], before[prop], klass],\n layer: layerId\n };\n commands.push(cmd);\n differ.changeLayerProp(layerId, cmd);\n }\n }\n}\n\nfunction pluckId(layer) {\n return layer.id;\n}\nfunction indexById(group, layer) {\n group[layer.id] = layer;\n return group;\n}\n\nfunction diffLayers(before, after, commands, differ) {\n before = before || [];\n after = after || [];\n\n // order of layers by id\n const beforeOrder = before.map(pluckId);\n const afterOrder = after.map(pluckId);\n\n // index of layer by id\n const beforeIndex = before.reduce(indexById, {});\n const afterIndex = after.reduce(indexById, {});\n\n // track order of layers as if they have been mutated\n const tracker = beforeOrder.slice();\n\n // layers that have been added do not need to be diffed\n const clean = Object.create(null);\n\n let i, d, layerId, beforeLayer, afterLayer, insertBeforeLayerId, prop;\n\n // remove layers\n for (i = 0, d = 0; i < beforeOrder.length; i++) {\n layerId = beforeOrder[i];\n // detect removed layer\n if (!afterIndex.hasOwnProperty(layerId)) {\n commands.push({ command: operations.removeLayer, args: [layerId] });\n differ.changeLayer(layerId, { command: 'removeLayer' });\n tracker.splice(tracker.indexOf(layerId, d), 1);\n } else {\n // limit where in tracker we need to look for a match\n d++;\n }\n }\n\n // add/reorder layers\n for (i = 0, d = 0; i < afterOrder.length; i++) {\n // work backwards as insert is before an existing layer\n layerId = afterOrder[afterOrder.length - 1 - i];\n\n if (tracker[tracker.length - 1 - i] === layerId) continue;\n var movingLayer = false;\n if (beforeIndex.hasOwnProperty(layerId)) {\n movingLayer = true;\n // remove the layer before we insert at the correct position\n commands.push({ command: operations.removeLayer, args: [layerId] });\n tracker.splice(tracker.lastIndexOf(layerId, tracker.length - d), 1);\n } else {\n // limit where in tracker we need to look for a match\n d++;\n }\n\n // add layer at correct position\n insertBeforeLayerId = tracker[tracker.length - i];\n commands.push({\n command: operations.addLayer,\n args: [afterIndex[layerId], insertBeforeLayerId]\n });\n tracker.splice(tracker.length - i, 0, layerId);\n\n if (movingLayer)\n differ.changeLayer(layerId, {\n command: 'moveLayer',\n args: [insertBeforeLayerId]\n });\n else {\n clean[layerId] = true;\n differ.changeLayer(layerId, {\n command: 'addLayer',\n args: [afterIndex[layerId], insertBeforeLayerId]\n });\n }\n }\n\n // update layers\n for (i = 0; i < afterOrder.length; i++) {\n layerId = afterOrder[i];\n beforeLayer = beforeIndex[layerId];\n afterLayer = afterIndex[layerId];\n\n // no need to update if previously added (new or moved)\n if (clean[layerId] || isEqual(beforeLayer, afterLayer)) continue;\n\n // layout, paint, filter, minzoom, maxzoom\n diffLayerPropertyChanges(\n beforeLayer.layout,\n afterLayer.layout,\n commands,\n layerId,\n null,\n operations.setLayoutProperty,\n differ\n );\n diffLayerPropertyChanges(\n beforeLayer.paint,\n afterLayer.paint,\n commands,\n layerId,\n null,\n operations.setPaintProperty,\n differ\n );\n if (!isEqual(beforeLayer.filter, afterLayer.filter)) {\n const cmd = {\n command: operations.setFilter,\n args: ['filter', JSON.stringify(afterLayer.filter), beforeLayer.filter],\n layer: layerId\n };\n commands.push(cmd);\n differ.changeLayerProp(layerId, cmd);\n }\n\n if (!isEqual(beforeLayer.minzoom, afterLayer.minzoom)) {\n const cmd = {\n command: operations.setLayerZoomRange,\n args: ['minzoom', afterLayer.minzoom, beforeLayer.minzoom],\n layer: layerId\n };\n commands.push(cmd);\n differ.changeLayerProp(layerId, cmd);\n }\n if (!isEqual(beforeLayer.maxzoom, afterLayer.maxzoom)) {\n const cmd = {\n command: operations.setLayerZoomRange,\n args: ['maxzoom', afterLayer.maxzoom, beforeLayer.maxzoom],\n layer: layerId\n };\n commands.push(cmd);\n differ.changeLayerProp(layerId, cmd);\n }\n\n // handle all other layer props, including paint.*\n for (prop in beforeLayer) {\n if (!beforeLayer.hasOwnProperty(prop)) continue;\n if (\n prop === 'layout' ||\n prop === 'paint' ||\n prop === 'filter' ||\n prop === 'metadata' ||\n prop === 'minzoom' ||\n prop === 'maxzoom'\n )\n continue;\n if (prop.indexOf('paint.') === 0) {\n diffLayerPropertyChanges(\n beforeLayer[prop],\n afterLayer[prop],\n commands,\n layerId,\n prop.slice(6),\n operations.setPaintProperty,\n differ\n );\n } else if (!isEqual(beforeLayer[prop], afterLayer[prop])) {\n const cmd = {\n command: operations.setLayerProperty,\n args: [prop, afterLayer[prop], beforeLayer[prop]],\n layer: layerId\n };\n commands.push(cmd);\n differ.changeLayerProp(layerId, cmd);\n }\n }\n for (prop in afterLayer) {\n if (!afterLayer.hasOwnProperty(prop) || beforeLayer.hasOwnProperty(prop))\n continue;\n if (\n prop === 'layout' ||\n prop === 'paint' ||\n prop === 'filter' ||\n prop === 'metadata' ||\n prop === 'minzoom' ||\n prop === 'maxzoom'\n )\n continue;\n if (prop.indexOf('paint.') === 0) {\n diffLayerPropertyChanges(\n beforeLayer[prop],\n afterLayer[prop],\n commands,\n layerId,\n prop.slice(6),\n operations.setPaintProperty\n );\n } else if (!isEqual(beforeLayer[prop], afterLayer[prop])) {\n const cmd = {\n command: operations.setLayerProperty,\n args: [prop, afterLayer[prop], beforeLayer[prop]],\n layer: layerId\n };\n commands.push(cmd);\n differ.changeLayerProp(layerId, cmd);\n }\n }\n }\n}\n\n/**\n * Diff two stylesheet\n *\n * Creates semanticly aware diffs that can easily be applied at runtime.\n * Operations produced by the diff closely resemble the mapbox-gl-js API. Any\n * error creating the diff will fall back to the 'setStyle' operation.\n *\n * Example diff:\n * [\n * { command: 'setConstant', args: ['@water', '#0000FF'] },\n * { command: 'setPaintProperty', args: ['background', 'background-color', 'black'] }\n * ]\n *\n * @private\n * @param {*} [before] stylesheet to compare from\n * @param {*} after stylesheet to compare to\n * @returns Array list of changes\n */\nexport function diffStylesSetStyle(before, after) {\n if (!before) return [{ command: operations.setStyle, args: [after] }];\n const differ = new diffTracker();\n\n let commands = [];\n\n try {\n // Handle changes to top-level properties\n if (!isEqual(before.version, after.version)) {\n return [{ command: operations.setStyle, args: [after] }];\n }\n if (!isEqual(before.center, after.center)) {\n commands.push({ command: operations.setCenter, args: [after.center] });\n }\n if (!isEqual(before.zoom, after.zoom)) {\n commands.push({ command: operations.setZoom, args: [after.zoom] });\n }\n if (!isEqual(before.bearing, after.bearing)) {\n commands.push({ command: operations.setBearing, args: [after.bearing] });\n }\n if (!isEqual(before.pitch, after.pitch)) {\n commands.push({ command: operations.setPitch, args: [after.pitch] });\n }\n if (!isEqual(before.sprite, after.sprite)) {\n commands.push({ command: operations.setSprite, args: [after.sprite] });\n }\n if (!isEqual(before.glyphs, after.glyphs)) {\n commands.push({ command: operations.setGlyphs, args: [after.glyphs] });\n }\n if (!isEqual(before.transition, after.transition)) {\n commands.push({\n command: operations.setTransition,\n args: [after.transition]\n });\n }\n if (!isEqual(before.light, after.light)) {\n commands.push({ command: operations.setLight, args: [after.light] });\n }\n if (!isEqual(before.fog, after.fog)) {\n commands.push({ command: operations.setFog, args: [after.fog] });\n }\n if (!isEqual(before.projection, after.projection)) {\n commands.push({\n command: operations.setProjection,\n args: [after.projection]\n });\n }\n\n // Handle changes to `sources`\n // If a source is to be removed, we also--before the removeSource\n // command--need to remove all the style layers that depend on it.\n const sourcesRemoved = {};\n\n // First collect the {add,remove}Source commands\n const removeOrAddSourceCommands = [];\n diffSources(\n before.sources,\n after.sources,\n removeOrAddSourceCommands,\n sourcesRemoved,\n differ\n );\n\n commands = commands.concat(removeOrAddSourceCommands);\n\n // Handle changes to `layers`\n diffLayers(before.layers, after.layers, commands, differ);\n } catch (e) {\n // fall back to setStyle\n console.warn('Unable to compute style diff:', e);\n commands = [{ command: operations.setStyle, args: [after] }];\n }\n\n commands = detectMovedLayers(commands);\n return differ;\n}\n\nfunction detectMovedLayers(commands) {\n var output = [];\n var blacklistAdds = [];\n\n function findReaddedLayer(removalCommand) {\n const targetId = removalCommand.args[0];\n const match = commands.find(l => l.args?.[0]?.id === targetId);\n if (match) {\n blacklistAdds.push(targetId);\n }\n return match;\n }\n\n commands.forEach(c => {\n if (c.command === 'removeLayer') {\n const readded = findReaddedLayer(c);\n if (readded) {\n output.push({ command: 'moveLayer', args: readded.args });\n } else output.push(c);\n } else if (c.command !== 'addLayer' || !blacklistAdds.includes(c.args[0]))\n output.push(c);\n });\n\n return output;\n}\n\n// Added this function to change the output format to be more helpful\nconst diffStyles = (before, after) => {\n const originalDiff = diffStylesSetStyle(before, after);\n\n const { layerProps, layers, sources } = originalDiff;\n\n // formatting for source additions and removals\n const nextSources = sources.reduce((acc, s) => {\n const { change, source } = s;\n\n let type = change.command;\n\n switch (type) {\n case 'removeSource': {\n type = 'remove';\n break;\n }\n case 'addSource': {\n type = 'add';\n break;\n }\n }\n\n acc[source] = type;\n\n return acc;\n }, {});\n\n // formatting for layer additions, reorders, and removals\n const nextLayers = layers.reduce((acc, l) => {\n const { change, layer } = l;\n\n let type = change.command;\n\n switch (type) {\n case 'removeLayer': {\n type = 'remove';\n break;\n }\n case 'addLayer': {\n type = 'add';\n break;\n }\n case 'moveLayer': {\n type = 'move';\n break;\n }\n }\n\n acc[layer] = {\n type,\n ...(type === 'add' && {\n layer: change?.args[0],\n layerAbove: change?.args[1]\n }),\n ...(type === 'move' && { layerAbove: change?.args[0] })\n };\n\n return acc;\n }, {});\n\n // formatting for layer property changes\n const nextLayerProps = Object.keys(layerProps).reduce((acc, layerId) => {\n const nextLayerChanges = layerProps[layerId].reduce((accum, change) => {\n const { command, args } = change;\n\n let type = command;\n\n switch (command) {\n case 'setFilter': {\n type = 'filter';\n break;\n }\n // source & source-layer\n case 'setLayerProperty': {\n type = 'root';\n break;\n }\n case 'setPaintProperty': {\n type = 'paint';\n break;\n }\n // min and max zoom\n case 'setLayerZoomRange': {\n type = 'minMaxZoom';\n break;\n }\n case 'setLayoutProperty': {\n type = 'layout';\n break;\n }\n }\n\n const [propertyId, currentValue, compareValue] = args;\n\n // These are reversed out of the set style version of the diffing tool\n const current = compareValue;\n const compare = currentValue;\n\n if (type === 'root' || type === 'minMaxZoom') {\n accum[propertyId] = {\n current,\n compare\n };\n } else if (type === 'filter') {\n accum[propertyId] = {\n current,\n // Not sure why this is stringified\n compare: typeof compare === 'string' ? JSON.parse(compare) : compare\n };\n } else {\n if (!accum[type]) {\n accum[type] = {};\n }\n accum[type][propertyId] = {\n current,\n compare\n };\n }\n\n return accum;\n }, {});\n\n acc[layerId] = nextLayerChanges;\n\n return acc;\n }, {});\n\n return {\n layerProps: nextLayerProps,\n layers: nextLayers,\n sources: nextSources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AAAC;QAEP,GAAG,CAAC,OAAO,CAAC,GAAG,gBAAgB,CAAC;QAEhC,OAAO,GAAG,CAAC;KACZ,EAAE,EAAE,CAAC,AAAC;IAEP,IAAI,UAAU,AAAC;IACf,IAAI,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE;QACxB,MAAM,CAAC,YAAY,EAAE,YAAY,CAAC,GAAG,MAAM,EAAE,MAAM,EAAE,IAAI,AAAC;QAC1D,UAAU,GAAG;YAAE,OAAO,EAAE,YAAY;YAAE,OAAO,EAAE,YAAY;SAAE,CAAC;KAC/D;IAED,IAAI,UAAU,AAAC;IACf,IAAI,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE;QACxB,MAAM,CAAC,aAAa,EAAE,aAAa,CAAC,GAAG,MAAM,EAAE,MAAM,EAAE,IAAI,AAAC;QAC5D,UAAU,GAAG;YAAE,OAAO,EAAE,aAAa;YAAE,OAAO,EAAE,aAAa;SAAE,CAAC;KACjE;IAED,OAAO;QACL,UAAU,EAAE,cAAc;QAC1B,MAAM,EAAE,UAAU;QAClB,OAAO,EAAE,WAAW;QACpB,MAAM,EAAE,UAAU;QAClB,MAAM,EAAE,UAAU;KACnB,CAAC;CACH,AAAC;AAEK,MAAM,yCAAI,GAAG,gCAAU,AAAC;;ADlvB/B","sources":["src/index.js","src/lib/diff.js"],"sourcesContent":["import { diff, diffStylesSetStyle } from \"./lib/diff\";\n\nexport { diff, diffStylesSetStyle };\n","const isEqual = (a, b) => JSON.stringify(a) === JSON.stringify(b);\n\nclass diffTracker {\n constructor() {\n this.glyphs = null;\n this.sprite = null;\n this.sources = [];\n this.layers = [];\n this.layerProps = {};\n }\n\n changeGlyphs(change) {\n this.glyphs = { change: change };\n }\n\n changeSprite(change) {\n this.sprite = { change: change };\n }\n\n changeSource(source, change) {\n this.sources.push({ source: source, change: change });\n }\n\n changeLayer(layer, change) {\n this.layers.push({ layer: layer, change: change });\n }\n\n changeLayerProp(layer, change) {\n if (!this.layerProps[layer]) this.layerProps[layer] = [change];\n else this.layerProps[layer].push(change);\n }\n}\nconst operations = {\n /*\n * { command: 'setStyle', args: [stylesheet] }\n */\n setStyle: 'setStyle',\n\n /*\n * { command: 'addLayer', args: [layer, 'beforeLayerId'] }\n */\n addLayer: 'addLayer',\n\n /*\n * { command: 'removeLayer', args: ['layerId'] }\n */\n removeLayer: 'removeLayer',\n\n moveLayer: 'moveLayer',\n\n /*\n * { command: 'setPaintProperty', args: ['layerId', 'prop', value] }\n */\n setPaintProperty: 'setPaintProperty',\n\n /*\n * { command: 'setLayoutProperty', args: ['layerId', 'prop', value] }\n */\n setLayoutProperty: 'setLayoutProperty',\n\n /*\n * { command: 'setFilter', args: ['layerId', filter] }\n */\n setFilter: 'setFilter',\n\n /*\n * { command: 'addSource', args: ['sourceId', source] }\n */\n addSource: 'addSource',\n\n /*\n * { command: 'removeSource', args: ['sourceId'] }\n */\n removeSource: 'removeSource',\n\n /*\n * { command: 'setGeoJSONSourceData', args: ['sourceId', data] }\n */\n setGeoJSONSourceData: 'setGeoJSONSourceData',\n\n /*\n * { command: 'setLayerZoomRange', args: ['layerId', 0, 22] }\n */\n setLayerZoomRange: 'setLayerZoomRange',\n\n /*\n * { command: 'setLayerProperty', args: ['layerId', 'prop', value] }\n */\n setLayerProperty: 'setLayerProperty',\n\n /*\n * { command: 'setCenter', args: [[lon, lat]] }\n */\n setCenter: 'setCenter',\n\n /*\n * { command: 'setZoom', args: [zoom] }\n */\n setZoom: 'setZoom',\n\n /*\n * { command: 'setBearing', args: [bearing] }\n */\n setBearing: 'setBearing',\n\n /*\n * { command: 'setPitch', args: [pitch] }\n */\n setPitch: 'setPitch',\n\n /*\n * { command: 'setSprite', args: ['spriteUrl'] }\n */\n setSprite: 'setSprite',\n\n /*\n * { command: 'setGlyphs', args: ['glyphsUrl'] }\n */\n setGlyphs: 'setGlyphs',\n\n /*\n * { command: 'setTransition', args: [transition] }\n */\n setTransition: 'setTransition',\n\n /*\n * { command: 'setLighting', args: [lightProperties] }\n */\n setLight: 'setLight',\n\n /*\n * { command: 'setTerrain', args: [terrainProperties] }\n */\n setTerrain: 'setTerrain',\n\n /*\n * { command: 'setFog', args: [fogProperties] }\n */\n setFog: 'setFog',\n\n /*\n * { command: 'setProjection', args: [projectionProperties] }\n */\n setProjection: 'setProjection'\n};\n\nfunction addSource(sourceId, after, commands) {\n commands.push({\n command: operations.addSource,\n args: [sourceId, after[sourceId]]\n });\n}\n\nfunction removeSource(sourceId, commands, sourcesRemoved) {\n commands.push({ command: operations.removeSource, args: [sourceId] });\n sourcesRemoved[sourceId] = true;\n}\n\nfunction updateSource(sourceId, after, commands, sourcesRemoved) {\n removeSource(sourceId, commands, sourcesRemoved);\n addSource(sourceId, after, commands);\n}\n\nfunction canUpdateGeoJSON(before, after, sourceId) {\n let prop;\n for (prop in before[sourceId]) {\n if (!before[sourceId].hasOwnProperty(prop)) continue;\n if (\n prop !== 'data' &&\n !isEqual(before[sourceId][prop], after[sourceId][prop])\n ) {\n return false;\n }\n }\n for (prop in after[sourceId]) {\n if (!after[sourceId].hasOwnProperty(prop)) continue;\n if (\n prop !== 'data' &&\n !isEqual(before[sourceId][prop], after[sourceId][prop])\n ) {\n return false;\n }\n }\n return true;\n}\n\nfunction diffSources(before, after, commands, sourcesRemoved, differ) {\n before = before || {};\n after = after || {};\n\n let sourceId;\n\n // look for sources to remove\n for (sourceId in before) {\n if (!before.hasOwnProperty(sourceId)) continue;\n if (!after.hasOwnProperty(sourceId)) {\n differ.changeSource(sourceId, { command: 'removeSource' });\n removeSource(sourceId, commands, sourcesRemoved);\n }\n }\n\n // look for sources to add/update\n for (sourceId in after) {\n if (!after.hasOwnProperty(sourceId)) continue;\n\n // add sources\n if (!before.hasOwnProperty(sourceId)) {\n differ.changeSource(sourceId, { command: 'addSource' });\n addSource(sourceId, after, commands);\n }\n // update sources\n else if (!isEqual(before[sourceId], after[sourceId])) {\n differ.changeSource(sourceId, { command: 'updateSource' });\n if (\n before[sourceId].type === 'geojson' &&\n after[sourceId].type === 'geojson' &&\n canUpdateGeoJSON(before, after, sourceId)\n ) {\n commands.push({\n command: operations.setGeoJSONSourceData,\n args: [sourceId, after[sourceId].data]\n });\n } else {\n // no update command, must remove then add\n updateSource(sourceId, after, commands, sourcesRemoved);\n // TODO Update differ?\n }\n }\n }\n}\n\nfunction diffLayerPropertyChanges(\n before,\n after,\n commands,\n layerId,\n klass,\n command,\n differ\n) {\n before = before || {};\n after = after || {};\n\n let prop;\n\n for (prop in before) {\n if (!before.hasOwnProperty(prop)) continue;\n if (!isEqual(before[prop], after[prop])) {\n const cmd = {\n command,\n args: [prop, after[prop], before[prop], klass],\n layer: layerId\n };\n commands.push(cmd);\n differ.changeLayerProp(layerId, cmd);\n }\n }\n for (prop in after) {\n if (!after.hasOwnProperty(prop) || before.hasOwnProperty(prop)) continue;\n if (!isEqual(before[prop], after[prop])) {\n const cmd = {\n command,\n args: [prop, after[prop], before[prop], klass],\n layer: layerId\n };\n commands.push(cmd);\n differ.changeLayerProp(layerId, cmd);\n }\n }\n}\n\nfunction pluckId(layer) {\n return layer.id;\n}\nfunction indexById(group, layer) {\n group[layer.id] = layer;\n return group;\n}\n\nfunction diffLayers(before, after, commands, differ) {\n before = before || [];\n after = after || [];\n\n // order of layers by id\n const beforeOrder = before.map(pluckId);\n const afterOrder = after.map(pluckId);\n\n // index of layer by id\n const beforeIndex = before.reduce(indexById, {});\n const afterIndex = after.reduce(indexById, {});\n\n // track order of layers as if they have been mutated\n const tracker = beforeOrder.slice();\n\n // layers that have been added do not need to be diffed\n const clean = Object.create(null);\n\n let i, d, layerId, beforeLayer, afterLayer, insertBeforeLayerId, prop;\n\n // remove layers\n for (i = 0, d = 0; i < beforeOrder.length; i++) {\n layerId = beforeOrder[i];\n // detect removed layer\n if (!afterIndex.hasOwnProperty(layerId)) {\n commands.push({ command: operations.removeLayer, args: [layerId] });\n differ.changeLayer(layerId, { command: 'removeLayer' });\n tracker.splice(tracker.indexOf(layerId, d), 1);\n } else {\n // limit where in tracker we need to look for a match\n d++;\n }\n }\n\n // add/reorder layers\n for (i = 0, d = 0; i < afterOrder.length; i++) {\n // work backwards as insert is before an existing layer\n layerId = afterOrder[afterOrder.length - 1 - i];\n\n if (tracker[tracker.length - 1 - i] === layerId) continue;\n var movingLayer = false;\n if (beforeIndex.hasOwnProperty(layerId)) {\n movingLayer = true;\n // remove the layer before we insert at the correct position\n commands.push({ command: operations.removeLayer, args: [layerId] });\n tracker.splice(tracker.lastIndexOf(layerId, tracker.length - d), 1);\n } else {\n // limit where in tracker we need to look for a match\n d++;\n }\n\n // add layer at correct position\n insertBeforeLayerId = tracker[tracker.length - i];\n commands.push({\n command: operations.addLayer,\n args: [afterIndex[layerId], insertBeforeLayerId]\n });\n tracker.splice(tracker.length - i, 0, layerId);\n\n if (movingLayer)\n differ.changeLayer(layerId, {\n command: 'moveLayer',\n args: [insertBeforeLayerId]\n });\n else {\n clean[layerId] = true;\n differ.changeLayer(layerId, {\n command: 'addLayer',\n args: [afterIndex[layerId], insertBeforeLayerId]\n });\n }\n }\n\n // update layers\n for (i = 0; i < afterOrder.length; i++) {\n layerId = afterOrder[i];\n beforeLayer = beforeIndex[layerId];\n afterLayer = afterIndex[layerId];\n\n // no need to update if previously added (new or moved)\n if (clean[layerId] || isEqual(beforeLayer, afterLayer)) continue;\n\n // layout, paint, filter, minzoom, maxzoom\n diffLayerPropertyChanges(\n beforeLayer.layout,\n afterLayer.layout,\n commands,\n layerId,\n null,\n operations.setLayoutProperty,\n differ\n );\n diffLayerPropertyChanges(\n beforeLayer.paint,\n afterLayer.paint,\n commands,\n layerId,\n null,\n operations.setPaintProperty,\n differ\n );\n if (!isEqual(beforeLayer.filter, afterLayer.filter)) {\n const cmd = {\n command: operations.setFilter,\n args: ['filter', JSON.stringify(afterLayer.filter), beforeLayer.filter],\n layer: layerId\n };\n commands.push(cmd);\n differ.changeLayerProp(layerId, cmd);\n }\n\n if (!isEqual(beforeLayer.minzoom, afterLayer.minzoom)) {\n const cmd = {\n command: operations.setLayerZoomRange,\n args: ['minzoom', afterLayer.minzoom, beforeLayer.minzoom],\n layer: layerId\n };\n commands.push(cmd);\n differ.changeLayerProp(layerId, cmd);\n }\n if (!isEqual(beforeLayer.maxzoom, afterLayer.maxzoom)) {\n const cmd = {\n command: operations.setLayerZoomRange,\n args: ['maxzoom', afterLayer.maxzoom, beforeLayer.maxzoom],\n layer: layerId\n };\n commands.push(cmd);\n differ.changeLayerProp(layerId, cmd);\n }\n\n // handle all other layer props, including paint.*\n for (prop in beforeLayer) {\n if (!beforeLayer.hasOwnProperty(prop)) continue;\n if (\n prop === 'layout' ||\n prop === 'paint' ||\n prop === 'filter' ||\n prop === 'metadata' ||\n prop === 'minzoom' ||\n prop === 'maxzoom'\n )\n continue;\n if (prop.indexOf('paint.') === 0) {\n diffLayerPropertyChanges(\n beforeLayer[prop],\n afterLayer[prop],\n commands,\n layerId,\n prop.slice(6),\n operations.setPaintProperty,\n differ\n );\n } else if (!isEqual(beforeLayer[prop], afterLayer[prop])) {\n const cmd = {\n command: operations.setLayerProperty,\n args: [prop, afterLayer[prop], beforeLayer[prop]],\n layer: layerId\n };\n commands.push(cmd);\n differ.changeLayerProp(layerId, cmd);\n }\n }\n for (prop in afterLayer) {\n if (!afterLayer.hasOwnProperty(prop) || beforeLayer.hasOwnProperty(prop))\n continue;\n if (\n prop === 'layout' ||\n prop === 'paint' ||\n prop === 'filter' ||\n prop === 'metadata' ||\n prop === 'minzoom' ||\n prop === 'maxzoom'\n )\n continue;\n if (prop.indexOf('paint.') === 0) {\n diffLayerPropertyChanges(\n beforeLayer[prop],\n afterLayer[prop],\n commands,\n layerId,\n prop.slice(6),\n operations.setPaintProperty\n );\n } else if (!isEqual(beforeLayer[prop], afterLayer[prop])) {\n const cmd = {\n command: operations.setLayerProperty,\n args: [prop, afterLayer[prop], beforeLayer[prop]],\n layer: layerId\n };\n commands.push(cmd);\n differ.changeLayerProp(layerId, cmd);\n }\n }\n }\n}\n\n/**\n * Diff two stylesheet\n *\n * Creates semanticly aware diffs that can easily be applied at runtime.\n * Operations produced by the diff closely resemble the mapbox-gl-js API. Any\n * error creating the diff will fall back to the 'setStyle' operation.\n *\n * Example diff:\n * [\n * { command: 'setConstant', args: ['@water', '#0000FF'] },\n * { command: 'setPaintProperty', args: ['background', 'background-color', 'black'] }\n * ]\n *\n * @private\n * @param {*} [before] stylesheet to compare from\n * @param {*} after stylesheet to compare to\n * @returns Array list of changes\n */\nexport function diffStylesSetStyle(before, after) {\n if (!before) return [{ command: operations.setStyle, args: [after] }];\n const differ = new diffTracker();\n\n let commands = [];\n\n try {\n // Handle changes to top-level properties\n if (!isEqual(before.version, after.version)) {\n return [{ command: operations.setStyle, args: [after] }];\n }\n if (!isEqual(before.center, after.center)) {\n commands.push({ command: operations.setCenter, args: [after.center] });\n }\n if (!isEqual(before.zoom, after.zoom)) {\n commands.push({ command: operations.setZoom, args: [after.zoom] });\n }\n if (!isEqual(before.bearing, after.bearing)) {\n commands.push({ command: operations.setBearing, args: [after.bearing] });\n }\n if (!isEqual(before.pitch, after.pitch)) {\n commands.push({ command: operations.setPitch, args: [after.pitch] });\n }\n if (!isEqual(before.sprite, after.sprite)) {\n commands.push({ command: operations.setSprite, args: [after.sprite] });\n differ.changeSprite({\n command: 'setSprite',\n args: [after.sprite, before.sprite]\n });\n }\n if (!isEqual(before.glyphs, after.glyphs)) {\n commands.push({ command: operations.setGlyphs, args: [after.glyphs] });\n differ.changeGlyphs({\n command: 'setGlyphs',\n args: [after.glyphs, before.glyphs]\n });\n }\n if (!isEqual(before.transition, after.transition)) {\n commands.push({\n command: operations.setTransition,\n args: [after.transition]\n });\n }\n if (!isEqual(before.light, after.light)) {\n commands.push({ command: operations.setLight, args: [after.light] });\n }\n if (!isEqual(before.fog, after.fog)) {\n commands.push({ command: operations.setFog, args: [after.fog] });\n }\n if (!isEqual(before.projection, after.projection)) {\n commands.push({\n command: operations.setProjection,\n args: [after.projection]\n });\n }\n\n // Handle changes to `sources`\n // If a source is to be removed, we also--before the removeSource\n // command--need to remove all the style layers that depend on it.\n const sourcesRemoved = {};\n\n // First collect the {add,remove}Source commands\n const removeOrAddSourceCommands = [];\n diffSources(\n before.sources,\n after.sources,\n removeOrAddSourceCommands,\n sourcesRemoved,\n differ\n );\n\n commands = commands.concat(removeOrAddSourceCommands);\n\n // Handle changes to `layers`\n diffLayers(before.layers, after.layers, commands, differ);\n } catch (e) {\n // fall back to setStyle\n console.warn('Unable to compute style diff:', e);\n commands = [{ command: operations.setStyle, args: [after] }];\n }\n\n commands = detectMovedLayers(commands);\n\n return differ;\n}\n\nfunction detectMovedLayers(commands) {\n var output = [];\n var blacklistAdds = [];\n\n function findReaddedLayer(removalCommand) {\n const targetId = removalCommand.args[0];\n const match = commands.find(l => l.args?.[0]?.id === targetId);\n if (match) {\n blacklistAdds.push(targetId);\n }\n return match;\n }\n\n commands.forEach(c => {\n if (c.command === 'removeLayer') {\n const readded = findReaddedLayer(c);\n if (readded) {\n output.push({ command: 'moveLayer', args: readded.args });\n } else output.push(c);\n } else if (c.command !== 'addLayer' || !blacklistAdds.includes(c.args[0]))\n output.push(c);\n });\n\n return output;\n}\n\n// Added this function to change the output format to be more helpful\nconst diffStyles = (before, after) => {\n const originalDiff = diffStylesSetStyle(before, after);\n\n const { layerProps, layers, sources, glyphs, sprite } = originalDiff;\n\n // formatting for source additions and removals\n const nextSources = sources.reduce((acc, s) => {\n const { change, source } = s;\n\n let type = change.command;\n\n switch (type) {\n case 'removeSource': {\n type = 'remove';\n break;\n }\n case 'addSource': {\n type = 'add';\n break;\n }\n }\n\n acc[source] = type;\n\n return acc;\n }, {});\n\n // formatting for layer additions, reorders, and removals\n const nextLayers = layers.reduce((acc, l) => {\n const { change, layer } = l;\n\n let type = change.command;\n\n switch (type) {\n case 'removeLayer': {\n type = 'remove';\n break;\n }\n case 'addLayer': {\n type = 'add';\n break;\n }\n case 'moveLayer': {\n type = 'move';\n break;\n }\n }\n\n acc[layer] = {\n type,\n ...(type === 'add' && {\n layer: change?.args[0],\n layerAbove: change?.args[1]\n }),\n ...(type === 'move' && { layerAbove: change?.args[0] })\n };\n\n return acc;\n }, {});\n\n // formatting for layer property changes\n const nextLayerProps = Object.keys(layerProps).reduce((acc, layerId) => {\n const nextLayerChanges = layerProps[layerId].reduce((accum, change) => {\n const { command, args } = change;\n\n let type = command;\n\n switch (command) {\n case 'setFilter': {\n type = 'filter';\n break;\n }\n // source & source-layer\n case 'setLayerProperty': {\n type = 'root';\n break;\n }\n case 'setPaintProperty': {\n type = 'paint';\n break;\n }\n // min and max zoom\n case 'setLayerZoomRange': {\n type = 'minMaxZoom';\n break;\n }\n case 'setLayoutProperty': {\n type = 'layout';\n break;\n }\n }\n\n const [propertyId, currentValue, compareValue] = args;\n\n // These are reversed out of the set style version of the diffing tool\n const current = compareValue;\n const compare = currentValue;\n\n if (type === 'root' || type === 'minMaxZoom') {\n accum[propertyId] = {\n current,\n compare\n };\n } else if (type === 'filter') {\n accum[propertyId] = {\n current,\n // Not sure why this is stringified\n compare: typeof compare === 'string' ? JSON.parse(compare) : compare\n };\n } else {\n if (!accum[type]) {\n accum[type] = {};\n }\n accum[type][propertyId] = {\n current,\n compare\n };\n }\n\n return accum;\n }, {});\n\n acc[layerId] = nextLayerChanges;\n\n return acc;\n }, {});\n\n let nextGlyphs;\n if (glyphs?.change?.args) {\n const [compareGlyph, currentGlyph] = glyphs?.change?.args;\n nextGlyphs = { current: currentGlyph, compare: compareGlyph };\n }\n\n let nextSprite;\n if (sprite?.change?.args) {\n const [compareSprite, currentSprite] = sprite?.change?.args;\n nextSprite = { current: currentSprite, compare: compareSprite };\n }\n\n return {\n layerProps: nextLayerProps,\n layers: nextLayers,\n sources: nextSources,\n glyphs: nextGlyphs,\n sprite: nextSprite\n };\n};\n\nexport const diff = diffStyles;\n"],"names":[],"version":3,"file":"main.js.map","sourceRoot":"../"} \ No newline at end of file diff --git a/dist/module.js b/dist/module.js index 73a6300..d718887 100644 --- a/dist/module.js +++ b/dist/module.js @@ -1,10 +1,22 @@ const $2658df1f3ad7813b$var$isEqual = (a, b)=>JSON.stringify(a) === JSON.stringify(b); class $2658df1f3ad7813b$var$diffTracker { constructor(){ + this.glyphs = null; + this.sprite = null; this.sources = []; this.layers = []; this.layerProps = {}; } + changeGlyphs(change) { + this.glyphs = { + change: change + }; + } + changeSprite(change) { + this.sprite = { + change: change + }; + } changeSource(source, change) { this.sources.push({ source: source, @@ -422,18 +434,36 @@ function $2658df1f3ad7813b$export$c11d25f35bd6cdfa(before, after) { after.pitch ] }); - if (!$2658df1f3ad7813b$var$isEqual(before.sprite, after.sprite)) commands.push({ - command: $2658df1f3ad7813b$var$operations.setSprite, - args: [ - after.sprite - ] - }); - if (!$2658df1f3ad7813b$var$isEqual(before.glyphs, after.glyphs)) commands.push({ - command: $2658df1f3ad7813b$var$operations.setGlyphs, - args: [ - after.glyphs - ] - }); + if (!$2658df1f3ad7813b$var$isEqual(before.sprite, after.sprite)) { + commands.push({ + command: $2658df1f3ad7813b$var$operations.setSprite, + args: [ + after.sprite + ] + }); + differ.changeSprite({ + command: "setSprite", + args: [ + after.sprite, + before.sprite + ] + }); + } + if (!$2658df1f3ad7813b$var$isEqual(before.glyphs, after.glyphs)) { + commands.push({ + command: $2658df1f3ad7813b$var$operations.setGlyphs, + args: [ + after.glyphs + ] + }); + differ.changeGlyphs({ + command: "setGlyphs", + args: [ + after.glyphs, + before.glyphs + ] + }); + } if (!$2658df1f3ad7813b$var$isEqual(before.transition, after.transition)) commands.push({ command: $2658df1f3ad7813b$var$operations.setTransition, args: [ @@ -507,7 +537,7 @@ function $2658df1f3ad7813b$var$detectMovedLayers(commands) { // Added this function to change the output format to be more helpful const $2658df1f3ad7813b$var$diffStyles = (before, after)=>{ const originalDiff = $2658df1f3ad7813b$export$c11d25f35bd6cdfa(before, after); - const { layerProps: layerProps , layers: layers , sources: sources } = originalDiff; + const { layerProps: layerProps , layers: layers , sources: sources , glyphs: glyphs , sprite: sprite } = originalDiff; // formatting for source additions and removals const nextSources = sources.reduce((acc, s)=>{ const { change: change , source: source } = s; @@ -599,10 +629,28 @@ const $2658df1f3ad7813b$var$diffStyles = (before, after)=>{ acc[layerId] = nextLayerChanges; return acc; }, {}); + let nextGlyphs; + if (glyphs?.change?.args) { + const [compareGlyph, currentGlyph] = glyphs?.change?.args; + nextGlyphs = { + current: currentGlyph, + compare: compareGlyph + }; + } + let nextSprite; + if (sprite?.change?.args) { + const [compareSprite, currentSprite] = sprite?.change?.args; + nextSprite = { + current: currentSprite, + compare: compareSprite + }; + } return { layerProps: nextLayerProps, layers: nextLayers, - sources: nextSources + sources: nextSources, + glyphs: nextGlyphs, + sprite: nextSprite }; }; const $2658df1f3ad7813b$export$a37e3c603d7117e5 = $2658df1f3ad7813b$var$diffStyles; diff --git a/dist/module.js.map b/dist/module.js.map index d815e93..c788b40 100644 --- a/dist/module.js.map +++ b/dist/module.js.map @@ -1 +1 @@ -{"mappings":"ACAA,MAAM,6BAAO,GAAG,CAAC,CAAC,EAAE,CAAC,GAAK,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,AAAC;AAElE,MAAM,iCAAW;IACf,aAAc;QACZ,IAAI,CAAC,OAAO,GAAG,EAAE,CAAC;QAClB,IAAI,CAAC,MAAM,GAAG,EAAE,CAAC;QACjB,IAAI,CAAC,UAAU,GAAG,EAAE,CAAC;KACtB;IAED,YAAY,CAAC,MAAM,EAAE,MAAM,EAAE;QAC3B,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC;YAAE,MAAM,EAAE,MAAM;YAAE,MAAM,EAAE,MAAM;SAAE,CAAC,CAAC;KACvD;IAED,WAAW,CAAC,KAAK,EAAE,MAAM,EAAE;QACzB,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC;YAAE,KAAK,EAAE,KAAK;YAAE,MAAM,EAAE,MAAM;SAAE,CAAC,CAAC;KACpD;IAED,eAAe,CAAC,KAAK,EAAE,MAAM,EAAE;QAC7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AAE,UAAU;QAClB,OAAO,EAAE,WAAW;KACrB,CAAC;CACH,AAAC;AAEK,MAAM,yCAAI,GAAG,gCAAU,AAAC;;ADhtB/B","sources":["src/index.js","src/lib/diff.js"],"sourcesContent":["import { diff, diffStylesSetStyle } from \"./lib/diff\";\n\nexport { diff, diffStylesSetStyle };\n","const isEqual = (a, b) => JSON.stringify(a) === JSON.stringify(b);\n\nclass diffTracker {\n constructor() {\n this.sources = [];\n this.layers = [];\n this.layerProps = {};\n }\n\n changeSource(source, change) {\n this.sources.push({ source: source, change: change });\n }\n\n changeLayer(layer, change) {\n this.layers.push({ layer: layer, change: change });\n }\n\n changeLayerProp(layer, change) {\n if (!this.layerProps[layer]) this.layerProps[layer] = [change];\n else this.layerProps[layer].push(change);\n }\n}\nconst operations = {\n /*\n * { command: 'setStyle', args: [stylesheet] }\n */\n setStyle: 'setStyle',\n\n /*\n * { command: 'addLayer', args: [layer, 'beforeLayerId'] }\n */\n addLayer: 'addLayer',\n\n /*\n * { command: 'removeLayer', args: ['layerId'] }\n */\n removeLayer: 'removeLayer',\n\n moveLayer: 'moveLayer',\n\n /*\n * { command: 'setPaintProperty', args: ['layerId', 'prop', value] }\n */\n setPaintProperty: 'setPaintProperty',\n\n /*\n * { command: 'setLayoutProperty', args: ['layerId', 'prop', value] }\n */\n setLayoutProperty: 'setLayoutProperty',\n\n /*\n * { command: 'setFilter', args: ['layerId', filter] }\n */\n setFilter: 'setFilter',\n\n /*\n * { command: 'addSource', args: ['sourceId', source] }\n */\n addSource: 'addSource',\n\n /*\n * { command: 'removeSource', args: ['sourceId'] }\n */\n removeSource: 'removeSource',\n\n /*\n * { command: 'setGeoJSONSourceData', args: ['sourceId', data] }\n */\n setGeoJSONSourceData: 'setGeoJSONSourceData',\n\n /*\n * { command: 'setLayerZoomRange', args: ['layerId', 0, 22] }\n */\n setLayerZoomRange: 'setLayerZoomRange',\n\n /*\n * { command: 'setLayerProperty', args: ['layerId', 'prop', value] }\n */\n setLayerProperty: 'setLayerProperty',\n\n /*\n * { command: 'setCenter', args: [[lon, lat]] }\n */\n setCenter: 'setCenter',\n\n /*\n * { command: 'setZoom', args: [zoom] }\n */\n setZoom: 'setZoom',\n\n /*\n * { command: 'setBearing', args: [bearing] }\n */\n setBearing: 'setBearing',\n\n /*\n * { command: 'setPitch', args: [pitch] }\n */\n setPitch: 'setPitch',\n\n /*\n * { command: 'setSprite', args: ['spriteUrl'] }\n */\n setSprite: 'setSprite',\n\n /*\n * { command: 'setGlyphs', args: ['glyphsUrl'] }\n */\n setGlyphs: 'setGlyphs',\n\n /*\n * { command: 'setTransition', args: [transition] }\n */\n setTransition: 'setTransition',\n\n /*\n * { command: 'setLighting', args: [lightProperties] }\n */\n setLight: 'setLight',\n\n /*\n * { command: 'setTerrain', args: [terrainProperties] }\n */\n setTerrain: 'setTerrain',\n\n /*\n * { command: 'setFog', args: [fogProperties] }\n */\n setFog: 'setFog',\n\n /*\n * { command: 'setProjection', args: [projectionProperties] }\n */\n setProjection: 'setProjection'\n};\n\nfunction addSource(sourceId, after, commands) {\n commands.push({\n command: operations.addSource,\n args: [sourceId, after[sourceId]]\n });\n}\n\nfunction removeSource(sourceId, commands, sourcesRemoved) {\n commands.push({ command: operations.removeSource, args: [sourceId] });\n sourcesRemoved[sourceId] = true;\n}\n\nfunction updateSource(sourceId, after, commands, sourcesRemoved) {\n removeSource(sourceId, commands, sourcesRemoved);\n addSource(sourceId, after, commands);\n}\n\nfunction canUpdateGeoJSON(before, after, sourceId) {\n let prop;\n for (prop in before[sourceId]) {\n if (!before[sourceId].hasOwnProperty(prop)) continue;\n if (\n prop !== 'data' &&\n !isEqual(before[sourceId][prop], after[sourceId][prop])\n ) {\n return false;\n }\n }\n for (prop in after[sourceId]) {\n if (!after[sourceId].hasOwnProperty(prop)) continue;\n if (\n prop !== 'data' &&\n !isEqual(before[sourceId][prop], after[sourceId][prop])\n ) {\n return false;\n }\n }\n return true;\n}\n\nfunction diffSources(before, after, commands, sourcesRemoved, differ) {\n before = before || {};\n after = after || {};\n\n let sourceId;\n\n // look for sources to remove\n for (sourceId in before) {\n if (!before.hasOwnProperty(sourceId)) continue;\n if (!after.hasOwnProperty(sourceId)) {\n differ.changeSource(sourceId, { command: 'removeSource' });\n removeSource(sourceId, commands, sourcesRemoved);\n }\n }\n\n // look for sources to add/update\n for (sourceId in after) {\n if (!after.hasOwnProperty(sourceId)) continue;\n\n // add sources\n if (!before.hasOwnProperty(sourceId)) {\n differ.changeSource(sourceId, { command: 'addSource' });\n addSource(sourceId, after, commands);\n }\n // update sources\n else if (!isEqual(before[sourceId], after[sourceId])) {\n differ.changeSource(sourceId, { command: 'updateSource' });\n if (\n before[sourceId].type === 'geojson' &&\n after[sourceId].type === 'geojson' &&\n canUpdateGeoJSON(before, after, sourceId)\n ) {\n commands.push({\n command: operations.setGeoJSONSourceData,\n args: [sourceId, after[sourceId].data]\n });\n } else {\n // no update command, must remove then add\n updateSource(sourceId, after, commands, sourcesRemoved);\n }\n }\n }\n}\n\nfunction diffLayerPropertyChanges(\n before,\n after,\n commands,\n layerId,\n klass,\n command,\n differ\n) {\n before = before || {};\n after = after || {};\n\n let prop;\n\n for (prop in before) {\n if (!before.hasOwnProperty(prop)) continue;\n if (!isEqual(before[prop], after[prop])) {\n const cmd = {\n command,\n args: [prop, after[prop], before[prop], klass],\n layer: layerId\n };\n commands.push(cmd);\n differ.changeLayerProp(layerId, cmd);\n }\n }\n for (prop in after) {\n if (!after.hasOwnProperty(prop) || before.hasOwnProperty(prop)) continue;\n if (!isEqual(before[prop], after[prop])) {\n const cmd = {\n command,\n args: [prop, after[prop], before[prop], klass],\n layer: layerId\n };\n commands.push(cmd);\n differ.changeLayerProp(layerId, cmd);\n }\n }\n}\n\nfunction pluckId(layer) {\n return layer.id;\n}\nfunction indexById(group, layer) {\n group[layer.id] = layer;\n return group;\n}\n\nfunction diffLayers(before, after, commands, differ) {\n before = before || [];\n after = after || [];\n\n // order of layers by id\n const beforeOrder = before.map(pluckId);\n const afterOrder = after.map(pluckId);\n\n // index of layer by id\n const beforeIndex = before.reduce(indexById, {});\n const afterIndex = after.reduce(indexById, {});\n\n // track order of layers as if they have been mutated\n const tracker = beforeOrder.slice();\n\n // layers that have been added do not need to be diffed\n const clean = Object.create(null);\n\n let i, d, layerId, beforeLayer, afterLayer, insertBeforeLayerId, prop;\n\n // remove layers\n for (i = 0, d = 0; i < beforeOrder.length; i++) {\n layerId = beforeOrder[i];\n // detect removed layer\n if (!afterIndex.hasOwnProperty(layerId)) {\n commands.push({ command: operations.removeLayer, args: [layerId] });\n differ.changeLayer(layerId, { command: 'removeLayer' });\n tracker.splice(tracker.indexOf(layerId, d), 1);\n } else {\n // limit where in tracker we need to look for a match\n d++;\n }\n }\n\n // add/reorder layers\n for (i = 0, d = 0; i < afterOrder.length; i++) {\n // work backwards as insert is before an existing layer\n layerId = afterOrder[afterOrder.length - 1 - i];\n\n if (tracker[tracker.length - 1 - i] === layerId) continue;\n var movingLayer = false;\n if (beforeIndex.hasOwnProperty(layerId)) {\n movingLayer = true;\n // remove the layer before we insert at the correct position\n commands.push({ command: operations.removeLayer, args: [layerId] });\n tracker.splice(tracker.lastIndexOf(layerId, tracker.length - d), 1);\n } else {\n // limit where in tracker we need to look for a match\n d++;\n }\n\n // add layer at correct position\n insertBeforeLayerId = tracker[tracker.length - i];\n commands.push({\n command: operations.addLayer,\n args: [afterIndex[layerId], insertBeforeLayerId]\n });\n tracker.splice(tracker.length - i, 0, layerId);\n\n if (movingLayer)\n differ.changeLayer(layerId, {\n command: 'moveLayer',\n args: [insertBeforeLayerId]\n });\n else {\n clean[layerId] = true;\n differ.changeLayer(layerId, {\n command: 'addLayer',\n args: [afterIndex[layerId], insertBeforeLayerId]\n });\n }\n }\n\n // update layers\n for (i = 0; i < afterOrder.length; i++) {\n layerId = afterOrder[i];\n beforeLayer = beforeIndex[layerId];\n afterLayer = afterIndex[layerId];\n\n // no need to update if previously added (new or moved)\n if (clean[layerId] || isEqual(beforeLayer, afterLayer)) continue;\n\n // layout, paint, filter, minzoom, maxzoom\n diffLayerPropertyChanges(\n beforeLayer.layout,\n afterLayer.layout,\n commands,\n layerId,\n null,\n operations.setLayoutProperty,\n differ\n );\n diffLayerPropertyChanges(\n beforeLayer.paint,\n afterLayer.paint,\n commands,\n layerId,\n null,\n operations.setPaintProperty,\n differ\n );\n if (!isEqual(beforeLayer.filter, afterLayer.filter)) {\n const cmd = {\n command: operations.setFilter,\n args: ['filter', JSON.stringify(afterLayer.filter), beforeLayer.filter],\n layer: layerId\n };\n commands.push(cmd);\n differ.changeLayerProp(layerId, cmd);\n }\n\n if (!isEqual(beforeLayer.minzoom, afterLayer.minzoom)) {\n const cmd = {\n command: operations.setLayerZoomRange,\n args: ['minzoom', afterLayer.minzoom, beforeLayer.minzoom],\n layer: layerId\n };\n commands.push(cmd);\n differ.changeLayerProp(layerId, cmd);\n }\n if (!isEqual(beforeLayer.maxzoom, afterLayer.maxzoom)) {\n const cmd = {\n command: operations.setLayerZoomRange,\n args: ['maxzoom', afterLayer.maxzoom, beforeLayer.maxzoom],\n layer: layerId\n };\n commands.push(cmd);\n differ.changeLayerProp(layerId, cmd);\n }\n\n // handle all other layer props, including paint.*\n for (prop in beforeLayer) {\n if (!beforeLayer.hasOwnProperty(prop)) continue;\n if (\n prop === 'layout' ||\n prop === 'paint' ||\n prop === 'filter' ||\n prop === 'metadata' ||\n prop === 'minzoom' ||\n prop === 'maxzoom'\n )\n continue;\n if (prop.indexOf('paint.') === 0) {\n diffLayerPropertyChanges(\n beforeLayer[prop],\n afterLayer[prop],\n commands,\n layerId,\n prop.slice(6),\n operations.setPaintProperty,\n differ\n );\n } else if (!isEqual(beforeLayer[prop], afterLayer[prop])) {\n const cmd = {\n command: operations.setLayerProperty,\n args: [prop, afterLayer[prop], beforeLayer[prop]],\n layer: layerId\n };\n commands.push(cmd);\n differ.changeLayerProp(layerId, cmd);\n }\n }\n for (prop in afterLayer) {\n if (!afterLayer.hasOwnProperty(prop) || beforeLayer.hasOwnProperty(prop))\n continue;\n if (\n prop === 'layout' ||\n prop === 'paint' ||\n prop === 'filter' ||\n prop === 'metadata' ||\n prop === 'minzoom' ||\n prop === 'maxzoom'\n )\n continue;\n if (prop.indexOf('paint.') === 0) {\n diffLayerPropertyChanges(\n beforeLayer[prop],\n afterLayer[prop],\n commands,\n layerId,\n prop.slice(6),\n operations.setPaintProperty\n );\n } else if (!isEqual(beforeLayer[prop], afterLayer[prop])) {\n const cmd = {\n command: operations.setLayerProperty,\n args: [prop, afterLayer[prop], beforeLayer[prop]],\n layer: layerId\n };\n commands.push(cmd);\n differ.changeLayerProp(layerId, cmd);\n }\n }\n }\n}\n\n/**\n * Diff two stylesheet\n *\n * Creates semanticly aware diffs that can easily be applied at runtime.\n * Operations produced by the diff closely resemble the mapbox-gl-js API. Any\n * error creating the diff will fall back to the 'setStyle' operation.\n *\n * Example diff:\n * [\n * { command: 'setConstant', args: ['@water', '#0000FF'] },\n * { command: 'setPaintProperty', args: ['background', 'background-color', 'black'] }\n * ]\n *\n * @private\n * @param {*} [before] stylesheet to compare from\n * @param {*} after stylesheet to compare to\n * @returns Array list of changes\n */\nexport function diffStylesSetStyle(before, after) {\n if (!before) return [{ command: operations.setStyle, args: [after] }];\n const differ = new diffTracker();\n\n let commands = [];\n\n try {\n // Handle changes to top-level properties\n if (!isEqual(before.version, after.version)) {\n return [{ command: operations.setStyle, args: [after] }];\n }\n if (!isEqual(before.center, after.center)) {\n commands.push({ command: operations.setCenter, args: [after.center] });\n }\n if (!isEqual(before.zoom, after.zoom)) {\n commands.push({ command: operations.setZoom, args: [after.zoom] });\n }\n if (!isEqual(before.bearing, after.bearing)) {\n commands.push({ command: operations.setBearing, args: [after.bearing] });\n }\n if (!isEqual(before.pitch, after.pitch)) {\n commands.push({ command: operations.setPitch, args: [after.pitch] });\n }\n if (!isEqual(before.sprite, after.sprite)) {\n commands.push({ command: operations.setSprite, args: [after.sprite] });\n }\n if (!isEqual(before.glyphs, after.glyphs)) {\n commands.push({ command: operations.setGlyphs, args: [after.glyphs] });\n }\n if (!isEqual(before.transition, after.transition)) {\n commands.push({\n command: operations.setTransition,\n args: [after.transition]\n });\n }\n if (!isEqual(before.light, after.light)) {\n commands.push({ command: operations.setLight, args: [after.light] });\n }\n if (!isEqual(before.fog, after.fog)) {\n commands.push({ command: operations.setFog, args: [after.fog] });\n }\n if (!isEqual(before.projection, after.projection)) {\n commands.push({\n command: operations.setProjection,\n args: [after.projection]\n });\n }\n\n // Handle changes to `sources`\n // If a source is to be removed, we also--before the removeSource\n // command--need to remove all the style layers that depend on it.\n const sourcesRemoved = {};\n\n // First collect the {add,remove}Source commands\n const removeOrAddSourceCommands = [];\n diffSources(\n before.sources,\n after.sources,\n removeOrAddSourceCommands,\n sourcesRemoved,\n differ\n );\n\n commands = commands.concat(removeOrAddSourceCommands);\n\n // Handle changes to `layers`\n diffLayers(before.layers, after.layers, commands, differ);\n } catch (e) {\n // fall back to setStyle\n console.warn('Unable to compute style diff:', e);\n commands = [{ command: operations.setStyle, args: [after] }];\n }\n\n commands = detectMovedLayers(commands);\n return differ;\n}\n\nfunction detectMovedLayers(commands) {\n var output = [];\n var blacklistAdds = [];\n\n function findReaddedLayer(removalCommand) {\n const targetId = removalCommand.args[0];\n const match = commands.find(l => l.args?.[0]?.id === targetId);\n if (match) {\n blacklistAdds.push(targetId);\n }\n return match;\n }\n\n commands.forEach(c => {\n if (c.command === 'removeLayer') {\n const readded = findReaddedLayer(c);\n if (readded) {\n output.push({ command: 'moveLayer', args: readded.args });\n } else output.push(c);\n } else if (c.command !== 'addLayer' || !blacklistAdds.includes(c.args[0]))\n output.push(c);\n });\n\n return output;\n}\n\n// Added this function to change the output format to be more helpful\nconst diffStyles = (before, after) => {\n const originalDiff = diffStylesSetStyle(before, after);\n\n const { layerProps, layers, sources } = originalDiff;\n\n // formatting for source additions and removals\n const nextSources = sources.reduce((acc, s) => {\n const { change, source } = s;\n\n let type = change.command;\n\n switch (type) {\n case 'removeSource': {\n type = 'remove';\n break;\n }\n case 'addSource': {\n type = 'add';\n break;\n }\n }\n\n acc[source] = type;\n\n return acc;\n }, {});\n\n // formatting for layer additions, reorders, and removals\n const nextLayers = layers.reduce((acc, l) => {\n const { change, layer } = l;\n\n let type = change.command;\n\n switch (type) {\n case 'removeLayer': {\n type = 'remove';\n break;\n }\n case 'addLayer': {\n type = 'add';\n break;\n }\n case 'moveLayer': {\n type = 'move';\n break;\n }\n }\n\n acc[layer] = {\n type,\n ...(type === 'add' && {\n layer: change?.args[0],\n layerAbove: change?.args[1]\n }),\n ...(type === 'move' && { layerAbove: change?.args[0] })\n };\n\n return acc;\n }, {});\n\n // formatting for layer property changes\n const nextLayerProps = Object.keys(layerProps).reduce((acc, layerId) => {\n const nextLayerChanges = layerProps[layerId].reduce((accum, change) => {\n const { command, args } = change;\n\n let type = command;\n\n switch (command) {\n case 'setFilter': {\n type = 'filter';\n break;\n }\n // source & source-layer\n case 'setLayerProperty': {\n type = 'root';\n break;\n }\n case 'setPaintProperty': {\n type = 'paint';\n break;\n }\n // min and max zoom\n case 'setLayerZoomRange': {\n type = 'minMaxZoom';\n break;\n }\n case 'setLayoutProperty': {\n type = 'layout';\n break;\n }\n }\n\n const [propertyId, currentValue, compareValue] = args;\n\n // These are reversed out of the set style version of the diffing tool\n const current = compareValue;\n const compare = currentValue;\n\n if (type === 'root' || type === 'minMaxZoom') {\n accum[propertyId] = {\n current,\n compare\n };\n } else if (type === 'filter') {\n accum[propertyId] = {\n current,\n // Not sure why this is stringified\n compare: typeof compare === 'string' ? JSON.parse(compare) : compare\n };\n } else {\n if (!accum[type]) {\n accum[type] = {};\n }\n accum[type][propertyId] = {\n current,\n compare\n };\n }\n\n return accum;\n }, {});\n\n acc[layerId] = nextLayerChanges;\n\n return acc;\n }, {});\n\n return {\n layerProps: nextLayerProps,\n layers: nextLayers,\n sources: nextSources\n };\n};\n\nexport const diff = diffStyles;\n"],"names":[],"version":3,"file":"module.js.map"} \ No newline at end of file +{"mappings":"ACAA,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AAE,EAAE,CAAC,AAAC;IAEP,IAAI,UAAU,AAAC;IACf,IAAI,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE;QACxB,MAAM,CAAC,YAAY,EAAE,YAAY,CAAC,GAAG,MAAM,EAAE,MAAM,EAAE,IAAI,AAAC;QAC1D,UAAU,GAAG;YAAE,OAAO,EAAE,YAAY;YAAE,OAAO,EAAE,YAAY;SAAE,CAAC;KAC/D;IAED,IAAI,UAAU,AAAC;IACf,IAAI,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE;QACxB,MAAM,CAAC,aAAa,EAAE,aAAa,CAAC,GAAG,MAAM,EAAE,MAAM,EAAE,IAAI,AAAC;QAC5D,UAAU,GAAG;YAAE,OAAO,EAAE,aAAa;YAAE,OAAO,EAAE,aAAa;SAAE,CAAC;KACjE;IAED,OAAO;QACL,UAAU,EAAE,cAAc;QAC1B,MAAM,EAAE,UAAU;QAClB,OAAO,EAAE,WAAW;QACpB,MAAM,EAAE,UAAU;QAClB,MAAM,EAAE,UAAU;KACnB,CAAC;CACH,AAAC;AAEK,MAAM,yCAAI,GAAG,gCAAU,AAAC;;ADlvB/B","sources":["src/index.js","src/lib/diff.js"],"sourcesContent":["import { diff, diffStylesSetStyle } from \"./lib/diff\";\n\nexport { diff, diffStylesSetStyle };\n","const isEqual = (a, b) => JSON.stringify(a) === JSON.stringify(b);\n\nclass diffTracker {\n constructor() {\n this.glyphs = null;\n this.sprite = null;\n this.sources = [];\n this.layers = [];\n this.layerProps = {};\n }\n\n changeGlyphs(change) {\n this.glyphs = { change: change };\n }\n\n changeSprite(change) {\n this.sprite = { change: change };\n }\n\n changeSource(source, change) {\n this.sources.push({ source: source, change: change });\n }\n\n changeLayer(layer, change) {\n this.layers.push({ layer: layer, change: change });\n }\n\n changeLayerProp(layer, change) {\n if (!this.layerProps[layer]) this.layerProps[layer] = [change];\n else this.layerProps[layer].push(change);\n }\n}\nconst operations = {\n /*\n * { command: 'setStyle', args: [stylesheet] }\n */\n setStyle: 'setStyle',\n\n /*\n * { command: 'addLayer', args: [layer, 'beforeLayerId'] }\n */\n addLayer: 'addLayer',\n\n /*\n * { command: 'removeLayer', args: ['layerId'] }\n */\n removeLayer: 'removeLayer',\n\n moveLayer: 'moveLayer',\n\n /*\n * { command: 'setPaintProperty', args: ['layerId', 'prop', value] }\n */\n setPaintProperty: 'setPaintProperty',\n\n /*\n * { command: 'setLayoutProperty', args: ['layerId', 'prop', value] }\n */\n setLayoutProperty: 'setLayoutProperty',\n\n /*\n * { command: 'setFilter', args: ['layerId', filter] }\n */\n setFilter: 'setFilter',\n\n /*\n * { command: 'addSource', args: ['sourceId', source] }\n */\n addSource: 'addSource',\n\n /*\n * { command: 'removeSource', args: ['sourceId'] }\n */\n removeSource: 'removeSource',\n\n /*\n * { command: 'setGeoJSONSourceData', args: ['sourceId', data] }\n */\n setGeoJSONSourceData: 'setGeoJSONSourceData',\n\n /*\n * { command: 'setLayerZoomRange', args: ['layerId', 0, 22] }\n */\n setLayerZoomRange: 'setLayerZoomRange',\n\n /*\n * { command: 'setLayerProperty', args: ['layerId', 'prop', value] }\n */\n setLayerProperty: 'setLayerProperty',\n\n /*\n * { command: 'setCenter', args: [[lon, lat]] }\n */\n setCenter: 'setCenter',\n\n /*\n * { command: 'setZoom', args: [zoom] }\n */\n setZoom: 'setZoom',\n\n /*\n * { command: 'setBearing', args: [bearing] }\n */\n setBearing: 'setBearing',\n\n /*\n * { command: 'setPitch', args: [pitch] }\n */\n setPitch: 'setPitch',\n\n /*\n * { command: 'setSprite', args: ['spriteUrl'] }\n */\n setSprite: 'setSprite',\n\n /*\n * { command: 'setGlyphs', args: ['glyphsUrl'] }\n */\n setGlyphs: 'setGlyphs',\n\n /*\n * { command: 'setTransition', args: [transition] }\n */\n setTransition: 'setTransition',\n\n /*\n * { command: 'setLighting', args: [lightProperties] }\n */\n setLight: 'setLight',\n\n /*\n * { command: 'setTerrain', args: [terrainProperties] }\n */\n setTerrain: 'setTerrain',\n\n /*\n * { command: 'setFog', args: [fogProperties] }\n */\n setFog: 'setFog',\n\n /*\n * { command: 'setProjection', args: [projectionProperties] }\n */\n setProjection: 'setProjection'\n};\n\nfunction addSource(sourceId, after, commands) {\n commands.push({\n command: operations.addSource,\n args: [sourceId, after[sourceId]]\n });\n}\n\nfunction removeSource(sourceId, commands, sourcesRemoved) {\n commands.push({ command: operations.removeSource, args: [sourceId] });\n sourcesRemoved[sourceId] = true;\n}\n\nfunction updateSource(sourceId, after, commands, sourcesRemoved) {\n removeSource(sourceId, commands, sourcesRemoved);\n addSource(sourceId, after, commands);\n}\n\nfunction canUpdateGeoJSON(before, after, sourceId) {\n let prop;\n for (prop in before[sourceId]) {\n if (!before[sourceId].hasOwnProperty(prop)) continue;\n if (\n prop !== 'data' &&\n !isEqual(before[sourceId][prop], after[sourceId][prop])\n ) {\n return false;\n }\n }\n for (prop in after[sourceId]) {\n if (!after[sourceId].hasOwnProperty(prop)) continue;\n if (\n prop !== 'data' &&\n !isEqual(before[sourceId][prop], after[sourceId][prop])\n ) {\n return false;\n }\n }\n return true;\n}\n\nfunction diffSources(before, after, commands, sourcesRemoved, differ) {\n before = before || {};\n after = after || {};\n\n let sourceId;\n\n // look for sources to remove\n for (sourceId in before) {\n if (!before.hasOwnProperty(sourceId)) continue;\n if (!after.hasOwnProperty(sourceId)) {\n differ.changeSource(sourceId, { command: 'removeSource' });\n removeSource(sourceId, commands, sourcesRemoved);\n }\n }\n\n // look for sources to add/update\n for (sourceId in after) {\n if (!after.hasOwnProperty(sourceId)) continue;\n\n // add sources\n if (!before.hasOwnProperty(sourceId)) {\n differ.changeSource(sourceId, { command: 'addSource' });\n addSource(sourceId, after, commands);\n }\n // update sources\n else if (!isEqual(before[sourceId], after[sourceId])) {\n differ.changeSource(sourceId, { command: 'updateSource' });\n if (\n before[sourceId].type === 'geojson' &&\n after[sourceId].type === 'geojson' &&\n canUpdateGeoJSON(before, after, sourceId)\n ) {\n commands.push({\n command: operations.setGeoJSONSourceData,\n args: [sourceId, after[sourceId].data]\n });\n } else {\n // no update command, must remove then add\n updateSource(sourceId, after, commands, sourcesRemoved);\n // TODO Update differ?\n }\n }\n }\n}\n\nfunction diffLayerPropertyChanges(\n before,\n after,\n commands,\n layerId,\n klass,\n command,\n differ\n) {\n before = before || {};\n after = after || {};\n\n let prop;\n\n for (prop in before) {\n if (!before.hasOwnProperty(prop)) continue;\n if (!isEqual(before[prop], after[prop])) {\n const cmd = {\n command,\n args: [prop, after[prop], before[prop], klass],\n layer: layerId\n };\n commands.push(cmd);\n differ.changeLayerProp(layerId, cmd);\n }\n }\n for (prop in after) {\n if (!after.hasOwnProperty(prop) || before.hasOwnProperty(prop)) continue;\n if (!isEqual(before[prop], after[prop])) {\n const cmd = {\n command,\n args: [prop, after[prop], before[prop], klass],\n layer: layerId\n };\n commands.push(cmd);\n differ.changeLayerProp(layerId, cmd);\n }\n }\n}\n\nfunction pluckId(layer) {\n return layer.id;\n}\nfunction indexById(group, layer) {\n group[layer.id] = layer;\n return group;\n}\n\nfunction diffLayers(before, after, commands, differ) {\n before = before || [];\n after = after || [];\n\n // order of layers by id\n const beforeOrder = before.map(pluckId);\n const afterOrder = after.map(pluckId);\n\n // index of layer by id\n const beforeIndex = before.reduce(indexById, {});\n const afterIndex = after.reduce(indexById, {});\n\n // track order of layers as if they have been mutated\n const tracker = beforeOrder.slice();\n\n // layers that have been added do not need to be diffed\n const clean = Object.create(null);\n\n let i, d, layerId, beforeLayer, afterLayer, insertBeforeLayerId, prop;\n\n // remove layers\n for (i = 0, d = 0; i < beforeOrder.length; i++) {\n layerId = beforeOrder[i];\n // detect removed layer\n if (!afterIndex.hasOwnProperty(layerId)) {\n commands.push({ command: operations.removeLayer, args: [layerId] });\n differ.changeLayer(layerId, { command: 'removeLayer' });\n tracker.splice(tracker.indexOf(layerId, d), 1);\n } else {\n // limit where in tracker we need to look for a match\n d++;\n }\n }\n\n // add/reorder layers\n for (i = 0, d = 0; i < afterOrder.length; i++) {\n // work backwards as insert is before an existing layer\n layerId = afterOrder[afterOrder.length - 1 - i];\n\n if (tracker[tracker.length - 1 - i] === layerId) continue;\n var movingLayer = false;\n if (beforeIndex.hasOwnProperty(layerId)) {\n movingLayer = true;\n // remove the layer before we insert at the correct position\n commands.push({ command: operations.removeLayer, args: [layerId] });\n tracker.splice(tracker.lastIndexOf(layerId, tracker.length - d), 1);\n } else {\n // limit where in tracker we need to look for a match\n d++;\n }\n\n // add layer at correct position\n insertBeforeLayerId = tracker[tracker.length - i];\n commands.push({\n command: operations.addLayer,\n args: [afterIndex[layerId], insertBeforeLayerId]\n });\n tracker.splice(tracker.length - i, 0, layerId);\n\n if (movingLayer)\n differ.changeLayer(layerId, {\n command: 'moveLayer',\n args: [insertBeforeLayerId]\n });\n else {\n clean[layerId] = true;\n differ.changeLayer(layerId, {\n command: 'addLayer',\n args: [afterIndex[layerId], insertBeforeLayerId]\n });\n }\n }\n\n // update layers\n for (i = 0; i < afterOrder.length; i++) {\n layerId = afterOrder[i];\n beforeLayer = beforeIndex[layerId];\n afterLayer = afterIndex[layerId];\n\n // no need to update if previously added (new or moved)\n if (clean[layerId] || isEqual(beforeLayer, afterLayer)) continue;\n\n // layout, paint, filter, minzoom, maxzoom\n diffLayerPropertyChanges(\n beforeLayer.layout,\n afterLayer.layout,\n commands,\n layerId,\n null,\n operations.setLayoutProperty,\n differ\n );\n diffLayerPropertyChanges(\n beforeLayer.paint,\n afterLayer.paint,\n commands,\n layerId,\n null,\n operations.setPaintProperty,\n differ\n );\n if (!isEqual(beforeLayer.filter, afterLayer.filter)) {\n const cmd = {\n command: operations.setFilter,\n args: ['filter', JSON.stringify(afterLayer.filter), beforeLayer.filter],\n layer: layerId\n };\n commands.push(cmd);\n differ.changeLayerProp(layerId, cmd);\n }\n\n if (!isEqual(beforeLayer.minzoom, afterLayer.minzoom)) {\n const cmd = {\n command: operations.setLayerZoomRange,\n args: ['minzoom', afterLayer.minzoom, beforeLayer.minzoom],\n layer: layerId\n };\n commands.push(cmd);\n differ.changeLayerProp(layerId, cmd);\n }\n if (!isEqual(beforeLayer.maxzoom, afterLayer.maxzoom)) {\n const cmd = {\n command: operations.setLayerZoomRange,\n args: ['maxzoom', afterLayer.maxzoom, beforeLayer.maxzoom],\n layer: layerId\n };\n commands.push(cmd);\n differ.changeLayerProp(layerId, cmd);\n }\n\n // handle all other layer props, including paint.*\n for (prop in beforeLayer) {\n if (!beforeLayer.hasOwnProperty(prop)) continue;\n if (\n prop === 'layout' ||\n prop === 'paint' ||\n prop === 'filter' ||\n prop === 'metadata' ||\n prop === 'minzoom' ||\n prop === 'maxzoom'\n )\n continue;\n if (prop.indexOf('paint.') === 0) {\n diffLayerPropertyChanges(\n beforeLayer[prop],\n afterLayer[prop],\n commands,\n layerId,\n prop.slice(6),\n operations.setPaintProperty,\n differ\n );\n } else if (!isEqual(beforeLayer[prop], afterLayer[prop])) {\n const cmd = {\n command: operations.setLayerProperty,\n args: [prop, afterLayer[prop], beforeLayer[prop]],\n layer: layerId\n };\n commands.push(cmd);\n differ.changeLayerProp(layerId, cmd);\n }\n }\n for (prop in afterLayer) {\n if (!afterLayer.hasOwnProperty(prop) || beforeLayer.hasOwnProperty(prop))\n continue;\n if (\n prop === 'layout' ||\n prop === 'paint' ||\n prop === 'filter' ||\n prop === 'metadata' ||\n prop === 'minzoom' ||\n prop === 'maxzoom'\n )\n continue;\n if (prop.indexOf('paint.') === 0) {\n diffLayerPropertyChanges(\n beforeLayer[prop],\n afterLayer[prop],\n commands,\n layerId,\n prop.slice(6),\n operations.setPaintProperty\n );\n } else if (!isEqual(beforeLayer[prop], afterLayer[prop])) {\n const cmd = {\n command: operations.setLayerProperty,\n args: [prop, afterLayer[prop], beforeLayer[prop]],\n layer: layerId\n };\n commands.push(cmd);\n differ.changeLayerProp(layerId, cmd);\n }\n }\n }\n}\n\n/**\n * Diff two stylesheet\n *\n * Creates semanticly aware diffs that can easily be applied at runtime.\n * Operations produced by the diff closely resemble the mapbox-gl-js API. Any\n * error creating the diff will fall back to the 'setStyle' operation.\n *\n * Example diff:\n * [\n * { command: 'setConstant', args: ['@water', '#0000FF'] },\n * { command: 'setPaintProperty', args: ['background', 'background-color', 'black'] }\n * ]\n *\n * @private\n * @param {*} [before] stylesheet to compare from\n * @param {*} after stylesheet to compare to\n * @returns Array list of changes\n */\nexport function diffStylesSetStyle(before, after) {\n if (!before) return [{ command: operations.setStyle, args: [after] }];\n const differ = new diffTracker();\n\n let commands = [];\n\n try {\n // Handle changes to top-level properties\n if (!isEqual(before.version, after.version)) {\n return [{ command: operations.setStyle, args: [after] }];\n }\n if (!isEqual(before.center, after.center)) {\n commands.push({ command: operations.setCenter, args: [after.center] });\n }\n if (!isEqual(before.zoom, after.zoom)) {\n commands.push({ command: operations.setZoom, args: [after.zoom] });\n }\n if (!isEqual(before.bearing, after.bearing)) {\n commands.push({ command: operations.setBearing, args: [after.bearing] });\n }\n if (!isEqual(before.pitch, after.pitch)) {\n commands.push({ command: operations.setPitch, args: [after.pitch] });\n }\n if (!isEqual(before.sprite, after.sprite)) {\n commands.push({ command: operations.setSprite, args: [after.sprite] });\n differ.changeSprite({\n command: 'setSprite',\n args: [after.sprite, before.sprite]\n });\n }\n if (!isEqual(before.glyphs, after.glyphs)) {\n commands.push({ command: operations.setGlyphs, args: [after.glyphs] });\n differ.changeGlyphs({\n command: 'setGlyphs',\n args: [after.glyphs, before.glyphs]\n });\n }\n if (!isEqual(before.transition, after.transition)) {\n commands.push({\n command: operations.setTransition,\n args: [after.transition]\n });\n }\n if (!isEqual(before.light, after.light)) {\n commands.push({ command: operations.setLight, args: [after.light] });\n }\n if (!isEqual(before.fog, after.fog)) {\n commands.push({ command: operations.setFog, args: [after.fog] });\n }\n if (!isEqual(before.projection, after.projection)) {\n commands.push({\n command: operations.setProjection,\n args: [after.projection]\n });\n }\n\n // Handle changes to `sources`\n // If a source is to be removed, we also--before the removeSource\n // command--need to remove all the style layers that depend on it.\n const sourcesRemoved = {};\n\n // First collect the {add,remove}Source commands\n const removeOrAddSourceCommands = [];\n diffSources(\n before.sources,\n after.sources,\n removeOrAddSourceCommands,\n sourcesRemoved,\n differ\n );\n\n commands = commands.concat(removeOrAddSourceCommands);\n\n // Handle changes to `layers`\n diffLayers(before.layers, after.layers, commands, differ);\n } catch (e) {\n // fall back to setStyle\n console.warn('Unable to compute style diff:', e);\n commands = [{ command: operations.setStyle, args: [after] }];\n }\n\n commands = detectMovedLayers(commands);\n\n return differ;\n}\n\nfunction detectMovedLayers(commands) {\n var output = [];\n var blacklistAdds = [];\n\n function findReaddedLayer(removalCommand) {\n const targetId = removalCommand.args[0];\n const match = commands.find(l => l.args?.[0]?.id === targetId);\n if (match) {\n blacklistAdds.push(targetId);\n }\n return match;\n }\n\n commands.forEach(c => {\n if (c.command === 'removeLayer') {\n const readded = findReaddedLayer(c);\n if (readded) {\n output.push({ command: 'moveLayer', args: readded.args });\n } else output.push(c);\n } else if (c.command !== 'addLayer' || !blacklistAdds.includes(c.args[0]))\n output.push(c);\n });\n\n return output;\n}\n\n// Added this function to change the output format to be more helpful\nconst diffStyles = (before, after) => {\n const originalDiff = diffStylesSetStyle(before, after);\n\n const { layerProps, layers, sources, glyphs, sprite } = originalDiff;\n\n // formatting for source additions and removals\n const nextSources = sources.reduce((acc, s) => {\n const { change, source } = s;\n\n let type = change.command;\n\n switch (type) {\n case 'removeSource': {\n type = 'remove';\n break;\n }\n case 'addSource': {\n type = 'add';\n break;\n }\n }\n\n acc[source] = type;\n\n return acc;\n }, {});\n\n // formatting for layer additions, reorders, and removals\n const nextLayers = layers.reduce((acc, l) => {\n const { change, layer } = l;\n\n let type = change.command;\n\n switch (type) {\n case 'removeLayer': {\n type = 'remove';\n break;\n }\n case 'addLayer': {\n type = 'add';\n break;\n }\n case 'moveLayer': {\n type = 'move';\n break;\n }\n }\n\n acc[layer] = {\n type,\n ...(type === 'add' && {\n layer: change?.args[0],\n layerAbove: change?.args[1]\n }),\n ...(type === 'move' && { layerAbove: change?.args[0] })\n };\n\n return acc;\n }, {});\n\n // formatting for layer property changes\n const nextLayerProps = Object.keys(layerProps).reduce((acc, layerId) => {\n const nextLayerChanges = layerProps[layerId].reduce((accum, change) => {\n const { command, args } = change;\n\n let type = command;\n\n switch (command) {\n case 'setFilter': {\n type = 'filter';\n break;\n }\n // source & source-layer\n case 'setLayerProperty': {\n type = 'root';\n break;\n }\n case 'setPaintProperty': {\n type = 'paint';\n break;\n }\n // min and max zoom\n case 'setLayerZoomRange': {\n type = 'minMaxZoom';\n break;\n }\n case 'setLayoutProperty': {\n type = 'layout';\n break;\n }\n }\n\n const [propertyId, currentValue, compareValue] = args;\n\n // These are reversed out of the set style version of the diffing tool\n const current = compareValue;\n const compare = currentValue;\n\n if (type === 'root' || type === 'minMaxZoom') {\n accum[propertyId] = {\n current,\n compare\n };\n } else if (type === 'filter') {\n accum[propertyId] = {\n current,\n // Not sure why this is stringified\n compare: typeof compare === 'string' ? JSON.parse(compare) : compare\n };\n } else {\n if (!accum[type]) {\n accum[type] = {};\n }\n accum[type][propertyId] = {\n current,\n compare\n };\n }\n\n return accum;\n }, {});\n\n acc[layerId] = nextLayerChanges;\n\n return acc;\n }, {});\n\n let nextGlyphs;\n if (glyphs?.change?.args) {\n const [compareGlyph, currentGlyph] = glyphs?.change?.args;\n nextGlyphs = { current: currentGlyph, compare: compareGlyph };\n }\n\n let nextSprite;\n if (sprite?.change?.args) {\n const [compareSprite, currentSprite] = sprite?.change?.args;\n nextSprite = { current: currentSprite, compare: compareSprite };\n }\n\n return {\n layerProps: nextLayerProps,\n layers: nextLayers,\n sources: nextSources,\n glyphs: nextGlyphs,\n sprite: nextSprite\n };\n};\n\nexport const diff = diffStyles;\n"],"names":[],"version":3,"file":"module.js.map","sourceRoot":"../"} \ No newline at end of file diff --git a/src/lib/diff.js b/src/lib/diff.js index d024d37..f547b2e 100644 --- a/src/lib/diff.js +++ b/src/lib/diff.js @@ -2,11 +2,21 @@ const isEqual = (a, b) => JSON.stringify(a) === JSON.stringify(b); class diffTracker { constructor() { + this.glyphs = null; + this.sprite = null; this.sources = []; this.layers = []; this.layerProps = {}; } + changeGlyphs(change) { + this.glyphs = { change: change }; + } + + changeSprite(change) { + this.sprite = { change: change }; + } + changeSource(source, change) { this.sources.push({ source: source, change: change }); } @@ -505,9 +515,17 @@ export function diffStylesSetStyle(before, after) { } if (!isEqual(before.sprite, after.sprite)) { commands.push({ command: operations.setSprite, args: [after.sprite] }); + differ.changeSprite({ + command: 'setSprite', + args: [after.sprite, before.sprite] + }); } if (!isEqual(before.glyphs, after.glyphs)) { commands.push({ command: operations.setGlyphs, args: [after.glyphs] }); + differ.changeGlyphs({ + command: 'setGlyphs', + args: [after.glyphs, before.glyphs] + }); } if (!isEqual(before.transition, after.transition)) { commands.push({ @@ -554,6 +572,7 @@ export function diffStylesSetStyle(before, after) { } commands = detectMovedLayers(commands); + return differ; } @@ -587,7 +606,7 @@ function detectMovedLayers(commands) { const diffStyles = (before, after) => { const originalDiff = diffStylesSetStyle(before, after); - const { layerProps, layers, sources } = originalDiff; + const { layerProps, layers, sources, glyphs, sprite } = originalDiff; // formatting for source additions and removals const nextSources = sources.reduce((acc, s) => { @@ -711,10 +730,24 @@ const diffStyles = (before, after) => { return acc; }, {}); + let nextGlyphs; + if (glyphs?.change?.args) { + const [compareGlyph, currentGlyph] = glyphs?.change?.args; + nextGlyphs = { current: currentGlyph, compare: compareGlyph }; + } + + let nextSprite; + if (sprite?.change?.args) { + const [compareSprite, currentSprite] = sprite?.change?.args; + nextSprite = { current: currentSprite, compare: compareSprite }; + } + return { layerProps: nextLayerProps, layers: nextLayers, - sources: nextSources + sources: nextSources, + glyphs: nextGlyphs, + sprite: nextSprite }; };