@nextcloud/files 3.0.0-beta.8 → 3.0.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.
@@ -0,0 +1,103 @@
1
+ /**
2
+ * @copyright Copyright (c) 2022 John Molakvoæ <skjnldsv@protonmail.com>
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
+ *
21
+ */
22
+ import type { Folder, Node } from '@nextcloud/files';
23
+ import { Column } from './column.js';
24
+ export type ContentsWithRoot = {
25
+ folder: Folder;
26
+ contents: Node[];
27
+ };
28
+ interface ViewData {
29
+ /** Unique view ID */
30
+ id: string;
31
+ /** Translated view name */
32
+ name: string;
33
+ /** Translated accessible description of the view */
34
+ caption?: string;
35
+ /** Translated title of the empty view */
36
+ emptyTitle?: string;
37
+ /** Translated description of the empty view */
38
+ emptyCaption?: string;
39
+ /**
40
+ * Method return the content of the provided path
41
+ * This ideally should be a cancellable promise.
42
+ * promise.cancel(reason) will be called when the directory
43
+ * change and the promise is not resolved yet.
44
+ * You _must_ also return the current directory
45
+ * information alongside with its content.
46
+ */
47
+ getContents: (path: string) => Promise<ContentsWithRoot>;
48
+ /** The view icon as an inline svg */
49
+ icon: string;
50
+ /** The view order */
51
+ order: number;
52
+ /**
53
+ * Custom params to give to the router on click
54
+ * If defined, will be treated as a dummy view and
55
+ * will just redirect and not fetch any contents.
56
+ */
57
+ params?: Record<string, string>;
58
+ /**
59
+ * This view column(s). Name and actions are
60
+ * by default always included
61
+ */
62
+ columns?: Column[];
63
+ /** The empty view element to render your empty content into */
64
+ emptyView?: (div: HTMLDivElement) => void;
65
+ /** The parent unique ID */
66
+ parent?: string;
67
+ /** This view is sticky (sent at the bottom) */
68
+ sticky?: boolean;
69
+ /**
70
+ * This view has children and is expanded (by default)
71
+ * or not. This will be overridden by user config.
72
+ */
73
+ expanded?: boolean;
74
+ /**
75
+ * Will be used as default if the user
76
+ * haven't customized their sorting column
77
+ */
78
+ defaultSortKey?: string;
79
+ }
80
+ export declare class View implements ViewData {
81
+ private _view;
82
+ constructor(view: ViewData);
83
+ get id(): string;
84
+ get name(): string;
85
+ get caption(): string | undefined;
86
+ get emptyTitle(): string | undefined;
87
+ get emptyCaption(): string | undefined;
88
+ get getContents(): (path: string) => Promise<ContentsWithRoot>;
89
+ get icon(): string;
90
+ set icon(icon: string);
91
+ get order(): number;
92
+ set order(order: number);
93
+ get params(): Record<string, string> | undefined;
94
+ set params(params: Record<string, string> | undefined);
95
+ get columns(): Column[] | undefined;
96
+ get emptyView(): ((div: HTMLDivElement) => void) | undefined;
97
+ get parent(): string | undefined;
98
+ get sticky(): boolean | undefined;
99
+ get expanded(): boolean | undefined;
100
+ set expanded(expanded: boolean | undefined);
101
+ get defaultSortKey(): string | undefined;
102
+ }
103
+ export {};
@@ -19,22 +19,35 @@
19
19
  * along with this program. If not, see <http://www.gnu.org/licenses/>.
20
20
  *
21
21
  */
22
+ import type { Folder, Node } from './index';
22
23
  export interface Entry {
23
24
  /** Unique ID */
24
25
  id: string;
25
26
  /** Translatable string displayed in the menu */
26
27
  displayName: string;
27
- templateName?: string;
28
- if?: (context: Object) => Boolean;
28
+ /**
29
+ * Condition wether this entry is shown or not
30
+ * @param context the creation context. Usually the current folder
31
+ */
32
+ enabled?: (context: Folder) => boolean;
29
33
  /**
30
34
  * Either iconSvgInline or iconClass must be defined
31
35
  * Svg as inline string. <svg><path fill="..." /></svg>
32
36
  */
33
37
  iconSvgInline?: string;
34
- /** Existing icon css class */
38
+ /**
39
+ * Existing icon css class
40
+ * @deprecated use iconSvgInline instead
41
+ */
35
42
  iconClass?: string;
36
- /** Function to be run after creation */
37
- handler?: Function;
43
+ /** Order of the entry in the menu */
44
+ order?: number;
45
+ /**
46
+ * Function to be run after creation
47
+ * @param context the creation context. Usually the current folder
48
+ * @param content list of file/folders present in the context folder
49
+ */
50
+ handler: (context: Folder, content: Node[]) => void;
38
51
  }
