@cloudron/pankow 4.2.3 → 4.3.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/components/ListItem.vue +188 -0
- package/components/Notification.vue +9 -61
- package/components/TabView.vue +26 -31
- package/fallbackImage.js +21 -17
- package/fetcher.js +47 -5
- package/gestures.js +15 -11
- package/index.js +7 -0
- package/notifyState.js +48 -0
- package/package.json +20 -2
- package/plugin.js +39 -0
- package/tooltip.js +34 -15
- package/types/fallbackImage.d.ts +5 -4
- package/types/fetcher.d.ts +60 -10
- package/types/gestures.d.ts +16 -1
- package/types/index.d.ts +4 -1
- package/types/notifyState.d.ts +8 -0
- package/types/plugin.d.ts +4 -0
- package/types/tooltip.d.ts +5 -8
- package/types/utils.d.ts +185 -25
- package/utils.js +154 -14
- package/viewers/GenericViewer.vue +20 -32
- package/viewers/ImageViewer.vue +149 -140
- package/viewers/PdfViewer.vue +27 -35
- package/viewers/TextViewer.vue +134 -136
- package/vite-plugin.js +16 -0
package/tooltip.js
CHANGED
|
@@ -1,19 +1,16 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Tooltip Directive
|
|
3
|
+
*
|
|
4
|
+
* Usage:
|
|
5
|
+
* ```
|
|
6
|
+
* import tooltip from 'pankow/tooltip';
|
|
7
|
+
* app.directive('tooltip', tooltip);
|
|
8
|
+
* // <div v-tooltip.top="'hello'"></div>
|
|
9
|
+
* ```
|
|
10
|
+
*
|
|
11
|
+
* Position modifiers: `.top`, `.left`, `.right` (default: bottom).
|
|
12
|
+
*/
|
|
2
13
|
|
|
3
|
-
Tooltip Directive
|
|
4
|
-
|
|
5
|
-
```
|
|
6
|
-
import tooltip from 'pankow/tooltip';
|
|
7
|
-
|
|
8
|
-
app.directive('tooltip', tooltip);
|
|
9
|
-
|
|
10
|
-
...
|
|
11
|
-
|
|
12
|
-
<div v-tooltip.top="'hello'"></div>
|
|
13
|
-
|
|
14
|
-
```
|
|
15
|
-
|
|
16
|
-
*/
|
|
17
14
|
|
|
18
15
|
const TOP = 1;
|
|
19
16
|
const BOTTOM = 2;
|
|
@@ -73,6 +70,12 @@ function update(target, modifiers, key) {
|
|
|
73
70
|
else tooltips[key].element.style.top = (targetRect.bottom + padding) + 'px';
|
|
74
71
|
}
|
|
75
72
|
|
|
73
|
+
/**
|
|
74
|
+
* Vue directive `mounted` hook. Creates tooltip element on mouseenter.
|
|
75
|
+
* @param {HTMLElement} el
|
|
76
|
+
* @param {import('vue').DirectiveBinding} binding
|
|
77
|
+
* @param {import('vue').VNode} vnode
|
|
78
|
+
*/
|
|
76
79
|
function mounted(el, binding, vnode) {
|
|
77
80
|
// generate running unique id
|
|
78
81
|
el.__pankow_id = id++;
|
|
@@ -112,6 +115,12 @@ function mounted(el, binding, vnode) {
|
|
|
112
115
|
|
|
113
116
|
}
|
|
114
117
|
|
|
118
|
+
/**
|
|
119
|
+
* Vue directive `updated` hook. Updates tooltip text and position.
|
|
120
|
+
* @param {HTMLElement} el
|
|
121
|
+
* @param {import('vue').DirectiveBinding} binding
|
|
122
|
+
* @param {import('vue').VNode} vnode
|
|
123
|
+
*/
|
|
115
124
|
function updated(el, binding, vnode) {
|
|
116
125
|
if (!tooltips[el.__pankow_id]) return;
|
|
117
126
|
|
|
@@ -123,6 +132,12 @@ function updated(el, binding, vnode) {
|
|
|
123
132
|
update(el, binding.modifiers, el.__pankow_id);
|
|
124
133
|
}
|
|
125
134
|
|
|
135
|
+
/**
|
|
136
|
+
* Vue directive `beforeUnmount` hook. Removes tooltip element and cleans up.
|
|
137
|
+
* @param {HTMLElement} el
|
|
138
|
+
* @param {import('vue').DirectiveBinding} binding
|
|
139
|
+
* @param {import('vue').VNode} vnode
|
|
140
|
+
*/
|
|
126
141
|
function beforeUnmount(el, binding, vnode) {
|
|
127
142
|
if (!tooltips[el.__pankow_id]) return;
|
|
128
143
|
|
|
@@ -130,6 +145,10 @@ function beforeUnmount(el, binding, vnode) {
|
|
|
130
145
|
delete tooltips[el.__pankow_id];
|
|
131
146
|
}
|
|
132
147
|
|
|
148
|
+
/**
|
|
149
|
+
* Vue directive for tooltips. Register via `app.directive('tooltip', tooltip)`.
|
|
150
|
+
* @type {import('vue').Directive}
|
|
151
|
+
*/
|
|
133
152
|
const tooltip = {
|
|
134
153
|
mounted,
|
|
135
154
|
updated,
|
package/types/fallbackImage.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export default fallbackImage;
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
}
|
|
5
|
-
|
|
2
|
+
/**
|
|
3
|
+
* Vue directive for image fallback. Register via `app.directive('fallback-image', fallbackImage)`.
|
|
4
|
+
* @type {import('vue').Directive}
|
|
5
|
+
*/
|
|
6
|
+
declare const fallbackImage: import("vue").Directive;
|
package/types/fetcher.d.ts
CHANGED
|
@@ -8,33 +8,83 @@ declare namespace _default {
|
|
|
8
8
|
export { del as delete };
|
|
9
9
|
}
|
|
10
10
|
export default _default;
|
|
11
|
+
/**
|
|
12
|
+
* Shared configuration for all HTTP requests.
|
|
13
|
+
*/
|
|
14
|
+
export type FetcherGlobalOptions = {
|
|
15
|
+
/**
|
|
16
|
+
* - Fetch credentials mode
|
|
17
|
+
*/
|
|
18
|
+
credentials: string;
|
|
19
|
+
/**
|
|
20
|
+
* - Fetch redirect mode
|
|
21
|
+
*/
|
|
22
|
+
redirect: string;
|
|
23
|
+
/**
|
|
24
|
+
* - Called on non-2xx responses or network errors
|
|
25
|
+
*/
|
|
26
|
+
errorHook: ((arg0: Response | Error) => void) | null;
|
|
27
|
+
};
|
|
11
28
|
declare namespace globalOptions {
|
|
12
29
|
let credentials: string;
|
|
13
30
|
let redirect: string;
|
|
14
31
|
let errorHook: null;
|
|
15
32
|
}
|
|
16
|
-
/**
|
|
17
|
-
|
|
33
|
+
/**
|
|
34
|
+
* Sends a HEAD request.
|
|
35
|
+
* @param {string} uri
|
|
36
|
+
* @param {Object} [query={}] - Query parameters serialized as URL query string
|
|
37
|
+
* @param {RequestInit} [options={}] - Merged into `fetch()`; use `{ signal }` to abort
|
|
38
|
+
* @returns {Promise<{ status: number, body: * }>}
|
|
39
|
+
*/
|
|
40
|
+
declare function head(uri: string, query?: Object, options?: RequestInit): Promise<{
|
|
18
41
|
status: number;
|
|
19
42
|
body: any;
|
|
20
43
|
}>;
|
|
21
|
-
/**
|
|
22
|
-
|
|
44
|
+
/**
|
|
45
|
+
* Sends a GET request.
|
|
46
|
+
* @param {string} uri
|
|
47
|
+
* @param {Object} [query={}] - Query parameters serialized as URL query string
|
|
48
|
+
* @param {RequestInit} [options={}] - Merged into `fetch()`; use `{ signal }` to abort
|
|
49
|
+
* @returns {Promise<{ status: number, body: * }>}
|
|
50
|
+
*/
|
|
51
|
+
declare function get(uri: string, query?: Object, options?: RequestInit): Promise<{
|
|
23
52
|
status: number;
|
|
24
53
|
body: any;
|
|
25
54
|
}>;
|
|
26
|
-
/**
|
|
27
|
-
|
|
55
|
+
/**
|
|
56
|
+
* Sends a POST request with a JSON or FormData body.
|
|
57
|
+
* @param {string} uri
|
|
58
|
+
* @param {Object|FormData} body - Request body; objects are JSON-stringified
|
|
59
|
+
* @param {Object} [query={}] - Query parameters serialized as URL query string
|
|
60
|
+
* @param {RequestInit} [options={}] - Merged into `fetch()`; use `{ signal }` to abort
|
|
61
|
+
* @returns {Promise<{ status: number, body: * }>}
|
|
62
|
+
*/
|
|
63
|
+
declare function post(uri: string, body: Object | FormData, query?: Object, options?: RequestInit): Promise<{
|
|
28
64
|
status: number;
|
|
29
65
|
body: any;
|
|
30
66
|
}>;
|
|
31
|
-
/**
|
|
32
|
-
|
|
67
|
+
/**
|
|
68
|
+
* Sends a PUT request with a JSON or FormData body.
|
|
69
|
+
* @param {string} uri
|
|
70
|
+
* @param {Object|FormData} body - Request body; objects are JSON-stringified
|
|
71
|
+
* @param {Object} [query={}] - Query parameters serialized as URL query string
|
|
72
|
+
* @param {RequestInit} [options={}] - Merged into `fetch()`; use `{ signal }` to abort
|
|
73
|
+
* @returns {Promise<{ status: number, body: * }>}
|
|
74
|
+
*/
|
|
75
|
+
declare function put(uri: string, body: Object | FormData, query?: Object, options?: RequestInit): Promise<{
|
|
33
76
|
status: number;
|
|
34
77
|
body: any;
|
|
35
78
|
}>;
|
|
36
|
-
/**
|
|
37
|
-
|
|
79
|
+
/**
|
|
80
|
+
* Sends a DELETE request with an optional body.
|
|
81
|
+
* @param {string} uri
|
|
82
|
+
* @param {Object|FormData} body - Request body; objects are JSON-stringified
|
|
83
|
+
* @param {Object} [query={}] - Query parameters serialized as URL query string
|
|
84
|
+
* @param {RequestInit} [options={}] - Merged into `fetch()`; use `{ signal }` to abort
|
|
85
|
+
* @returns {Promise<{ status: number, body: * }>}
|
|
86
|
+
*/
|
|
87
|
+
declare function del(uri: string, body: Object | FormData, query?: Object, options?: RequestInit): Promise<{
|
|
38
88
|
status: number;
|
|
39
89
|
body: any;
|
|
40
90
|
}>;
|
package/types/gestures.d.ts
CHANGED
|
@@ -2,4 +2,19 @@ declare namespace _default {
|
|
|
2
2
|
export { onSwipe };
|
|
3
3
|
}
|
|
4
4
|
export default _default;
|
|
5
|
-
|
|
5
|
+
/**
|
|
6
|
+
* Swipe handler
|
|
7
|
+
*
|
|
8
|
+
* Usage:
|
|
9
|
+
* ```
|
|
10
|
+
* import { onSwipe } from 'pankow/gestures';
|
|
11
|
+
* onSwipe(element, (direction) => {});
|
|
12
|
+
* ```
|
|
13
|
+
*/
|
|
14
|
+
/**
|
|
15
|
+
* Registers touch event listeners on an element and calls the callback on swipe.
|
|
16
|
+
* @param {HTMLElement} elem
|
|
17
|
+
* @param {function('left'|'right'|'up'|'down'): void} callback
|
|
18
|
+
* @param {number} [threshold=50] - Minimum pixel distance to trigger a swipe
|
|
19
|
+
*/
|
|
20
|
+
export function onSwipe(elem: HTMLElement, callback: (arg0: "left" | "right" | "up" | "down") => void, threshold?: number): void;
|
package/types/index.d.ts
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
|
+
export { useNotify } from "./notifyState.js";
|
|
2
|
+
export default pankowPlugin;
|
|
1
3
|
import fetcher from './fetcher.js';
|
|
2
4
|
import gestures from './gestures.js';
|
|
3
5
|
import tooltip from './tooltip.js';
|
|
4
6
|
import fallbackImage from './fallbackImage.js';
|
|
5
7
|
import utils from './utils.js';
|
|
6
|
-
|
|
8
|
+
import pankowPlugin from './plugin.js';
|
|
9
|
+
export { BottomBar, BreadCrumb, Button, ButtonGroup, ClipboardAction, ClipboardButton, CheckBox, DateTimeInput, Dialog, DirectoryView, EmailInput, FileUploader, FormGroup, InputGroup, Icon, ListItem, InputDialog, LoginView, MainLayout, MaskedInput, Menu, MenuItem, SingleSelect, MultiSelect, Notification, NumberInput, OfflineBanner, PasswordInput, Popover, ProgressBar, RadioButton, SectionItem, SideBar, SplitLayout, Spinner, Switch, TableView, TableViewActionBar, TabView, TagInput, TextInput, TextInputRaw, TopBar, TreeView, fetcher, gestures, tooltip, fallbackImage, utils, CheckBox as Checkbox, RadioButton as Radiobutton, BreadCrumb as Breadcrumb };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export const messages: import("vue").Reactive<never[]>;
|
|
2
|
+
export const position: import("vue").Ref<string, string>;
|
|
3
|
+
export function pushNotify(options: any): void;
|
|
4
|
+
export function removeNotify(id: any): void;
|
|
5
|
+
export function setNotifyPosition(pos: any): void;
|
|
6
|
+
export function useNotify(): {
|
|
7
|
+
notify: typeof pushNotify;
|
|
8
|
+
};
|
package/types/tooltip.d.ts
CHANGED
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
export default tooltip;
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
declare function mounted(el: any, binding: any, vnode: any): void;
|
|
8
|
-
declare function updated(el: any, binding: any, vnode: any): void;
|
|
9
|
-
declare function beforeUnmount(el: any, binding: any, vnode: any): void;
|
|
2
|
+
/**
|
|
3
|
+
* Vue directive for tooltips. Register via `app.directive('tooltip', tooltip)`.
|
|
4
|
+
* @type {import('vue').Directive}
|
|
5
|
+
*/
|
|
6
|
+
declare const tooltip: import("vue").Directive;
|
package/types/utils.d.ts
CHANGED
|
@@ -26,35 +26,195 @@ declare namespace _default {
|
|
|
26
26
|
export { uuidv4 };
|
|
27
27
|
}
|
|
28
28
|
export default _default;
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
export function
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
export function
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
29
|
+
/**
|
|
30
|
+
* Extracts the MIME type group from an item (e.g. "image" from "image/png").
|
|
31
|
+
* @param {{ mimeType: string }} item
|
|
32
|
+
* @returns {string}
|
|
33
|
+
* @throws {string} If item has no mimeType string property
|
|
34
|
+
*/
|
|
35
|
+
export function getFileTypeGroup(item: {
|
|
36
|
+
mimeType: string;
|
|
37
|
+
}): string;
|
|
38
|
+
/**
|
|
39
|
+
* Looks up a translation string by dot-separated key (e.g. "filemanager.title").
|
|
40
|
+
* Falls back to the key itself if the translation is not found.
|
|
41
|
+
* @param {string} id - Dot-separated translation key
|
|
42
|
+
* @returns {string}
|
|
43
|
+
*/
|
|
44
|
+
export function translation(id: string): string;
|
|
45
|
+
/**
|
|
46
|
+
* Creates a debounced reactive ref that delays value updates.
|
|
47
|
+
* @see https://vuejs.org/api/reactivity-advanced.html#customref
|
|
48
|
+
* @param {any} value
|
|
49
|
+
* @param {number} [delay=300] - Debounce delay in milliseconds
|
|
50
|
+
* @returns {import('vue').Ref}
|
|
51
|
+
*/
|
|
52
|
+
export function useDebouncedRef(value: any, delay?: number): import("vue").Ref;
|
|
53
|
+
/**
|
|
54
|
+
* Validates whether a string is a valid domain name.
|
|
55
|
+
* @param {string} domain
|
|
56
|
+
* @returns {boolean}
|
|
57
|
+
*/
|
|
58
|
+
export function isValidDomain(domain: string): boolean;
|
|
59
|
+
/**
|
|
60
|
+
* Validates whether a string is a valid domain or URL (extracts hostname from URLs first).
|
|
61
|
+
* @param {string} domain
|
|
62
|
+
* @returns {boolean}
|
|
63
|
+
*/
|
|
64
|
+
export function isValidDomainOrURL(domain: string): boolean;
|
|
65
|
+
/**
|
|
66
|
+
* Validates whether a string is a valid email address.
|
|
67
|
+
* Does not match: quoted local-parts, IP-literal domains, comments, or internationalized addresses.
|
|
68
|
+
* @param {string} email
|
|
69
|
+
* @returns {boolean}
|
|
70
|
+
*/
|
|
71
|
+
export function isValidEmail(email: string): boolean;
|
|
72
|
+
/**
|
|
73
|
+
* Formats a byte count into human-readable IEC binary units (KiB, MiB, GiB, TiB).
|
|
74
|
+
* @see https://en.wikipedia.org/wiki/Binary_prefix
|
|
75
|
+
* @param {number} size - Byte count; -1 returns "Unlimited"
|
|
76
|
+
* @param {string|number} [fallback] - Value returned when size is falsy (0, null, undefined)
|
|
77
|
+
* @returns {string|number}
|
|
78
|
+
*/
|
|
79
|
+
export function prettyBinarySize(size: number, fallback?: string | number): string | number;
|
|
80
|
+
/**
|
|
81
|
+
* Formats a byte count into human-readable SI decimal units (kB, MB, GB, TB).
|
|
82
|
+
* @param {number} size - Byte count
|
|
83
|
+
* @param {string|number} [fallback] - Value returned when size is falsy
|
|
84
|
+
* @returns {string|number}
|
|
85
|
+
*/
|
|
86
|
+
export function prettyDecimalSize(size: number, fallback?: string | number): string | number;
|
|
87
|
+
/**
|
|
88
|
+
* Formats a value as a human-friendly relative time offset from now (e.g. "2 days ago").
|
|
89
|
+
* @param {string|number} value - Date string or timestamp; falsy returns "never"
|
|
90
|
+
* @returns {string}
|
|
91
|
+
*/
|
|
92
|
+
export function prettyDate(value: string | number): string;
|
|
93
|
+
/**
|
|
94
|
+
* Formats a value as a short time string (medium time style via Intl.DateTimeFormat).
|
|
95
|
+
* @param {string|number} value - Date string or timestamp; falsy returns "unknown"
|
|
96
|
+
* @returns {string}
|
|
97
|
+
*/
|
|
98
|
+
export function prettyShortDate(value: string | number): string;
|
|
99
|
+
/**
|
|
100
|
+
* Formats a date using a named format preset.
|
|
101
|
+
* @param {'hh:mm A'|'hh:mm:ss A'|'DD MMM'|'DD MMM hh:mm A'} format - Preset format key
|
|
102
|
+
* @param {string|number} value - Date string or timestamp
|
|
103
|
+
* @returns {string}
|
|
104
|
+
*/
|
|
105
|
+
export function formatDate(format: "hh:mm A" | "hh:mm:ss A" | "DD MMM" | "DD MMM hh:mm A", value: string | number): string;
|
|
106
|
+
/**
|
|
107
|
+
* Formats a value as a long date string (day, month, year, time).
|
|
108
|
+
* @param {string|number} value - Date string or timestamp; falsy returns "unknown"
|
|
109
|
+
* @returns {string}
|
|
110
|
+
*/
|
|
111
|
+
export function prettyLongDate(value: string | number): string;
|
|
112
|
+
/**
|
|
113
|
+
* Formats a numeric value as a human-readable file size string (uses the `filesize` library).
|
|
114
|
+
* @param {number} value - Byte count
|
|
115
|
+
* @returns {string}
|
|
116
|
+
*/
|
|
117
|
+
export function prettyFileSize(value: number): string;
|
|
118
|
+
/**
|
|
119
|
+
* Strips angle brackets from email address strings or arrays.
|
|
120
|
+
* @param {string|string[]} addresses - Format: "<name@example.com>"; returns empty string if falsy
|
|
121
|
+
* @returns {string}
|
|
122
|
+
*/
|
|
123
|
+
export function prettyEmailAddresses(addresses: string | string[]): string;
|
|
124
|
+
/**
|
|
125
|
+
* Formats milliseconds as a human-readable duration string using Intl.DurationFormat.
|
|
126
|
+
* @param {number} ms - Duration in milliseconds
|
|
127
|
+
* @returns {string}
|
|
128
|
+
*/
|
|
129
|
+
export function prettyDuration(ms: number): string;
|
|
130
|
+
/**
|
|
131
|
+
* Normalizes a file path: ensures leading slash and collapses consecutive slashes.
|
|
132
|
+
* @param {string} path
|
|
133
|
+
* @returns {string}
|
|
134
|
+
*/
|
|
135
|
+
export function sanitize(path: string): string;
|
|
136
|
+
/**
|
|
137
|
+
* Joins path segments and normalizes the result (via sanitize).
|
|
138
|
+
* @param {...string} args - Path segments to join
|
|
139
|
+
* @returns {string}
|
|
140
|
+
*/
|
|
141
|
+
export function pathJoin(...args: string[]): string;
|
|
142
|
+
/**
|
|
143
|
+
* Triggers a file download via the browser. Single entry: direct download.
|
|
144
|
+
* Multiple entries: zipped archive download via /api/v1/download.
|
|
145
|
+
* @param {Array<{ filePath: string, share?: { id: string } }>} entries - File entries to download
|
|
146
|
+
* @param {string} [name] - Archive name for multi-file downloads
|
|
147
|
+
* @returns {void}
|
|
148
|
+
*/
|
|
149
|
+
export function download(entries: Array<{
|
|
150
|
+
filePath: string;
|
|
151
|
+
share?: {
|
|
152
|
+
id: string;
|
|
153
|
+
};
|
|
154
|
+
}>, name?: string): void;
|
|
155
|
+
/**
|
|
156
|
+
* Extracts the file extension from a file entry. Does not detect double extensions (e.g. .tar.gz).
|
|
157
|
+
* @param {{ isFile: boolean, fileName: string }} entry
|
|
158
|
+
* @returns {string} Extension without leading dot (empty string for directories or files without extension)
|
|
159
|
+
*/
|
|
160
|
+
export function getExtension(entry: {
|
|
161
|
+
isFile: boolean;
|
|
162
|
+
fileName: string;
|
|
163
|
+
}): string;
|
|
164
|
+
/**
|
|
165
|
+
* Copies a string to the system clipboard using a temporary input element.
|
|
166
|
+
* @param {string} value
|
|
167
|
+
* @returns {void}
|
|
168
|
+
* @deprecated Prefer the native `navigator.clipboard.writeText()` API.
|
|
169
|
+
*/
|
|
170
|
+
export function copyToClipboard(value: string): void;
|
|
171
|
+
/**
|
|
172
|
+
* Parses the current page's URL query string into a key/value object.
|
|
173
|
+
* @returns {Object<string, string>}
|
|
174
|
+
*/
|
|
175
|
+
export function urlSearchQuery(): {
|
|
176
|
+
[x: string]: string;
|
|
177
|
+
};
|
|
178
|
+
/**
|
|
179
|
+
* Parses a Cloudron resource path into its components (type, path, shareId, apiPath).
|
|
180
|
+
* Handles paths like "files/folder/filename" or "shares/:shareId/folder/filename".
|
|
181
|
+
* @param {string} resourcePath
|
|
182
|
+
* @returns {{ type: string, path: string, shareId: string, apiPath: string, resourcePath: string }}
|
|
183
|
+
*/
|
|
184
|
+
export function parseResourcePath(resourcePath: string): {
|
|
51
185
|
type: string;
|
|
52
186
|
path: string;
|
|
53
187
|
shareId: string;
|
|
54
188
|
apiPath: string;
|
|
55
189
|
resourcePath: string;
|
|
56
190
|
};
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
191
|
+
/**
|
|
192
|
+
* Generates a unique identifier for a file entry, including its share ID if present.
|
|
193
|
+
* @param {{ share?: { id: string }, filePath: string }} entry
|
|
194
|
+
* @returns {string}
|
|
195
|
+
*/
|
|
196
|
+
export function getEntryIdentifier(entry: {
|
|
197
|
+
share?: {
|
|
198
|
+
id: string;
|
|
199
|
+
};
|
|
200
|
+
filePath: string;
|
|
201
|
+
}): string;
|
|
202
|
+
/**
|
|
203
|
+
* Sorts an array of objects by a given property, case-insensitive for strings.
|
|
204
|
+
* @param {Array<Object>} list - Array of objects to sort
|
|
205
|
+
* @param {string} prop - Property name to sort by
|
|
206
|
+
* @param {boolean} desc - If falsey, reverses the sort (descending order)
|
|
207
|
+
* @returns {Array<Object>}
|
|
208
|
+
*/
|
|
209
|
+
export function entryListSort(list: Array<Object>, prop: string, desc: boolean): Array<Object>;
|
|
210
|
+
/**
|
|
211
|
+
* Returns a promise that resolves after the specified number of milliseconds.
|
|
212
|
+
* @param {number} ms
|
|
213
|
+
* @returns {Promise<void>}
|
|
214
|
+
*/
|
|
215
|
+
export function sleep(ms: number): Promise<void>;
|
|
216
|
+
/**
|
|
217
|
+
* Generates a random UUID v4 string using crypto.getRandomValues.
|
|
218
|
+
* @returns {string}
|
|
219
|
+
*/
|
|
60
220
|
export function uuidv4(): string;
|