-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This adds TypeScript definitions to the library so it can be used in TS apps, with no change to JS apps
- Loading branch information
Showing
31 changed files
with
2,753 additions
and
2,384 deletions.
There are no files selected for viewing
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 |
---|---|---|
|
@@ -5,7 +5,8 @@ | |
{ | ||
"modules": false | ||
} | ||
] | ||
], | ||
"@babel/typescript" | ||
], | ||
"env": { | ||
"commonjs": { | ||
|
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
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
const DASH = /-([a-z])/g | ||
const MS = /^Ms/g | ||
|
||
function toUpper(match) { | ||
function toUpper(match: string) { | ||
return match[1].toUpperCase() | ||
} | ||
|
||
export default function camelCaseProperty(property) { | ||
export default function camelCaseProperty(property: string) { | ||
return property.replace(DASH, toUpper).replace(MS, 'ms') | ||
} |
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 |
---|---|---|
@@ -1,5 +1,8 @@ | ||
import hyphenateProperty from './hyphenateProperty' | ||
|
||
export default function cssifyDeclaration(property, value) { | ||
export default function cssifyDeclaration( | ||
property: string, | ||
value: string | number | ||
) { | ||
return hyphenateProperty(property) + ':' + value | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
declare module 'hyphenate-style-name' { | ||
export default function hyphenateStyleName(property: string | number): string | ||
} |
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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
import hyphenateStyleName from 'hyphenate-style-name' | ||
|
||
export default function hyphenateProperty(property) { | ||
export default function hyphenateProperty(property: string | number) { | ||
return hyphenateStyleName(property) | ||
} |
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 |
---|---|---|
|
@@ -23,5 +23,5 @@ export { | |
normalizeProperty, | ||
resolveArrayValue, | ||
unprefixProperty, | ||
unprefixValue | ||
unprefixValue, | ||
} |
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,5 @@ | ||
const RE = /^(Webkit|Moz|O|ms)/ | ||
|
||
export default function isPrefixedProperty(property: string) { | ||
return RE.test(property) | ||
} |
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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
const RE = /-webkit-|-moz-|-ms-/ | ||
|
||
export default function isPrefixedValue(value) { | ||
export default function isPrefixedValue(value: string) { | ||
return typeof value === 'string' && RE.test(value) | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
import camelCaseProperty from './camelCaseProperty' | ||
import unprefixProperty from './unprefixProperty' | ||
|
||
export default function normalizeProperty(property) { | ||
export default function normalizeProperty(property: string) { | ||
return unprefixProperty(camelCaseProperty(property)) | ||
} |
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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
import hyphenateProperty from './hyphenateProperty' | ||
|
||
export default function resolveArrayValue(property, value) { | ||
export default function resolveArrayValue(property: string, value: string[]) { | ||
return value.join(';' + hyphenateProperty(property) + ':') | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{ | ||
"compilerOptions": { | ||
"allowJs": true, | ||
"declaration": true, | ||
"module": "ESNext", | ||
"moduleResolution": "node", | ||
"outDir": "es", | ||
"skipLibCheck": true, | ||
"strict": true, | ||
"target": "ESNext", | ||
"types": ["jest"] | ||
}, | ||
"exclude": ["modules/__tests__", "node_modules"], | ||
"include": ["modules"] | ||
} |
Oops, something went wrong.