mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
tidy(ui): remove unused stuff 2
This commit is contained in:
parent
f10248e3f5
commit
96f6e9e683
@ -9,6 +9,8 @@ const config: KnipConfig = {
|
||||
'src/services/api/schema.ts',
|
||||
'src/features/nodes/types/v1/**',
|
||||
'src/features/nodes/types/v2/**',
|
||||
// TODO(psyche): maybe we can clean up these utils after canvas v2 release
|
||||
'src/features/controlLayers/konva/util.ts',
|
||||
],
|
||||
ignoreBinaries: ['only-allow'],
|
||||
paths: {
|
||||
|
@ -10,7 +10,6 @@ import { setEventListeners } from 'services/events/setEventListeners';
|
||||
import type { ClientToServerEvents, ServerToClientEvents } from 'services/events/types';
|
||||
import type { ManagerOptions, Socket, SocketOptions } from 'socket.io-client';
|
||||
import { io } from 'socket.io-client';
|
||||
import { assert } from 'tsafe';
|
||||
|
||||
// Inject socket options and url into window for debugging
|
||||
declare global {
|
||||
@ -22,11 +21,6 @@ declare global {
|
||||
export type AppSocket = Socket<ServerToClientEvents, ClientToServerEvents>;
|
||||
|
||||
export const $socket = atom<AppSocket | null>(null);
|
||||
export const getSocket = () => {
|
||||
const socket = $socket.get();
|
||||
assert(socket !== null, 'Socket is not initialized');
|
||||
return socket;
|
||||
};
|
||||
export const $socketOptions = map<Partial<ManagerOptions & SocketOptions>>({});
|
||||
|
||||
const $isSocketInitialized = atom<boolean>(false);
|
||||
|
@ -27,9 +27,7 @@ export const zLogNamespace = z.enum([
|
||||
'queue',
|
||||
'workflows',
|
||||
]);
|
||||
const zLogNamespacesArray = z.array(zLogNamespace);
|
||||
export type LogNamespace = z.infer<typeof zLogNamespace>;
|
||||
export const isLogNamespaceArray = (v: unknown): v is LogNamespace[] => zLogNamespacesArray.safeParse(v).success;
|
||||
|
||||
export const logger = (namespace: LogNamespace) => $logger.get().child({ namespace });
|
||||
|
||||
|
@ -1,9 +1,6 @@
|
||||
export const roundDownToMultiple = (num: number, multiple: number): number => {
|
||||
return Math.floor(num / multiple) * multiple;
|
||||
};
|
||||
export const roundDownToMultipleMin = (num: number, multiple: number): number => {
|
||||
return Math.max(multiple, Math.floor(num / multiple) * multiple);
|
||||
};
|
||||
|
||||
export const roundToMultiple = (num: number, multiple: number): number => {
|
||||
return Math.round(num / multiple) * multiple;
|
||||
|
@ -35,6 +35,7 @@ export const EntityLayerAdapterGate = memo(({ children }: PropsWithChildren) =>
|
||||
|
||||
EntityLayerAdapterGate.displayName = 'EntityLayerAdapterGate';
|
||||
|
||||
/** @knipignore */
|
||||
export const useEntityLayerAdapter = (): CanvasLayerAdapter => {
|
||||
const adapter = useContext(EntityAdapterContext);
|
||||
assert(adapter, 'useEntityLayerAdapter must be used within a EntityLayerAdapterGate');
|
||||
@ -68,6 +69,7 @@ export const EntityMaskAdapterGate = memo(({ children }: PropsWithChildren) => {
|
||||
|
||||
EntityMaskAdapterGate.displayName = 'EntityMaskAdapterGate';
|
||||
|
||||
/** @knipignore */
|
||||
export const useEntityMaskAdapter = (): CanvasMaskAdapter => {
|
||||
const adapter = useContext(EntityAdapterContext);
|
||||
assert(adapter, 'useEntityMaskAdapter must be used within a CanvasMaskAdapterGate');
|
||||
|
@ -5,11 +5,6 @@
|
||||
export const TRANSPARENCY_CHECKER_PATTERN =
|
||||
'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAIAAAAC64paAAAEsmlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4KPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iWE1QIENvcmUgNS41LjAiPgogPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4KICA8cmRmOkRlc2NyaXB0aW9uIHJkZjphYm91dD0iIgogICAgeG1sbnM6ZXhpZ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XZ0OndoZW49IjIwMjQtMDQtMjNUMDg6MjA6NDcrMTA6MDAiLz4KICAgIDwvcmRmOlNlcT4KICAgPC94bXBNTTpIaXN0b3J5PgogIDwvcmRmOkRlc2NyaXB0aW9uPgogPC9yZGY6UkRGPgo8L3g6eG1wbWV0YT4KPD94cGFja2V0IGVuZD0iciI/Pn9pdVgAAAGBaUNDUHNSR0IgSUVDNjE5NjYtMi4xAAAokXWR3yuDURjHP5uJmKghFy6WxpVpqMWNMgm1tGbKr5vt3S+1d3t73y3JrXKrKHHj1wV/AbfKtVJESq53TdywXs9rakv2nJ7zfM73nOfpnOeAPZJRVMPhAzWb18NTAffC4pK7oYiDTjpw4YgqhjYeCgWpaR8P2Kx457Vq1T73rzXHE4YCtkbhMUXT88LTwsG1vGbxrnC7ko7Ghc+F+3W5oPC9pcfKXLQ4VeYvi/VIeALsbcLuVBXHqlhJ66qwvByPmikov/exXuJMZOfnJPaId2MQZooAbmaYZAI/g4zK7MfLEAOyoka+7yd/lpzkKjJrrKOzSoo0efpFLUj1hMSk6AkZGdat/v/tq5EcHipXdwag/sU033qhYQdK26b5eWyapROoe4arbCU/dwQj76JvVzTPIbRuwsV1RYvtweUWdD1pUT36I9WJ25NJeD2DlkVw3ULTcrlnv/ucPkJkQ77qBvYPoE/Ot658AxagZ8FoS/a7AAAACXBIWXMAAC4jAAAuIwF4pT92AAAAL0lEQVQ4jWM8ffo0A25gYmKCR5YJjxxBMKp5ZGhm/P//Px7pM2fO0MrmUc0jQzMAB2EIhZC3pUYAAAAASUVORK5CYII=';
|
||||
|
||||
/**
|
||||
* The color of a bounding box stroke when its object is selected.
|
||||
*/
|
||||
export const BBOX_SELECTED_STROKE = 'rgba(78, 190, 255, 1)';
|
||||
|
||||
/**
|
||||
* The inner border color for the brush preview.
|
||||
*/
|
||||
@ -30,21 +25,6 @@ export const BRUSH_ERASER_BORDER_WIDTH = 1;
|
||||
*/
|
||||
export const BRUSH_SPACING_TARGET_SCALE = 0.1;
|
||||
|
||||
/**
|
||||
* The minimum brush spacing in pixels.
|
||||
*/
|
||||
export const MIN_BRUSH_SPACING_PX = 5;
|
||||
|
||||
/**
|
||||
* The maximum brush spacing in pixels.
|
||||
*/
|
||||
export const MAX_BRUSH_SPACING_PX = 15;
|
||||
|
||||
/**
|
||||
* The debounce time in milliseconds for debounced renderers.
|
||||
*/
|
||||
export const DEBOUNCE_MS = 300;
|
||||
|
||||
/**
|
||||
* Konva wheel zoom exponential scale factor
|
||||
*/
|
||||
@ -64,13 +44,3 @@ export const MAX_CANVAS_SCALE = 20;
|
||||
* The fine grid size of the canvas
|
||||
*/
|
||||
export const CANVAS_GRID_SIZE_FINE = 8;
|
||||
|
||||
/**
|
||||
* The coarse grid size of the canvas
|
||||
*/
|
||||
export const CANVAS_GRID_SIZE_COARSE = 64;
|
||||
|
||||
/**
|
||||
* Document fit padding
|
||||
*/
|
||||
export const DOCUMENT_FIT_PADDING_PX = 50;
|
||||
|
@ -19,7 +19,3 @@ export const LightnessToAlphaFilter = (imageData: ImageData): void => {
|
||||
imageData.data[i * 4 + 3] = (cMin + cMax) / 2;
|
||||
}
|
||||
};
|
||||
|
||||
export const FILTER_MAP = {
|
||||
LightnessToAlphaFilter: LightnessToAlphaFilter,
|
||||
} as const;
|
||||
|
@ -12,7 +12,5 @@ export const getEraserLineId = (entityId: string, lineId: string, isBuffer?: boo
|
||||
export const getRectShapeId = (entityId: string, rectId: string, isBuffer?: boolean) =>
|
||||
`${isBuffer ? 'buffer_' : ''}rect_${rectId}`;
|
||||
export const getImageObjectId = (entityId: string, imageId: string) => `image_${imageId}`;
|
||||
export const getObjectGroupId = (entityId: string, groupId: string) => `objectGroup_${groupId}`;
|
||||
export const getLayerBboxId = (entityId: string) => `${entityId}.bbox`;
|
||||
export const getCAId = (entityId: string) => `control_adapter_${entityId}`;
|
||||
export const getIPAId = (entityId: string) => `ip_adapter_${entityId}`;
|
||||
|
@ -208,7 +208,7 @@ export const downloadBlob = (blob: Blob, fileName: string) => {
|
||||
/**
|
||||
* Gets an ImageData object from an image dataURL by drawing it to a canvas.
|
||||
*/
|
||||
export const dataURLToImageData = async (dataURL: string, width: number, height: number): Promise<ImageData> => {
|
||||
export const dataURLToImageData = (dataURL: string, width: number, height: number): Promise<ImageData> => {
|
||||
return new Promise((resolve, reject) => {
|
||||
const canvas = document.createElement('canvas');
|
||||
canvas.width = width;
|
||||
|
Loading…
Reference in New Issue
Block a user