Merge pull request #2021 from maxberger/jsreorg

Reorganized Javascript files into subdirectories
This commit is contained in:
Peter Bieringer
2026-03-09 17:37:22 +01:00
committed by GitHub
17 changed files with 40 additions and 31 deletions

View File

@@ -100,6 +100,11 @@ radicale = [
"web/internal_data/css/main.css", "web/internal_data/css/main.css",
"web/internal_data/css/icons/*.svg", "web/internal_data/css/icons/*.svg",
"web/internal_data/*.js", "web/internal_data/*.js",
"web/internal_data/js/*.js",
"web/internal_data/js/api/*.js",
"web/internal_data/js/models/*.js",
"web/internal_data/js/scenes/*.js",
"web/internal_data/js/utils/*.js",
"web/internal_data/index.html", "web/internal_data/index.html",
"py.typed", "py.typed",
] ]

View File

@@ -19,7 +19,7 @@
display: none !important; display: none !important;
} }
</style> </style>
<script type="module" src="main.js"></script> <script type="module" src="js/main.js"></script>
</head> </head>
<body> <body>

View File

@@ -19,9 +19,9 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
import { COLOR_RE, ROOT_PATH, SERVER } from "./constants.js"; import { COLOR_RE, ROOT_PATH, SERVER } from "../constants.js";
import { Collection, CollectionType } from "./models.js"; import { Collection, CollectionType } from "../models/collection.js";
import { escape_xml } from "./utils.js"; import { escape_xml } from "../utils/misc.js";
/** /**
* @typedef {Object} SharingFeatures * @typedef {Object} SharingFeatures
* @property {number} [ApiVersion] * @property {number} [ApiVersion]

View File

@@ -19,8 +19,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
import { push_scene } from "./scene_manager.js"; import { LoginScene } from "./scenes/LoginScene.js";
import { LoginScene } from "./LoginScene.js"; import { push_scene } from "./scenes/scene_manager.js";
// Hide startup loading message // Hide startup loading message
document.getElementById("loadingscene").classList.add("hidden"); document.getElementById("loadingscene").classList.add("hidden");

View File

@@ -19,16 +19,16 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
import { discover_server_features, get_collections } from "../api/api.js";
import { SERVER } from "../constants.js";
import { Collection, CollectionType } from "../models/collection.js";
import { bytesToHumanReadable } from "../utils/misc.js";
import { CreateEditCollectionScene } from "./CreateEditCollectionScene.js"; import { CreateEditCollectionScene } from "./CreateEditCollectionScene.js";
import { DeleteCollectionScene } from "./DeleteCollectionScene.js"; import { DeleteCollectionScene } from "./DeleteCollectionScene.js";
import { LoadingScene } from "./LoadingScene.js"; import { LoadingScene } from "./LoadingScene.js";
import { Scene, pop_scene, push_scene, scene_stack } from "./scene_manager.js";
import { ShareCollectionScene, maybe_enable_sharing_options } from "./ShareCollectionScene.js"; import { ShareCollectionScene, maybe_enable_sharing_options } from "./ShareCollectionScene.js";
import { UploadCollectionScene } from "./UploadCollectionScene.js"; import { UploadCollectionScene } from "./UploadCollectionScene.js";
import { discover_server_features, get_collections } from "./api.js";
import { SERVER } from "./constants.js";
import { Collection, CollectionType } from "./models.js";
import { Scene, pop_scene, push_scene, scene_stack } from "./scene_manager.js";
import { bytesToHumanReadable } from "./utils.js";
/** /**
* @implements {Scene} * @implements {Scene}

View File

@@ -19,12 +19,12 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
import { create_collection, edit_collection } from "../api/api.js";
import { COLOR_RE } from "../constants.js";
import { Collection, CollectionType } from "../models/collection.js";
import { cleanHREFinput, isValidHREF, onCleanHREFinput, random_hex, random_uuid } from "../utils/misc.js";
import { LoadingScene } from "./LoadingScene.js"; import { LoadingScene } from "./LoadingScene.js";
import { create_collection, edit_collection } from "./api.js";
import { COLOR_RE } from "./constants.js";
import { Collection, CollectionType } from "./models.js";
import { Scene, pop_scene, push_scene, scene_stack } from "./scene_manager.js"; import { Scene, pop_scene, push_scene, scene_stack } from "./scene_manager.js";
import { cleanHREFinput, isValidHREF, onCleanHREFinput, random_hex, random_uuid } from "./utils.js";
/** /**
* @implements {Scene} * @implements {Scene}

View File

@@ -19,11 +19,11 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
import { Scene, push_scene, pop_scene, scene_stack } from "./scene_manager.js"; import { delete_collection } from "../api/api.js";
import { Collection } from "./models.js"; import { DELETE_CONFIRMATION_TEXT } from "../constants.js";
import { DELETE_CONFIRMATION_TEXT } from "./constants.js"; import { Collection } from "../models/collection.js";
import { LoadingScene } from "./LoadingScene.js"; import { LoadingScene } from "./LoadingScene.js";
import { delete_collection } from "./api.js"; import { Scene, pop_scene, push_scene, scene_stack } from "./scene_manager.js";
/** /**
* @implements {Scene} * @implements {Scene}

View File

@@ -19,7 +19,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
import { get_principal } from "./api.js"; import { get_principal } from "../api/api.js";
import { CollectionsScene } from "./CollectionsScene.js"; import { CollectionsScene } from "./CollectionsScene.js";
import { LoadingScene } from "./LoadingScene.js"; import { LoadingScene } from "./LoadingScene.js";
import { Scene, pop_scene, push_scene, scene_stack } from "./scene_manager.js"; import { Scene, pop_scene, push_scene, scene_stack } from "./scene_manager.js";

View File

@@ -19,9 +19,9 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
import { add_share_by_map, add_share_by_token } from "./api.js"; import { add_share_by_map, add_share_by_token } from "../api/api.js";
import { onCleanHREFinput } from "../utils/misc.js";
import { Scene, pop_scene, scene_stack } from "./scene_manager.js"; import { Scene, pop_scene, scene_stack } from "./scene_manager.js";
import { onCleanHREFinput } from "./utils.js";
/** /**
* @implements {Scene} * @implements {Scene}

View File

@@ -24,8 +24,8 @@ import {
delete_share_by_token, delete_share_by_token,
reload_sharing_list, reload_sharing_list,
server_features, server_features,
} from "./api.js"; } from "../api/api.js";
import { Collection } from "./models.js"; import { Collection } from "../models/collection.js";
import { NewShareScene } from "./NewShareScene.js"; import { NewShareScene } from "./NewShareScene.js";
import { Scene, pop_scene, push_scene, scene_stack } from "./scene_manager.js"; import { Scene, pop_scene, push_scene, scene_stack } from "./scene_manager.js";
@@ -155,7 +155,7 @@ function update_share_list(user, password, collection) {
* @param {string} user * @param {string} user
* @param {string} password * @param {string} password
* @param {Collection} collection * @param {Collection} collection
* @param {import('./api.js').Share} share * @param {import('../api/api.js').Share} share
* @param {HTMLElement} template * @param {HTMLElement} template
* @param {string} delete_label * @param {string} delete_label
* @param {function(string, string, string, function():void):void} delete_action * @param {function(string, string, string, function():void):void} delete_action
@@ -205,7 +205,7 @@ function add_share_row_node(user, password, collection, share, template, delete_
* @param {string} user * @param {string} user
* @param {string} password * @param {string} password
* @param {Collection} collection * @param {Collection} collection
* @param {Array<import('./api.js').Share>} shares * @param {Array<import('../api/api.js').Share>} shares
*/ */
function add_share_rows(user, password, collection, shares) { function add_share_rows(user, password, collection, shares) {
/** @type {HTMLElement} */ let token_template = document.querySelector("[data-name=sharetokenrowtemplate]"); /** @type {HTMLElement} */ let token_template = document.querySelector("[data-name=sharetokenrowtemplate]");

View File

@@ -19,10 +19,10 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
import { upload_collection } from "../api/api.js";
import { Collection } from "../models/collection.js";
import { cleanHREFinput, isValidHREF, onCleanHREFinput, random_uuid } from "../utils/misc.js";
import { Scene, pop_scene, scene_stack } from "./scene_manager.js"; import { Scene, pop_scene, scene_stack } from "./scene_manager.js";
import { Collection } from "./models.js";
import { cleanHREFinput, isValidHREF, onCleanHREFinput, random_uuid } from "./utils.js";
import { upload_collection } from "./api.js";
/** /**
* @implements {Scene} * @implements {Scene}

View File

@@ -30,7 +30,11 @@ web_files = ["web/internal_data/css/icon.png",
"web/internal_data/css/logo.svg", "web/internal_data/css/logo.svg",
"web/internal_data/css/main.css", "web/internal_data/css/main.css",
"web/internal_data/css/icons/*.svg", "web/internal_data/css/icons/*.svg",
"web/internal_data/*.js", "web/internal_data/js/*.js",
"web/internal_data/js/api/*.js",
"web/internal_data/js/models/*.js",
"web/internal_data/js/scenes/*.js",
"web/internal_data/js/utils/*.js",
"web/internal_data/index.html"] "web/internal_data/index.html"]
# Hint: if bcyrpt < 5.0.0 is used, passlib(libpass) dependency can be downgraded/reverted by: sed -i 's|libpass[^"]*|passlib|' setup.py.legacy # Hint: if bcyrpt < 5.0.0 is used, passlib(libpass) dependency can be downgraded/reverted by: sed -i 's|libpass[^"]*|passlib|' setup.py.legacy