From f6b1da0b89f036f6d78501b6b22c63452c134d2f Mon Sep 17 00:00:00 2001 From: Pavol Hejny Date: Fri, 15 Sep 2023 17:01:56 +0200 Subject: [PATCH 01/20] Revert "Moving TODOs in next branch" This reverts commit f027014b3c6ae111d0c82a3f683b10d9d88d91a6. --- src/utils/supabase/provideClientId.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/utils/supabase/provideClientId.ts b/src/utils/supabase/provideClientId.ts index db2ebc13e..65d36ca6e 100644 --- a/src/utils/supabase/provideClientId.ts +++ b/src/utils/supabase/provideClientId.ts @@ -40,10 +40,15 @@ export async function provideClientId(options: IProvideClientIdOptions): Promise return clientId; } + // TODO: !!! promptForm or some verify callback + // TODO: !!! Add preferences for email receiving + // TODO: !!! Add preferences + const email = await promptDialogue({ prompt: `Please write your email`, placeholder: `john.smith@gmail.com`, defaultValue: `@`, + // !!! isCloseable: true }); if (!isValidEmail(email)) { @@ -56,6 +61,7 @@ export async function provideClientId(options: IProvideClientIdOptions): Promise } /** + * TODO: [🧠] !!! What should happen if user refuses to verify email? * TODO: [0] Implement isVerifiedEmailRequired * TODO: [🧠] This should be probbably in some other folder than supabase */ From 6d61e8ca0d82ba707347047885610e0af8a30f58 Mon Sep 17 00:00:00 2001 From: Pavol Hejny Date: Fri, 15 Sep 2023 17:31:17 +0200 Subject: [PATCH 02/20] isCloseable --- src/components/Dialogues/dialogues/promptDialogue.tsx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/components/Dialogues/dialogues/promptDialogue.tsx b/src/components/Dialogues/dialogues/promptDialogue.tsx index b93e2ec75..16a6aa88d 100644 --- a/src/components/Dialogues/dialogues/promptDialogue.tsx +++ b/src/components/Dialogues/dialogues/promptDialogue.tsx @@ -23,7 +23,11 @@ export interface IPromptDialogueOptions { */ placeholder?: string; - // TODO: !!! isCloseable + /** + * If true, the prompt can be closed by the user + * When the prompt is closed, the answer is `null` + */ + isCloseable: boolean; } /** From 4c40dc2b66b5cabea088bbcf3d1d28ff08d7719b Mon Sep 17 00:00:00 2001 From: Pavol Hejny Date: Wed, 20 Sep 2023 00:36:04 +0200 Subject: [PATCH 03/20] TODOs --- .../Dialogues/dialogues/promptDialogue.tsx | 16 +++++++++++++++- src/utils/supabase/provideClientId.ts | 2 +- .../createNewWallpaper.worker.ts | 2 ++ 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/src/components/Dialogues/dialogues/promptDialogue.tsx b/src/components/Dialogues/dialogues/promptDialogue.tsx index dfc4bcfdd..c5d8afb2b 100644 --- a/src/components/Dialogues/dialogues/promptDialogue.tsx +++ b/src/components/Dialogues/dialogues/promptDialogue.tsx @@ -28,6 +28,11 @@ export interface IPromptDialogueOptions { * When the prompt is closed, the answer is `null` */ isCloseable: boolean; + + /** + * If set, the prompt will be automatically submitted after the given number of milliseconds + */ + autoSubmit?: number; } /** @@ -51,7 +56,10 @@ export interface IPromptInQueue extends IPromptDialogueOptions { * Pops up the co-pilot panel with a prompt dialogue. */ export async function promptDialogue(options: IPromptDialogueOptions): Promise { - const { prompt, defaultValue, placeholder } = options; + const { prompt, defaultValue, placeholder, isCloseable, autoSubmit } = options; + + // TODO: !!! Implement isCloseable + // TODO: !!! autoSubmit const promptInQueue: IPromptInQueue = { prompt, @@ -100,6 +108,12 @@ export async function promptDialogue(options: IPromptDialogueOptions): Promise Date: Wed, 20 Sep 2023 16:29:02 +0200 Subject: [PATCH 04/20] Move interfaces into separate folder --- .../Dialogues/dialogues/promptDialogue.tsx | 45 +------------------ .../interfaces/PromptDialogueOptions.ts | 31 +++++++++++++ .../Dialogues/interfaces/PromptInQueue.ts | 18 ++++++++ src/workers/0-Workerify/PostMessages.ts | 2 +- 4 files changed, 52 insertions(+), 44 deletions(-) create mode 100644 src/components/Dialogues/interfaces/PromptDialogueOptions.ts create mode 100644 src/components/Dialogues/interfaces/PromptInQueue.ts diff --git a/src/components/Dialogues/dialogues/promptDialogue.tsx b/src/components/Dialogues/dialogues/promptDialogue.tsx index c5d8afb2b..43235869f 100644 --- a/src/components/Dialogues/dialogues/promptDialogue.tsx +++ b/src/components/Dialogues/dialogues/promptDialogue.tsx @@ -2,55 +2,14 @@ import { forTime } from 'waitasecond'; import { isRunningInWebWorker } from '../../../utils/isRunningInWhatever'; import { message } from '../../../utils/typeAliases'; import { IMessageMainToWorker, IMessagePromptDialogue } from '../../../workers/0-Workerify/PostMessages'; +import { IPromptDialogueOptions } from '../interfaces/PromptDialogueOptions'; +import { IPromptInQueue } from '../interfaces/PromptInQueue'; import { isDialoguesRendered } from '../locks/Dialogues.lock'; import { promptDialogueQueue } from '../queues/prompts'; -export interface IPromptDialogueOptions { - /** - * Prompt message - * - * Note: This is not a prompt to language model but a prompt to the user - */ - prompt: message; - /** - * Default value for the input/textarea - */ - defaultValue: string | null; - /** - * Placeholder for the input/textarea - */ - placeholder?: string; - /** - * If true, the prompt can be closed by the user - * When the prompt is closed, the answer is `null` - */ - isCloseable: boolean; - - /** - * If set, the prompt will be automatically submitted after the given number of milliseconds - */ - autoSubmit?: number; -} - -/** - * Represents a prompt message that is waiting for an answer or is already answered - * - * Note: This is not a prompt to language model but a prompt to the user - * @private this should be used only withing this folder Dialogues - */ -export interface IPromptInQueue extends IPromptDialogueOptions { - /** - * Answer to the prompt - * - * - `undefined` means that the prompt is not answered yet and is waiting for an answer - * - `null` means that the prompt is answered with `null` - * - `string` means the answer to the prompt - */ - answer: undefined | string | null; -} /** * Pops up the co-pilot panel with a prompt dialogue. diff --git a/src/components/Dialogues/interfaces/PromptDialogueOptions.ts b/src/components/Dialogues/interfaces/PromptDialogueOptions.ts new file mode 100644 index 000000000..c582d2fc4 --- /dev/null +++ b/src/components/Dialogues/interfaces/PromptDialogueOptions.ts @@ -0,0 +1,31 @@ +import { message } from '../../../utils/typeAliases'; + +export interface IPromptDialogueOptions { + /** + * Prompt message + * + * Note: This is not a prompt to language model but a prompt to the user + */ + prompt: message; + + /** + * Default value for the input/textarea + */ + defaultValue: string | null; + + /** + * Placeholder for the input/textarea + */ + placeholder?: string; + + /** + * If true, the prompt can be closed by the user + * When the prompt is closed, the answer is `null` + */ + isCloseable: boolean; + + /** + * If set, the prompt will be automatically submitted after the given number of milliseconds + */ + autoSubmit?: number; +} diff --git a/src/components/Dialogues/interfaces/PromptInQueue.ts b/src/components/Dialogues/interfaces/PromptInQueue.ts new file mode 100644 index 000000000..1571fb864 --- /dev/null +++ b/src/components/Dialogues/interfaces/PromptInQueue.ts @@ -0,0 +1,18 @@ +import { IPromptDialogueOptions } from "./PromptDialogueOptions"; + +/** + * Represents a prompt message that is waiting for an answer or is already answered + * + * Note: This is not a prompt to language model but a prompt to the user + * @private this should be used only withing this folder Dialogues + */ +export interface IPromptInQueue extends IPromptDialogueOptions { + /** + * Answer to the prompt + * + * - `undefined` means that the prompt is not answered yet and is waiting for an answer + * - `null` means that the prompt is answered with `null` + * - `string` means the answer to the prompt + */ + answer: undefined | string | null; +} diff --git a/src/workers/0-Workerify/PostMessages.ts b/src/workers/0-Workerify/PostMessages.ts index 749829c12..56f71955d 100644 --- a/src/workers/0-Workerify/PostMessages.ts +++ b/src/workers/0-Workerify/PostMessages.ts @@ -1,5 +1,5 @@ import { Promisable } from 'type-fest'; -import { IPromptDialogueOptions } from '../../components/Dialogues/dialogues/promptDialogue'; +import type { IPromptDialogueOptions } from '../../components/Dialogues/interfaces/PromptDialogueOptions'; import { TaskProgress } from '../../components/TaskInProgress/task/TaskProgress'; export type TransferableObject = any /* <-[0] */; From 28dc612839b2beb9bbd5eb72d9912fe6bff519d9 Mon Sep 17 00:00:00 2001 From: Pavol Hejny Date: Wed, 20 Sep 2023 16:35:07 +0200 Subject: [PATCH 05/20] Refactoring: Optimize imports --- .../generate-wallpapers-content.ts | 2 +- .../repair-wallpapers-content.ts | 2 +- scripts/integration-test-with-server/forCondition.ts | 2 +- scripts/playground/playground.ts | 2 +- scripts/utils/autocommit/commit.ts | 2 +- scripts/utils/execCommand/execCommand.ts | 2 +- .../hardcoded-wallpaper/getHardcodedWallpapers.ts | 2 +- scripts/utils/prettify.ts | 2 +- .../prompt-templates/createContentPromptTemplate.ts | 2 +- .../prompt-templates/createFontPromptTemplate.ts | 2 +- .../prompt-templates/createTitlePromptTemplate.ts | 2 +- src/ai/text-to-text/writeWallpaperContent.ts | 2 +- src/components/AiComponents/AiComponentsRoot.tsx | 5 +++-- .../AnalyticsAndIntegrations.tsx | 2 +- src/components/AppHead/WallpaperAppHead.tsx | 3 ++- .../AsyncContentComponent/AsyncContentComponent.tsx | 4 ++-- src/components/ColorPreview/ColorInput/ColorInput.tsx | 2 +- .../RandomWallpaper/RandomWallpaperManager.ts | 2 +- src/components/CopilotPanel/CopilotPanel.tsx | 2 +- src/components/CreateZone/CreateZone.tsx | 2 +- src/components/Dialogues/dialogues/promptDialogue.tsx | 9 ++------- src/components/ExportComment/ExportCommentedBlock.tsx | 4 ++-- src/components/ExportModal/ExportModal.tsx | 2 +- .../ExportPreviewModal/ExportPreviewModal.tsx | 2 +- .../Gallery/GalleryFilter/GalleryFilterInput.tsx | 2 +- .../Gallery/GalleryFilter/IGalleryFilter.ts | 2 +- src/components/Hint/Hint.tsx | 3 ++- src/components/ImportFonts/addFontToContent.ts | 2 +- .../ImportFonts/extractFontsFromContent.test.ts | 2 +- src/components/Items/Item.tsx | 2 +- src/components/Items/Items.tsx | 2 +- src/components/MarkdownContent/MarkdownContent.tsx | 3 +-- src/components/MarkdownContent/mapLinksInHtml.test.ts | 2 +- .../MarkdownContent/markdownConverter.test.ts | 3 +-- src/components/Modal/00-Modal.tsx | 3 ++- src/components/NoSsr/NoCsr.tsx | 2 +- src/components/NoSsr/NoSsr.tsx | 2 +- src/components/Section/Section.tsx | 2 +- src/components/Select/Select.tsx | 4 ++-- src/components/Shuffle/Shuffle.tsx | 3 ++- src/components/SimpleLayout/Center.tsx | 2 +- src/components/SimpleLayout/TakeNoSpace.tsx | 2 +- src/components/StaticLayout/StaticLayout.tsx | 2 +- src/components/TaskInProgress/TasksInProgress.tsx | 2 +- .../TaskInProgress/task/joinTasksProgress.ts | 2 +- src/components/TaskInProgress/task/mock/_tasks.tsx | 2 +- .../task/mock/mockedEndlessMultitask.ts.todo | 6 +++--- .../TaskInProgress/task/mock/mockedMultitask.ts | 6 +++--- .../task/mock/mockedMultitaskWithPrompts.tsx | 6 +++--- src/components/Translate/Translate.tsx | 3 +-- .../UploadNewWallpaper/UploadNewWallpaper.tsx | 7 ++++--- src/components/UploadZone/UploadZone.tsx | 3 ++- src/components/WallpaperContent/WallpaperContent.tsx | 2 +- src/components/WallpaperContent/getPageContent.ts | 2 +- src/components/Whois/AdvancedDomainsChecker.tsx | 3 +-- src/components/_Sample/Sample.tsx | 2 +- src/export/exportAsHtml.tsx | 2 +- src/export/splitCss.test.ts | 2 +- src/export/utils/blobToDataurl.ts | 2 +- src/export/utils/prettifyJavascript.test.ts | 2 +- src/export/utils/removeSourceMaps.test.ts | 2 +- src/export/utils/removeTodoComments.test.ts | 2 +- src/pages/api/update-wallpaper-content.ts | 2 +- src/pages/experiments/loading+prompt.tsx | 2 +- src/pages/experiments/loading+tasks.tsx | 2 +- src/utils/aspect-ratio/aspectRatioRangeExplain.ts | 2 +- src/utils/aspect-ratio/expectAspectRatioInRange.ts | 2 +- src/utils/aspect-ratio/expectAspectRatioNotInRange.ts | 2 +- src/utils/aspect-ratio/visualizeAspectRatio.ts | 2 +- src/utils/cdn/classes/DigitalOceanSpaces.ts | 2 +- src/utils/color/Color.ts | 2 +- src/utils/color/utils/mixColors.ts | 4 ++-- src/utils/computeWallpaperUriid.test.ts | 2 +- src/utils/content/detectContentFormat.test.ts | 2 +- .../content/extractDescriptionFromContent.test.ts | 2 +- src/utils/content/extractDescriptionFromHtml.test.ts | 2 +- src/utils/content/extractDescriptionFromHtml.ts | 4 ++-- .../content/extractFirstParagraphFromMarkdown.test.ts | 2 +- .../content/extractFirstParagraphFromMarkdown.ts | 2 +- src/utils/content/extractTitleFromContent.test.ts | 2 +- src/utils/content/extractTitleFromHtml.test.ts | 2 +- src/utils/content/extractTitleFromHtml.ts | 2 +- src/utils/content/removeContentComments.test.ts | 2 +- src/utils/content/removeContentComments.ts | 2 +- src/utils/content/removeMarkdownTitle.test.ts | 2 +- src/utils/content/removeMarkdownTitle.ts | 2 +- src/utils/hooks/usePromise.ts | 11 ++++------- src/utils/hooks/useRole.ts | 4 ++-- src/utils/hooks/useScenario.ts | 4 ++-- src/utils/hooks/useStateInLocalstorage.ts | 2 +- src/utils/image/IImage.ts | 8 ++++---- src/utils/image/Image.ts | 4 ++-- .../image/palette/13/computeImagePalette13.ts.todo | 2 +- src/utils/image/palette/14/computeImagePalette14.ts | 2 +- src/utils/image/palette/15/computeImagePalette15.ts | 2 +- .../15/createColorfulComputeImageColorStats15.ts | 4 ++-- src/utils/image/utils/IImageColorStats.ts | 6 +++--- src/utils/image/utils/computeImageAverageColor.ts | 2 +- src/utils/image/utils/computeImageDarkestColor.ts | 6 +++--- src/utils/image/utils/computeImageLightestColor.ts | 6 +++--- .../image/utils/computeImageMostFrequentColors.ts | 2 +- .../image/utils/computeImageMostGroupedColors.ts | 2 +- .../image/utils/computeImageMostSatulightedColors.ts | 2 +- src/utils/image/utils/getImageUniqueColors.ts | 2 +- src/utils/jsx-html/jsxToHtml.test.tsx.todo | 2 +- src/utils/take/classes/TakeChain.ts | 4 ++-- src/utils/take/take.ts | 4 ++-- src/utils/typeHelpers.ts | 2 +- src/workers/0-Workerify/PostMessages.ts | 4 ++-- src/workers/0-Workerify/Workerify.ts | 2 +- .../createNewWallpaper/createNewWallpaper.worker.ts | 4 ++-- 111 files changed, 153 insertions(+), 158 deletions(-) diff --git a/scripts/generate-wallpapers-content/generate-wallpapers-content.ts b/scripts/generate-wallpapers-content/generate-wallpapers-content.ts index 296a3d133..7fac253c4 100644 --- a/scripts/generate-wallpapers-content/generate-wallpapers-content.ts +++ b/scripts/generate-wallpapers-content/generate-wallpapers-content.ts @@ -7,7 +7,7 @@ import chalk from 'chalk'; import commander from 'commander'; import { readFile, writeFile } from 'fs/promises'; import { join, relative } from 'path'; -import spaceTrim from 'spacetrim'; +import { spaceTrim } from 'spacetrim'; import { forTime } from 'waitasecond'; import { FONTS, OPENAI_API_KEY } from '../../config'; import { extractTitleFromContent } from '../../src/utils/content/extractTitleFromContent'; diff --git a/scripts/generate-wallpapers-content/repair-wallpapers-content.ts b/scripts/generate-wallpapers-content/repair-wallpapers-content.ts index f9f6b4864..cbe4ead24 100644 --- a/scripts/generate-wallpapers-content/repair-wallpapers-content.ts +++ b/scripts/generate-wallpapers-content/repair-wallpapers-content.ts @@ -7,7 +7,7 @@ import chalk from 'chalk'; import commander from 'commander'; import { readFile, writeFile } from 'fs/promises'; import { join } from 'path'; -import spaceTrim from 'spacetrim'; +import { spaceTrim } from 'spacetrim'; import { forTime } from 'waitasecond'; import { FONTS, MAX_CHARS_IN_TITLE, OPENAI_API_KEY } from '../../config'; import { extractTitleFromContent } from '../../src/utils/content/extractTitleFromContent'; diff --git a/scripts/integration-test-with-server/forCondition.ts b/scripts/integration-test-with-server/forCondition.ts index 3704c2167..2347c0ff7 100644 --- a/scripts/integration-test-with-server/forCondition.ts +++ b/scripts/integration-test-with-server/forCondition.ts @@ -1,4 +1,4 @@ -import { Promisable } from 'type-fest'; +import type { Promisable } from 'type-fest'; import { forTime, forValueDefined } from 'waitasecond'; export async function forCondition( diff --git a/scripts/playground/playground.ts b/scripts/playground/playground.ts index 86e76fee1..a01c31459 100644 --- a/scripts/playground/playground.ts +++ b/scripts/playground/playground.ts @@ -6,7 +6,7 @@ dotenv.config({ path: '.env' }); import chalk from 'chalk'; import { join } from 'path'; // import { ChatThread } from '../../src/ai/text-to-text/ChatThread'; -import spaceTrim from 'spacetrim'; +import { spaceTrim } from 'spacetrim'; import { getOpenaiForServer } from '../../src/ai/text-to-text/getOpenaiForServer'; if (process.cwd() !== join(__dirname, '../..')) { diff --git a/scripts/utils/autocommit/commit.ts b/scripts/utils/autocommit/commit.ts index 2551d5a5b..0cab38e05 100644 --- a/scripts/utils/autocommit/commit.ts +++ b/scripts/utils/autocommit/commit.ts @@ -1,7 +1,7 @@ import chalk from 'chalk'; import { mkdir, unlink, writeFile } from 'fs/promises'; import { dirname, join } from 'path'; -import spaceTrim from 'spacetrim'; +import { spaceTrim } from 'spacetrim'; import { execCommand } from '../execCommand/execCommand'; import { isWorkingTreeClean } from './isWorkingTreeClean'; diff --git a/scripts/utils/execCommand/execCommand.ts b/scripts/utils/execCommand/execCommand.ts index bd25786f7..d0d90e599 100644 --- a/scripts/utils/execCommand/execCommand.ts +++ b/scripts/utils/execCommand/execCommand.ts @@ -1,6 +1,6 @@ import chalk from 'chalk'; import { spawn } from 'child_process'; -import spaceTrim from 'spacetrim'; +import { spaceTrim } from 'spacetrim'; import { forTime } from 'waitasecond'; import { execCommandNormalizeOptions } from './execCommandNormalizeOptions'; import { IExecCommandOptions } from './IExecCommandOptions'; diff --git a/scripts/utils/hardcoded-wallpaper/getHardcodedWallpapers.ts b/scripts/utils/hardcoded-wallpaper/getHardcodedWallpapers.ts index 7d3b46693..69aae49c5 100644 --- a/scripts/utils/hardcoded-wallpaper/getHardcodedWallpapers.ts +++ b/scripts/utils/hardcoded-wallpaper/getHardcodedWallpapers.ts @@ -1,6 +1,6 @@ import chalk from 'chalk'; import { readFile } from 'fs/promises'; -import spaceTrim from 'spacetrim'; +import { spaceTrim } from 'spacetrim'; import YAML from 'yaml'; import { COLORSTATS_DEFAULT_COMPUTE_IN_SCRIPT, diff --git a/scripts/utils/prettify.ts b/scripts/utils/prettify.ts index 97016737b..c1b158b0a 100644 --- a/scripts/utils/prettify.ts +++ b/scripts/utils/prettify.ts @@ -1,7 +1,7 @@ import { readFile } from 'fs'; import { join } from 'path'; import prettier from 'prettier'; -import spaceTrim from 'spacetrim'; +import { spaceTrim } from 'spacetrim'; import { promisify } from 'util'; export async function prettify(fileContents: string, parser = 'typescript'): Promise { diff --git a/src/ai/text-to-text/prompt-templates/createContentPromptTemplate.ts b/src/ai/text-to-text/prompt-templates/createContentPromptTemplate.ts index 232361ca9..b2c777979 100644 --- a/src/ai/text-to-text/prompt-templates/createContentPromptTemplate.ts +++ b/src/ai/text-to-text/prompt-templates/createContentPromptTemplate.ts @@ -1,4 +1,4 @@ -import spaceTrim from 'spacetrim'; +import { spaceTrim } from 'spacetrim'; import { image_description, string_chat_prompt, string_midjourney_prompt } from '../../../utils/typeAliases'; /** diff --git a/src/ai/text-to-text/prompt-templates/createFontPromptTemplate.ts b/src/ai/text-to-text/prompt-templates/createFontPromptTemplate.ts index 893e50458..cba84a790 100644 --- a/src/ai/text-to-text/prompt-templates/createFontPromptTemplate.ts +++ b/src/ai/text-to-text/prompt-templates/createFontPromptTemplate.ts @@ -1,4 +1,4 @@ -import spaceTrim from 'spacetrim'; +import { spaceTrim } from 'spacetrim'; import { FONTS } from '../../../../config'; import { string_chat_prompt } from '../../../utils/typeAliases'; diff --git a/src/ai/text-to-text/prompt-templates/createTitlePromptTemplate.ts b/src/ai/text-to-text/prompt-templates/createTitlePromptTemplate.ts index 48255b2d0..b61d45afe 100644 --- a/src/ai/text-to-text/prompt-templates/createTitlePromptTemplate.ts +++ b/src/ai/text-to-text/prompt-templates/createTitlePromptTemplate.ts @@ -1,4 +1,4 @@ -import spaceTrim from 'spacetrim'; +import { spaceTrim } from 'spacetrim'; import { image_description, string_chat_prompt, string_midjourney_prompt } from '../../../utils/typeAliases'; /** diff --git a/src/ai/text-to-text/writeWallpaperContent.ts b/src/ai/text-to-text/writeWallpaperContent.ts index e9d8d6568..085716cb1 100644 --- a/src/ai/text-to-text/writeWallpaperContent.ts +++ b/src/ai/text-to-text/writeWallpaperContent.ts @@ -1,4 +1,4 @@ -import spaceTrim from 'spacetrim'; +import { spaceTrim } from 'spacetrim'; import { parseTitleAndTopic } from '../../utils/content/parseTitleAndTopic'; import { removeQuotes } from '../../utils/content/removeQuotes'; import { diff --git a/src/components/AiComponents/AiComponentsRoot.tsx b/src/components/AiComponents/AiComponentsRoot.tsx index 6b40ebe52..2cd4817fa 100644 --- a/src/components/AiComponents/AiComponentsRoot.tsx +++ b/src/components/AiComponents/AiComponentsRoot.tsx @@ -1,5 +1,6 @@ -import { ReactNode, useContext } from 'react'; -import { Promisable } from 'type-fest'; +import type { ReactNode } from 'react'; +import { useContext } from 'react'; +import type { Promisable } from 'type-fest'; import { ExportContext } from '../../utils/hooks/ExportContext'; import { string_css_class } from '../../utils/typeAliases'; import { InlineScript } from '../InlineScript/InlineScript'; diff --git a/src/components/AnalyticsAndIntegrations/AnalyticsAndIntegrations.tsx b/src/components/AnalyticsAndIntegrations/AnalyticsAndIntegrations.tsx index b36f0afca..cbe6298e8 100644 --- a/src/components/AnalyticsAndIntegrations/AnalyticsAndIntegrations.tsx +++ b/src/components/AnalyticsAndIntegrations/AnalyticsAndIntegrations.tsx @@ -1,5 +1,5 @@ import Script from 'next/script'; -import spaceTrim from 'spacetrim'; +import { spaceTrim } from 'spacetrim'; /** * Renders all the analytics and integrations like Google Analytics, SmartLook, Sentry, ... diff --git a/src/components/AppHead/WallpaperAppHead.tsx b/src/components/AppHead/WallpaperAppHead.tsx index 01153f8da..b82554b92 100644 --- a/src/components/AppHead/WallpaperAppHead.tsx +++ b/src/components/AppHead/WallpaperAppHead.tsx @@ -1,6 +1,7 @@ import Head from 'next/head'; import { useRouter } from 'next/router'; -import { ReactNode, useContext } from 'react'; +import type { ReactNode } from 'react'; +import { useContext } from 'react'; import { NEXT_PUBLIC_URL } from '../../../config'; import { AnalyticsAndIntegrations } from '../../components/AnalyticsAndIntegrations/AnalyticsAndIntegrations'; import { extractDescriptionFromHtml } from '../../utils/content/extractDescriptionFromHtml'; diff --git a/src/components/AsyncContentComponent/AsyncContentComponent.tsx b/src/components/AsyncContentComponent/AsyncContentComponent.tsx index 51ccbed9c..882eb176e 100644 --- a/src/components/AsyncContentComponent/AsyncContentComponent.tsx +++ b/src/components/AsyncContentComponent/AsyncContentComponent.tsx @@ -1,5 +1,5 @@ -import { ReactNode } from 'react'; -import { Promisable } from 'type-fest'; +import type { ReactNode } from 'react'; +import type { Promisable } from 'type-fest'; import { usePromise } from '../../utils/hooks/usePromise'; interface AsyncContentComponentProps { diff --git a/src/components/ColorPreview/ColorInput/ColorInput.tsx b/src/components/ColorPreview/ColorInput/ColorInput.tsx index d6fb29df9..22dabb193 100644 --- a/src/components/ColorPreview/ColorInput/ColorInput.tsx +++ b/src/components/ColorPreview/ColorInput/ColorInput.tsx @@ -2,7 +2,7 @@ import { useState } from 'react'; import SketchPicker, { PresetColor } from 'react-color/lib/components/sketch/Sketch'; import { Color } from '../../../utils/color/Color'; import { useClickOutside } from '../../../utils/hooks/useClickOutside'; -import { WithTake } from '../../../utils/take/interfaces/ITakeChain'; +import type { WithTake } from '../../../utils/take/interfaces/ITakeChain'; import { take } from '../../../utils/take/take'; import { string_css_class } from '../../../utils/typeAliases'; import { ColorPreview } from '../ColorPreview'; diff --git a/src/components/ControlPanel/RandomWallpaper/RandomWallpaperManager.ts b/src/components/ControlPanel/RandomWallpaper/RandomWallpaperManager.ts index b813e716c..24c5b73ad 100644 --- a/src/components/ControlPanel/RandomWallpaper/RandomWallpaperManager.ts +++ b/src/components/ControlPanel/RandomWallpaper/RandomWallpaperManager.ts @@ -1,4 +1,4 @@ -import { Promisable } from 'type-fest'; +import type { Promisable } from 'type-fest'; import { forAnimationFrame, forImmediate } from 'waitasecond'; import { IS_DEVELOPMENT, NEXT_PUBLIC_URL } from '../../../../config'; import type { RecommendWallpaperResponse } from '../../../pages/api/recommend-wallpaper'; diff --git a/src/components/CopilotPanel/CopilotPanel.tsx b/src/components/CopilotPanel/CopilotPanel.tsx index 0d32097e2..2e5b06d78 100644 --- a/src/components/CopilotPanel/CopilotPanel.tsx +++ b/src/components/CopilotPanel/CopilotPanel.tsx @@ -1,7 +1,7 @@ import Image from 'next/image'; import { useRouter } from 'next/router'; import { useCallback, useMemo, useRef, useState } from 'react'; -import spaceTrim from 'spacetrim'; +import { spaceTrim } from 'spacetrim'; import { COPILOT_PLACEHOLDERS } from '../../../config'; import type { UpdateWallpaperContentRequest, diff --git a/src/components/CreateZone/CreateZone.tsx b/src/components/CreateZone/CreateZone.tsx index ac8958ed1..aa89ac22b 100644 --- a/src/components/CreateZone/CreateZone.tsx +++ b/src/components/CreateZone/CreateZone.tsx @@ -1,4 +1,4 @@ -import { ReactNode } from 'react'; +import type { ReactNode } from 'react'; import { classNames } from '../../utils/classNames'; import { string_css_class } from '../../utils/typeAliases'; import { Center } from '../SimpleLayout/Center'; diff --git a/src/components/Dialogues/dialogues/promptDialogue.tsx b/src/components/Dialogues/dialogues/promptDialogue.tsx index 43235869f..8afc7c9ca 100644 --- a/src/components/Dialogues/dialogues/promptDialogue.tsx +++ b/src/components/Dialogues/dialogues/promptDialogue.tsx @@ -1,16 +1,11 @@ import { forTime } from 'waitasecond'; import { isRunningInWebWorker } from '../../../utils/isRunningInWhatever'; -import { message } from '../../../utils/typeAliases'; import { IMessageMainToWorker, IMessagePromptDialogue } from '../../../workers/0-Workerify/PostMessages'; -import { IPromptDialogueOptions } from '../interfaces/PromptDialogueOptions'; -import { IPromptInQueue } from '../interfaces/PromptInQueue'; +import type { IPromptDialogueOptions } from '../interfaces/PromptDialogueOptions'; +import type { IPromptInQueue } from '../interfaces/PromptInQueue'; import { isDialoguesRendered } from '../locks/Dialogues.lock'; import { promptDialogueQueue } from '../queues/prompts'; - - - - /** * Pops up the co-pilot panel with a prompt dialogue. */ diff --git a/src/components/ExportComment/ExportCommentedBlock.tsx b/src/components/ExportComment/ExportCommentedBlock.tsx index 3e8f4aef4..98f02607b 100644 --- a/src/components/ExportComment/ExportCommentedBlock.tsx +++ b/src/components/ExportComment/ExportCommentedBlock.tsx @@ -1,5 +1,5 @@ -import { ReactNode } from 'react'; -import spaceTrim from 'spacetrim'; +import type { ReactNode } from 'react'; +import { spaceTrim } from 'spacetrim'; import { string_name } from '../../utils/typeAliases'; import { ExportComment } from './ExportComment'; diff --git a/src/components/ExportModal/ExportModal.tsx b/src/components/ExportModal/ExportModal.tsx index 4bc68b6fe..53b671570 100644 --- a/src/components/ExportModal/ExportModal.tsx +++ b/src/components/ExportModal/ExportModal.tsx @@ -1,6 +1,6 @@ import { useRouter } from 'next/router'; import { useState } from 'react'; -import spaceTrim from 'spacetrim'; +import { spaceTrim } from 'spacetrim'; import { exportAsZip } from '../../export/exportAsZip'; import { induceFileDownload } from '../../export/utils/induceFileDownload'; import { classNames } from '../../utils/classNames'; diff --git a/src/components/ExportPreviewModal/ExportPreviewModal.tsx b/src/components/ExportPreviewModal/ExportPreviewModal.tsx index 4fe371cd0..9208f266c 100644 --- a/src/components/ExportPreviewModal/ExportPreviewModal.tsx +++ b/src/components/ExportPreviewModal/ExportPreviewModal.tsx @@ -1,6 +1,6 @@ import { Registration } from 'destroyable'; import { useEffect, useMemo, useState } from 'react'; -import spaceTrim from 'spacetrim'; +import { spaceTrim } from 'spacetrim'; import { exportAsHtml } from '../../export/exportAsHtml'; import { HtmlExportFile } from '../../export/HtmlExportFile'; import { useCurrentWallpaper } from '../../utils/hooks/useCurrentWallpaper'; diff --git a/src/components/Gallery/GalleryFilter/GalleryFilterInput.tsx b/src/components/Gallery/GalleryFilter/GalleryFilterInput.tsx index ee4a51cb1..ac3a5ed92 100644 --- a/src/components/Gallery/GalleryFilter/GalleryFilterInput.tsx +++ b/src/components/Gallery/GalleryFilter/GalleryFilterInput.tsx @@ -2,7 +2,7 @@ import { debounce } from 'lodash'; import { Color } from '../../../utils/color/Color'; import { LikedStatus } from '../../../utils/hooks/useLikedStatusOfCurrentWallpaper'; import { useStateWithReporting } from '../../../utils/hooks/useStateWithReporting'; -import { WithTake } from '../../../utils/take/interfaces/ITakeChain'; +import type { WithTake } from '../../../utils/take/interfaces/ITakeChain'; import { ColorInput } from '../../ColorPreview/ColorInput/ColorInput'; import { MarkdownContent } from '../../MarkdownContent/MarkdownContent'; import { Select } from '../../Select/Select'; diff --git a/src/components/Gallery/GalleryFilter/IGalleryFilter.ts b/src/components/Gallery/GalleryFilter/IGalleryFilter.ts index 058d123d5..40e1b6d98 100644 --- a/src/components/Gallery/GalleryFilter/IGalleryFilter.ts +++ b/src/components/Gallery/GalleryFilter/IGalleryFilter.ts @@ -1,6 +1,6 @@ import { Color } from '../../../utils/color/Color'; import type { LikedStatus } from '../../../utils/hooks/useLikedStatusOfCurrentWallpaper'; -import { WithTake } from '../../../utils/take/interfaces/ITakeChain'; +import type { WithTake } from '../../../utils/take/interfaces/ITakeChain'; export interface IGalleryFilter { fulltext?: string; diff --git a/src/components/Hint/Hint.tsx b/src/components/Hint/Hint.tsx index 322eaaa7c..208c2cde1 100644 --- a/src/components/Hint/Hint.tsx +++ b/src/components/Hint/Hint.tsx @@ -1,4 +1,5 @@ -import { ReactNode, useEffect, useRef, useState } from 'react'; +import type { ReactNode } from 'react'; +import { useEffect, useRef, useState } from 'react'; import { classNames } from '../../utils/classNames'; import { useNumericStateInLocalstorage } from '../../utils/hooks/useNumericStateInLocalstorage'; import { string_css_class, title } from '../../utils/typeAliases'; diff --git a/src/components/ImportFonts/addFontToContent.ts b/src/components/ImportFonts/addFontToContent.ts index 829149d44..55d975ae5 100644 --- a/src/components/ImportFonts/addFontToContent.ts +++ b/src/components/ImportFonts/addFontToContent.ts @@ -1,4 +1,4 @@ -import spaceTrim from 'spacetrim'; +import { spaceTrim } from 'spacetrim'; import { detectContentFormat } from '../../utils/content/detectContentFormat'; import { string_font_family, string_html, string_markdown } from '../../utils/typeAliases'; diff --git a/src/components/ImportFonts/extractFontsFromContent.test.ts b/src/components/ImportFonts/extractFontsFromContent.test.ts index b8ec1c019..5325f78e8 100644 --- a/src/components/ImportFonts/extractFontsFromContent.test.ts +++ b/src/components/ImportFonts/extractFontsFromContent.test.ts @@ -1,5 +1,5 @@ import { describe, expect, it } from '@jest/globals'; -import spaceTrim from 'spacetrim'; +import { spaceTrim } from 'spacetrim'; import { extractFontsFromContent } from './extractFontsFromContent'; describe('extractTitleFromContent', () => { diff --git a/src/components/Items/Item.tsx b/src/components/Items/Item.tsx index 0a793c32b..5ca7caf46 100644 --- a/src/components/Items/Item.tsx +++ b/src/components/Items/Item.tsx @@ -1,4 +1,4 @@ -import { ReactNode } from 'react'; +import type { ReactNode } from 'react'; import styles from './Item.module.css'; /** diff --git a/src/components/Items/Items.tsx b/src/components/Items/Items.tsx index 2dc130356..1858d1225 100644 --- a/src/components/Items/Items.tsx +++ b/src/components/Items/Items.tsx @@ -1,4 +1,4 @@ -import { ReactNode } from 'react'; +import type { ReactNode } from 'react'; import styles from './Items.module.css'; /** diff --git a/src/components/MarkdownContent/MarkdownContent.tsx b/src/components/MarkdownContent/MarkdownContent.tsx index ead716696..dec7438df 100644 --- a/src/components/MarkdownContent/MarkdownContent.tsx +++ b/src/components/MarkdownContent/MarkdownContent.tsx @@ -1,11 +1,10 @@ -import spaceTrim from 'spacetrim'; +import { spaceTrim } from 'spacetrim'; import { linkMarkdown } from '../../utils/content/linkMarkdown'; import { normalizeDashes } from '../../utils/content/normalizeDashes'; import { string_css_class, string_href, string_markdown } from '../../utils/typeAliases'; import { HtmlContent } from './HtmlContent'; import { markdownConverter } from './markdownConverter'; - interface MarkdownContentProps { /** * Source markdown diff --git a/src/components/MarkdownContent/mapLinksInHtml.test.ts b/src/components/MarkdownContent/mapLinksInHtml.test.ts index 3c8663cb4..e2049821a 100644 --- a/src/components/MarkdownContent/mapLinksInHtml.test.ts +++ b/src/components/MarkdownContent/mapLinksInHtml.test.ts @@ -1,5 +1,5 @@ import { describe, expect, it } from '@jest/globals'; -import spaceTrim from 'spacetrim'; +import { spaceTrim } from 'spacetrim'; import { mapLinksInHtml } from './mapLinksInHtml'; describe('mapLinksInHtml', () => { diff --git a/src/components/MarkdownContent/markdownConverter.test.ts b/src/components/MarkdownContent/markdownConverter.test.ts index 9defcb094..eb68bd6a8 100644 --- a/src/components/MarkdownContent/markdownConverter.test.ts +++ b/src/components/MarkdownContent/markdownConverter.test.ts @@ -1,5 +1,5 @@ import { describe, expect, it } from '@jest/globals'; -import spaceTrim from 'spacetrim'; +import { spaceTrim } from 'spacetrim'; import { markdownConverter } from './markdownConverter'; describe(`markdownConverter`, () => { @@ -57,7 +57,6 @@ describe(`markdownConverter`, () => { ); }); - /*/ Note: [🧠][🎐] Code can not be converted back from html to markdown diff --git a/src/components/Modal/00-Modal.tsx b/src/components/Modal/00-Modal.tsx index 6bbf7d21d..ebcfc6adb 100644 --- a/src/components/Modal/00-Modal.tsx +++ b/src/components/Modal/00-Modal.tsx @@ -1,4 +1,5 @@ -import { ReactNode, useEffect } from 'react'; +import type { ReactNode } from 'react'; +import { useEffect } from 'react'; import { MarkdownContent } from '../MarkdownContent/MarkdownContent'; import styles from './00-Modal.module.css'; import { CloseModalLink } from './10-CloseModalLink'; diff --git a/src/components/NoSsr/NoCsr.tsx b/src/components/NoSsr/NoCsr.tsx index 5c59f2256..be835db85 100644 --- a/src/components/NoSsr/NoCsr.tsx +++ b/src/components/NoSsr/NoCsr.tsx @@ -1,4 +1,4 @@ -import { ReactNode } from 'react'; +import type { ReactNode } from 'react'; import { useSsrDetection } from '../../utils/hooks/useSsrDetection'; interface NoCsrProps { diff --git a/src/components/NoSsr/NoSsr.tsx b/src/components/NoSsr/NoSsr.tsx index 715364407..5ab50e399 100644 --- a/src/components/NoSsr/NoSsr.tsx +++ b/src/components/NoSsr/NoSsr.tsx @@ -1,4 +1,4 @@ -import { ReactNode } from 'react'; +import type { ReactNode } from 'react'; import { useSsrDetection } from '../../utils/hooks/useSsrDetection'; interface NoSsrProps { diff --git a/src/components/Section/Section.tsx b/src/components/Section/Section.tsx index 9b2073e7c..7cbf7b1e2 100644 --- a/src/components/Section/Section.tsx +++ b/src/components/Section/Section.tsx @@ -1,4 +1,4 @@ -import { ReactNode } from 'react'; +import type { ReactNode } from 'react'; import { classNames } from '../../utils/classNames'; import { string_css_class } from '../../utils/typeAliases'; import styles from './Section.module.css'; diff --git a/src/components/Select/Select.tsx b/src/components/Select/Select.tsx index 4a132bb2a..a486551f5 100644 --- a/src/components/Select/Select.tsx +++ b/src/components/Select/Select.tsx @@ -1,4 +1,4 @@ -import { ReactNode } from 'react'; +import type { ReactNode } from 'react'; import { classNames } from '../../utils/classNames'; import { string_css_class } from '../../utils/typeAliases'; import styles from './Select.module.css'; @@ -10,7 +10,7 @@ interface SelectProps { visibleButtons: number; options: Record; - /** + /** * Optional CSS class name which will be added to root element */ className?: string_css_class; diff --git a/src/components/Shuffle/Shuffle.tsx b/src/components/Shuffle/Shuffle.tsx index 268efea76..9adcc73a3 100644 --- a/src/components/Shuffle/Shuffle.tsx +++ b/src/components/Shuffle/Shuffle.tsx @@ -1,4 +1,5 @@ -import { ReactNode, useContext } from 'react'; +import type { ReactNode } from 'react'; +import { useContext } from 'react'; import seedrandom from 'seedrandom'; import { ShuffleSeedContext } from './ShuffleSeedContext'; diff --git a/src/components/SimpleLayout/Center.tsx b/src/components/SimpleLayout/Center.tsx index 13fdc8e79..791ad17ba 100644 --- a/src/components/SimpleLayout/Center.tsx +++ b/src/components/SimpleLayout/Center.tsx @@ -1,4 +1,4 @@ -import { ReactNode } from 'react'; +import type { ReactNode } from 'react'; import { classNames } from '../../utils/classNames'; import { string_css_class } from '../../utils/typeAliases'; import styles from './Center.module.css'; diff --git a/src/components/SimpleLayout/TakeNoSpace.tsx b/src/components/SimpleLayout/TakeNoSpace.tsx index 30f5377f9..2c8a93d2e 100644 --- a/src/components/SimpleLayout/TakeNoSpace.tsx +++ b/src/components/SimpleLayout/TakeNoSpace.tsx @@ -1,4 +1,4 @@ -import { ReactNode } from 'react'; +import type { ReactNode } from 'react'; import styles from './TakeNoSpace.module.css'; interface TakeNoSpaceProps { diff --git a/src/components/StaticLayout/StaticLayout.tsx b/src/components/StaticLayout/StaticLayout.tsx index 5f2006281..b31bf80b4 100644 --- a/src/components/StaticLayout/StaticLayout.tsx +++ b/src/components/StaticLayout/StaticLayout.tsx @@ -1,4 +1,4 @@ -import { ReactNode } from 'react'; +import type { ReactNode } from 'react'; import { StaticAppHead, StaticAppHeadProps } from '../AppHead/StaticAppHead'; import styles from './StaticLayout.module.css'; diff --git a/src/components/TaskInProgress/TasksInProgress.tsx b/src/components/TaskInProgress/TasksInProgress.tsx index 62a40218e..1864a35d6 100644 --- a/src/components/TaskInProgress/TasksInProgress.tsx +++ b/src/components/TaskInProgress/TasksInProgress.tsx @@ -2,7 +2,7 @@ import { MeshBuilder } from 'babylonjs'; import { useEffect } from 'react'; import { useGraph } from '../../utils/hooks/useGraph'; import { Dialogues } from '../Dialogues/Dialogues'; -import { TaskProgress } from './task/TaskProgress'; +import type { TaskProgress } from './task/TaskProgress'; import styles from './TasksInProgress.module.css'; /** diff --git a/src/components/TaskInProgress/task/joinTasksProgress.ts b/src/components/TaskInProgress/task/joinTasksProgress.ts index 2b3ec43b9..905f1f811 100644 --- a/src/components/TaskInProgress/task/joinTasksProgress.ts +++ b/src/components/TaskInProgress/task/joinTasksProgress.ts @@ -1,4 +1,4 @@ -import { TaskProgress } from './TaskProgress'; +import type { TaskProgress } from './TaskProgress'; /** * Merges tasks with same name into one in array of tasks diff --git a/src/components/TaskInProgress/task/mock/_tasks.tsx b/src/components/TaskInProgress/task/mock/_tasks.tsx index 3202a7ca4..2a84a3aa4 100644 --- a/src/components/TaskInProgress/task/mock/_tasks.tsx +++ b/src/components/TaskInProgress/task/mock/_tasks.tsx @@ -1,4 +1,4 @@ -import { TaskProgress } from '../TaskProgress'; +import type { TaskProgress } from '../TaskProgress'; /** * Just an list of miscellaneous (im)possible tasks diff --git a/src/components/TaskInProgress/task/mock/mockedEndlessMultitask.ts.todo b/src/components/TaskInProgress/task/mock/mockedEndlessMultitask.ts.todo index 73902ccfc..d75268058 100644 --- a/src/components/TaskInProgress/task/mock/mockedEndlessMultitask.ts.todo +++ b/src/components/TaskInProgress/task/mock/mockedEndlessMultitask.ts.todo @@ -1,7 +1,7 @@ -import spaceTrim from 'spacetrim'; -import { Promisable } from 'type-fest'; +import { spaceTrim } from 'spacetrim'; +import type { Promisable } from 'type-fest'; import { forTime } from 'waitasecond'; -import { TaskProgress } from '../TaskProgress'; +import type { TaskProgress } from '../TaskProgress'; import { MOCKED_TASKS_PROGRESS_QUEUE } from './_tasks'; export async function mockedEndlessMultitask( diff --git a/src/components/TaskInProgress/task/mock/mockedMultitask.ts b/src/components/TaskInProgress/task/mock/mockedMultitask.ts index 276b37ebe..589a0eb8c 100644 --- a/src/components/TaskInProgress/task/mock/mockedMultitask.ts +++ b/src/components/TaskInProgress/task/mock/mockedMultitask.ts @@ -1,7 +1,7 @@ -import spaceTrim from 'spacetrim'; -import { Promisable } from 'type-fest'; +import { spaceTrim } from 'spacetrim'; +import type { Promisable } from 'type-fest'; import { forTime } from 'waitasecond'; -import { TaskProgress } from '../TaskProgress'; +import type { TaskProgress } from '../TaskProgress'; import { MOCKED_TASKS_PROGRESS_QUEUE } from './_tasks'; export async function mockedMultitask(onProgress: (taskProgress: TaskProgress) => Promisable): Promise { diff --git a/src/components/TaskInProgress/task/mock/mockedMultitaskWithPrompts.tsx b/src/components/TaskInProgress/task/mock/mockedMultitaskWithPrompts.tsx index 3737766ef..c1271879f 100644 --- a/src/components/TaskInProgress/task/mock/mockedMultitaskWithPrompts.tsx +++ b/src/components/TaskInProgress/task/mock/mockedMultitaskWithPrompts.tsx @@ -1,9 +1,9 @@ import { faker } from '@faker-js/faker'; -import spaceTrim from 'spacetrim'; -import { Promisable } from 'type-fest'; +import { spaceTrim } from 'spacetrim'; +import type { Promisable } from 'type-fest'; import { forTime } from 'waitasecond'; import { promptDialogue } from '../../../Dialogues/dialogues/promptDialogue'; -import { TaskProgress } from '../TaskProgress'; +import type { TaskProgress } from '../TaskProgress'; export async function mockedMultitaskWithPrompts( onProgress: (taskProgress: TaskProgress) => Promisable, diff --git a/src/components/Translate/Translate.tsx b/src/components/Translate/Translate.tsx index 55d3098d7..f6d0d7110 100644 --- a/src/components/Translate/Translate.tsx +++ b/src/components/Translate/Translate.tsx @@ -1,6 +1,5 @@ import { useRouter } from 'next/router'; -import { ReactNode } from 'react'; - +import type { ReactNode } from 'react'; /** * A component that renders its children only if the locale matches the router locale diff --git a/src/components/UploadNewWallpaper/UploadNewWallpaper.tsx b/src/components/UploadNewWallpaper/UploadNewWallpaper.tsx index cf053e070..d5c1f39da 100644 --- a/src/components/UploadNewWallpaper/UploadNewWallpaper.tsx +++ b/src/components/UploadNewWallpaper/UploadNewWallpaper.tsx @@ -1,12 +1,13 @@ import { useRouter } from 'next/router'; -import { ReactNode, useState } from 'react'; -import spaceTrim from 'spacetrim'; +import type { ReactNode } from 'react'; +import { useState } from 'react'; +import { spaceTrim } from 'spacetrim'; import { classNames } from '../../utils/classNames'; import { provideClientId } from '../../utils/supabase/provideClientId'; import { string_css_class } from '../../utils/typeAliases'; import { createNewWallpaperForBrowser } from '../../workers/createNewWallpaper/createNewWallpaperForBrowser'; import { joinTasksProgress } from '../TaskInProgress/task/joinTasksProgress'; -import { TaskProgress } from '../TaskInProgress/task/TaskProgress'; +import type { TaskProgress } from '../TaskInProgress/task/TaskProgress'; import { TasksInProgress } from '../TaskInProgress/TasksInProgress'; import { UploadZone } from '../UploadZone/UploadZone'; import styles from './UploadNewWallpaper.module.css'; diff --git a/src/components/UploadZone/UploadZone.tsx b/src/components/UploadZone/UploadZone.tsx index 8d0111692..f5e769d60 100644 --- a/src/components/UploadZone/UploadZone.tsx +++ b/src/components/UploadZone/UploadZone.tsx @@ -1,4 +1,5 @@ -import { ReactNode, useState } from 'react'; +import type { ReactNode } from 'react'; +import { useState } from 'react'; import { classNames } from '../../utils/classNames'; import { string_css_class } from '../../utils/typeAliases'; import { CreateZone } from '../CreateZone/CreateZone'; diff --git a/src/components/WallpaperContent/WallpaperContent.tsx b/src/components/WallpaperContent/WallpaperContent.tsx index 3596d315b..3a9d24286 100644 --- a/src/components/WallpaperContent/WallpaperContent.tsx +++ b/src/components/WallpaperContent/WallpaperContent.tsx @@ -1,5 +1,5 @@ import { useContext } from 'react'; -import spaceTrim from 'spacetrim'; +import { spaceTrim } from 'spacetrim'; import { ExportContext } from '../../utils/hooks/ExportContext'; import { useCurrentWallpaper } from '../../utils/hooks/useCurrentWallpaper'; import { useCurrentWallpaperFonts } from '../../utils/hooks/useCurrentWallpaperFonts'; diff --git a/src/components/WallpaperContent/getPageContent.ts b/src/components/WallpaperContent/getPageContent.ts index 48c0c1200..a0b98043a 100644 --- a/src/components/WallpaperContent/getPageContent.ts +++ b/src/components/WallpaperContent/getPageContent.ts @@ -1,4 +1,4 @@ -import spaceTrim from 'spacetrim'; +import { spaceTrim } from 'spacetrim'; import contact from '../../../documents/contact.md'; import explanation from '../../../documents/explanation.html'; import gallery from '../../../documents/gallery.html'; diff --git a/src/components/Whois/AdvancedDomainsChecker.tsx b/src/components/Whois/AdvancedDomainsChecker.tsx index bca9fe2e4..4ffedbf15 100644 --- a/src/components/Whois/AdvancedDomainsChecker.tsx +++ b/src/components/Whois/AdvancedDomainsChecker.tsx @@ -1,12 +1,11 @@ import { useState } from 'react'; -import spaceTrim from 'spacetrim'; +import { spaceTrim } from 'spacetrim'; import { string_domain, string_tdl } from '../../utils/typeAliases'; import styles from './AdvancedDomainsChecker.module.css'; import { createAllPermutationsOf } from './utils/createAllPermutationsOf'; import { createAllSubsetsOf } from './utils/createAllSubsetsOf'; import { WhoisDomains } from './WhoisDomains/WhoisDomains'; - /** * Renders a domain checker with advanced options and patterns */ diff --git a/src/components/_Sample/Sample.tsx b/src/components/_Sample/Sample.tsx index 6f3a3f6e0..c55a84b44 100644 --- a/src/components/_Sample/Sample.tsx +++ b/src/components/_Sample/Sample.tsx @@ -1,4 +1,4 @@ -import { ReactNode } from 'react'; +import type { ReactNode } from 'react'; import { classNames } from '../../utils/classNames'; import { string_css_class } from '../../utils/typeAliases'; import styles from './Sample.module.css'; diff --git a/src/export/exportAsHtml.tsx b/src/export/exportAsHtml.tsx index 11aef18a0..a34a0fc67 100644 --- a/src/export/exportAsHtml.tsx +++ b/src/export/exportAsHtml.tsx @@ -2,7 +2,7 @@ import { MemoryRouter } from 'next-router-mock'; import { RouterContext } from 'next/dist/shared/lib/router-context'; import { renderToStaticMarkup } from 'react-dom/server'; import { BehaviorSubject } from 'rxjs'; -import spaceTrim from 'spacetrim'; +import { spaceTrim } from 'spacetrim'; import { NEXT_PUBLIC_URL } from '../../config'; import stripesBlackImage from '../../public/patterns/simple/stripes-black.png'; import stripesGreyImage from '../../public/patterns/simple/stripes-grey.png'; diff --git a/src/export/splitCss.test.ts b/src/export/splitCss.test.ts index f276ddc78..6d821db79 100644 --- a/src/export/splitCss.test.ts +++ b/src/export/splitCss.test.ts @@ -1,5 +1,5 @@ import { describe, expect, it } from '@jest/globals'; -import spaceTrim from 'spacetrim'; +import { spaceTrim } from 'spacetrim'; import { splitCss } from './splitCss'; describe('splitCss', () => { diff --git a/src/export/utils/blobToDataurl.ts b/src/export/utils/blobToDataurl.ts index f1b124766..1b51cba28 100644 --- a/src/export/utils/blobToDataurl.ts +++ b/src/export/utils/blobToDataurl.ts @@ -1,4 +1,4 @@ -import { Promisable } from 'type-fest'; +import type { Promisable } from 'type-fest'; import { string_data_url } from '../../utils/typeAliases'; /** diff --git a/src/export/utils/prettifyJavascript.test.ts b/src/export/utils/prettifyJavascript.test.ts index 8537a5385..5d60b1007 100644 --- a/src/export/utils/prettifyJavascript.test.ts +++ b/src/export/utils/prettifyJavascript.test.ts @@ -1,5 +1,5 @@ import { describe, expect, it } from '@jest/globals'; -import spaceTrim from 'spacetrim'; +import { spaceTrim } from 'spacetrim'; import { prettifyJavascript } from './prettifyJavascript'; describe('prettifyJavascript', () => { diff --git a/src/export/utils/removeSourceMaps.test.ts b/src/export/utils/removeSourceMaps.test.ts index df78e91de..c84f48580 100644 --- a/src/export/utils/removeSourceMaps.test.ts +++ b/src/export/utils/removeSourceMaps.test.ts @@ -1,5 +1,5 @@ import { describe, expect, it } from '@jest/globals'; -import spaceTrim from 'spacetrim'; +import { spaceTrim } from 'spacetrim'; import { removeSourceMaps } from './removeSourceMaps'; describe('removeSourceMaps', () => { diff --git a/src/export/utils/removeTodoComments.test.ts b/src/export/utils/removeTodoComments.test.ts index 7ce709b46..62d40a9d0 100644 --- a/src/export/utils/removeTodoComments.test.ts +++ b/src/export/utils/removeTodoComments.test.ts @@ -1,5 +1,5 @@ import { describe, expect, it } from '@jest/globals'; -import spaceTrim from 'spacetrim'; +import { spaceTrim } from 'spacetrim'; import { removeTodoComments } from './removeTodoComments'; describe('removeTodoComments', () => { diff --git a/src/pages/api/update-wallpaper-content.ts b/src/pages/api/update-wallpaper-content.ts index a347fceff..b3de57dd1 100644 --- a/src/pages/api/update-wallpaper-content.ts +++ b/src/pages/api/update-wallpaper-content.ts @@ -1,5 +1,5 @@ import type { NextApiRequest, NextApiResponse } from 'next'; -import spaceTrim from 'spacetrim'; +import { spaceTrim } from 'spacetrim'; import { ChatThread } from '../../ai/text-to-text/ChatThread'; import { removeQuotes } from '../../utils/content/removeQuotes'; import { IWallpaperSerialized } from '../../utils/IWallpaper'; diff --git a/src/pages/experiments/loading+prompt.tsx b/src/pages/experiments/loading+prompt.tsx index fc0549131..73096d9a6 100644 --- a/src/pages/experiments/loading+prompt.tsx +++ b/src/pages/experiments/loading+prompt.tsx @@ -2,7 +2,7 @@ import { useEffect, useState } from 'react'; import { StaticLayout } from '../../components/StaticLayout/StaticLayout'; import { joinTasksProgress } from '../../components/TaskInProgress/task/joinTasksProgress'; import { mockedMultitaskWithPrompts } from '../../components/TaskInProgress/task/mock/mockedMultitaskWithPrompts'; -import { TaskProgress } from '../../components/TaskInProgress/task/TaskProgress'; +import type { TaskProgress } from '../../components/TaskInProgress/task/TaskProgress'; import { TasksInProgress } from '../../components/TaskInProgress/TasksInProgress'; export default function TestTasksProgressWithChatPage() { diff --git a/src/pages/experiments/loading+tasks.tsx b/src/pages/experiments/loading+tasks.tsx index 292c2d1e2..f2de84dfc 100644 --- a/src/pages/experiments/loading+tasks.tsx +++ b/src/pages/experiments/loading+tasks.tsx @@ -2,7 +2,7 @@ import { useEffect, useState } from 'react'; import { StaticLayout } from '../../components/StaticLayout/StaticLayout'; import { joinTasksProgress } from '../../components/TaskInProgress/task/joinTasksProgress'; import { mockedMultitask } from '../../components/TaskInProgress/task/mock/mockedMultitask'; -import { TaskProgress } from '../../components/TaskInProgress/task/TaskProgress'; +import type { TaskProgress } from '../../components/TaskInProgress/task/TaskProgress'; import { TasksInProgress } from '../../components/TaskInProgress/TasksInProgress'; export default function TestTasksProgressPage() { diff --git a/src/utils/aspect-ratio/aspectRatioRangeExplain.ts b/src/utils/aspect-ratio/aspectRatioRangeExplain.ts index a68ac444f..4c1be1bf0 100644 --- a/src/utils/aspect-ratio/aspectRatioRangeExplain.ts +++ b/src/utils/aspect-ratio/aspectRatioRangeExplain.ts @@ -1,4 +1,4 @@ -import spaceTrim from 'spacetrim'; +import { spaceTrim } from 'spacetrim'; import { Vector } from 'xyzt'; import { AspectRatioRange } from './AspectRatioRange'; import { visualizeAspectRatio } from './visualizeAspectRatio'; diff --git a/src/utils/aspect-ratio/expectAspectRatioInRange.ts b/src/utils/aspect-ratio/expectAspectRatioInRange.ts index 0b8ab15e4..88560e1fe 100644 --- a/src/utils/aspect-ratio/expectAspectRatioInRange.ts +++ b/src/utils/aspect-ratio/expectAspectRatioInRange.ts @@ -1,4 +1,4 @@ -import spaceTrim from 'spacetrim'; +import { spaceTrim } from 'spacetrim'; import { Vector } from 'xyzt'; import { AspectRatioRange } from './AspectRatioRange'; import { aspectRatioRangeExplain } from './aspectRatioRangeExplain'; diff --git a/src/utils/aspect-ratio/expectAspectRatioNotInRange.ts b/src/utils/aspect-ratio/expectAspectRatioNotInRange.ts index 747031e72..78a32ae1c 100644 --- a/src/utils/aspect-ratio/expectAspectRatioNotInRange.ts +++ b/src/utils/aspect-ratio/expectAspectRatioNotInRange.ts @@ -1,4 +1,4 @@ -import spaceTrim from 'spacetrim'; +import { spaceTrim } from 'spacetrim'; import { Vector } from 'xyzt'; import { AspectRatioRange } from './AspectRatioRange'; import { aspectRatioRangeExplain } from './aspectRatioRangeExplain'; diff --git a/src/utils/aspect-ratio/visualizeAspectRatio.ts b/src/utils/aspect-ratio/visualizeAspectRatio.ts index b8e8c0780..7a39cf526 100644 --- a/src/utils/aspect-ratio/visualizeAspectRatio.ts +++ b/src/utils/aspect-ratio/visualizeAspectRatio.ts @@ -1,4 +1,4 @@ -import spaceTrim from 'spacetrim'; +import { spaceTrim } from 'spacetrim'; import { Vector } from 'xyzt'; /** diff --git a/src/utils/cdn/classes/DigitalOceanSpaces.ts b/src/utils/cdn/classes/DigitalOceanSpaces.ts index 36997639a..5da291f63 100644 --- a/src/utils/cdn/classes/DigitalOceanSpaces.ts +++ b/src/utils/cdn/classes/DigitalOceanSpaces.ts @@ -1,6 +1,6 @@ import { GetObjectCommand, PutObjectCommand, PutObjectCommandInput, S3Client } from '@aws-sdk/client-s3'; import { gzip, ungzip } from 'node-gzip'; -import { IFile, IIFilesStorageWithCdn } from '../interfaces/IFilesStorage'; +import type { IFile, IIFilesStorageWithCdn } from '../interfaces/IFilesStorage'; interface IDigitalOceanSpacesConfig { bucket: string; diff --git a/src/utils/color/Color.ts b/src/utils/color/Color.ts index 13b7de0c2..f3a8fcdd0 100644 --- a/src/utils/color/Color.ts +++ b/src/utils/color/Color.ts @@ -1,4 +1,4 @@ -import { WithTake } from '../take/interfaces/ITakeChain'; +import type { WithTake } from '../take/interfaces/ITakeChain'; import { take } from '../take/take'; import { CSS_COLORS } from './css-colors'; import { checkChanellValue } from './internal-utils/checkChanellValue'; diff --git a/src/utils/color/utils/mixColors.ts b/src/utils/color/utils/mixColors.ts index 08647a409..34f9f4588 100644 --- a/src/utils/color/utils/mixColors.ts +++ b/src/utils/color/utils/mixColors.ts @@ -1,9 +1,9 @@ -import { WithTake } from '../../take/interfaces/ITakeChain'; +import type { WithTake } from '../../take/interfaces/ITakeChain'; import { Color } from '../Color'; /** * Mixes an array of colors and returns the average color - * + * * @param {...Color} colors - The array of colors to be mixed. * @returns {WithTake} - The mixed color. */ diff --git a/src/utils/computeWallpaperUriid.test.ts b/src/utils/computeWallpaperUriid.test.ts index 6edb1eec0..ad0821373 100644 --- a/src/utils/computeWallpaperUriid.test.ts +++ b/src/utils/computeWallpaperUriid.test.ts @@ -1,5 +1,5 @@ import { describe, expect, it } from '@jest/globals'; -import spaceTrim from 'spacetrim'; +import { spaceTrim } from 'spacetrim'; import { FULLHD } from '../constants'; import { computeWallpaperUriid } from './computeWallpaperUriid'; import { hydrateColorStats } from './image/utils/hydrateColorStats'; diff --git a/src/utils/content/detectContentFormat.test.ts b/src/utils/content/detectContentFormat.test.ts index ff6497190..72a9653ff 100644 --- a/src/utils/content/detectContentFormat.test.ts +++ b/src/utils/content/detectContentFormat.test.ts @@ -1,5 +1,5 @@ import { describe, expect, it } from '@jest/globals'; -import spaceTrim from 'spacetrim'; +import { spaceTrim } from 'spacetrim'; import { detectContentFormat } from './detectContentFormat'; describe('detectContentFormat', () => { diff --git a/src/utils/content/extractDescriptionFromContent.test.ts b/src/utils/content/extractDescriptionFromContent.test.ts index 80c135789..53ed8af87 100644 --- a/src/utils/content/extractDescriptionFromContent.test.ts +++ b/src/utils/content/extractDescriptionFromContent.test.ts @@ -1,5 +1,5 @@ import { describe, expect, it } from '@jest/globals'; -import spaceTrim from 'spacetrim'; +import { spaceTrim } from 'spacetrim'; import { extractDescriptionFromContent } from './extractDescriptionFromContent'; describe('extractDescriptionFromContent', () => { diff --git a/src/utils/content/extractDescriptionFromHtml.test.ts b/src/utils/content/extractDescriptionFromHtml.test.ts index 89b6ab5de..33d551169 100644 --- a/src/utils/content/extractDescriptionFromHtml.test.ts +++ b/src/utils/content/extractDescriptionFromHtml.test.ts @@ -1,5 +1,5 @@ import { describe, expect, it } from '@jest/globals'; -import spaceTrim from 'spacetrim'; +import { spaceTrim } from 'spacetrim'; import { extractDescriptionFromHtml } from './extractDescriptionFromHtml'; describe('extractFirstHeadingFromHtmlRegex', () => { diff --git a/src/utils/content/extractDescriptionFromHtml.ts b/src/utils/content/extractDescriptionFromHtml.ts index e3fbc2d6b..1e8428114 100644 --- a/src/utils/content/extractDescriptionFromHtml.ts +++ b/src/utils/content/extractDescriptionFromHtml.ts @@ -1,4 +1,4 @@ -import spaceTrim from 'spacetrim'; +import { spaceTrim } from 'spacetrim'; import { DOMParser } from 'xmldom-qsa'; import { description, string_html } from '../typeAliases'; @@ -8,7 +8,7 @@ import { description, string_html } from '../typeAliases'; * @param contentText HTML * @returns heading */ -export function extractDescriptionFromHtml(contentHtml: string_html): Exclude | null { +export function extractDescriptionFromHtml(contentHtml: string_html): Exclude | null { contentHtml = contentHtml.split(/\s+/gs).join(' '); contentHtml = contentHtml.split(/\<(?:br|hr)\s*\/?\>/gis).join('\n'); contentHtml = contentHtml.split(/\<(?:wbr)\s*\/?\>/gis).join(' '); diff --git a/src/utils/content/extractFirstParagraphFromMarkdown.test.ts b/src/utils/content/extractFirstParagraphFromMarkdown.test.ts index 5f761c8b6..9f2a62714 100644 --- a/src/utils/content/extractFirstParagraphFromMarkdown.test.ts +++ b/src/utils/content/extractFirstParagraphFromMarkdown.test.ts @@ -1,5 +1,5 @@ import { describe, expect, it } from '@jest/globals'; -import spaceTrim from 'spacetrim'; +import { spaceTrim } from 'spacetrim'; import { extractFirstParagraphFromMarkdown } from './extractFirstParagraphFromMarkdown'; describe('extractFirstParagraphFromMarkdown', () => { diff --git a/src/utils/content/extractFirstParagraphFromMarkdown.ts b/src/utils/content/extractFirstParagraphFromMarkdown.ts index efea11f28..cca7043a1 100644 --- a/src/utils/content/extractFirstParagraphFromMarkdown.ts +++ b/src/utils/content/extractFirstParagraphFromMarkdown.ts @@ -1,4 +1,4 @@ -import spaceTrim from 'spacetrim'; +import { spaceTrim } from 'spacetrim'; import { string_markdown } from '../typeAliases'; /** diff --git a/src/utils/content/extractTitleFromContent.test.ts b/src/utils/content/extractTitleFromContent.test.ts index eea2c77a9..38a8f28a2 100644 --- a/src/utils/content/extractTitleFromContent.test.ts +++ b/src/utils/content/extractTitleFromContent.test.ts @@ -1,5 +1,5 @@ import { describe, expect, it } from '@jest/globals'; -import spaceTrim from 'spacetrim'; +import { spaceTrim } from 'spacetrim'; import { extractTitleFromContent } from './extractTitleFromContent'; describe('extractTitleFromContent', () => { diff --git a/src/utils/content/extractTitleFromHtml.test.ts b/src/utils/content/extractTitleFromHtml.test.ts index cc4d70243..60ad9fab8 100644 --- a/src/utils/content/extractTitleFromHtml.test.ts +++ b/src/utils/content/extractTitleFromHtml.test.ts @@ -1,5 +1,5 @@ import { describe, expect, it } from '@jest/globals'; -import spaceTrim from 'spacetrim'; +import { spaceTrim } from 'spacetrim'; import { extractTitleFromHtml } from './extractTitleFromHtml'; describe('extractFirstHeadingFromHtmlRegex', () => { diff --git a/src/utils/content/extractTitleFromHtml.ts b/src/utils/content/extractTitleFromHtml.ts index fb11d6faf..ce0d2a506 100644 --- a/src/utils/content/extractTitleFromHtml.ts +++ b/src/utils/content/extractTitleFromHtml.ts @@ -1,4 +1,4 @@ -import spaceTrim from 'spacetrim'; +import { spaceTrim } from 'spacetrim'; import { DOMParser } from 'xmldom-qsa'; import { string_html, title } from '../typeAliases'; diff --git a/src/utils/content/removeContentComments.test.ts b/src/utils/content/removeContentComments.test.ts index fc4d71f64..bfedc6941 100644 --- a/src/utils/content/removeContentComments.test.ts +++ b/src/utils/content/removeContentComments.test.ts @@ -1,5 +1,5 @@ import { describe, expect, it } from '@jest/globals'; -import spaceTrim from 'spacetrim'; +import { spaceTrim } from 'spacetrim'; import { removeContentComments } from './removeContentComments'; describe('removeContentComments', () => { diff --git a/src/utils/content/removeContentComments.ts b/src/utils/content/removeContentComments.ts index 420e669fc..738b2ae32 100644 --- a/src/utils/content/removeContentComments.ts +++ b/src/utils/content/removeContentComments.ts @@ -1,4 +1,4 @@ -import spaceTrim from 'spacetrim'; +import { spaceTrim } from 'spacetrim'; import { string_html, string_markdown } from '../typeAliases'; /** diff --git a/src/utils/content/removeMarkdownTitle.test.ts b/src/utils/content/removeMarkdownTitle.test.ts index 80d14d958..9c249e1d1 100644 --- a/src/utils/content/removeMarkdownTitle.test.ts +++ b/src/utils/content/removeMarkdownTitle.test.ts @@ -1,5 +1,5 @@ import { describe, expect, it } from '@jest/globals'; -import spaceTrim from 'spacetrim'; +import { spaceTrim } from 'spacetrim'; import { just } from '../just'; import { removeMarkdownTitle } from './removeMarkdownTitle'; diff --git a/src/utils/content/removeMarkdownTitle.ts b/src/utils/content/removeMarkdownTitle.ts index f10816a0c..8e149e777 100644 --- a/src/utils/content/removeMarkdownTitle.ts +++ b/src/utils/content/removeMarkdownTitle.ts @@ -1,4 +1,4 @@ -import spaceTrim from 'spacetrim'; +import { spaceTrim } from 'spacetrim'; import { string_markdown } from '../typeAliases'; /** diff --git a/src/utils/hooks/usePromise.ts b/src/utils/hooks/usePromise.ts index 502ddbbd0..2859d135d 100644 --- a/src/utils/hooks/usePromise.ts +++ b/src/utils/hooks/usePromise.ts @@ -1,6 +1,6 @@ import type { DependencyList } from 'react'; import { useEffect, useState } from 'react'; -import { Promisable } from 'type-fest'; +import type { Promisable } from 'type-fest'; import { IUseLoadableResultComplete, IUseLoadableResultError, @@ -16,13 +16,10 @@ type IUsePromiseResult = /** * React hook that returns result of Promise or its pending/error state. */ -export function usePromise( - promise: Promisable, - deps?: DependencyList, -): IUsePromiseResult { +export function usePromise(promise: Promisable, deps?: DependencyList): IUsePromiseResult { // console.log('🅰️', 'usePromise'); - const [result, setResult] = useState >({ + const [result, setResult] = useState>({ status: IUseLoadableResultStatus.Pending, value: undefined, error: undefined, @@ -30,7 +27,7 @@ export function usePromise( }); useEffect( - () => { + () => { (async () => { try { const value = await promise; diff --git a/src/utils/hooks/useRole.ts b/src/utils/hooks/useRole.ts index 8eaf5c2d8..3824c853c 100644 --- a/src/utils/hooks/useRole.ts +++ b/src/utils/hooks/useRole.ts @@ -1,7 +1,7 @@ import { normalizeToKebabCase, normalizeTo_SCREAMING_CASE } from 'n12'; import { useRouter } from 'next/router'; -import spaceTrim from 'spacetrim'; -import { TupleToUnion } from 'type-fest'; +import { spaceTrim } from 'spacetrim'; +import type { TupleToUnion } from 'type-fest'; import { useSsrDetection } from './useSsrDetection'; const ROLES = ['VISITOR', 'OWNER', 'OWNER_AS_VISITOR'] as const; diff --git a/src/utils/hooks/useScenario.ts b/src/utils/hooks/useScenario.ts index e9930f4e3..e24413cba 100644 --- a/src/utils/hooks/useScenario.ts +++ b/src/utils/hooks/useScenario.ts @@ -1,7 +1,7 @@ import { normalizeToKebabCase, normalizeTo_SCREAMING_CASE } from 'n12'; import { useRouter } from 'next/router'; -import spaceTrim from 'spacetrim'; -import { TupleToUnion } from 'type-fest'; +import { spaceTrim } from 'spacetrim'; +import type { TupleToUnion } from 'type-fest'; import { useSsrDetection } from './useSsrDetection'; const SCENARIOS = ['FROM_SOMETHING', 'GALLERY'] as const; diff --git a/src/utils/hooks/useStateInLocalstorage.ts b/src/utils/hooks/useStateInLocalstorage.ts index e5b06d232..2fb2cc65e 100644 --- a/src/utils/hooks/useStateInLocalstorage.ts +++ b/src/utils/hooks/useStateInLocalstorage.ts @@ -1,5 +1,5 @@ import { useEffect, useState } from 'react'; -import spaceTrim from 'spacetrim'; +import { spaceTrim } from 'spacetrim'; export function useStateInLocalstorage( key: string, diff --git a/src/utils/image/IImage.ts b/src/utils/image/IImage.ts index f03242066..74ae8c08f 100644 --- a/src/utils/image/IImage.ts +++ b/src/utils/image/IImage.ts @@ -2,10 +2,10 @@ * File generated by Interface generator (dotup.dotup-vscode-interface-generator) * Date: 2023-05-04 14:05:34 */ -import { Promisable } from 'type-fest'; -import { IVector, Vector } from 'xyzt'; -import { Color } from '../color/Color'; -import { WithTake } from '../take/interfaces/ITakeChain'; +import type { Promisable } from 'type-fest'; +import type { IVector, Vector } from 'xyzt'; +import type { Color } from '../color/Color'; +import type { WithTake } from '../take/interfaces/ITakeChain'; /** * Represents an image as a 2D array of pixels diff --git a/src/utils/image/Image.ts b/src/utils/image/Image.ts index 224906baf..ba44eb454 100644 --- a/src/utils/image/Image.ts +++ b/src/utils/image/Image.ts @@ -1,7 +1,7 @@ -import spaceTrim from 'spacetrim'; +import { spaceTrim } from 'spacetrim'; import { IVector, Vector } from 'xyzt'; import { Color } from '../color/Color'; -import { WithTake } from '../take/interfaces/ITakeChain'; +import type { WithTake } from '../take/interfaces/ITakeChain'; import { take } from '../take/take'; import { IImage } from './IImage'; import { checkSizeValue } from './internal-utils/checkSizeValue'; diff --git a/src/utils/image/palette/13/computeImagePalette13.ts.todo b/src/utils/image/palette/13/computeImagePalette13.ts.todo index 8be2879e9..ca5e332f5 100644 --- a/src/utils/image/palette/13/computeImagePalette13.ts.todo +++ b/src/utils/image/palette/13/computeImagePalette13.ts.todo @@ -9,7 +9,7 @@ import { textColor } from '../../../color/operators/furthest'; import { areColorsEqual } from '../../../color/utils/areColorsEqual'; import { colorDistanceSquared } from '../../../color/utils/colorDistance'; import { colorHueDistance } from '../../../color/utils/colorHueDistance'; -import { WithTake } from '../../../take/interfaces/ITakeChain'; +import type { WithTake } from '../../../take/interfaces/ITakeChain'; import { IImageColorStatsAdvanced } from '../../utils/IImageColorStats'; let totalCount = 0; diff --git a/src/utils/image/palette/14/computeImagePalette14.ts b/src/utils/image/palette/14/computeImagePalette14.ts index d996ed6f6..188129b43 100644 --- a/src/utils/image/palette/14/computeImagePalette14.ts +++ b/src/utils/image/palette/14/computeImagePalette14.ts @@ -12,7 +12,7 @@ import { colorDistanceSquared } from '../../../color/utils/colorDistance'; import { colorHueDistance } from '../../../color/utils/colorHueDistance'; import { forARest } from '../../../forARest'; import { getOrderString } from '../../../getOrderString'; -import { WithTake } from '../../../take/interfaces/ITakeChain'; +import type { WithTake } from '../../../take/interfaces/ITakeChain'; import { IComputeColorstatsWork } from '../../IComputeColorstatsWork'; import { IImageColorStatsAdvanced } from '../../utils/IImageColorStats'; diff --git a/src/utils/image/palette/15/computeImagePalette15.ts b/src/utils/image/palette/15/computeImagePalette15.ts index 1a546b1d4..50a7fbaab 100644 --- a/src/utils/image/palette/15/computeImagePalette15.ts +++ b/src/utils/image/palette/15/computeImagePalette15.ts @@ -12,7 +12,7 @@ import { colorDistanceSquared } from '../../../color/utils/colorDistance'; import { colorHueDistance } from '../../../color/utils/colorHueDistance'; import { forARest } from '../../../forARest'; import { getOrderString } from '../../../getOrderString'; -import { WithTake } from '../../../take/interfaces/ITakeChain'; +import type { WithTake } from '../../../take/interfaces/ITakeChain'; import { IComputeColorstatsWork } from '../../IComputeColorstatsWork'; import { IImageColorStatsAdvanced } from '../../utils/IImageColorStats'; diff --git a/src/utils/image/palette/15/createColorfulComputeImageColorStats15.ts b/src/utils/image/palette/15/createColorfulComputeImageColorStats15.ts index ef6350936..87b70c547 100644 --- a/src/utils/image/palette/15/createColorfulComputeImageColorStats15.ts +++ b/src/utils/image/palette/15/createColorfulComputeImageColorStats15.ts @@ -1,6 +1,6 @@ -import { Promisable } from 'type-fest'; +import type { Promisable } from 'type-fest'; import { IVector, Vector } from 'xyzt'; -import { TaskProgress } from '../../../../components/TaskInProgress/task/TaskProgress'; +import type { TaskProgress } from '../../../../components/TaskInProgress/task/TaskProgress'; import { forARest } from '../../../forARest'; import { take } from '../../../take/take'; import { IComputeColorstatsWork } from '../../IComputeColorstatsWork'; diff --git a/src/utils/image/utils/IImageColorStats.ts b/src/utils/image/utils/IImageColorStats.ts index 8d7091823..67d99d259 100644 --- a/src/utils/image/utils/IImageColorStats.ts +++ b/src/utils/image/utils/IImageColorStats.ts @@ -1,8 +1,8 @@ -import { Promisable } from 'type-fest'; +import type { Promisable } from 'type-fest'; import { Vector } from 'xyzt'; -import { TaskProgress } from '../../../components/TaskInProgress/task/TaskProgress'; +import type { TaskProgress } from '../../../components/TaskInProgress/task/TaskProgress'; import { Color } from '../../color/Color'; -import { WithTake } from '../../take/interfaces/ITakeChain'; +import type { WithTake } from '../../take/interfaces/ITakeChain'; import { number_integer, number_percent } from '../../typeAliases'; import { IImage } from '../IImage'; diff --git a/src/utils/image/utils/computeImageAverageColor.ts b/src/utils/image/utils/computeImageAverageColor.ts index cc45c89a1..b59241815 100644 --- a/src/utils/image/utils/computeImageAverageColor.ts +++ b/src/utils/image/utils/computeImageAverageColor.ts @@ -1,6 +1,6 @@ import { Color } from '../../color/Color'; import { forARest } from '../../forARest'; -import { WithTake } from '../../take/interfaces/ITakeChain'; +import type { WithTake } from '../../take/interfaces/ITakeChain'; import { IComputeColorstatsWork } from '../IComputeColorstatsWork'; import { IImage } from '../IImage'; diff --git a/src/utils/image/utils/computeImageDarkestColor.ts b/src/utils/image/utils/computeImageDarkestColor.ts index 3861e3f40..2a66d119f 100644 --- a/src/utils/image/utils/computeImageDarkestColor.ts +++ b/src/utils/image/utils/computeImageDarkestColor.ts @@ -1,13 +1,13 @@ import { Color } from '../../color/Color'; import { colorLuminance } from '../../color/utils/colorLuminance'; -import { WithTake } from '../../take/interfaces/ITakeChain'; +import type { WithTake } from '../../take/interfaces/ITakeChain'; import { IImage } from '../IImage'; import { getImageUniqueColors } from './getImageUniqueColors'; /** * Computes the darkest color of an image - * - * + * + * * @param {IImage} image - The image object to compute the darkest color from * @returns {Promise>} A promise that resolves to the darkest color of the image */ diff --git a/src/utils/image/utils/computeImageLightestColor.ts b/src/utils/image/utils/computeImageLightestColor.ts index 9cd6ab9c0..f15fdf431 100644 --- a/src/utils/image/utils/computeImageLightestColor.ts +++ b/src/utils/image/utils/computeImageLightestColor.ts @@ -1,13 +1,13 @@ import { Color } from '../../color/Color'; import { colorLuminance } from '../../color/utils/colorLuminance'; -import { WithTake } from '../../take/interfaces/ITakeChain'; +import type { WithTake } from '../../take/interfaces/ITakeChain'; import { IImage } from '../IImage'; import { getImageUniqueColors } from './getImageUniqueColors'; /** * Computes the lightest color in an image - * - * + * + * * @param {IImage} image - The image to compute the lightest color from. * @returns {Promise>} The lightest color in the image, wrapped in a promise. */ diff --git a/src/utils/image/utils/computeImageMostFrequentColors.ts b/src/utils/image/utils/computeImageMostFrequentColors.ts index 0e25e65d4..ecd056317 100644 --- a/src/utils/image/utils/computeImageMostFrequentColors.ts +++ b/src/utils/image/utils/computeImageMostFrequentColors.ts @@ -2,7 +2,7 @@ import { COLORS_LIMIT, DIFFERENT_COLOR_DISTANCE_THEASHOLD_RATIO } from '../../.. import { Color } from '../../color/Color'; import { colorDistanceSquared } from '../../color/utils/colorDistance'; import { forARest } from '../../forARest'; -import { WithTake } from '../../take/interfaces/ITakeChain'; +import type { WithTake } from '../../take/interfaces/ITakeChain'; import { IComputeColorstatsWork } from '../IComputeColorstatsWork'; import { IImage } from '../IImage'; diff --git a/src/utils/image/utils/computeImageMostGroupedColors.ts b/src/utils/image/utils/computeImageMostGroupedColors.ts index 87162f867..c395601d0 100644 --- a/src/utils/image/utils/computeImageMostGroupedColors.ts +++ b/src/utils/image/utils/computeImageMostGroupedColors.ts @@ -1,7 +1,7 @@ import { Color } from '../../color/Color'; import { areColorsEqual } from '../../color/utils/areColorsEqual'; import { forARest } from '../../forARest'; -import { WithTake } from '../../take/interfaces/ITakeChain'; +import type { WithTake } from '../../take/interfaces/ITakeChain'; import { IComputeColorstatsWork } from '../IComputeColorstatsWork'; import { IImage } from '../IImage'; diff --git a/src/utils/image/utils/computeImageMostSatulightedColors.ts b/src/utils/image/utils/computeImageMostSatulightedColors.ts index b15d38ba7..08abc55e2 100644 --- a/src/utils/image/utils/computeImageMostSatulightedColors.ts +++ b/src/utils/image/utils/computeImageMostSatulightedColors.ts @@ -8,7 +8,7 @@ import { areColorsEqual } from '../../color/utils/areColorsEqual'; import { colorHueDistance } from '../../color/utils/colorHueDistance'; import { colorSatulightion } from '../../color/utils/colorSatulightion'; import { forARest } from '../../forARest'; -import { WithTake } from '../../take/interfaces/ITakeChain'; +import type { WithTake } from '../../take/interfaces/ITakeChain'; import { IComputeColorstatsWork } from '../IComputeColorstatsWork'; import { IImage } from '../IImage'; import { getImageUniqueColors } from './getImageUniqueColors'; diff --git a/src/utils/image/utils/getImageUniqueColors.ts b/src/utils/image/utils/getImageUniqueColors.ts index 005c89836..f064575af 100644 --- a/src/utils/image/utils/getImageUniqueColors.ts +++ b/src/utils/image/utils/getImageUniqueColors.ts @@ -1,6 +1,6 @@ import { Color, string_color } from '../../color/Color'; import { forARest } from '../../forARest'; -import { WithTake } from '../../take/interfaces/ITakeChain'; +import type { WithTake } from '../../take/interfaces/ITakeChain'; import { IComputeColorstatsWork } from '../IComputeColorstatsWork'; import { IImage } from '../IImage'; diff --git a/src/utils/jsx-html/jsxToHtml.test.tsx.todo b/src/utils/jsx-html/jsxToHtml.test.tsx.todo index 43a0e6534..696289b6b 100644 --- a/src/utils/jsx-html/jsxToHtml.test.tsx.todo +++ b/src/utils/jsx-html/jsxToHtml.test.tsx.todo @@ -1,5 +1,5 @@ import { describe, expect, it } from '@jest/globals'; -import spaceTrim from 'spacetrim'; +import { spaceTrim } from 'spacetrim'; import { jsxToHtml } from './jsxToHtml'; describe('conversion of JSX to HTML', () => { diff --git a/src/utils/take/classes/TakeChain.ts b/src/utils/take/classes/TakeChain.ts index 243aa31bf..be05a3682 100644 --- a/src/utils/take/classes/TakeChain.ts +++ b/src/utils/take/classes/TakeChain.ts @@ -1,5 +1,5 @@ -import { ITakeChain } from '../interfaces/ITakeChain'; -import { Takeable } from '../interfaces/Takeable'; +import type { ITakeChain } from '../interfaces/ITakeChain'; +import type { Takeable } from '../interfaces/Takeable'; import { take } from '../take'; export class TakeChain implements ITakeChain { diff --git a/src/utils/take/take.ts b/src/utils/take/take.ts index ef121c409..1878cf762 100644 --- a/src/utils/take/take.ts +++ b/src/utils/take/take.ts @@ -1,6 +1,6 @@ import { TakeChain } from './classes/TakeChain'; -import { WithTake } from './interfaces/ITakeChain'; -import { Takeable } from './interfaces/Takeable'; +import type { WithTake } from './interfaces/ITakeChain'; +import type { Takeable } from './interfaces/Takeable'; /** * A function that takes an initial value and returns a proxy object with chainable methods. diff --git a/src/utils/typeHelpers.ts b/src/utils/typeHelpers.ts index f424b756d..ec0876fa8 100644 --- a/src/utils/typeHelpers.ts +++ b/src/utils/typeHelpers.ts @@ -1,5 +1,5 @@ import { Observable } from 'rxjs'; -import { Promisable } from 'type-fest'; +import type { Promisable } from 'type-fest'; // TODO: !! Cleanup diff --git a/src/workers/0-Workerify/PostMessages.ts b/src/workers/0-Workerify/PostMessages.ts index 56f71955d..2bc5ae3b1 100644 --- a/src/workers/0-Workerify/PostMessages.ts +++ b/src/workers/0-Workerify/PostMessages.ts @@ -1,6 +1,6 @@ -import { Promisable } from 'type-fest'; +import type { Promisable } from 'type-fest'; import type { IPromptDialogueOptions } from '../../components/Dialogues/interfaces/PromptDialogueOptions'; -import { TaskProgress } from '../../components/TaskInProgress/task/TaskProgress'; +import type { TaskProgress } from '../../components/TaskInProgress/task/TaskProgress'; export type TransferableObject = any /* <-[0] */; diff --git a/src/workers/0-Workerify/Workerify.ts b/src/workers/0-Workerify/Workerify.ts index 3a201f500..771f8314c 100644 --- a/src/workers/0-Workerify/Workerify.ts +++ b/src/workers/0-Workerify/Workerify.ts @@ -1,5 +1,5 @@ import { promptDialogue } from '../../components/Dialogues/dialogues/promptDialogue'; -import { TaskProgress } from '../../components/TaskInProgress/task/TaskProgress'; +import type { TaskProgress } from '../../components/TaskInProgress/task/TaskProgress'; import { isRunningInBrowser, isRunningInWebWorker } from '../../utils/isRunningInWhatever'; import { IMessageError, diff --git a/src/workers/createNewWallpaper/createNewWallpaper.worker.ts b/src/workers/createNewWallpaper/createNewWallpaper.worker.ts index 284563575..2e10c3497 100644 --- a/src/workers/createNewWallpaper/createNewWallpaper.worker.ts +++ b/src/workers/createNewWallpaper/createNewWallpaper.worker.ts @@ -1,11 +1,11 @@ -import spaceTrim from 'spacetrim'; +import { spaceTrim } from 'spacetrim'; import { COLORSTATS_DEFAULT_COMPUTE_IN_FRONTEND, WALLPAPER_IMAGE_ASPECT_RATIO_ALLOWED_RANGE, WALLPAPER_IMAGE_MAX_ALLOWED_SIZE, } from '../../../config'; import { promptDialogue } from '../../components/Dialogues/dialogues/promptDialogue'; -import { TaskProgress } from '../../components/TaskInProgress/task/TaskProgress'; +import type { TaskProgress } from '../../components/TaskInProgress/task/TaskProgress'; import { UploadWallpaperResponse } from '../../pages/api/custom/upload-wallpaper-image'; import type { WriteWallpaperContentResponse } from '../../pages/api/custom/write-wallpaper-content'; import type { WriteWallpaperPromptResponse } from '../../pages/api/custom/write-wallpaper-prompt'; From fce5a145f744ed4b34a31e556899b916b2196b57 Mon Sep 17 00:00:00 2001 From: Pavol Hejny Date: Wed, 20 Sep 2023 16:37:32 +0200 Subject: [PATCH 06/20] Refactoring: Optimize imports Use type import for typeAliases --- .../utils/hardcoded-wallpaper/getHardcodedWallpapers.ts | 2 +- src/ai/image-to-text/imageToText.ts | 2 +- src/ai/recommendation/likedStatusToLikeness.ts | 2 +- src/ai/recommendation/pickMostRecommended.ts | 2 +- src/ai/text-to-text/ChatThread.ts | 2 +- src/ai/text-to-text/completeWithGpt.ts | 2 +- .../prompt-templates/createContentPromptTemplate.ts | 2 +- .../prompt-templates/createFontPromptTemplate.ts | 2 +- .../prompt-templates/createTitlePromptTemplate.ts | 2 +- src/components/AiComponents/AiComponentsRoot.tsx | 2 +- src/components/AiComponents/activateGalleryComponent.ts | 2 +- src/components/ColorPreview/ColorInput/ColorInput.tsx | 2 +- src/components/ColorPreview/ColorPreview.tsx | 2 +- .../RandomWallpaper/RandomWallpaperManager.ts | 2 +- src/components/CopilotPanel/CopilotPanel.tsx | 2 +- src/components/CreateZone/CreateZone.tsx | 2 +- src/components/DeviceIframe/DeviceIframe.tsx | 2 +- .../Dialogues/interfaces/PromptDialogueOptions.ts | 2 +- src/components/ExportComment/ExportCommentedBlock.tsx | 2 +- src/components/ExportModal/ExportModal.tsx | 2 +- src/components/ExportPreviewModal/ExportPreviewModal.tsx | 2 +- src/components/ExportPreviewModal/utils/ObjectUrl.ts | 2 +- src/components/Hint/Hint.tsx | 2 +- src/components/ImagineTag/ImagineTag.tsx | 2 +- src/components/ImportFonts/ImportFonts.tsx | 2 +- src/components/ImportFonts/addFontToContent.ts | 2 +- src/components/ImportFonts/extractFontsFromContent.ts | 2 +- src/components/InlineScript/InlineScript.tsx | 2 +- src/components/MarkdownContent/Content.tsx | 2 +- src/components/MarkdownContent/HtmlContent.tsx | 2 +- src/components/MarkdownContent/MarkdownContent.tsx | 2 +- src/components/MarkdownContent/mapLinksInHtml.ts | 2 +- src/components/MidjourneyLink/MidjourneyLink.tsx | 2 +- src/components/PricingTable/PricingTableNext.tsx | 2 +- src/components/Section/Section.tsx | 2 +- src/components/Select/Select.tsx | 2 +- src/components/SimpleLayout/Center.tsx | 2 +- src/components/TaskInProgress/TorusInteractiveImage.tsx | 2 +- src/components/TaskInProgress/task/TaskProgress.ts | 2 +- src/components/UploadNewWallpaper/UploadNewWallpaper.tsx | 2 +- src/components/UploadZone/UploadZone.tsx | 2 +- src/components/WallpaperContent/WallpaperContent.tsx | 2 +- src/components/WallpaperContent/getPageContent.ts | 2 +- src/components/WallpaperLink/WallpaperLink.tsx | 2 +- src/components/Whois/AdvancedDomainsChecker.tsx | 2 +- src/components/Whois/SimpleDomainChecker.tsx | 2 +- src/components/Whois/WhoisDomain/WhoisDomain.tsx | 2 +- src/components/Whois/WhoisDomains/WhoisDomains.tsx | 2 +- src/components/Whois/utils/useWhois.ts | 2 +- src/components/_Sample/Sample.tsx | 2 +- src/export/HtmlExportFile.tsx | 8 +++++++- src/export/exportAsHtml.tsx | 2 +- src/export/splitCss.ts | 4 ++-- src/export/utils/ObjectUrl.ts | 2 +- src/export/utils/blobToDataurl.ts | 2 +- src/export/utils/blobToFile.ts | 2 +- src/export/utils/induceFileDownload.ts | 2 +- src/export/utils/prettifyCss.ts | 2 +- src/export/utils/prettifyHtml.ts | 2 +- src/export/utils/prettifyJavascript.ts | 2 +- src/export/utils/removeSourceMaps.ts | 2 +- src/export/utils/removeTodoComments.ts | 2 +- src/pages/[wallpaperId].tsx | 2 +- src/pages/api/custom/upload-wallpaper-image.ts | 2 +- src/pages/api/custom/write-wallpaper-content.ts | 2 +- src/pages/api/custom/write-wallpaper-prompt.ts | 2 +- src/pages/api/og-image.tsx | 2 +- src/pages/api/recommend-wallpaper.ts | 2 +- src/pages/api/register-script.ts | 2 +- src/pages/api/register.ts | 2 +- src/pages/api/update-wallpaper-content.ts | 2 +- src/pages/api/wallpapers-min.ts | 2 +- src/utils/cdn/interfaces/IFilesStorage.ts | 2 +- src/utils/cdn/utils/generateUserWallpaperCdnKey.ts | 2 +- src/utils/cdn/utils/generateWallpaperCdnKey.ts | 2 +- src/utils/computeWallpaperUriid.ts | 2 +- src/utils/content/detectContentFormat.ts | 4 ++-- src/utils/content/emojifyMarkdown.ts | 2 +- src/utils/content/extractDescriptionFromContent.ts | 2 +- src/utils/content/extractDescriptionFromHtml.ts | 2 +- src/utils/content/extractFirstParagraphFromMarkdown.ts | 2 +- src/utils/content/extractTitleFromContent.ts | 2 +- src/utils/content/extractTitleFromHtml.ts | 2 +- src/utils/content/removeContentComments.ts | 2 +- src/utils/content/removeMarkdownLinks.ts | 2 +- src/utils/content/removeMarkdownTitle.ts | 2 +- src/utils/hooks/useCurrentWallpaperFonts.ts | 2 +- src/utils/hooks/useCurrentWallpaperId.ts | 2 +- src/utils/hooks/useLoadable.ts | 2 +- src/utils/hooks/usePageName.ts | 2 +- src/utils/hooks/useWallpaperSubject.ts | 2 +- src/utils/hydrateWallpapers.ts | 2 +- src/utils/hydrateWallpapersCached.ts | 2 +- src/utils/image/createImageInBrowser.ts | 2 +- src/utils/image/utils/IImageColorStats.ts | 2 +- src/utils/jsx-html/jsxToHtml.ts | 2 +- src/utils/jsx-html/jsxToHtmlSimple.ts | 2 +- src/utils/loadAndRunExternalScript.tsx | 2 +- src/utils/randomUuid.ts | 2 +- src/utils/supabase/provideClientId.ts | 4 ++-- src/utils/supabase/provideClientIdWithoutVerification.ts | 2 +- src/utils/validators/isPrivateNetwork.ts | 2 +- src/utils/validators/isValidClientId.ts | 3 +-- src/utils/validators/isValidEmail.ts | 2 +- src/utils/validators/isValidUuid.ts | 2 +- src/utils/validators/isValidWallpaperId.ts | 2 +- src/utils/validators/validateUuid.ts | 2 +- .../createNewWallpaper/createNewWallpaper.common.ts | 2 +- 108 files changed, 117 insertions(+), 112 deletions(-) diff --git a/scripts/utils/hardcoded-wallpaper/getHardcodedWallpapers.ts b/scripts/utils/hardcoded-wallpaper/getHardcodedWallpapers.ts index 69aae49c5..bfd82c1e2 100644 --- a/scripts/utils/hardcoded-wallpaper/getHardcodedWallpapers.ts +++ b/scripts/utils/hardcoded-wallpaper/getHardcodedWallpapers.ts @@ -12,7 +12,7 @@ import { parseKeywordsFromWallpaper } from '../../../src/components/Gallery/Gall import { FULLHD } from '../../../src/constants'; import { extractTitleFromContent } from '../../../src/utils/content/extractTitleFromContent'; import { IWallpaperMetadata, IWallpaperSerialized } from '../../../src/utils/IWallpaper'; -import { string_file_path } from '../../../src/utils/typeAliases'; +import type { string_file_path } from '../../../src/utils/typeAliases'; import { isFileExisting } from '../isFileExisting'; import { getHardcodedWallpapersMetadataFilePaths } from './getHardcodedWallpapersMetadataFilePaths'; diff --git a/src/ai/image-to-text/imageToText.ts b/src/ai/image-to-text/imageToText.ts index 1337dcc81..e8e9ec8b9 100644 --- a/src/ai/image-to-text/imageToText.ts +++ b/src/ai/image-to-text/imageToText.ts @@ -1,7 +1,7 @@ import { ComputerVisionClient } from '@azure/cognitiveservices-computervision'; import { CognitiveServicesCredentials } from '@azure/ms-rest-azure-js'; import { AZURE_COMPUTER_VISION_ENDPOINT, AZURE_COMPUTER_VISION_KEY } from '../../../config'; -import { image_description } from '../../utils/typeAliases'; +import type { image_description } from '../../utils/typeAliases'; /** * Analyzes an image through the Azure Computer vision API diff --git a/src/ai/recommendation/likedStatusToLikeness.ts b/src/ai/recommendation/likedStatusToLikeness.ts index 8a0578464..67b9b4d4e 100644 --- a/src/ai/recommendation/likedStatusToLikeness.ts +++ b/src/ai/recommendation/likedStatusToLikeness.ts @@ -1,5 +1,5 @@ import type { LikedStatus } from '../../utils/hooks/useLikedStatusOfCurrentWallpaper'; -import { number_likeness } from '../../utils/typeAliases'; +import type { number_likeness } from '../../utils/typeAliases'; const LIKED_STATUS_LIKENESS: Record = { NONE: 0 /* <- TODO: [🧠] Maybe -0.1 or some small negative number, wallpaper user go through and did not react person maybe dislike */, diff --git a/src/ai/recommendation/pickMostRecommended.ts b/src/ai/recommendation/pickMostRecommended.ts index a04cadbcd..6643c8b89 100644 --- a/src/ai/recommendation/pickMostRecommended.ts +++ b/src/ai/recommendation/pickMostRecommended.ts @@ -1,5 +1,5 @@ import { IWallpaper } from '../../utils/IWallpaper'; -import { number_likeness } from '../../utils/typeAliases'; +import type { number_likeness } from '../../utils/typeAliases'; import { IWallpaperVector } from './IWallpaperVector'; import { wallpaperToVector } from './wallpaperToVector'; import { wallpaperVectorsDistanceSquared } from './wallpaperVectorsDistanceSquared'; diff --git a/src/ai/text-to-text/ChatThread.ts b/src/ai/text-to-text/ChatThread.ts index 33bc8e118..7440d69dc 100644 --- a/src/ai/text-to-text/ChatThread.ts +++ b/src/ai/text-to-text/ChatThread.ts @@ -1,5 +1,5 @@ import { getSupabaseForServer } from '../../utils/supabase/getSupabaseForServer'; -import { string_chat_prompt, string_model_name, uuid } from '../../utils/typeAliases'; +import type { string_chat_prompt, string_model_name, uuid } from '../../utils/typeAliases'; import { getOpenaiForServer } from './getOpenaiForServer'; /** diff --git a/src/ai/text-to-text/completeWithGpt.ts b/src/ai/text-to-text/completeWithGpt.ts index 5f62664f7..132b378b7 100644 --- a/src/ai/text-to-text/completeWithGpt.ts +++ b/src/ai/text-to-text/completeWithGpt.ts @@ -1,5 +1,5 @@ import { getSupabaseForServer } from '../../utils/supabase/getSupabaseForServer'; -import { string_completion_prompt, string_model_name, uuid } from '../../utils/typeAliases'; +import type { string_completion_prompt, string_model_name, uuid } from '../../utils/typeAliases'; import { getOpenaiForServer } from './getOpenaiForServer'; export interface ICompleteWithGptResult { diff --git a/src/ai/text-to-text/prompt-templates/createContentPromptTemplate.ts b/src/ai/text-to-text/prompt-templates/createContentPromptTemplate.ts index b2c777979..06dcacd27 100644 --- a/src/ai/text-to-text/prompt-templates/createContentPromptTemplate.ts +++ b/src/ai/text-to-text/prompt-templates/createContentPromptTemplate.ts @@ -1,5 +1,5 @@ import { spaceTrim } from 'spacetrim'; -import { image_description, string_chat_prompt, string_midjourney_prompt } from '../../../utils/typeAliases'; +import type { image_description, string_chat_prompt, string_midjourney_prompt } from '../../../utils/typeAliases'; /** * Generates a template for creating web content based on a given wallpaper description diff --git a/src/ai/text-to-text/prompt-templates/createFontPromptTemplate.ts b/src/ai/text-to-text/prompt-templates/createFontPromptTemplate.ts index cba84a790..a97b50b8d 100644 --- a/src/ai/text-to-text/prompt-templates/createFontPromptTemplate.ts +++ b/src/ai/text-to-text/prompt-templates/createFontPromptTemplate.ts @@ -1,6 +1,6 @@ import { spaceTrim } from 'spacetrim'; import { FONTS } from '../../../../config'; -import { string_chat_prompt } from '../../../utils/typeAliases'; +import type { string_chat_prompt } from '../../../utils/typeAliases'; /** * Generates a template for figuring out best fitting font for the website. diff --git a/src/ai/text-to-text/prompt-templates/createTitlePromptTemplate.ts b/src/ai/text-to-text/prompt-templates/createTitlePromptTemplate.ts index b61d45afe..72d72a141 100644 --- a/src/ai/text-to-text/prompt-templates/createTitlePromptTemplate.ts +++ b/src/ai/text-to-text/prompt-templates/createTitlePromptTemplate.ts @@ -1,5 +1,5 @@ import { spaceTrim } from 'spacetrim'; -import { image_description, string_chat_prompt, string_midjourney_prompt } from '../../../utils/typeAliases'; +import type { image_description, string_chat_prompt, string_midjourney_prompt } from '../../../utils/typeAliases'; /** * Generates a template for creating web title based on a given wallpaper description diff --git a/src/components/AiComponents/AiComponentsRoot.tsx b/src/components/AiComponents/AiComponentsRoot.tsx index 2cd4817fa..0365f1c2d 100644 --- a/src/components/AiComponents/AiComponentsRoot.tsx +++ b/src/components/AiComponents/AiComponentsRoot.tsx @@ -2,7 +2,7 @@ import type { ReactNode } from 'react'; import { useContext } from 'react'; import type { Promisable } from 'type-fest'; import { ExportContext } from '../../utils/hooks/ExportContext'; -import { string_css_class } from '../../utils/typeAliases'; +import type { string_css_class } from '../../utils/typeAliases'; import { InlineScript } from '../InlineScript/InlineScript'; interface AiComponentsRootProps { diff --git a/src/components/AiComponents/activateGalleryComponent.ts b/src/components/AiComponents/activateGalleryComponent.ts index 861cbc77d..0ece0736c 100644 --- a/src/components/AiComponents/activateGalleryComponent.ts +++ b/src/components/AiComponents/activateGalleryComponent.ts @@ -1,5 +1,5 @@ import type { LikedStatus } from '../../utils/hooks/useLikedStatusOfCurrentWallpaper'; -import { string_color, string_wallpaper_id } from '../../utils/typeAliases'; +import type { string_color, string_wallpaper_id } from '../../utils/typeAliases'; export async function activateGalleryComponent(galleryElement: HTMLElement): Promise { const moreButtonHtml = ` diff --git a/src/components/ColorPreview/ColorInput/ColorInput.tsx b/src/components/ColorPreview/ColorInput/ColorInput.tsx index 22dabb193..1e74afe08 100644 --- a/src/components/ColorPreview/ColorInput/ColorInput.tsx +++ b/src/components/ColorPreview/ColorInput/ColorInput.tsx @@ -4,7 +4,7 @@ import { Color } from '../../../utils/color/Color'; import { useClickOutside } from '../../../utils/hooks/useClickOutside'; import type { WithTake } from '../../../utils/take/interfaces/ITakeChain'; import { take } from '../../../utils/take/take'; -import { string_css_class } from '../../../utils/typeAliases'; +import type { string_css_class } from '../../../utils/typeAliases'; import { ColorPreview } from '../ColorPreview'; import styles from './ColorInput.module.css'; diff --git a/src/components/ColorPreview/ColorPreview.tsx b/src/components/ColorPreview/ColorPreview.tsx index 28d7a9adb..554d48fca 100644 --- a/src/components/ColorPreview/ColorPreview.tsx +++ b/src/components/ColorPreview/ColorPreview.tsx @@ -3,7 +3,7 @@ import { classNames } from '../../utils/classNames'; import { Color } from '../../utils/color/Color'; import { textColor } from '../../utils/color/operators/furthest'; import { take } from '../../utils/take/take'; -import { string_css_class } from '../../utils/typeAliases'; +import type { string_css_class } from '../../utils/typeAliases'; import styles from './ColorPreview.module.css'; interface ColorPreviewProps { diff --git a/src/components/ControlPanel/RandomWallpaper/RandomWallpaperManager.ts b/src/components/ControlPanel/RandomWallpaper/RandomWallpaperManager.ts index 24c5b73ad..1b83846fe 100644 --- a/src/components/ControlPanel/RandomWallpaper/RandomWallpaperManager.ts +++ b/src/components/ControlPanel/RandomWallpaper/RandomWallpaperManager.ts @@ -5,7 +5,7 @@ import type { RecommendWallpaperResponse } from '../../../pages/api/recommend-wa import { IWallpaperSerialized } from '../../../utils/IWallpaper'; import { randomItem } from '../../../utils/randomItem'; import { provideClientIdWithoutVerification } from '../../../utils/supabase/provideClientIdWithoutVerification'; -import { string_wallpaper_id } from '../../../utils/typeAliases'; +import type { string_wallpaper_id } from '../../../utils/typeAliases'; export type IWallpaperInStorage = Pick; diff --git a/src/components/CopilotPanel/CopilotPanel.tsx b/src/components/CopilotPanel/CopilotPanel.tsx index 2e5b06d78..a9d2b9dcd 100644 --- a/src/components/CopilotPanel/CopilotPanel.tsx +++ b/src/components/CopilotPanel/CopilotPanel.tsx @@ -17,7 +17,7 @@ import { serializeWallpaper } from '../../utils/hydrateWallpaper'; import { shuffleItems } from '../../utils/shuffleItems'; import { getSupabaseForBrowser } from '../../utils/supabase/getSupabaseForBrowser'; import { provideClientId } from '../../utils/supabase/provideClientId'; -import { string_prompt } from '../../utils/typeAliases'; +import type { string_prompt } from '../../utils/typeAliases'; import { parseKeywordsFromWallpaper } from '../Gallery/GalleryFilter/utils/parseKeywordsFromWallpaper'; import { Hint } from '../Hint/Hint'; import { TorusInteractiveImage } from '../TaskInProgress/TorusInteractiveImage'; diff --git a/src/components/CreateZone/CreateZone.tsx b/src/components/CreateZone/CreateZone.tsx index aa89ac22b..b77c99720 100644 --- a/src/components/CreateZone/CreateZone.tsx +++ b/src/components/CreateZone/CreateZone.tsx @@ -1,6 +1,6 @@ import type { ReactNode } from 'react'; import { classNames } from '../../utils/classNames'; -import { string_css_class } from '../../utils/typeAliases'; +import type { string_css_class } from '../../utils/typeAliases'; import { Center } from '../SimpleLayout/Center'; import { TakeNoSpace } from '../SimpleLayout/TakeNoSpace'; import styles from './CreateZone.module.css'; diff --git a/src/components/DeviceIframe/DeviceIframe.tsx b/src/components/DeviceIframe/DeviceIframe.tsx index 5e685a1ce..66337cde1 100644 --- a/src/components/DeviceIframe/DeviceIframe.tsx +++ b/src/components/DeviceIframe/DeviceIframe.tsx @@ -1,6 +1,6 @@ import Link from 'next/link'; import { classNames } from '../../utils/classNames'; -import { string_css_class, string_url } from '../../utils/typeAliases'; +import type { string_css_class, string_url } from '../../utils/typeAliases'; import styles from './DeviceIframe.module.css'; interface DeviceIframeProps { diff --git a/src/components/Dialogues/interfaces/PromptDialogueOptions.ts b/src/components/Dialogues/interfaces/PromptDialogueOptions.ts index c582d2fc4..af94389d1 100644 --- a/src/components/Dialogues/interfaces/PromptDialogueOptions.ts +++ b/src/components/Dialogues/interfaces/PromptDialogueOptions.ts @@ -1,4 +1,4 @@ -import { message } from '../../../utils/typeAliases'; +import type { message } from '../../../utils/typeAliases'; export interface IPromptDialogueOptions { /** diff --git a/src/components/ExportComment/ExportCommentedBlock.tsx b/src/components/ExportComment/ExportCommentedBlock.tsx index 98f02607b..f549e3518 100644 --- a/src/components/ExportComment/ExportCommentedBlock.tsx +++ b/src/components/ExportComment/ExportCommentedBlock.tsx @@ -1,6 +1,6 @@ import type { ReactNode } from 'react'; import { spaceTrim } from 'spacetrim'; -import { string_name } from '../../utils/typeAliases'; +import type { string_name } from '../../utils/typeAliases'; import { ExportComment } from './ExportComment'; interface ExportCommentedBlockProps { diff --git a/src/components/ExportModal/ExportModal.tsx b/src/components/ExportModal/ExportModal.tsx index 53b671570..ee717751a 100644 --- a/src/components/ExportModal/ExportModal.tsx +++ b/src/components/ExportModal/ExportModal.tsx @@ -7,7 +7,7 @@ import { classNames } from '../../utils/classNames'; import { useCurrentWallpaper } from '../../utils/hooks/useCurrentWallpaper'; import { getSupabaseForBrowser } from '../../utils/supabase/getSupabaseForBrowser'; import { provideClientId } from '../../utils/supabase/provideClientId'; -import { string_email } from '../../utils/typeAliases'; +import type { string_email } from '../../utils/typeAliases'; import { isValidUrl } from '../../utils/validators/isValidUrl'; import { MarkdownContent } from '../MarkdownContent/MarkdownContent'; import { Modal } from '../Modal/00-Modal'; diff --git a/src/components/ExportPreviewModal/ExportPreviewModal.tsx b/src/components/ExportPreviewModal/ExportPreviewModal.tsx index 9208f266c..fe5b1cbae 100644 --- a/src/components/ExportPreviewModal/ExportPreviewModal.tsx +++ b/src/components/ExportPreviewModal/ExportPreviewModal.tsx @@ -6,7 +6,7 @@ import { HtmlExportFile } from '../../export/HtmlExportFile'; import { useCurrentWallpaper } from '../../utils/hooks/useCurrentWallpaper'; import { usePromise } from '../../utils/hooks/usePromise'; import { randomUuid } from '../../utils/randomUuid'; -import { string_javascript, string_uri } from '../../utils/typeAliases'; +import type { string_javascript, string_uri } from '../../utils/typeAliases'; import { DeviceIframe } from '../DeviceIframe/DeviceIframe'; import { Modal } from '../Modal/00-Modal'; import styles from './ExportPreviewModal.module.css'; diff --git a/src/components/ExportPreviewModal/utils/ObjectUrl.ts b/src/components/ExportPreviewModal/utils/ObjectUrl.ts index dc9a87bd3..49ecb95ac 100644 --- a/src/components/ExportPreviewModal/utils/ObjectUrl.ts +++ b/src/components/ExportPreviewModal/utils/ObjectUrl.ts @@ -1,5 +1,5 @@ import { IDestroyable, ITeardownLogic, Registration } from 'destroyable'; -import { string_mime_type, string_url } from '../../../utils/typeAliases'; +import type { string_mime_type, string_url } from '../../../utils/typeAliases'; /** * Converts Blob, File or MediaSource to url using URL.createObjectURL diff --git a/src/components/Hint/Hint.tsx b/src/components/Hint/Hint.tsx index 208c2cde1..408bca69c 100644 --- a/src/components/Hint/Hint.tsx +++ b/src/components/Hint/Hint.tsx @@ -2,7 +2,7 @@ import type { ReactNode } from 'react'; import { useEffect, useRef, useState } from 'react'; import { classNames } from '../../utils/classNames'; import { useNumericStateInLocalstorage } from '../../utils/hooks/useNumericStateInLocalstorage'; -import { string_css_class, title } from '../../utils/typeAliases'; +import type { string_css_class, title } from '../../utils/typeAliases'; import styles from './Hint.module.css'; interface HintProps { diff --git a/src/components/ImagineTag/ImagineTag.tsx b/src/components/ImagineTag/ImagineTag.tsx index 6d9200fc9..a77f7d046 100644 --- a/src/components/ImagineTag/ImagineTag.tsx +++ b/src/components/ImagineTag/ImagineTag.tsx @@ -1,4 +1,4 @@ -import { string_midjourney_prompt } from '../../utils/typeAliases'; +import type { string_midjourney_prompt } from '../../utils/typeAliases'; import styles from './ImagineTag.module.css'; interface ImagineTagProps { diff --git a/src/components/ImportFonts/ImportFonts.tsx b/src/components/ImportFonts/ImportFonts.tsx index c59ff4788..77c94d535 100644 --- a/src/components/ImportFonts/ImportFonts.tsx +++ b/src/components/ImportFonts/ImportFonts.tsx @@ -1,7 +1,7 @@ import { useContext } from 'react'; import { FONTS } from '../../../config'; import { ExportContext } from '../../utils/hooks/ExportContext'; -import { string_font_family } from '../../utils/typeAliases'; +import type { string_font_family } from '../../utils/typeAliases'; interface ImportFontsProps { /** diff --git a/src/components/ImportFonts/addFontToContent.ts b/src/components/ImportFonts/addFontToContent.ts index 55d975ae5..1990a58f5 100644 --- a/src/components/ImportFonts/addFontToContent.ts +++ b/src/components/ImportFonts/addFontToContent.ts @@ -1,6 +1,6 @@ import { spaceTrim } from 'spacetrim'; import { detectContentFormat } from '../../utils/content/detectContentFormat'; -import { string_font_family, string_html, string_markdown } from '../../utils/typeAliases'; +import type { string_font_family, string_html, string_markdown } from '../../utils/typeAliases'; export function addFontToContent( content: TContent, diff --git a/src/components/ImportFonts/extractFontsFromContent.ts b/src/components/ImportFonts/extractFontsFromContent.ts index 03c326a8e..04280a96a 100644 --- a/src/components/ImportFonts/extractFontsFromContent.ts +++ b/src/components/ImportFonts/extractFontsFromContent.ts @@ -1,4 +1,4 @@ -import { string_font_family, string_html, string_markdown } from '../../utils/typeAliases'; +import type { string_font_family, string_html, string_markdown } from '../../utils/typeAliases'; /** * A function that takes a string as input and returns a set of fonts extracted from it diff --git a/src/components/InlineScript/InlineScript.tsx b/src/components/InlineScript/InlineScript.tsx index 893b18dd1..eeac3202c 100644 --- a/src/components/InlineScript/InlineScript.tsx +++ b/src/components/InlineScript/InlineScript.tsx @@ -2,7 +2,7 @@ import Script from 'next/script'; import { useContext } from 'react'; import { prettifyJavascript } from '../../export/utils/prettifyJavascript'; import { ExportContext } from '../../utils/hooks/ExportContext'; -import { string_javascript } from '../../utils/typeAliases'; +import type { string_javascript } from '../../utils/typeAliases'; interface InlineScriptProps { /** diff --git a/src/components/MarkdownContent/Content.tsx b/src/components/MarkdownContent/Content.tsx index 4fc8d83f2..660ffb429 100644 --- a/src/components/MarkdownContent/Content.tsx +++ b/src/components/MarkdownContent/Content.tsx @@ -1,6 +1,6 @@ import { useMemo } from 'react'; import { detectContentFormat } from '../../utils/content/detectContentFormat'; -import { string_css_class, string_href, string_html, string_markdown } from '../../utils/typeAliases'; +import type { string_css_class, string_href, string_html, string_markdown } from '../../utils/typeAliases'; import { HtmlContent } from './HtmlContent'; import { MarkdownContent } from './MarkdownContent'; diff --git a/src/components/MarkdownContent/HtmlContent.tsx b/src/components/MarkdownContent/HtmlContent.tsx index 99a465874..fb0812404 100644 --- a/src/components/MarkdownContent/HtmlContent.tsx +++ b/src/components/MarkdownContent/HtmlContent.tsx @@ -1,7 +1,7 @@ import parse from 'html-react-parser'; import { useEffect, useLayoutEffect, useRef } from 'react'; import { useSsrDetection } from '../../utils/hooks/useSsrDetection'; -import { string_css_class, string_href, string_html } from '../../utils/typeAliases'; +import type { string_css_class, string_href, string_html } from '../../utils/typeAliases'; import { extractFontsFromContent } from '../ImportFonts/extractFontsFromContent'; import { mapLinksInHtml } from './mapLinksInHtml'; diff --git a/src/components/MarkdownContent/MarkdownContent.tsx b/src/components/MarkdownContent/MarkdownContent.tsx index dec7438df..99e9e0106 100644 --- a/src/components/MarkdownContent/MarkdownContent.tsx +++ b/src/components/MarkdownContent/MarkdownContent.tsx @@ -1,7 +1,7 @@ import { spaceTrim } from 'spacetrim'; import { linkMarkdown } from '../../utils/content/linkMarkdown'; import { normalizeDashes } from '../../utils/content/normalizeDashes'; -import { string_css_class, string_href, string_markdown } from '../../utils/typeAliases'; +import type { string_css_class, string_href, string_markdown } from '../../utils/typeAliases'; import { HtmlContent } from './HtmlContent'; import { markdownConverter } from './markdownConverter'; diff --git a/src/components/MarkdownContent/mapLinksInHtml.ts b/src/components/MarkdownContent/mapLinksInHtml.ts index bb095f129..bc883cc1b 100644 --- a/src/components/MarkdownContent/mapLinksInHtml.ts +++ b/src/components/MarkdownContent/mapLinksInHtml.ts @@ -1,4 +1,4 @@ -import { string_href, string_html } from '../../utils/typeAliases'; +import type { string_href, string_html } from '../../utils/typeAliases'; /** * Map all by replacer diff --git a/src/components/MidjourneyLink/MidjourneyLink.tsx b/src/components/MidjourneyLink/MidjourneyLink.tsx index 71a37475f..8e483d9a6 100644 --- a/src/components/MidjourneyLink/MidjourneyLink.tsx +++ b/src/components/MidjourneyLink/MidjourneyLink.tsx @@ -1,4 +1,4 @@ -import { uuid } from '../../utils/typeAliases'; +import type { uuid } from '../../utils/typeAliases'; import styles from './MidjourneyLink.module.css'; interface MidjourneyLinkProps { diff --git a/src/components/PricingTable/PricingTableNext.tsx b/src/components/PricingTable/PricingTableNext.tsx index a6a0c6582..748111151 100644 --- a/src/components/PricingTable/PricingTableNext.tsx +++ b/src/components/PricingTable/PricingTableNext.tsx @@ -1,4 +1,4 @@ -import { number_positive, title } from '../../utils/typeAliases'; +import type { number_positive, title } from '../../utils/typeAliases'; import styles from './PricingTableNext.module.css'; interface PricingTableNextProps { diff --git a/src/components/Section/Section.tsx b/src/components/Section/Section.tsx index 7cbf7b1e2..bce7b65de 100644 --- a/src/components/Section/Section.tsx +++ b/src/components/Section/Section.tsx @@ -1,6 +1,6 @@ import type { ReactNode } from 'react'; import { classNames } from '../../utils/classNames'; -import { string_css_class } from '../../utils/typeAliases'; +import type { string_css_class } from '../../utils/typeAliases'; import styles from './Section.module.css'; interface SectionProps { diff --git a/src/components/Select/Select.tsx b/src/components/Select/Select.tsx index a486551f5..8e364fdcd 100644 --- a/src/components/Select/Select.tsx +++ b/src/components/Select/Select.tsx @@ -1,6 +1,6 @@ import type { ReactNode } from 'react'; import { classNames } from '../../utils/classNames'; -import { string_css_class } from '../../utils/typeAliases'; +import type { string_css_class } from '../../utils/typeAliases'; import styles from './Select.module.css'; interface SelectProps { diff --git a/src/components/SimpleLayout/Center.tsx b/src/components/SimpleLayout/Center.tsx index 791ad17ba..c4a6ad5d4 100644 --- a/src/components/SimpleLayout/Center.tsx +++ b/src/components/SimpleLayout/Center.tsx @@ -1,6 +1,6 @@ import type { ReactNode } from 'react'; import { classNames } from '../../utils/classNames'; -import { string_css_class } from '../../utils/typeAliases'; +import type { string_css_class } from '../../utils/typeAliases'; import styles from './Center.module.css'; interface CenterProps { diff --git a/src/components/TaskInProgress/TorusInteractiveImage.tsx b/src/components/TaskInProgress/TorusInteractiveImage.tsx index 3d767a9bd..7f7da72a0 100644 --- a/src/components/TaskInProgress/TorusInteractiveImage.tsx +++ b/src/components/TaskInProgress/TorusInteractiveImage.tsx @@ -1,7 +1,7 @@ import { MeshBuilder } from 'babylonjs'; import { SPEED } from '../../../config'; import { useGraph } from '../../utils/hooks/useGraph'; -import { number_positive, string_css_class } from '../../utils/typeAliases'; +import type { number_positive, string_css_class } from '../../utils/typeAliases'; interface TorusInteractiveProps { /** diff --git a/src/components/TaskInProgress/task/TaskProgress.ts b/src/components/TaskInProgress/task/TaskProgress.ts index fdb98dc8e..5e81474e9 100644 --- a/src/components/TaskInProgress/task/TaskProgress.ts +++ b/src/components/TaskInProgress/task/TaskProgress.ts @@ -1,4 +1,4 @@ -import { string_name, title } from '../../../utils/typeAliases'; +import type { string_name, title } from '../../../utils/typeAliases'; export type TaskProgress = PendingTaskProgress | DoneTaskProgress; diff --git a/src/components/UploadNewWallpaper/UploadNewWallpaper.tsx b/src/components/UploadNewWallpaper/UploadNewWallpaper.tsx index d5c1f39da..ae06ef788 100644 --- a/src/components/UploadNewWallpaper/UploadNewWallpaper.tsx +++ b/src/components/UploadNewWallpaper/UploadNewWallpaper.tsx @@ -4,7 +4,7 @@ import { useState } from 'react'; import { spaceTrim } from 'spacetrim'; import { classNames } from '../../utils/classNames'; import { provideClientId } from '../../utils/supabase/provideClientId'; -import { string_css_class } from '../../utils/typeAliases'; +import type { string_css_class } from '../../utils/typeAliases'; import { createNewWallpaperForBrowser } from '../../workers/createNewWallpaper/createNewWallpaperForBrowser'; import { joinTasksProgress } from '../TaskInProgress/task/joinTasksProgress'; import type { TaskProgress } from '../TaskInProgress/task/TaskProgress'; diff --git a/src/components/UploadZone/UploadZone.tsx b/src/components/UploadZone/UploadZone.tsx index f5e769d60..f7b87350b 100644 --- a/src/components/UploadZone/UploadZone.tsx +++ b/src/components/UploadZone/UploadZone.tsx @@ -1,7 +1,7 @@ import type { ReactNode } from 'react'; import { useState } from 'react'; import { classNames } from '../../utils/classNames'; -import { string_css_class } from '../../utils/typeAliases'; +import type { string_css_class } from '../../utils/typeAliases'; import { CreateZone } from '../CreateZone/CreateZone'; interface UploadZoneProps { diff --git a/src/components/WallpaperContent/WallpaperContent.tsx b/src/components/WallpaperContent/WallpaperContent.tsx index 3a9d24286..d752bb8d9 100644 --- a/src/components/WallpaperContent/WallpaperContent.tsx +++ b/src/components/WallpaperContent/WallpaperContent.tsx @@ -5,7 +5,7 @@ import { useCurrentWallpaper } from '../../utils/hooks/useCurrentWallpaper'; import { useCurrentWallpaperFonts } from '../../utils/hooks/useCurrentWallpaperFonts'; import { usePageName } from '../../utils/hooks/usePageName'; import { useRole } from '../../utils/hooks/useRole'; -import { string_href, string_html } from '../../utils/typeAliases'; +import type { string_href, string_html } from '../../utils/typeAliases'; import { activateGalleryComponent } from '../AiComponents/activateGalleryComponent'; import { AiComponentsRoot } from '../AiComponents/AiComponentsRoot'; import { ExportCommentedBlock } from '../ExportComment/ExportCommentedBlock'; diff --git a/src/components/WallpaperContent/getPageContent.ts b/src/components/WallpaperContent/getPageContent.ts index a0b98043a..7c16c18e3 100644 --- a/src/components/WallpaperContent/getPageContent.ts +++ b/src/components/WallpaperContent/getPageContent.ts @@ -5,7 +5,7 @@ import gallery from '../../../documents/gallery.html'; import license from '../../../documents/license.md'; import pricing from '../../../documents/pricing.html'; import testSize from '../../../documents/test-size.html'; -import { string_html, string_markdown, string_page } from '../../utils/typeAliases'; +import type { string_html, string_markdown, string_page } from '../../utils/typeAliases'; export const PAGES_CONTENTS: Record = { explanation, diff --git a/src/components/WallpaperLink/WallpaperLink.tsx b/src/components/WallpaperLink/WallpaperLink.tsx index 651648ab2..09cce85de 100644 --- a/src/components/WallpaperLink/WallpaperLink.tsx +++ b/src/components/WallpaperLink/WallpaperLink.tsx @@ -5,7 +5,7 @@ import { RefCallback, useContext } from 'react'; import { ExportContext } from '../../utils/hooks/ExportContext'; import { DEFAULT_ROLE, Role } from '../../utils/hooks/useRole'; import { DEFAULT_SCENARIO, Scenario } from '../../utils/hooks/useScenario'; -import { string_page, string_wallpaper_id } from '../../utils/typeAliases'; +import type { string_page, string_wallpaper_id } from '../../utils/typeAliases'; interface WallpaperLinkProps extends Omit, 'ref' | 'role' /* <- [🍛] */> { wallpaperId?: string_wallpaper_id | null; diff --git a/src/components/Whois/AdvancedDomainsChecker.tsx b/src/components/Whois/AdvancedDomainsChecker.tsx index 4ffedbf15..b656fdd5b 100644 --- a/src/components/Whois/AdvancedDomainsChecker.tsx +++ b/src/components/Whois/AdvancedDomainsChecker.tsx @@ -1,6 +1,6 @@ import { useState } from 'react'; import { spaceTrim } from 'spacetrim'; -import { string_domain, string_tdl } from '../../utils/typeAliases'; +import type { string_domain, string_tdl } from '../../utils/typeAliases'; import styles from './AdvancedDomainsChecker.module.css'; import { createAllPermutationsOf } from './utils/createAllPermutationsOf'; import { createAllSubsetsOf } from './utils/createAllSubsetsOf'; diff --git a/src/components/Whois/SimpleDomainChecker.tsx b/src/components/Whois/SimpleDomainChecker.tsx index 2a593b5c5..431ce3977 100644 --- a/src/components/Whois/SimpleDomainChecker.tsx +++ b/src/components/Whois/SimpleDomainChecker.tsx @@ -1,5 +1,5 @@ import { useState } from 'react'; -import { string_hostname } from '../../utils/typeAliases'; +import type { string_hostname } from '../../utils/typeAliases'; import { WhoisDomain } from './WhoisDomain/WhoisDomain'; /** diff --git a/src/components/Whois/WhoisDomain/WhoisDomain.tsx b/src/components/Whois/WhoisDomain/WhoisDomain.tsx index c3fd807f6..963654d8c 100644 --- a/src/components/Whois/WhoisDomain/WhoisDomain.tsx +++ b/src/components/Whois/WhoisDomain/WhoisDomain.tsx @@ -1,6 +1,6 @@ import Link from 'next/link'; import { useState } from 'react'; -import { string_domain } from '../../../utils/typeAliases'; +import type { string_domain } from '../../../utils/typeAliases'; import { useWhois } from '../utils/useWhois'; import styles from './WhoisDomain.module.css'; diff --git a/src/components/Whois/WhoisDomains/WhoisDomains.tsx b/src/components/Whois/WhoisDomains/WhoisDomains.tsx index 2e426be11..9ca93611a 100644 --- a/src/components/Whois/WhoisDomains/WhoisDomains.tsx +++ b/src/components/Whois/WhoisDomains/WhoisDomains.tsx @@ -1,4 +1,4 @@ -import { string_domain } from '../../../utils/typeAliases'; +import type { string_domain } from '../../../utils/typeAliases'; import { WhoisDomain } from '../WhoisDomain/WhoisDomain'; import styles from './WhoisDomains.module.css'; diff --git a/src/components/Whois/utils/useWhois.ts b/src/components/Whois/utils/useWhois.ts index 99099ad5d..e34ab143c 100644 --- a/src/components/Whois/utils/useWhois.ts +++ b/src/components/Whois/utils/useWhois.ts @@ -2,7 +2,7 @@ import { normalizeTo_PascalCase } from 'n12'; import { useMemo } from 'react'; import type WhoisSearchResult from 'whoiser' /* <- TODO: There should be probbably "import { type WhoisSearchResult } from 'whoiser' " */; import { usePromise } from '../../../utils/hooks/usePromise'; -import { string_domain } from '../../../utils/typeAliases'; +import type { string_domain } from '../../../utils/typeAliases'; import { DomainStatus } from './DomainStatus'; import { getDomainStatusFromWhois } from './getDomainStatusFromWhois'; diff --git a/src/components/_Sample/Sample.tsx b/src/components/_Sample/Sample.tsx index c55a84b44..3f0e14239 100644 --- a/src/components/_Sample/Sample.tsx +++ b/src/components/_Sample/Sample.tsx @@ -1,6 +1,6 @@ import type { ReactNode } from 'react'; import { classNames } from '../../utils/classNames'; -import { string_css_class } from '../../utils/typeAliases'; +import type { string_css_class } from '../../utils/typeAliases'; import styles from './Sample.module.css'; interface SampleProps { diff --git a/src/export/HtmlExportFile.tsx b/src/export/HtmlExportFile.tsx index da28b7c80..c9a4224ef 100644 --- a/src/export/HtmlExportFile.tsx +++ b/src/export/HtmlExportFile.tsx @@ -1,4 +1,10 @@ -import { string_css, string_file_relative_path, string_html, string_markdown, string_mime_type } from '../utils/typeAliases'; +import type { + string_css, + string_file_relative_path, + string_html, + string_markdown, + string_mime_type, +} from '../utils/typeAliases'; export interface HtmlExportFile { type: 'page' | 'code' | 'asset' | 'other'; diff --git a/src/export/exportAsHtml.tsx b/src/export/exportAsHtml.tsx index a34a0fc67..c9fde2b0b 100644 --- a/src/export/exportAsHtml.tsx +++ b/src/export/exportAsHtml.tsx @@ -15,7 +15,7 @@ import { ExportContext } from '../utils/hooks/ExportContext'; import { parseFontsFromWallpaper } from '../utils/hooks/useCurrentWallpaperFonts'; import { WallpapersContext } from '../utils/hooks/WallpapersContext'; import { IWallpaper } from '../utils/IWallpaper'; -import { string_css, string_page } from '../utils/typeAliases'; +import type { string_css, string_page } from '../utils/typeAliases'; import { HtmlExportFile } from './HtmlExportFile'; import { HtmlExportOptions } from './HtmlExportOptions'; import { splitCss } from './splitCss'; diff --git a/src/export/splitCss.ts b/src/export/splitCss.ts index 8b402c818..09cc1e8ee 100644 --- a/src/export/splitCss.ts +++ b/src/export/splitCss.ts @@ -1,8 +1,8 @@ -import { string_css } from '../utils/typeAliases'; +import type { string_css } from '../utils/typeAliases'; /** * Splits a CSS string into an array of CSS chunks - * + * * @param {string} cssString - The CSS string to be split. * @returns {string[]} - An array of CSS chunks. */ diff --git a/src/export/utils/ObjectUrl.ts b/src/export/utils/ObjectUrl.ts index 0fe7cd819..9eaeb861c 100644 --- a/src/export/utils/ObjectUrl.ts +++ b/src/export/utils/ObjectUrl.ts @@ -1,5 +1,5 @@ import { IDestroyable, ITeardownLogic, Registration } from 'destroyable'; -import { string_url } from '../../utils/typeAliases'; +import type { string_url } from '../../utils/typeAliases'; /** * Converts Blob, File or MediaSource to url using URL.createObjectURL diff --git a/src/export/utils/blobToDataurl.ts b/src/export/utils/blobToDataurl.ts index 1b51cba28..a93f81a4b 100644 --- a/src/export/utils/blobToDataurl.ts +++ b/src/export/utils/blobToDataurl.ts @@ -1,5 +1,5 @@ import type { Promisable } from 'type-fest'; -import { string_data_url } from '../../utils/typeAliases'; +import type { string_data_url } from '../../utils/typeAliases'; /** * Convert Blob or File to string data url diff --git a/src/export/utils/blobToFile.ts b/src/export/utils/blobToFile.ts index 158c3e612..9f45df17a 100644 --- a/src/export/utils/blobToFile.ts +++ b/src/export/utils/blobToFile.ts @@ -1,4 +1,4 @@ -import { string_filename } from '../../utils/typeAliases'; +import type { string_filename } from '../../utils/typeAliases'; /** * Converts Blob to File diff --git a/src/export/utils/induceFileDownload.ts b/src/export/utils/induceFileDownload.ts index 5d488698f..30f153712 100644 --- a/src/export/utils/induceFileDownload.ts +++ b/src/export/utils/induceFileDownload.ts @@ -1,4 +1,4 @@ -import { string_url } from '../../utils/typeAliases'; +import type { string_url } from '../../utils/typeAliases'; import { ObjectUrl } from './ObjectUrl'; /** diff --git a/src/export/utils/prettifyCss.ts b/src/export/utils/prettifyCss.ts index 500214649..6db951e60 100644 --- a/src/export/utils/prettifyCss.ts +++ b/src/export/utils/prettifyCss.ts @@ -1,6 +1,6 @@ import { format } from 'prettier'; import parserPostcss from 'prettier/parser-postcss'; -import { string_css } from '../../utils/typeAliases'; +import type { string_css } from '../../utils/typeAliases'; /** * Prettify the css code diff --git a/src/export/utils/prettifyHtml.ts b/src/export/utils/prettifyHtml.ts index ea0586df9..8461334ec 100644 --- a/src/export/utils/prettifyHtml.ts +++ b/src/export/utils/prettifyHtml.ts @@ -1,6 +1,6 @@ import { format } from 'prettier'; import parserHtml from 'prettier/parser-html'; -import { string_html } from '../../utils/typeAliases'; +import type { string_html } from '../../utils/typeAliases'; /** * Prettify the html code diff --git a/src/export/utils/prettifyJavascript.ts b/src/export/utils/prettifyJavascript.ts index 3ff1e976b..4cf5b75f8 100644 --- a/src/export/utils/prettifyJavascript.ts +++ b/src/export/utils/prettifyJavascript.ts @@ -1,6 +1,6 @@ import { format } from 'prettier'; import parserBabel from 'prettier/parser-babel'; -import { string_javascript } from '../../utils/typeAliases'; +import type { string_javascript } from '../../utils/typeAliases'; /** * Prettify the css code diff --git a/src/export/utils/removeSourceMaps.ts b/src/export/utils/removeSourceMaps.ts index 38ba9a7e9..a259a131b 100644 --- a/src/export/utils/removeSourceMaps.ts +++ b/src/export/utils/removeSourceMaps.ts @@ -1,4 +1,4 @@ -import { string_css, string_javascript } from '../../utils/typeAliases'; +import type { string_css, string_javascript } from '../../utils/typeAliases'; /** * Remove source maps from the code diff --git a/src/export/utils/removeTodoComments.ts b/src/export/utils/removeTodoComments.ts index ae30425cd..e8d40290c 100644 --- a/src/export/utils/removeTodoComments.ts +++ b/src/export/utils/removeTodoComments.ts @@ -1,4 +1,4 @@ -import { string_css, string_html, string_javascript, string_svg } from '../../utils/typeAliases'; +import type { string_css, string_html, string_javascript, string_svg } from '../../utils/typeAliases'; /** * Remove TODO comments from HTML, CSS or JavaScript diff --git a/src/pages/[wallpaperId].tsx b/src/pages/[wallpaperId].tsx index acebf2424..3770f3b89 100644 --- a/src/pages/[wallpaperId].tsx +++ b/src/pages/[wallpaperId].tsx @@ -11,7 +11,7 @@ import { WallpapersContext } from '../utils/hooks/WallpapersContext'; import { hydrateWallpapersCached } from '../utils/hydrateWallpapersCached'; import { IWallpaperSerialized } from '../utils/IWallpaper'; import { getSupabaseForServer } from '../utils/supabase/getSupabaseForServer'; -import { string_wallpaper_id } from '../utils/typeAliases'; +import type { string_wallpaper_id } from '../utils/typeAliases'; import { validateUuid } from '../utils/validators/validateUuid'; interface WallpaperPageProps { diff --git a/src/pages/api/custom/upload-wallpaper-image.ts b/src/pages/api/custom/upload-wallpaper-image.ts index 194a05fbc..3a87fc6bd 100644 --- a/src/pages/api/custom/upload-wallpaper-image.ts +++ b/src/pages/api/custom/upload-wallpaper-image.ts @@ -3,7 +3,7 @@ import { readFile } from 'fs/promises'; import type { NextApiRequest, NextApiResponse } from 'next'; import { CDN } from '../../../../config'; import { generateUserWallpaperCdnKey } from '../../../utils/cdn/utils/generateUserWallpaperCdnKey'; -import { string_url } from '../../../utils/typeAliases'; +import type { string_url } from '../../../utils/typeAliases'; export interface UploadWallpaperResponse { // TODO: [🌋] ErrorableResponse diff --git a/src/pages/api/custom/write-wallpaper-content.ts b/src/pages/api/custom/write-wallpaper-content.ts index 011c02834..ad1ca75de 100644 --- a/src/pages/api/custom/write-wallpaper-content.ts +++ b/src/pages/api/custom/write-wallpaper-content.ts @@ -1,7 +1,7 @@ import type { NextApiRequest, NextApiResponse } from 'next'; import { writeWallpaperContent } from '../../../ai/text-to-text/writeWallpaperContent'; -import { description, string_markdown, uuid } from '../../../utils/typeAliases'; +import type { description, string_markdown, uuid } from '../../../utils/typeAliases'; import { isValidClientId } from '../../../utils/validators/isValidClientId'; export interface WriteWallpaperContentResponse { diff --git a/src/pages/api/custom/write-wallpaper-prompt.ts b/src/pages/api/custom/write-wallpaper-prompt.ts index 427b1af0b..e034e3d91 100644 --- a/src/pages/api/custom/write-wallpaper-prompt.ts +++ b/src/pages/api/custom/write-wallpaper-prompt.ts @@ -1,7 +1,7 @@ import type { NextApiRequest, NextApiResponse } from 'next'; import { imageToText } from '../../../ai/image-to-text/imageToText'; -import { image_description, string_url } from '../../../utils/typeAliases'; +import type { image_description, string_url } from '../../../utils/typeAliases'; import { isValidUrl } from '../../../utils/validators/isValidUrl'; export interface WriteWallpaperPromptResponse { diff --git a/src/pages/api/og-image.tsx b/src/pages/api/og-image.tsx index 7a0f12005..380005f51 100644 --- a/src/pages/api/og-image.tsx +++ b/src/pages/api/og-image.tsx @@ -1,6 +1,6 @@ import { unstable_createNodejsStream } from '@vercel/og'; import type { NextApiRequest, NextApiResponse } from 'next'; -import { string_wallpaper_id } from '../../utils/typeAliases'; +import type { string_wallpaper_id } from '../../utils/typeAliases'; import { isValidWallpaperId } from '../../utils/validators/isValidWallpaperId'; export default async function ogImageHandler(request: NextApiRequest, response: NextApiResponse) { diff --git a/src/pages/api/recommend-wallpaper.ts b/src/pages/api/recommend-wallpaper.ts index 4bff48638..78e457cd0 100644 --- a/src/pages/api/recommend-wallpaper.ts +++ b/src/pages/api/recommend-wallpaper.ts @@ -6,7 +6,7 @@ import type { LikedStatus } from '../../utils/hooks/useLikedStatusOfCurrentWallp import { hydrateWallpaper } from '../../utils/hydrateWallpaper'; import { IWallpaper, IWallpaperSerialized } from '../../utils/IWallpaper'; import { getSupabaseForServer } from '../../utils/supabase/getSupabaseForServer'; -import { number_likeness, string_url } from '../../utils/typeAliases'; +import type { number_likeness, string_url } from '../../utils/typeAliases'; import { isValidUuid } from '../../utils/validators/isValidUuid'; export interface RecommendWallpaperResponse { diff --git a/src/pages/api/register-script.ts b/src/pages/api/register-script.ts index 8b1a04825..60bbfdb02 100644 --- a/src/pages/api/register-script.ts +++ b/src/pages/api/register-script.ts @@ -2,7 +2,7 @@ import type { NextApiRequest, NextApiResponse } from 'next'; import { spaceTrim } from 'spacetrim'; import { NEXT_PUBLIC_URL } from '../../../config'; import { prettifyJavascript } from '../../export/utils/prettifyJavascript'; -import { uuid } from '../../utils/typeAliases'; +import type { uuid } from '../../utils/typeAliases'; import { isValidWallpaperId } from '../../utils/validators/isValidWallpaperId'; async function register(wallpaperId: uuid) { diff --git a/src/pages/api/register.ts b/src/pages/api/register.ts index 0d7a4bf9f..c15aa4ca4 100644 --- a/src/pages/api/register.ts +++ b/src/pages/api/register.ts @@ -1,6 +1,6 @@ import type { NextApiRequest, NextApiResponse } from 'next'; import { getSupabaseForServer } from '../../utils/supabase/getSupabaseForServer'; -import { string_url, string_wallpaper_id } from '../../utils/typeAliases'; +import type { string_url, string_wallpaper_id } from '../../utils/typeAliases'; import { isValidUrl } from '../../utils/validators/isValidUrl'; import { isValidWallpaperId } from '../../utils/validators/isValidWallpaperId'; diff --git a/src/pages/api/update-wallpaper-content.ts b/src/pages/api/update-wallpaper-content.ts index b3de57dd1..ebd89ef51 100644 --- a/src/pages/api/update-wallpaper-content.ts +++ b/src/pages/api/update-wallpaper-content.ts @@ -3,7 +3,7 @@ import { spaceTrim } from 'spacetrim'; import { ChatThread } from '../../ai/text-to-text/ChatThread'; import { removeQuotes } from '../../utils/content/removeQuotes'; import { IWallpaperSerialized } from '../../utils/IWallpaper'; -import { string_prompt, uuid } from '../../utils/typeAliases'; +import type { string_prompt, uuid } from '../../utils/typeAliases'; import { isValidClientId } from '../../utils/validators/isValidClientId'; export interface UpdateWallpaperContentRequest { diff --git a/src/pages/api/wallpapers-min.ts b/src/pages/api/wallpapers-min.ts index 90c688fbe..27a7a2c37 100644 --- a/src/pages/api/wallpapers-min.ts +++ b/src/pages/api/wallpapers-min.ts @@ -1,6 +1,6 @@ import type { NextApiRequest, NextApiResponse } from 'next'; import { getHardcodedWallpapers } from '../../../scripts/utils/hardcoded-wallpaper/getHardcodedWallpapers'; -import { string_color, string_wallpaper_id } from '../../utils/typeAliases'; +import type { string_color, string_wallpaper_id } from '../../utils/typeAliases'; interface WallpapersResponse { wallpapers: Array<{ id: string_wallpaper_id; primaryColor: string_color }>; diff --git a/src/utils/cdn/interfaces/IFilesStorage.ts b/src/utils/cdn/interfaces/IFilesStorage.ts index bcd19ad9a..258a7ee82 100644 --- a/src/utils/cdn/interfaces/IFilesStorage.ts +++ b/src/utils/cdn/interfaces/IFilesStorage.ts @@ -1,5 +1,5 @@ import type { IStorage } from 'everstorage'; -import { string_mime_type } from '../../typeAliases'; +import type { string_mime_type } from '../../typeAliases'; export interface IFile { // Maybe TODO name: string_name; diff --git a/src/utils/cdn/utils/generateUserWallpaperCdnKey.ts b/src/utils/cdn/utils/generateUserWallpaperCdnKey.ts index 37a0ed4bc..facc38fe6 100644 --- a/src/utils/cdn/utils/generateUserWallpaperCdnKey.ts +++ b/src/utils/cdn/utils/generateUserWallpaperCdnKey.ts @@ -1,6 +1,6 @@ import hexEncoder from 'crypto-js/enc-hex'; import sha256 from 'crypto-js/sha256'; -import { string_uri } from '../../typeAliases'; +import type { string_uri } from '../../typeAliases'; import { nameToSubfolderPath } from './nameToSubfolderPath'; /** diff --git a/src/utils/cdn/utils/generateWallpaperCdnKey.ts b/src/utils/cdn/utils/generateWallpaperCdnKey.ts index c7201bfb5..8e94230e1 100644 --- a/src/utils/cdn/utils/generateWallpaperCdnKey.ts +++ b/src/utils/cdn/utils/generateWallpaperCdnKey.ts @@ -1,5 +1,5 @@ import { IWallpaper } from '../../IWallpaper'; -import { string_uri } from '../../typeAliases'; +import type { string_uri } from '../../typeAliases'; import { nameToSubfolderPath } from './nameToSubfolderPath'; /** diff --git a/src/utils/computeWallpaperUriid.ts b/src/utils/computeWallpaperUriid.ts index 3dfce3242..9036a098b 100644 --- a/src/utils/computeWallpaperUriid.ts +++ b/src/utils/computeWallpaperUriid.ts @@ -4,7 +4,7 @@ import { extractTitleFromContent } from './content/extractTitleFromContent'; import { serializeColorStats } from './image/utils/serializeColorStats'; import { IWallpaper } from './IWallpaper'; import { randomString } from './randomString'; -import { string_uriid } from './typeAliases'; +import type { string_uriid } from './typeAliases'; const URIID_VERSION = '2'; diff --git a/src/utils/content/detectContentFormat.ts b/src/utils/content/detectContentFormat.ts index 1264751d4..d17ed345f 100644 --- a/src/utils/content/detectContentFormat.ts +++ b/src/utils/content/detectContentFormat.ts @@ -1,4 +1,4 @@ -import { string_html, string_markdown } from '../typeAliases'; +import type { string_html, string_markdown } from '../typeAliases'; import { removeContentComments } from './removeContentComments'; export function detectContentFormat(content: string_html | string_markdown | string): 'html' | 'markdown' | 'text' { @@ -29,4 +29,4 @@ export function detectContentFormat(content: string_html | string_markdown | str // If none of the above conditions are met, assume the content is plain text return 'text'; -} \ No newline at end of file +} diff --git a/src/utils/content/emojifyMarkdown.ts b/src/utils/content/emojifyMarkdown.ts index b7c0413d2..432ac0f5d 100644 --- a/src/utils/content/emojifyMarkdown.ts +++ b/src/utils/content/emojifyMarkdown.ts @@ -1,5 +1,5 @@ import { EMOJIS } from '../emojis'; -import { string_html, string_url } from '../typeAliases'; +import type { string_html, string_url } from '../typeAliases'; /** * Replaces emojis in an html with images from openmoji diff --git a/src/utils/content/extractDescriptionFromContent.ts b/src/utils/content/extractDescriptionFromContent.ts index 38424b2f8..8f188947f 100644 --- a/src/utils/content/extractDescriptionFromContent.ts +++ b/src/utils/content/extractDescriptionFromContent.ts @@ -1,5 +1,5 @@ import { markdownConverter } from '../../components/MarkdownContent/markdownConverter'; -import { description, string_html, string_markdown } from '../typeAliases'; +import type { description, string_html, string_markdown } from '../typeAliases'; import { detectContentFormat } from './detectContentFormat'; import { extractDescriptionFromHtml } from './extractDescriptionFromHtml'; diff --git a/src/utils/content/extractDescriptionFromHtml.ts b/src/utils/content/extractDescriptionFromHtml.ts index 1e8428114..b135b53c6 100644 --- a/src/utils/content/extractDescriptionFromHtml.ts +++ b/src/utils/content/extractDescriptionFromHtml.ts @@ -1,6 +1,6 @@ import { spaceTrim } from 'spacetrim'; import { DOMParser } from 'xmldom-qsa'; -import { description, string_html } from '../typeAliases'; +import type { description, string_html } from '../typeAliases'; /** * Extract the first paragraph from HTML diff --git a/src/utils/content/extractFirstParagraphFromMarkdown.ts b/src/utils/content/extractFirstParagraphFromMarkdown.ts index cca7043a1..2fd95d194 100644 --- a/src/utils/content/extractFirstParagraphFromMarkdown.ts +++ b/src/utils/content/extractFirstParagraphFromMarkdown.ts @@ -1,5 +1,5 @@ import { spaceTrim } from 'spacetrim'; -import { string_markdown } from '../typeAliases'; +import type { string_markdown } from '../typeAliases'; /** * Extracts the first paragraph from a markdown string. diff --git a/src/utils/content/extractTitleFromContent.ts b/src/utils/content/extractTitleFromContent.ts index 98ac0a990..278ea99e4 100644 --- a/src/utils/content/extractTitleFromContent.ts +++ b/src/utils/content/extractTitleFromContent.ts @@ -1,5 +1,5 @@ import { markdownConverter } from '../../components/MarkdownContent/markdownConverter'; -import { string_html, string_markdown, title } from '../typeAliases'; +import type { string_html, string_markdown, title } from '../typeAliases'; import { detectContentFormat } from './detectContentFormat'; import { extractTitleFromHtml } from './extractTitleFromHtml'; diff --git a/src/utils/content/extractTitleFromHtml.ts b/src/utils/content/extractTitleFromHtml.ts index ce0d2a506..e338bc8eb 100644 --- a/src/utils/content/extractTitleFromHtml.ts +++ b/src/utils/content/extractTitleFromHtml.ts @@ -1,6 +1,6 @@ import { spaceTrim } from 'spacetrim'; import { DOMParser } from 'xmldom-qsa'; -import { string_html, title } from '../typeAliases'; +import type { string_html, title } from '../typeAliases'; /** * Extract the first heading from HTML diff --git a/src/utils/content/removeContentComments.ts b/src/utils/content/removeContentComments.ts index 738b2ae32..e45ffb277 100644 --- a/src/utils/content/removeContentComments.ts +++ b/src/utils/content/removeContentComments.ts @@ -1,5 +1,5 @@ import { spaceTrim } from 'spacetrim'; -import { string_html, string_markdown } from '../typeAliases'; +import type { string_html, string_markdown } from '../typeAliases'; /** * Removes HTML or Markdown comments from a string. diff --git a/src/utils/content/removeMarkdownLinks.ts b/src/utils/content/removeMarkdownLinks.ts index eb2ce4912..ac2745424 100644 --- a/src/utils/content/removeMarkdownLinks.ts +++ b/src/utils/content/removeMarkdownLinks.ts @@ -1,4 +1,4 @@ -import { string_markdown } from '../typeAliases'; +import type { string_markdown } from '../typeAliases'; /** * Removes Markdown link tags from a string. diff --git a/src/utils/content/removeMarkdownTitle.ts b/src/utils/content/removeMarkdownTitle.ts index 8e149e777..13f99178c 100644 --- a/src/utils/content/removeMarkdownTitle.ts +++ b/src/utils/content/removeMarkdownTitle.ts @@ -1,5 +1,5 @@ import { spaceTrim } from 'spacetrim'; -import { string_markdown } from '../typeAliases'; +import type { string_markdown } from '../typeAliases'; /** * Remove the title from a markdown string. diff --git a/src/utils/hooks/useCurrentWallpaperFonts.ts b/src/utils/hooks/useCurrentWallpaperFonts.ts index d21ceb346..5baa406d9 100644 --- a/src/utils/hooks/useCurrentWallpaperFonts.ts +++ b/src/utils/hooks/useCurrentWallpaperFonts.ts @@ -1,6 +1,6 @@ import { extractFontsFromContent } from '../../components/ImportFonts/extractFontsFromContent'; import { IWallpaper } from '../IWallpaper'; -import { string_font_family } from '../typeAliases'; +import type { string_font_family } from '../typeAliases'; import { useCurrentWallpaper } from './useCurrentWallpaper'; interface WallpaperFonts { diff --git a/src/utils/hooks/useCurrentWallpaperId.ts b/src/utils/hooks/useCurrentWallpaperId.ts index 4f4d929f1..00e4f588e 100644 --- a/src/utils/hooks/useCurrentWallpaperId.ts +++ b/src/utils/hooks/useCurrentWallpaperId.ts @@ -1,5 +1,5 @@ import { useRouter } from 'next/router'; -import { string_wallpaper_id } from '../typeAliases'; +import type { string_wallpaper_id } from '../typeAliases'; /** * A function that returns current wallpaper id based on the router query diff --git a/src/utils/hooks/useLoadable.ts b/src/utils/hooks/useLoadable.ts index 507642c54..1ffdb17f3 100644 --- a/src/utils/hooks/useLoadable.ts +++ b/src/utils/hooks/useLoadable.ts @@ -1,5 +1,5 @@ import { isObservable } from 'rxjs'; -import { Loadable } from '../typeHelpers'; +import type { Loadable } from '../typeHelpers'; import { useObservable } from './useObservable'; import { usePromise } from './usePromise'; diff --git a/src/utils/hooks/usePageName.ts b/src/utils/hooks/usePageName.ts index a8b575ecd..34d2d6224 100644 --- a/src/utils/hooks/usePageName.ts +++ b/src/utils/hooks/usePageName.ts @@ -1,6 +1,6 @@ import { normalizeToKebabCase } from 'n12'; import { useRouter } from 'next/router'; -import { string_page } from '../typeAliases'; +import type { string_page } from '../typeAliases'; export function usePageName(): string_page { const router = useRouter(); diff --git a/src/utils/hooks/useWallpaperSubject.ts b/src/utils/hooks/useWallpaperSubject.ts index 6f4810eda..ba7815877 100644 --- a/src/utils/hooks/useWallpaperSubject.ts +++ b/src/utils/hooks/useWallpaperSubject.ts @@ -1,7 +1,7 @@ import { useContext } from 'react'; import { BehaviorSubject } from 'rxjs'; import { IWallpaper } from '../IWallpaper'; -import { string_wallpaper_id } from '../typeAliases'; +import type { string_wallpaper_id } from '../typeAliases'; import { WallpapersContext } from './WallpapersContext'; /** diff --git a/src/utils/hydrateWallpapers.ts b/src/utils/hydrateWallpapers.ts index 7ee63f57e..46cd9d99f 100644 --- a/src/utils/hydrateWallpapers.ts +++ b/src/utils/hydrateWallpapers.ts @@ -1,7 +1,7 @@ import { BehaviorSubject } from 'rxjs'; import { hydrateWallpaper } from './hydrateWallpaper'; import { IWallpaper, IWallpaperSerialized } from './IWallpaper'; -import { string_wallpaper_id } from './typeAliases'; +import type { string_wallpaper_id } from './typeAliases'; export function hydrateWallpapers( wallpapersJson: Array, diff --git a/src/utils/hydrateWallpapersCached.ts b/src/utils/hydrateWallpapersCached.ts index 920b2f10c..39118d962 100644 --- a/src/utils/hydrateWallpapersCached.ts +++ b/src/utils/hydrateWallpapersCached.ts @@ -1,7 +1,7 @@ import { BehaviorSubject } from 'rxjs'; import { hydrateWallpaper } from './hydrateWallpaper'; import { IWallpaper, IWallpaperSerialized } from './IWallpaper'; -import { string_wallpaper_id } from './typeAliases'; +import type { string_wallpaper_id } from './typeAliases'; /** * Cache of wallpapers to hydrate diff --git a/src/utils/image/createImageInBrowser.ts b/src/utils/image/createImageInBrowser.ts index 59e640492..574455894 100644 --- a/src/utils/image/createImageInBrowser.ts +++ b/src/utils/image/createImageInBrowser.ts @@ -1,6 +1,6 @@ import { Color } from '../color/Color'; import { forARest } from '../forARest'; -import { string_url } from '../typeAliases'; +import type { string_url } from '../typeAliases'; import { IComputeColorstatsWork } from './IComputeColorstatsWork'; import { Image as MyImage } from './Image'; diff --git a/src/utils/image/utils/IImageColorStats.ts b/src/utils/image/utils/IImageColorStats.ts index 67d99d259..a9e72b1d9 100644 --- a/src/utils/image/utils/IImageColorStats.ts +++ b/src/utils/image/utils/IImageColorStats.ts @@ -3,7 +3,7 @@ import { Vector } from 'xyzt'; import type { TaskProgress } from '../../../components/TaskInProgress/task/TaskProgress'; import { Color } from '../../color/Color'; import type { WithTake } from '../../take/interfaces/ITakeChain'; -import { number_integer, number_percent } from '../../typeAliases'; +import type { number_integer, number_percent } from '../../typeAliases'; import { IImage } from '../IImage'; interface IComputeImageColorStatsProgress { diff --git a/src/utils/jsx-html/jsxToHtml.ts b/src/utils/jsx-html/jsxToHtml.ts index 66e252c57..441aae7ca 100644 --- a/src/utils/jsx-html/jsxToHtml.ts +++ b/src/utils/jsx-html/jsxToHtml.ts @@ -1,5 +1,5 @@ import { renderToStaticMarkup } from 'react-dom/server'; -import { string_html, string_xml } from '../typeAliases'; +import type { string_html, string_xml } from '../typeAliases'; /** * Renders jsx to html / xml diff --git a/src/utils/jsx-html/jsxToHtmlSimple.ts b/src/utils/jsx-html/jsxToHtmlSimple.ts index 84c69da4a..ebc85afe2 100644 --- a/src/utils/jsx-html/jsxToHtmlSimple.ts +++ b/src/utils/jsx-html/jsxToHtmlSimple.ts @@ -1,4 +1,4 @@ -import { message, string_html } from '../typeAliases'; +import type { message, string_html } from '../typeAliases'; /** * Converts jsx to simple provisional html without using react-dom diff --git a/src/utils/loadAndRunExternalScript.tsx b/src/utils/loadAndRunExternalScript.tsx index d59f2c97f..592453c48 100644 --- a/src/utils/loadAndRunExternalScript.tsx +++ b/src/utils/loadAndRunExternalScript.tsx @@ -1,5 +1,5 @@ import { forImmediate } from 'waitasecond'; -import { string_url } from './typeAliases'; +import type { string_url } from './typeAliases'; /** * Load and run an external script diff --git a/src/utils/randomUuid.ts b/src/utils/randomUuid.ts index 43ff1c77b..cf1d31a32 100644 --- a/src/utils/randomUuid.ts +++ b/src/utils/randomUuid.ts @@ -1,5 +1,5 @@ import { v4 } from 'uuid'; -import { uuid } from './typeAliases'; +import type { uuid } from './typeAliases'; /** * Generates random UUID v4 diff --git a/src/utils/supabase/provideClientId.ts b/src/utils/supabase/provideClientId.ts index 0bf0948eb..979b3d8d8 100644 --- a/src/utils/supabase/provideClientId.ts +++ b/src/utils/supabase/provideClientId.ts @@ -1,6 +1,6 @@ import { promptDialogue } from '../../components/Dialogues/dialogues/promptDialogue'; import { IsClientVerifiedResponse } from '../../pages/api/client/is-client-verified'; -import { uuid } from '../typeAliases'; +import type { uuid } from '../typeAliases'; import { isValidEmail } from '../validators/isValidEmail'; import { getSupabaseForBrowser } from './getSupabaseForBrowser'; import { provideClientIdWithoutVerification } from './provideClientIdWithoutVerification'; @@ -48,7 +48,7 @@ export async function provideClientId(options: IProvideClientIdOptions): Promise prompt: `Please write your email`, placeholder: `john.smith@gmail.com`, defaultValue: `@`, - isCloseable: true + isCloseable: true, }); if (!isValidEmail(email)) { diff --git a/src/utils/supabase/provideClientIdWithoutVerification.ts b/src/utils/supabase/provideClientIdWithoutVerification.ts index c8496c5d3..760f17d04 100644 --- a/src/utils/supabase/provideClientIdWithoutVerification.ts +++ b/src/utils/supabase/provideClientIdWithoutVerification.ts @@ -1,6 +1,6 @@ import { isRunningInBrowser } from '../isRunningInWhatever'; import { randomUuid } from '../randomUuid'; -import { uuid } from '../typeAliases'; +import type { uuid } from '../typeAliases'; import { isValidClientId } from '../validators/isValidClientId'; /** diff --git a/src/utils/validators/isPrivateNetwork.ts b/src/utils/validators/isPrivateNetwork.ts index b96af9b7b..b94fc6980 100644 --- a/src/utils/validators/isPrivateNetwork.ts +++ b/src/utils/validators/isPrivateNetwork.ts @@ -1,4 +1,4 @@ -import { string_hostname } from '../typeAliases'; +import type { string_hostname } from '../typeAliases'; /** * Checks if an IP address or hostname is reserved for private networks or localhost. diff --git a/src/utils/validators/isValidClientId.ts b/src/utils/validators/isValidClientId.ts index b8bcbab57..811a2ac67 100644 --- a/src/utils/validators/isValidClientId.ts +++ b/src/utils/validators/isValidClientId.ts @@ -1,4 +1,3 @@ -import { uuid } from '../typeAliases'; import { isValidUuid } from './isValidUuid'; -export const isValidClientId = isValidUuid \ No newline at end of file +export const isValidClientId = isValidUuid; diff --git a/src/utils/validators/isValidEmail.ts b/src/utils/validators/isValidEmail.ts index c22a29a5a..e40d9a1d7 100644 --- a/src/utils/validators/isValidEmail.ts +++ b/src/utils/validators/isValidEmail.ts @@ -1,4 +1,4 @@ -import { string_email } from '../typeAliases'; +import type { string_email } from '../typeAliases'; /** * Checks if value is valid email diff --git a/src/utils/validators/isValidUuid.ts b/src/utils/validators/isValidUuid.ts index 8aacf3457..9e7a465d5 100644 --- a/src/utils/validators/isValidUuid.ts +++ b/src/utils/validators/isValidUuid.ts @@ -1,4 +1,4 @@ -import { uuid } from '../typeAliases'; +import type { uuid } from '../typeAliases'; /** * Checks if value is valid uuid diff --git a/src/utils/validators/isValidWallpaperId.ts b/src/utils/validators/isValidWallpaperId.ts index 5a63e44e0..bd792897c 100644 --- a/src/utils/validators/isValidWallpaperId.ts +++ b/src/utils/validators/isValidWallpaperId.ts @@ -1,4 +1,4 @@ -import { uuid } from '../typeAliases'; +import type { uuid } from '../typeAliases'; export function isValidWallpaperId(value: unknown): value is uuid { if (typeof value !== 'string') { diff --git a/src/utils/validators/validateUuid.ts b/src/utils/validators/validateUuid.ts index fb06e1892..f9a64fe20 100644 --- a/src/utils/validators/validateUuid.ts +++ b/src/utils/validators/validateUuid.ts @@ -1,4 +1,4 @@ -import { uuid } from '../typeAliases'; +import type { uuid } from '../typeAliases'; import { isValidUuid } from './isValidUuid'; export function validateUuid(value: unknown): uuid { diff --git a/src/workers/createNewWallpaper/createNewWallpaper.common.ts b/src/workers/createNewWallpaper/createNewWallpaper.common.ts index dd3a32cc0..506ef9533 100644 --- a/src/workers/createNewWallpaper/createNewWallpaper.common.ts +++ b/src/workers/createNewWallpaper/createNewWallpaper.common.ts @@ -1,4 +1,4 @@ -import { string_wallpaper_id, uuid } from '../../utils/typeAliases'; +import type { string_wallpaper_id, uuid } from '../../utils/typeAliases'; import { Workerify } from '../0-Workerify/Workerify'; export interface ICreateNewWallpaperRequest { From 1b425ad8b33a5b40a08e1929f63f733c8a70ec4e Mon Sep 17 00:00:00 2001 From: Pavol Hejny Date: Wed, 20 Sep 2023 16:39:16 +0200 Subject: [PATCH 07/20] Working on dialogues options --- src/components/Dialogues/Dialogues.tsx | 2 +- src/components/Dialogues/dialogues/promptDialogue.tsx | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/components/Dialogues/Dialogues.tsx b/src/components/Dialogues/Dialogues.tsx index 21a2cebaf..a1e5708bb 100644 --- a/src/components/Dialogues/Dialogues.tsx +++ b/src/components/Dialogues/Dialogues.tsx @@ -1,7 +1,7 @@ import { useEffect, useRef, useState } from 'react'; import { Modal } from '../Modal/00-Modal'; import styles from './Dialogues.module.css'; -import { IPromptInQueue } from './dialogues/promptDialogue'; +import type { IPromptInQueue } from './interfaces/PromptInQueue'; import { isDialoguesRendered } from './locks/Dialogues.lock'; import { promptDialogueQueue } from './queues/prompts'; diff --git a/src/components/Dialogues/dialogues/promptDialogue.tsx b/src/components/Dialogues/dialogues/promptDialogue.tsx index 8afc7c9ca..1fe5e2c16 100644 --- a/src/components/Dialogues/dialogues/promptDialogue.tsx +++ b/src/components/Dialogues/dialogues/promptDialogue.tsx @@ -19,6 +19,8 @@ export async function promptDialogue(options: IPromptDialogueOptions): Promise { From 7556e434eb27f187d8fce17d0386b225cc76c5e4 Mon Sep 17 00:00:00 2001 From: Pavol Hejny Date: Wed, 20 Sep 2023 16:39:58 +0200 Subject: [PATCH 08/20] Remove I prefix from interfaces IPromptDialogueOptions and IPromptInQueue --- src/components/Dialogues/Dialogues.tsx | 4 ++-- src/components/Dialogues/dialogues/promptDialogue.tsx | 8 ++++---- .../Dialogues/interfaces/PromptDialogueOptions.ts | 2 +- src/components/Dialogues/interfaces/PromptInQueue.ts | 4 ++-- src/workers/0-Workerify/PostMessages.ts | 4 ++-- 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/components/Dialogues/Dialogues.tsx b/src/components/Dialogues/Dialogues.tsx index a1e5708bb..67ab6a863 100644 --- a/src/components/Dialogues/Dialogues.tsx +++ b/src/components/Dialogues/Dialogues.tsx @@ -1,7 +1,7 @@ import { useEffect, useRef, useState } from 'react'; import { Modal } from '../Modal/00-Modal'; import styles from './Dialogues.module.css'; -import type { IPromptInQueue } from './interfaces/PromptInQueue'; +import type { PromptInQueue } from './interfaces/PromptInQueue'; import { isDialoguesRendered } from './locks/Dialogues.lock'; import { promptDialogueQueue } from './queues/prompts'; @@ -27,7 +27,7 @@ export function Dialogues() { ], ); - const [currentPromptInQueue, setCurrentPromptInQueue] = useState(null); + const [currentPromptInQueue, setCurrentPromptInQueue] = useState(null); const textareaRef = useRef(null); useEffect(() => { diff --git a/src/components/Dialogues/dialogues/promptDialogue.tsx b/src/components/Dialogues/dialogues/promptDialogue.tsx index 1fe5e2c16..ca902b137 100644 --- a/src/components/Dialogues/dialogues/promptDialogue.tsx +++ b/src/components/Dialogues/dialogues/promptDialogue.tsx @@ -1,21 +1,21 @@ import { forTime } from 'waitasecond'; import { isRunningInWebWorker } from '../../../utils/isRunningInWhatever'; import { IMessageMainToWorker, IMessagePromptDialogue } from '../../../workers/0-Workerify/PostMessages'; -import type { IPromptDialogueOptions } from '../interfaces/PromptDialogueOptions'; -import type { IPromptInQueue } from '../interfaces/PromptInQueue'; +import type { PromptDialogueOptions } from '../interfaces/PromptDialogueOptions'; +import type { PromptInQueue } from '../interfaces/PromptInQueue'; import { isDialoguesRendered } from '../locks/Dialogues.lock'; import { promptDialogueQueue } from '../queues/prompts'; /** * Pops up the co-pilot panel with a prompt dialogue. */ -export async function promptDialogue(options: IPromptDialogueOptions): Promise { +export async function promptDialogue(options: PromptDialogueOptions): Promise { const { prompt, defaultValue, placeholder, isCloseable, autoSubmit } = options; // TODO: !!! Implement isCloseable // TODO: !!! autoSubmit - const promptInQueue: IPromptInQueue = { + const promptInQueue: PromptInQueue = { prompt, defaultValue, placeholder, diff --git a/src/components/Dialogues/interfaces/PromptDialogueOptions.ts b/src/components/Dialogues/interfaces/PromptDialogueOptions.ts index af94389d1..2eaf84705 100644 --- a/src/components/Dialogues/interfaces/PromptDialogueOptions.ts +++ b/src/components/Dialogues/interfaces/PromptDialogueOptions.ts @@ -1,6 +1,6 @@ import type { message } from '../../../utils/typeAliases'; -export interface IPromptDialogueOptions { +export interface PromptDialogueOptions { /** * Prompt message * diff --git a/src/components/Dialogues/interfaces/PromptInQueue.ts b/src/components/Dialogues/interfaces/PromptInQueue.ts index 1571fb864..90b62c8af 100644 --- a/src/components/Dialogues/interfaces/PromptInQueue.ts +++ b/src/components/Dialogues/interfaces/PromptInQueue.ts @@ -1,4 +1,4 @@ -import { IPromptDialogueOptions } from "./PromptDialogueOptions"; +import { PromptDialogueOptions } from './PromptDialogueOptions'; /** * Represents a prompt message that is waiting for an answer or is already answered @@ -6,7 +6,7 @@ import { IPromptDialogueOptions } from "./PromptDialogueOptions"; * Note: This is not a prompt to language model but a prompt to the user * @private this should be used only withing this folder Dialogues */ -export interface IPromptInQueue extends IPromptDialogueOptions { +export interface PromptInQueue extends PromptDialogueOptions { /** * Answer to the prompt * diff --git a/src/workers/0-Workerify/PostMessages.ts b/src/workers/0-Workerify/PostMessages.ts index 2bc5ae3b1..cd136cbba 100644 --- a/src/workers/0-Workerify/PostMessages.ts +++ b/src/workers/0-Workerify/PostMessages.ts @@ -1,5 +1,5 @@ import type { Promisable } from 'type-fest'; -import type { IPromptDialogueOptions } from '../../components/Dialogues/interfaces/PromptDialogueOptions'; +import type { PromptDialogueOptions } from '../../components/Dialogues/interfaces/PromptDialogueOptions'; import type { TaskProgress } from '../../components/TaskInProgress/task/TaskProgress'; export type TransferableObject = any /* <-[0] */; @@ -46,5 +46,5 @@ export interface IMessageError { export interface IMessagePromptDialogue { type: 'PROMPT_DIALOGUE'; - promptOptions: IPromptDialogueOptions; + promptOptions: PromptDialogueOptions; } From 0b61a9dc2983839b6773b1ad6bd37dc8d74a9647 Mon Sep 17 00:00:00 2001 From: Pavol Hejny Date: Wed, 20 Sep 2023 16:41:04 +0200 Subject: [PATCH 09/20] Refactoring: Optimize imports Use type import for all interfaces --- config.ts | 2 +- .../generate-wallpapers-color-stats.ts | 2 +- .../generate-wallpapers-content.ts | 2 +- scripts/utils/execCommand/execCommand.ts | 2 +- .../execCommand/execCommandNormalizeOptions.ts | 2 +- .../forEachHardcodedWallpaper.ts | 2 +- .../hardcoded-wallpaper/getHardcodedWallpapers.ts | 2 +- src/ai/recommendation/pickMostRecommended.ts | 4 ++-- src/ai/recommendation/wallpaperToVector.ts | 4 ++-- .../wallpaperVectorsDistanceSquared.ts | 2 +- src/components/AiComponents/AiComponentsRoot.tsx | 2 +- .../RandomWallpaper/RandomWallpaperManager.ts | 4 ++-- .../RandomWallpaper/useRandomWallpaper.ts | 4 ++-- .../Dialogues/dialogues/promptDialogue.tsx | 2 +- src/components/Dialogues/queues/prompts.ts | 2 +- .../ExportPreviewModal/utils/ObjectUrl.ts | 2 +- src/components/Files/10-FilePreview.tsx | 2 +- src/components/Gallery/Gallery.tsx | 2 +- .../Gallery/GalleryFilter/GalleryFilterInput.tsx | 2 +- .../GalleryFilter/utils/filterWallpapers.tsx | 4 ++-- .../utils/parseKeywordsFromWallpaper.ts | 6 +++--- src/components/WallpaperLayout/WallpaperLayout.tsx | 2 +- src/export/exportAsHtml.tsx | 2 +- src/export/exportAsZip.tsx | 2 +- src/export/getWallpaperBaseFilename.ts | 6 +++--- src/export/utils/ObjectUrl.ts | 2 +- src/pages/[wallpaperId].tsx | 2 +- src/pages/api/random-wallpaper.ts | 14 ++++++-------- src/pages/api/recommend-wallpaper.ts | 4 ++-- src/pages/api/update-wallpaper-content.ts | 2 +- src/pages/gallery.tsx | 2 +- src/utils/IWallpaper.ts | 4 ++-- src/utils/addWallpaperComputables.ts | 2 +- src/utils/cdn/utils/generateWallpaperCdnKey.ts | 2 +- src/utils/color/operators/darken.ts | 2 +- src/utils/color/operators/furthest.ts | 2 +- src/utils/color/operators/grayscale.ts | 2 +- src/utils/color/operators/lighten.ts | 2 +- src/utils/color/operators/mixWithColor.ts | 2 +- src/utils/color/operators/nearest.ts | 2 +- src/utils/color/operators/withAlpha.ts | 2 +- src/utils/computeWallpaperUriid.ts | 2 +- src/utils/hooks/WallpapersContext.ts | 2 +- src/utils/hooks/useCurrentWallpaper.ts | 2 +- src/utils/hooks/useCurrentWallpaperFonts.ts | 2 +- src/utils/hooks/useLastSavedWallpaper.ts | 2 +- src/utils/hooks/useWallpaper.ts | 2 +- src/utils/hooks/useWallpaperSubject.ts | 2 +- src/utils/hydrateWallpaper.ts | 2 +- src/utils/hydrateWallpapers.ts | 2 +- src/utils/hydrateWallpapersCached.ts | 2 +- src/utils/image/Image.ts | 4 ++-- src/utils/image/createImageInBrowser.ts | 4 ++-- src/utils/image/createImageInNode.ts | 2 +- src/utils/image/createImageInWorker.ts | 5 ++--- .../image/palette/13/computeImagePalette13.ts.todo | 2 +- .../createColorfulComputeImageColorStats13.ts.todo | 4 ++-- .../image/palette/14/computeImagePalette14.ts | 4 ++-- .../14/createColorfulComputeImageColorStats14.ts | 6 +++--- .../image/palette/15/computeImagePalette15.ts | 4 ++-- .../15/createColorfulComputeImageColorStats15.ts | 6 +++--- src/utils/image/resizeImageBlob.ts | 2 +- src/utils/image/utils/IImageColorStats.ts | 2 +- src/utils/image/utils/colorDownscaleImage.ts | 6 +++--- src/utils/image/utils/computeImageAverageColor.ts | 4 ++-- src/utils/image/utils/computeImageDarkestColor.ts | 2 +- src/utils/image/utils/computeImageLightestColor.ts | 2 +- .../image/utils/computeImageMostFrequentColors.ts | 4 ++-- .../image/utils/computeImageMostGroupedColors.ts | 4 ++-- .../utils/computeImageMostSatulightedColors.ts | 4 ++-- src/utils/image/utils/countImagePixelsWithColor.ts | 2 +- src/utils/image/utils/getImageUniqueColors.ts | 4 ++-- src/utils/image/utils/hydrateColorStats.ts | 2 +- src/utils/image/utils/scaleImage.ts | 8 ++++---- src/utils/image/utils/serializeColorStats.ts | 2 +- src/utils/supabase/provideClientId.ts | 2 +- src/utils/svgPath/ISvgPath.ts | 2 +- src/utils/svgPath/parseSvgPath.ts | 7 +++---- src/utils/svgPath/stringifySvgPath.ts | 4 ++-- 79 files changed, 118 insertions(+), 122 deletions(-) diff --git a/config.ts b/config.ts index f87970127..0d23326bf 100644 --- a/config.ts +++ b/config.ts @@ -6,7 +6,7 @@ import { AspectRatioRange } from './src/utils/aspect-ratio/AspectRatioRange'; import { expectAspectRatioInRange } from './src/utils/aspect-ratio/expectAspectRatioInRange'; import { DigitalOceanSpaces } from './src/utils/cdn/classes/DigitalOceanSpaces'; import { createColorfulComputeImageColorStats15 } from './src/utils/image/palette/15/createColorfulComputeImageColorStats15'; -import { IComputeImageColorStats } from './src/utils/image/utils/IImageColorStats'; +import type { IComputeImageColorStats } from './src/utils/image/utils/IImageColorStats'; import { isRunningInBrowser } from './src/utils/isRunningInWhatever'; import { isPrivateNetwork } from './src/utils/validators/isPrivateNetwork'; import { validateUuid } from './src/utils/validators/validateUuid'; diff --git a/scripts/generate-wallpapers-color-stats/generate-wallpapers-color-stats.ts b/scripts/generate-wallpapers-color-stats/generate-wallpapers-color-stats.ts index d5be279da..a1b25c9b4 100644 --- a/scripts/generate-wallpapers-color-stats/generate-wallpapers-color-stats.ts +++ b/scripts/generate-wallpapers-color-stats/generate-wallpapers-color-stats.ts @@ -12,7 +12,7 @@ import YAML from 'yaml'; import { COLORSTATS_DEFAULT_COMPUTE_IN_SCRIPT, MIDJOURNEY_WHOLE_GALLERY_PATH } from '../../config'; import { createImageInNode } from '../../src/utils/image/createImageInNode'; import { serializeColorStats } from '../../src/utils/image/utils/serializeColorStats'; -import { IWallpaperMetadata } from '../../src/utils/IWallpaper'; +import type { IWallpaperMetadata } from '../../src/utils/IWallpaper'; import { commit } from '../utils/autocommit/commit'; import { isWorkingTreeClean } from '../utils/autocommit/isWorkingTreeClean'; import { forEachHardcodedWallpaper } from '../utils/hardcoded-wallpaper/forEachHardcodedWallpaper'; diff --git a/scripts/generate-wallpapers-content/generate-wallpapers-content.ts b/scripts/generate-wallpapers-content/generate-wallpapers-content.ts index 7fac253c4..394cc3455 100644 --- a/scripts/generate-wallpapers-content/generate-wallpapers-content.ts +++ b/scripts/generate-wallpapers-content/generate-wallpapers-content.ts @@ -11,7 +11,7 @@ import { spaceTrim } from 'spacetrim'; import { forTime } from 'waitasecond'; import { FONTS, OPENAI_API_KEY } from '../../config'; import { extractTitleFromContent } from '../../src/utils/content/extractTitleFromContent'; -import { IWallpaperMetadata } from '../../src/utils/IWallpaper'; +import type { IWallpaperMetadata } from '../../src/utils/IWallpaper'; import { randomItem } from '../../src/utils/randomItem'; import { commit } from '../utils/autocommit/commit'; import { isWorkingTreeClean } from '../utils/autocommit/isWorkingTreeClean'; diff --git a/scripts/utils/execCommand/execCommand.ts b/scripts/utils/execCommand/execCommand.ts index d0d90e599..f27e80109 100644 --- a/scripts/utils/execCommand/execCommand.ts +++ b/scripts/utils/execCommand/execCommand.ts @@ -3,7 +3,7 @@ import { spawn } from 'child_process'; import { spaceTrim } from 'spacetrim'; import { forTime } from 'waitasecond'; import { execCommandNormalizeOptions } from './execCommandNormalizeOptions'; -import { IExecCommandOptions } from './IExecCommandOptions'; +import type { IExecCommandOptions } from './IExecCommandOptions'; export function execCommand(options: IExecCommandOptions): Promise { return new Promise((resolve, reject) => { diff --git a/scripts/utils/execCommand/execCommandNormalizeOptions.ts b/scripts/utils/execCommand/execCommandNormalizeOptions.ts index 251743b68..0c30916ca 100644 --- a/scripts/utils/execCommand/execCommandNormalizeOptions.ts +++ b/scripts/utils/execCommand/execCommandNormalizeOptions.ts @@ -1,4 +1,4 @@ -import { IExecCommandOptions, IExecCommandOptionsAdvanced } from './IExecCommandOptions'; +import type { IExecCommandOptions, IExecCommandOptionsAdvanced } from './IExecCommandOptions'; export function execCommandNormalizeOptions(options: IExecCommandOptions): Pick< IExecCommandOptionsAdvanced, diff --git a/scripts/utils/hardcoded-wallpaper/forEachHardcodedWallpaper.ts b/scripts/utils/hardcoded-wallpaper/forEachHardcodedWallpaper.ts index 583af1071..996e632a2 100644 --- a/scripts/utils/hardcoded-wallpaper/forEachHardcodedWallpaper.ts +++ b/scripts/utils/hardcoded-wallpaper/forEachHardcodedWallpaper.ts @@ -3,7 +3,7 @@ import moment from 'moment'; import { COLORSTATS_DEFAULT_COMPUTE_IN_SCRIPT } from '../../../config'; import { forPlay } from '../forPlay'; import { getHardcodedWallpapersMetadataFilePaths } from './getHardcodedWallpapersMetadataFilePaths'; -import { IHardcodedWallpaperFiles } from './IHardcodedWallpaperFiles'; +import type { IHardcodedWallpaperFiles } from './IHardcodedWallpaperFiles'; /** * Executes a series of async tasks on hardcoded wallpapers diff --git a/scripts/utils/hardcoded-wallpaper/getHardcodedWallpapers.ts b/scripts/utils/hardcoded-wallpaper/getHardcodedWallpapers.ts index bfd82c1e2..7b9d6fbd5 100644 --- a/scripts/utils/hardcoded-wallpaper/getHardcodedWallpapers.ts +++ b/scripts/utils/hardcoded-wallpaper/getHardcodedWallpapers.ts @@ -11,7 +11,7 @@ import { import { parseKeywordsFromWallpaper } from '../../../src/components/Gallery/GalleryFilter/utils/parseKeywordsFromWallpaper'; import { FULLHD } from '../../../src/constants'; import { extractTitleFromContent } from '../../../src/utils/content/extractTitleFromContent'; -import { IWallpaperMetadata, IWallpaperSerialized } from '../../../src/utils/IWallpaper'; +import type { IWallpaperMetadata, IWallpaperSerialized } from '../../../src/utils/IWallpaper'; import type { string_file_path } from '../../../src/utils/typeAliases'; import { isFileExisting } from '../isFileExisting'; import { getHardcodedWallpapersMetadataFilePaths } from './getHardcodedWallpapersMetadataFilePaths'; diff --git a/src/ai/recommendation/pickMostRecommended.ts b/src/ai/recommendation/pickMostRecommended.ts index 6643c8b89..cc64cedb0 100644 --- a/src/ai/recommendation/pickMostRecommended.ts +++ b/src/ai/recommendation/pickMostRecommended.ts @@ -1,6 +1,6 @@ -import { IWallpaper } from '../../utils/IWallpaper'; +import type { IWallpaper } from '../../utils/IWallpaper'; import type { number_likeness } from '../../utils/typeAliases'; -import { IWallpaperVector } from './IWallpaperVector'; +import type { IWallpaperVector } from './IWallpaperVector'; import { wallpaperToVector } from './wallpaperToVector'; import { wallpaperVectorsDistanceSquared } from './wallpaperVectorsDistanceSquared'; diff --git a/src/ai/recommendation/wallpaperToVector.ts b/src/ai/recommendation/wallpaperToVector.ts index 1e4344865..76a80902c 100644 --- a/src/ai/recommendation/wallpaperToVector.ts +++ b/src/ai/recommendation/wallpaperToVector.ts @@ -1,5 +1,5 @@ -import { IWallpaper } from '../../utils/IWallpaper'; -import { IWallpaperVector } from './IWallpaperVector'; +import type { IWallpaper } from '../../utils/IWallpaper'; +import type { IWallpaperVector } from './IWallpaperVector'; export function wallpaperToVector(wallpaper: IWallpaper): IWallpaperVector { const { red, green, blue } = wallpaper.colorStats.palette[0]!.value; diff --git a/src/ai/recommendation/wallpaperVectorsDistanceSquared.ts b/src/ai/recommendation/wallpaperVectorsDistanceSquared.ts index 68751f455..a06d485ab 100644 --- a/src/ai/recommendation/wallpaperVectorsDistanceSquared.ts +++ b/src/ai/recommendation/wallpaperVectorsDistanceSquared.ts @@ -1,4 +1,4 @@ -import { IWallpaperVector } from './IWallpaperVector'; +import type { IWallpaperVector } from './IWallpaperVector'; export function wallpaperVectorsDistanceSquared( wallpaperVector1: IWallpaperVector, diff --git a/src/components/AiComponents/AiComponentsRoot.tsx b/src/components/AiComponents/AiComponentsRoot.tsx index 0365f1c2d..86a1da853 100644 --- a/src/components/AiComponents/AiComponentsRoot.tsx +++ b/src/components/AiComponents/AiComponentsRoot.tsx @@ -3,7 +3,7 @@ import { useContext } from 'react'; import type { Promisable } from 'type-fest'; import { ExportContext } from '../../utils/hooks/ExportContext'; import type { string_css_class } from '../../utils/typeAliases'; -import { InlineScript } from '../InlineScript/InlineScript'; +import type { InlineScript } from '../InlineScript/InlineScript'; interface AiComponentsRootProps { /** diff --git a/src/components/ControlPanel/RandomWallpaper/RandomWallpaperManager.ts b/src/components/ControlPanel/RandomWallpaper/RandomWallpaperManager.ts index 1b83846fe..a90a088e5 100644 --- a/src/components/ControlPanel/RandomWallpaper/RandomWallpaperManager.ts +++ b/src/components/ControlPanel/RandomWallpaper/RandomWallpaperManager.ts @@ -1,8 +1,8 @@ import type { Promisable } from 'type-fest'; import { forAnimationFrame, forImmediate } from 'waitasecond'; -import { IS_DEVELOPMENT, NEXT_PUBLIC_URL } from '../../../../config'; +import type { IS_DEVELOPMENT, NEXT_PUBLIC_URL } from '../../../../config'; import type { RecommendWallpaperResponse } from '../../../pages/api/recommend-wallpaper'; -import { IWallpaperSerialized } from '../../../utils/IWallpaper'; +import type { IWallpaperSerialized } from '../../../utils/IWallpaper'; import { randomItem } from '../../../utils/randomItem'; import { provideClientIdWithoutVerification } from '../../../utils/supabase/provideClientIdWithoutVerification'; import type { string_wallpaper_id } from '../../../utils/typeAliases'; diff --git a/src/components/ControlPanel/RandomWallpaper/useRandomWallpaper.ts b/src/components/ControlPanel/RandomWallpaper/useRandomWallpaper.ts index 0e11639db..711d2ea89 100644 --- a/src/components/ControlPanel/RandomWallpaper/useRandomWallpaper.ts +++ b/src/components/ControlPanel/RandomWallpaper/useRandomWallpaper.ts @@ -1,7 +1,7 @@ import { useMemo } from 'react'; import { useCurrentWallpaperId } from '../../../utils/hooks/useCurrentWallpaperId'; import { usePromise } from '../../../utils/hooks/usePromise'; -import { IWallpaperInStorage, RandomWallpaperManager } from './RandomWallpaperManager'; +import type { IWallpaperInStorage, RandomWallpaperManager } from './RandomWallpaperManager'; export function useRandomWallpaper(): [ randomWallpaper: IWallpaperInStorage | null, @@ -17,7 +17,7 @@ export function useRandomWallpaper(): [ ); const { value: recommendedWallpaper } = usePromise(randomWallpaperPromise); - console.info(`🎲 Use recommended wallpaper`, {recommendedWallpaper}); + console.info(`🎲 Use recommended wallpaper`, { recommendedWallpaper }); return [ recommendedWallpaper || null, diff --git a/src/components/Dialogues/dialogues/promptDialogue.tsx b/src/components/Dialogues/dialogues/promptDialogue.tsx index ca902b137..57f3097c3 100644 --- a/src/components/Dialogues/dialogues/promptDialogue.tsx +++ b/src/components/Dialogues/dialogues/promptDialogue.tsx @@ -1,6 +1,6 @@ import { forTime } from 'waitasecond'; import { isRunningInWebWorker } from '../../../utils/isRunningInWhatever'; -import { IMessageMainToWorker, IMessagePromptDialogue } from '../../../workers/0-Workerify/PostMessages'; +import type { IMessageMainToWorker, IMessagePromptDialogue } from '../../../workers/0-Workerify/PostMessages'; import type { PromptDialogueOptions } from '../interfaces/PromptDialogueOptions'; import type { PromptInQueue } from '../interfaces/PromptInQueue'; import { isDialoguesRendered } from '../locks/Dialogues.lock'; diff --git a/src/components/Dialogues/queues/prompts.ts b/src/components/Dialogues/queues/prompts.ts index 8f8e4863e..d7cc3a580 100644 --- a/src/components/Dialogues/queues/prompts.ts +++ b/src/components/Dialogues/queues/prompts.ts @@ -1,4 +1,4 @@ -import { IPromptInQueue } from "../dialogues/promptDialogue"; +import type { IPromptInQueue } from '../dialogues/promptDialogue'; /** * Queue of prompt dialogues that are waiting for an answer diff --git a/src/components/ExportPreviewModal/utils/ObjectUrl.ts b/src/components/ExportPreviewModal/utils/ObjectUrl.ts index 49ecb95ac..e613c7b55 100644 --- a/src/components/ExportPreviewModal/utils/ObjectUrl.ts +++ b/src/components/ExportPreviewModal/utils/ObjectUrl.ts @@ -1,4 +1,4 @@ -import { IDestroyable, ITeardownLogic, Registration } from 'destroyable'; +import type { IDestroyable, ITeardownLogic, Registration } from 'destroyable'; import type { string_mime_type, string_url } from '../../../utils/typeAliases'; /** diff --git a/src/components/Files/10-FilePreview.tsx b/src/components/Files/10-FilePreview.tsx index 8240308e6..9a23ad146 100644 --- a/src/components/Files/10-FilePreview.tsx +++ b/src/components/Files/10-FilePreview.tsx @@ -1,7 +1,7 @@ import MonacoEditor from '@monaco-editor/react'; import { HtmlExportFile } from '../../export/HtmlExportFile'; import styles from './00-FilesPreview.module.css'; -import { ImageFilePreview } from './20-ImageFilePreview'; +import type { ImageFilePreview } from './20-ImageFilePreview'; interface FilePreviewProps { /** diff --git a/src/components/Gallery/Gallery.tsx b/src/components/Gallery/Gallery.tsx index 29f2799c6..5e94a5d5e 100644 --- a/src/components/Gallery/Gallery.tsx +++ b/src/components/Gallery/Gallery.tsx @@ -4,7 +4,7 @@ import { useInitial } from '../../utils/hooks/useInitial'; import { WallpapersContext } from '../../utils/hooks/WallpapersContext'; import styles from './Gallery.module.css'; import { GalleryFilterInput } from './GalleryFilter/GalleryFilterInput'; -import { IGalleryFilter } from './GalleryFilter/IGalleryFilter'; +import type { IGalleryFilter } from './GalleryFilter/IGalleryFilter'; import { filterWallpapers } from './GalleryFilter/utils/filterWallpapers'; /** diff --git a/src/components/Gallery/GalleryFilter/GalleryFilterInput.tsx b/src/components/Gallery/GalleryFilter/GalleryFilterInput.tsx index ac3a5ed92..86d7c073e 100644 --- a/src/components/Gallery/GalleryFilter/GalleryFilterInput.tsx +++ b/src/components/Gallery/GalleryFilter/GalleryFilterInput.tsx @@ -7,7 +7,7 @@ import { ColorInput } from '../../ColorPreview/ColorInput/ColorInput'; import { MarkdownContent } from '../../MarkdownContent/MarkdownContent'; import { Select } from '../../Select/Select'; import styles from './GalleryFilterInput.module.css'; -import { IGalleryFilter, Order } from './IGalleryFilter'; +import type { IGalleryFilter, Order } from './IGalleryFilter'; interface GalleryFilterProps { /** diff --git a/src/components/Gallery/GalleryFilter/utils/filterWallpapers.tsx b/src/components/Gallery/GalleryFilter/utils/filterWallpapers.tsx index 871aa07d5..8b3871c07 100644 --- a/src/components/Gallery/GalleryFilter/utils/filterWallpapers.tsx +++ b/src/components/Gallery/GalleryFilter/utils/filterWallpapers.tsx @@ -2,8 +2,8 @@ import { parseKeywordsFromString } from 'n12'; import { DIFFERENT_COLOR_DISTANCE_THEASHOLD_RATIO } from '../../../../../config'; import { Color } from '../../../../utils/color/Color'; import { colorDistanceSquared } from '../../../../utils/color/utils/colorDistance'; -import { IWallpaper } from '../../../../utils/IWallpaper'; -import { IGalleryFilter } from '../IGalleryFilter'; +import type { IWallpaper } from '../../../../utils/IWallpaper'; +import type { IGalleryFilter } from '../IGalleryFilter'; export function filterWallpapers( wallpapers: Array, diff --git a/src/components/Gallery/GalleryFilter/utils/parseKeywordsFromWallpaper.ts b/src/components/Gallery/GalleryFilter/utils/parseKeywordsFromWallpaper.ts index d8cbea737..3cf474c97 100644 --- a/src/components/Gallery/GalleryFilter/utils/parseKeywordsFromWallpaper.ts +++ b/src/components/Gallery/GalleryFilter/utils/parseKeywordsFromWallpaper.ts @@ -1,7 +1,7 @@ -import { IKeywords, parseKeywords } from 'n12'; -import { IWallpaper } from '../../../../utils/IWallpaper'; +import type { IKeywords, parseKeywords } from 'n12'; +import type { IWallpaper } from '../../../../utils/IWallpaper'; -export function parseKeywordsFromWallpaper(wallpaper: Pick): IKeywords { +export function parseKeywordsFromWallpaper(wallpaper: Pick): IKeywords { const { prompt, content } = wallpaper; return parseKeywords({ prompt, content }); } diff --git a/src/components/WallpaperLayout/WallpaperLayout.tsx b/src/components/WallpaperLayout/WallpaperLayout.tsx index 0e1cd3674..52299b2d8 100644 --- a/src/components/WallpaperLayout/WallpaperLayout.tsx +++ b/src/components/WallpaperLayout/WallpaperLayout.tsx @@ -5,7 +5,7 @@ import { HeaderWallpaper } from '../../components/HeaderWallpaper/HeaderWallpape import { useCurrentWallpaperFonts } from '../../utils/hooks/useCurrentWallpaperFonts'; import { BackgroundPattern } from '../BackgroundPattern/BackgroundPattern'; import { FooterSection } from '../Footer/Footer'; -import { ImportFonts } from '../ImportFonts/ImportFonts'; +import type { ImportFonts } from '../ImportFonts/ImportFonts'; import { Menu } from '../Menu/Menu'; import { WallpaperContentSection } from '../WallpaperContent/WallpaperContent'; import styles from './WallpaperLayout.module.css'; diff --git a/src/export/exportAsHtml.tsx b/src/export/exportAsHtml.tsx index c9fde2b0b..1af4e6f59 100644 --- a/src/export/exportAsHtml.tsx +++ b/src/export/exportAsHtml.tsx @@ -14,7 +14,7 @@ import { removeContentComments } from '../utils/content/removeContentComments'; import { ExportContext } from '../utils/hooks/ExportContext'; import { parseFontsFromWallpaper } from '../utils/hooks/useCurrentWallpaperFonts'; import { WallpapersContext } from '../utils/hooks/WallpapersContext'; -import { IWallpaper } from '../utils/IWallpaper'; +import type { IWallpaper } from '../utils/IWallpaper'; import type { string_css, string_page } from '../utils/typeAliases'; import { HtmlExportFile } from './HtmlExportFile'; import { HtmlExportOptions } from './HtmlExportOptions'; diff --git a/src/export/exportAsZip.tsx b/src/export/exportAsZip.tsx index 29cdec9c0..c74784980 100644 --- a/src/export/exportAsZip.tsx +++ b/src/export/exportAsZip.tsx @@ -1,5 +1,5 @@ import JSZip from 'jszip'; -import { IWallpaper } from '../utils/IWallpaper'; +import type { IWallpaper } from '../utils/IWallpaper'; import { exportAsHtml } from './exportAsHtml'; import { getWallpaperBaseFilename } from './getWallpaperBaseFilename'; import { HtmlExportOptions } from './HtmlExportOptions'; diff --git a/src/export/getWallpaperBaseFilename.ts b/src/export/getWallpaperBaseFilename.ts index 774ff8ca7..a65613f74 100644 --- a/src/export/getWallpaperBaseFilename.ts +++ b/src/export/getWallpaperBaseFilename.ts @@ -1,10 +1,10 @@ import { normalizeToKebabCase } from 'n12'; -import { IWallpaper } from '../utils/IWallpaper'; +import type { IWallpaper } from '../utils/IWallpaper'; /** * Function that returns the base filename of a wallpaper - * - * + * + * * @param wallpaper - The wallpaper object. * @returns The base filename of the wallpaper. */ diff --git a/src/export/utils/ObjectUrl.ts b/src/export/utils/ObjectUrl.ts index 9eaeb861c..aad72c97b 100644 --- a/src/export/utils/ObjectUrl.ts +++ b/src/export/utils/ObjectUrl.ts @@ -1,4 +1,4 @@ -import { IDestroyable, ITeardownLogic, Registration } from 'destroyable'; +import type { IDestroyable, ITeardownLogic, Registration } from 'destroyable'; import type { string_url } from '../../utils/typeAliases'; /** diff --git a/src/pages/[wallpaperId].tsx b/src/pages/[wallpaperId].tsx index 3770f3b89..703e35bdf 100644 --- a/src/pages/[wallpaperId].tsx +++ b/src/pages/[wallpaperId].tsx @@ -9,7 +9,7 @@ import { WallpaperLayout } from '../components/WallpaperLayout/WallpaperLayout'; import { useRole } from '../utils/hooks/useRole'; import { WallpapersContext } from '../utils/hooks/WallpapersContext'; import { hydrateWallpapersCached } from '../utils/hydrateWallpapersCached'; -import { IWallpaperSerialized } from '../utils/IWallpaper'; +import type { IWallpaperSerialized } from '../utils/IWallpaper'; import { getSupabaseForServer } from '../utils/supabase/getSupabaseForServer'; import type { string_wallpaper_id } from '../utils/typeAliases'; import { validateUuid } from '../utils/validators/validateUuid'; diff --git a/src/pages/api/random-wallpaper.ts b/src/pages/api/random-wallpaper.ts index 0bc402750..c206c4ba4 100644 --- a/src/pages/api/random-wallpaper.ts +++ b/src/pages/api/random-wallpaper.ts @@ -1,5 +1,5 @@ import type { NextApiRequest, NextApiResponse } from 'next'; -import { IWallpaperSerialized } from '../../utils/IWallpaper'; +import type { IWallpaperSerialized } from '../../utils/IWallpaper'; import { getSupabaseForServer } from '../../utils/supabase/getSupabaseForServer'; export interface RandomWallpaperResponse { @@ -17,11 +17,9 @@ export default async function randomWallpaperHandler( .limit(1) .single(); - return response - .status(200) - .json( - { - randomWallpaper: result.data, - } as any /* <- TODO: Remove any and replace by satisfies RandomWallpaperResponse*/, - ); + return response.status(200).json( + { + randomWallpaper: result.data, + } as any /* <- TODO: Remove any and replace by satisfies RandomWallpaperResponse*/, + ); } diff --git a/src/pages/api/recommend-wallpaper.ts b/src/pages/api/recommend-wallpaper.ts index 78e457cd0..e346dcad9 100644 --- a/src/pages/api/recommend-wallpaper.ts +++ b/src/pages/api/recommend-wallpaper.ts @@ -1,10 +1,10 @@ import type { NextApiRequest, NextApiResponse } from 'next'; -import { IS_DEVELOPMENT, NEXT_PUBLIC_DEBUG, NEXT_PUBLIC_URL } from '../../../config'; +import type { IS_DEVELOPMENT, NEXT_PUBLIC_DEBUG, NEXT_PUBLIC_URL } from '../../../config'; import { likedStatusToLikeness } from '../../ai/recommendation/likedStatusToLikeness'; import { pickMostRecommended } from '../../ai/recommendation/pickMostRecommended'; import type { LikedStatus } from '../../utils/hooks/useLikedStatusOfCurrentWallpaper'; import { hydrateWallpaper } from '../../utils/hydrateWallpaper'; -import { IWallpaper, IWallpaperSerialized } from '../../utils/IWallpaper'; +import type { IWallpaper, IWallpaperSerialized } from '../../utils/IWallpaper'; import { getSupabaseForServer } from '../../utils/supabase/getSupabaseForServer'; import type { number_likeness, string_url } from '../../utils/typeAliases'; import { isValidUuid } from '../../utils/validators/isValidUuid'; diff --git a/src/pages/api/update-wallpaper-content.ts b/src/pages/api/update-wallpaper-content.ts index ebd89ef51..44d5f8d56 100644 --- a/src/pages/api/update-wallpaper-content.ts +++ b/src/pages/api/update-wallpaper-content.ts @@ -2,7 +2,7 @@ import type { NextApiRequest, NextApiResponse } from 'next'; import { spaceTrim } from 'spacetrim'; import { ChatThread } from '../../ai/text-to-text/ChatThread'; import { removeQuotes } from '../../utils/content/removeQuotes'; -import { IWallpaperSerialized } from '../../utils/IWallpaper'; +import type { IWallpaperSerialized } from '../../utils/IWallpaper'; import type { string_prompt, uuid } from '../../utils/typeAliases'; import { isValidClientId } from '../../utils/validators/isValidClientId'; diff --git a/src/pages/gallery.tsx b/src/pages/gallery.tsx index 3491c378c..2fcfdafbc 100644 --- a/src/pages/gallery.tsx +++ b/src/pages/gallery.tsx @@ -7,7 +7,7 @@ import styles from '../styles/static.module.css' /* <- TODO: [🤶] Get rid of p import { classNames } from '../utils/classNames'; import { WallpapersContext } from '../utils/hooks/WallpapersContext'; import { hydrateWallpapers } from '../utils/hydrateWallpapers'; -import { IWallpaperSerialized } from '../utils/IWallpaper'; +import type { IWallpaperSerialized } from '../utils/IWallpaper'; interface GalleryPageProps { /** diff --git a/src/utils/IWallpaper.ts b/src/utils/IWallpaper.ts index 3865159fc..cec86c4fa 100644 --- a/src/utils/IWallpaper.ts +++ b/src/utils/IWallpaper.ts @@ -1,8 +1,8 @@ import { string_keyword } from 'n12'; import { Vector } from 'xyzt'; import { Json } from '../utils/supabase/types'; -import { IImageColorStats } from './image/utils/IImageColorStats'; -import { IMidjourneyJob } from './IMidjourneyJob'; +import type { IImageColorStats } from './image/utils/IImageColorStats'; +import type { IMidjourneyJob } from './IMidjourneyJob'; import { string_html, string_markdown, diff --git a/src/utils/addWallpaperComputables.ts b/src/utils/addWallpaperComputables.ts index 65b1a9d60..931828806 100644 --- a/src/utils/addWallpaperComputables.ts +++ b/src/utils/addWallpaperComputables.ts @@ -1,7 +1,7 @@ import { parseKeywordsFromWallpaper } from '../components/Gallery/GalleryFilter/utils/parseKeywordsFromWallpaper'; import { computeWallpaperUriid } from './computeWallpaperUriid'; import { extractTitleFromContent } from './content/extractTitleFromContent'; -import { IWallpaper } from './IWallpaper'; +import type { IWallpaper } from './IWallpaper'; /** * Populates the wallpaper with computable values if they are not present diff --git a/src/utils/cdn/utils/generateWallpaperCdnKey.ts b/src/utils/cdn/utils/generateWallpaperCdnKey.ts index 8e94230e1..c9d5a8e05 100644 --- a/src/utils/cdn/utils/generateWallpaperCdnKey.ts +++ b/src/utils/cdn/utils/generateWallpaperCdnKey.ts @@ -1,4 +1,4 @@ -import { IWallpaper } from '../../IWallpaper'; +import type { IWallpaper } from '../../IWallpaper'; import type { string_uri } from '../../typeAliases'; import { nameToSubfolderPath } from './nameToSubfolderPath'; diff --git a/src/utils/color/operators/darken.ts b/src/utils/color/operators/darken.ts index 3911d62f9..7efb43e4e 100644 --- a/src/utils/color/operators/darken.ts +++ b/src/utils/color/operators/darken.ts @@ -1,4 +1,4 @@ -import { IColorTransformer } from './IColorTransformer'; +import type { IColorTransformer } from './IColorTransformer'; import { lighten } from './lighten'; /** diff --git a/src/utils/color/operators/furthest.ts b/src/utils/color/operators/furthest.ts index 543215b63..e7691ee28 100644 --- a/src/utils/color/operators/furthest.ts +++ b/src/utils/color/operators/furthest.ts @@ -1,5 +1,5 @@ import { Color } from '../Color'; -import { IColorTransformer } from './IColorTransformer'; +import type { IColorTransformer } from './IColorTransformer'; import { nearest } from './nearest'; import { negative } from './negative'; diff --git a/src/utils/color/operators/grayscale.ts b/src/utils/color/operators/grayscale.ts index e2a7381a4..2f8ac1795 100644 --- a/src/utils/color/operators/grayscale.ts +++ b/src/utils/color/operators/grayscale.ts @@ -1,5 +1,5 @@ import { Color } from '../Color'; -import { IColorTransformer } from './IColorTransformer'; +import type { IColorTransformer } from './IColorTransformer'; /** * Makes color transformer which returns a grayscale version of the color diff --git a/src/utils/color/operators/lighten.ts b/src/utils/color/operators/lighten.ts index e555293a2..4390efeb2 100644 --- a/src/utils/color/operators/lighten.ts +++ b/src/utils/color/operators/lighten.ts @@ -2,7 +2,7 @@ import clamp from 'lodash/clamp'; /* <- TODO: Do we need here a lodash for just import { Color } from '../Color'; import { hslToRgb } from '../internal-utils/hslToRgb'; import { rgbToHsl } from '../internal-utils/rgbToHsl'; -import { IColorTransformer } from './IColorTransformer'; +import type { IColorTransformer } from './IColorTransformer'; /** * Makes color transformer which lighten the given color diff --git a/src/utils/color/operators/mixWithColor.ts b/src/utils/color/operators/mixWithColor.ts index dc8435977..dd1172186 100644 --- a/src/utils/color/operators/mixWithColor.ts +++ b/src/utils/color/operators/mixWithColor.ts @@ -1,5 +1,5 @@ import { Color } from '../Color'; -import { IColorTransformer } from './IColorTransformer'; +import type { IColorTransformer } from './IColorTransformer'; /** * Makes color transformer which returns a mix of two colors based on a ratio diff --git a/src/utils/color/operators/nearest.ts b/src/utils/color/operators/nearest.ts index dfe830a44..ba0a12494 100644 --- a/src/utils/color/operators/nearest.ts +++ b/src/utils/color/operators/nearest.ts @@ -1,6 +1,6 @@ import { Color } from '../Color'; import { colorDistanceSquared } from '../utils/colorDistance'; -import { IColorTransformer } from './IColorTransformer'; +import type { IColorTransformer } from './IColorTransformer'; /** * Makes color transformer which finds the nearest color from the given list diff --git a/src/utils/color/operators/withAlpha.ts b/src/utils/color/operators/withAlpha.ts index 15e0ec546..ddd3f50f1 100644 --- a/src/utils/color/operators/withAlpha.ts +++ b/src/utils/color/operators/withAlpha.ts @@ -1,5 +1,5 @@ import { Color } from '../Color'; -import { IColorTransformer } from './IColorTransformer'; +import type { IColorTransformer } from './IColorTransformer'; /** * Makes color transformer which sets alpha chanell to given color diff --git a/src/utils/computeWallpaperUriid.ts b/src/utils/computeWallpaperUriid.ts index 9036a098b..35aa4f86f 100644 --- a/src/utils/computeWallpaperUriid.ts +++ b/src/utils/computeWallpaperUriid.ts @@ -2,7 +2,7 @@ import { nameToUriParts } from 'n12'; import seedrandom from 'seedrandom'; import { extractTitleFromContent } from './content/extractTitleFromContent'; import { serializeColorStats } from './image/utils/serializeColorStats'; -import { IWallpaper } from './IWallpaper'; +import type { IWallpaper } from './IWallpaper'; import { randomString } from './randomString'; import type { string_uriid } from './typeAliases'; diff --git a/src/utils/hooks/WallpapersContext.ts b/src/utils/hooks/WallpapersContext.ts index db5ef3c4b..0d8f2fd8b 100644 --- a/src/utils/hooks/WallpapersContext.ts +++ b/src/utils/hooks/WallpapersContext.ts @@ -1,5 +1,5 @@ import { createContext } from 'react'; import { BehaviorSubject } from 'rxjs'; -import { IWallpaper } from '../IWallpaper'; +import type { IWallpaper } from '../IWallpaper'; export const WallpapersContext = createContext>>({}); diff --git a/src/utils/hooks/useCurrentWallpaper.ts b/src/utils/hooks/useCurrentWallpaper.ts index 2973fa3ef..f928cf1b2 100644 --- a/src/utils/hooks/useCurrentWallpaper.ts +++ b/src/utils/hooks/useCurrentWallpaper.ts @@ -1,5 +1,5 @@ import { extractTitleFromContent } from '../content/extractTitleFromContent'; -import { IWallpaper } from '../IWallpaper'; +import type { IWallpaper } from '../IWallpaper'; import { useCurrentWallpaperId } from './useCurrentWallpaperId'; import { useObservable } from './useObservable'; import { useWallpaperSubject } from './useWallpaperSubject'; diff --git a/src/utils/hooks/useCurrentWallpaperFonts.ts b/src/utils/hooks/useCurrentWallpaperFonts.ts index 5baa406d9..26e3258f3 100644 --- a/src/utils/hooks/useCurrentWallpaperFonts.ts +++ b/src/utils/hooks/useCurrentWallpaperFonts.ts @@ -1,5 +1,5 @@ import { extractFontsFromContent } from '../../components/ImportFonts/extractFontsFromContent'; -import { IWallpaper } from '../IWallpaper'; +import type { IWallpaper } from '../IWallpaper'; import type { string_font_family } from '../typeAliases'; import { useCurrentWallpaper } from './useCurrentWallpaper'; diff --git a/src/utils/hooks/useLastSavedWallpaper.ts b/src/utils/hooks/useLastSavedWallpaper.ts index 940652abe..0a080acbd 100644 --- a/src/utils/hooks/useLastSavedWallpaper.ts +++ b/src/utils/hooks/useLastSavedWallpaper.ts @@ -1,5 +1,5 @@ import { useMemo } from 'react'; -import { IWallpaper } from '../IWallpaper'; +import type { IWallpaper } from '../IWallpaper'; import { useCurrentWallpaperId } from './useCurrentWallpaperId'; import { useWallpaperSubject } from './useWallpaperSubject'; diff --git a/src/utils/hooks/useWallpaper.ts b/src/utils/hooks/useWallpaper.ts index 2973fa3ef..f928cf1b2 100644 --- a/src/utils/hooks/useWallpaper.ts +++ b/src/utils/hooks/useWallpaper.ts @@ -1,5 +1,5 @@ import { extractTitleFromContent } from '../content/extractTitleFromContent'; -import { IWallpaper } from '../IWallpaper'; +import type { IWallpaper } from '../IWallpaper'; import { useCurrentWallpaperId } from './useCurrentWallpaperId'; import { useObservable } from './useObservable'; import { useWallpaperSubject } from './useWallpaperSubject'; diff --git a/src/utils/hooks/useWallpaperSubject.ts b/src/utils/hooks/useWallpaperSubject.ts index ba7815877..09ed0b1d9 100644 --- a/src/utils/hooks/useWallpaperSubject.ts +++ b/src/utils/hooks/useWallpaperSubject.ts @@ -1,6 +1,6 @@ import { useContext } from 'react'; import { BehaviorSubject } from 'rxjs'; -import { IWallpaper } from '../IWallpaper'; +import type { IWallpaper } from '../IWallpaper'; import type { string_wallpaper_id } from '../typeAliases'; import { WallpapersContext } from './WallpapersContext'; diff --git a/src/utils/hydrateWallpaper.ts b/src/utils/hydrateWallpaper.ts index c72354d2d..3cc24ec00 100644 --- a/src/utils/hydrateWallpaper.ts +++ b/src/utils/hydrateWallpaper.ts @@ -1,7 +1,7 @@ import { Vector } from 'xyzt'; import { hydrateColorStats } from './image/utils/hydrateColorStats'; import { serializeColorStats } from './image/utils/serializeColorStats'; -import { IWallpaper, IWallpaperSerialized } from './IWallpaper'; +import type { IWallpaper, IWallpaperSerialized } from './IWallpaper'; export function hydrateWallpaper(json: IWallpaperSerialized): IWallpaper { return { diff --git a/src/utils/hydrateWallpapers.ts b/src/utils/hydrateWallpapers.ts index 46cd9d99f..5ef00a83f 100644 --- a/src/utils/hydrateWallpapers.ts +++ b/src/utils/hydrateWallpapers.ts @@ -1,6 +1,6 @@ import { BehaviorSubject } from 'rxjs'; import { hydrateWallpaper } from './hydrateWallpaper'; -import { IWallpaper, IWallpaperSerialized } from './IWallpaper'; +import type { IWallpaper, IWallpaperSerialized } from './IWallpaper'; import type { string_wallpaper_id } from './typeAliases'; export function hydrateWallpapers( diff --git a/src/utils/hydrateWallpapersCached.ts b/src/utils/hydrateWallpapersCached.ts index 39118d962..28f21ce3a 100644 --- a/src/utils/hydrateWallpapersCached.ts +++ b/src/utils/hydrateWallpapersCached.ts @@ -1,6 +1,6 @@ import { BehaviorSubject } from 'rxjs'; import { hydrateWallpaper } from './hydrateWallpaper'; -import { IWallpaper, IWallpaperSerialized } from './IWallpaper'; +import type { IWallpaper, IWallpaperSerialized } from './IWallpaper'; import type { string_wallpaper_id } from './typeAliases'; /** diff --git a/src/utils/image/Image.ts b/src/utils/image/Image.ts index ba44eb454..4388995f7 100644 --- a/src/utils/image/Image.ts +++ b/src/utils/image/Image.ts @@ -1,9 +1,9 @@ import { spaceTrim } from 'spacetrim'; -import { IVector, Vector } from 'xyzt'; +import type { IVector, Vector } from 'xyzt'; import { Color } from '../color/Color'; import type { WithTake } from '../take/interfaces/ITakeChain'; import { take } from '../take/take'; -import { IImage } from './IImage'; +import type { IImage } from './IImage'; import { checkSizeValue } from './internal-utils/checkSizeValue'; /** diff --git a/src/utils/image/createImageInBrowser.ts b/src/utils/image/createImageInBrowser.ts index 574455894..4726d035f 100644 --- a/src/utils/image/createImageInBrowser.ts +++ b/src/utils/image/createImageInBrowser.ts @@ -1,8 +1,8 @@ import { Color } from '../color/Color'; import { forARest } from '../forARest'; import type { string_url } from '../typeAliases'; -import { IComputeColorstatsWork } from './IComputeColorstatsWork'; -import { Image as MyImage } from './Image'; +import type { IComputeColorstatsWork } from './IComputeColorstatsWork'; +import type { Image as MyImage } from './Image'; /** * Create new Image in the browser diff --git a/src/utils/image/createImageInNode.ts b/src/utils/image/createImageInNode.ts index 0008879f9..e30a34ef8 100644 --- a/src/utils/image/createImageInNode.ts +++ b/src/utils/image/createImageInNode.ts @@ -1,6 +1,6 @@ import jimp from 'jimp'; import { Color } from '../color/Color'; -import { Image } from './Image'; +import type { Image } from './Image'; /** * Create new Image in Node.js from local file diff --git a/src/utils/image/createImageInWorker.ts b/src/utils/image/createImageInWorker.ts index 3386c0dea..1057633a6 100644 --- a/src/utils/image/createImageInWorker.ts +++ b/src/utils/image/createImageInWorker.ts @@ -1,8 +1,7 @@ import { Color } from '../color/Color'; import { forARest } from '../forARest'; -import { IComputeColorstatsWork } from './IComputeColorstatsWork'; -import { Image as MyImage } from './Image'; - +import type { IComputeColorstatsWork } from './IComputeColorstatsWork'; +import type { Image as MyImage } from './Image'; /** * Create new Image from Blob in the browser or worker diff --git a/src/utils/image/palette/13/computeImagePalette13.ts.todo b/src/utils/image/palette/13/computeImagePalette13.ts.todo index ca5e332f5..34ef28870 100644 --- a/src/utils/image/palette/13/computeImagePalette13.ts.todo +++ b/src/utils/image/palette/13/computeImagePalette13.ts.todo @@ -10,7 +10,7 @@ import { areColorsEqual } from '../../../color/utils/areColorsEqual'; import { colorDistanceSquared } from '../../../color/utils/colorDistance'; import { colorHueDistance } from '../../../color/utils/colorHueDistance'; import type { WithTake } from '../../../take/interfaces/ITakeChain'; -import { IImageColorStatsAdvanced } from '../../utils/IImageColorStats'; +import type { IImageColorStatsAdvanced } from '../../utils/IImageColorStats'; let totalCount = 0; let pickByMostFrequentColorCount = 0; diff --git a/src/utils/image/palette/13/createColorfulComputeImageColorStats13.ts.todo b/src/utils/image/palette/13/createColorfulComputeImageColorStats13.ts.todo index c961a817b..a58eb9f83 100644 --- a/src/utils/image/palette/13/createColorfulComputeImageColorStats13.ts.todo +++ b/src/utils/image/palette/13/createColorfulComputeImageColorStats13.ts.todo @@ -1,5 +1,5 @@ -import { IVector, Vector } from 'xyzt'; -import { IImage } from '../../IImage'; +import type { IVector, Vector } from 'xyzt'; +import type { IImage } from '../../IImage'; import { colorDownscaleImage } from '../../utils/colorDownscaleImage'; import { computeImageAverageColor } from '../../utils/computeImageAverageColor'; import { computeImageDarkestColor } from '../../utils/computeImageDarkestColor'; diff --git a/src/utils/image/palette/14/computeImagePalette14.ts b/src/utils/image/palette/14/computeImagePalette14.ts index 188129b43..ba99a1019 100644 --- a/src/utils/image/palette/14/computeImagePalette14.ts +++ b/src/utils/image/palette/14/computeImagePalette14.ts @@ -13,8 +13,8 @@ import { colorHueDistance } from '../../../color/utils/colorHueDistance'; import { forARest } from '../../../forARest'; import { getOrderString } from '../../../getOrderString'; import type { WithTake } from '../../../take/interfaces/ITakeChain'; -import { IComputeColorstatsWork } from '../../IComputeColorstatsWork'; -import { IImageColorStatsAdvanced } from '../../utils/IImageColorStats'; +import type { IComputeColorstatsWork } from '../../IComputeColorstatsWork'; +import type { IImageColorStatsAdvanced } from '../../utils/IImageColorStats'; let totalCount = 0; let pickByMostFrequentColorCount = 0; diff --git a/src/utils/image/palette/14/createColorfulComputeImageColorStats14.ts b/src/utils/image/palette/14/createColorfulComputeImageColorStats14.ts index 3c21cfbb3..4ab7f1d19 100644 --- a/src/utils/image/palette/14/createColorfulComputeImageColorStats14.ts +++ b/src/utils/image/palette/14/createColorfulComputeImageColorStats14.ts @@ -1,8 +1,8 @@ -import { IVector, Vector } from 'xyzt'; +import type { IVector, Vector } from 'xyzt'; import { forARest } from '../../../forARest'; import { take } from '../../../take/take'; -import { IComputeColorstatsWork } from '../../IComputeColorstatsWork'; -import { IImage } from '../../IImage'; +import type { IComputeColorstatsWork } from '../../IComputeColorstatsWork'; +import type { IImage } from '../../IImage'; import { colorDownscaleImage } from '../../utils/colorDownscaleImage'; import { computeImageAverageColor } from '../../utils/computeImageAverageColor'; import { computeImageDarkestColor } from '../../utils/computeImageDarkestColor'; diff --git a/src/utils/image/palette/15/computeImagePalette15.ts b/src/utils/image/palette/15/computeImagePalette15.ts index 50a7fbaab..057ccc510 100644 --- a/src/utils/image/palette/15/computeImagePalette15.ts +++ b/src/utils/image/palette/15/computeImagePalette15.ts @@ -13,8 +13,8 @@ import { colorHueDistance } from '../../../color/utils/colorHueDistance'; import { forARest } from '../../../forARest'; import { getOrderString } from '../../../getOrderString'; import type { WithTake } from '../../../take/interfaces/ITakeChain'; -import { IComputeColorstatsWork } from '../../IComputeColorstatsWork'; -import { IImageColorStatsAdvanced } from '../../utils/IImageColorStats'; +import type { IComputeColorstatsWork } from '../../IComputeColorstatsWork'; +import type { IImageColorStatsAdvanced } from '../../utils/IImageColorStats'; export async function computeImagePalette15( colorStats: Omit, 'version' | 'palette' | 'paletteCandidates'>, diff --git a/src/utils/image/palette/15/createColorfulComputeImageColorStats15.ts b/src/utils/image/palette/15/createColorfulComputeImageColorStats15.ts index 87b70c547..581f2f25f 100644 --- a/src/utils/image/palette/15/createColorfulComputeImageColorStats15.ts +++ b/src/utils/image/palette/15/createColorfulComputeImageColorStats15.ts @@ -1,10 +1,10 @@ import type { Promisable } from 'type-fest'; -import { IVector, Vector } from 'xyzt'; +import type { IVector, Vector } from 'xyzt'; import type { TaskProgress } from '../../../../components/TaskInProgress/task/TaskProgress'; import { forARest } from '../../../forARest'; import { take } from '../../../take/take'; -import { IComputeColorstatsWork } from '../../IComputeColorstatsWork'; -import { IImage } from '../../IImage'; +import type { IComputeColorstatsWork } from '../../IComputeColorstatsWork'; +import type { IImage } from '../../IImage'; import { colorDownscaleImage } from '../../utils/colorDownscaleImage'; import { computeImageAverageColor } from '../../utils/computeImageAverageColor'; import { computeImageDarkestColor } from '../../utils/computeImageDarkestColor'; diff --git a/src/utils/image/resizeImageBlob.ts b/src/utils/image/resizeImageBlob.ts index bcb01da70..a679e45ef 100644 --- a/src/utils/image/resizeImageBlob.ts +++ b/src/utils/image/resizeImageBlob.ts @@ -1,4 +1,4 @@ -import { IVector } from 'xyzt'; +import type { IVector } from 'xyzt'; /** * Resizes an image to a new size diff --git a/src/utils/image/utils/IImageColorStats.ts b/src/utils/image/utils/IImageColorStats.ts index a9e72b1d9..3575a024b 100644 --- a/src/utils/image/utils/IImageColorStats.ts +++ b/src/utils/image/utils/IImageColorStats.ts @@ -4,7 +4,7 @@ import type { TaskProgress } from '../../../components/TaskInProgress/task/TaskP import { Color } from '../../color/Color'; import type { WithTake } from '../../take/interfaces/ITakeChain'; import type { number_integer, number_percent } from '../../typeAliases'; -import { IImage } from '../IImage'; +import type { IImage } from '../IImage'; interface IComputeImageColorStatsProgress { total: number_integer; diff --git a/src/utils/image/utils/colorDownscaleImage.ts b/src/utils/image/utils/colorDownscaleImage.ts index 595872ff5..03a318a2c 100644 --- a/src/utils/image/utils/colorDownscaleImage.ts +++ b/src/utils/image/utils/colorDownscaleImage.ts @@ -1,8 +1,8 @@ import { Color } from '../../color/Color'; import { forARest } from '../../forARest'; -import { IComputeColorstatsWork } from '../IComputeColorstatsWork'; -import { IImage } from '../IImage'; -import { Image } from '../Image'; +import type { IComputeColorstatsWork } from '../IComputeColorstatsWork'; +import type { IImage } from '../IImage'; +import type { Image } from '../Image'; /** * Downscale the colors of an image diff --git a/src/utils/image/utils/computeImageAverageColor.ts b/src/utils/image/utils/computeImageAverageColor.ts index b59241815..5d52efaac 100644 --- a/src/utils/image/utils/computeImageAverageColor.ts +++ b/src/utils/image/utils/computeImageAverageColor.ts @@ -1,8 +1,8 @@ import { Color } from '../../color/Color'; import { forARest } from '../../forARest'; import type { WithTake } from '../../take/interfaces/ITakeChain'; -import { IComputeColorstatsWork } from '../IComputeColorstatsWork'; -import { IImage } from '../IImage'; +import type { IComputeColorstatsWork } from '../IComputeColorstatsWork'; +import type { IImage } from '../IImage'; /** * Computes the average color of an image diff --git a/src/utils/image/utils/computeImageDarkestColor.ts b/src/utils/image/utils/computeImageDarkestColor.ts index 2a66d119f..767102f78 100644 --- a/src/utils/image/utils/computeImageDarkestColor.ts +++ b/src/utils/image/utils/computeImageDarkestColor.ts @@ -1,7 +1,7 @@ import { Color } from '../../color/Color'; import { colorLuminance } from '../../color/utils/colorLuminance'; import type { WithTake } from '../../take/interfaces/ITakeChain'; -import { IImage } from '../IImage'; +import type { IImage } from '../IImage'; import { getImageUniqueColors } from './getImageUniqueColors'; /** diff --git a/src/utils/image/utils/computeImageLightestColor.ts b/src/utils/image/utils/computeImageLightestColor.ts index f15fdf431..4ad5a7f01 100644 --- a/src/utils/image/utils/computeImageLightestColor.ts +++ b/src/utils/image/utils/computeImageLightestColor.ts @@ -1,7 +1,7 @@ import { Color } from '../../color/Color'; import { colorLuminance } from '../../color/utils/colorLuminance'; import type { WithTake } from '../../take/interfaces/ITakeChain'; -import { IImage } from '../IImage'; +import type { IImage } from '../IImage'; import { getImageUniqueColors } from './getImageUniqueColors'; /** diff --git a/src/utils/image/utils/computeImageMostFrequentColors.ts b/src/utils/image/utils/computeImageMostFrequentColors.ts index ecd056317..632e56617 100644 --- a/src/utils/image/utils/computeImageMostFrequentColors.ts +++ b/src/utils/image/utils/computeImageMostFrequentColors.ts @@ -3,8 +3,8 @@ import { Color } from '../../color/Color'; import { colorDistanceSquared } from '../../color/utils/colorDistance'; import { forARest } from '../../forARest'; import type { WithTake } from '../../take/interfaces/ITakeChain'; -import { IComputeColorstatsWork } from '../IComputeColorstatsWork'; -import { IImage } from '../IImage'; +import type { IComputeColorstatsWork } from '../IComputeColorstatsWork'; +import type { IImage } from '../IImage'; /** * Computes the most frequent colors in an image diff --git a/src/utils/image/utils/computeImageMostGroupedColors.ts b/src/utils/image/utils/computeImageMostGroupedColors.ts index c395601d0..d8152cfc6 100644 --- a/src/utils/image/utils/computeImageMostGroupedColors.ts +++ b/src/utils/image/utils/computeImageMostGroupedColors.ts @@ -2,8 +2,8 @@ import { Color } from '../../color/Color'; import { areColorsEqual } from '../../color/utils/areColorsEqual'; import { forARest } from '../../forARest'; import type { WithTake } from '../../take/interfaces/ITakeChain'; -import { IComputeColorstatsWork } from '../IComputeColorstatsWork'; -import { IImage } from '../IImage'; +import type { IComputeColorstatsWork } from '../IComputeColorstatsWork'; +import type { IImage } from '../IImage'; /** * Computes the most grouped colors in an image diff --git a/src/utils/image/utils/computeImageMostSatulightedColors.ts b/src/utils/image/utils/computeImageMostSatulightedColors.ts index 08abc55e2..156472c49 100644 --- a/src/utils/image/utils/computeImageMostSatulightedColors.ts +++ b/src/utils/image/utils/computeImageMostSatulightedColors.ts @@ -9,8 +9,8 @@ import { colorHueDistance } from '../../color/utils/colorHueDistance'; import { colorSatulightion } from '../../color/utils/colorSatulightion'; import { forARest } from '../../forARest'; import type { WithTake } from '../../take/interfaces/ITakeChain'; -import { IComputeColorstatsWork } from '../IComputeColorstatsWork'; -import { IImage } from '../IImage'; +import type { IComputeColorstatsWork } from '../IComputeColorstatsWork'; +import type { IImage } from '../IImage'; import { getImageUniqueColors } from './getImageUniqueColors'; /** diff --git a/src/utils/image/utils/countImagePixelsWithColor.ts b/src/utils/image/utils/countImagePixelsWithColor.ts index be8b515de..782ec3187 100644 --- a/src/utils/image/utils/countImagePixelsWithColor.ts +++ b/src/utils/image/utils/countImagePixelsWithColor.ts @@ -1,6 +1,6 @@ import { Color } from '../../color/Color'; import { colorDistanceSquared } from '../../color/utils/colorDistance'; -import { IImage } from '../IImage'; +import type { IImage } from '../IImage'; /** * Counts the number of pixels in an image that have a specified color within a given tolerance diff --git a/src/utils/image/utils/getImageUniqueColors.ts b/src/utils/image/utils/getImageUniqueColors.ts index f064575af..dddc08a6c 100644 --- a/src/utils/image/utils/getImageUniqueColors.ts +++ b/src/utils/image/utils/getImageUniqueColors.ts @@ -1,8 +1,8 @@ import { Color, string_color } from '../../color/Color'; import { forARest } from '../../forARest'; import type { WithTake } from '../../take/interfaces/ITakeChain'; -import { IComputeColorstatsWork } from '../IComputeColorstatsWork'; -import { IImage } from '../IImage'; +import type { IComputeColorstatsWork } from '../IComputeColorstatsWork'; +import type { IImage } from '../IImage'; /** * Retrieves the unique colors from an image diff --git a/src/utils/image/utils/hydrateColorStats.ts b/src/utils/image/utils/hydrateColorStats.ts index e15484635..8e3058d5e 100644 --- a/src/utils/image/utils/hydrateColorStats.ts +++ b/src/utils/image/utils/hydrateColorStats.ts @@ -1,6 +1,6 @@ import { hydrateColors } from '../../color/utils/hydrateColors'; import { Json } from '../../supabase/types'; -import { IImageColorStats } from './IImageColorStats'; +import type { IImageColorStats } from './IImageColorStats'; export function hydrateColorStats(json: Json): IImageColorStats { const colorStats = hydrateColors(json); diff --git a/src/utils/image/utils/scaleImage.ts b/src/utils/image/utils/scaleImage.ts index 7a9c16bfc..26716de53 100644 --- a/src/utils/image/utils/scaleImage.ts +++ b/src/utils/image/utils/scaleImage.ts @@ -1,9 +1,9 @@ -import { IVector } from 'xyzt'; +import type { IVector } from 'xyzt'; import { Color } from '../../color/Color'; import { forARest } from '../../forARest'; -import { IComputeColorstatsWork } from '../IComputeColorstatsWork'; -import { IImage } from '../IImage'; -import { Image } from '../Image'; +import type { IComputeColorstatsWork } from '../IComputeColorstatsWork'; +import type { IImage } from '../IImage'; +import type { Image } from '../Image'; /** * Scales an image to a new size diff --git a/src/utils/image/utils/serializeColorStats.ts b/src/utils/image/utils/serializeColorStats.ts index e7fb467a4..894603f15 100644 --- a/src/utils/image/utils/serializeColorStats.ts +++ b/src/utils/image/utils/serializeColorStats.ts @@ -1,6 +1,6 @@ import { Json } from '../../supabase/types'; import { TakeChain } from '../../take/classes/TakeChain'; -import { IImageColorStats } from './IImageColorStats'; +import type { IImageColorStats } from './IImageColorStats'; export function serializeColorStats(colorStats: IImageColorStats): Json { return JSON.parse( diff --git a/src/utils/supabase/provideClientId.ts b/src/utils/supabase/provideClientId.ts index 979b3d8d8..0255deda6 100644 --- a/src/utils/supabase/provideClientId.ts +++ b/src/utils/supabase/provideClientId.ts @@ -1,5 +1,5 @@ import { promptDialogue } from '../../components/Dialogues/dialogues/promptDialogue'; -import { IsClientVerifiedResponse } from '../../pages/api/client/is-client-verified'; +import type { IsClientVerifiedResponse } from '../../pages/api/client/is-client-verified'; import type { uuid } from '../typeAliases'; import { isValidEmail } from '../validators/isValidEmail'; import { getSupabaseForBrowser } from './getSupabaseForBrowser'; diff --git a/src/utils/svgPath/ISvgPath.ts b/src/utils/svgPath/ISvgPath.ts index 7a44768b7..99517607d 100644 --- a/src/utils/svgPath/ISvgPath.ts +++ b/src/utils/svgPath/ISvgPath.ts @@ -1,4 +1,4 @@ -import { IVector } from 'xyzt'; +import type { IVector } from 'xyzt'; export type ISvgPath = Array; diff --git a/src/utils/svgPath/parseSvgPath.ts b/src/utils/svgPath/parseSvgPath.ts index 831013518..e06d066ca 100644 --- a/src/utils/svgPath/parseSvgPath.ts +++ b/src/utils/svgPath/parseSvgPath.ts @@ -1,14 +1,13 @@ import { Vector } from 'xyzt'; -import { ISvgPath } from './ISvgPath'; +import type { ISvgPath } from './ISvgPath'; /** * Parses a string that defines an SVG path and returns an array of ISvgPath objects - * + * * @param {string} pathDefinition - The string that defines the SVG path. * @returns {ISvgPath[]} An array of ISvgPath objects that represent the SVG path commands and positions. */ export function parseSvgPath(pathDefinition: string): ISvgPath { - return [ { command: 'M', @@ -27,4 +26,4 @@ export function parseSvgPath(pathDefinition: string): ISvgPath { /** * TODO: Implement - */ \ No newline at end of file + */ diff --git a/src/utils/svgPath/stringifySvgPath.ts b/src/utils/svgPath/stringifySvgPath.ts index 95d33aa17..711932ce8 100644 --- a/src/utils/svgPath/stringifySvgPath.ts +++ b/src/utils/svgPath/stringifySvgPath.ts @@ -1,5 +1,5 @@ -import { IVector, Vector } from 'xyzt'; -import { ISvgPath } from './ISvgPath'; +import type { IVector, Vector } from 'xyzt'; +import type { ISvgPath } from './ISvgPath'; interface IStringifySvgPathOptions { path: ISvgPath; From 63b3f2c8d2721471d9ed4dc256c3b0f01d1cbf1a Mon Sep 17 00:00:00 2001 From: Pavol Hejny Date: Wed, 20 Sep 2023 17:01:37 +0200 Subject: [PATCH 10/20] Make modal indipendent of wallpaper route --- src/components/ColorsModal/ColorsModal.tsx | 6 +-- src/components/Dialogues/Dialogues.tsx | 9 +++- .../EditContentModal/EditContentModal.tsx | 3 +- .../ExportCodeModal/ExportCodeModal.tsx | 3 +- src/components/ExportModal/ExportModal.tsx | 3 +- .../ExportPreviewModal/ExportPreviewModal.tsx | 3 +- src/components/Modal/00-Modal.tsx | 33 +++++++++--- src/components/Modal/10-CloseModalLink.tsx | 12 ----- src/components/Modal/10-OpenModalLink.tsx | 17 ------- .../WallpaperLink/OpenModalLink.tsx | 13 +++++ .../WallpaperLink/WallpaperLink.tsx | 44 +++------------- .../useCloseWallpaperModalHandler.tsx | 19 +++++++ .../WallpaperLink/useWallpaperLinkQuery.tsx | 51 +++++++++++++++++++ 13 files changed, 134 insertions(+), 82 deletions(-) delete mode 100644 src/components/Modal/10-CloseModalLink.tsx delete mode 100644 src/components/Modal/10-OpenModalLink.tsx create mode 100644 src/components/WallpaperLink/OpenModalLink.tsx create mode 100644 src/components/WallpaperLink/useCloseWallpaperModalHandler.tsx create mode 100644 src/components/WallpaperLink/useWallpaperLinkQuery.tsx diff --git a/src/components/ColorsModal/ColorsModal.tsx b/src/components/ColorsModal/ColorsModal.tsx index 29a3f5b67..3de890541 100644 --- a/src/components/ColorsModal/ColorsModal.tsx +++ b/src/components/ColorsModal/ColorsModal.tsx @@ -4,6 +4,7 @@ import { Color } from '../../utils/color/Color'; import { textColor } from '../../utils/color/operators/furthest'; import { useCurrentWallpaper } from '../../utils/hooks/useCurrentWallpaper'; import { Modal } from '../Modal/00-Modal'; +import { useCloseWallpaperModalHandler } from '../WallpaperLink/useCloseWallpaperModalHandler'; import styles from './ColorsModal.module.css'; import { ColorsModalColorAlgoritm } from './ColorsModalColorAlgoritm'; @@ -14,7 +15,7 @@ export function ColorsModal() { const [wallpaper, modifyWallpaper] = useCurrentWallpaper(); return ( - +
{wallpaper.src}
@@ -61,7 +62,6 @@ export function ColorsModal() { ); } - /** * TODO: [🦼] Use instead of - */ \ No newline at end of file + */ diff --git a/src/components/Dialogues/Dialogues.tsx b/src/components/Dialogues/Dialogues.tsx index 67ab6a863..16dd65320 100644 --- a/src/components/Dialogues/Dialogues.tsx +++ b/src/components/Dialogues/Dialogues.tsx @@ -58,7 +58,14 @@ export function Dialogues() { } return ( - + { + currentPromptInQueue.answer = null; + setCurrentPromptInQueue(null); + }} + >