Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(ui): UX improvements & updated design #5270

Merged
merged 29 commits into from
Dec 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
4ffb1cb
feat(api): add max_prompts constraints
psychedelicious Dec 28, 2023
925518f
feat(ui): ux improvements & redesign
psychedelicious Dec 28, 2023
e371041
feat(ui): reduce button fontweight to semibold
psychedelicious Dec 28, 2023
08b2ae8
feat(ui): change queue icon
psychedelicious Dec 28, 2023
8199d8e
fix(ui): board collapse button styling
psychedelicious Dec 28, 2023
62022a7
fix(ui): canvas layer select cut off
psychedelicious Dec 28, 2023
a557146
fix(ui): restore labels in model manager selects
psychedelicious Dec 28, 2023
a82add9
feat(ui): sort model select options with compatible base model first
psychedelicious Dec 28, 2023
dffed09
fix(ui): fix word break on LoRACard
psychedelicious Dec 28, 2023
6eabcc7
fix(ui): typo in canvas model handler
psychedelicious Dec 28, 2023
45278bf
feat(ui): use primitive style props or memoized sx objects
psychedelicious Dec 29, 2023
6bbf166
feat(ui): move scaling up to image settings -> advanced
psychedelicious Dec 29, 2023
f40eab8
feat(ui): fix control adapters styling
psychedelicious Dec 29, 2023
2a89e1a
feat(ui): generation accordion badges
psychedelicious Dec 29, 2023
fd69b91
feat(ui): use stable objects for animation/native element styles
psychedelicious Dec 29, 2023
a4ff4a4
feat(ui): memoize all components
psychedelicious Dec 29, 2023
4ab2738
fix(ui): fix typing issues
psychedelicious Dec 29, 2023
27b4593
chore(ui): bump deps
psychedelicious Dec 29, 2023
fb5fb0c
feat(ui): update panel lib, move gallery to percentages
psychedelicious Dec 29, 2023
81bf39d
feat(ui): more memoization
psychedelicious Dec 29, 2023
9c843f9
fix(ui): remove errant console.log
psychedelicious Dec 29, 2023
f978f6d
fix(ui): InvEditable, linear field view styling
psychedelicious Dec 29, 2023
3790407
fix(ui): fix InvSlider vertical thumb styling
psychedelicious Dec 29, 2023
45ddd9d
feat(ui): InvSwitch and InvSliderThumb are round
psychedelicious Dec 29, 2023
c1a443a
feat(ui): add refiner cfg scale & steps defaults & marks
psychedelicious Dec 29, 2023
71a02cd
feat(ui): only show refiner models on refiner model select
psychedelicious Dec 29, 2023
b8dbfd4
feat(ui): more memoization
psychedelicious Dec 29, 2023
bb491ea
feat(ui): increase size of clear icon on selects
psychedelicious Dec 29, 2023
0c6f0e6
feat(ui): partial rebuild of model manager internal logic
psychedelicious Dec 29, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
3 changes: 2 additions & 1 deletion invokeai/app/api/routers/utilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,11 @@ class DynamicPromptsResponse(BaseModel):
)
async def parse_dynamicprompts(
prompt: str = Body(description="The prompt to parse with dynamicprompts"),
max_prompts: int = Body(default=1000, description="The max number of prompts to generate"),
max_prompts: int = Body(ge=1, le=10000, default=1000, description="The max number of prompts to generate"),
combinatorial: bool = Body(default=True, description="Whether to use the combinatorial generator"),
) -> DynamicPromptsResponse:
"""Creates a batch process"""
max_prompts = min(max_prompts, 10000)
generator: Union[RandomPromptGenerator, CombinatorialPromptGenerator]
try:
error: Optional[str] = None
Expand Down
38 changes: 37 additions & 1 deletion invokeai/frontend/web/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,16 @@ module.exports = {
'i18next',
'path',
'unused-imports',
'simple-import-sort',
'eslint-plugin-import',
// These rules are too strict for normal usage, but are useful for optimizing rerenders
// '@arthurgeron/react-usememo',
],
root: true,
rules: {
'path/no-relative-imports': ['error', { maxDepth: 0 }],
curly: 'error',
'i18next/no-literal-string': 2,
'i18next/no-literal-string': 'warn',
'react/jsx-no-bind': ['error', { allowBind: true }],
'react/jsx-curly-brace-presence': [
'error',
Expand All @@ -43,6 +47,7 @@ module.exports = {
'no-var': 'error',
'brace-style': 'error',
'prefer-template': 'error',
'import/no-duplicates': 'error',
radix: 'error',
'space-before-blocks': 'error',
'import/prefer-default-export': 'off',
Expand All @@ -57,6 +62,18 @@ module.exports = {
argsIgnorePattern: '^_',
},
],
// These rules are too strict for normal usage, but are useful for optimizing rerenders
// '@arthurgeron/react-usememo/require-usememo': [
// 'warn',
// {
// strict: false,
// checkHookReturnObject: false,
// fix: { addImports: true },
// checkHookCalls: false,

// },
// ],
// '@arthurgeron/react-usememo/require-memo': 'warn',
'@typescript-eslint/ban-ts-comment': 'warn',
'@typescript-eslint/no-explicit-any': 'warn',
'@typescript-eslint/no-empty-interface': [
Expand All @@ -65,7 +82,26 @@ module.exports = {
allowSingleExtends: true,
},
],
'@typescript-eslint/consistent-type-imports': [
'error',
{
prefer: 'type-imports',
fixStyle: 'separate-type-imports',
disallowTypeAnnotations: true,
},
],
'@typescript-eslint/no-import-type-side-effects': 'error',
'simple-import-sort/imports': 'error',
'simple-import-sort/exports': 'error',
},
overrides: [
{
files: ['*.stories.tsx'],
rules: {
'i18next/no-literal-string': 'off',
},
},
],
settings: {
react: {
version: 'detect',
Expand Down
1 change: 1 addition & 0 deletions invokeai/frontend/web/.prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,5 @@ index.html
src/services/api/schema.d.ts
static/
src/theme/css/overlayscrollbars.css
src/theme_/css/overlayscrollbars.css
pnpm-lock.yaml
25 changes: 25 additions & 0 deletions invokeai/frontend/web/.storybook/ReduxInit.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { PropsWithChildren, memo, useEffect } from 'react';
import { modelChanged } from '../src/features/parameters/store/generationSlice';
import { useAppDispatch } from '../src/app/store/storeHooks';
import { useGlobalModifiersInit } from '../src/common/hooks/useGlobalModifiers';
/**
* Initializes some state for storybook. Must be in a different component
* so that it is run inside the redux context.
*/
export const ReduxInit = memo((props: PropsWithChildren) => {
const dispatch = useAppDispatch();
useGlobalModifiersInit();
useEffect(() => {
dispatch(
modelChanged({
model_name: 'test_model',
base_model: 'sd-1',
model_type: 'main',
})
);
}, []);

return props.children;
});

ReduxInit.displayName = 'ReduxInit';
1 change: 1 addition & 0 deletions invokeai/frontend/web/.storybook/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ const config: StorybookConfig = {
'@storybook/addon-links',
'@storybook/addon-essentials',
'@storybook/addon-interactions',
'@storybook/addon-storysource',
],
framework: {
name: '@storybook/react-vite',
Expand Down
25 changes: 15 additions & 10 deletions invokeai/frontend/web/.storybook/preview.tsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
import { Preview } from '@storybook/react';
import { themes } from '@storybook/theming';
import i18n from 'i18next';
import React from 'react';
import { initReactI18next } from 'react-i18next';
import { Provider } from 'react-redux';
import GlobalHotkeys from '../src/app/components/GlobalHotkeys';
import ThemeLocaleProvider from '../src/app/components/ThemeLocaleProvider';
import { $baseUrl } from '../src/app/store/nanostores/baseUrl';
import { createStore } from '../src/app/store/store';
import { Container } from '@chakra-ui/react';
// TODO: Disabled for IDE performance issues with our translation JSON
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
import translationEN from '../public/locales/en.json';
import { ReduxInit } from './ReduxInit';

i18n.use(initReactI18next).init({
lng: 'en',
Expand All @@ -25,17 +26,21 @@ i18n.use(initReactI18next).init({
});

const store = createStore(undefined, false);
$baseUrl.set('http://localhost:9090');

const preview: Preview = {
decorators: [
(Story) => (
<Provider store={store}>
<ThemeLocaleProvider>
<GlobalHotkeys />
<Story />
</ThemeLocaleProvider>
</Provider>
),
(Story) => {
return (
<Provider store={store}>
<ThemeLocaleProvider>
<ReduxInit>
<Story />
</ReduxInit>
</ThemeLocaleProvider>
</Provider>
);
},
],
parameters: {
docs: {
Expand Down
15 changes: 15 additions & 0 deletions invokeai/frontend/web/.unimportedrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"entry": ["src/main.tsx"],
"extensions": [".ts", ".tsx"],
"ignorePatterns": [
"**/node_modules/**",
"dist/**",
"public/**",
"**/*.stories.tsx",
"config/**"
],
"ignoreUnresolved": [],
"ignoreUnimported": ["src/i18.d.ts", "vite.config.ts", "src/vite-env.d.ts"],
"respectGitignore": true,
"ignoreUnused": []
}
2 changes: 1 addition & 1 deletion invokeai/frontend/web/config/common.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import react from '@vitejs/plugin-react-swc';
import { visualizer } from 'rollup-plugin-visualizer';
import { PluginOption, UserConfig } from 'vite';
import type { PluginOption, UserConfig } from 'vite';
import eslint from 'vite-plugin-eslint';
import tsconfigPaths from 'vite-tsconfig-paths';

Expand Down
3 changes: 2 additions & 1 deletion invokeai/frontend/web/config/vite.app.config.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { UserConfig } from 'vite';
import type { UserConfig } from 'vite';

import { commonPlugins } from './common';

export const appConfig: UserConfig = {
Expand Down
5 changes: 3 additions & 2 deletions invokeai/frontend/web/config/vite.package.config.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import path from 'path';
import { UserConfig } from 'vite';
import dts from 'vite-plugin-dts';
import type { UserConfig } from 'vite';
import cssInjectedByJsPlugin from 'vite-plugin-css-injected-by-js';
import dts from 'vite-plugin-dts';

import { commonPlugins } from './common';

export const packageConfig: UserConfig = {
Expand Down
89 changes: 50 additions & 39 deletions invokeai/frontend/web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,17 @@
"lint": "concurrently -g -n eslint,prettier,tsc,madge -c cyan,green,magenta,yellow \"pnpm run lint:eslint\" \"pnpm run lint:prettier\" \"pnpm run lint:tsc\" \"pnpm run lint:madge\"",
"fix": "eslint --fix . && prettier --log-level warn --write .",
"preinstall": "npx only-allow pnpm",
"postinstall": "patch-package && pnpm run theme",
"postinstall": "pnpm run theme",
"theme": "chakra-cli tokens src/theme/theme.ts",
"theme:watch": "chakra-cli tokens src/theme/theme.ts --watch",
"storybook": "storybook dev -p 6006",
"build-storybook": "storybook build"
"build-storybook": "storybook build",
"unimported": "npx unimported"
},
"madge": {
"excludeRegExp": [
"^index.ts$"
],
"detectiveOptions": {
"ts": {
"skipTypeImports": true
Expand All @@ -53,56 +57,56 @@
"@chakra-ui/layout": "^2.3.1",
"@chakra-ui/portal": "^2.1.0",
"@chakra-ui/react": "^2.8.2",
"@chakra-ui/react-use-size": "^2.1.0",
"@chakra-ui/styled-system": "^2.9.2",
"@chakra-ui/theme-tools": "^2.1.2",
"@dagrejs/graphlib": "^2.1.13",
"@dnd-kit/core": "^6.1.0",
"@dnd-kit/utilities": "^3.2.2",
"@emotion/react": "^11.11.1",
"@emotion/react": "^11.11.3",
"@emotion/styled": "^11.11.0",
"@fontsource-variable/inter": "^5.0.16",
"@mantine/core": "^6.0.19",
"@mantine/form": "^6.0.19",
"@mantine/hooks": "^6.0.19",
"@mantine/form": "6.0.21",
"@nanostores/react": "^0.7.1",
"@reduxjs/toolkit": "^2.0.1",
"@roarr/browser-log-writer": "^1.3.0",
"@storybook/manager-api": "^7.6.4",
"@storybook/theming": "^7.6.4",
"chakra-react-select": "^4.7.6",
"compare-versions": "^6.1.0",
"dateformat": "^5.0.3",
"framer-motion": "^10.16.15",
"i18next": "^23.7.8",
"framer-motion": "^10.16.16",
"i18next": "^23.7.12",
"i18next-http-backend": "^2.4.2",
"idb-keyval": "^6.2.1",
"konva": "^9.2.3",
"konva": "^9.3.0",
"lodash-es": "^4.17.21",
"nanostores": "^0.9.5",
"new-github-issue-url": "^1.0.0",
"overlayscrollbars": "^2.4.5",
"overlayscrollbars": "^2.4.6",
"overlayscrollbars-react": "^0.5.3",
"patch-package": "^8.0.0",
"query-string": "^8.1.0",
"react": "^18.2.0",
"react-colorful": "^5.6.1",
"react-dom": "^18.2.0",
"react-dropzone": "^14.2.3",
"react-error-boundary": "^4.0.11",
"react-error-boundary": "^4.0.12",
"react-hook-form": "^7.49.2",
"react-hotkeys-hook": "4.4.1",
"react-i18next": "^13.5.0",
"react-icons": "^4.12.0",
"react-konva": "^18.2.10",
"react-redux": "^9.0.2",
"react-resizable-panels": "^0.0.55",
"react-redux": "^9.0.4",
"react-resizable-panels": "^1.0.5",
"react-select": "5.7.7",
"react-textarea-autosize": "^8.5.3",
"react-use": "^17.4.2",
"react-virtuoso": "^4.6.2",
"reactflow": "^11.10.1",
"redux-dynamic-middlewares": "^2.2.0",
"redux-remember": "^5.0.0",
"redux-remember": "^5.0.1",
"roarr": "^7.21.0",
"serialize-error": "^11.0.3",
"socket.io-client": "^4.7.2",
"type-fest": "^4.8.3",
"type-fest": "^4.9.0",
"use-debounce": "^10.0.0",
"use-image": "^1.1.1",
"uuid": "^9.0.1",
Expand All @@ -117,44 +121,51 @@
"ts-toolbelt": "^9.6.0"
},
"devDependencies": {
"@arthurgeron/eslint-plugin-react-usememo": "^2.2.1",
"@chakra-ui/cli": "^2.4.1",
"@storybook/addon-essentials": "^7.6.4",
"@storybook/addon-interactions": "^7.6.4",
"@storybook/addon-links": "^7.6.4",
"@storybook/blocks": "^7.6.4",
"@storybook/react": "^7.6.4",
"@storybook/react-vite": "^7.6.4",
"@storybook/test": "^7.6.4",
"@storybook/addon-docs": "^7.6.6",
"@storybook/addon-essentials": "^7.6.6",
"@storybook/addon-interactions": "^7.6.6",
"@storybook/addon-links": "^7.6.6",
"@storybook/addon-storysource": "^7.6.6",
"@storybook/blocks": "^7.6.6",
"@storybook/manager-api": "^7.6.6",
"@storybook/react": "^7.6.6",
"@storybook/react-vite": "^7.6.6",
"@storybook/test": "^7.6.6",
"@storybook/theming": "^7.6.6",
"@types/dateformat": "^5.0.2",
"@types/lodash-es": "^4.17.12",
"@types/node": "^20.9.0",
"@types/react": "^18.2.37",
"@types/react-dom": "^18.2.17",
"@types/node": "^20.10.5",
"@types/react": "^18.2.46",
"@types/react-dom": "^18.2.18",
"@types/uuid": "^9.0.7",
"@typescript-eslint/eslint-plugin": "^6.13.2",
"@typescript-eslint/parser": "^6.13.2",
"@typescript-eslint/eslint-plugin": "^6.16.0",
"@typescript-eslint/parser": "^6.16.0",
"@vitejs/plugin-react-swc": "^3.5.0",
"concurrently": "^8.2.2",
"eslint": "^8.55.0",
"eslint": "^8.56.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-i18next": "^6.0.3",
"eslint-plugin-path": "^1.2.2",
"eslint-plugin-import": "^2.29.1",
"eslint-plugin-path": "^1.2.3",
"eslint-plugin-react": "^7.33.2",
"eslint-plugin-react-hooks": "^4.6.0",
"eslint-plugin-simple-import-sort": "^10.0.0",
"eslint-plugin-storybook": "^0.6.15",
"eslint-plugin-unused-imports": "^3.0.0",
"madge": "^6.1.0",
"openapi-types": "^12.1.3",
"openapi-typescript": "^6.7.2",
"prettier": "^3.1.0",
"rollup-plugin-visualizer": "^5.10.0",
"storybook": "^7.6.4",
"openapi-typescript": "^6.7.3",
"prettier": "^3.1.1",
"rollup-plugin-visualizer": "^5.12.0",
"storybook": "^7.6.6",
"ts-toolbelt": "^9.6.0",
"typescript": "^5.3.3",
"vite": "^4.5.1",
"vite-plugin-css-injected-by-js": "^3.3.0",
"vite-plugin-dts": "^3.6.4",
"vite-plugin-css-injected-by-js": "^3.3.1",
"vite-plugin-dts": "^3.7.0",
"vite-plugin-eslint": "^1.8.1",
"vite-tsconfig-paths": "^4.2.2"
"vite-tsconfig-paths": "^4.2.3"
}
}
Loading