Invoke is a leading creative engine that uses image and video generation models to empower professionals, artists, and enthusiasts to generate and create visual media using the latest AI-driven technologies. The solution offers an industry-leading application interface, and serves as the foundation for multiple commercial products.
TypeScript ai-artartificial-intelligencegenerative-artimage-generationimg2imginpaintinglatent-diffusionlinuxmacosoutpaintingstable-diffusiontxt2imgwindows
refactor(webv2): vendor brand icons, drop react-icons
joshistoastd8e9700d2bb2
diff --git a/invokeai/frontend/webv2/package.json b/invokeai/frontend/webv2/package.jsonindex 63c6c1c520..89fb31a2b3 100644--- a/invokeai/frontend/webv2/package.json+++ b/invokeai/frontend/webv2/package.json@@ -61,7 +61,6 @@"react-dom": "^19.2.8","react-hook-tanstack-virtual": "^0.0.4","react-i18next": "^17.0.11",- "react-icons": "^5.7.0","socket.io-client": "^4.8.3","tinykeys": "^4.0.0","use-sync-external-store": "^1.6.0",diff --git a/invokeai/frontend/webv2/pnpm-lock.yaml b/invokeai/frontend/webv2/pnpm-lock.yamlindex d9e25ed78f..c05b923aa3 100644--- a/invokeai/frontend/webv2/pnpm-lock.yaml+++ b/invokeai/frontend/webv2/pnpm-lock.yaml@@ -79,9 +79,6 @@ importers:react-i18next:specifier: ^17.0.11version: 17.0.11([email protected]([email protected]))([email protected]([email protected]))([email protected])([email protected])- react-icons:- specifier: ^5.7.0- version: 5.7.0([email protected])socket.io-client:specifier: ^4.8.3version: 4.8.3@@ -1808,11 +1805,6 @@ packages:typescript:optional: true- resolution: {integrity: sha512-LBLy340Rzqy6+/yVhZKT3B/QpP1BZaesGqasf09HPOBzRarcDIFH0WwXlXQfE7q7ipxK4MSiC5DIBWURCny6fw==}- peerDependencies:- react: '*'-resolution: {integrity: sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==}@@ -3890,10 +3882,6 @@ snapshots:react-dom: 19.2.8([email protected])typescript: 7.0.2- dependencies:- react: 19.2.8-diff --git a/invokeai/frontend/webv2/src/features/models/ui/add-models/AddModelsView.tsx b/invokeai/frontend/webv2/src/features/models/ui/add-models/AddModelsView.tsxindex 15e8644f2a..0501dd73db 100644--- a/invokeai/frontend/webv2/src/features/models/ui/add-models/AddModelsView.tsx+++ b/invokeai/frontend/webv2/src/features/models/ui/add-models/AddModelsView.tsx@@ -26,10 +26,10 @@ import {} from '@platform/state/accountLifecycle';import { getApiErrorMessage } from '@platform/transport/http';import { Button, Scrollable, Tooltip } from '@platform/ui';+import { HuggingFaceIcon } from '@platform/ui/BrandIcon';import { DownloadIcon, FileIcon, FolderIcon, FolderSearchIcon, LinkIcon, SearchIcon } from 'lucide-react';import { useDeferredValue, useMemo, useState } from 'react';import { useTranslation } from 'react-i18next';-import { SiHuggingface } from 'react-icons/si';import { AccessTokenPopover } from './AccessTokenPopover';import { BundleChips } from './BundleChips';@@ -46,7 +46,7 @@ import { useInstallActions } from './useInstallActions';const SOURCE_KIND_ICONS: Record<string, ElementType> = {'models.sourceKind.filePath': FileIcon,'models.sourceKind.folderPath': FolderIcon,- 'models.sourceKind.hfRepo': SiHuggingface,+ 'models.sourceKind.hfRepo': HuggingFaceIcon,'models.sourceKind.url': LinkIcon,};diff --git a/invokeai/frontend/webv2/src/features/models/ui/credentials/ApiKeysSection.tsx b/invokeai/frontend/webv2/src/features/models/ui/credentials/ApiKeysSection.tsxindex a45182ff6e..7434f0942c 100644--- a/invokeai/frontend/webv2/src/features/models/ui/credentials/ApiKeysSection.tsx+++ b/invokeai/frontend/webv2/src/features/models/ui/credentials/ApiKeysSection.tsx@@ -18,10 +18,10 @@ import {} from '@platform/state/accountLifecycle';import { getApiErrorMessage } from '@platform/transport/http';import { Button } from '@platform/ui';+import { HuggingFaceIcon } from '@platform/ui/BrandIcon';import { HexagonIcon } from 'lucide-react';import { useState } from 'react';import { useTranslation } from 'react-i18next';-import { SiHuggingface } from 'react-icons/si';/*** Credentials for every model source, as one uniform grid of key cards:@@ -175,7 +175,7 @@ const HuggingFaceKeyCard = ({ onError }: { onError: (title: string, message: strreturn (<ApiKeyCarddescription={t('models.huggingFaceKeyDescription')}- icon={SiHuggingface}+ icon={HuggingFaceIcon}isLoading={status === null}placeholder="hf_…"status={statusBadge}diff --git a/invokeai/frontend/webv2/src/features/models/ui/credentials/ExternalProviderKeyCards.tsx b/invokeai/frontend/webv2/src/features/models/ui/credentials/ExternalProviderKeyCards.tsxindex e59e5d9038..a0e86f9162 100644--- a/invokeai/frontend/webv2/src/features/models/ui/credentials/ExternalProviderKeyCards.tsx+++ b/invokeai/frontend/webv2/src/features/models/ui/credentials/ExternalProviderKeyCards.tsx@@ -17,10 +17,10 @@ import { useScopedAction } from '@platform/react/useScopedAction';import { assertAccountScopeCurrent, type AccountScope } from '@platform/state/accountLifecycle';import { getApiErrorMessage } from '@platform/transport/http';import { Button } from '@platform/ui';+import { AlibabaCloudIcon, ByteDanceIcon, GoogleGeminiIcon } from '@platform/ui/BrandIcon';import { BotIcon, HexagonIcon } from 'lucide-react';import { useState } from 'react';import { useTranslation } from 'react-i18next';-import { SiAlibabacloud, SiBytedance, SiGooglegemini } from 'react-icons/si';interface ProviderPresentation {icon: ElementType;@@ -31,10 +31,10 @@ interface ProviderPresentation {}const EXTERNAL_PROVIDER_PRESENTATION: Record<string, ProviderPresentation> = {- alibabacloud: { icon: SiAlibabacloud, placeholder: 'sk-…', title: 'Alibaba Cloud (Qwen)' },- gemini: { icon: SiGooglegemini, placeholder: 'AIza…', title: 'Google Gemini' },+ alibabacloud: { icon: AlibabaCloudIcon, placeholder: 'sk-…', title: 'Alibaba Cloud (Qwen)' },+ gemini: { icon: GoogleGeminiIcon, placeholder: 'AIza…', title: 'Google Gemini' },openai: { icon: BotIcon, placeholder: 'sk-…', title: 'OpenAI' },- seedream: { icon: SiBytedance, placeholderKey: 'models.bytePlusApiKeyPlaceholder', title: 'Seedream' },+ seedream: { icon: ByteDanceIcon, placeholderKey: 'models.bytePlusApiKeyPlaceholder', title: 'Seedream' },};/** One key card per provider the backend reports, from the shared store. */diff --git a/invokeai/frontend/webv2/src/features/models/ui/detail/ModelDetail.tsx b/invokeai/frontend/webv2/src/features/models/ui/detail/ModelDetail.tsxindex aa5fdc04a5..d4db0ccaa1 100644--- a/invokeai/frontend/webv2/src/features/models/ui/detail/ModelDetail.tsx+++ b/invokeai/frontend/webv2/src/features/models/ui/detail/ModelDetail.tsx@@ -16,10 +16,10 @@ import {import { useNotify } from '@features/models/ui/useModelsNotify';import { areArraysEqual } from '@platform/state/selectors';import { Button, IconButton, MenuContent } from '@platform/ui';+import { HuggingFaceIcon } from '@platform/ui/BrandIcon';import { ExternalLinkIcon, MoreHorizontalIcon, PencilIcon } from 'lucide-react';import { memo, useCallback, useState } from 'react';import { useTranslation } from 'react-i18next';-import { SiHuggingface } from 'react-icons/si';import { CpuOnlySetting, supportsCpuOnlySetting } from './CpuOnlySetting';import { supportsDefaultSettings, type DefaultSettingsModel } from './defaultSettingsFields';@@ -286,7 +286,7 @@ const ModelDetailActions = ({<HStack flexShrink={0} gap="1" wrap="wrap">{isConvertibleToDiffusers(model) ? (<Button size="xs" variant="outline" onClick={() => setPendingAction({ kind: 'convert', model })}>- <Icon as={SiHuggingface} boxSize="3" />+ <Icon as={HuggingFaceIcon} boxSize="3" />{t('models.convertToDiffusers')}</Button>) : null}diff --git a/invokeai/frontend/webv2/src/features/models/ui/shared/ModelActionsMenu.tsx b/invokeai/frontend/webv2/src/features/models/ui/shared/ModelActionsMenu.tsxindex a80bf34d20..8c5d77358c 100644--- a/invokeai/frontend/webv2/src/features/models/ui/shared/ModelActionsMenu.tsx+++ b/invokeai/frontend/webv2/src/features/models/ui/shared/ModelActionsMenu.tsx@@ -5,10 +5,10 @@ import type { ReactNode } from 'react';import { Icon, Menu } from '@chakra-ui/react';import { isConvertibleToDiffusers } from '@features/models/core/baseIdentity';import { useModelActions } from '@features/models/ui/detail/useModelActions';+import { HuggingFaceIcon } from '@platform/ui/BrandIcon';import { ConfirmDialog } from '@platform/ui/ConfirmDialog';import { RefreshCcwIcon, Trash2Icon } from 'lucide-react';import { useTranslation } from 'react-i18next';-import { SiHuggingface } from 'react-icons/si';/*** The reidentify/convert/delete action set for one model, shared by the@@ -60,7 +60,7 @@ export const ModelActionMenuItems = ({</Menu.Item>{showConvertItem && isConvertibleToDiffusers(model) ? (<Menu.Item value="convert" onClick={() => onRequestConfirm({ kind: 'convert', model })}>- <Icon as={SiHuggingface} boxSize="3.5" />+ <Icon as={HuggingFaceIcon} boxSize="3.5" /><Menu.ItemText fontSize="xs">{t('models.convertToDiffusers')}</Menu.ItemText></Menu.Item>) : null}diff --git a/invokeai/frontend/webv2/src/platform/ui/BrandIcon.tsx b/invokeai/frontend/webv2/src/platform/ui/BrandIcon.tsxnew file mode 100644index 0000000000..9941606d44--- /dev/null+++ b/invokeai/frontend/webv2/src/platform/ui/BrandIcon.tsx@@ -0,0 +1,69 @@+import type { SVGProps } from 'react';++/**+ * Brand marks, vendored from Simple Icons (https://simpleicons.org, CC0-1.0).+ *+ * Everything non-brand is a Lucide icon; brands are the only exception, and+ * there are a handful of them. Both `react-icons/si` and the `simple-icons`+ * package expose their icons through a single ~5 MB barrel module with no+ * per-icon entry point, which the dev server transforms in full to hand back+ * four paths — so the paths live here instead, as the data they are.+ *+ * To add or refresh one: copy the 24×24 path from simpleicons.org (or+ * `npx -y simple-icons@latest`), keeping the slug and title as the upstream+ * name so a later refresh is a straight lookup.+ */++interface BrandIconSource {+ /** Upstream Simple Icons slug, for refreshing the path later. */+ slug: string;+ /** Upstream title, used as the accessible name when the icon is not decorative. */+ title: string;+ /** The 24×24 `path` `d` attribute. */+ path: string;+}++const createBrandIcon = ({ path, title }: BrandIconSource) => {+ const BrandIcon = (props: SVGProps<SVGSVGElement>) => (+ <svg+ fill="currentColor"+ height="1em"+ role="img"+ viewBox="0 0 24 24"+ width="1em"+ xmlns="http://www.w3.org/2000/svg"+ {...props}+ >+ <title>{title}</title>+ <path d={path} />+ </svg>+ );++ BrandIcon.displayName = `BrandIcon(${title})`;++ return BrandIcon;+};++export const HuggingFaceIcon = createBrandIcon({+ path: 'M12.025 1.13c-5.77 0-10.449 4.647-10.449 10.378 0 1.112.178 2.181.503 3.185.064-.222.203-.444.416-.577a.96.96 0 0 1 .524-.15c.293 0 .584.124.84.284.278.173.48.408.71.694.226.282.458.611.684.951v-.014c.017-.324.106-.622.264-.874s.403-.487.762-.543c.3-.047.596.06.787.203s.31.313.4.467c.15.257.212.468.233.542.01.026.653 1.552 1.657 2.54.616.605 1.01 1.223 1.082 1.912.055.537-.096 1.059-.38 1.572.637.121 1.294.187 1.967.187.657 0 1.298-.063 1.921-.178-.287-.517-.44-1.041-.384-1.581.07-.69.465-1.307 1.081-1.913 1.004-.987 1.647-2.513 1.657-2.539.021-.074.083-.285.233-.542.09-.154.208-.323.4-.467a1.08 1.08 0 0 1 .787-.203c.359.056.604.29.762.543s.247.55.265.874v.015c.225-.34.457-.67.683-.952.23-.286.432-.52.71-.694.257-.16.547-.284.84-.285a.97.97 0 0 1 .524.151c.228.143.373.388.43.625l.006.04a10.3 10.3 0 0 0 .534-3.273c0-5.731-4.678-10.378-10.449-10.378M8.327 6.583a1.5 1.5 0 0 1 .713.174 1.487 1.487 0 0 1 .617 2.013c-.183.343-.762-.214-1.102-.094-.38.134-.532.914-.917.71a1.487 1.487 0 0 1 .69-2.803m7.486 0a1.487 1.487 0 0 1 .689 2.803c-.385.204-.536-.576-.916-.71-.34-.12-.92.437-1.103.094a1.487 1.487 0 0 1 .617-2.013 1.5 1.5 0 0 1 .713-.174m-10.68 1.55a.96.96 0 1 1 0 1.921.96.96 0 0 1 0-1.92m13.838 0a.96.96 0 1 1 0 1.92.96.96 0 0 1 0-1.92M8.489 11.458c.588.01 1.965 1.157 3.572 1.164 1.607-.007 2.984-1.155 3.572-1.164.196-.003.305.12.305.454 0 .886-.424 2.328-1.563 3.202-.22-.756-1.396-1.366-1.63-1.32q-.011.001-.02.006l-.044.026-.01.008-.03.024q-.018.017-.035.036l-.032.04a1 1 0 0 0-.058.09l-.014.025q-.049.088-.11.19a1 1 0 0 1-.083.116 1.2 1.2 0 0 1-.173.18q-.035.029-.075.058a1.3 1.3 0 0 1-.251-.243 1 1 0 0 1-.076-.107c-.124-.193-.177-.363-.337-.444-.034-.016-.104-.008-.2.022q-.094.03-.216.087-.06.028-.125.063l-.13.074q-.067.04-.136.086a3 3 0 0 0-.135.096 3 3 0 0 0-.26.219 2 2 0 0 0-.12.121 2 2 0 0 0-.106.128l-.002.002a2 2 0 0 0-.09.132l-.001.001a1.2 1.2 0 0 0-.105.212q-.013.036-.024.073c-1.139-.875-1.563-2.317-1.563-3.203 0-.334.109-.457.305-.454m.836 10.354c.824-1.19.766-2.082-.365-3.194-1.13-1.112-1.789-2.738-1.789-2.738s-.246-.945-.806-.858-.97 1.499.202 2.362c1.173.864-.233 1.45-.685.64-.45-.812-1.683-2.896-2.322-3.295s-1.089-.175-.938.647 2.822 2.813 2.562 3.244-1.176-.506-1.176-.506-2.866-2.567-3.49-1.898.473 1.23 2.037 2.16c1.564.932 1.686 1.178 1.464 1.53s-3.675-2.511-4-1.297c-.323 1.214 3.524 1.567 3.287 2.405-.238.839-2.71-1.587-3.216-.642-.506.946 3.49 2.056 3.522 2.064 1.29.33 4.568 1.028 5.713-.624m5.349 0c-.824-1.19-.766-2.082.365-3.194 1.13-1.112 1.789-2.738 1.789-2.738s.246-.945.806-.858.97 1.499-.202 2.362c-1.173.864.233 1.45.685.64.451-.812 1.683-2.896 2.322-3.295s1.089-.175.938.647-2.822 2.813-2.562 3.244 1.176-.506 1.176-.506 2.866-2.567 3.49-1.898-.473 1.23-2.037 2.16c-1.564.932-1.686 1.178-1.464 1.53s3.675-2.511 4-1.297c.323 1.214-3.524 1.567-3.287 2.405.238.839 2.71-1.587 3.216-.642.506.946-3.49 2.056-3.522 2.064-1.29.33-4.568 1.028-5.713-.624',+ slug: 'huggingface',+ title: 'Hugging Face',+});++export const AlibabaCloudIcon = createBrandIcon({+ path: 'M3.996 4.517h5.291L8.01 6.324 4.153 7.506a1.668 1.668 0 0 0-1.165 1.601v5.786a1.668 1.668 0 0 0 1.165 1.6l3.857 1.183 1.277 1.807H3.996A3.996 3.996 0 0 1 0 15.487V8.513a3.996 3.996 0 0 1 3.996-3.996m16.008 0h-5.291l1.277 1.807 3.857 1.182c.715.227 1.17.889 1.165 1.601v5.786a1.668 1.668 0 0 1-1.165 1.6l-3.857 1.183-1.277 1.807h5.291A3.996 3.996 0 0 0 24 15.487V8.513a3.996 3.996 0 0 0-3.996-3.996m-4.007 8.345H8.002v-1.804h7.995Z',+ slug: 'alibabacloud',+ title: 'Alibaba Cloud',+});++export const ByteDanceIcon = createBrandIcon({+ path: 'M19.8772 1.4685L24 2.5326v18.9426l-4.1228 1.0563V1.4685zm-13.3481 9.428l4.115 1.0641v8.9786l-4.115 1.0642v-11.107zM0 2.572l4.115 1.0642v16.7354L0 21.428V2.572zm17.4553 5.6205v11.107l-4.1228-1.0642V9.2568l4.1228-1.0642z',+ slug: 'bytedance',+ title: 'ByteDance',+});++export const GoogleGeminiIcon = createBrandIcon({+ path: 'M11.04 19.32Q12 21.51 12 24q0-2.49.93-4.68.96-2.19 2.58-3.81t3.81-2.55Q21.51 12 24 12q-2.49 0-4.68-.93a12.3 12.3 0 0 1-3.81-2.58 12.3 12.3 0 0 1-2.58-3.81Q12 2.49 12 0q0 2.49-.96 4.68-.93 2.19-2.55 3.81a12.3 12.3 0 0 1-3.81 2.58Q2.49 12 0 12q2.49 0 4.68.96 2.19.93 3.81 2.55t2.55 3.81',+ slug: 'googlegemini',+ title: 'Google Gemini',+});