This commit is contained in:
Chris Trevino 2022-02-09 14:31:52 -08:00
Родитель ff0e2a26df
Коммит 339e4d2827
40 изменённых файлов: 214 добавлений и 1448 удалений

Просмотреть файл

@ -1,11 +0,0 @@
/*!
* Copyright (c) Microsoft. All rights reserved.
* Licensed under the MIT license. See LICENSE file in the project.
*/
module.exports = {
presets: [
['@babel/preset-env', { targets: { node: 'current' } }],
'@babel/preset-typescript',
['@babel/preset-react', { runtime: 'automatic' }],
],
}

Просмотреть файл

@ -24,10 +24,6 @@
] ]
}, },
"devDependencies": { "devDependencies": {
"@babel/core": "^7.16.0",
"@babel/preset-env": "^7.16.4",
"@babel/preset-react": "^7.16.0",
"@babel/preset-typescript": "^7.16.0",
"@essex/eslint-config": "^20.0.0", "@essex/eslint-config": "^20.0.0",
"@essex/eslint-plugin": "^20.0.0", "@essex/eslint-plugin": "^20.0.0",
"@essex/jest-config": "^20.0.0", "@essex/jest-config": "^20.0.0",
@ -48,7 +44,6 @@
"react": "^17.0.2", "react": "^17.0.2",
"react-dom": "^17.0.2", "react-dom": "^17.0.2",
"regenerator-runtime": "^0.13.9", "regenerator-runtime": "^0.13.9",
"ts-jest": "^27.1.2",
"typescript": "^4.5.5" "typescript": "^4.5.5"
}, },
"prettier": "@essex/prettier-config" "prettier": "@essex/prettier-config"

Просмотреть файл

@ -26,7 +26,7 @@
}, },
"devDependencies": { "devDependencies": {
"@essex/scripts": "^20.0.1", "@essex/scripts": "^20.0.1",
"@essex/tsconfig-base": "^1.0.0", "@essex/tsconfig-base": "^1.0.1",
"@types/chroma-js": "^2.1.3", "@types/chroma-js": "^2.1.3",
"@types/node": "^14.18.5" "@types/node": "^14.18.5"
}, },

Просмотреть файл

