Files
Oxicloud/static/js/app/state.js
T

98 lines
2.4 KiB
JavaScript
Raw Normal View History

/**
* OxiCloud - App state container
* Centralized mutable state for app and cached DOM references.
*/
2026-05-07 23:40:02 +02:00
/** @import {FileItem, FolderItem, LightItem} from '../core/types.js' */
2026-04-30 02:02:27 +02:00
export const app = {
currentView: 'grid',
2026-04-30 02:02:27 +02:00
/** @type {string | null} */
currentPath: '',
2026-05-07 23:40:02 +02:00
/** @type {string | null} */
currentFolder: null,
2026-04-30 02:02:27 +02:00
2026-05-07 23:40:02 +02:00
/** @type {FolderItem | null} */
currentFolderInfo: null,
2026-04-30 02:02:27 +02:00
2026-05-07 23:40:02 +02:00
/** @type {FolderItem | null} */
contextMenuTargetFolder: null,
2026-04-30 02:02:27 +02:00
2026-05-07 23:40:02 +02:00
/** @type {FileItem | null} */
contextMenuTargetFile: null,
selectedTargetFolderId: '',
moveDialogMode: 'file',
2026-04-30 02:02:27 +02:00
2026-05-07 23:40:02 +02:00
/** @type {string | null} */
moveDialogItemId: null,
/** @type {'file' | 'folder' | null} */
moveDialogItemMode: null,
/** @type {string | null} */
moveDialogCurrentFolderId: null,
/** @type {Array<{id: string, name: string}>} */
moveDialogBreadcrumb: [],
/** @type {FileItem[] | null} */
playlistDialogFiles: null,
2026-04-30 02:02:27 +02:00
/** @type {String | null} */
currentSection: null, // will be defined on first call
isSearchMode: false,
2026-05-07 23:40:02 +02:00
/** @type {FileItem | FolderItem | null} */
shareDialogItem: null,
2026-05-07 23:40:02 +02:00
/** @type {'file' | 'folder' | null} */
shareDialogItemType: null,
2026-05-07 23:40:02 +02:00
/** @type {String | null} */
notificationShareUrl: null,
2026-05-07 23:40:02 +02:00
/** @type {string | null} */
userHomeFolderId: null,
2026-05-07 23:40:02 +02:00
/** @type {string | null} */
userHomeFolderName: null,
2026-05-07 23:40:02 +02:00
/** @type {Array<{id: string, name: string}>} */
breadcrumbPath: [], // Array of {id, name} tracking folder navigation hierarchy
2026-04-30 02:02:27 +02:00
/** @type {String | null} */
2026-05-07 23:40:02 +02:00
viewFile: null, // current file in inline view
/** @type {LightItem[] | null} */
batchMoveItems: null
};
2026-04-30 02:02:27 +02:00
export const appElements = {
/** @type {HTMLElement | null} */
uploadBtn: null,
/** @type {HTMLElement | null} */
dropzone: null,
/** @type {HTMLInputElement | null} */
fileInput: null,
/** @type {HTMLElement | null} */
filesList: null,
/** @type {HTMLElement | null} */
newFolderBtn: null,
/** @type {HTMLElement | null} */
gridViewBtn: null,
/** @type {HTMLElement | null} */
listViewBtn: null,
/** @type {HTMLElement | null} */
breadcrumb: null,
/** @type {HTMLElement | null} */
pageTitle: null,
/** @type {HTMLElement | null} */
actionsBar: null,
/** @type {NodeListOf<HTMLElement> | null} */
navItems: null,
/** @type {HTMLInputElement | null} */
searchInput: null
};