mirror of
https://github.com/invoke-ai/InvokeAI.git
synced 2026-04-23 03:00:31 -04:00
chore(ui): lint
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import { Checkbox, FormControl, FormLabel } from '@invoke-ai/ui-library';
|
||||
import { createSelector } from '@reduxjs/toolkit';
|
||||
import { useAppDispatch, useAppSelector } from 'app/store/storeHooks';
|
||||
import { selectCanvasSettingsSlice,settingsClipToBboxChanged } from 'features/controlLayers/store/canvasSettingsSlice';
|
||||
import { selectCanvasSettingsSlice, settingsClipToBboxChanged } from 'features/controlLayers/store/canvasSettingsSlice';
|
||||
import type { ChangeEvent } from 'react';
|
||||
import { memo, useCallback } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
import { Checkbox, FormControl, FormLabel } from '@invoke-ai/ui-library';
|
||||
import { createSelector } from '@reduxjs/toolkit';
|
||||
import { useAppDispatch, useAppSelector } from 'app/store/storeHooks';
|
||||
import { selectCanvasSettingsSlice, settingsInvertScrollForToolWidthChanged } from 'features/controlLayers/store/canvasSettingsSlice';
|
||||
import {
|
||||
selectCanvasSettingsSlice,
|
||||
settingsInvertScrollForToolWidthChanged,
|
||||
} from 'features/controlLayers/store/canvasSettingsSlice';
|
||||
import type { ChangeEvent } from 'react';
|
||||
import { memo, useCallback } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
|
||||
@@ -15,7 +15,10 @@ import {
|
||||
import { createSelector } from '@reduxjs/toolkit';
|
||||
import { useAppDispatch, useAppSelector } from 'app/store/storeHooks';
|
||||
import { useToolIsSelected } from 'features/controlLayers/components/Tool/hooks';
|
||||
import { selectCanvasSettingsSlice, settingsEraserWidthChanged } from 'features/controlLayers/store/canvasSettingsSlice';
|
||||
import {
|
||||
selectCanvasSettingsSlice,
|
||||
settingsEraserWidthChanged,
|
||||
} from 'features/controlLayers/store/canvasSettingsSlice';
|
||||
import { clamp } from 'lodash-es';
|
||||
import type { KeyboardEvent } from 'react';
|
||||
import { memo, useCallback, useEffect, useState } from 'react';
|
||||
|
||||
@@ -9,7 +9,11 @@ import { createContext, memo, useContext, useMemo, useSyncExternalStore } from '
|
||||
import { assert } from 'tsafe';
|
||||
|
||||
const EntityAdapterContext = createContext<
|
||||
CanvasEntityAdapterRasterLayer | CanvasEntityAdapterControlLayer | CanvasEntityAdapterInpaintMask | CanvasEntityAdapterRegionalGuidance | null
|
||||
| CanvasEntityAdapterRasterLayer
|
||||
| CanvasEntityAdapterControlLayer
|
||||
| CanvasEntityAdapterInpaintMask
|
||||
| CanvasEntityAdapterRegionalGuidance
|
||||
| null
|
||||
>(null);
|
||||
|
||||
export const RasterLayerAdapterGate = memo(({ children }: PropsWithChildren) => {
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
import { useStore } from '@nanostores/react';
|
||||
import { useCanvasManager } from 'features/controlLayers/contexts/CanvasManagerProviderGate';
|
||||
|
||||
export const useIsFiltering = () => {
|
||||
const canvasManager = useCanvasManager();
|
||||
const isFiltering = useStore(canvasManager.filter.$isFiltering);
|
||||
return isFiltering;
|
||||
};
|
||||
@@ -1,8 +0,0 @@
|
||||
import { useStore } from '@nanostores/react';
|
||||
import { useCanvasManager } from 'features/controlLayers/contexts/CanvasManagerProviderGate';
|
||||
|
||||
export const useIsTransforming = () => {
|
||||
const canvasManager = useCanvasManager();
|
||||
const isTransforming = useStore(canvasManager.stateApi.$isTranforming);
|
||||
return isTransforming;
|
||||
};
|
||||
@@ -31,7 +31,10 @@ export class CanvasObjectImage extends CanvasModuleBase {
|
||||
isError: boolean = false;
|
||||
mutex = new Mutex();
|
||||
|
||||
constructor(state: CanvasImageState, parent: CanvasEntityObjectRenderer | CanvasStagingAreaModule | CanvasFilterModule) {
|
||||
constructor(
|
||||
state: CanvasImageState,
|
||||
parent: CanvasEntityObjectRenderer | CanvasStagingAreaModule | CanvasFilterModule
|
||||
) {
|
||||
super();
|
||||
this.id = state.id;
|
||||
this.parent = parent;
|
||||
|
||||
@@ -3,7 +3,7 @@ import type { PersistConfig, RootState } from 'app/store/store';
|
||||
import { canvasSlice } from 'features/controlLayers/store/canvasSlice';
|
||||
import type { StagingAreaImage } from 'features/controlLayers/store/types';
|
||||
|
||||
export type CanvasSessionState = {
|
||||
type CanvasSessionState = {
|
||||
isStaging: boolean;
|
||||
stagedImages: StagingAreaImage[];
|
||||
selectedStagedImageIndex: number;
|
||||
|
||||
@@ -2,7 +2,7 @@ import { createSelector, createSlice, type PayloadAction } from '@reduxjs/toolki
|
||||
import type { PersistConfig, RootState } from 'app/store/store';
|
||||
import type { RgbaColor } from 'features/controlLayers/store/types';
|
||||
|
||||
export type CanvasSettingsState = {
|
||||
type CanvasSettingsState = {
|
||||
/**
|
||||
* Whether to show HUD (Heads-Up Display) on the canvas.
|
||||
*/
|
||||
|
||||
@@ -11,7 +11,6 @@ import type {
|
||||
CanvasRegionalGuidanceState,
|
||||
CanvasState,
|
||||
} from 'features/controlLayers/store/types';
|
||||
import { isDrawableEntityType } from 'features/controlLayers/store/types';
|
||||
import { getOptimalDimension } from 'features/parameters/util/optimalDimension';
|
||||
import { assert } from 'tsafe';
|
||||
|
||||
@@ -189,16 +188,6 @@ export const selectBookmarkedEntityIdentifier = createSelector(
|
||||
(canvas) => canvas.bookmarkedEntityIdentifier
|
||||
);
|
||||
|
||||
export const selectIsSelectedEntityDrawable = createSelector(
|
||||
selectSelectedEntityIdentifier,
|
||||
(selectedEntityIdentifier) => {
|
||||
if (!selectedEntityIdentifier) {
|
||||
return false;
|
||||
}
|
||||
return isDrawableEntityType(selectedEntityIdentifier.type);
|
||||
}
|
||||
);
|
||||
|
||||
export const selectCanvasMayUndo = (state: RootState) => state.canvas.past.length > 0;
|
||||
export const selectCanvasMayRedo = (state: RootState) => state.canvas.future.length > 0;
|
||||
export const selectSelectedEntityFill = createSelector(
|
||||
|
||||
@@ -552,7 +552,6 @@ const zFillStyle = z.enum(['solid', 'grid', 'crosshatch', 'diagonal', 'horizonta
|
||||
export type FillStyle = z.infer<typeof zFillStyle>;
|
||||
export const isFillStyle = (v: unknown): v is FillStyle => zFillStyle.safeParse(v).success;
|
||||
const zFill = z.object({ style: zFillStyle, color: zRgbColor });
|
||||
export type Fill = z.infer<typeof zFill>;
|
||||
|
||||
const zRegionalGuidanceIPAdapterConfig = z.object({
|
||||
id: zId,
|
||||
@@ -779,7 +778,7 @@ export type EntityRasterizedPayload = EntityIdentifierPayload<{
|
||||
|
||||
export type GenerationMode = 'txt2img' | 'img2img' | 'inpaint' | 'outpaint';
|
||||
|
||||
export function isDrawableEntityType(
|
||||
function isDrawableEntityType(
|
||||
entityType: CanvasEntityState['type']
|
||||
): entityType is CanvasRenderableEntityState['type'] {
|
||||
return (
|
||||
|
||||
Reference in New Issue
Block a user