@ -31,7 +31,7 @@
}, },
"devDependencies": { "devDependencies": {
"@essex/scripts": "^20.0.1", "@essex/scripts": "^20.0.1",
"@essex/tsconfig-base": "^1.0.0", "@essex/tsconfig-base": "^1.0.1",
"@types/d3-scale": "^2.2.6", "@types/d3-scale": "^2.2.6",
"@types/jest": "^26.0.24", "@types/jest": "^26.0.24",
"@types/lodash": "^4.14.178", "@types/lodash": "^4.14.178",

Просмотреть файл

@ -4,7 +4,7 @@
*/ */
import { Theme, ThemeVariant, Transformer } from '../types/index.js' import { Theme, ThemeVariant, Transformer } from '../types/index.js'
export interface OfficeTheme { export type OfficeTheme = {
dark1: string dark1: string
light1: string light1: string
dark2: string dark2: string

Просмотреть файл

@ -26,7 +26,7 @@
}, },
"devDependencies": { "devDependencies": {
"@essex/scripts": "^20.0.1", "@essex/scripts": "^20.0.1",
"@essex/tsconfig-base": "^1.0.0", "@essex/tsconfig-base": "^1.0.1",
"@types/d3-axis": "^1.0.16", "@types/d3-axis": "^1.0.16",
"@types/d3-selection": "^1.4.3", "@types/d3-selection": "^1.4.3",
"@types/node": "^14.18.5" "@types/node": "^14.18.5"

Просмотреть файл

@ -16,19 +16,19 @@ export interface SelectionOptions {
/** /**
* This is a map of event handlers to apply to the selection. * This is a map of event handlers to apply to the selection.
*/ */
on?: { [key: string]: any } on: { [key: string]: any }
/** /**
* This is a map of ad-hoc attrs to apply to the selection. * This is a map of ad-hoc attrs to apply to the selection.
*/ */
attr?: { [key: string]: any } attr: { [key: string]: any }
/** /**
* Map of ad-hoc classes to add or remove from the selection. * Map of ad-hoc classes to add or remove from the selection.
*/ */
classed?: { [key: string]: any } classed: { [key: string]: any }
/** /**
* Map of ad-hoc styles to add or remove from the selection. * Map of ad-hoc styles to add or remove from the selection.
*/ */
style?: { [key: string]: any } style: { [key: string]: any }
} }
export interface ChartOptions extends SelectionOptions { export interface ChartOptions extends SelectionOptions {
@ -45,7 +45,7 @@ export interface PlotAreaOptions extends ChartOptions {
function getSelectionOptions( function getSelectionOptions(
_selection: Selection<Element, any, Element, any>, _selection: Selection<Element, any, Element, any>,
options?: SelectionOptions, options?: Partial<SelectionOptions>,
): SelectionOptions { ): SelectionOptions {
const _on = (options && options.on) || {} const _on = (options && options.on) || {}
const _attr = (options && options.attr) || {} const _attr = (options && options.attr) || {}
@ -64,15 +64,15 @@ function getChartOptions(
const height = h || +selection.attr('height') || 0 const height = h || +selection.attr('height') || 0
const sOpts = getSelectionOptions(selection, options) const sOpts = getSelectionOptions(selection, options)
return { return {
on: sOpts.on ?? {}, on: sOpts.on,
attr: { attr: {
// stick these on for application later // stick these on for application later
width, width,
height, height,
...sOpts.attr, ...sOpts.attr,
}, },
classed: sOpts.classed ?? {}, classed: sOpts.classed,
style: sOpts.style ?? {}, style: sOpts.style,
} }
} }
@ -104,15 +104,15 @@ function getPlotAreaOptions(
marginBottom, marginBottom,
marginLeft, marginLeft,
marginRight, marginRight,
on: sOpts.on ?? {}, on: sOpts.on,
attr: { attr: {
// stick these on for application later // stick these on for application later
width, width,
height, height,
...sOpts.attr, ...sOpts.attr,
}, },
classed: sOpts.classed ?? {}, classed: sOpts.classed,
style: sOpts.style ?? {}, style: sOpts.style,
} }
} }

Просмотреть файл

@ -28,7 +28,7 @@
}, },
"devDependencies": { "devDependencies": {
"@essex/scripts": "^20.0.1", "@essex/scripts": "^20.0.1",
"@essex/tsconfig-base": "^1.0.0", "@essex/tsconfig-base": "^1.0.1",
"@fluentui/font-icons-mdl2": "^8.1.20", "@fluentui/font-icons-mdl2": "^8.1.20",
"@fluentui/react": "^8.49.0", "@fluentui/react": "^8.49.0",
"@types/chroma-js": "^2.1.3", "@types/chroma-js": "^2.1.3",

Просмотреть файл

@ -53,7 +53,7 @@ export class FluentTheme extends ThemeImpl implements IThematicFluentTheme {
return this._fTheme.semanticColors return this._fTheme.semanticColors
} }
get rtl() { get rtl() {
return this._fTheme.rtl ?? false return this._fTheme.rtl
} }
get spacing() { get spacing() {
return this._fTheme.spacing return this._fTheme.spacing

Просмотреть файл

@ -24,11 +24,11 @@ export interface ColorPickerStyles {
} }
export interface ColorPickerProps { export interface ColorPickerProps {
onChange?: ((theme: Theme) => void) | undefined onChange?: (theme: Theme) => void
/** Optional theme to use, otherwise it will be pulled from context */ /** Optional theme to use, otherwise it will be pulled from context */
theme?: Theme | undefined theme?: Theme
layout?: ColorPickerLayout | undefined layout?: ColorPickerLayout
styles?: ColorPickerStyles | undefined styles?: ColorPickerStyles
} }
export type PartialParams = Partial<Params> export type PartialParams = Partial<Params>

Просмотреть файл

@ -25,7 +25,7 @@
}, },
"devDependencies": { "devDependencies": {
"@essex/scripts": "^20.0.1", "@essex/scripts": "^20.0.1",
"@essex/tsconfig-base": "^1.0.0", "@essex/tsconfig-base": "^1.0.1",
"@types/node": "^14.18.5", "@types/node": "^14.18.5",
"@types/react": "^17.0.38", "@types/react": "^17.0.38",
"react": "^17.0.2" "react": "^17.0.2"

Просмотреть файл

@ -24,7 +24,7 @@
}, },
"devDependencies": { "devDependencies": {
"@essex/scripts": "^20.0.1", "@essex/scripts": "^20.0.1",
"@essex/tsconfig-base": "^1.0.0", "@essex/tsconfig-base": "^1.0.1",
"@types/node": "^14.18.5", "@types/node": "^14.18.5",
"vega": "5.15.0" "vega": "5.15.0"
}, },

Просмотреть файл

@ -43,6 +43,7 @@
"@types/node": "^14.18.5", "@types/node": "^14.18.5",
"@types/react": "^17.0.38", "@types/react": "^17.0.38",
"@types/react-dom": "^17.0.11", "@types/react-dom": "^17.0.11",
"typescript": "^4.5.5",
"vite": "^2.8.0" "vite": "^2.8.0"
}, },
"browserslist": [ "browserslist": [

Просмотреть файл

@ -4,7 +4,7 @@
*/ */
import { ThematicFluentProvider } from '@thematic/fluent' import { ThematicFluentProvider } from '@thematic/fluent'
import { ApplicationStyles } from '@thematic/react' import { ApplicationStyles } from '@thematic/react'
import { FC } from 'react' import type { FC } from 'react'
import { useTheme } from '../../state' import { useTheme } from '../../state'
import { ControlPanel } from '../ControlPanel' import { ControlPanel } from '../ControlPanel'
import { ThemeEditor } from '../ThemeEditor' import { ThemeEditor } from '../ThemeEditor'

Просмотреть файл

@ -4,7 +4,7 @@
*/ */
import './index.css' import './index.css'
import { Theme, Application } from '@thematic/core' import type { Theme, Application } from '@thematic/core'
import { useThematic } from '@thematic/react' import { useThematic } from '@thematic/react'
import { FC, useMemo } from 'react' import { FC, useMemo } from 'react'
import { ColorStrip } from '../ColorStrip' import { ColorStrip } from '../ColorStrip'

Просмотреть файл

@ -27,19 +27,19 @@ export const ColorPalette: FC<ColorPaletteProps> = ({ scaleItemCount }) => {
usePalette() usePalette()
const accent = ( const accent = (
<Fragment> <Fragment>
<span style={{ color: accentColor }}>Accent {accentColor}</span> <span style={{ color: accentColor! }}>Accent {accentColor}</span>
</Fragment> </Fragment>
) )
const background = ( const background = (
<Fragment> <Fragment>
<span style={{ color: foregroundColor }}> <span style={{ color: foregroundColor! }}>
Background {backgroundColor} Background {backgroundColor}
</span> </span>
</Fragment> </Fragment>
) )
const foreground = ( const foreground = (
<Fragment> <Fragment>
<span style={{ color: foregroundColor }}> <span style={{ color: foregroundColor! }}>
Foreground {foregroundColor} Foreground {foregroundColor}
</span> </span>
</Fragment> </Fragment>
@ -59,13 +59,13 @@ export const ColorPalette: FC<ColorPaletteProps> = ({ scaleItemCount }) => {
<div <div
style={{ style={{
border: `1px solid ${foregroundColor}`, border: `1px solid ${foregroundColor}`,
background: backgroundColor, background: backgroundColor!,
padding: '10px 30px 30px 30px', padding: '10px 30px 30px 30px',
color: foregroundColor, color: foregroundColor!,
textAlign: 'left', textAlign: 'left',
}} }}
> >
<h2 style={{ color: foregroundColor }}>Application colors</h2> <h2 style={{ color: foregroundColor! }}>Application colors</h2>
<ApplicationPalette /> <ApplicationPalette />
<ul <ul
style={{ style={{
@ -77,9 +77,9 @@ export const ColorPalette: FC<ColorPaletteProps> = ({ scaleItemCount }) => {
<li> <li>
{foreground} on {background} (contrast ratio:{' '} {foreground} on {background} (contrast ratio:{' '}
<Contrast <Contrast
foreground={foregroundColor} foreground={foregroundColor!}
background={backgroundColor} background={backgroundColor!}
error={errorColor} error={errorColor!}
showLink showLink
/> />
) )
@ -87,15 +87,15 @@ export const ColorPalette: FC<ColorPaletteProps> = ({ scaleItemCount }) => {
<li> <li>
{accent} on {background} (contrast ratio:{' '} {accent} on {background} (contrast ratio:{' '}
<Contrast <Contrast
foreground={accentColor} foreground={accentColor!}
background={backgroundColor} background={backgroundColor!}
error={errorColor} error={errorColor!}
showLink showLink
/> />
) )
</li> </li>
</ul> </ul>
<h2 style={{ color: foregroundColor }}>Scales</h2> <h2 style={{ color: foregroundColor! }}>Scales</h2>
<div <div
style={{ style={{
display: 'flex', display: 'flex',
@ -108,52 +108,52 @@ export const ColorPalette: FC<ColorPaletteProps> = ({ scaleItemCount }) => {
> >
<ColorStrip <ColorStrip
label="Nominal " label="Nominal "
foreground={foregroundColor} foreground={foregroundColor!}
background={backgroundColor} background={backgroundColor!}
colors={nominal} colors={nominal!}
/> />
<ColorStrip <ColorStrip
label="Nominal+" label="Nominal+"
foreground={foregroundColor} foreground={foregroundColor!}
background={backgroundColor} background={backgroundColor!}
colors={nominalBold} colors={nominalBold!}
labelColors={nominalMuted} labelColors={nominalMuted!}
/> />
<ColorStrip <ColorStrip
label="Nominal-" label="Nominal-"
foreground={foregroundColor} foreground={foregroundColor!}
background={backgroundColor} background={backgroundColor!}
colors={nominalMuted} colors={nominalMuted!}
labelColors={nominalBold} labelColors={nominalBold!}
/> />
<ColorBand <ColorBand
label="Sequential" label="Sequential"
foreground={foregroundColor} foreground={foregroundColor!}
colors={sequential} colors={sequential!}
width={BAND_WIDTH} width={BAND_WIDTH}
/> />
<ColorBand <ColorBand
label="Sequential2" label="Sequential2"
foreground={foregroundColor} foreground={foregroundColor!}
colors={sequential2} colors={sequential2!}
width={BAND_WIDTH} width={BAND_WIDTH}
/> />
<ColorBand <ColorBand
label="Diverging" label="Diverging"
foreground={foregroundColor} foreground={foregroundColor!}
colors={diverging} colors={diverging!}
width={BAND_WIDTH} width={BAND_WIDTH}
/> />
<ColorBand <ColorBand
label="Diverging2" label="Diverging2"
foreground={foregroundColor} foreground={foregroundColor!}
colors={diverging2} colors={diverging2!}
width={BAND_WIDTH} width={BAND_WIDTH}
/> />
<ColorBand <ColorBand
label="Greys" label="Greys"
foreground={foregroundColor} foreground={foregroundColor!}
colors={greys} colors={greys!}
width={BAND_WIDTH} width={BAND_WIDTH}
/> />
</div> </div>

Просмотреть файл

@ -2,7 +2,7 @@
* Copyright (c) Microsoft. All rights reserved. * Copyright (c) Microsoft. All rights reserved.
* Licensed under the MIT license. See LICENSE file in the project. * Licensed under the MIT license. See LICENSE file in the project.
*/ */
import { CSSProperties, FC } from 'react' import type { CSSProperties, FC } from 'react'
import './index.css' import './index.css'

Просмотреть файл

@ -10,7 +10,7 @@ import {
Position, Position,
} from '@fluentui/react' } from '@fluentui/react'
import { ColorBlindnessMode, colorBlindnessInfo } from '@thematic/color' import { ColorBlindnessMode, colorBlindnessInfo } from '@thematic/color'
import { ThemeListing, Theme } from '@thematic/core' import type { ThemeListing, Theme } from '@thematic/core'
import { ColorPickerButton } from '@thematic/fluent' import { ColorPickerButton } from '@thematic/fluent'
import { useCallback, FC, useMemo } from 'react' import { useCallback, FC, useMemo } from 'react'
import { EnumDropdown } from '../EnumDropdown' import { EnumDropdown } from '../EnumDropdown'
@ -58,7 +58,7 @@ export const ControlPanel: FC<ControlPanelProps> = ({
onDarkModeChange, onDarkModeChange,
}) => { }) => {
const handleThemeChange = useCallback( const handleThemeChange = useCallback(
(event: React.FormEvent<HTMLDivElement>, option?: IDropdownOption) => { (_event: React.FormEvent<HTMLDivElement>, option?: IDropdownOption) => {
if (option) { if (option) {
const found = themes.find(t => t.id === option.key) const found = themes.find(t => t.id === option.key)
if (found) { if (found) {
@ -91,12 +91,12 @@ export const ControlPanel: FC<ControlPanelProps> = ({
}, [darkMode, onDarkModeChange]) }, [darkMode, onDarkModeChange])
const handleDrawNodesChange = useCallback( const handleDrawNodesChange = useCallback(
(event: React.MouseEvent<HTMLElement>, checked?: boolean) => (_event: React.MouseEvent<HTMLElement>, checked?: boolean) =>
onDrawNodesChange(!!checked), onDrawNodesChange(!!checked),
[onDrawNodesChange], [onDrawNodesChange],
) )
const handleDrawLinksChange = useCallback( const handleDrawLinksChange = useCallback(
(event: React.MouseEvent<HTMLElement>, checked?: boolean) => (_event: React.MouseEvent<HTMLElement>, checked?: boolean) =>
onDrawLinksChange(!!checked), onDrawLinksChange(!!checked),
[onDrawLinksChange], [onDrawLinksChange],
) )

Просмотреть файл

@ -2,9 +2,9 @@
* Copyright (c) Microsoft. All rights reserved. * Copyright (c) Microsoft. All rights reserved.
* Licensed under the MIT license. See LICENSE file in the project. * Licensed under the MIT license. See LICENSE file in the project.
*/ */
import { Theme } from '@thematic/core' import type { Theme } from '@thematic/core'
import { ColorPicker, ColorPickerLayout } from '@thematic/fluent' import { ColorPicker, ColorPickerLayout } from '@thematic/fluent'
import { FC } from 'react' import type { FC } from 'react'
import './index.css' import './index.css'

Просмотреть файл

@ -2,8 +2,8 @@
* Copyright (c) Microsoft. All rights reserved. * Copyright (c) Microsoft. All rights reserved.
* Licensed under the MIT license. See LICENSE file in the project. * Licensed under the MIT license. See LICENSE file in the project.
*/ */
import { Theme } from '@thematic/core' import type { Theme } from '@thematic/core'
import { FC } from 'react' import type { FC } from 'react'
import { useSetTheme } from '../../state' import { useSetTheme } from '../../state'
import { ColorSelection } from './ColorSelection' import { ColorSelection } from './ColorSelection'
import './index.css' import './index.css'

Просмотреть файл

@ -26,10 +26,9 @@ export interface EnumDropdownProps<E> {
*/ */
export function EnumDropdown<E>({ export function EnumDropdown<E>({
enumeration, enumeration,
label,
selected, selected,
onChange = () => null, onChange = () => null,
styles, ...props
}: EnumDropdownProps<E>): JSX.Element { }: EnumDropdownProps<E>): JSX.Element {
const options = useMemo( const options = useMemo(
() => () =>
@ -39,7 +38,7 @@ export function EnumDropdown<E>({
[enumeration], [enumeration],
) )
const handleChange = useCallback( const handleChange = useCallback(
(e: React.FormEvent, v: IDropdownOption | undefined) => { (_e: React.FormEvent, v: IDropdownOption | undefined) => {
if (v) { if (v) {
setSelectedKey(v.key) setSelectedKey(v.key)
onChange(v.key) onChange(v.key)
@ -51,11 +50,10 @@ export function EnumDropdown<E>({
const [selectedKey, setSelectedKey] = useState<string | number>(key) const [selectedKey, setSelectedKey] = useState<string | number>(key)
return ( return (
<Dropdown <Dropdown
label={label}
options={options} options={options}
selectedKey={selectedKey} selectedKey={selectedKey}
onChange={handleChange} onChange={handleChange}
styles={styles} {...props}
/> />
) )
} }

Просмотреть файл

@ -22,7 +22,10 @@ const FluentControlsComponent: FC<FluentControlsComponentProps> = ({
}) => { }) => {
const theme = useThematic() const theme = useThematic()
const [scale, setScale] = useState<string>('<none>') const [scale, setScale] = useState<string>('<none>')
const handleScaleChange = useCallback((e, option) => setScale(option.key), []) const handleScaleChange = useCallback(
(_e, option) => setScale(option.key),
[],
)
const [scaleType, setScaleType] = useState<ScaleType>(ScaleType.Linear) const [scaleType, setScaleType] = useState<ScaleType>(ScaleType.Linear)
const handleScaleTypeChange = useCallback(type => setScaleType(type), []) const handleScaleTypeChange = useCallback(type => setScaleType(type), [])
const handlePickerChange = useCallback(t => themeLoaded(t), [themeLoaded]) const handlePickerChange = useCallback(t => themeLoaded(t), [themeLoaded])

Просмотреть файл

@ -2,8 +2,8 @@
* Copyright (c) Microsoft. All rights reserved. * Copyright (c) Microsoft. All rights reserved.
* Licensed under the MIT license. See LICENSE file in the project. * Licensed under the MIT license. See LICENSE file in the project.
*/ */
import { IPalette, Theme } from '@fluentui/react' import type { IPalette, Theme } from '@fluentui/react'
import { FluentTheme } from '@thematic/fluent' import type { FluentTheme } from '@thematic/fluent'
import { FC, useMemo } from 'react' import { FC, useMemo } from 'react'
import { ColorStrip } from '../ColorStrip' import { ColorStrip } from '../ColorStrip'

Просмотреть файл

@ -3,7 +3,7 @@
* Licensed under the MIT license. See LICENSE file in the project. * Licensed under the MIT license. See LICENSE file in the project.
*/ */
import { TextField } from '@fluentui/react' import { TextField } from '@fluentui/react'
import { FC } from 'react' import type { FC } from 'react'
export interface JSONEditorProps { export interface JSONEditorProps {
value: unknown value: unknown

Просмотреть файл

@ -2,7 +2,7 @@
* Copyright (c) Microsoft. All rights reserved. * Copyright (c) Microsoft. All rights reserved.
* Licensed under the MIT license. See LICENSE file in the project. * Licensed under the MIT license. See LICENSE file in the project.
*/ */
import { SelectionState, ThemeElementType } from '@thematic/core' import type { SelectionState, ThemeElementType } from '@thematic/core'
import { useThematic, mark2style } from '@thematic/react' import { useThematic, mark2style } from '@thematic/react'
import { CSSProperties, FC, useMemo } from 'react' import { CSSProperties, FC, useMemo } from 'react'
import { Rect, Circle, Line, Arc, Text } from '../svg' import { Rect, Circle, Line, Arc, Text } from '../svg'

Просмотреть файл

@ -2,7 +2,7 @@
* Copyright (c) Microsoft. All rights reserved. * Copyright (c) Microsoft. All rights reserved.
* Licensed under the MIT license. See LICENSE file in the project. * Licensed under the MIT license. See LICENSE file in the project.
*/ */
import { OfficeTheme } from '@thematic/core' import type { OfficeTheme } from '@thematic/core'
import { useThematic } from '@thematic/react' import { useThematic } from '@thematic/react'
import { FC, useMemo } from 'react' import { FC, useMemo } from 'react'
import { ColorStrip } from '../ColorStrip' import { ColorStrip } from '../ColorStrip'

Просмотреть файл

@ -7,6 +7,7 @@ import { useThematic } from '@thematic/react'
import { FC, useMemo } from 'react' import { FC, useMemo } from 'react'
import { DownloadLink } from '../DownloadLink' import { DownloadLink } from '../DownloadLink'
import { OfficePalette } from './OfficePalette' import { OfficePalette } from './OfficePalette'
export const Office: FC = () => { export const Office: FC = () => {
const theme = useThematic() const theme = useThematic()
const ofc = useMemo(() => theme.transform(office) as OfficeTheme, [theme]) const ofc = useMemo(() => theme.transform(office) as OfficeTheme, [theme])

Просмотреть файл

@ -2,7 +2,7 @@
* Copyright (c) Microsoft. All rights reserved. * Copyright (c) Microsoft. All rights reserved.
* Licensed under the MIT license. See LICENSE file in the project. * Licensed under the MIT license. See LICENSE file in the project.
*/ */
import { PowerBITheme } from '@thematic/core' import type { PowerBITheme } from '@thematic/core'
import { useThematic } from '@thematic/react' import { useThematic } from '@thematic/react'
import { FC, useMemo } from 'react' import { FC, useMemo } from 'react'
import { ColorDefinition, ColorStrip } from '../ColorStrip' import { ColorDefinition, ColorStrip } from '../ColorStrip'

Просмотреть файл

@ -3,7 +3,7 @@
* Licensed under the MIT license. See LICENSE file in the project. * Licensed under the MIT license. See LICENSE file in the project.
*/ */
import { Pivot, PivotItem } from '@fluentui/react' import { Pivot, PivotItem } from '@fluentui/react'
import { FC } from 'react' import type { FC } from 'react'
import { ColorPalette } from '../ColorPalette' import { ColorPalette } from '../ColorPalette'
import { CoolerPicker } from '../CoolerPicker' import { CoolerPicker } from '../CoolerPicker'
import { FluentViewer } from '../FluentViewer' import { FluentViewer } from '../FluentViewer'

Просмотреть файл

@ -4,7 +4,7 @@
*/ */
import { Pivot, PivotItem } from '@fluentui/react' import { Pivot, PivotItem } from '@fluentui/react'
import { FC, useMemo } from 'react' import { FC, useMemo } from 'react'
import { Graph } from '../../interfaces' import type { Graph } from '../../interfaces'
import { FluentControls } from '../FluentControls' import { FluentControls } from '../FluentControls'
import { D3Chart } from '../charts/D3' import { D3Chart } from '../charts/D3'
import { VegaChart, charts } from '../charts/Vega' import { VegaChart, charts } from '../charts/Vega'

Просмотреть файл

@ -158,8 +158,8 @@ export const D3Chart: FC<ChartProps> = ({ width = 800, height = 600 }) => {
.attr('width', LEGEND_WIDTH) .attr('width', LEGEND_WIDTH)
.attr('height', 1) .attr('height', 1)
.attr('x', 1) .attr('x', 1)
.attr('y', (d, i) => plotHeight - i) .attr('y', (_d, i) => plotHeight - i)
.attr('fill', (d, i) => scale(i).hex()) .attr('fill', (_d, i) => scale(i).hex())
.attr('fill-opacity', CIRCLE_FILL_OPACITY) .attr('fill-opacity', CIRCLE_FILL_OPACITY)
const labels = [ const labels = [
{ {

Просмотреть файл

@ -22,7 +22,7 @@ import {
useCallback, useCallback,
FC, FC,
} from 'react' } from 'react'
import { Graph, Node, Edge } from '../../../interfaces' import type { Graph, Node, Edge } from '../../../interfaces'
import { bounds } from '../../../util/graph' import { bounds } from '../../../util/graph'
export interface GraphProps { export interface GraphProps {
@ -95,10 +95,10 @@ export const D3Graph: FC<GraphProps> = ({
.enter() .enter()
.append('line') .append('line')
.attr('class', 'link') .attr('class', 'link')
.attr('x1', d => xScale(nmap[d.source].x) as number) .attr('x1', d => xScale(nmap[d.source]!.x) as number)
.attr('x2', d => xScale(nmap[d.target].x) as number) .attr('x2', d => xScale(nmap[d.target]!.x) as number)
.attr('y1', d => yScale(nmap[d.source].y) as number) .attr('y1', d => yScale(nmap[d.source]!.y) as number)
.attr('y2', d => yScale(nmap[d.target].y) as number) .attr('y2', d => yScale(nmap[d.target]!.y) as number)
.call(line as any, theme.link({ selectionState: SelectionState.Hidden })) .call(line as any, theme.link({ selectionState: SelectionState.Hidden }))
g.selectAll('.node') g.selectAll('.node')

Просмотреть файл

@ -2,8 +2,8 @@
* Copyright (c) Microsoft. All rights reserved. * Copyright (c) Microsoft. All rights reserved.
* Licensed under the MIT license. See LICENSE file in the project. * Licensed under the MIT license. See LICENSE file in the project.
*/ */
import { SVGMark, Text as TextMark } from '@thematic/core' import type { SVGMark, Text as TextMark } from '@thematic/core'
import { FC, ReactNode } from 'react' import type { FC, ReactNode } from 'react'
export interface MarkProps { export interface MarkProps {
children: ReactNode children: ReactNode

Просмотреть файл

@ -4,7 +4,7 @@
*/ */
import { atom, useRecoilState } from 'recoil' import { atom, useRecoilState } from 'recoil'
import { graph } from '../data' import { graph } from '../data'
import { Graph } from '../interfaces' import type { Graph } from '../interfaces'
const graphState = atom<Graph>({ const graphState = atom<Graph>({
key: 'graph', key: 'graph',

Просмотреть файл

@ -31,7 +31,7 @@ export function useThemes() {
const themeInfoState = atom<ThemeListing>({ const themeInfoState = atom<ThemeListing>({
key: 'theme-info', key: 'theme-info',
default: defaultThemes[0], default: defaultThemes[0]!,
}) })
// we drive the theme by the params, so if a pre-defined theme // we drive the theme by the params, so if a pre-defined theme

Просмотреть файл

@ -2,7 +2,7 @@
* Copyright (c) Microsoft. All rights reserved. * Copyright (c) Microsoft. All rights reserved.
* Licensed under the MIT license. See LICENSE file in the project. * Licensed under the MIT license. See LICENSE file in the project.
*/ */
export const download = (value, filename) => { export function download(value: BlobPart, filename: string): void {
const blob = new Blob([value]) const blob = new Blob([value])
const url = URL.createObjectURL(blob) const url = URL.createObjectURL(blob)
const a = document.createElement('a') const a = document.createElement('a')

Просмотреть файл

@ -2,7 +2,7 @@
* Copyright (c) Microsoft. All rights reserved. * Copyright (c) Microsoft. All rights reserved.
* Licensed under the MIT license. See LICENSE file in the project. * Licensed under the MIT license. See LICENSE file in the project.
*/ */
import { Node } from '../interfaces' import type { Node } from '../interfaces'
/** /**
* Compute the bounds for a node list * Compute the bounds for a node list
* @param nodes * @param nodes

Просмотреть файл

@ -1,10 +1,33 @@
{ {
"extends": "../../tsconfig.json",
"compilerOptions": { "compilerOptions": {
"target": "ESNext",
"module": "ESNext",
"moduleResolution": "Node",
"jsx": "react-jsx",
"lib": ["dom", "esnext"],
// Strictest
"strict": true,
"alwaysStrict": true,
"allowUnusedLabels": false,
"allowUnreachableCode": false,
"noFallthroughCasesInSwitch": true,
"noImplicitOverride": true,
"noImplicitReturns": true,
"noPropertyAccessFromIndexSignature": true,
"noUncheckedIndexedAccess": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"importsNotUsedAsValues": "error",
"checkJs": true,
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"skipLibCheck": true,
// Package Config
"outDir": "lib", "outDir": "lib",
"allowSyntheticDefaultImports": true,
"resolveJsonModule": true, "resolveJsonModule": true,
"skipLibCheck": true "allowSyntheticDefaultImports": true
}, },
"include": ["src/**/*"] "include": ["src/**/*"]
} }

Просмотреть файл

@ -1,17 +0,0 @@
{
"compilerOptions": {
"target": "esnext",
"module": "esnext",
"moduleResolution": "node",
"declaration": true,
"jsx": "react-jsx",
"lib": ["dom", "esnext"],
// SDI covers over esm support flaws. Libraries should not ship with SDI enabled if it's at all possible.
// However, application code can use it to write idiomatic react imports.
"allowSyntheticDefaultImports": false,
"forceConsistentCasingInFileNames": true,
"strict": true,
"esModuleInterop": true
},
"exclude": ["**/node_modules/**", "**/__tests__/**"]
}

1407
yarn.lock

Разница между файлами не показана из-за своего большого размера Загрузить разницу