-
-
Notifications
You must be signed in to change notification settings - Fork 403
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Initial migration to typescript (#845)
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.
- Loading branch information
Showing
17 changed files
with
76 additions
and
68 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import throttle from 'lodash.throttle' | ||
|
||
export default { | ||
// Throttle for 3 seconds so when a user enables it they don't have to refresh the page. | ||
reducedMotionEnabled: throttle(() => { | ||
return window.matchMedia("(prefers-reduced-motion: reduce)").matches | ||
}, 3000) | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
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) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import {latest} from '@maplibre/maplibre-gl-style-spec' | ||
|
||
export const combiningFilterOps = ['all', 'any', 'none']; | ||
export const setFilterOps = ['in', '!in']; | ||
export const otherFilterOps = Object | ||
.keys(latest.filter_operator.values) | ||
.filter(op => combiningFilterOps.indexOf(op) < 0); |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
export default function(num1: string | number, num2: string| number) { | ||
const a = +num1; | ||
const b = +num2; | ||
|
||
if(a < b) { | ||
return -1 | ||
} | ||
else if(a > b) { | ||
return 1 | ||
} | ||
else { | ||
return 0; | ||
} | ||
} |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters