From 85888030c38a32e3558b5cd3d9a6497f49288228 Mon Sep 17 00:00:00 2001 From: Mary Hipp Date: Wed, 15 Mar 2023 14:38:22 -0400 Subject: [PATCH 1/7] more things needed for header --- invokeai/frontend/web/index.d.ts | 12 +++++++++++- .../web/src/common/components/IAIPopover.tsx | 2 +- invokeai/frontend/web/src/exports.tsx | 4 +++- 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/invokeai/frontend/web/index.d.ts b/invokeai/frontend/web/index.d.ts index bf6edb98bc..ef1d5cf8fe 100644 --- a/invokeai/frontend/web/index.d.ts +++ b/invokeai/frontend/web/index.d.ts @@ -1,4 +1,6 @@ import React, { PropsWithChildren } from 'react'; +import { IAIPopoverProps } from '../web/src/common/components/IAIPopover'; +import { IAIIconButtonProps } from '../web/src/common/components/IAIIconButton'; export {}; @@ -50,9 +52,17 @@ declare module '@invoke-ai/invoke-ai-ui' { declare class InvokeAiLogoComponent extends React.Component { public constructor(props: InvokeAILogoComponentProps); } + + declare class IAIPopover extends React.Component { + public constructor(props: IAIPopoverProps); + } + + declare class IAIIconButton extends React.Component { + public constructor(props: IAIIconButtonProps); + } } declare function Invoke(props: PropsWithChildren): JSX.Element; -export { ThemeChanger, InvokeAiLogoComponent }; +export { ThemeChanger, InvokeAiLogoComponent, IAIPopover, IAIIconButton }; export = Invoke; diff --git a/invokeai/frontend/web/src/common/components/IAIPopover.tsx b/invokeai/frontend/web/src/common/components/IAIPopover.tsx index 46a08e97e3..ba3fbdd109 100644 --- a/invokeai/frontend/web/src/common/components/IAIPopover.tsx +++ b/invokeai/frontend/web/src/common/components/IAIPopover.tsx @@ -8,7 +8,7 @@ import { } from '@chakra-ui/react'; import { memo, ReactNode } from 'react'; -type IAIPopoverProps = PopoverProps & { +export type IAIPopoverProps = PopoverProps & { triggerComponent: ReactNode; triggerContainerProps?: BoxProps; children: ReactNode; diff --git a/invokeai/frontend/web/src/exports.tsx b/invokeai/frontend/web/src/exports.tsx index c1e767891a..853b606dd1 100644 --- a/invokeai/frontend/web/src/exports.tsx +++ b/invokeai/frontend/web/src/exports.tsx @@ -2,6 +2,8 @@ import Component from './component'; import InvokeAiLogoComponent from './features/system/components/InvokeAILogoComponent'; import ThemeChanger from './features/system/components/ThemeChanger'; +import IAIPopover from './common/components/IAIPopover'; +import IAIIconButton from './common/components/IAIIconButton'; export default Component; -export { InvokeAiLogoComponent, ThemeChanger }; +export { InvokeAiLogoComponent, ThemeChanger, IAIPopover, IAIIconButton }; From c2922d59910fac722a8bc4b459321d7cc4921164 Mon Sep 17 00:00:00 2001 From: Mary Hipp Date: Wed, 15 Mar 2023 16:12:51 -0400 Subject: [PATCH 2/7] add settingsmodal --- invokeai/frontend/web/index.d.ts | 12 +++++++++++- invokeai/frontend/web/src/exports.tsx | 9 ++++++++- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/invokeai/frontend/web/index.d.ts b/invokeai/frontend/web/index.d.ts index ef1d5cf8fe..a3ab75d17c 100644 --- a/invokeai/frontend/web/index.d.ts +++ b/invokeai/frontend/web/index.d.ts @@ -60,9 +60,19 @@ declare module '@invoke-ai/invoke-ai-ui' { declare class IAIIconButton extends React.Component { public constructor(props: IAIIconButtonProps); } + + declare class SettingsModal extends React.Component { + public constructor(props: SettingsModalProps); + } } declare function Invoke(props: PropsWithChildren): JSX.Element; -export { ThemeChanger, InvokeAiLogoComponent, IAIPopover, IAIIconButton }; +export { + ThemeChanger, + InvokeAiLogoComponent, + IAIPopover, + IAIIconButton, + SettingsModal, +}; export = Invoke; diff --git a/invokeai/frontend/web/src/exports.tsx b/invokeai/frontend/web/src/exports.tsx index 853b606dd1..35c6bb5022 100644 --- a/invokeai/frontend/web/src/exports.tsx +++ b/invokeai/frontend/web/src/exports.tsx @@ -4,6 +4,13 @@ import InvokeAiLogoComponent from './features/system/components/InvokeAILogoComp import ThemeChanger from './features/system/components/ThemeChanger'; import IAIPopover from './common/components/IAIPopover'; import IAIIconButton from './common/components/IAIIconButton'; +import SettingsModal from './features/system/components/SettingsModal/SettingsModal'; export default Component; -export { InvokeAiLogoComponent, ThemeChanger, IAIPopover, IAIIconButton }; +export { + InvokeAiLogoComponent, + ThemeChanger, + IAIPopover, + IAIIconButton, + SettingsModal, +}; From 74e83dda54cce032466f47be6f35f69f646218cb Mon Sep 17 00:00:00 2001 From: Mary Hipp Date: Tue, 21 Mar 2023 10:10:48 -0400 Subject: [PATCH 3/7] update type --- invokeai/frontend/web/index.d.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/invokeai/frontend/web/index.d.ts b/invokeai/frontend/web/index.d.ts index a3ab75d17c..2753fc2fb6 100644 --- a/invokeai/frontend/web/index.d.ts +++ b/invokeai/frontend/web/index.d.ts @@ -45,23 +45,23 @@ declare global { } declare module '@invoke-ai/invoke-ai-ui' { - declare class ThemeChanger extends React.Component { + declare class ThemeChanger extends React.FunctionComponent { public constructor(props: ThemeChangerProps); } - declare class InvokeAiLogoComponent extends React.Component { + declare class InvokeAiLogoComponent extends React.FunctionComponent { public constructor(props: InvokeAILogoComponentProps); } - declare class IAIPopover extends React.Component { + declare class IAIPopover extends React.FunctionComponent { public constructor(props: IAIPopoverProps); } - declare class IAIIconButton extends React.Component { + declare class IAIIconButton extends React.FunctionComponent { public constructor(props: IAIIconButtonProps); } - declare class SettingsModal extends React.Component { + declare class SettingsModal extends React.FunctionComponent { public constructor(props: SettingsModalProps); } } From 278c14ba2ec522550b26a10374925a6034017fe9 Mon Sep 17 00:00:00 2001 From: Mary Hipp Date: Tue, 21 Mar 2023 10:18:38 -0400 Subject: [PATCH 4/7] try jsx.element --- invokeai/frontend/web/index.d.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/invokeai/frontend/web/index.d.ts b/invokeai/frontend/web/index.d.ts index 2753fc2fb6..48d406d800 100644 --- a/invokeai/frontend/web/index.d.ts +++ b/invokeai/frontend/web/index.d.ts @@ -45,23 +45,23 @@ declare global { } declare module '@invoke-ai/invoke-ai-ui' { - declare class ThemeChanger extends React.FunctionComponent { + declare class ThemeChanger extends JSX.Element { public constructor(props: ThemeChangerProps); } - declare class InvokeAiLogoComponent extends React.FunctionComponent { + declare class InvokeAiLogoComponent extends JSX.Element { public constructor(props: InvokeAILogoComponentProps); } - declare class IAIPopover extends React.FunctionComponent { + declare class IAIPopover extends JSX.Element { public constructor(props: IAIPopoverProps); } - declare class IAIIconButton extends React.FunctionComponent { + declare class IAIIconButton extends JSX.Element { public constructor(props: IAIIconButtonProps); } - declare class SettingsModal extends React.FunctionComponent { + declare class SettingsModal extends JSX.Element { public constructor(props: SettingsModalProps); } } From eb7ae2588c6019786632c449bb00554e4f0c464e Mon Sep 17 00:00:00 2001 From: Mary Hipp Date: Tue, 21 Mar 2023 10:21:58 -0400 Subject: [PATCH 5/7] unused var --- invokeai/frontend/web/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/invokeai/frontend/web/index.d.ts b/invokeai/frontend/web/index.d.ts index 48d406d800..188f3eb8fa 100644 --- a/invokeai/frontend/web/index.d.ts +++ b/invokeai/frontend/web/index.d.ts @@ -1,4 +1,4 @@ -import React, { PropsWithChildren } from 'react'; +import { PropsWithChildren } from 'react'; import { IAIPopoverProps } from '../web/src/common/components/IAIPopover'; import { IAIIconButtonProps } from '../web/src/common/components/IAIIconButton'; From 26f71d35366045e52974537b2fdff65982814b0b Mon Sep 17 00:00:00 2001 From: Mary Hipp Date: Tue, 21 Mar 2023 10:28:29 -0400 Subject: [PATCH 6/7] change back --- invokeai/frontend/web/index.d.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/invokeai/frontend/web/index.d.ts b/invokeai/frontend/web/index.d.ts index 188f3eb8fa..a3ab75d17c 100644 --- a/invokeai/frontend/web/index.d.ts +++ b/invokeai/frontend/web/index.d.ts @@ -1,4 +1,4 @@ -import { PropsWithChildren } from 'react'; +import React, { PropsWithChildren } from 'react'; import { IAIPopoverProps } from '../web/src/common/components/IAIPopover'; import { IAIIconButtonProps } from '../web/src/common/components/IAIIconButton'; @@ -45,23 +45,23 @@ declare global { } declare module '@invoke-ai/invoke-ai-ui' { - declare class ThemeChanger extends JSX.Element { + declare class ThemeChanger extends React.Component { public constructor(props: ThemeChangerProps); } - declare class InvokeAiLogoComponent extends JSX.Element { + declare class InvokeAiLogoComponent extends React.Component { public constructor(props: InvokeAILogoComponentProps); } - declare class IAIPopover extends JSX.Element { + declare class IAIPopover extends React.Component { public constructor(props: IAIPopoverProps); } - declare class IAIIconButton extends JSX.Element { + declare class IAIIconButton extends React.Component { public constructor(props: IAIIconButtonProps); } - declare class SettingsModal extends JSX.Element { + declare class SettingsModal extends React.Component { public constructor(props: SettingsModalProps); } } From db079a27336b18c2a0cd9a14914d4fa04337d931 Mon Sep 17 00:00:00 2001 From: Mary Hipp Date: Tue, 21 Mar 2023 10:29:27 -0400 Subject: [PATCH 7/7] remove unneeded build:package code --- invokeai/frontend/web/package.json | 1 - invokeai/frontend/web/vite.config.ts | 21 --------------------- 2 files changed, 22 deletions(-) diff --git a/invokeai/frontend/web/package.json b/invokeai/frontend/web/package.json index 1c37b68156..c47948746d 100644 --- a/invokeai/frontend/web/package.json +++ b/invokeai/frontend/web/package.json @@ -6,7 +6,6 @@ "prepare": "cd ../../../ && husky install invokeai/frontend/web/.husky", "dev": "concurrently \"vite dev\" \"yarn run theme:watch\"", "build": "yarn run lint && vite build", - "build:package": "vite build --mode=package", "preview": "vite preview", "lint:madge": "madge --circular src/main.tsx", "lint:eslint": "eslint --max-warnings=0 .", diff --git a/invokeai/frontend/web/vite.config.ts b/invokeai/frontend/web/vite.config.ts index 3b6a051355..a6071341b3 100644 --- a/invokeai/frontend/web/vite.config.ts +++ b/invokeai/frontend/web/vite.config.ts @@ -1,4 +1,3 @@ -import path from 'path'; import react from '@vitejs/plugin-react-swc'; import { visualizer } from 'rollup-plugin-visualizer'; import { defineConfig, PluginOption } from 'vite'; @@ -58,26 +57,6 @@ export default defineConfig(({ mode }) => { // sourcemap: true, // this can be enabled if needed, it adds ovwer 15MB to the commit }, }; - } else if (mode === 'package') { - return { - ...common, - build: { - ...common.build, - lib: { - entry: path.resolve(__dirname, 'src/exports.tsx'), - name: 'InvokeAI UI', - fileName: (format) => `invoke-ai-ui.${format}.js`, - }, - rollupOptions: { - external: ['react', 'react-dom'], - output: { - globals: { - react: 'React', - }, - }, - }, - }, - }; } else { return { ...common,