39
52
  export declare class NewFileMenu {
40
53
  private _entries;
@@ -43,9 +56,9 @@ export declare class NewFileMenu {
43
56
  /**
44
57
  * Get the list of registered entries
45
58
  *
46
- * @param {FileInfo} context the creation context. Usually the current folder FileInfo
59
+ * @param {Folder} context the creation context. Usually the current folder
47
60
  */
48
- getEntries(context?: Object): Array<Entry>;
61
+ getEntries(context?: Folder): Array<Entry>;
49
62
  private getEntryIndex;
50
63
  private validateEntry;
51
64
  }
@@ -19,6 +19,9 @@
19
19
  * along with this program. If not, see <http://www.gnu.org/licenses/>.
20
20
  *
21
21
  */
22
+ /**
23
+ * Node permissions
24
+ */
22
25
  export declare enum Permission {
23
26
  NONE = 0,
24
27
  CREATE = 4,
@@ -28,8 +31,3 @@ export declare enum Permission {
28
31
  SHARE = 16,
29
32
  ALL = 31
30
33
  }
31
- /**
32
- * Parse the webdav permission string to a permission enum
33
- * @see https://github.com/nextcloud/server/blob/71f698649f578db19a22457cb9d420fb62c10382/lib/public/Files/DavUtil.php#L58-L88
34
- */
35
- export declare const parseWebdavPermissions: (permString?: string) => number;
@@ -19,5 +19,5 @@
19
19
  * along with this program. If not, see <http://www.gnu.org/licenses/>.
20
20
  *
21
21
  */
22
- declare const _default: any;
22
+ declare const _default: import("@nextcloud/logger").ILogger;
23
23
  export default _default;
@@ -0,0 +1,13 @@
1
+ Included dependencies:
2
+
3
+ fast-xml-parser
4
+ version: 4.3.2
5
+ license: MIT
6
+
7
+ is-svg
8
+ version: 5.0.0
9
+ license: MIT
10
+
11
+ strnum
12
+ version: 1.0.5
13
+ license: MIT
package/package.json CHANGED
@@ -1,14 +1,16 @@
1
1
  {
2
2
  "name": "@nextcloud/files",
3
- "version": "3.0.0-beta.8",
3
+ "version": "3.0.0",
4
4
  "description": "Nextcloud files utils",
5
- "main": "dist/index.js",
6
- "module": "dist/index.esm.js",
5
+ "type": "module",
6
+ "main": "dist/index.cjs",
7
+ "module": "dist/index.mjs",
7
8
  "types": "dist/index.d.ts",
8
9
  "exports": {
9
10
  ".": {
10
- "import": "./dist/index.esm.js",
11
- "require": "./dist/index.js"
11
+ "types": "./dist/index.d.ts",
12
+ "import": "./dist/index.mjs",
13
+ "require": "./dist/index.cjs"
12
14
  }
13
15
  },
14
16
  "files": [
@@ -16,7 +18,8 @@
16
18
  ],
17
19
  "author": "Christoph Wurst <christoph@winzerhof-wurst.at>",
18
20
  "contributors": [
19
- "John Molakvoæ <skjnldsv@protonmail.com>"
21
+ "John Molakvoæ <skjnldsv@protonmail.com>",
22
+ "Ferdinand Thiessen <opensource@fthiessen.de>"
20
23
  ],
21
24
  "license": "AGPL-3.0-or-later",
22
25
  "keywords": [
@@ -25,48 +28,53 @@
25
28
  "library"
26
29
  ],
27
30
  "scripts": {
28
- "build": "rollup --config rollup.config.mjs",
31
+ "build": "vite --mode production build",
29
32
  "build:doc": "typedoc --out dist/doc lib && touch dist/doc/.nojekyll",
30
- "dev": "echo 'No dev build available, production only' && npm run build",
31
- "watch": "rollup --config rollup.config.mjs --watch",
32
- "test": "jest",
33
- "test:watch": "jest --watchAll --verbose true",
34
- "test:coverage": "jest --coverage"
33
+ "dev": "vite --mode development build",
34
+ "watch": "vite --mode development build --watch",
35
+ "lint": "eslint .",
36
+ "lint:fix": "eslint --fix .",
37
+ "test": "vitest run",
38
+ "test:watch": "vitest watch",
39
+ "test:coverage": "vitest run --coverage"
35
40
  },
36
41
  "repository": {
37
42
  "type": "git",
38
- "url": "https://github.com/nextcloud/nextcloud-files.git"
43
+ "url": "https://github.com/nextcloud-libraries/nextcloud-files.git"
39
44
  },
40
45
  "bugs": {
41
- "url": "https://github.com/nextcloud/nextcloud-files/issues"
46
+ "url": "https://github.com/nextcloud-libraries/nextcloud-files/issues"
42
47
  },
43
48
  "engines": {
44
- "node": "^16.0.0",
45
- "npm": "^7.0.0 || ^8.0.0"
49
+ "node": "^20.0.0",
50
+ "npm": "^9.0.0"
46
51
  },
47
- "homepage": "https://github.com/nextcloud/nextcloud-files",
52
+ "homepage": "https://github.com/nextcloud-libraries/nextcloud-files",
48
53
  "devDependencies": {
49
- "@babel/cli": "^7.17.10",
50
- "@babel/core": "^7.18.5",
51
- "@babel/preset-env": "^7.18.2",
52
- "@babel/preset-typescript": "^7.17.12",
53
- "@rollup-extras/plugin-clean": "^1.2.3",
54
- "@rollup/plugin-commonjs": "^24.0.1",
55
- "@rollup/plugin-node-resolve": "^15.0.1",
56
- "@rollup/plugin-typescript": "^11.0.0",
57
- "@types/jest": "^29.4.0",
58
- "@types/node": "^18.11.18",
59
- "jest": "^29.4.0",
60
- "jest-environment-jsdom": "^29.4.0",
61
- "rollup": "^3.20.2",
62
- "ts-jest": "^29.0.5",
63
- "tslib": "^2.4.1",
64
- "typedoc": "^0.23.24",
65
- "typescript": "^5.0.3"
54
+ "@nextcloud/eslint-config": "^8.3.0",
55
+ "@nextcloud/typings": "^1.7.0",
56
+ "@nextcloud/vite-config": "^1.1.0",
57
+ "@rollup-extras/plugin-clean": "^1.3.9",
58
+ "@rollup/plugin-commonjs": "^25.0.7",
59
+ "@rollup/plugin-node-resolve": "^15.2.3",
60
+ "@rollup/plugin-typescript": "^11.1.5",
61
+ "@types/node": "^20.8.10",
62
+ "@vitest/coverage-istanbul": "^0.34.6",
63
+ "fast-xml-parser": "^4.3.2",
64
+ "rollup": "^4.3.0",
65
+ "tslib": "^2.6.2",
66
+ "typedoc": "^0.25.3",
67
+ "typescript": "^5.2.2",
68
+ "vite": "^4.5.0",
69
+ "vitest": "^0.34.6"
66
70
  },
67
71
  "dependencies": {
68
- "@nextcloud/auth": "^2.0.0",
69
- "@nextcloud/l10n": "^2.1.0",
70
- "@nextcloud/logger": "^2.5.0"
72
+ "@nextcloud/auth": "^2.2.1",
73
+ "@nextcloud/l10n": "^2.2.0",
74
+ "@nextcloud/logger": "^2.7.0",
75
+ "@nextcloud/paths": "^2.1.0",
76
+ "@nextcloud/router": "^2.2.0",
77
+ "is-svg": "^5.0.0",
78
+ "webdav": "^5.3.0"
71
79
  }
72
80
  }