@nextcloud/files 3.9.2 → 3.10.0

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.
Files changed (39) hide show
  1. package/README.md +63 -26
  2. package/dist/chunks/dav-BBwoJ8WE.cjs +703 -0
  3. package/dist/chunks/dav-BBwoJ8WE.cjs.map +1 -0
  4. package/dist/chunks/dav-DxfiR0wZ.mjs +704 -0
  5. package/dist/chunks/dav-DxfiR0wZ.mjs.map +1 -0
  6. package/dist/dav.cjs +19 -0
  7. package/dist/dav.cjs.map +1 -0
  8. package/dist/dav.d.ts +370 -0
  9. package/dist/dav.mjs +19 -0
  10. package/dist/dav.mjs.map +1 -0
  11. package/dist/index.cjs +106 -692
  12. package/dist/index.cjs.map +1 -1
  13. package/dist/index.d.ts +1099 -39
  14. package/dist/index.mjs +410 -995
  15. package/dist/index.mjs.map +1 -1
  16. package/package.json +15 -10
  17. package/dist/dav/dav.d.ts +0 -56
  18. package/dist/dav/davPermissions.d.ts +0 -6
  19. package/dist/dav/davProperties.d.ts +0 -57
  20. package/dist/fileAction.d.ts +0 -79
  21. package/dist/fileListFilters.d.ts +0 -86
  22. package/dist/fileListHeaders.d.ts +0 -27
  23. package/dist/files/file.d.ts +0 -12
  24. package/dist/files/fileType.d.ts +0 -8
  25. package/dist/files/folder.d.ts +0 -18
  26. package/dist/files/node.d.ts +0 -166
  27. package/dist/files/nodeData.d.ts +0 -54
  28. package/dist/navigation/column.d.ts +0 -28
  29. package/dist/navigation/index.d.ts +0 -7
  30. package/dist/navigation/navigation.d.ts +0 -74
  31. package/dist/navigation/view.d.ts +0 -92
  32. package/dist/newFileMenu.d.ts +0 -66
  33. package/dist/permissions.d.ts +0 -16
  34. package/dist/utils/fileSize.d.ts +0 -25
  35. package/dist/utils/fileSorting.d.ts +0 -35
  36. package/dist/utils/filename-validation.d.ts +0 -51
  37. package/dist/utils/filename.d.ts +0 -24
  38. package/dist/utils/logger.d.ts +0 -2
  39. package/dist/utils/sorting.d.ts +0 -12
