From 74ef30ea79a0d69aa9d84073ac7698f0bdbc637d Mon Sep 17 00:00:00 2001 From: marlon-erler Date: Thu, 9 Apr 2026 16:54:56 +0000 Subject: [PATCH] standardize use of public keyword --- dist/index.js | 46 ++++++++++--------- src/ViewModel/Chat/chatListViewModel.ts | 8 +--- src/ViewModel/Chat/chatMessageViewModel.ts | 6 +-- src/ViewModel/Chat/chatViewModel.ts | 24 ++-------- src/ViewModel/Global/fileTransferViewModel.ts | 1 - src/ViewModel/Global/notificationViewModel.ts | 6 +-- src/ViewModel/Pages/boardViewModel.ts | 18 ++------ src/ViewModel/Pages/calendarPageViewModel.ts | 7 +-- src/ViewModel/Pages/messagePageViewModel.ts | 6 +-- src/ViewModel/Pages/settingsPageViewModel.ts | 5 +- .../Pages/taskContainingPageViewModel.ts | 8 +--- src/ViewModel/Pages/taskPageViewModel.ts | 9 +--- src/ViewModel/Pages/taskViewModel.ts | 18 ++------ 13 files changed, 47 insertions(+), 115 deletions(-) diff --git a/dist/index.js b/dist/index.js index b145e6ac..aef8fc79 100644 --- a/dist/index.js +++ b/dist/index.js @@ -1662,9 +1662,12 @@ // src/ViewModel/Pages/taskViewModel.ts var TaskViewModel = class { // init - constructor(coreViewModel2, chatViewModel, boardsAndTasksModel, containingModel, taskFileContent) { + constructor(coreViewModel2, chatViewModel, boardsAndTasksModel, containingModel, task) { this.coreViewModel = coreViewModel2; this.chatViewModel = chatViewModel; + this.boardsAndTasksModel = boardsAndTasksModel; + this.containingModel = containingModel; + this.task = task; // paths this.getFilePath = () => { return this.boardsAndTasksModel.getTaskFilePath(this.task.fileId); @@ -1790,9 +1793,6 @@ this.selectedVersionId.value = this.task.fileContentId; this.updateSuggestions(); }; - this.boardsAndTasksModel = boardsAndTasksModel; - this.containingModel = containingModel; - this.task = taskFileContent; this.loadAllData(); this.selectedVersionId.subscribeSilent((selectedVersionId) => { this.switchVersion(selectedVersionId); @@ -1831,6 +1831,7 @@ constructor(coreViewModel2, chatViewModel, boardsAndTasksModel) { this.coreViewModel = coreViewModel2; this.chatViewModel = chatViewModel; + this.boardsAndTasksModel = boardsAndTasksModel; // state this.taskIndexManager = new IndexManager( (taskViewModel) => taskViewModel.sortingString @@ -1867,7 +1868,6 @@ taskViewModel.updateIndex(); } }; - this.boardsAndTasksModel = boardsAndTasksModel; } }; @@ -1879,6 +1879,8 @@ super(coreViewModel2, chatViewModel, boardsAndTasksModel); this.coreViewModel = coreViewModel2; this.chatViewModel = chatViewModel; + this.calendarModel = calendarModel; + this.boardsAndTasksModel = boardsAndTasksModel; // paths this.getBasePath = () => { return [...this.calendarModel.getViewPath()]; @@ -2030,6 +2032,7 @@ // init constructor(coreViewModel2, messagePageViewModel, chatMessage, sentByUser) { this.coreViewModel = coreViewModel2; + this.messagePageViewModel = messagePageViewModel; this.body = new State(""); this.status = new State( void 0 @@ -2122,7 +2125,6 @@ this.body.value = this.chatMessage.body; this.status.value = this.chatMessage.status; }; - this.messagePageViewModel = messagePageViewModel; this.chatMessage = chatMessage; this.sentByUser = sentByUser; this.loadData(); @@ -2134,6 +2136,7 @@ // init constructor(coreViewModel2, chatViewModel) { this.coreViewModel = coreViewModel2; + this.chatViewModel = chatViewModel; // state this.chatMessageViewModels = new MapState(); this.composingMessage = new State(""); @@ -2193,7 +2196,6 @@ this.handleReaction(reaction); } }; - this.chatViewModel = chatViewModel; this.cannotSendMessage = createProxyState( [ this.chatViewModel.settingsViewModel.username, @@ -2209,6 +2211,7 @@ // init constructor(coreViewModel2, chatViewModel) { this.coreViewModel = coreViewModel2; + this.chatViewModel = chatViewModel; // state this.primaryChannel = new State(""); this.primaryChannelInput = new State(""); @@ -2283,7 +2286,6 @@ this.secondaryChannels.add(secondaryChannel); } }; - this.chatViewModel = chatViewModel; this.loadListRelevantData(); this.cannotSetEncryptionKey = createProxyState( [this.encryptionKeyInput], @@ -2355,6 +2357,9 @@ super(coreViewModel2, chatViewModel, boardsAndTasksModel); this.coreViewModel = coreViewModel2; this.chatViewModel = chatViewModel; + this.boardsAndTasksModel = boardsAndTasksModel; + this.taskPageViewModel = taskPageViewModel; + this.boardInfo = boardInfo; // state this.name = new State(""); this.color = new State("standard" /* Standard */); @@ -2527,9 +2532,6 @@ this.loadTasks(); this.loadSearchSuggestions(); }; - this.boardsAndTasksModel = boardsAndTasksModel; - this.taskPageViewModel = taskPageViewModel; - this.boardInfo = boardInfo; this.loadListRelevantData(); this.isSelected = createProxyState( [this.taskPageViewModel.selectedBoardId], @@ -2567,9 +2569,10 @@ // src/ViewModel/Pages/taskPageViewModel.ts var TaskPageViewModel = class { // init - constructor(coreViewModel2, chatViewModel, boardModel) { + constructor(coreViewModel2, chatViewModel, boardsAndTasksModel) { this.coreViewModel = coreViewModel2; this.chatViewModel = chatViewModel; + this.boardsAndTasksModel = boardsAndTasksModel; // data this.boardIndexManager = new IndexManager( (boardViewModel) => boardViewModel.name.value @@ -2674,10 +2677,9 @@ this.updateBoardIndices(); this.openLastUsedBoard(); }; - this.boardsAndTasksModel = boardModel; this.chatViewModel = chatViewModel; this.loadData(); - boardModel.boardHandlerManager.addHandler( + boardsAndTasksModel.boardHandlerManager.addHandler( (boardInfoFileContent) => { this.showBoardInList(boardInfoFileContent); this.updateBoardIndices(); @@ -2691,6 +2693,11 @@ // init constructor(coreViewModel2, chatModel, settingsViewModel2, notificationViewModel, connectionViewModel2, chatListViewModel2) { this.coreViewModel = coreViewModel2; + this.chatModel = chatModel; + this.settingsViewModel = settingsViewModel2; + this.notificationViewModel = notificationViewModel; + this.connectionViewModel = connectionViewModel2; + this.chatListViewModel = chatListViewModel2; // state this.displayedColor = new State("standard" /* Standard */); this.selectedPage = new State( @@ -2764,11 +2771,6 @@ } ); }; - this.chatModel = chatModel; - this.settingsViewModel = settingsViewModel2; - this.connectionViewModel = connectionViewModel2; - this.notificationViewModel = notificationViewModel; - this.chatListViewModel = chatListViewModel2; this.calendarViewModel = new CalendarPageViewModel( coreViewModel2, this, @@ -2811,6 +2813,7 @@ var NotificationViewModel = class _NotificationViewModel { // init constructor(chatListViewModel2) { + this.chatListViewModel = chatListViewModel2; // data this.seenMessageIds = /* @__PURE__ */ new Set(); this.messagesInMarquee = []; @@ -2864,7 +2867,6 @@ this.stopLoop(); this.startLoop(); }; - this.chatListViewModel = chatListViewModel2; } // util static createNotification(message) { @@ -2882,6 +2884,8 @@ // init constructor(coreViewModel2, settingsViewModel2, connectionViewModel2) { this.coreViewModel = coreViewModel2; + this.settingsViewModel = settingsViewModel2; + this.connectionViewModel = connectionViewModel2; // data this.chatIndexManager = new IndexManager( (chatViewModel) => chatViewModel.settingsPageViewModel.primaryChannel.value @@ -2947,9 +2951,7 @@ } this.updateIndices(); }; - this.settingsViewModel = settingsViewModel2; this.notificationViewModel = new NotificationViewModel(this); - this.connectionViewModel = connectionViewModel2; this.loadChats(); } }; diff --git a/src/ViewModel/Chat/chatListViewModel.ts b/src/ViewModel/Chat/chatListViewModel.ts index f88f0869..9dd3aaba 100644 --- a/src/ViewModel/Chat/chatListViewModel.ts +++ b/src/ViewModel/Chat/chatListViewModel.ts @@ -11,9 +11,7 @@ import ConnectionViewModel from "../Global/connectionViewModel"; import NotificationViewModel from "../Global/notificationViewModel"; export default class ChatListViewModel { - settingsViewModel: SettingsViewModel; notificationViewModel: NotificationViewModel; - connectionViewModel: ConnectionViewModel; // data chatIndexManager: IndexManager = new IndexManager( @@ -99,12 +97,10 @@ export default class ChatListViewModel { // init constructor( public coreViewModel: CoreViewModel, - settingsViewModel: SettingsViewModel, - connectionViewModel: ConnectionViewModel, + public settingsViewModel: SettingsViewModel, + public connectionViewModel: ConnectionViewModel, ) { - this.settingsViewModel = settingsViewModel; this.notificationViewModel = new NotificationViewModel(this); - this.connectionViewModel = connectionViewModel; this.loadChats(); } diff --git a/src/ViewModel/Chat/chatMessageViewModel.ts b/src/ViewModel/Chat/chatMessageViewModel.ts index 47a40b44..9f6dd13d 100644 --- a/src/ViewModel/Chat/chatMessageViewModel.ts +++ b/src/ViewModel/Chat/chatMessageViewModel.ts @@ -12,8 +12,6 @@ import CoreViewModel from "../Global/coreViewModel"; import MessagePageViewModel from "../Pages/messagePageViewModel"; export default class ChatMessageViewModel { - messagePageViewModel: MessagePageViewModel; - // data chatMessage: ChatMessage; channel: string; @@ -126,12 +124,10 @@ export default class ChatMessageViewModel { // init constructor( public coreViewModel: CoreViewModel, - messagePageViewModel: MessagePageViewModel, + public messagePageViewModel: MessagePageViewModel, chatMessage: ChatMessage, sentByUser: boolean, ) { - this.messagePageViewModel = messagePageViewModel; - this.chatMessage = chatMessage; this.sentByUser = sentByUser; this.loadData(); diff --git a/src/ViewModel/Chat/chatViewModel.ts b/src/ViewModel/Chat/chatViewModel.ts index 4d640b77..32bfda79 100644 --- a/src/ViewModel/Chat/chatViewModel.ts +++ b/src/ViewModel/Chat/chatViewModel.ts @@ -24,13 +24,6 @@ import ConnectionViewModel from "../Global/connectionViewModel"; import NotificationViewModel from "../Global/notificationViewModel"; export default class ChatViewModel { - chatModel: ChatModel; - - settingsViewModel: SettingsViewModel; - notificationViewModel: NotificationViewModel; - connectionViewModel: ConnectionViewModel; - chatListViewModel: ChatListViewModel; - calendarViewModel: CalendarPageViewModel; taskPageViewModel: TaskPageViewModel; messagePageViewModel: MessagePageViewModel; @@ -132,19 +125,12 @@ export default class ChatViewModel { // init constructor( public coreViewModel: CoreViewModel, - chatModel: ChatModel, - settingsViewModel: SettingsViewModel, - notificationViewModel: NotificationViewModel, - connectionViewModel: ConnectionViewModel, - chatListViewModel: ChatListViewModel, + public chatModel: ChatModel, + public settingsViewModel: SettingsViewModel, + public notificationViewModel: NotificationViewModel, + public connectionViewModel: ConnectionViewModel, + public chatListViewModel: ChatListViewModel, ) { - // models - this.chatModel = chatModel; - this.settingsViewModel = settingsViewModel; - this.connectionViewModel = connectionViewModel; - this.notificationViewModel = notificationViewModel; - this.chatListViewModel = chatListViewModel; - // page viewModels this.calendarViewModel = new CalendarPageViewModel( coreViewModel, diff --git a/src/ViewModel/Global/fileTransferViewModel.ts b/src/ViewModel/Global/fileTransferViewModel.ts index 8eb46615..b41eec3c 100644 --- a/src/ViewModel/Global/fileTransferViewModel.ts +++ b/src/ViewModel/Global/fileTransferViewModel.ts @@ -8,7 +8,6 @@ import StorageModel, { filePaths, } from "../../Model/Global/storageModel"; -import ChatListModel from "../../Model/Chat/chatListModel"; import ChatModel from "../../Model/Chat/chatModel"; import CoreViewModel from "./coreViewModel"; diff --git a/src/ViewModel/Global/notificationViewModel.ts b/src/ViewModel/Global/notificationViewModel.ts index 60fe92c8..fe186893 100644 --- a/src/ViewModel/Global/notificationViewModel.ts +++ b/src/ViewModel/Global/notificationViewModel.ts @@ -4,8 +4,6 @@ import ChatListViewModel from "../Chat/chatListViewModel"; import { ChatPageTypes } from "../Chat/chatViewModel"; export default class NotificationViewModel { - chatListViewModel: ChatListViewModel; - // data seenMessageIds = new Set(); messagesInMarquee: Notification[] = []; @@ -78,9 +76,7 @@ export default class NotificationViewModel { }; // init - constructor(chatListViewModel: ChatListViewModel) { - this.chatListViewModel = chatListViewModel; - } + constructor(public chatListViewModel: ChatListViewModel) {} // util static createNotification(message: ChatMessage): Notification { diff --git a/src/ViewModel/Pages/boardViewModel.ts b/src/ViewModel/Pages/boardViewModel.ts index 8e7dc04e..cebae447 100644 --- a/src/ViewModel/Pages/boardViewModel.ts +++ b/src/ViewModel/Pages/boardViewModel.ts @@ -15,13 +15,6 @@ import TaskPageViewModel from "./taskPageViewModel"; import TaskViewModel from "./taskViewModel"; export default class BoardViewModel extends TaskContainingPageViewModel { - boardsAndTasksModel: BoardsAndTasksModel; - - taskPageViewModel: TaskPageViewModel; - - // data - boardInfo: BoardInfoFileContent; - // state name: React.State = new React.State(""); color: React.State = new React.State(Colors.Standard); @@ -248,17 +241,12 @@ export default class BoardViewModel extends TaskContainingPageViewModel { constructor( public coreViewModel: CoreViewModel, public chatViewModel: ChatViewModel, - boardsAndTasksModel: BoardsAndTasksModel, - taskPageViewModel: TaskPageViewModel, - boardInfo: BoardInfoFileContent, + public boardsAndTasksModel: BoardsAndTasksModel, + public taskPageViewModel: TaskPageViewModel, + public boardInfo: BoardInfoFileContent, ) { super(coreViewModel, chatViewModel, boardsAndTasksModel); - // set - this.boardsAndTasksModel = boardsAndTasksModel; - this.taskPageViewModel = taskPageViewModel; - this.boardInfo = boardInfo; - // load this.loadListRelevantData(); diff --git a/src/ViewModel/Pages/calendarPageViewModel.ts b/src/ViewModel/Pages/calendarPageViewModel.ts index 87b99efa..b41893ee 100644 --- a/src/ViewModel/Pages/calendarPageViewModel.ts +++ b/src/ViewModel/Pages/calendarPageViewModel.ts @@ -14,9 +14,6 @@ import TaskViewModel from "./taskViewModel"; export const CALENDAR_EVENT_BOARD_ID = "events"; export default class CalendarPageViewModel extends TaskContainingPageViewModel { - calendarModel: CalendarModel; - boardsAndTasksModel: BoardsAndTasksModel; - // data get monthString(): string { return CalendarModel.getMonthString( @@ -188,8 +185,8 @@ export default class CalendarPageViewModel extends TaskContainingPageViewModel { constructor( public coreViewModel: CoreViewModel, public chatViewModel: ChatViewModel, - calendarModel: CalendarModel, - boardsAndTasksModel: BoardsAndTasksModel, + public calendarModel: CalendarModel, + public boardsAndTasksModel: BoardsAndTasksModel, ) { super(coreViewModel, chatViewModel, boardsAndTasksModel); diff --git a/src/ViewModel/Pages/messagePageViewModel.ts b/src/ViewModel/Pages/messagePageViewModel.ts index 6723b6c1..97207638 100644 --- a/src/ViewModel/Pages/messagePageViewModel.ts +++ b/src/ViewModel/Pages/messagePageViewModel.ts @@ -10,8 +10,6 @@ import ChatViewModel from "../Chat/chatViewModel"; import CoreViewModel from "../Global/coreViewModel"; export default class MessagePageViewModel { - chatViewModel: ChatViewModel; - // state chatMessageViewModels: React.MapState = new React.MapState(); @@ -97,10 +95,8 @@ export default class MessagePageViewModel { // init constructor( public coreViewModel: CoreViewModel, - chatViewModel: ChatViewModel, + public chatViewModel: ChatViewModel, ) { - this.chatViewModel = chatViewModel; - this.cannotSendMessage = React.createProxyState( [ this.chatViewModel.settingsViewModel.username, diff --git a/src/ViewModel/Pages/settingsPageViewModel.ts b/src/ViewModel/Pages/settingsPageViewModel.ts index 142eb6c4..04253636 100644 --- a/src/ViewModel/Pages/settingsPageViewModel.ts +++ b/src/ViewModel/Pages/settingsPageViewModel.ts @@ -5,8 +5,6 @@ import { Colors } from "../../colors"; import CoreViewModel from "../Global/coreViewModel"; export default class SettingsPageViewModel { - chatViewModel: ChatViewModel; - // state primaryChannel: React.State = new React.State(""); primaryChannelInput: React.State = new React.State(""); @@ -113,9 +111,8 @@ export default class SettingsPageViewModel { // init constructor( public coreViewModel: CoreViewModel, - chatViewModel: ChatViewModel, + public chatViewModel: ChatViewModel, ) { - this.chatViewModel = chatViewModel; this.loadListRelevantData(); this.cannotSetEncryptionKey = React.createProxyState( diff --git a/src/ViewModel/Pages/taskContainingPageViewModel.ts b/src/ViewModel/Pages/taskContainingPageViewModel.ts index b11be412..77711303 100644 --- a/src/ViewModel/Pages/taskContainingPageViewModel.ts +++ b/src/ViewModel/Pages/taskContainingPageViewModel.ts @@ -10,8 +10,6 @@ import { IndexManager } from "../../Model/Utility/utility"; import TaskViewModel from "./taskViewModel"; export default class TaskContainingPageViewModel { - boardsAndTasksModel: BoardsAndTasksModel; - // state taskIndexManager: IndexManager = new IndexManager( (taskViewModel: TaskViewModel) => taskViewModel.sortingString, @@ -60,8 +58,6 @@ export default class TaskContainingPageViewModel { constructor( public coreViewModel: CoreViewModel, public chatViewModel: ChatViewModel, - boardsAndTasksModel: BoardsAndTasksModel, - ) { - this.boardsAndTasksModel = boardsAndTasksModel; - } + public boardsAndTasksModel: BoardsAndTasksModel, + ) {} } diff --git a/src/ViewModel/Pages/taskPageViewModel.ts b/src/ViewModel/Pages/taskPageViewModel.ts index 955d118e..a007af0e 100644 --- a/src/ViewModel/Pages/taskPageViewModel.ts +++ b/src/ViewModel/Pages/taskPageViewModel.ts @@ -8,11 +8,8 @@ import BoardViewModel from "./boardViewModel"; import ChatViewModel from "../Chat/chatViewModel"; import CoreViewModel from "../Global/coreViewModel"; import { IndexManager } from "../../Model/Utility/utility"; -import StorageModel from "../../Model/Global/storageModel"; export default class TaskPageViewModel { - boardsAndTasksModel: BoardsAndTasksModel; - // data boardIndexManager: IndexManager = new IndexManager( (boardViewModel: BoardViewModel) => boardViewModel.name.value, @@ -155,16 +152,14 @@ export default class TaskPageViewModel { constructor( public coreViewModel: CoreViewModel, public chatViewModel: ChatViewModel, - boardModel: BoardsAndTasksModel, + public boardsAndTasksModel: BoardsAndTasksModel, ) { - this.boardsAndTasksModel = boardModel; - this.chatViewModel = chatViewModel; this.loadData(); // handlers - boardModel.boardHandlerManager.addHandler( + boardsAndTasksModel.boardHandlerManager.addHandler( (boardInfoFileContent: BoardInfoFileContent) => { this.showBoardInList(boardInfoFileContent); this.updateBoardIndices(); diff --git a/src/ViewModel/Pages/taskViewModel.ts b/src/ViewModel/Pages/taskViewModel.ts index 7db9bdec..3d697bc5 100644 --- a/src/ViewModel/Pages/taskViewModel.ts +++ b/src/ViewModel/Pages/taskViewModel.ts @@ -11,13 +11,6 @@ import TaskContainingPageViewModel from "./taskContainingPageViewModel"; import { allowDrag } from "../../View/utility"; export default class TaskViewModel { - boardsAndTasksModel: BoardsAndTasksModel; - - containingModel: TaskContainingPageViewModel; - - // data - task: TaskFileContent; - get sortingString(): string { const splitDate: string[] = this.date.value.split("-"); const year = padZero(splitDate[0], 4); @@ -213,15 +206,10 @@ export default class TaskViewModel { constructor( public coreViewModel: CoreViewModel, public chatViewModel: ChatViewModel, - boardsAndTasksModel: BoardsAndTasksModel, - containingModel: TaskContainingPageViewModel, - taskFileContent: TaskFileContent, + public boardsAndTasksModel: BoardsAndTasksModel, + public containingModel: TaskContainingPageViewModel, + public task: TaskFileContent, ) { - this.boardsAndTasksModel = boardsAndTasksModel; - this.containingModel = containingModel; - - this.task = taskFileContent; - // load this.loadAllData();