diff --git a/src/common/hooks/useControlledOrUncontrolled.js b/src/common/hooks/useControlledOrUncontrolled.ts similarity index 100% rename from src/common/hooks/useControlledOrUncontrolled.js rename to src/common/hooks/useControlledOrUncontrolled.ts diff --git a/src/common/hooks/useForkRef.spec.js b/src/common/hooks/useForkRef.spec.tsx similarity index 57% rename from src/common/hooks/useForkRef.spec.js rename to src/common/hooks/useForkRef.spec.tsx index 855d9e5f..d4b4cb8c 100644 --- a/src/common/hooks/useForkRef.spec.js +++ b/src/common/hooks/useForkRef.spec.tsx @@ -1,8 +1,5 @@ -/* eslint-disable react/require-default-props */ -/* eslint-disable react/forbid-prop-types */ -import React from 'react'; import { render } from '@testing-library/react'; -import propTypes from 'prop-types'; +import React from 'react'; import useForkRef from './useForkRef'; @@ -18,10 +15,10 @@ afterEach(() => { describe('useForkRef', () => { it('returns a single ref-setter function that forks the ref to its inputs', () => { - function Component(props) { + function Component(props: { innerRef: React.RefObject }) { const { innerRef } = props; - const ownRef = React.useRef(null); - const [, forceUpdate] = React.useState(0); + const ownRef = React.useRef(); + const [, forceUpdate] = React.useState(true); React.useEffect(() => forceUpdate(n => !n), []); const handleRef = useForkRef(innerRef, ownRef); @@ -31,19 +28,18 @@ describe('useForkRef', () => { ); } - Component.propTypes = { - innerRef: propTypes.any - }; - - const outerRef = React.createRef(); + const outerRef = React.createRef(); render(); - expect(outerRef.current.textContent).toBe('has a ref'); + expect(outerRef.current?.textContent).toBe('has a ref'); expect(console.error).not.toHaveBeenCalled(); }); it('forks if only one of the branches requires a ref', () => { - const Component = React.forwardRef(function Component(props, ref) { + const Component = React.forwardRef(function Component( + _, + ref + ) { const [hasRef, setHasRef] = React.useState(false); const handleOwnRef = React.useCallback(() => setHasRef(true), []); const handleRef = useForkRef(handleOwnRef, ref); @@ -58,16 +54,26 @@ describe('useForkRef', () => { }); it('does nothing if none of the forked branches requires a ref', () => { - const Outer = React.forwardRef(function Outer(props, ref) { + const setRef = jest.fn(); + + type OuterProps = { + children: React.ReactElement; + }; + + const Outer = React.forwardRef(function Outer( + props, + ref + ) { const { children } = props; - const handleRef = useForkRef(children.ref, ref); - return React.cloneElement(children, { ref: handleRef }); - }); + // TODO: Fix this test as reading ref from children is not allowed so not available on React types + // eslint-disable-next-line @typescript-eslint/ban-ts-comment + // @ts-ignore + const handleRef = useForkRef(children?.ref, ref); + setRef(handleRef); - // TODO: Figure out how to make react/no-unused-prop-types happy with the children - // eslint-disable-next-line react/no-unused-prop-types - Outer.propTypes = { children: propTypes.element.isRequired }; + return children ? React.cloneElement(children, { ref: handleRef }) : null; + }); function Inner() { return
; @@ -79,37 +85,38 @@ describe('useForkRef', () => { ); expect(console.error).not.toHaveBeenCalled(); + expect(setRef).toHaveBeenCalledWith(null); }); describe('changing refs', () => { - function Div(props) { - const { leftRef, rightRef, ...other } = props; + function Div( + props: { + leftRef?: React.Ref; + rightRef?: React.Ref; + } & React.HTMLAttributes + ) { + const { leftRef = null, rightRef = null, ...other } = props; const handleRef = useForkRef(leftRef, rightRef); return
; } - Div.propTypes = { - leftRef: propTypes.oneOfType([propTypes.func, propTypes.object]), - rightRef: propTypes.oneOfType([propTypes.func, propTypes.object]) - }; - it('handles changing from no ref to some ref', () => { const { rerender } = render(
); expect(console.error).not.toHaveBeenCalled(); - const ref = React.createRef(); + const ref = React.createRef(); rerender(
); - expect(ref.current.id).toBe('test'); + expect(ref.current?.id).toBe('test'); expect(console.error).not.toHaveBeenCalled(); }); it('cleans up detached refs', () => { - const firstLeftRef = React.createRef(); - const firstRightRef = React.createRef(); - const secondRightRef = React.createRef(); + const firstLeftRef = React.createRef(); + const firstRightRef = React.createRef(); + const secondRightRef = React.createRef(); const { rerender } = render(
@@ -117,17 +124,17 @@ describe('useForkRef', () => { expect(console.error).not.toHaveBeenCalled(); - expect(firstLeftRef.current.id).toBe('test'); - expect(firstRightRef.current.id).toBe('test'); + expect(firstLeftRef.current?.id).toBe('test'); + expect(firstRightRef.current?.id).toBe('test'); expect(secondRightRef.current).toBe(null); rerender(
); - expect(firstLeftRef.current.id).toBe('test'); + expect(firstLeftRef.current?.id).toBe('test'); expect(firstRightRef.current).toBe(null); - expect(secondRightRef.current.id).toBe('test'); + expect(secondRightRef.current?.id).toBe('test'); }); }); }); diff --git a/src/common/hooks/useForkRef.js b/src/common/hooks/useForkRef.ts similarity index 70% rename from src/common/hooks/useForkRef.js rename to src/common/hooks/useForkRef.ts index 41c77065..78c4abf6 100644 --- a/src/common/hooks/useForkRef.js +++ b/src/common/hooks/useForkRef.ts @@ -1,7 +1,10 @@ // Straight out copied from https://github.com/mui-org/material-ui 😂 import * as React from 'react'; -function setRef(ref, value) { +function setRef( + ref: React.RefCallback | React.MutableRefObject | null, + value: T +) { if (typeof ref === 'function') { ref(value); } else if (ref) { @@ -10,7 +13,10 @@ function setRef(ref, value) { } } -export default function useForkRef(refA, refB) { +export default function useForkRef( + refA: React.RefCallback | React.MutableRefObject | null, + refB: React.RefCallback | React.MutableRefObject | null +): React.RefCallback | null { /** * This will create a new function if the ref props change and are defined. * This means react will call the old forkRef with `null` and the new forkRef diff --git a/src/common/hooks/useIsFocusVisible.js b/src/common/hooks/useIsFocusVisible.ts similarity index 100% rename from src/common/hooks/useIsFocusVisible.js rename to src/common/hooks/useIsFocusVisible.ts diff --git a/src/common/index.js b/src/common/index.ts similarity index 90% rename from src/common/index.js rename to src/common/index.ts index 1ab65ee1..644a7870 100644 --- a/src/common/index.js +++ b/src/common/index.ts @@ -1,4 +1,7 @@ -import { css } from 'styled-components'; +import { css, ThemedStyledProps } from 'styled-components'; +import { Color, CommonThemeProps, Theme } from '../types'; + +type CSSProps = ThemedStyledProps; export const shadow = '4px 4px 10px 0 rgba(0, 0, 0, 0.35)'; export const insetShadow = 'inset 2px 2px 3px rgba(0,0,0,0.2)'; @@ -9,12 +12,14 @@ export const createDisabledTextStyles = () => css` text-shadow: 1px 1px ${({ theme }) => theme.materialTextDisabledShadow}; /* filter: grayscale(100%); */ `; + export const createBoxStyles = () => css` box-sizing: border-box; display: inline-block; background: ${({ theme }) => theme.material}; color: ${({ theme }) => theme.materialText}; `; + // TODO for flat box styles add checkered background when disabled (not solid color) export const createHatchedBackground = ({ mainColor = 'black', @@ -41,17 +46,19 @@ export const createHatchedBackground = ({ background-size: ${`${pixelSize * 2}px ${pixelSize * 2}px`}; background-position: 0 0, ${`${pixelSize}px ${pixelSize}px`}; `; + export const createFlatBoxStyles = () => css` position: relative; box-sizing: border-box; display: inline-block; color: ${({ theme }) => theme.materialText}; - background: ${({ theme, isDisabled }) => + background: ${({ theme, isDisabled }: CSSProps) => isDisabled ? theme.flatLight : theme.canvas}; border: 2px solid ${({ theme }) => theme.canvas}; outline: 2px solid ${({ theme }) => theme.flatDark}; outline-offset: -4px; `; + export const createBorderStyles = ({ invert = false, windowBorders = false @@ -64,8 +71,8 @@ export const createBorderStyles = ({ border-top-color: ${({ theme }) => theme.borderDarkest}; border-right-color: ${({ theme }) => theme.borderLightest}; border-bottom-color: ${({ theme }) => theme.borderLightest}; - box-shadow: ${props => props.shadow && `${shadow}, `} inset 1px 1px 0px - 1px ${({ theme }) => theme.borderDark}, + box-shadow: ${(props: CSSProps) => props.shadow && `${shadow}, `} inset + 1px 1px 0px 1px ${({ theme }) => theme.borderDark}, inset -1px -1px 0 1px ${({ theme }) => theme.borderLight}; ` : css` @@ -77,12 +84,13 @@ export const createBorderStyles = ({ windowBorders ? theme.borderLight : theme.borderLightest}; border-right-color: ${({ theme }) => theme.borderDarkest}; border-bottom-color: ${({ theme }) => theme.borderDarkest}; - box-shadow: ${props => props.shadow && `${shadow}, `} inset 1px 1px 0px - 1px + box-shadow: ${(props: CSSProps) => props.shadow && `${shadow}, `} inset + 1px 1px 0px 1px ${({ theme }) => windowBorders ? theme.borderLightest : theme.borderLight}, inset -1px -1px 0 1px ${({ theme }) => theme.borderDark}; `; + export const createWellBorderStyles = (invert = false) => invert ? css` @@ -106,10 +114,10 @@ export const focusOutline = () => css` outline: 2px dotted ${({ theme }) => theme.materialText}; `; -const nodeBtoa = b => Buffer.from(b).toString('base64'); +const nodeBtoa = (string: string) => Buffer.from(string).toString('base64'); const base64encode = typeof btoa !== 'undefined' ? btoa : nodeBtoa; -const createTriangleSVG = (color, angle = 0) => { +const createTriangleSVG = (color: Color, angle = 0) => { const svg = ` diff --git a/src/common/styleReset.js b/src/common/styleReset.ts similarity index 100% rename from src/common/styleReset.js rename to src/common/styleReset.ts diff --git a/src/common/system.js b/src/common/system.js deleted file mode 100644 index db488abb..00000000 --- a/src/common/system.js +++ /dev/null @@ -1,8 +0,0 @@ -// TODO - implement styled-system - -// eslint-disable-next-line import/prefer-default-export -export const blockSizes = { - sm: '28px', - md: '36px', - lg: '44px' -}; diff --git a/src/common/system.ts b/src/common/system.ts new file mode 100644 index 00000000..deba781b --- /dev/null +++ b/src/common/system.ts @@ -0,0 +1,9 @@ +// TODO - implement styled-system + +import { Sizes } from '../types'; + +export const blockSizes: Record = { + sm: '28px', + md: '36px', + lg: '44px' +}; diff --git a/src/common/themes/aiee.js b/src/common/themes/aiee.ts similarity index 96% rename from src/common/themes/aiee.js rename to src/common/themes/aiee.ts index b01661a7..80ac9f1e 100644 --- a/src/common/themes/aiee.js +++ b/src/common/themes/aiee.ts @@ -2,6 +2,8 @@ * https://www.deviantart.com/tpenguinltg/art/Aiee-668092636 */ +import { Theme } from '../../types'; + export default { name: 'aiee', anchor: 'rgb(0,0,128)', @@ -36,4 +38,4 @@ export default { materialTextInvert: 'rgb(0,62,109)', progress: 'rgb(251,211,61)', tooltip: 'rgb(255,243,185)' -}; +} as Theme; diff --git a/src/common/themes/ash.js b/src/common/themes/ash.ts similarity index 96% rename from src/common/themes/ash.js rename to src/common/themes/ash.ts index 1173fb5e..c402b4b4 100644 --- a/src/common/themes/ash.js +++ b/src/common/themes/ash.ts @@ -1,6 +1,8 @@ /* "Ash" by tPenguinLTG * https://www.deviantart.com/tpenguinltg/art/Ash-575566643 */ +import { Theme } from '../../types'; + export default { name: 'ash', anchor: 'rgb(192, 192, 192)', @@ -34,4 +36,4 @@ export default { materialTextInvert: 'rgb(255, 255, 255)', progress: 'rgb(0, 0, 0)', tooltip: 'rgb(0, 0, 0)' -}; +} as Theme; diff --git a/src/common/themes/azureOrange.js b/src/common/themes/azureOrange.ts similarity index 94% rename from src/common/themes/azureOrange.js rename to src/common/themes/azureOrange.ts index a197f436..26b6ef48 100644 --- a/src/common/themes/azureOrange.js +++ b/src/common/themes/azureOrange.ts @@ -1,3 +1,5 @@ +import { Theme } from '../../types'; + export default { name: 'azureOrange', @@ -31,4 +33,4 @@ export default { materialTextInvert: '#000000', progress: '#F46036', tooltip: '#fefbcc' -}; +} as Theme; diff --git a/src/common/themes/bee.js b/src/common/themes/bee.ts similarity index 94% rename from src/common/themes/bee.js rename to src/common/themes/bee.ts index 22e2d339..405fa8f8 100644 --- a/src/common/themes/bee.js +++ b/src/common/themes/bee.ts @@ -1,3 +1,5 @@ +import { Theme } from '../../types'; + export default { name: 'bee', @@ -31,4 +33,4 @@ export default { materialTextInvert: '#ffffff', progress: '#0C1618', tooltip: '#fefbcc' -}; +} as Theme; diff --git a/src/common/themes/blackAndWhite.js b/src/common/themes/blackAndWhite.ts similarity index 94% rename from src/common/themes/blackAndWhite.js rename to src/common/themes/blackAndWhite.ts index f212234a..a5c67967 100644 --- a/src/common/themes/blackAndWhite.js +++ b/src/common/themes/blackAndWhite.ts @@ -1,3 +1,5 @@ +import { Theme } from '../../types'; + export default { name: 'blackAndWhite', @@ -31,4 +33,4 @@ export default { materialTextInvert: '#ffffff', progress: '#000000', tooltip: '#fefbcc' -}; +} as Theme; diff --git a/src/common/themes/blue.js b/src/common/themes/blue.ts similarity index 96% rename from src/common/themes/blue.js rename to src/common/themes/blue.ts index fac0c68b..f835873c 100644 --- a/src/common/themes/blue.js +++ b/src/common/themes/blue.ts @@ -2,6 +2,8 @@ * https://www.deviantart.com/tpenguinltg/art/Blue-525167751 */ +import { Theme } from '../../types'; + export default { name: 'blue', anchor: 'rgb(0, 0, 128)', @@ -36,4 +38,4 @@ export default { materialTextInvert: 'rgb(255, 255, 255)', progress: 'rgb(51, 153, 255)', tooltip: 'rgb(225, 225, 255)' -}; +} as Theme; diff --git a/src/common/themes/brick.js b/src/common/themes/brick.ts similarity index 94% rename from src/common/themes/brick.js rename to src/common/themes/brick.ts index 4aa02950..326246aa 100644 --- a/src/common/themes/brick.js +++ b/src/common/themes/brick.ts @@ -1,3 +1,5 @@ +import { Theme } from '../../types'; + export default { name: 'brick', @@ -31,4 +33,4 @@ export default { materialTextInvert: '#ffffff', progress: '#8e0101', tooltip: '#fefbcc' -}; +} as Theme; diff --git a/src/common/themes/candy.js b/src/common/themes/candy.ts similarity index 94% rename from src/common/themes/candy.js rename to src/common/themes/candy.ts index 7f18fab5..e224dfe6 100644 --- a/src/common/themes/candy.js +++ b/src/common/themes/candy.ts @@ -1,3 +1,5 @@ +import { Theme } from '../../types'; + export default { name: 'candy', @@ -31,4 +33,4 @@ export default { materialTextInvert: '#EFF1F3', progress: '#256EFF', tooltip: '#fefbcc' -}; +} as Theme; diff --git a/src/common/themes/cherry.js b/src/common/themes/cherry.ts similarity index 96% rename from src/common/themes/cherry.js rename to src/common/themes/cherry.ts index 1ef0a8c2..c28042c8 100644 --- a/src/common/themes/cherry.js +++ b/src/common/themes/cherry.ts @@ -2,6 +2,8 @@ * https://www.deviantart.com/tpenguinltg/art/Cherry-747961418 */ +import { Theme } from '../../types'; + export default { name: 'cherry', anchor: 'rgb(128, 0, 1)', @@ -36,4 +38,4 @@ export default { materialTextInvert: 'rgb(255, 255, 255)', progress: 'rgb(106, 10, 36)', tooltip: 'rgb(225, 254, 255)' -}; +} as Theme; diff --git a/src/common/themes/coldGray.js b/src/common/themes/coldGray.ts similarity index 94% rename from src/common/themes/coldGray.js rename to src/common/themes/coldGray.ts index 70955785..62aca455 100644 --- a/src/common/themes/coldGray.js +++ b/src/common/themes/coldGray.ts @@ -1,3 +1,5 @@ +import { Theme } from '../../types'; + export default { name: 'coldGray', @@ -32,4 +34,4 @@ export default { materialTextInvert: '#c7c7df', progress: '#8d88c2', tooltip: '#fefbcc' -}; +} as Theme; diff --git a/src/common/themes/counterStrike.js b/src/common/themes/counterStrike.ts similarity index 94% rename from src/common/themes/counterStrike.js rename to src/common/themes/counterStrike.ts index 24a1f863..b1556b35 100644 --- a/src/common/themes/counterStrike.js +++ b/src/common/themes/counterStrike.ts @@ -1,3 +1,5 @@ +import { Theme } from '../../types'; + export default { name: 'counterStrike', @@ -31,4 +33,4 @@ export default { materialTextInvert: '#fefefe', progress: '#978830', tooltip: '#fefbcc' -}; +} as Theme; diff --git a/src/common/themes/darkTeal.js b/src/common/themes/darkTeal.ts similarity index 96% rename from src/common/themes/darkTeal.js rename to src/common/themes/darkTeal.ts index 3e6aaef7..486f3734 100644 --- a/src/common/themes/darkTeal.js +++ b/src/common/themes/darkTeal.ts @@ -2,6 +2,8 @@ * https://www.deviantart.com/tpenguinltg/art/Teal-for-Shelbi-Dark-631177772 */ +import { Theme } from '../../types'; + export default { name: 'darkTeal', anchor: 'rgb(0, 132, 132)', @@ -36,4 +38,4 @@ export default { materialTextInvert: 'rgb(255, 255, 255)', progress: 'rgb(0, 128, 128)', tooltip: 'rgb(0, 32, 32)' -}; +} as Theme; diff --git a/src/common/themes/denim.js b/src/common/themes/denim.ts similarity index 96% rename from src/common/themes/denim.js rename to src/common/themes/denim.ts index b2782a0f..6910bcf2 100644 --- a/src/common/themes/denim.js +++ b/src/common/themes/denim.ts @@ -2,6 +2,8 @@ * https://www.deviantart.com/tpenguinltg/art/Denim-870494744 */ +import { Theme } from '../../types'; + export default { name: 'denim', anchor: 'rgb(0, 0, 128)', @@ -36,4 +38,4 @@ export default { materialTextInvert: 'rgb(255, 255, 255)', progress: 'rgb(10, 36, 106)', tooltip: 'rgb(255, 255, 225)' -}; +} as Theme; diff --git a/src/common/themes/eggplant.js b/src/common/themes/eggplant.ts similarity index 94% rename from src/common/themes/eggplant.js rename to src/common/themes/eggplant.ts index 739d5dd6..02456b02 100644 --- a/src/common/themes/eggplant.js +++ b/src/common/themes/eggplant.ts @@ -1,3 +1,5 @@ +import { Theme } from '../../types'; + export default { name: 'eggplant', @@ -31,4 +33,4 @@ export default { materialTextInvert: '#ffffff', progress: '#4b8178', tooltip: '#fefbcc' -}; +} as Theme; diff --git a/src/common/themes/fxDev.js b/src/common/themes/fxDev.ts similarity index 96% rename from src/common/themes/fxDev.js rename to src/common/themes/fxDev.ts index 205eea4b..67e3a635 100644 --- a/src/common/themes/fxDev.js +++ b/src/common/themes/fxDev.ts @@ -2,6 +2,8 @@ * https://www.deviantart.com/tpenguinltg/art/FxDev-701274128 */ +import { Theme } from '../../types'; + export default { name: 'fxDev', anchor: 'rgb(47, 138, 202)', @@ -36,4 +38,4 @@ export default { materialTextInvert: 'rgb(255, 255, 255)', progress: 'rgb(7, 77, 117)', tooltip: 'rgb(243, 242, 219)' -}; +} as Theme; diff --git a/src/common/themes/highContrast.js b/src/common/themes/highContrast.ts similarity index 94% rename from src/common/themes/highContrast.js rename to src/common/themes/highContrast.ts index de7dd0a2..6319990c 100644 --- a/src/common/themes/highContrast.js +++ b/src/common/themes/highContrast.ts @@ -1,3 +1,5 @@ +import { Theme } from '../../types'; + export default { name: 'highContrast', @@ -31,4 +33,4 @@ export default { materialTextInvert: '#ffffff', progress: '#8e0284', tooltip: '#fefbcc' -}; +} as Theme; diff --git a/src/common/themes/honey.js b/src/common/themes/honey.ts similarity index 96% rename from src/common/themes/honey.js rename to src/common/themes/honey.ts index 2f4a1d35..47aa9c7b 100644 --- a/src/common/themes/honey.js +++ b/src/common/themes/honey.ts @@ -2,6 +2,8 @@ * https://www.deviantart.com/tpenguinltg/art/Honey-632126512 */ +import { Theme } from '../../types'; + export default { name: 'honey', anchor: 'rgb(128, 128, 0)', @@ -36,4 +38,4 @@ export default { materialTextInvert: 'rgb(255, 255, 0)', progress: 'rgb(170, 123, 0)', tooltip: 'rgb(255, 220, 128)' -}; +} as Theme; diff --git a/src/common/themes/hotChocolate.js b/src/common/themes/hotChocolate.ts similarity index 96% rename from src/common/themes/hotChocolate.js rename to src/common/themes/hotChocolate.ts index 8f1d0509..670a4f55 100644 --- a/src/common/themes/hotChocolate.js +++ b/src/common/themes/hotChocolate.ts @@ -2,6 +2,8 @@ * https://www.deviantart.com/tpenguinltg/art/Hot-Chocolate-654380979 */ +import { Theme } from '../../types'; + export default { name: 'hotChocolate', anchor: 'rgb(128, 96, 64)', @@ -36,4 +38,4 @@ export default { materialTextInvert: 'rgb(255, 255, 255)', progress: 'rgb(128, 96, 64)', tooltip: 'rgb(219, 200, 181)' -}; +} as Theme; diff --git a/src/common/themes/hotdogStand.js b/src/common/themes/hotdogStand.ts similarity index 96% rename from src/common/themes/hotdogStand.js rename to src/common/themes/hotdogStand.ts index 0ce38537..9bcc152e 100644 --- a/src/common/themes/hotdogStand.js +++ b/src/common/themes/hotdogStand.ts @@ -2,6 +2,8 @@ * https://www.deviantart.com/tpenguinltg/art/Hotdog-Stand-525606846 */ +import { Theme } from '../../types'; + export default { name: 'hotdogStand', anchor: 'rgb(255, 255, 0)', @@ -35,4 +37,4 @@ export default { materialTextInvert: 'rgb(255, 255, 255)', progress: 'rgb(0, 0, 0)', tooltip: 'rgb(255, 255, 225)' -}; +} as Theme; diff --git a/src/common/themes/lilac.js b/src/common/themes/lilac.ts similarity index 94% rename from src/common/themes/lilac.js rename to src/common/themes/lilac.ts index 8a88080e..07a6722d 100644 --- a/src/common/themes/lilac.js +++ b/src/common/themes/lilac.ts @@ -1,3 +1,5 @@ +import { Theme } from '../../types'; + export default { name: 'lilac', @@ -31,4 +33,4 @@ export default { materialTextInvert: '#ffffff', progress: '#5e4dba', tooltip: '#fefbcc' -}; +} as Theme; diff --git a/src/common/themes/lilacRoseDark.js b/src/common/themes/lilacRoseDark.ts similarity index 94% rename from src/common/themes/lilacRoseDark.js rename to src/common/themes/lilacRoseDark.ts index 3474744c..3b90b2a9 100644 --- a/src/common/themes/lilacRoseDark.js +++ b/src/common/themes/lilacRoseDark.ts @@ -1,3 +1,5 @@ +import { Theme } from '../../types'; + export default { name: 'lilacRoseDark', @@ -32,4 +34,4 @@ export default { materialTextInvert: '#ecbfe3', progress: '#713259', tooltip: '#fefbcc' -}; +} as Theme; diff --git a/src/common/themes/maple.js b/src/common/themes/maple.ts similarity index 94% rename from src/common/themes/maple.js rename to src/common/themes/maple.ts index 7974825c..ea8fce75 100644 --- a/src/common/themes/maple.js +++ b/src/common/themes/maple.ts @@ -1,3 +1,5 @@ +import { Theme } from '../../types'; + export default { name: 'maple', @@ -31,4 +33,4 @@ export default { materialTextInvert: '#ffffff', progress: '#8e0101', tooltip: '#fefbcc' -}; +} as Theme; diff --git a/src/common/themes/marine.js b/src/common/themes/marine.ts similarity index 94% rename from src/common/themes/marine.js rename to src/common/themes/marine.ts index 5d33055a..e00979c8 100644 --- a/src/common/themes/marine.js +++ b/src/common/themes/marine.ts @@ -1,3 +1,5 @@ +import { Theme } from '../../types'; + export default { name: 'marine', @@ -31,4 +33,4 @@ export default { materialTextInvert: '#ffffff', progress: '#000080', tooltip: '#fefbcc' -}; +} as Theme; diff --git a/src/common/themes/matrix.js b/src/common/themes/matrix.ts similarity index 94% rename from src/common/themes/matrix.js rename to src/common/themes/matrix.ts index 476b3de0..52d0e2e5 100644 --- a/src/common/themes/matrix.js +++ b/src/common/themes/matrix.ts @@ -1,3 +1,5 @@ +import { Theme } from '../../types'; + export default { name: 'matrix', @@ -31,4 +33,4 @@ export default { materialTextInvert: '#ffffff', progress: '#000000', tooltip: '#fefbcc' -}; +} as Theme; diff --git a/src/common/themes/millenium.js b/src/common/themes/millenium.ts similarity index 94% rename from src/common/themes/millenium.js rename to src/common/themes/millenium.ts index ad3d6e58..e455031c 100644 --- a/src/common/themes/millenium.js +++ b/src/common/themes/millenium.ts @@ -1,3 +1,5 @@ +import { Theme } from '../../types'; + export default { name: 'millenium', @@ -31,4 +33,4 @@ export default { materialTextInvert: '#ffffff', progress: '#00256e', tooltip: '#fefbcc' -}; +} as Theme; diff --git a/src/common/themes/modernDark.js b/src/common/themes/modernDark.ts similarity index 94% rename from src/common/themes/modernDark.js rename to src/common/themes/modernDark.ts index 58633087..e49b85ad 100644 --- a/src/common/themes/modernDark.js +++ b/src/common/themes/modernDark.ts @@ -1,3 +1,5 @@ +import { Theme } from '../../types'; + export default { name: 'modernDark', @@ -31,4 +33,4 @@ export default { materialTextInvert: '#202127', progress: '#f88702', tooltip: '#fefbcc' -}; +} as Theme; diff --git a/src/common/themes/molecule.js b/src/common/themes/molecule.ts similarity index 94% rename from src/common/themes/molecule.js rename to src/common/themes/molecule.ts index 7ae8da55..cc6ad0c3 100644 --- a/src/common/themes/molecule.js +++ b/src/common/themes/molecule.ts @@ -1,3 +1,5 @@ +import { Theme } from '../../types'; + export default { name: 'molecule', @@ -31,4 +33,4 @@ export default { materialTextInvert: '#f1f5f6', progress: '#a03d49', tooltip: '#fefbcc' -}; +} as Theme; diff --git a/src/common/themes/monochrome.js b/src/common/themes/monochrome.ts similarity index 100% rename from src/common/themes/monochrome.js rename to src/common/themes/monochrome.ts diff --git a/src/common/themes/ninjaTurtles.js b/src/common/themes/ninjaTurtles.ts similarity index 94% rename from src/common/themes/ninjaTurtles.js rename to src/common/themes/ninjaTurtles.ts index 0fd91616..88277a69 100644 --- a/src/common/themes/ninjaTurtles.js +++ b/src/common/themes/ninjaTurtles.ts @@ -1,3 +1,5 @@ +import { Theme } from '../../types'; + export default { name: 'ninjaTurtles', @@ -31,4 +33,4 @@ export default { materialTextInvert: '#000000', progress: '#FF1D15', tooltip: '#fefbcc' -}; +} as Theme; diff --git a/src/common/themes/olive.js b/src/common/themes/olive.ts similarity index 94% rename from src/common/themes/olive.js rename to src/common/themes/olive.ts index b5d79a43..70a58fae 100644 --- a/src/common/themes/olive.js +++ b/src/common/themes/olive.ts @@ -1,3 +1,5 @@ +import { Theme } from '../../types'; + export default { name: 'olive', @@ -31,4 +33,4 @@ export default { materialTextInvert: '#000000', progress: '#F3DE2C', tooltip: '#fefbcc' -}; +} as Theme; diff --git a/src/common/themes/original.js b/src/common/themes/original.ts similarity index 94% rename from src/common/themes/original.js rename to src/common/themes/original.ts index f52352fa..f8c9dc30 100644 --- a/src/common/themes/original.js +++ b/src/common/themes/original.ts @@ -1,3 +1,5 @@ +import { Theme } from '../../types'; + export default { name: 'original', @@ -31,4 +33,4 @@ export default { materialTextInvert: '#fefefe', progress: '#060084', tooltip: '#fefbcc' -}; +} as Theme; diff --git a/src/common/themes/pamelaAnderson.js b/src/common/themes/pamelaAnderson.ts similarity index 94% rename from src/common/themes/pamelaAnderson.js rename to src/common/themes/pamelaAnderson.ts index 0e7667c3..406ccbb8 100644 --- a/src/common/themes/pamelaAnderson.js +++ b/src/common/themes/pamelaAnderson.ts @@ -1,3 +1,5 @@ +import { Theme } from '../../types'; + export default { name: 'pamelaAnderson', @@ -31,4 +33,4 @@ export default { materialTextInvert: '#F1E4E8', progress: '#004FFF', tooltip: '#fefbcc' -}; +} as Theme; diff --git a/src/common/themes/peggysPastels.js b/src/common/themes/peggysPastels.ts similarity index 96% rename from src/common/themes/peggysPastels.js rename to src/common/themes/peggysPastels.ts index 567d6af4..fdde7824 100644 --- a/src/common/themes/peggysPastels.js +++ b/src/common/themes/peggysPastels.ts @@ -2,6 +2,8 @@ * https://www.deviantart.com/tpenguinltg/art/Peggy-s-Pastels-505540096 */ +import { Theme } from '../../types'; + export default { name: 'peggysPastels', anchor: 'rgb(0, 128, 128)', @@ -36,4 +38,4 @@ export default { materialTextInvert: 'rgb(0, 0, 0)', progress: 'rgb(162, 219, 210)', tooltip: 'rgb(204, 255, 255)' -}; +} as Theme; diff --git a/src/common/themes/plum.js b/src/common/themes/plum.ts similarity index 94% rename from src/common/themes/plum.js rename to src/common/themes/plum.ts index 2d95ddea..5afdca30 100644 --- a/src/common/themes/plum.js +++ b/src/common/themes/plum.ts @@ -1,3 +1,5 @@ +import { Theme } from '../../types'; + export default { name: 'plum', @@ -31,4 +33,4 @@ export default { materialTextInvert: '#ffffff', progress: '#483f63', tooltip: '#fefbcc' -}; +} as Theme; diff --git a/src/common/themes/polarized.js b/src/common/themes/polarized.ts similarity index 96% rename from src/common/themes/polarized.js rename to src/common/themes/polarized.ts index 6361bee6..823881ce 100644 --- a/src/common/themes/polarized.js +++ b/src/common/themes/polarized.ts @@ -2,6 +2,8 @@ * https://www.deviantart.com/tpenguinltg/art/Polarized-557712217 */ +import { Theme } from '../../types'; + export default { name: 'polarized', anchor: 'rgb(160, 160, 128)', @@ -36,4 +38,4 @@ export default { materialTextInvert: 'rgb(0, 0, 255)', progress: 'rgb(192, 192, 64)', tooltip: 'rgb(16, 16, 240)' -}; +} as Theme; diff --git a/src/common/themes/powerShell.js b/src/common/themes/powerShell.ts similarity index 96% rename from src/common/themes/powerShell.js rename to src/common/themes/powerShell.ts index 461d3d38..936c35ce 100644 --- a/src/common/themes/powerShell.js +++ b/src/common/themes/powerShell.ts @@ -2,6 +2,8 @@ * https://www.deviantart.com/tpenguinltg/art/PowerShell-646065752 */ +import { Theme } from '../../types'; + export default { name: 'powerShell', anchor: 'rgb(0, 192, 0)', @@ -35,4 +37,4 @@ export default { materialTextInvert: 'rgb(255, 255, 255)', progress: 'rgb(0, 128, 128)', tooltip: 'rgb(255, 255, 225)' -}; +} as Theme; diff --git a/src/common/themes/rainyDay.js b/src/common/themes/rainyDay.ts similarity index 94% rename from src/common/themes/rainyDay.js rename to src/common/themes/rainyDay.ts index b61581ae..b6a74ca8 100644 --- a/src/common/themes/rainyDay.js +++ b/src/common/themes/rainyDay.ts @@ -1,3 +1,5 @@ +import { Theme } from '../../types'; + export default { name: 'rainyDay', @@ -31,4 +33,4 @@ export default { materialTextInvert: '#ffffff', progress: '#4b6480', tooltip: '#fefbcc' -}; +} as Theme; diff --git a/src/common/themes/raspberry.js b/src/common/themes/raspberry.ts similarity index 96% rename from src/common/themes/raspberry.js rename to src/common/themes/raspberry.ts index cef186cb..be64cc6f 100644 --- a/src/common/themes/raspberry.js +++ b/src/common/themes/raspberry.ts @@ -2,6 +2,8 @@ * https://www.deviantart.com/tpenguinltg/art/Raspberry-539289720 */ +import { Theme } from '../../types'; + export default { name: 'raspberry', anchor: 'rgb(10, 36, 106)', @@ -36,4 +38,4 @@ export default { materialTextInvert: 'rgb(255, 255, 255)', progress: 'rgb(10, 36, 106)', tooltip: 'rgb(255, 255, 225)' -}; +} as Theme; diff --git a/src/common/themes/redWine.js b/src/common/themes/redWine.ts similarity index 96% rename from src/common/themes/redWine.js rename to src/common/themes/redWine.ts index be4f46f2..083c2ce7 100644 --- a/src/common/themes/redWine.js +++ b/src/common/themes/redWine.ts @@ -2,6 +2,8 @@ * https://www.deviantart.com/tpenguinltg/art/Red-Wine-545729607 */ +import { Theme } from '../../types'; + export default { name: 'redWine', anchor: 'rgb(255, 0, 0)', @@ -36,4 +38,4 @@ export default { materialTextInvert: 'rgb(255, 255, 255)', progress: 'rgb(192, 0, 0)', tooltip: 'rgb(64, 0, 0)' -}; +} as Theme; diff --git a/src/common/themes/rose.js b/src/common/themes/rose.ts similarity index 94% rename from src/common/themes/rose.js rename to src/common/themes/rose.ts index b51de610..dfd31bea 100644 --- a/src/common/themes/rose.js +++ b/src/common/themes/rose.ts @@ -1,3 +1,5 @@ +import { Theme } from '../../types'; + export default { name: 'rose', @@ -31,4 +33,4 @@ export default { materialTextInvert: '#ffffff', progress: '#ab5a71', tooltip: '#fefbcc' -}; +} as Theme; diff --git a/src/common/themes/seawater.js b/src/common/themes/seawater.ts similarity index 96% rename from src/common/themes/seawater.js rename to src/common/themes/seawater.ts index 37c351b1..24aa747b 100644 --- a/src/common/themes/seawater.js +++ b/src/common/themes/seawater.ts @@ -2,6 +2,8 @@ * https://www.deviantart.com/tpenguinltg/art/Seawater-736002425 */ +import { Theme } from '../../types'; + export default { name: 'seawater', anchor: 'rgb(0, 0, 128)', @@ -35,4 +37,4 @@ export default { materialTextInvert: 'rgb(255, 255, 255)', progress: 'rgb(0, 128, 128)', tooltip: 'rgb(255, 255, 225)' -}; +} as Theme; diff --git a/src/common/themes/shelbiTeal.js b/src/common/themes/shelbiTeal.ts similarity index 96% rename from src/common/themes/shelbiTeal.js rename to src/common/themes/shelbiTeal.ts index 88d88729..32e58d0a 100644 --- a/src/common/themes/shelbiTeal.js +++ b/src/common/themes/shelbiTeal.ts @@ -2,6 +2,8 @@ * https://www.deviantart.com/tpenguinltg/art/Teal-for-Shelbi-506118460 */ +import { Theme } from '../../types'; + export default { name: 'shelbiTeal', anchor: 'rgb(0, 128, 128)', @@ -36,4 +38,4 @@ export default { materialTextInvert: 'rgb(255, 255, 255)', progress: 'rgb(0, 128, 128)', tooltip: 'rgb(224, 255, 255)' -}; +} as Theme; diff --git a/src/common/themes/slate.js b/src/common/themes/slate.ts similarity index 94% rename from src/common/themes/slate.js rename to src/common/themes/slate.ts index d40bd159..85013719 100644 --- a/src/common/themes/slate.js +++ b/src/common/themes/slate.ts @@ -1,3 +1,5 @@ +import { Theme } from '../../types'; + export default { name: 'slate', @@ -31,4 +33,4 @@ export default { materialTextInvert: '#f2ffff', progress: '#448199', tooltip: '#fefbcc' -}; +} as Theme; diff --git a/src/common/themes/solarizedDark.js b/src/common/themes/solarizedDark.ts similarity index 96% rename from src/common/themes/solarizedDark.js rename to src/common/themes/solarizedDark.ts index 46c08f17..913d0f12 100644 --- a/src/common/themes/solarizedDark.js +++ b/src/common/themes/solarizedDark.ts @@ -2,6 +2,8 @@ * https://www.deviantart.com/tpenguinltg/art/Solarized-Dark-592122068 */ +import { Theme } from '../../types'; + export default { name: 'solarizedDark', anchor: 'rgb(38, 139, 210)', @@ -35,4 +37,4 @@ export default { materialTextInvert: 'rgb(238, 232, 213)', progress: 'rgb(211, 54, 130)', tooltip: 'rgb(253, 246, 227)' -}; +} as Theme; diff --git a/src/common/themes/solarizedLight.js b/src/common/themes/solarizedLight.ts similarity index 96% rename from src/common/themes/solarizedLight.js rename to src/common/themes/solarizedLight.ts index 3b4e8c82..19e26cac 100644 --- a/src/common/themes/solarizedLight.js +++ b/src/common/themes/solarizedLight.ts @@ -2,6 +2,8 @@ * https://www.deviantart.com/tpenguinltg/art/Solarized-Light-592124935 */ +import { Theme } from '../../types'; + export default { name: 'solarizedLight', anchor: 'rgb(38, 139, 210)', @@ -36,4 +38,4 @@ export default { materialTextInvert: 'rgb(238, 232, 213)', progress: 'rgb(211, 54, 130)', tooltip: 'rgb(253, 246, 227)' -}; +} as Theme; diff --git a/src/common/themes/spruce.js b/src/common/themes/spruce.ts similarity index 94% rename from src/common/themes/spruce.js rename to src/common/themes/spruce.ts index 6f61807a..dcae06e3 100644 --- a/src/common/themes/spruce.js +++ b/src/common/themes/spruce.ts @@ -1,3 +1,5 @@ +import { Theme } from '../../types'; + export default { name: 'spruce', @@ -31,4 +33,4 @@ export default { materialTextInvert: '#fcfff6', progress: '#3d9961', tooltip: '#fefbcc' -}; +} as Theme; diff --git a/src/common/themes/stormClouds.js b/src/common/themes/stormClouds.ts similarity index 96% rename from src/common/themes/stormClouds.js rename to src/common/themes/stormClouds.ts index 990db4e6..087510a0 100644 --- a/src/common/themes/stormClouds.js +++ b/src/common/themes/stormClouds.ts @@ -2,6 +2,8 @@ * https://www.deviantart.com/tpenguinltg/art/Storm-Clouds-613198674 */ +import { Theme } from '../../types'; + export default { name: 'stormClouds', anchor: 'rgb(64, 64, 255)', @@ -36,4 +38,4 @@ export default { materialTextInvert: 'rgb(255, 255, 255)', progress: 'rgb(128, 128, 0)', tooltip: 'rgb(48, 64, 80)' -}; +} as Theme; diff --git a/src/common/themes/theSixtiesUSA.js b/src/common/themes/theSixtiesUSA.ts similarity index 94% rename from src/common/themes/theSixtiesUSA.js rename to src/common/themes/theSixtiesUSA.ts index 5709372c..bb1605d4 100644 --- a/src/common/themes/theSixtiesUSA.js +++ b/src/common/themes/theSixtiesUSA.ts @@ -1,3 +1,5 @@ +import { Theme } from '../../types'; + export default { name: 'theSixtiesUSA', @@ -31,4 +33,4 @@ export default { materialTextInvert: '#010001', progress: '#0f0', tooltip: '#fefbcc' -}; +} as Theme; diff --git a/src/common/themes/tokyoDark.js b/src/common/themes/tokyoDark.ts similarity index 94% rename from src/common/themes/tokyoDark.js rename to src/common/themes/tokyoDark.ts index 9bf6a0d4..2bd0b1a4 100644 --- a/src/common/themes/tokyoDark.js +++ b/src/common/themes/tokyoDark.ts @@ -1,3 +1,5 @@ +import { Theme } from '../../types'; + export default { name: 'tokyoDark', @@ -31,4 +33,4 @@ export default { materialTextInvert: '#ffffff', progress: '#F61067', tooltip: '#fefbcc' -}; +} as Theme; diff --git a/src/common/themes/toner.js b/src/common/themes/toner.ts similarity index 96% rename from src/common/themes/toner.js rename to src/common/themes/toner.ts index 873fa68e..97d6f7f7 100644 --- a/src/common/themes/toner.js +++ b/src/common/themes/toner.ts @@ -2,6 +2,8 @@ * https://www.deviantart.com/tpenguinltg/art/Toner-871968986 */ +import { Theme } from '../../types'; + export default { name: 'toner', anchor: 'rgb(0, 0, 128)', @@ -36,4 +38,4 @@ export default { materialTextInvert: 'rgb(0, 0, 0)', progress: 'rgb(255, 255, 255)', tooltip: 'rgb(128, 128, 128)' -}; +} as Theme; diff --git a/src/common/themes/tooSexy.js b/src/common/themes/tooSexy.ts similarity index 94% rename from src/common/themes/tooSexy.js rename to src/common/themes/tooSexy.ts index 31982aa7..b8f74deb 100644 --- a/src/common/themes/tooSexy.js +++ b/src/common/themes/tooSexy.ts @@ -1,3 +1,5 @@ +import { Theme } from '../../types'; + export default { name: 'tooSexy', @@ -31,4 +33,4 @@ export default { materialTextInvert: '#ffffff', progress: '#474973', tooltip: '#fefbcc' -}; +} as Theme; diff --git a/src/common/themes/travel.js b/src/common/themes/travel.ts similarity index 94% rename from src/common/themes/travel.js rename to src/common/themes/travel.ts index 3f15f05a..aa670ab3 100644 --- a/src/common/themes/travel.js +++ b/src/common/themes/travel.ts @@ -1,3 +1,5 @@ +import { Theme } from '../../types'; + export default { name: 'travel', @@ -31,4 +33,4 @@ export default { materialTextInvert: '#ffffff', progress: '#48604f', tooltip: '#fefbcc' -}; +} as Theme; diff --git a/src/common/themes/vaporTeal.js b/src/common/themes/vaporTeal.ts similarity index 94% rename from src/common/themes/vaporTeal.js rename to src/common/themes/vaporTeal.ts index c173bd9f..e1fe32f4 100644 --- a/src/common/themes/vaporTeal.js +++ b/src/common/themes/vaporTeal.ts @@ -1,3 +1,5 @@ +import { Theme } from '../../types'; + export default { name: 'vaporTeal', @@ -31,4 +33,4 @@ export default { materialTextInvert: '#000000', progress: '#FF99C8', tooltip: '#fefbcc' -}; +} as Theme; diff --git a/src/common/themes/vermillion.js b/src/common/themes/vermillion.ts similarity index 94% rename from src/common/themes/vermillion.js rename to src/common/themes/vermillion.ts index e94f949e..cd256cc9 100644 --- a/src/common/themes/vermillion.js +++ b/src/common/themes/vermillion.ts @@ -1,3 +1,5 @@ +import { Theme } from '../../types'; + export default { name: 'vermillion', @@ -31,4 +33,4 @@ export default { materialTextInvert: '#EFE9F4', progress: '#000103', tooltip: '#fefbcc' -}; +} as Theme; diff --git a/src/common/themes/violetDark.js b/src/common/themes/violetDark.ts similarity index 94% rename from src/common/themes/violetDark.js rename to src/common/themes/violetDark.ts index 921a7d86..13a614c9 100644 --- a/src/common/themes/violetDark.js +++ b/src/common/themes/violetDark.ts @@ -1,3 +1,5 @@ +import { Theme } from '../../types'; + export default { name: 'violetDark', @@ -31,4 +33,4 @@ export default { materialTextInvert: '#c47bcc', progress: '#000080', tooltip: '#fefbcc' -}; +} as Theme; diff --git a/src/common/themes/vistaesqueMidnight.js b/src/common/themes/vistaesqueMidnight.ts similarity index 96% rename from src/common/themes/vistaesqueMidnight.js rename to src/common/themes/vistaesqueMidnight.ts index 514146fe..3af93809 100644 --- a/src/common/themes/vistaesqueMidnight.js +++ b/src/common/themes/vistaesqueMidnight.ts @@ -2,6 +2,8 @@ * https://www.deviantart.com/tpenguinltg/art/Vista-esque-Midnight-557498234 */ +import { Theme } from '../../types'; + export default { name: 'vistaesqueMidnight', anchor: 'rgb(64, 64, 192)', @@ -36,4 +38,4 @@ export default { materialTextInvert: 'rgb(255, 255, 255)', progress: 'rgb(49, 106, 197)', tooltip: 'rgb(0, 0, 30)' -}; +} as Theme; diff --git a/src/common/themes/water.js b/src/common/themes/water.ts similarity index 94% rename from src/common/themes/water.js rename to src/common/themes/water.ts index 429711c2..83e902b3 100644 --- a/src/common/themes/water.js +++ b/src/common/themes/water.ts @@ -1,3 +1,5 @@ +import { Theme } from '../../types'; + export default { name: 'water', @@ -31,4 +33,4 @@ export default { materialTextInvert: '#ffffff', progress: '#72b3b4', tooltip: '#fefbcc' -}; +} as Theme; diff --git a/src/common/themes/white.js b/src/common/themes/white.ts similarity index 96% rename from src/common/themes/white.js rename to src/common/themes/white.ts index e885b85e..6655e25f 100644 --- a/src/common/themes/white.js +++ b/src/common/themes/white.ts @@ -2,6 +2,8 @@ * https://www.deviantart.com/tpenguinltg/art/White-870495714 */ +import { Theme } from '../../types'; + export default { name: 'white', anchor: 'rgb(0, 0, 128)', @@ -35,4 +37,4 @@ export default { materialTextInvert: 'rgb(255, 255, 255)', progress: 'rgb(0, 0, 128)', tooltip: 'rgb(255, 255, 128)' -}; +} as Theme; diff --git a/src/common/themes/windows1.js b/src/common/themes/windows1.ts similarity index 96% rename from src/common/themes/windows1.js rename to src/common/themes/windows1.ts index ffe617ce..ba0acf68 100644 --- a/src/common/themes/windows1.js +++ b/src/common/themes/windows1.ts @@ -2,6 +2,8 @@ * https://www.deviantart.com/tpenguinltg/art/Windows-1-573195578 */ +import { Theme } from '../../types'; + export default { name: 'windows1', anchor: 'rgb(0, 0, 85)', @@ -35,4 +37,4 @@ export default { materialTextInvert: 'rgb(255, 255, 255)', progress: 'rgb(0, 0, 0)', tooltip: 'rgb(255, 255, 85)' -}; +} as Theme; diff --git a/src/common/themes/wmii.js b/src/common/themes/wmii.ts similarity index 96% rename from src/common/themes/wmii.js rename to src/common/themes/wmii.ts index 7e7c5eab..5eee2e77 100644 --- a/src/common/themes/wmii.js +++ b/src/common/themes/wmii.ts @@ -2,6 +2,8 @@ * https://www.deviantart.com/tpenguinltg/art/wmii-683233676 */ +import { Theme } from '../../types'; + export default { name: 'wmii', anchor: 'rgb(129, 101, 79)', @@ -36,4 +38,4 @@ export default { materialTextInvert: 'rgb(255, 255, 255)', progress: 'rgb(0, 0, 0)', tooltip: 'rgb(255, 255, 225)' -}; +} as Theme; diff --git a/src/common/utils/index.spec.js b/src/common/utils/index.spec.ts similarity index 100% rename from src/common/utils/index.spec.js rename to src/common/utils/index.spec.ts diff --git a/src/common/utils/index.js b/src/common/utils/index.ts similarity index 80% rename from src/common/utils/index.js rename to src/common/utils/index.ts index 1ea27923..7b8b6d6c 100644 --- a/src/common/utils/index.js +++ b/src/common/utils/index.ts @@ -1,6 +1,8 @@ +import { WindowsTheme } from '../../types'; + export const noOp = () => {}; -export function clamp(value, min, max) { +export function clamp(value: number, min: number | null, max: number | null) { if (max !== null && value > max) { return max; } @@ -10,27 +12,24 @@ export function clamp(value, min, max) { return value; } -function linearGradient(left, right) { +function linearGradient(left: string, right: string) { return `linear-gradient(to right, ${left}, ${right})`; } -export function mapFromWindowsTheme(name, windowsTheme, useGradients) { - /* eslint-disable no-unused-vars, @typescript-eslint/no-unused-vars */ +export function mapFromWindowsTheme( + name: string, + windowsTheme: WindowsTheme, + useGradients: boolean +) { const { - ButtonAlternateFace, ButtonDkShadow, ButtonFace, ButtonHilight, ButtonLight, ButtonShadow, ButtonText, - ActiveBorder, - AppWorkspace, Background, - InactiveBorder, - Scrollbar, Window, - WindowFrame, WindowText, ActiveTitle, GradientActiveTitle, @@ -38,18 +37,12 @@ export function mapFromWindowsTheme(name, windowsTheme, useGradients) { InactiveTitle, InactiveTitleText, TitleText, - Menu, - MenuBar, - MenuHilight, - MenuText, GrayText, Hilight, HilightText, HotTrackingColor, - InfoText, InfoWindow } = windowsTheme; - /* eslint-enable no-unused-vars, @typescript-eslint/no-unused-vars */ return { name, @@ -92,7 +85,7 @@ export function mapFromWindowsTheme(name, windowsTheme, useGradients) { } // helper functions below are from Material UI (https://github.com/mui-org/material-ui) -export function getDecimalPrecision(num) { +export function getDecimalPrecision(num: number) { if (Math.abs(num) < 1) { const parts = num.toExponential().split('e-'); const matissaDecimalPart = parts[0].split('.')[1]; @@ -106,7 +99,7 @@ export function getDecimalPrecision(num) { return decimalPart ? decimalPart.length : 0; } -export function roundValueToStep(value, step, min) { +export function roundValueToStep(value: number, step: number, min: number) { const nearest = Math.round((value - min) / step) * step + min; return Number(nearest.toFixed(getDecimalPrecision(step))); }