@@ -1,74 +0,0 @@
1
- import { View } from './view';
2
- import { TypedEventTarget } from 'typescript-event-target';
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
- }> {
42
- private _views;
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
- */
49
- register(view: View): void;
50
- /**
51
- * Remove a registered view
52
- * @param id The id of the view to remove
53
- */
54
- remove(id: string): void;
55
- /**
56
- * Set the currently active view
57
- * @fires UpdateActiveViewEvent
58
- * @param view New active view
59
- */
60
- setActive(view: View | null): void;
61
- /**
62
- * The currently active files view
63
- */
64
- get active(): View | null;
65
- /**
66
- * All registered views
67
- */
68
- get views(): View[];
69
- }
70
- /**
71
- * Get the current files navigation
72
- */
73
- export declare const getNavigation: () => Navigation;
74
- export {};
@@ -1,92 +0,0 @@
1
- import { Folder } from '../files/folder';
2
- import { Node } from '../files/node';
3
- import { Column } from './column.js';
4
-
5
- export type ContentsWithRoot = {
6
- folder: Folder;
7
- contents: Node[];
8
- };
9
- interface ViewData {
10
- /** Unique view ID */
11
- id: string;
12
- /** Translated view name */
13
- name: string;
14
- /** Translated accessible description of the view */
15
- caption?: string;
16
- /** Translated title of the empty view */
17
- emptyTitle?: string;
18
- /** Translated description of the empty view */
19
- emptyCaption?: string;
20
- /**
21
- * Method return the content of the provided path
22
- * This ideally should be a cancellable promise.
23
- * promise.cancel(reason) will be called when the directory
24
- * change and the promise is not resolved yet.
25
- * You _must_ also return the current directory
26
- * information alongside with its content.
27
- */
28
- getContents: (path: string) => Promise<ContentsWithRoot>;
29
- /** The view icon as an inline svg */
30
- icon: string;
31
- /**
32
- * The view order.
33
- * If not set will be natural sorted by view name.
34
- */
35
- order?: number;
36
- /**
37
- * Custom params to give to the router on click
38
- * If defined, will be treated as a dummy view and
39
- * will just redirect and not fetch any contents.
40
- */
41
- params?: Record<string, string>;
42
- /**
43
- * This view column(s). Name and actions are
44
- * by default always included
45
- */
46
- columns?: Column[];
47
- /** The empty view element to render your empty content into */
48
- emptyView?: (div: HTMLDivElement) => void;
49
- /** The parent unique ID */
50
- parent?: string;
51
- /** This view is sticky (sent at the bottom) */
52
- sticky?: boolean;
53
- /**
54
- * This view has children and is expanded (by default)
55
- * or not. This will be overridden by user config.
56
- */
57
- expanded?: boolean;
58
- /**
59
- * Will be used as default if the user
60
- * haven't customized their sorting column
61
- */
62
- defaultSortKey?: string;
63
- /**
64
- * Method called to load child views if any
65
- */
66
- loadChildViews?: (view: View) => Promise<void>;
67
- }
68
- export declare class View implements ViewData {
69
- private _view;
70
- constructor(view: ViewData);
71
- get id(): string;
72
- get name(): string;
73
- get caption(): string | undefined;
74
- get emptyTitle(): string | undefined;
75
- get emptyCaption(): string | undefined;
76
- get getContents(): (path: string) => Promise<ContentsWithRoot>;
77
- get icon(): string;
78
- set icon(icon: string);
79
- get order(): number | undefined;
80
- set order(order: number | undefined);
81
- get params(): Record<string, string> | undefined;
82
- set params(params: Record<string, string> | undefined);
83
- get columns(): Column[] | undefined;
84
- get emptyView(): ((div: HTMLDivElement) => void) | undefined;
85
- get parent(): string | undefined;
86
- get sticky(): boolean | undefined;
87
- get expanded(): boolean | undefined;
88
- set expanded(expanded: boolean | undefined);
89
- get defaultSortKey(): string | undefined;
90
- get loadChildViews(): ((view: View) => Promise<void>) | undefined;
91
- }
92
- export {};
@@ -1,66 +0,0 @@
1
- import { Folder, Node } from './index';
2
-
3
- export declare enum NewMenuEntryCategory {
4
- /**
5
- * For actions where the user is intended to upload from their device
6
- */
7
- UploadFromDevice = 0,
8
- /**
9
- * For actions that create new nodes on the server without uploading
10
- */
11
- CreateNew = 1,
12
- /**
13
- * For everything not matching the other categories
14
- */
15
- Other = 2
16
- }
17
- export interface Entry {
18
- /** Unique ID */
19
- id: string;
20
- /**
21
- * Category to put this entry in
22
- * (supported since Nextcloud 30)
23
- * @since 3.3.0
24
- * @default NewMenuEntryCategory.CreateNew
25
- */
26
- category?: NewMenuEntryCategory;
27
- /** Translatable string displayed in the menu */
28
- displayName: string;
29
- /**
30
- * Condition wether this entry is shown or not
31
- * @param context the creation context. Usually the current folder
32
- */
33
- enabled?: (context: Folder) => boolean;
34
- /**
35
- * Either iconSvgInline or iconClass must be defined
36
- * Svg as inline string. <svg><path fill="..." /></svg>
37
- */
38
- iconSvgInline?: string;
39
- /**
40
- * Existing icon css class
41
- * @deprecated use iconSvgInline instead
42
- */
43
- iconClass?: string;
44
- /** Order of the entry in the menu */
45
- order?: number;
46
- /**
47
- * Function to be run after creation
48
- * @param context the creation context. Usually the current folder
49
- * @param content list of file/folders present in the context folder
50
- */
51
- handler: (context: Folder, content: Node[]) => void;
52
- }
53
- export declare class NewFileMenu {
54
- private _entries;
55
- registerEntry(entry: Entry): void;
56
- unregisterEntry(entry: Entry | string): void;
57
- /**
58
- * Get the list of registered entries
59
- *
60
- * @param {Folder} context the creation context. Usually the current folder
61
- */
62
- getEntries(context?: Folder): Array<Entry>;
63
- private getEntryIndex;
64
- private validateEntry;
65
- }
66
- export declare const getNewFileMenu: () => NewFileMenu;
@@ -1,16 +0,0 @@
1
- /**
2
- * SPDX-FileCopyrightText: 2022 Nextcloud GmbH and Nextcloud contributors
3
- * SPDX-License-Identifier: AGPL-3.0-or-later
4
- */
5
- /**
6
- * Node permissions
7
- */
8
- export declare enum Permission {
9
- NONE = 0,
10
- CREATE = 4,
11
- READ = 1,
12
- UPDATE = 2,
13
- DELETE = 8,
14
- SHARE = 16,
15
- ALL = 31
16
- }
@@ -1,25 +0,0 @@
1
- /**
2
- * SPDX-FileCopyrightText: 2019 Nextcloud GmbH and Nextcloud contributors
3
- * SPDX-License-Identifier: AGPL-3.0-or-later
4
- */
5
- /**
6
- * Format a file size in a human-like format. e.g. 42GB
7
- *
8
- * The default for Nextcloud is like Windows using binary sizes but showing decimal units,
9
- * meaning 1024 bytes will show as 1KB instead of 1KiB or like on Apple 1.02 KB
10
- *
11
- * @param size in bytes
12
- * @param skipSmallSizes avoid rendering tiny sizes and return '< 1 KB' instead
13
- * @param binaryPrefixes True if size binary prefixes like `KiB` should be used as per IEC 80000-13
14
- * @param base1000 Set to true to use base 1000 as per SI or used by Apple (default is base 1024 like Linux or Windows)
15
- */
16
- export declare function formatFileSize(size: number | string, skipSmallSizes?: boolean, binaryPrefixes?: boolean, base1000?: boolean): string;
17
- /**
18
- * Returns a file size in bytes from a humanly readable string
19
- * Note: `b` and `B` are both parsed as bytes and not as bit or byte.
20
- *
21
- * @param {string} value file size in human-readable format
22
- * @param {boolean} forceBinary for backwards compatibility this allows values to be base 2 (so 2KB means 2048 bytes instead of 2000 bytes)
23
- * @return {number} or null if string could not be parsed
24
- */
25
- export declare function parseFileSize(value: string, forceBinary?: boolean): number | null;
@@ -1,35 +0,0 @@
1
- import { INode } from '../files/node';
2
- import { SortingOrder } from './sorting';
3
-
4
- export declare enum FilesSortingMode {
5
- Name = "basename",
6
- Modified = "mtime",
7
- Size = "size"
8
- }
9
- export interface FilesSortingOptions {
10
- /**
11
- * They key to order the files by
12
- * @default FilesSortingMode.Name
13
- */
14
- sortingMode?: FilesSortingMode;
15
- /**
16
- * @default 'asc'
17
- */
18
- sortingOrder?: SortingOrder;
19
- /**
20
- * If set to true nodes marked as favorites are ordered on top of all other nodes
21
- * @default false
22
- */
23
- sortFavoritesFirst?: boolean;
24
- /**
25
- * If set to true folders are ordered on top of files
26
- * @default false
27
- */
28
- sortFoldersFirst?: boolean;
29
- }
30
- /**
31
- * Sort files and folders according to the sorting options
32
- * @param nodes Nodes to sort
33
- * @param options Sorting options
34
- */
35
- export declare function sortNodes(nodes: readonly INode[], options?: FilesSortingOptions): INode[];
@@ -1,51 +0,0 @@
1
- /**
2
- * SPDX-FileCopyrightText: Nextcloud GmbH and Nextcloud contributors
3
- * SPDX-License-Identifier: AGPL-3.0-or-later or LGPL-3.0-or-later
4
- */
5
- export declare enum InvalidFilenameErrorReason {
6
- ReservedName = "reserved name",
7
- Character = "character",
8
- Extension = "extension"
9
- }
10
- interface InvalidFilenameErrorOptions {
11
- /**
12
- * The filename that was validated
13
- */
14
- filename: string;
15
- /**
16
- * Reason why the validation failed
17
- */
18
- reason: InvalidFilenameErrorReason;
19
- /**
20
- * Part of the filename that caused this error
21
- */
22
- segment: string;
23
- }
24
- export declare class InvalidFilenameError extends Error {
25
- constructor(options: InvalidFilenameErrorOptions);
26
- /**
27
- * The filename that was validated
28
- */
29
- get filename(): string;
30
- /**
31
- * Reason why the validation failed
32
- */
33
- get reason(): InvalidFilenameErrorReason;
34
- /**
35
- * Part of the filename that caused this error
36
- */
37
- get segment(): string;
38
- }
39
- /**
40
- * Validate a given filename
41
- * @param filename The filename to check
42
- * @throws {InvalidFilenameError}
43
- */
44
- export declare function validateFilename(filename: string): void;
45
- /**
46
- * Check the validity of a filename
47
- * This is a convinient wrapper for `checkFilenameValidity` to only return a boolean for the valid
48
- * @param filename Filename to check validity
49
- */
50
- export declare function isFilenameValid(filename: string): boolean;
51
- export {};
@@ -1,24 +0,0 @@
1
- /**
2
- * SPDX-FileCopyrightText: Ferdinand Thiessen <opensource@fthiessen.de>
3
- * SPDX-License-Identifier: AGPL-3.0-or-later or LGPL-3.0-or-later
4
- */
5
- interface UniqueNameOptions {
6
- /**
7
- * A function that takes an index and returns a suffix to add to the file name, defaults to '(index)'
8
- * @param index The current index to add
9
- */
10
- suffix?: (index: number) => string;
11
- /**
12
- * Set to true to ignore the file extension when adding the suffix (when getting a unique directory name)
13
- */
14
- ignoreFileExtension?: boolean;
15
- }
16
- /**
17
- * Create an unique file name
18
- * @param name The initial name to use
19
- * @param otherNames Other names that are already used
20
- * @param options Optional parameters for tuning the behavior
21
- * @return {string} Either the initial name, if unique, or the name with the suffix so that the name is unique
22
- */
23
- export declare function getUniqueName(name: string, otherNames: string[], options?: UniqueNameOptions): string;
24
- export {};
@@ -1,2 +0,0 @@
1
- declare const _default: import('@nextcloud/logger').ILogger;
2
- export default _default;
@@ -1,12 +0,0 @@
1
- type IdentifierFn<T> = (v: T) => unknown;
2
- export type SortingOrder = 'asc' | 'desc';
3
- /**
4
- * Natural order a collection
5
- * You can define identifiers as callback functions, that get the element and return the value to sort.
6
- *
7
- * @param collection The collection to order
8
- * @param identifiers An array of identifiers to use, by default the identity of the element is used
9
- * @param orders Array of orders, by default all identifiers are sorted ascening
10
- */
11
- export declare function orderBy<T>(collection: readonly T[], identifiers?: IdentifierFn<T>[], orders?: SortingOrder[]): T[];
12
- export {};