@nextcloud/files 3.4.1 → 3.5.1
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/README.md +5 -1
- package/dist/dav/dav.d.ts +11 -0
- package/dist/files/file.d.ts +7 -1
- package/dist/files/fileType.d.ts +2 -19
- package/dist/files/folder.d.ts +9 -1
- package/dist/files/node.d.ts +4 -0
- package/dist/index.cjs +157 -565
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +4 -4
- package/dist/index.mjs +157 -565
- package/dist/index.mjs.map +1 -1
- package/dist/navigation/column.d.ts +1 -1
- package/dist/navigation/navigation.d.ts +64 -2
- package/dist/permissions.d.ts +2 -19
- package/dist/utils/fileSize.d.ts +2 -20
- package/dist/utils/fileSorting.d.ts +2 -2
- package/dist/utils/filename.d.ts +20 -0
- package/dist/utils/logger.d.ts +0 -21
- package/package.json +9 -7
|
@@ -1,12 +1,74 @@
|
|
|
1
1
|
import { View } from './view';
|
|
2
|
+
import { TypedEventTarget } from 'typescript-event-target';
|
|
2
3
|
|
|
3
|
-
|
|
4
|
+
/**
|
|
5
|
+
* The event is emitted when the navigation view was updated.
|
|
6
|
+
* It contains the new active view in the `detail` attribute.
|
|
7
|
+
*/
|
|
8
|
+
interface UpdateActiveViewEvent extends CustomEvent<View | null> {
|
|
9
|
+
type: 'updateActive';
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* This event is emitted when the list of registered views is changed
|
|
13
|
+
*/
|
|
14
|
+
interface UpdateViewsEvent extends CustomEvent<never> {
|
|
15
|
+
type: 'update';
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* The files navigation manages the available and active views
|
|
19
|
+
*
|
|
20
|
+
* Custom views for the files app can be registered (examples are the favorites views or the shared-with-you view).
|
|
21
|
+
* It is also possible to listen on changes of the registered views or when the current active view is changed.
|
|
22
|
+
* @example
|
|
23
|
+
* ```js
|
|
24
|
+
* const navigation = getNavigation()
|
|
25
|
+
* navigation.addEventListener('update', () => {
|
|
26
|
+
* // This will be called whenever a new view is registered or a view is removed
|
|
27
|
+
* const viewNames = navigation.views.map((view) => view.name)
|
|
28
|
+
* console.warn('Registered views changed', viewNames)
|
|
29
|
+
* })
|
|
30
|
+
* // Or you can react to changes of the current active view
|
|
31
|
+
* navigation.addEventListener('updateActive', (event) => {
|
|
32
|
+
* // This will be called whenever the active view changed
|
|
33
|
+
* const newView = event.detail // you could also use `navigation.active`
|
|
34
|
+
* console.warn('Active view changed to ' + newView.name)
|
|
35
|
+
* })
|
|
36
|
+
* ```
|
|
37
|
+
*/
|
|
38
|
+
export declare class Navigation extends TypedEventTarget<{
|
|
39
|
+
updateActive: UpdateActiveViewEvent;
|
|
40
|
+
update: UpdateViewsEvent;
|
|
41
|
+
}> {
|
|
4
42
|
private _views;
|
|
5
43
|
private _currentView;
|
|
44
|
+
/**
|
|
45
|
+
* Register a new view on the navigation
|
|
46
|
+
* @param view The view to register
|
|
47
|
+
* @throws `Error` is thrown if a view with the same id is already registered
|
|
48
|
+
*/
|
|
6
49
|
register(view: View): void;
|
|
50
|
+
/**
|
|
51
|
+
* Remove a registered view
|
|
52
|
+
* @param id The id of the view to remove
|
|
53
|
+
*/
|
|
7
54
|
remove(id: string): void;
|
|
8
|
-
|
|
55
|
+
/**
|
|
56
|
+
* Set the currently active view
|
|
57
|
+
* @fires UpdateActiveViewEvent
|
|
58
|
+
* @param view New active view
|
|
59
|
+
*/
|
|
9
60
|
setActive(view: View | null): void;
|
|
61
|
+
/**
|
|
62
|
+
* The currently active files view
|
|
63
|
+
*/
|
|
10
64
|
get active(): View | null;
|
|
65
|
+
/**
|
|
66
|
+
* All registered views
|
|
67
|
+
*/
|
|
68
|
+
get views(): View[];
|
|
11
69
|
}
|
|
70
|
+
/**
|
|
71
|
+
* Get the current files navigation
|
|
72
|
+
*/
|
|
12
73
|
export declare const getNavigation: () => Navigation;
|
|
74
|
+
export {};
|
package/dist/permissions.d.ts
CHANGED
|
@@ -1,23 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
* @author John Molakvoæ <skjnldsv@protonmail.com>
|
|
5
|
-
*
|
|
6
|
-
* @license AGPL-3.0-or-later
|
|
7
|
-
*
|
|
8
|
-
* This program is free software: you can redistribute it and/or modify
|
|
9
|
-
* it under the terms of the GNU Affero General Public License as
|
|
10
|
-
* published by the Free Software Foundation, either version 3 of the
|
|
11
|
-
* License, or (at your option) any later version.
|
|
12
|
-
*
|
|
13
|
-
* This program is distributed in the hope that it will be useful,
|
|
14
|
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
15
|
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
16
|
-
* GNU Affero General Public License for more details.
|
|
17
|
-
*
|
|
18
|
-
* You should have received a copy of the GNU Affero General Public License
|
|
19
|
-
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
20
|
-
*
|
|
2
|
+
* SPDX-FileCopyrightText: 2022 Nextcloud GmbH and Nextcloud contributors
|
|
3
|
+
* SPDX-License-Identifier: AGPL-3.0-or-later
|
|
21
4
|
*/
|
|
22
5
|
/**
|
|
23
6
|
* Node permissions
|
package/dist/utils/fileSize.d.ts
CHANGED
|
@@ -1,24 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
* @author Christoph Wurst <christoph@winzerhof-wurst.at>
|
|
5
|
-
* @author John Molakvoæ <skjnldsv@protonmail.com>
|
|
6
|
-
*
|
|
7
|
-
* @license AGPL-3.0-or-later
|
|
8
|
-
*
|
|
9
|
-
* This program is free software: you can redistribute it and/or modify
|
|
10
|
-
* it under the terms of the GNU Affero General Public License as
|
|
11
|
-
* published by the Free Software Foundation, either version 3 of the
|
|
12
|
-
* License, or (at your option) any later version.
|
|
13
|
-
*
|
|
14
|
-
* This program is distributed in the hope that it will be useful,
|
|
15
|
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
16
|
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
17
|
-
* GNU Affero General Public License for more details.
|
|
18
|
-
*
|
|
19
|
-
* You should have received a copy of the GNU Affero General Public License
|
|
20
|
-
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
21
|
-
*
|
|
2
|
+
* SPDX-FileCopyrightText: 2019 Nextcloud GmbH and Nextcloud contributors
|
|
3
|
+
* SPDX-License-Identifier: AGPL-3.0-or-later
|
|
22
4
|
*/
|
|
23
5
|
/**
|
|
24
6
|
* Format a file size in a human-like format. e.g. 42GB
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { INode } from '../files/node';
|
|
2
2
|
|
|
3
3
|
export declare enum FilesSortingMode {
|
|
4
4
|
Name = "basename",
|
|
@@ -31,4 +31,4 @@ export interface FilesSortingOptions {
|
|
|
31
31
|
* @param nodes Nodes to sort
|
|
32
32
|
* @param options Sorting options
|
|
33
33
|
*/
|
|
34
|
-
export declare function sortNodes(nodes:
|
|
34
|
+
export declare function sortNodes(nodes: readonly INode[], options?: FilesSortingOptions): INode[];
|
package/dist/utils/filename.d.ts
CHANGED
|
@@ -8,3 +8,23 @@
|
|
|
8
8
|
* @param filename Filename to check validity
|
|
9
9
|
*/
|
|
10
10
|
export declare function isFilenameValid(filename: string): boolean;
|
|
11
|
+
interface UniqueNameOptions {
|
|
12
|
+
/**
|
|
13
|
+
* A function that takes an index and returns a suffix to add to the file name, defaults to '(index)'
|
|
14
|
+
* @param index The current index to add
|
|
15
|
+
*/
|
|
16
|
+
suffix?: (index: number) => string;
|
|
17
|
+
/**
|
|
18
|
+
* Set to true to ignore the file extension when adding the suffix (when getting a unique directory name)
|
|
19
|
+
*/
|
|
20
|
+
ignoreFileExtension?: boolean;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Create an unique file name
|
|
24
|
+
* @param name The initial name to use
|
|
25
|
+
* @param otherNames Other names that are already used
|
|
26
|
+
* @param options Optional parameters for tuning the behavior
|
|
27
|
+
* @return {string} Either the initial name, if unique, or the name with the suffix so that the name is unique
|
|
28
|
+
*/
|
|
29
|
+
export declare function getUniqueName(name: string, otherNames: string[], options?: UniqueNameOptions): string;
|
|
30
|
+
export {};
|
package/dist/utils/logger.d.ts
CHANGED
|
@@ -1,23 +1,2 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @copyright 2019 Christoph Wurst <christoph@winzerhof-wurst.at>
|
|
3
|
-
*
|
|
4
|
-
* @author Christoph Wurst <christoph@winzerhof-wurst.at>
|
|
5
|
-
*
|
|
6
|
-
* @license AGPL-3.0-or-later
|
|
7
|
-
*
|
|
8
|
-
* This program is free software: you can redistribute it and/or modify
|
|
9
|
-
* it under the terms of the GNU Affero General Public License as
|
|
10
|
-
* published by the Free Software Foundation, either version 3 of the
|
|
11
|
-
* License, or (at your option) any later version.
|
|
12
|
-
*
|
|
13
|
-
* This program is distributed in the hope that it will be useful,
|
|
14
|
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
15
|
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
16
|
-
* GNU Affero General Public License for more details.
|
|
17
|
-
*
|
|
18
|
-
* You should have received a copy of the GNU Affero General Public License
|
|
19
|
-
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
20
|
-
*
|
|
21
|
-
*/
|
|
22
1
|
declare const _default: import('@nextcloud/logger').ILogger;
|
|
23
2
|
export default _default;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nextcloud/files",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.5.1",
|
|
4
4
|
"description": "Nextcloud files utils",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.cjs",
|
|
@@ -51,19 +51,19 @@
|
|
|
51
51
|
},
|
|
52
52
|
"homepage": "https://github.com/nextcloud-libraries/nextcloud-files",
|
|
53
53
|
"devDependencies": {
|
|
54
|
-
"@codecov/vite-plugin": "^0.0.1-beta.
|
|
54
|
+
"@codecov/vite-plugin": "^0.0.1-beta.10",
|
|
55
55
|
"@nextcloud/eslint-config": "^8.4.1",
|
|
56
56
|
"@nextcloud/typings": "^1.8.0",
|
|
57
|
-
"@nextcloud/vite-config": "^2.0.
|
|
58
|
-
"@types/node": "^20.
|
|
57
|
+
"@nextcloud/vite-config": "^2.0.2",
|
|
58
|
+
"@types/node": "^20.14.5",
|
|
59
59
|
"@vitest/coverage-istanbul": "^1.6.0",
|
|
60
60
|
"fast-xml-parser": "^4.4.0",
|
|
61
61
|
"jsdom": "^24.1.0",
|
|
62
|
-
"tslib": "^2.6.
|
|
62
|
+
"tslib": "^2.6.3",
|
|
63
63
|
"typedoc": "^0.25.13",
|
|
64
64
|
"typescript": "^5.4.5",
|
|
65
|
-
"vite": "^5.
|
|
66
|
-
"vitest": "^1.
|
|
65
|
+
"vite": "^5.3.1",
|
|
66
|
+
"vitest": "^1.6.0"
|
|
67
67
|
},
|
|
68
68
|
"dependencies": {
|
|
69
69
|
"@nextcloud/auth": "^2.3.0",
|
|
@@ -71,8 +71,10 @@
|
|
|
71
71
|
"@nextcloud/logger": "^3.0.2",
|
|
72
72
|
"@nextcloud/paths": "^2.1.0",
|
|
73
73
|
"@nextcloud/router": "^3.0.1",
|
|
74
|
+
"@nextcloud/sharing": "^0.2.1",
|
|
74
75
|
"cancelable-promise": "^4.3.1",
|
|
75
76
|
"is-svg": "^5.0.1",
|
|
77
|
+
"typescript-event-target": "^1.1.1",
|
|
76
78
|
"webdav": "^5.6.0"
|
|
77
79
|
}
|
|
78
80
|
}
|