@prozilla-os/core 1.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +21 -0
- package/README.md +1 -0
- package/package.json +43 -0
- package/src/components/_utils/button/Button.module.css +25 -0
- package/src/components/_utils/button/Button.tsx +48 -0
- package/src/components/_utils/directory-list/DirectoryList.module.css +70 -0
- package/src/components/_utils/directory-list/DirectoryList.tsx +203 -0
- package/src/components/_utils/directory-list/ImagePreview.module.css +19 -0
- package/src/components/_utils/directory-list/ImagePreview.tsx +33 -0
- package/src/components/_utils/dropdown-button/DropdownButton.module.css +60 -0
- package/src/components/_utils/dropdown-button/DropdownButton.tsx +40 -0
- package/src/components/_utils/header-menu/HeaderMenu.module.css +8 -0
- package/src/components/_utils/header-menu/HeaderMenu.tsx +15 -0
- package/src/components/_utils/index.ts +10 -0
- package/src/components/_utils/interactable/Interactable.tsx +42 -0
- package/src/components/_utils/progress-bar/ProgressBar.module.css +20 -0
- package/src/components/_utils/progress-bar/ProgressBar.tsx +22 -0
- package/src/components/_utils/web-view/WebView.module.css +15 -0
- package/src/components/_utils/web-view/WebView.tsx +47 -0
- package/src/components/actions/Actions.module.css +281 -0
- package/src/components/actions/Actions.tsx +108 -0
- package/src/components/actions/actions/ClickAction.tsx +30 -0
- package/src/components/actions/actions/Divider.tsx +5 -0
- package/src/components/actions/actions/DropdownAction.tsx +50 -0
- package/src/components/actions/actions/RadioAction.tsx +50 -0
- package/src/components/actions/actions/TextDisplay.tsx +12 -0
- package/src/components/actions/actions/ToggleAction.tsx +31 -0
- package/src/components/actions/index.ts +7 -0
- package/src/components/desktop/Desktop.module.css +49 -0
- package/src/components/desktop/Desktop.tsx +199 -0
- package/src/components/index.ts +10 -0
- package/src/components/modals/ModalView.module.css +14 -0
- package/src/components/modals/ModalView.tsx +54 -0
- package/src/components/modals/ModalsView.module.css +4 -0
- package/src/components/modals/ModalsView.tsx +32 -0
- package/src/components/modals/_utils/WindowedModal.module.css +92 -0
- package/src/components/modals/_utils/WindowedModal.tsx +71 -0
- package/src/components/modals/dialog-box/DialogBox.module.css +27 -0
- package/src/components/modals/dialog-box/DialogBox.tsx +26 -0
- package/src/components/modals/file-selector/FileSelector.module.css +25 -0
- package/src/components/modals/file-selector/FileSelector.tsx +77 -0
- package/src/components/modals/index.ts +7 -0
- package/src/components/modals/share/Option.tsx +23 -0
- package/src/components/modals/share/Share.module.css +153 -0
- package/src/components/modals/share/Share.tsx +197 -0
- package/src/components/prozilla-os/ProzillaOS.module.css +14 -0
- package/src/components/prozilla-os/ProzillaOS.tsx +76 -0
- package/src/components/taskbar/Taskbar.module.css +218 -0
- package/src/components/taskbar/Taskbar.tsx +193 -0
- package/src/components/taskbar/app-icon/AppIcon.module.css +62 -0
- package/src/components/taskbar/app-icon/AppIcon.tsx +76 -0
- package/src/components/taskbar/indicators/Battery.module.css +32 -0
- package/src/components/taskbar/indicators/Battery.tsx +114 -0
- package/src/components/taskbar/indicators/Calendar.module.css +24 -0
- package/src/components/taskbar/indicators/Calendar.tsx +67 -0
- package/src/components/taskbar/indicators/Network.module.css +17 -0
- package/src/components/taskbar/indicators/Network.tsx +38 -0
- package/src/components/taskbar/indicators/Volume.module.css +17 -0
- package/src/components/taskbar/indicators/Volume.tsx +38 -0
- package/src/components/taskbar/indicators/index.ts +4 -0
- package/src/components/taskbar/menus/AppList.module.css +33 -0
- package/src/components/taskbar/menus/HomeMenu.module.css +47 -0
- package/src/components/taskbar/menus/HomeMenu.tsx +118 -0
- package/src/components/taskbar/menus/SearchMenu.module.css +68 -0
- package/src/components/taskbar/menus/SearchMenu.tsx +100 -0
- package/src/components/taskbar/menus/UtilMenu.module.css +41 -0
- package/src/components/taskbar/menus/UtilMenu.tsx +23 -0
- package/src/components/windows/WindowFallbackView.tsx +38 -0
- package/src/components/windows/WindowView.module.css +152 -0
- package/src/components/windows/WindowView.tsx +233 -0
- package/src/components/windows/WindowsView.tsx +89 -0
- package/src/constants/index.ts +3 -0
- package/src/constants/modals.const.ts +3 -0
- package/src/constants/themes.const.ts +8 -0
- package/src/constants/utils.const.ts +19 -0
- package/src/constants/virtualDrive.const.ts +20 -0
- package/src/features/_utils/array.utils.ts +14 -0
- package/src/features/_utils/browser.utils.ts +111 -0
- package/src/features/_utils/date.utils.ts +90 -0
- package/src/features/_utils/event.utils.ts +39 -0
- package/src/features/_utils/index.ts +8 -0
- package/src/features/_utils/math.utils.ts +18 -0
- package/src/features/_utils/number.utils.ts +3 -0
- package/src/features/_utils/string.utils.ts +31 -0
- package/src/features/_utils/time.utils.ts +13 -0
- package/src/features/actions/actionsManager.ts +7 -0
- package/src/features/index.ts +12 -0
- package/src/features/math/vector2.ts +75 -0
- package/src/features/modals/modal.ts +74 -0
- package/src/features/modals/modalsManager.ts +72 -0
- package/src/features/settings/settings.ts +109 -0
- package/src/features/settings/settingsManager.ts +31 -0
- package/src/features/storage/storageManager.ts +35 -0
- package/src/features/system/configs/app.tsx +60 -0
- package/src/features/system/configs/appsConfig.ts +60 -0
- package/src/features/system/configs/desktopConfig.ts +46 -0
- package/src/features/system/configs/index.ts +9 -0
- package/src/features/system/configs/miscConfig.ts +19 -0
- package/src/features/system/configs/modalsConfig.ts +28 -0
- package/src/features/system/configs/taskbarConfig.ts +19 -0
- package/src/features/system/configs/trackingConfig.ts +24 -0
- package/src/features/system/configs/virtualDriveConfig.ts +39 -0
- package/src/features/system/configs/windowsConfig.ts +34 -0
- package/src/features/system/systemManager.ts +68 -0
- package/src/features/tracking/trackingManager.ts +40 -0
- package/src/features/virtual-drive/file/index.ts +2 -0
- package/src/features/virtual-drive/file/virtualFile.ts +197 -0
- package/src/features/virtual-drive/file/virtualFileLink.ts +111 -0
- package/src/features/virtual-drive/folder/index.ts +2 -0
- package/src/features/virtual-drive/folder/virtualFolder.ts +388 -0
- package/src/features/virtual-drive/folder/virtualFolderLink.ts +148 -0
- package/src/features/virtual-drive/index.ts +3 -0
- package/src/features/virtual-drive/root/defaultData.ts +140 -0
- package/src/features/virtual-drive/root/virtualRoot.ts +244 -0
- package/src/features/virtual-drive/virtualBase.ts +191 -0
- package/src/features/windows/windowsManager.ts +244 -0
- package/src/features/z-index/zIndexGroup.ts +40 -0
- package/src/features/z-index/zIndexManager.ts +46 -0
- package/src/hooks/_utils/history.ts +50 -0
- package/src/hooks/_utils/index.ts +6 -0
- package/src/hooks/_utils/keyboard.ts +111 -0
- package/src/hooks/_utils/mouse.ts +32 -0
- package/src/hooks/_utils/outsideClick.tsx +33 -0
- package/src/hooks/_utils/screen.ts +61 -0
- package/src/hooks/_utils/scrollWithShadows.ts +138 -0
- package/src/hooks/apps/appFolder.ts +30 -0
- package/src/hooks/index.ts +9 -0
- package/src/hooks/modals/alert.tsx +34 -0
- package/src/hooks/modals/contextMenu.tsx +47 -0
- package/src/hooks/modals/index.ts +4 -0
- package/src/hooks/modals/modalsContext.ts +10 -0
- package/src/hooks/modals/modalsManagerContext.ts +10 -0
- package/src/hooks/modals/modalsManagerProvider.tsx +16 -0
- package/src/hooks/modals/modalsProvider.tsx +20 -0
- package/src/hooks/modals/windowedModal.ts +47 -0
- package/src/hooks/settings/settingsManagerContext.ts +10 -0
- package/src/hooks/settings/settingsManagerProvider.tsx +16 -0
- package/src/hooks/system/systemManagerContext.ts +8 -0
- package/src/hooks/system/systemManagerProvider.tsx +26 -0
- package/src/hooks/themes/themes.tsx +22 -0
- package/src/hooks/tracking/trackingManagerContext.ts +10 -0
- package/src/hooks/tracking/trackingManagerProvider.tsx +13 -0
- package/src/hooks/virtual-drive/virtualRootContext.ts +10 -0
- package/src/hooks/virtual-drive/virtualRootProvider.tsx +13 -0
- package/src/hooks/windows/windowsContext.ts +10 -0
- package/src/hooks/windows/windowsManagerContext.ts +10 -0
- package/src/hooks/windows/windowsManagerProvider.tsx +24 -0
- package/src/hooks/windows/windowsProvider.tsx +20 -0
- package/src/hooks/z-index/zIndex.ts +32 -0
- package/src/hooks/z-index/zIndexManagerContext.ts +10 -0
- package/src/hooks/z-index/zIndexManagerProvider.tsx +11 -0
- package/src/index.ts +5 -0
- package/src/styles/global/fonts.css +18 -0
- package/src/styles/global/scrollbar.css +29 -0
- package/src/styles/global/themes.css +67 -0
- package/src/styles/global/variables.css +92 -0
- package/src/styles/global.css +65 -0
- package/src/styles/index.ts +3 -0
- package/src/styles/utils.module.css +22 -0
- package/src/types/util.d.ts +3 -0
- package/src/types/vite-env.d.ts +1 -0
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { FC, useCallback } from "react";
|
|
2
|
+
import { useModalsManager } from "./modalsManagerContext";
|
|
3
|
+
import { ModalProps } from "../../components/modals/ModalView";
|
|
4
|
+
import { Modal } from "../../features/modals/modal";
|
|
5
|
+
import { Vector2 } from "../../features";
|
|
6
|
+
import { useSystemManager } from "../system/systemManagerContext";
|
|
7
|
+
|
|
8
|
+
interface OpenWindowedModalParams {
|
|
9
|
+
appId?: string;
|
|
10
|
+
iconUrl?: string;
|
|
11
|
+
title?: string;
|
|
12
|
+
size: Vector2;
|
|
13
|
+
Modal: Function;
|
|
14
|
+
single?: boolean;
|
|
15
|
+
fullscreen?: boolean;
|
|
16
|
+
}
|
|
17
|
+
type OpenWindowedModal = (params: OpenWindowedModalParams) => Modal;
|
|
18
|
+
|
|
19
|
+
export function useWindowedModal(): { openWindowedModal: OpenWindowedModal; } {
|
|
20
|
+
const { modalsConfig } = useSystemManager();
|
|
21
|
+
const modalsManager = useModalsManager();
|
|
22
|
+
|
|
23
|
+
const openWindowedModal = useCallback<OpenWindowedModal>(({ Modal: WindowedModal, ...params }) => {
|
|
24
|
+
const size = params.size ?? modalsConfig.defaultDialogSize;
|
|
25
|
+
let positionX = (window.innerWidth - size.x) / 4;
|
|
26
|
+
let positionY = (window.innerHeight - size.y) / 4;
|
|
27
|
+
|
|
28
|
+
if (modalsManager?.containerRef?.current) {
|
|
29
|
+
const containerRect = modalsManager.containerRef.current.getBoundingClientRect();
|
|
30
|
+
positionX -= containerRect.x / 2;
|
|
31
|
+
positionY -= containerRect.y / 2;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
const newModal = new Modal(WindowedModal as FC<ModalProps>)
|
|
35
|
+
.setPosition(new Vector2(positionX, positionY))
|
|
36
|
+
.setSize(size)
|
|
37
|
+
.setDismissible(false)
|
|
38
|
+
.setProps({ params });
|
|
39
|
+
|
|
40
|
+
const single = params.single ?? false;
|
|
41
|
+
|
|
42
|
+
modalsManager?.open(newModal, single);
|
|
43
|
+
return newModal;
|
|
44
|
+
}, [modalsManager]);
|
|
45
|
+
|
|
46
|
+
return { openWindowedModal };
|
|
47
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { createContext, useContext } from "react";
|
|
2
|
+
import { SettingsManager } from "../../features";
|
|
3
|
+
|
|
4
|
+
type SettingsManagerState = SettingsManager | undefined;
|
|
5
|
+
|
|
6
|
+
export const SettingsManagerContext = createContext<SettingsManagerState>(undefined);
|
|
7
|
+
|
|
8
|
+
export function useSettingsManager(): SettingsManagerState {
|
|
9
|
+
return useContext(SettingsManagerContext);
|
|
10
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { FC, ReactNode } from "react";
|
|
2
|
+
import { useVirtualRoot } from "../virtual-drive/virtualRootContext";
|
|
3
|
+
import { SettingsManagerContext } from "./settingsManagerContext";
|
|
4
|
+
import { SettingsManager } from "../../features";
|
|
5
|
+
|
|
6
|
+
export const SettingsManagerProvider: FC<{ children: ReactNode }> = ({ children }) => {
|
|
7
|
+
const virtualRoot = useVirtualRoot();
|
|
8
|
+
if (virtualRoot == null) throw new Error("SettingsManager is missing VirtualRoot");
|
|
9
|
+
const settingsManager = new SettingsManager(virtualRoot);
|
|
10
|
+
|
|
11
|
+
return (
|
|
12
|
+
<SettingsManagerContext.Provider value={settingsManager}>
|
|
13
|
+
{children}
|
|
14
|
+
</SettingsManagerContext.Provider>
|
|
15
|
+
);
|
|
16
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { createContext, useContext } from "react";
|
|
2
|
+
import { SystemManager } from "../../features/system/systemManager";
|
|
3
|
+
|
|
4
|
+
export const SystemManagerContext = createContext<SystemManager | undefined>(undefined);
|
|
5
|
+
|
|
6
|
+
export function useSystemManager(): SystemManager {
|
|
7
|
+
return useContext(SystemManagerContext) as SystemManager;
|
|
8
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { FC, ReactNode } from "react";
|
|
2
|
+
import { SystemManagerContext } from "./systemManagerContext";
|
|
3
|
+
import { SystemManager, SystemManagerParams } from "../../features/system/systemManager";
|
|
4
|
+
|
|
5
|
+
interface SystemManagerProviderProps {
|
|
6
|
+
systemName: SystemManagerParams["systemName"];
|
|
7
|
+
tagLine: SystemManagerParams["tagLine"];
|
|
8
|
+
appsConfig: SystemManagerParams["appsConfig"];
|
|
9
|
+
desktopConfig: SystemManagerParams["desktopConfig"];
|
|
10
|
+
miscConfig: SystemManagerParams["miscConfig"];
|
|
11
|
+
modalsConfig: SystemManagerParams["modalsConfig"];
|
|
12
|
+
taskbarConfig: SystemManagerParams["taskbarConfig"];
|
|
13
|
+
trackingConfig: SystemManagerParams["trackingConfig"];
|
|
14
|
+
windowsConfig: SystemManagerParams["windowsConfig"];
|
|
15
|
+
virtualDriveConfig: SystemManagerParams["virtualDriveConfig"];
|
|
16
|
+
children: ReactNode;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export const SystemManagerProvider: FC<SystemManagerProviderProps> = (props) => {
|
|
20
|
+
const { children, ...systemManagerParams } = props;
|
|
21
|
+
const systemManager = new SystemManager(systemManagerParams);
|
|
22
|
+
|
|
23
|
+
return <SystemManagerContext.Provider value={systemManager}>
|
|
24
|
+
{children}
|
|
25
|
+
</SystemManagerContext.Provider>;
|
|
26
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { ReactElement, useEffect, useState } from "react";
|
|
2
|
+
import { useSettingsManager } from "../settings/settingsManagerContext";
|
|
3
|
+
import { THEMES } from "../../constants/themes.const";
|
|
4
|
+
import { SettingsManager } from "../../features";
|
|
5
|
+
|
|
6
|
+
interface ThemeProviderProps {
|
|
7
|
+
children: ReactElement;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export function ThemeProvider({ children }: ThemeProviderProps): ReactElement {
|
|
11
|
+
const [theme, setTheme] = useState(0);
|
|
12
|
+
const settingsManager = useSettingsManager();
|
|
13
|
+
const themeSettings = settingsManager?.getSettings(SettingsManager.VIRTUAL_PATHS.theme);
|
|
14
|
+
|
|
15
|
+
useEffect(() => {
|
|
16
|
+
void themeSettings?.get("theme", (value: string) => { setTheme(parseInt(value) || 0); });
|
|
17
|
+
}, [themeSettings]);
|
|
18
|
+
|
|
19
|
+
return <div className={`${THEMES[theme ?? 0]}-theme`}>
|
|
20
|
+
{children}
|
|
21
|
+
</div>;
|
|
22
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { createContext, useContext } from "react";
|
|
2
|
+
import { TrackingManager } from "../../features";
|
|
3
|
+
|
|
4
|
+
type TrackingManagerState = TrackingManager | undefined;
|
|
5
|
+
|
|
6
|
+
export const TrackingManagerContext = createContext<TrackingManagerState>(undefined);
|
|
7
|
+
|
|
8
|
+
export function useTrackingManager(): TrackingManagerState {
|
|
9
|
+
return useContext(TrackingManagerContext);
|
|
10
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { FC, ReactNode } from "react";
|
|
2
|
+
import { TrackingManagerContext } from "./trackingManagerContext";
|
|
3
|
+
import { TrackingManager } from "../../features";
|
|
4
|
+
import { useSystemManager } from "../system/systemManagerContext";
|
|
5
|
+
|
|
6
|
+
export const TrackingManagerProvider: FC<{ children: ReactNode }> = ({ children }) => {
|
|
7
|
+
const systemManager = useSystemManager();
|
|
8
|
+
const trackingManager = new TrackingManager(systemManager).init();
|
|
9
|
+
|
|
10
|
+
return <TrackingManagerContext.Provider value={trackingManager}>
|
|
11
|
+
{children}
|
|
12
|
+
</TrackingManagerContext.Provider>;
|
|
13
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { createContext, useContext } from "react";
|
|
2
|
+
import { VirtualRoot } from "../../features/virtual-drive/root/virtualRoot";
|
|
3
|
+
|
|
4
|
+
type VirtualRootState = VirtualRoot | undefined;
|
|
5
|
+
|
|
6
|
+
export const VirtualRootContext = createContext<VirtualRootState>(undefined);
|
|
7
|
+
|
|
8
|
+
export function useVirtualRoot(): VirtualRootState {
|
|
9
|
+
return useContext(VirtualRootContext);
|
|
10
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { FC, ReactNode } from "react";
|
|
2
|
+
import { VirtualRootContext } from "./virtualRootContext";
|
|
3
|
+
import { VirtualRoot } from "../../features/virtual-drive/root/virtualRoot";
|
|
4
|
+
import { useSystemManager } from "../system/systemManagerContext";
|
|
5
|
+
|
|
6
|
+
export const VirtualRootProvider: FC<{ children: ReactNode }> = ({ children }) => {
|
|
7
|
+
const systemManager = useSystemManager();
|
|
8
|
+
const virtualRoot = new VirtualRoot(systemManager).init();
|
|
9
|
+
|
|
10
|
+
return <VirtualRootContext.Provider value={virtualRoot}>
|
|
11
|
+
{children}
|
|
12
|
+
</VirtualRootContext.Provider>;
|
|
13
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { createContext, useContext } from "react";
|
|
2
|
+
import { WindowProps } from "../../components/windows/WindowView";
|
|
3
|
+
|
|
4
|
+
export type WindowsState = WindowProps[] | undefined;
|
|
5
|
+
|
|
6
|
+
export const WindowsContext = createContext<WindowsState>(undefined);
|
|
7
|
+
|
|
8
|
+
export function useWindows(): WindowsState {
|
|
9
|
+
return useContext(WindowsContext);
|
|
10
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { createContext, useContext } from "react";
|
|
2
|
+
import { WindowsManager } from "../../features";
|
|
3
|
+
|
|
4
|
+
type WindowsManagerState = WindowsManager | undefined;
|
|
5
|
+
|
|
6
|
+
export const WindowsManagerContext = createContext<WindowsManagerState>(undefined);
|
|
7
|
+
|
|
8
|
+
export function useWindowsManager(): WindowsManagerState {
|
|
9
|
+
return useContext(WindowsManagerContext);
|
|
10
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { FC, ReactNode } from "react";
|
|
2
|
+
import { WindowsManagerContext } from "./windowsManagerContext";
|
|
3
|
+
import { WindowsProvider } from "./windowsProvider";
|
|
4
|
+
import { WindowsManager } from "../../features";
|
|
5
|
+
import { useSystemManager } from "../system/systemManagerContext";
|
|
6
|
+
import { useTrackingManager } from "../tracking/trackingManagerContext";
|
|
7
|
+
|
|
8
|
+
export const WindowsManagerProvider: FC<{ children: ReactNode }> = ({ children }) => {
|
|
9
|
+
const systemManager = useSystemManager();
|
|
10
|
+
const trackingManager = useTrackingManager();
|
|
11
|
+
|
|
12
|
+
if (trackingManager == null)
|
|
13
|
+
throw new Error("WindowsManager is missing TrackingManager");
|
|
14
|
+
|
|
15
|
+
const windowsManager = new WindowsManager(systemManager, trackingManager);
|
|
16
|
+
|
|
17
|
+
return (
|
|
18
|
+
<WindowsManagerContext.Provider value={windowsManager}>
|
|
19
|
+
<WindowsProvider windowsManager={windowsManager}>
|
|
20
|
+
{children}
|
|
21
|
+
</WindowsProvider>
|
|
22
|
+
</WindowsManagerContext.Provider>
|
|
23
|
+
);
|
|
24
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { FC, ReactNode, useCallback, useState } from "react";
|
|
2
|
+
import { WindowsContext, WindowsState } from "./windowsContext";
|
|
3
|
+
import { WindowProps } from "../../components/windows/WindowView";
|
|
4
|
+
import { WindowsManager } from "../../features";
|
|
5
|
+
|
|
6
|
+
export const WindowsProvider: FC<{ children: ReactNode, windowsManager: WindowsManager }> = ({ children, windowsManager }) => {
|
|
7
|
+
const [windows, setWindows] = useState<WindowsState>([]);
|
|
8
|
+
|
|
9
|
+
const updateWindows = useCallback((updatedWindows: Record<string, WindowProps>) => {
|
|
10
|
+
setWindows(Object.values(updatedWindows));
|
|
11
|
+
}, []);
|
|
12
|
+
|
|
13
|
+
windowsManager.setUpdateWindows(updateWindows);
|
|
14
|
+
|
|
15
|
+
return (
|
|
16
|
+
<WindowsContext.Provider value={windows}>
|
|
17
|
+
{children}
|
|
18
|
+
</WindowsContext.Provider>
|
|
19
|
+
);
|
|
20
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { useEffect, useState } from "react";
|
|
2
|
+
import { useZIndexManager } from "./zIndexManagerContext";
|
|
3
|
+
import { ZIndexManager } from "../../features";
|
|
4
|
+
|
|
5
|
+
interface UseZIndexParams {
|
|
6
|
+
groupIndex: number;
|
|
7
|
+
index: number;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export function useZIndex({ groupIndex, index }: UseZIndexParams) {
|
|
11
|
+
const initialIndex = (groupIndex * 10) + index;
|
|
12
|
+
const [zIndex, setZIndex] = useState(initialIndex);
|
|
13
|
+
const zIndexManager = useZIndexManager();
|
|
14
|
+
|
|
15
|
+
useEffect(() => {
|
|
16
|
+
const updateIndex = () => {
|
|
17
|
+
const newZIndex = zIndexManager?.getIndex(groupIndex, index);
|
|
18
|
+
|
|
19
|
+
if (newZIndex != null && zIndex !== newZIndex)
|
|
20
|
+
setZIndex(newZIndex);
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
updateIndex();
|
|
24
|
+
zIndexManager?.on(ZIndexManager.EVENT_NAMES.indexChange, updateIndex);
|
|
25
|
+
|
|
26
|
+
return () => {
|
|
27
|
+
zIndexManager?.off(ZIndexManager.EVENT_NAMES.indexChange, updateIndex);
|
|
28
|
+
};
|
|
29
|
+
}, [groupIndex, index, zIndex, zIndexManager]);
|
|
30
|
+
|
|
31
|
+
return zIndex;
|
|
32
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { createContext, useContext } from "react";
|
|
2
|
+
import { ZIndexManager } from "../../features";
|
|
3
|
+
|
|
4
|
+
type ZIndexManagerState = ZIndexManager | undefined;
|
|
5
|
+
|
|
6
|
+
export const ZIndexManagerContext = createContext<ZIndexManagerState>(undefined);
|
|
7
|
+
|
|
8
|
+
export function useZIndexManager(): ZIndexManagerState {
|
|
9
|
+
return useContext(ZIndexManagerContext);
|
|
10
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { FC, ReactNode } from "react";
|
|
2
|
+
import { ZIndexManagerContext } from "./zIndexManagerContext";
|
|
3
|
+
import { ZIndexManager } from "../../features";
|
|
4
|
+
|
|
5
|
+
export const ZIndexManagerProvider: FC<{ children: ReactNode }> = ({ children }) => {
|
|
6
|
+
const zIndexManager = new ZIndexManager();
|
|
7
|
+
|
|
8
|
+
return <ZIndexManagerContext.Provider value={zIndexManager}>
|
|
9
|
+
{children}
|
|
10
|
+
</ZIndexManagerContext.Provider>;
|
|
11
|
+
};
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
:root {
|
|
2
|
+
--body-font-family: "Outfit", -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
|
|
3
|
+
'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
|
|
4
|
+
--mono-font-family: "Roboto Mono", source-code-pro, Menlo, Monaco, Consolas, 'Courier New',
|
|
5
|
+
monospace;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
@font-face {
|
|
9
|
+
font-family: "Outfit";
|
|
10
|
+
src: url("/assets/fonts/outfit/Outfit-VariableFont_wght.ttf");
|
|
11
|
+
font-display: swap;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
@font-face {
|
|
15
|
+
font-family: "Roboto Mono";
|
|
16
|
+
src: url("/assets/fonts/roboto-mono/RobotoMono-VariableFont_wght.ttf");
|
|
17
|
+
font-display: swap;
|
|
18
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/* Firefox */
|
|
2
|
+
* {
|
|
3
|
+
scrollbar-color: var(--scrollbar-color) transparent;
|
|
4
|
+
scrollbar-width: thin;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
/* Chrome, Safari */
|
|
8
|
+
*::-webkit-scrollbar {
|
|
9
|
+
width: 1.25rem;
|
|
10
|
+
height: 1.25rem;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
*::-webkit-scrollbar-track {
|
|
14
|
+
background: none;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
*::-webkit-scrollbar-thumb {
|
|
18
|
+
border-radius: var(--border-radius-99);
|
|
19
|
+
border: 5px solid transparent;
|
|
20
|
+
background-color: var(--scrollbar-color);
|
|
21
|
+
background-clip: padding-box;
|
|
22
|
+
backdrop-filter: invert(100%);
|
|
23
|
+
transition: 200ms ease-in-out;
|
|
24
|
+
z-index: 1;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
*::-webkit-scrollbar-corner {
|
|
28
|
+
background-color: transparent;
|
|
29
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
.Light-theme {
|
|
2
|
+
--foreground-color-0: var(--black-3);
|
|
3
|
+
--foreground-color-1: var(--black-2);
|
|
4
|
+
--foreground-color-2: var(--black-1);
|
|
5
|
+
|
|
6
|
+
--background-color-0: var(--white-0);
|
|
7
|
+
--background-color-1: var(--white-0);
|
|
8
|
+
--background-color-2: var(--white-1);
|
|
9
|
+
--background-color-3: var(--white-1);
|
|
10
|
+
--background-color-4: var(--white-2);
|
|
11
|
+
|
|
12
|
+
--taskbar-color: var(--white-0);
|
|
13
|
+
--taskbar-menu-color: var(--white-0);
|
|
14
|
+
--taskbar-button-hover-color: rgba(0, 0, 0, 5%);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.Cherry-theme {
|
|
18
|
+
--background-color-0: var(--red-0);
|
|
19
|
+
--background-color-1: var(--red-0);
|
|
20
|
+
--background-color-2: var(--red-1);
|
|
21
|
+
--background-color-3: var(--red-1);
|
|
22
|
+
--background-color-4: var(--red-2);
|
|
23
|
+
|
|
24
|
+
--taskbar-color: var(--red-2);
|
|
25
|
+
--taskbar-menu-color: var(--red-1);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.Mango-theme {
|
|
29
|
+
--foreground-color-0: var(--black-3);
|
|
30
|
+
--foreground-color-1: var(--black-2);
|
|
31
|
+
--foreground-color-2: var(--black-1);
|
|
32
|
+
|
|
33
|
+
--background-color-0: var(--yellow-0);
|
|
34
|
+
--background-color-1: var(--yellow-0);
|
|
35
|
+
--background-color-2: var(--yellow-1);
|
|
36
|
+
--background-color-3: var(--yellow-1);
|
|
37
|
+
--background-color-4: var(--yellow-2);
|
|
38
|
+
|
|
39
|
+
--taskbar-color: var(--yellow-0);
|
|
40
|
+
--taskbar-menu-color: var(--yellow-0);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.Aqua-theme {
|
|
44
|
+
--foreground-color-0: var(--black-3);
|
|
45
|
+
--foreground-color-1: var(--black-2);
|
|
46
|
+
--foreground-color-2: var(--black-1);
|
|
47
|
+
|
|
48
|
+
--background-color-0: var(--cyan-0);
|
|
49
|
+
--background-color-1: var(--cyan-0);
|
|
50
|
+
--background-color-2: var(--cyan-1);
|
|
51
|
+
--background-color-3: var(--cyan-1);
|
|
52
|
+
--background-color-4: var(--cyan-2);
|
|
53
|
+
|
|
54
|
+
--taskbar-color: var(--cyan-0);
|
|
55
|
+
--taskbar-menu-color: var(--cyan-0);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
.Grape-theme {
|
|
59
|
+
--background-color-0: var(--purple-0);
|
|
60
|
+
--background-color-1: var(--purple-0);
|
|
61
|
+
--background-color-2: var(--purple-1);
|
|
62
|
+
--background-color-3: var(--purple-1);
|
|
63
|
+
--background-color-4: var(--purple-2);
|
|
64
|
+
|
|
65
|
+
--taskbar-color: var(--purple-2);
|
|
66
|
+
--taskbar-menu-color: var(--purple-1);
|
|
67
|
+
}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
:root {
|
|
2
|
+
--red-0: #FF4D5B;
|
|
3
|
+
--red-1: #B23640;
|
|
4
|
+
--red-2: #661F25;
|
|
5
|
+
|
|
6
|
+
--orange-0: #FF974D;
|
|
7
|
+
--orange-1: #B26A36;
|
|
8
|
+
--orange-2: #663C1F;
|
|
9
|
+
|
|
10
|
+
--yellow-0: #FED24C;
|
|
11
|
+
--yellow-1: #B29336;
|
|
12
|
+
--yellow-2: #66541F;
|
|
13
|
+
|
|
14
|
+
--green-0: #4DFF8B;
|
|
15
|
+
--green-1: #36B261;
|
|
16
|
+
--green-2: #1F6638;
|
|
17
|
+
|
|
18
|
+
--cyan-0: #4DFFE1;
|
|
19
|
+
--cyan-1: #36B29E;
|
|
20
|
+
--cyan-2: #1F665A;
|
|
21
|
+
|
|
22
|
+
--light-blue-0: #4CDFFF;
|
|
23
|
+
--light-blue-1: #369CB2;
|
|
24
|
+
--light-blue-2: #1F5966;
|
|
25
|
+
|
|
26
|
+
--blue-0: #4D9CFF;
|
|
27
|
+
--blue-1: #366DB2;
|
|
28
|
+
--blue-2: #1F3E66;
|
|
29
|
+
|
|
30
|
+
--purple-0: #974DFF;
|
|
31
|
+
--purple-1: #6A36B2;
|
|
32
|
+
--purple-2: #3C1F66;
|
|
33
|
+
|
|
34
|
+
--pink-0: #FF4DFF;
|
|
35
|
+
--pink-1: #B236B2;
|
|
36
|
+
--pink-2: #661F66;
|
|
37
|
+
|
|
38
|
+
--white-0: #E5F2FF;
|
|
39
|
+
--white-1: #A0A9B2;
|
|
40
|
+
--white-2: #5C6166;
|
|
41
|
+
--white-3: #393C40;
|
|
42
|
+
--white-4: #222426;
|
|
43
|
+
|
|
44
|
+
--black-0: #29343F;
|
|
45
|
+
--black-1: #1E262E;
|
|
46
|
+
--black-2: #14191F;
|
|
47
|
+
--black-3: #0D1114;
|
|
48
|
+
--black-4: #080B0D;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
:root {
|
|
52
|
+
--foreground-color-0: var(--white-0);
|
|
53
|
+
--foreground-color-1: var(--white-1);
|
|
54
|
+
--foreground-color-2: var(--white-2);
|
|
55
|
+
|
|
56
|
+
--background-color-0: var(--black-0);
|
|
57
|
+
--background-color-1: var(--black-1);
|
|
58
|
+
--background-color-2: var(--black-2);
|
|
59
|
+
--background-color-3: var(--black-3);
|
|
60
|
+
--background-color-4: var(--black-4);
|
|
61
|
+
|
|
62
|
+
--scrollbar-color: color-mix(in srgb, var(--background-color-0) 25%, transparent);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
:root {
|
|
66
|
+
--border-radius-0: 0.2rem;
|
|
67
|
+
--border-radius-1: 0.375rem;
|
|
68
|
+
--border-radius-99: 9999px;
|
|
69
|
+
|
|
70
|
+
--svg-drop-shadow-color: var(--black-0);
|
|
71
|
+
--svg-drop-shadow-0: drop-shadow(0.1rem 0.1rem 0.2rem color-mix(in srgb, var(--svg-drop-shadow-color) 50%, transparent));
|
|
72
|
+
--svg-drop-shadow-1: drop-shadow(0.1rem 0.1rem 0.2rem color-mix(in srgb, var(--svg-drop-shadow-color) 75%, transparent));
|
|
73
|
+
|
|
74
|
+
--window-shadow-size: 0.3rem;
|
|
75
|
+
--window-shadow-opacity: 35%;
|
|
76
|
+
--window-shadow-spread: 3;
|
|
77
|
+
--window-box-shadow: calc(var(--window-shadow-size) * -1) var(--window-shadow-size)
|
|
78
|
+
calc(var(--window-shadow-size) * var(--window-shadow-spread)) 0px
|
|
79
|
+
rgba(0, 0, 0, var(--window-shadow-opacity));
|
|
80
|
+
|
|
81
|
+
--taskbar-height: 3rem;
|
|
82
|
+
--taskbar-color: var(--background-color-2);
|
|
83
|
+
--taskbar-opacity: 0.75;
|
|
84
|
+
--taskbar-menu-color: var(--background-color-1);
|
|
85
|
+
--taskbar-menu-opacity: 0.5;
|
|
86
|
+
--taskbar-button-hover-color: rgba(255, 255, 255, 5%);
|
|
87
|
+
--taskbar-filter: blur(1rem);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
@media screen and (max-width: 450px) {
|
|
91
|
+
/* Change --taskbar-height to 2.5rem using TS */
|
|
92
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
@import "./global/variables.css";
|
|
2
|
+
@import "./global/fonts.css";
|
|
3
|
+
@import "./global/themes.css";
|
|
4
|
+
@import "./global/scrollbar.css";
|
|
5
|
+
|
|
6
|
+
html, body, #root {
|
|
7
|
+
width: 100%;
|
|
8
|
+
height: 100%;
|
|
9
|
+
pointer-events: none;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
html {
|
|
13
|
+
scroll-behavior: smooth;
|
|
14
|
+
overflow: hidden;
|
|
15
|
+
background-color: var(--background-color-2);
|
|
16
|
+
font-size: 16px;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
body {
|
|
20
|
+
margin: 0;
|
|
21
|
+
font-family: var(--body-font-family);
|
|
22
|
+
-webkit-font-smoothing: antialiased;
|
|
23
|
+
-moz-osx-font-smoothing: grayscale;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
*, :after, :before {
|
|
27
|
+
color: var(--foreground-color-0);
|
|
28
|
+
font-size: 1rem;
|
|
29
|
+
box-sizing: border-box;
|
|
30
|
+
-webkit-tap-highlight-color: transparent;
|
|
31
|
+
text-rendering: optimizelegibility;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
p, a, button, input, select, h1, h2, h3, h4, h5, h6 {
|
|
35
|
+
font-family: var(--body-font-family);
|
|
36
|
+
letter-spacing: normal;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
p, a, div, span { font-size: 1em; }
|
|
40
|
+
button, input { font-size: 0.875em; }
|
|
41
|
+
h1 { font-size: 2em; }
|
|
42
|
+
h2 { font-size: 1.8em; }
|
|
43
|
+
h3 { font-size: 1.6em; }
|
|
44
|
+
h4 { font-size: 1.4em; }
|
|
45
|
+
h5 { font-size: 1.2em; }
|
|
46
|
+
h6 { font-size: 1em; }
|
|
47
|
+
|
|
48
|
+
button, li[data-rttab="true"] {
|
|
49
|
+
margin: 0;
|
|
50
|
+
border: none;
|
|
51
|
+
outline: none;
|
|
52
|
+
transition: background-color 100ms ease-in-out;
|
|
53
|
+
cursor: pointer;
|
|
54
|
+
user-select: none;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
code {
|
|
58
|
+
font-family: var(--mono-font-family);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
*::selection {
|
|
63
|
+
color: var(--background-color-3);
|
|
64
|
+
background-color: var(--foreground-color-0);
|
|
65
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
.TextRegular {
|
|
2
|
+
font-size: 1em;
|
|
3
|
+
font-weight: 400;
|
|
4
|
+
letter-spacing: normal;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
.TextLight {
|
|
8
|
+
color: var(--foreground-color-1);
|
|
9
|
+
font-size: 0.875em;
|
|
10
|
+
font-weight: 400;
|
|
11
|
+
letter-spacing: normal;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.TextSemibold {
|
|
15
|
+
font-weight: 500;
|
|
16
|
+
letter-spacing: normal;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.TextBold {
|
|
20
|
+
font-weight: 600;
|
|
21
|
+
letter-spacing: normal;
|
|
22
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
/// <reference types="vite/client" />
|