mirror of
https://github.com/maputnik/editor.git
synced 2026-09-02 02:17:26 +00:00
e8d07fa694
This migrates some utilities classes from javascript to typescript. Nothing special about the migration, mainly added types and made sure the code adheres to the strict mode. I have picked some small files so git doesn't think they are the same since they are "very different". I hope that in later PRs, when migrating lager files this won't be an issues.
13 lines
616 B
TypeScript
13 lines
616 B
TypeScript
import {StyleSpecification, diff} from '@maplibre/maplibre-gl-style-spec'
|
|
|
|
function diffMessages(beforeStyle: StyleSpecification, afterStyle: StyleSpecification) {
|
|
const changes = diff(beforeStyle, afterStyle)
|
|
return changes.map(cmd => cmd.command + ' ' + cmd.args.join(' '))
|
|
}
|
|
|
|
export function undoMessages(beforeStyle: StyleSpecification, afterStyle: StyleSpecification) {
|
|
return diffMessages(beforeStyle, afterStyle).map(m => 'Undo ' + m)
|
|
}
|
|
export function redoMessages(beforeStyle: StyleSpecification, afterStyle: StyleSpecification) {
|
|
return diffMessages(beforeStyle, afterStyle).map(m => 'Redo ' + m)
|
|
} |