This version uses Rollup instead of WebPack.

Due to that the code is smaller and has changes to prevent Circular Dependencies
This commit is contained in:
djmaze 2021-01-25 22:00:13 +01:00
parent 5e63ade9dd
commit ad8fd8879b
49 changed files with 595 additions and 577 deletions

View file

@ -15,7 +15,8 @@ import {
} from 'Common/EnumsUser';
import { inFocus, pInt } from 'Common/Utils';
import { encodeHtml, delegateRunOnDestroy } from 'Common/UtilsUser';
import { delegateRunOnDestroy } from 'Common/UtilsUser';
import { encodeHtml } from 'Common/Html';
import { UNUSED_OPTION_VALUE } from 'Common/Consts';
import { upload } from 'Common/Links';
@ -23,7 +24,7 @@ import { i18n, getNotification, getUploadErrorDescByCode } from 'Common/Translat
import { format as momentorFormat } from 'Common/Momentor';
import { MessageFlagsCache, setFolderHash } from 'Common/Cache';
import { HtmlEditor } from 'Common/HtmlEditor';
import { HtmlEditor } from 'Common/Html';
import AppStore from 'Stores/User/App';
import SettingsStore from 'Stores/User/Settings';
@ -40,6 +41,11 @@ import { ComposeAttachmentModel } from 'Model/ComposeAttachment';
import { command, isPopupVisible, showScreenPopup, hideScreenPopup } from 'Knoin/Knoin';
import { AbstractViewPopup } from 'Knoin/AbstractViews';
import { FolderSystemPopupView } from 'View/Popup/FolderSystem';
import { AskPopupView } from 'View/Popup/Ask';
import { ContactsPopupView } from 'View/Popup/Contacts';
import { ComposeOpenPgpPopupView } from 'View/Popup/ComposeOpenPgp';
const Settings = rl.settings,
/**
* @param {string} prefix
@ -403,7 +409,7 @@ class ComposePopupView extends AbstractViewPopup {
}
if (!sSentFolder) {
showScreenPopup(require('View/Popup/FolderSystem'), [SetSystemFoldersNotification.Sent]);
showScreenPopup(FolderSystemPopupView, [SetSystemFoldersNotification.Sent]);
} else {
this.sendError(false);
this.sending(true);
@ -443,7 +449,7 @@ class ComposePopupView extends AbstractViewPopup {
}
if (FolderStore.draftFolderNotEnabled()) {
showScreenPopup(require('View/Popup/FolderSystem'), [SetSystemFoldersNotification.Draft]);
showScreenPopup(FolderSystemPopupView, [SetSystemFoldersNotification.Draft]);
} else {
this.savedError(false);
this.saving(true);
@ -463,9 +469,8 @@ class ComposePopupView extends AbstractViewPopup {
@command((self) => self.isDraftFolderMessage())
deleteCommand() {
const PopupsAskViewModel = require('View/Popup/Ask');
if (!isPopupVisible(PopupsAskViewModel) && this.modalVisibility()) {
showScreenPopup(PopupsAskViewModel, [
if (!isPopupVisible(AskPopupView) && this.modalVisibility()) {
showScreenPopup(AskPopupView, [
i18n('POPUPS_ASK/DESC_WANT_DELETE_MESSAGES'),
() => {
if (this.modalVisibility()) {
@ -499,7 +504,7 @@ class ComposePopupView extends AbstractViewPopup {
if (this.allowContacts) {
this.skipCommand();
setTimeout(() => {
showScreenPopup(require('View/Popup/Contacts'), [true, this.sLastFocusedField]);
showScreenPopup(ContactsPopupView, [true, this.sLastFocusedField]);
}, 200);
}
}
@ -535,7 +540,7 @@ class ComposePopupView extends AbstractViewPopup {
openOpenPgpPopup() {
if (PgpStore.capaOpenPGP() && this.oEditor && !this.oEditor.isHtml()) {
showScreenPopup(require('View/Popup/ComposeOpenPgp'), [
showScreenPopup(ComposeOpenPgpPopupView, [
(result) => {
this.editor((editor) => {
editor.setPlain(result);
@ -780,7 +785,7 @@ class ComposePopupView extends AbstractViewPopup {
if (AppStore.composeInEdit()) {
type = type || ComposeType.Empty;
if (ComposeType.Empty !== type) {
showScreenPopup(require('View/Popup/Ask'), [
showScreenPopup(AskPopupView, [
i18n('COMPOSE/DISCARD_UNSAVED_DATA'),
() => {
this.initOnShow(type, oMessageOrArray, aToEmails, aCcEmails, aBccEmails, sCustomSubject, sCustomPlainText);
@ -1137,12 +1142,11 @@ class ComposePopupView extends AbstractViewPopup {
}
tryToClosePopup() {
const PopupsAskViewModel = require('View/Popup/Ask');
if (!isPopupVisible(PopupsAskViewModel) && this.modalVisibility()) {
if (!isPopupVisible(AskPopupView) && this.modalVisibility()) {
if (this.bSkipNextHide || (this.isEmptyForm() && !this.draftUid())) {
this.closeCommand && this.closeCommand();
} else {
showScreenPopup(PopupsAskViewModel, [
showScreenPopup(AskPopupView, [
i18n('POPUPS_ASK/DESC_WANT_CLOSE_THIS_WINDOW'),
() => {
if (this.modalVisibility()) {

View file

@ -26,9 +26,10 @@ import { EmailModel } from 'Model/Email';
import { ContactModel } from 'Model/Contact';
import { ContactPropertyModel, ContactPropertyType } from 'Model/ContactProperty';
import { command, showScreenPopup, hideScreenPopup } from 'Knoin/Knoin';
import { command, hideScreenPopup } from 'Knoin/Knoin';
import { AbstractViewPopup } from 'Knoin/AbstractViews';
const CONTACTS_PER_PAGE = 50,
propertyIsMail = prop => prop.isType(ContactPropertyType.Email),
propertyIsName = prop => prop.isType(ContactPropertyType.FirstName) || prop.isType(ContactPropertyType.LastName);
@ -225,7 +226,7 @@ class ContactsPopupView extends AbstractViewPopup {
this.sLastComposeFocusedField = '';
setTimeout(() => {
showScreenPopup(require('View/Popup/Compose'), [ComposeType.Empty, null, toEmails, ccEmails, bccEmails]);
rl.app.showComposePopupView([ComposeType.Empty, null, toEmails, ccEmails, bccEmails]);
}, 200);
}
@ -567,7 +568,7 @@ class ContactsPopupView extends AbstractViewPopup {
this.bBackToCompose = false;
if (rl.settings.capa(Capa.Composer)) {
showScreenPopup(require('View/Popup/Compose'));
rl.app.showComposePopupView();
}
}
}

View file

@ -12,7 +12,7 @@ import Remote from 'Remote/User/Fetch';
import { command } from 'Knoin/Knoin';
import { AbstractViewPopup } from 'Knoin/AbstractViews';
class FolderCreateView extends AbstractViewPopup {
class FolderCreatePopupView extends AbstractViewPopup {
constructor() {
super('FolderCreate');
@ -77,4 +77,4 @@ class FolderCreateView extends AbstractViewPopup {
}
}
export { FolderCreateView, FolderCreateView as default };
export { FolderCreatePopupView, FolderCreatePopupView as default };

View file

@ -1,6 +1,6 @@
import ko from 'ko';
import { convertLangName } from 'Common/Utils';
import { convertLangName } from 'Common/Translator';
import { AbstractViewPopup } from 'Knoin/AbstractViews';

View file

@ -7,6 +7,7 @@ import Remote from 'Remote/Admin/Fetch';
import { command, isPopupVisible, showScreenPopup } from 'Knoin/Knoin';
import { AbstractViewPopup } from 'Knoin/AbstractViews';
import { AskPopupView } from 'View/Popup/Ask';
class PluginPopupView extends AbstractViewPopup {
constructor() {
@ -88,9 +89,8 @@ class PluginPopupView extends AbstractViewPopup {
}
tryToClosePopup() {
const PopupsAskViewModel = require('View/Popup/Ask');
if (!isPopupVisible(PopupsAskViewModel)) {
showScreenPopup(PopupsAskViewModel, [
if (!isPopupVisible(AskPopupView)) {
showScreenPopup(AskPopupView, [
i18n('POPUPS_ASK/DESC_WANT_CLOSE_THIS_WINDOW'),
() => this.modalVisibility() && this.cancelCommand && this.cancelCommand()
]);

View file

@ -12,6 +12,8 @@ import SieveStore from 'Stores/User/Sieve';
import { showScreenPopup/*, command*/ } from 'Knoin/Knoin';
import { AbstractViewPopup } from 'Knoin/AbstractViews';
import { FilterPopupView } from 'View/Popup/Filter';
class SieveScriptPopupView extends AbstractViewPopup {
constructor() {
super('SieveScript');
@ -83,7 +85,7 @@ class SieveScriptPopupView extends AbstractViewPopup {
/* this = SieveScriptModel */
const filter = new FilterModel();
filter.generateID();
showScreenPopup(require('View/Popup/Filter'), [
showScreenPopup(FilterPopupView, [
filter,
() => {
this.filters.push(filter);
@ -94,7 +96,7 @@ class SieveScriptPopupView extends AbstractViewPopup {
editFilter(filter) {
const clonedFilter = filter.cloneSelf();
showScreenPopup(require('View/Popup/Filter'), [
showScreenPopup(FilterPopupView, [
clonedFilter,
() => {
const script = this.script(),

View file

@ -1,6 +1,6 @@
import { StorageResultType, Notification } from 'Common/Enums';
import { getNotification } from 'Common/Translator';
import { HtmlEditor } from 'Common/HtmlEditor';
import { HtmlEditor } from 'Common/Html';
import Remote from 'Remote/User/Fetch';

View file

@ -7,6 +7,8 @@ import Remote from 'Remote/User/Fetch';
import { showScreenPopup } from 'Knoin/Knoin';
import { AbstractViewPopup } from 'Knoin/AbstractViews';
import { TwoFactorTestPopupView } from 'View/Popup/TwoFactorTest';
class TwoFactorConfigurationPopupView extends AbstractViewPopup {
constructor() {
super('TwoFactorConfiguration');
@ -104,7 +106,7 @@ class TwoFactorConfigurationPopupView extends AbstractViewPopup {
}
testTwoFactor() {
showScreenPopup(require('View/Popup/TwoFactorTest'), [this.twoFactorTested]);
showScreenPopup(TwoFactorTestPopupView, [this.twoFactorTested]);
}
clearTwoFactor() {

View file

@ -8,6 +8,9 @@ import { settings } from 'Common/Links';
import { showScreenPopup } from 'Knoin/Knoin';
import { AbstractViewRight } from 'Knoin/AbstractViews';
import { KeyboardShortcutsHelpPopupView } from 'View/Popup/KeyboardShortcutsHelp';
import { AccountPopupView } from 'View/Popup/Account';
const Settings = rl.settings;
export class AbstractSystemDropDownUserView extends AbstractViewRight {
@ -63,13 +66,13 @@ export class AbstractSystemDropDownUserView extends AbstractViewRight {
settingsHelp() {
if (Settings.capa(Capa.Help)) {
showScreenPopup(require('View/Popup/KeyboardShortcutsHelp'));
showScreenPopup(KeyboardShortcutsHelpPopupView);
}
}
addAccountClick() {
if (this.capaAdditionalAccounts()) {
showScreenPopup(require('View/Popup/Account'));
showScreenPopup(AccountPopupView);
}
}
@ -89,7 +92,7 @@ export class AbstractSystemDropDownUserView extends AbstractViewRight {
// shortcuts help
shortcuts.add('?,f1,help', '', [KeyState.MessageList, KeyState.MessageView, KeyState.Settings], () => {
if (this.viewModelVisible) {
showScreenPopup(require('View/Popup/KeyboardShortcutsHelp'));
showScreenPopup(KeyboardShortcutsHelpPopupView);
return false;
}
return true;

View file

@ -7,9 +7,7 @@ import {
import { ClientSideKeyName } from 'Common/EnumsUser';
import { convertLangName } from 'Common/Utils';
import { getNotification, getNotificationFromResponse, reload as translatorReload } from 'Common/Translator';
import { getNotification, getNotificationFromResponse, reload as translatorReload, convertLangName } from 'Common/Translator';
import AppStore from 'Stores/User/App';
import LanguageStore from 'Stores/Language';
@ -23,6 +21,8 @@ import { AbstractViewCenter } from 'Knoin/AbstractViews';
import { rootAdmin } from 'Common/Links';
import { LanguagesPopupView } from 'View/Popup/Languages';
const Settings = rl.settings,
LoginSignMeType = {
@ -269,7 +269,7 @@ class LoginUserView extends AbstractViewCenter {
}
selectLanguage() {
showScreenPopup(require('View/Popup/Languages'), [this.language, this.languages(), LanguageStore.userLanguage()]);
showScreenPopup(LanguagesPopupView, [this.language, this.languages(), LanguageStore.userLanguage()]);
}
}

View file

@ -14,6 +14,10 @@ import MessageStore from 'Stores/User/Message';
import { showScreenPopup } from 'Knoin/Knoin';
import { AbstractViewLeft } from 'Knoin/AbstractViews';
import { ComposePopupView } from 'View/Popup/Compose';
import { FolderCreatePopupView } from 'View/Popup/FolderCreate';
import { ContactsPopupView } from 'View/Popup/Contacts';
const Settings = rl.settings;
class FolderListMailBoxUserView extends AbstractViewLeft {
@ -200,12 +204,12 @@ class FolderListMailBoxUserView extends AbstractViewLeft {
composeClick() {
if (Settings.capa(Capa.Composer)) {
showScreenPopup(require('View/Popup/Compose'));
showScreenPopup(ComposePopupView);
}
}
createFolder() {
showScreenPopup(require('View/Popup/FolderCreate'));
showScreenPopup(FolderCreatePopupView);
}
configureFolders() {
@ -214,7 +218,7 @@ class FolderListMailBoxUserView extends AbstractViewLeft {
contactsClick() {
if (this.allowContacts) {
showScreenPopup(require('View/Popup/Contacts'));
showScreenPopup(ContactsPopupView);
}
}
}

View file

@ -44,6 +44,10 @@ import Remote from 'Remote/User/Fetch';
import { command, showScreenPopup, popupVisibility } from 'Knoin/Knoin';
import { AbstractViewRight } from 'Knoin/AbstractViews';
import { FolderClearPopupView } from 'View/Popup/FolderClear';
import { ComposePopupView } from 'View/Popup/Compose';
import { AdvancedSearchPopupView } from 'View/Popup/AdvancedSearch';
const
Settings = rl.settings,
canBeMovedHelper = (self) => self.canBeMoved(),
@ -244,7 +248,7 @@ class MessageListMailBoxUserView extends AbstractViewRight {
@command()
clearCommand() {
if (Settings.capa(Capa.DangerousActions)) {
showScreenPopup(require('View/Popup/FolderClear'), [FolderStore.currentFolder()]);
showScreenPopup(FolderClearPopupView, [FolderStore.currentFolder()]);
}
}
@ -258,7 +262,7 @@ class MessageListMailBoxUserView extends AbstractViewRight {
@command(canBeMovedHelper)
multyForwardCommand() {
if (Settings.capa(Capa.Composer)) {
showScreenPopup(require('View/Popup/Compose'), [
showScreenPopup(ComposePopupView, [
ComposeType.ForwardAsAttachment,
MessageStore.messageListCheckedOrSelected()
]);
@ -350,7 +354,7 @@ class MessageListMailBoxUserView extends AbstractViewRight {
composeClick() {
if (Settings.capa(Capa.Composer)) {
showScreenPopup(require('View/Popup/Compose'));
showScreenPopup(ComposePopupView);
}
}
@ -761,7 +765,7 @@ class MessageListMailBoxUserView extends AbstractViewRight {
if (Settings.capa(Capa.Composer)) {
// write/compose (open compose popup)
shortcuts.add('w,c,new', '', [KeyState.MessageList, KeyState.MessageView], () => {
showScreenPopup(require('View/Popup/Compose'));
showScreenPopup(ComposePopupView);
return false;
});
}
@ -887,7 +891,7 @@ class MessageListMailBoxUserView extends AbstractViewRight {
advancedSearchClick() {
Settings.capa(Capa.SearchAdv)
&& showScreenPopup(require('View/Popup/AdvancedSearch'), [this.mainMessageListSearch()]);
&& showScreenPopup(AdvancedSearchPopupView, [this.mainMessageListSearch()]);
}
quotaTooltip() {

View file

@ -41,6 +41,8 @@ import Remote from 'Remote/User/Fetch';
import { command, showScreenPopup, createCommand } from 'Knoin/Knoin';
import { AbstractViewRight } from 'Knoin/AbstractViews';
import { ComposePopupView } from 'View/Popup/Compose';
const Settings = rl.settings;
function isTransparent(color) {
@ -342,7 +344,7 @@ class MessageViewMailBoxUserView extends AbstractViewRight {
* @returns {void}
*/
replyOrforward(sType) {
Settings.capa(Capa.Composer) && showScreenPopup(require('View/Popup/Compose'), [sType, MessageStore.message()]);
Settings.capa(Capa.Composer) && showScreenPopup(ComposePopupView, [sType, MessageStore.message()]);
}
checkHeaderHeight() {
@ -426,7 +428,7 @@ class MessageViewMailBoxUserView extends AbstractViewRight {
3 !== event.which &&
mailToHelper(
el.href,
Settings.capa(Capa.Composer) ? require('View/Popup/Compose') : null
Settings.capa(Capa.Composer) ? ComposePopupView : null
)
);
}
@ -684,13 +686,13 @@ class MessageViewMailBoxUserView extends AbstractViewRight {
composeClick() {
if (Settings.capa(Capa.Composer)) {
showScreenPopup(require('View/Popup/Compose'));
showScreenPopup(ComposePopupView);
}
}
editMessage() {
if (Settings.capa(Capa.Composer) && MessageStore.message()) {
showScreenPopup(require('View/Popup/Compose'), [ComposeType.Draft, MessageStore.message()]);
showScreenPopup(ComposePopupView, [ComposeType.Draft, MessageStore.message()]);
}
}