tidy(ui): remove unused exports

This commit is contained in:
psychedelicious 2024-04-18 11:48:14 +10:00 committed by Kent Keirsey
parent a1a9f0da73
commit b81030fe27
3 changed files with 5 additions and 25 deletions

View File

@ -22,7 +22,7 @@ const selectSelectedLayerColor = createMemoizedSelector(selectRegionalPromptsSli
return regionalPrompts.layers.find((l) => l.id === regionalPrompts.selectedLayer)?.color; return regionalPrompts.layers.find((l) => l.id === regionalPrompts.selectedLayer)?.color;
}); });
export const useStageRenderer = (container: HTMLDivElement | null, wrapper: HTMLDivElement | null) => { const useStageRenderer = (container: HTMLDivElement | null, wrapper: HTMLDivElement | null) => {
const dispatch = useAppDispatch(); const dispatch = useAppDispatch();
const width = useAppSelector((s) => s.generation.width); const width = useAppSelector((s) => s.generation.width);
const height = useAppSelector((s) => s.generation.height); const height = useAppSelector((s) => s.generation.height);

View File

@ -4,19 +4,6 @@ import { selectRegionalPromptsSlice } from 'features/regionalPrompts/store/regio
import { useMemo } from 'react'; import { useMemo } from 'react';
import { assert } from 'tsafe'; import { assert } from 'tsafe';
export const useLayer = (layerId: string) => {
const selectLayer = useMemo(
() =>
createSelector(selectRegionalPromptsSlice, (regionalPrompts) =>
regionalPrompts.layers.find((l) => l.id === layerId)
),
[layerId]
);
const layer = useAppSelector(selectLayer);
assert(layer !== undefined, `Layer ${layerId} doesn't exist!`);
return layer;
};
export const useLayerPositivePrompt = (layerId: string) => { export const useLayerPositivePrompt = (layerId: string) => {
const selectLayer = useMemo( const selectLayer = useMemo(
() => () =>

View File

@ -2,7 +2,6 @@ import type { PayloadAction } from '@reduxjs/toolkit';
import { createSlice } from '@reduxjs/toolkit'; import { createSlice } from '@reduxjs/toolkit';
import type { PersistConfig, RootState } from 'app/store/store'; import type { PersistConfig, RootState } from 'app/store/store';
import { moveBackward, moveForward, moveToBack, moveToFront } from 'common/util/arrayUtils'; import { moveBackward, moveForward, moveToBack, moveToFront } from 'common/util/arrayUtils';
import type { Stage } from 'konva/lib/Stage';
import type { IRect, Vector2d } from 'konva/lib/types'; import type { IRect, Vector2d } from 'konva/lib/types';
import { atom } from 'nanostores'; import { atom } from 'nanostores';
import type { RgbColor } from 'react-colorful'; import type { RgbColor } from 'react-colorful';
@ -24,14 +23,14 @@ type ImageObject = LayerObjectBase & {
height: number; height: number;
}; };
export type LineObject = LayerObjectBase & { type LineObject = LayerObjectBase & {
kind: 'line'; kind: 'line';
tool: Tool; tool: Tool;
strokeWidth: number; strokeWidth: number;
points: number[]; points: number[];
}; };
export type FillRectObject = LayerObjectBase & { type FillRectObject = LayerObjectBase & {
kind: 'fillRect'; kind: 'fillRect';
x: number; x: number;
y: number; y: number;
@ -297,12 +296,6 @@ export const regionalPromptsPersistConfig: PersistConfig<RegionalPromptsState> =
export const $isMouseDown = atom(false); export const $isMouseDown = atom(false);
export const $isMouseOver = atom(false); export const $isMouseOver = atom(false);
export const $cursorPosition = atom<Vector2d | null>(null); export const $cursorPosition = atom<Vector2d | null>(null);
export const $stage = atom<Stage | null>(null);
export const getStage = (): Stage => {
const stage = $stage.get();
assert(stage);
return stage;
};
// IDs for singleton layers and objects // IDs for singleton layers and objects
export const BRUSH_PREVIEW_LAYER_ID = 'brushPreviewLayer'; export const BRUSH_PREVIEW_LAYER_ID = 'brushPreviewLayer';
@ -317,8 +310,8 @@ export const REGIONAL_PROMPT_LAYER_OBJECT_GROUP_NAME = 'regionalPromptLayerObjec
export const REGIONAL_PROMPT_LAYER_BBOX_NAME = 'regionalPromptLayerBbox'; export const REGIONAL_PROMPT_LAYER_BBOX_NAME = 'regionalPromptLayerBbox';
// Getters for non-singleton layer and object IDs // Getters for non-singleton layer and object IDs
export const getLayerId = (layerId: string) => `layer_${layerId}`; const getLayerId = (layerId: string) => `layer_${layerId}`;
export const getLayerLineId = (layerId: string, lineId: string) => `${layerId}.line_${lineId}`; const getLayerLineId = (layerId: string, lineId: string) => `${layerId}.line_${lineId}`;
export const getLayerObjectGroupId = (layerId: string, groupId: string) => `${layerId}.objectGroup_${groupId}`; export const getLayerObjectGroupId = (layerId: string, groupId: string) => `${layerId}.objectGroup_${groupId}`;
export const getLayerBboxId = (layerId: string) => `${layerId}.bbox`; export const getLayerBboxId = (layerId: string) => `${layerId}.bbox`;
export const getLayerTransparencyRectId = (layerId: string) => `${layerId}.transparency_rect`; export const getLayerTransparencyRectId = (layerId: string) => `${layerId}.transparency_rect`;