From 258b587a1703fb95e5fc03faa98bd927d0971523 Mon Sep 17 00:00:00 2001 From: Alex Taing Date: Tue, 24 Oct 2023 13:05:31 -0400 Subject: [PATCH] rename to loadedstyles --- packages/studio-ui/src/hooks/useInjectUserStyles.tsx | 2 +- packages/studio-ui/src/store/models/StudioStore.ts | 4 ++-- .../{LoadingProgressSlice.ts => LoadedStylesSlice.ts} | 2 +- ...teLoadingProgressSlice.ts => createLoadedStylesSlice.ts} | 6 +++--- packages/studio-ui/src/store/useStudioStore.ts | 4 ++-- packages/studio-ui/src/utils/loadUserAssets.tsx | 2 +- 6 files changed, 10 insertions(+), 10 deletions(-) rename packages/studio-ui/src/store/models/slices/{LoadingProgressSlice.ts => LoadedStylesSlice.ts} (60%) rename packages/studio-ui/src/store/slices/{createLoadingProgressSlice.ts => createLoadedStylesSlice.ts} (52%) diff --git a/packages/studio-ui/src/hooks/useInjectUserStyles.tsx b/packages/studio-ui/src/hooks/useInjectUserStyles.tsx index b749f9a45..f4cf09f68 100644 --- a/packages/studio-ui/src/hooks/useInjectUserStyles.tsx +++ b/packages/studio-ui/src/hooks/useInjectUserStyles.tsx @@ -14,7 +14,7 @@ export default function useInjectUserStyles( iframeDocument: Document | undefined ) { const [userStyleImports, loadedStyles] = useStudioStore( - (store) => [getUserStyleImports(store), store.loadingProgress.loadedStyles], + (store) => [getUserStyleImports(store), store.loadedStyles.loadedStyles], isEqual ); diff --git a/packages/studio-ui/src/store/models/StudioStore.ts b/packages/studio-ui/src/store/models/StudioStore.ts index e8c3bf228..80507dafb 100644 --- a/packages/studio-ui/src/store/models/StudioStore.ts +++ b/packages/studio-ui/src/store/models/StudioStore.ts @@ -9,7 +9,7 @@ import SiteSettingSlice from "./slices/SiteSettingsSlice"; import StudioConfigSlice from "./slices/StudioConfigSlice"; import EnvDataSlice from "./slices/EnvDataSlice"; import GitDataSlice from "./slices/GitDataSlice"; -import LoadingProgressSlice from "./slices/LoadingProgressSlice"; +import LoadedStylesSlice from "./slices/LoadedStylesSlice"; /** * The overall shape of the Zustand store as the state manager for Studio. @@ -28,5 +28,5 @@ export type StudioStore = { envData: EnvDataSlice; gitData: GitDataSlice; accountContent: AccountContentSlice; - loadingProgress: LoadingProgressSlice; + loadedStyles: LoadedStylesSlice; }; diff --git a/packages/studio-ui/src/store/models/slices/LoadingProgressSlice.ts b/packages/studio-ui/src/store/models/slices/LoadedStylesSlice.ts similarity index 60% rename from packages/studio-ui/src/store/models/slices/LoadingProgressSlice.ts rename to packages/studio-ui/src/store/models/slices/LoadedStylesSlice.ts index 917ec6a0d..b980cd445 100644 --- a/packages/studio-ui/src/store/models/slices/LoadingProgressSlice.ts +++ b/packages/studio-ui/src/store/models/slices/LoadedStylesSlice.ts @@ -1,4 +1,4 @@ -export default interface LoadingProgressSlice { +export default interface LoadedStylesSlice { loadedStyles: Set; addLoadedStyle: (style: string) => void; } diff --git a/packages/studio-ui/src/store/slices/createLoadingProgressSlice.ts b/packages/studio-ui/src/store/slices/createLoadedStylesSlice.ts similarity index 52% rename from packages/studio-ui/src/store/slices/createLoadingProgressSlice.ts rename to packages/studio-ui/src/store/slices/createLoadedStylesSlice.ts index a50a3bb5f..09eecb53b 100644 --- a/packages/studio-ui/src/store/slices/createLoadingProgressSlice.ts +++ b/packages/studio-ui/src/store/slices/createLoadedStylesSlice.ts @@ -1,7 +1,7 @@ -import LoadingProgressSlice from "../models/slices/LoadingProgressSlice"; +import LoadedStylesSlice from "../models/slices/LoadedStylesSlice"; import { SliceCreator } from "../models/utils"; -const createLoadingProgressSlice: SliceCreator = ( +const createLoadedStylesSlice: SliceCreator = ( set ) => ({ loadedStyles: new Set(), @@ -12,4 +12,4 @@ const createLoadingProgressSlice: SliceCreator = ( }, }); -export default createLoadingProgressSlice; +export default createLoadedStylesSlice; diff --git a/packages/studio-ui/src/store/useStudioStore.ts b/packages/studio-ui/src/store/useStudioStore.ts index 07e22ef25..2381c6fd0 100644 --- a/packages/studio-ui/src/store/useStudioStore.ts +++ b/packages/studio-ui/src/store/useStudioStore.ts @@ -16,7 +16,7 @@ import createEnvDataSlice from "./slices/createEnvDataSlice"; import createGitDataSlice from "./slices/createGitDataSlice"; import createAccountContentSlice from "./slices/accountContent/createAccountContentSlice"; import createLayoutSlice from "./slices/createLayoutSlice"; -import createLoadingProgressSlice from "./slices/createLoadingProgressSlice"; +import createLoadedStylesSlice from "./slices/createLoadedStylesSlice"; enableMapSet(); @@ -53,7 +53,7 @@ const useStudioStore = create()( envData: lens(createEnvDataSlice), gitData: lens(createGitDataSlice), accountContent: lens(createAccountContentSlice), - loadingProgress: lens(createLoadingProgressSlice), + loadedStyles: lens(createLoadedStylesSlice), }; }) ) diff --git a/packages/studio-ui/src/utils/loadUserAssets.tsx b/packages/studio-ui/src/utils/loadUserAssets.tsx index 16a1a444e..3f4f9d3ee 100644 --- a/packages/studio-ui/src/utils/loadUserAssets.tsx +++ b/packages/studio-ui/src/utils/loadUserAssets.tsx @@ -42,7 +42,7 @@ export function loadComponents(): Promise[] { */ export function loadStyling(): Promise[] { const studioStore = useStudioStore.getState(); - const addLoadedStyle = studioStore.loadingProgress.addLoadedStyle; + const addLoadedStyle = studioStore.loadedStyles.addLoadedStyle; const pages = Object.values(studioStore.pages.pages); const layouts = Object.values(studioStore.layouts.layoutNameToLayoutState); const fileMetadatas = Object.values(