@putkoff/abstract-securefiles 0.0.33 → 0.0.34

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 (181) hide show
  1. package/css.d.ts +0 -0
  2. package/dist/App/SecureFiles.d.ts +4 -0
  3. package/dist/App/index.d.ts +1 -0
  4. package/dist/FileHandlers/FileRow/imports.d.ts +2 -0
  5. package/dist/FileHandlers/FileRow/index.d.ts +1 -0
  6. package/dist/FileHandlers/FileRow/src/index.d.ts +1 -0
  7. package/dist/FileHandlers/FileRow/src/row_utils.d.ts +2 -0
  8. package/dist/FileHandlers/FileTable/imports.d.ts +4 -0
  9. package/dist/FileHandlers/FileTable/index.d.ts +1 -0
  10. package/dist/FileHandlers/FileTable/src/index.d.ts +1 -0
  11. package/dist/FileHandlers/FileTable/src/table_utils.d.ts +2 -0
  12. package/dist/FileHandlers/ShareModal/imports.d.ts +2 -0
  13. package/dist/FileHandlers/ShareModal/index.d.ts +1 -0
  14. package/dist/FileHandlers/ShareModal/src/index.d.ts +1 -0
  15. package/dist/FileHandlers/ShareModal/src/share_utils.d.ts +2 -0
  16. package/dist/FileHandlers/Upload/imports.d.ts +2 -0
  17. package/dist/FileHandlers/Upload/index.d.ts +1 -0
  18. package/dist/FileHandlers/Upload/src/index.d.ts +2 -0
  19. package/dist/FileHandlers/Upload/src/upload_utils.d.ts +2 -0
  20. package/dist/FileHandlers/imports.d.ts +4 -0
  21. package/dist/FileHandlers/index.d.ts +4 -0
  22. package/dist/UI/index.d.ts +28 -0
  23. package/dist/file_utils/imports.d.ts +2 -0
  24. package/dist/file_utils/index.d.ts +1 -0
  25. package/dist/file_utils/src/cookieFetch.d.ts +22 -0
  26. package/dist/file_utils/src/delete_utils/imports.d.ts +1 -0
  27. package/dist/file_utils/src/delete_utils/index.d.ts +1 -0
  28. package/dist/file_utils/src/delete_utils/src/delete_row.d.ts +2 -0
  29. package/dist/file_utils/src/delete_utils/src/delete_select.d.ts +4 -0
  30. package/dist/file_utils/src/delete_utils/src/delete_selected.d.ts +2 -0
  31. package/dist/file_utils/src/delete_utils/src/index.d.ts +3 -0
  32. package/dist/file_utils/src/download_utils/imports.d.ts +2 -0
  33. package/dist/file_utils/src/download_utils/index.d.ts +1 -0
  34. package/dist/file_utils/src/download_utils/src/direct_download.d.ts +3 -0
  35. package/dist/file_utils/src/download_utils/src/download_file.d.ts +6 -0
  36. package/dist/file_utils/src/download_utils/src/download_select.d.ts +2 -0
  37. package/dist/file_utils/src/download_utils/src/index.d.ts +5 -0
  38. package/dist/file_utils/src/download_utils/src/target_downloads.d.ts +4 -0
  39. package/dist/file_utils/src/download_utils/src/trigger_download.d.ts +2 -0
  40. package/dist/file_utils/src/imports.d.ts +2 -0
  41. package/dist/file_utils/src/index.d.ts +6 -0
  42. package/dist/file_utils/src/list_utils/imports.d.ts +2 -0
  43. package/dist/file_utils/src/list_utils/index.d.ts +1 -0
  44. package/dist/file_utils/src/list_utils/src/index.d.ts +1 -0
  45. package/dist/file_utils/src/list_utils/src/list_utils.d.ts +2 -0
  46. package/dist/file_utils/src/select_utils/index.d.ts +1 -0
  47. package/dist/file_utils/src/select_utils/src/index.d.ts +3 -0
  48. package/dist/file_utils/src/select_utils/src/init_select_all.d.ts +2 -0
  49. package/dist/file_utils/src/select_utils/src/sync_header_checkbox.d.ts +5 -0
  50. package/dist/file_utils/src/select_utils/src/toggle_checkboxes.d.ts +2 -0
  51. package/dist/file_utils/src/share_utils/imports.d.ts +2 -0
  52. package/dist/file_utils/src/share_utils/index.d.ts +1 -0
  53. package/dist/file_utils/src/share_utils/src/index.d.ts +1 -0
  54. package/dist/file_utils/src/share_utils/src/share_utils.d.ts +7 -0
  55. package/{package.tmp.json → dist/file_utils/src/upload_utils/imports.d.ts} +0 -0
  56. package/dist/file_utils/src/upload_utils/index.d.ts +1 -0
  57. package/dist/file_utils/src/upload_utils/src/index.d.ts +3 -0
  58. package/dist/file_utils/src/upload_utils/src/patch_file_settings.d.ts +2 -0
  59. package/dist/file_utils/src/upload_utils/src/upload_file.d.ts +2 -0
  60. package/dist/file_utils/src/upload_utils/src/upload_files.d.ts +5 -0
  61. package/dist/hooks/imports.d.ts +3 -0
  62. package/dist/hooks/index.d.ts +1 -0
  63. package/dist/hooks/useFiles/imports.d.ts +2 -0
  64. package/dist/hooks/useFiles/index.d.ts +1 -0
  65. package/dist/hooks/useFiles/src/deleteFile.d.ts +3 -0
  66. package/dist/hooks/useFiles/src/index.d.ts +6 -0
  67. package/dist/hooks/useFiles/src/load.d.ts +3 -0
  68. package/dist/hooks/useFiles/src/patchShareSettings.d.ts +3 -0
  69. package/dist/hooks/useFiles/src/toggleShare.d.ts +3 -0
  70. package/dist/hooks/useFiles/src/useFiles.d.ts +13 -0
  71. package/dist/hooks/useFiles/src/useSaveShareSettings.d.ts +7 -0
  72. package/dist/imports.d.ts +7 -0
  73. package/dist/index.cjs +992 -8
  74. package/dist/index.cjs.map +1 -1
  75. package/dist/index.css +1 -1
  76. package/dist/index.d.ts +8 -1
  77. package/dist/index.js +945 -10
  78. package/dist/index.js.map +1 -1
  79. package/dist/styles/index.d.ts +1 -0
  80. package/dist/types/index.d.ts +1 -0
  81. package/dist/types/src/index.d.ts +1 -0
  82. package/dist/types/src/types.d.ts +75 -0
  83. package/index.ts +0 -0
  84. package/package.json +4 -4
  85. package/postcss.config.cjs +0 -0
  86. package/rollup.config.js +0 -0
  87. package/rollup.config.mjs +0 -0
  88. package/src/App/SecureFiles.tsx +45 -0
  89. package/src/App/index.ts +1 -0
  90. package/src/FileHandlers/FileRow/imports.ts +2 -0
  91. package/src/FileHandlers/FileRow/index.ts +1 -0
  92. package/src/FileHandlers/FileRow/src/index.ts +1 -0
  93. package/src/FileHandlers/FileRow/src/row_utils.tsx +143 -0
  94. package/src/FileHandlers/FileTable/imports.ts +16 -0
  95. package/src/FileHandlers/FileTable/index.ts +1 -0
  96. package/src/FileHandlers/FileTable/src/index.ts +1 -0
  97. package/src/FileHandlers/FileTable/src/table_utils.tsx +251 -0
  98. package/src/FileHandlers/ShareModal/imports.ts +2 -0
  99. package/src/FileHandlers/ShareModal/index.ts +1 -0
  100. package/src/FileHandlers/ShareModal/src/index.ts +1 -0
  101. package/src/FileHandlers/ShareModal/src/share_utils.tsx +155 -0
  102. package/src/FileHandlers/Upload/imports.ts +3 -0
  103. package/src/FileHandlers/Upload/index.ts +1 -0
  104. package/src/FileHandlers/Upload/src/index.ts +2 -0
  105. package/src/FileHandlers/Upload/src/upload_utils.tsx +267 -0
  106. package/src/FileHandlers/imports.ts +18 -0
  107. package/src/FileHandlers/index.ts +4 -0
  108. package/src/UI/index.tsx +122 -0
  109. package/src/custom.d.ts +7 -0
  110. package/src/file_utils/imports.ts +2 -0
  111. package/src/file_utils/index.ts +1 -0
  112. package/src/file_utils/src/cookieFetch.ts +78 -0
  113. package/src/file_utils/src/delete_utils/imports.ts +1 -0
  114. package/src/file_utils/src/delete_utils/index.ts +1 -0
  115. package/src/file_utils/src/delete_utils/src/delete_row.ts +11 -0
  116. package/src/file_utils/src/delete_utils/src/delete_select.ts +10 -0
  117. package/src/file_utils/src/delete_utils/src/delete_selected.ts +15 -0
  118. package/src/file_utils/src/delete_utils/src/index.ts +3 -0
  119. package/src/file_utils/src/download_utils/imports.ts +3 -0
  120. package/src/file_utils/src/download_utils/index.ts +1 -0
  121. package/src/file_utils/src/download_utils/src/direct_download.ts +22 -0
  122. package/src/file_utils/src/download_utils/src/download_file.ts +25 -0
  123. package/src/file_utils/src/download_utils/src/download_select.ts +20 -0
  124. package/src/file_utils/src/download_utils/src/index.ts +5 -0
  125. package/src/file_utils/src/download_utils/src/target_downloads.ts +21 -0
  126. package/src/file_utils/src/download_utils/src/trigger_download.ts +14 -0
  127. package/src/file_utils/src/imports.ts +3 -0
  128. package/src/file_utils/src/index.ts +6 -0
  129. package/src/file_utils/src/list_utils/imports.ts +2 -0
  130. package/src/file_utils/src/list_utils/index.ts +1 -0
  131. package/src/file_utils/src/list_utils/src/index.ts +1 -0
  132. package/src/file_utils/src/list_utils/src/list_utils.ts +28 -0
  133. package/src/file_utils/src/select_utils/index.ts +1 -0
  134. package/src/file_utils/src/select_utils/src/index.ts +3 -0
  135. package/src/file_utils/src/select_utils/src/init_select_all.ts +37 -0
  136. package/src/file_utils/src/select_utils/src/sync_header_checkbox.ts +18 -0
  137. package/src/file_utils/src/select_utils/src/toggle_checkboxes.ts +11 -0
  138. package/src/file_utils/src/share_utils/imports.ts +2 -0
  139. package/src/file_utils/src/share_utils/index.ts +1 -0
  140. package/src/file_utils/src/share_utils/src/index.ts +1 -0
  141. package/src/file_utils/src/share_utils/src/share_utils.ts +20 -0
  142. package/src/file_utils/src/upload_utils/imports.ts +1 -0
  143. package/src/file_utils/src/upload_utils/index.ts +1 -0
  144. package/src/file_utils/src/upload_utils/src/index.ts +3 -0
  145. package/src/file_utils/src/upload_utils/src/patch_file_settings.ts +20 -0
  146. package/src/file_utils/src/upload_utils/src/upload_file.ts +27 -0
  147. package/src/file_utils/src/upload_utils/src/upload_files.ts +19 -0
  148. package/src/global.d.ts +1 -0
  149. package/src/hooks/imports.ts +3 -0
  150. package/src/hooks/index.ts +1 -0
  151. package/src/hooks/useFiles/imports.ts +3 -0
  152. package/src/hooks/useFiles/index.ts +1 -0
  153. package/src/hooks/useFiles/src/deleteFile.ts +23 -0
  154. package/src/hooks/useFiles/src/index.ts +6 -0
  155. package/src/hooks/useFiles/src/load.ts +39 -0
  156. package/src/hooks/useFiles/src/logs/clipit_logs.log +0 -0
  157. package/src/hooks/useFiles/src/logs/routes_bp.log +0 -0
  158. package/src/hooks/useFiles/src/patchShareSettings.ts +27 -0
  159. package/src/hooks/useFiles/src/toggleShare.ts +28 -0
  160. package/src/hooks/useFiles/src/useFiles.ts +35 -0
  161. package/src/hooks/useFiles/src/useSaveShareSettings.ts +31 -0
  162. package/src/imports.ts +19 -0
  163. package/src/index.ts +8 -1
  164. package/src/styles/{App.css → SecureFiles/App.css} +0 -0
  165. package/src/styles/{index.css → SecureFiles/index.css} +0 -0
  166. package/src/styles/SecureFiles/logs/clipit_logs.log +0 -0
  167. package/src/styles/SecureFiles/logs/routes_bp.log +0 -0
  168. package/src/styles/{tailwind.css → SecureFiles/tailwind.css} +0 -0
  169. package/src/styles/{window-manager.css → SecureFiles/window-manager.css} +0 -0
  170. package/src/styles/SecureFilesStyles.module.css +287 -0
  171. package/src/styles/index.ts +1 -0
  172. package/src/types/index.ts +1 -0
  173. package/src/types/src/index.ts +1 -0
  174. package/src/types/src/types.ts +88 -0
  175. package/tailwind.config.cjs +0 -0
  176. package/testit.mjs +0 -0
  177. package/testit.ts +0 -0
  178. package/tsconfig.json +0 -0
  179. package/.github/workflows/release.yml +0 -17
  180. package/dist/secure_files.d.ts +0 -4
  181. package/src/secure_files.tsx +0 -41
@@ -0,0 +1,19 @@
1
+ import { cookieUpload } from '../../../../file_utils/src/cookieFetch';
2
+
3
+ interface UploadResponse {
4
+ filepath: string;
5
+ }
6
+
7
+ export async function uploadFiles(
8
+ file: File,
9
+ subdir: string = '',
10
+ ): Promise<UploadResponse> {
11
+ if (!(file instanceof File)) throw new Error('Invalid file: must be a File object.');
12
+ if (typeof subdir !== 'string') throw new Error('Invalid subdir: must be a string.');
13
+
14
+ const relPath = subdir.trim() ? `${subdir.trim()}/${file.name}` : file.name;
15
+ const json = await cookieUpload(file, relPath) as { filepath?: string };
16
+
17
+ if (!json?.filepath) throw new Error('Server response missing filepath.');
18
+ return { filepath: json.filepath };
19
+ }
@@ -0,0 +1 @@
1
+ declare module "*.css";
@@ -0,0 +1,3 @@
1
+ export type { FileItem,ApiRow } from './../imports';
2
+ export { secureFetchIt,fetchSharePatch,alertit,useCallback,isLoggedIn} from './../imports';
3
+ export {toggleShare,removeFile,listFiles,downloadFile} from './../file_utils'
@@ -0,0 +1 @@
1
+ export * from './useFiles';
@@ -0,0 +1,3 @@
1
+
2
+ export type { FileItem,ApiRow } from './../imports';
3
+ export { secureFetchIt,fetchSharePatch,alertit,toggleShare,removeFile,listFiles,useCallback,downloadFile,isLoggedIn } from './../imports';
@@ -0,0 +1 @@
1
+ export * from './src';
@@ -0,0 +1,23 @@
1
+ import React from 'react';
2
+ import { useCallback } from './../imports';
3
+ import type { FileItem } from './../imports';
4
+ import { cookieFetch } from '../../../file_utils/src/cookieFetch';
5
+
6
+ export const useDeleteFile = (
7
+ setFiles: React.Dispatch<React.SetStateAction<FileItem[]>>,
8
+ ) => {
9
+ return useCallback(
10
+ async (file: FileItem | FileItem[]) => {
11
+ const targets = Array.isArray(file) ? file : [file];
12
+ for (const f of targets) {
13
+ try {
14
+ await cookieFetch("remove", { id: f.id }, "POST");
15
+ setFiles(curr => curr.filter(item => item.id !== f.id));
16
+ } catch (err) {
17
+ console.error(`Failed to delete "${f.filename}":`, err);
18
+ }
19
+ }
20
+ },
21
+ [setFiles],
22
+ );
23
+ };
@@ -0,0 +1,6 @@
1
+ export * from './load';
2
+ export * from './toggleShare';
3
+ export * from './patchShareSettings';
4
+ export * from './useFiles';
5
+ export * from './deleteFile';
6
+ export * from './useSaveShareSettings';
@@ -0,0 +1,39 @@
1
+ import React from 'react';
2
+ import { useCallback } from './../imports';
3
+ import type { FileItem, ApiRow } from './../imports';
4
+ import { cookieFetch } from '../../../file_utils/src/cookieFetch';
5
+
6
+ export const useLoadFiles = (
7
+ setLoading: React.Dispatch<React.SetStateAction<boolean>>,
8
+ setError: React.Dispatch<React.SetStateAction<Error | null>>,
9
+ setFiles: React.Dispatch<React.SetStateAction<FileItem[]>>,
10
+ ) => {
11
+ return useCallback(async () => {
12
+ setLoading(true);
13
+ setError(null);
14
+ try {
15
+ const result = await cookieFetch<ApiRow[] | { result: ApiRow[] }>("list", undefined, "GET");
16
+ const apiRows: ApiRow[] = Array.isArray(result)
17
+ ? result
18
+ : ((result as any)?.result ?? []);
19
+
20
+ setFiles(apiRows.map((r: ApiRow) => ({
21
+ id: r.id,
22
+ filename: r.filename,
23
+ uploader_id: r.uploader_id,
24
+ filepath: r.filepath,
25
+ created_at: r.created_at,
26
+ download_count: r.download_count,
27
+ download_limit: r.download_limit,
28
+ shareable: Boolean(r.shareable),
29
+ needsPassword: !!r.share_password,
30
+ share_password: r.share_password,
31
+ password_str: r.password_str,
32
+ })));
33
+ } catch (err) {
34
+ setError(err instanceof Error ? err : new Error('Failed to load files'));
35
+ } finally {
36
+ setLoading(false);
37
+ }
38
+ }, [setLoading, setError, setFiles]);
39
+ };
File without changes
File without changes
@@ -0,0 +1,27 @@
1
+ import React from 'react';
2
+ import { useCallback } from './../imports';
3
+ import { cookieFetch } from '../../../file_utils/src/cookieFetch';
4
+
5
+ export const usePatchShareSettings = (
6
+ setFiles: React.Dispatch<React.SetStateAction<any[]>>,
7
+ ) => {
8
+ return useCallback(
9
+ async (file: any) => {
10
+ const body = {
11
+ id: file.id,
12
+ shareable: file.shareable,
13
+ share_password: file.share_password ?? null,
14
+ password_str: file.password_str ?? null,
15
+ download_limit: file.download_limit ?? null,
16
+ };
17
+ try {
18
+ await cookieFetch("files/share", body, "POST");
19
+ setFiles(curr => curr.map(f => f.id === body.id ? { ...f, ...body } : f));
20
+ } catch (err) {
21
+ console.error('Failed to update share settings:', err);
22
+ }
23
+ },
24
+ [setFiles],
25
+ );
26
+ };
27
+ export default usePatchShareSettings;
@@ -0,0 +1,28 @@
1
+ import React from 'react';
2
+ import { useCallback } from './../imports';
3
+ import type { FileItem } from './../imports';
4
+ import { cookieFetch } from '../../../file_utils/src/cookieFetch';
5
+
6
+ export const useToggleShare = (
7
+ setFiles: React.Dispatch<React.SetStateAction<FileItem[]>>,
8
+ ) => {
9
+ return useCallback(
10
+ async (file: FileItem) => {
11
+ const updated: FileItem = { ...file, shareable: !file.shareable };
12
+ if (!updated.shareable) updated.needsPassword = false;
13
+ try {
14
+ await cookieFetch("files/share", {
15
+ id: updated.id,
16
+ shareable: updated.shareable,
17
+ share_password: updated.share_password ?? null,
18
+ password_str: updated.password_str ?? null,
19
+ download_limit: updated.download_limit ?? null,
20
+ }, "POST");
21
+ setFiles(curr => curr.map(f => f.id === file.id ? updated : f));
22
+ } catch (err) {
23
+ console.error('Failed to toggle share:', err);
24
+ }
25
+ },
26
+ [setFiles],
27
+ );
28
+ };
@@ -0,0 +1,35 @@
1
+ import { useState, useEffect } from 'react';
2
+ import type {FileItem} from './../imports';
3
+ import { useLoadFiles } from './load';
4
+ import { useToggleShare } from './toggleShare';
5
+ import {useSaveShareSettings} from './useSaveShareSettings';
6
+ import { useDeleteFile } from './deleteFile';
7
+
8
+ export function useFiles() {
9
+ const [files, setFiles] = useState<FileItem[]>([]);
10
+ const [loading, setLoading] = useState<boolean>(false);
11
+ const [error, setError] = useState<Error | null>(null);
12
+
13
+ const loadCallback = useLoadFiles(setLoading, setError, setFiles);
14
+ const toggleShareCallback = useToggleShare(setFiles);
15
+ const patchShareSettingsCallback = useSaveShareSettings(setFiles);
16
+ const deleteFileCallback = useDeleteFile(setFiles);
17
+
18
+ useEffect(() => {
19
+ loadCallback();
20
+ }, [loadCallback]);
21
+
22
+ return {
23
+ files,
24
+ loading,
25
+ error,
26
+ load: loadCallback,
27
+ toggleShare: toggleShareCallback,
28
+ patchShareSettings: patchShareSettingsCallback,
29
+ deleteFile: deleteFileCallback,
30
+ setFiles,
31
+ setLoading,
32
+ setError,
33
+
34
+ };
35
+ }
@@ -0,0 +1,31 @@
1
+ import React from 'react';
2
+ import { useCallback } from './../imports';
3
+ import { cookieFetch } from '../../../file_utils/src/cookieFetch';
4
+
5
+ /**
6
+ * Hook alias used by useFiles.ts. Patches share settings via the session-cookie
7
+ * authenticated /files/share endpoint.
8
+ */
9
+ export const useSaveShareSettings = (
10
+ setFiles: React.Dispatch<React.SetStateAction<any[]>>,
11
+ ) => {
12
+ return useCallback(
13
+ async (file: any) => {
14
+ const body = {
15
+ id: file.id,
16
+ shareable: file.shareable,
17
+ share_password: file.share_password ?? null,
18
+ password_str: file.password_str ?? null,
19
+ download_limit: file.download_limit ?? null,
20
+ };
21
+ try {
22
+ await cookieFetch("files/share", body, "POST");
23
+ setFiles(curr => curr.map(f => f.id === body.id ? { ...f, ...body } : f));
24
+ } catch (err) {
25
+ console.error('Failed to save share settings:', err);
26
+ }
27
+ },
28
+ [setFiles],
29
+ );
30
+ };
31
+ export default useSaveShareSettings;
package/src/imports.ts ADDED
@@ -0,0 +1,19 @@
1
+ export { createPortal } from "react-dom";
2
+ export { ClipboardIcon, CloudArrowUpIcon } from "@heroicons/react/24/outline";
3
+ export {useEffect,useRef,useState,useCallback} from 'react';
4
+ export type { QueuedFile, FileItem, FileTableProps, UploadProps, ShareModalProps, FileRowProps, ApiRow, EnhancedInputProps } from './types';
5
+ export {
6
+ currentUsername,
7
+ alertit,
8
+ requireToken,
9
+ isLoggedIn,
10
+ fetchIt,
11
+ stripPrefixes,
12
+ make_path
13
+ } from "@putkoff/abstract-utilities";
14
+ export {
15
+ Button,
16
+ Checkbox,
17
+ Input,
18
+ Spinner} from './UI';
19
+ export { secureFetchIt, fetchSharePatch } from "@putkoff/abstract-apis";
package/src/index.ts CHANGED
@@ -1 +1,8 @@
1
- export {default as SecureFiles} from './secure_files';
1
+ export { FileRow, ShareModal, FileTable, Upload } from './FileHandlers';
2
+ export { useFiles } from './hooks';
3
+ export * from './file_utils';
4
+ export * from './hooks';
5
+ export * from './UI';
6
+ export * from './types';
7
+ export * from './styles';
8
+ export { SecureFiles } from './App'
File without changes
File without changes
File without changes
File without changes
@@ -0,0 +1,287 @@
1
+ /* SecureFilesStyles.module.css */
2
+
3
+ /* Scope all styles under .secure-files */
4
+ .secure-files {
5
+ /* Pull in Tailwind utilities if needed (but skip @base to avoid global resets) */
6
+ @tailwind utilities;
7
+
8
+ /* window-manager.css styles (prefixed where needed) */
9
+ .wm-table {
10
+ width: 100%;
11
+ font-size: 13px;
12
+ table-layout: fixed;
13
+ }
14
+
15
+ .wm-thead th {
16
+ background-color: #e5e7eb;
17
+ border-bottom: 1px solid #9ca3af;
18
+ padding: 5px 8px;
19
+ text-align: left;
20
+ font-weight: 600;
21
+ }
22
+
23
+ .wm-row {
24
+ border-bottom: 1px solid #d1d5db;
25
+ background-color: #f9fafb;
26
+ }
27
+
28
+ .wm-row:hover {
29
+ background-color: #eff6ff;
30
+ }
31
+
32
+ .wm-cell {
33
+ padding: 5px 8px;
34
+ white-space: nowrap;
35
+ overflow: hidden;
36
+ text-overflow: ellipsis;
37
+ }
38
+
39
+ .wm-checkbox {
40
+ height: 14px;
41
+ width: 14px;
42
+ color: #2563eb;
43
+ border: 1px solid #9ca3af;
44
+ border-radius: 4px;
45
+ cursor: pointer;
46
+ }
47
+
48
+ .wm-btn-link {
49
+ color: #2563eb;
50
+ text-decoration: underline;
51
+ }
52
+
53
+ .wm-btn-link:hover {
54
+ color: #1e40af;
55
+ }
56
+
57
+ .wm-btn-link:disabled {
58
+ color: #9ca3af;
59
+ cursor: not-allowed;
60
+ }
61
+
62
+ .wm-btn-icon {
63
+ color: #4b5563;
64
+ padding: 2px;
65
+ border-radius: 4px;
66
+ }
67
+
68
+ .wm-btn-icon:hover {
69
+ color: #111827;
70
+ background-color: #e5e7eb;
71
+ }
72
+
73
+ .wm-btn-icon:disabled {
74
+ color: #9ca3af;
75
+ }
76
+
77
+ /* file-table styles */
78
+ .file-table {
79
+ width: 100%;
80
+ border: 1px solid #9ca3af;
81
+ font-size: 13px;
82
+ line-height: 1.15rem;
83
+ border-collapse: collapse;
84
+ }
85
+
86
+ .file-table thead th {
87
+ background-color: #e5e7eb;
88
+ color: #1f2937;
89
+ font-weight: 600;
90
+ padding: 6px 12px;
91
+ user-select: none;
92
+ border-bottom: 1px solid #9ca3af;
93
+ border-right: 1px solid #d1d5db;
94
+ }
95
+
96
+ .file-table thead th:last-child {
97
+ border-right: none;
98
+ }
99
+
100
+ .file-table tbody tr {
101
+ border-bottom: 1px solid #d1d5db;
102
+ transition: background-color 0.2s;
103
+ }
104
+
105
+ .file-table tbody tr:hover {
106
+ background-color: #f3f4f6;
107
+ }
108
+
109
+ .file-table tbody tr:nth-child(even) {
110
+ background-color: #f9fafb;
111
+ }
112
+
113
+ .file-table td {
114
+ padding: 6px 12px;
115
+ vertical-align: middle;
116
+ white-space: nowrap;
117
+ border-right: 1px solid #d1d5db;
118
+ }
119
+
120
+ .file-table td:last-child {
121
+ border-right: none;
122
+ }
123
+
124
+ .file-table .unsaved {
125
+ color: #dc2626;
126
+ }
127
+
128
+ /* Modals */
129
+ .modal-backdrop {
130
+ position: fixed;
131
+ top: 0;
132
+ right: 0;
133
+ bottom: 0;
134
+ left: 0;
135
+ background-color: rgba(0, 0, 0, 0.6);
136
+ }
137
+
138
+ .modal-wrapper {
139
+ position: fixed;
140
+ top: 0;
141
+ right: 0;
142
+ bottom: 0;
143
+ left: 0;
144
+ display: flex;
145
+ align-items: center;
146
+ justify-content: center;
147
+ }
148
+
149
+ .modal-panel {
150
+ background-color: #ffffff;
151
+ border-radius: 12px;
152
+ padding: 24px;
153
+ box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
154
+ outline: none;
155
+ max-width: 28rem;
156
+ max-height: 90vh;
157
+ overflow-y: auto;
158
+ }
159
+
160
+ /* Forms & Inputs */
161
+ .form-container {
162
+ background-color: #ffffff;
163
+ box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06);
164
+ border-radius: 8px;
165
+ padding: 24px;
166
+ display: flex;
167
+ flex-direction: column;
168
+ gap: 16px;
169
+ max-width: 28rem;
170
+ }
171
+
172
+ .form-title {
173
+ font-size: 20px;
174
+ font-weight: 600;
175
+ text-align: center;
176
+ }
177
+
178
+ .form-input {
179
+ display: block;
180
+ width: 100%;
181
+ border-radius: 4px;
182
+ border: 1px solid #d1d5db;
183
+ padding: 4px 8px;
184
+ }
185
+
186
+ .form-input:disabled {
187
+ background-color: #f3f4f6;
188
+ }
189
+
190
+ .form-group {
191
+ margin-bottom: 16px;
192
+ }
193
+
194
+ .form-label {
195
+ display: block;
196
+ font-size: 14px;
197
+ font-weight: 500;
198
+ margin-bottom: 4px;
199
+ }
200
+
201
+ .form-error {
202
+ font-size: 14px;
203
+ color: #dc2626;
204
+ }
205
+
206
+ /* Buttons */
207
+ .btn {
208
+ border-radius: 8px;
209
+ padding: 4px 12px;
210
+ font-size: 14px;
211
+ font-weight: 500;
212
+ transition: background-color 0.15s, color 0.15s;
213
+ }
214
+
215
+ .btn:focus {
216
+ outline: none;
217
+ box-shadow: 0 0 0 2px #ffffff, 0 0 0 4px rgba(0, 0, 0, 0.1);
218
+ }
219
+
220
+ .btn-primary {
221
+ background-color: #2563eb;
222
+ color: #ffffff;
223
+ }
224
+
225
+ .btn-primary:hover {
226
+ background-color: #1d4ed8;
227
+ }
228
+
229
+ .btn-primary:focus {
230
+ box-shadow: 0 0 0 2px #ffffff, 0 0 0 4px rgba(59, 130, 246, 0.5);
231
+ }
232
+
233
+ .btn-secondary {
234
+ background-color: #e5e7eb;
235
+ }
236
+
237
+ .btn-secondary:hover {
238
+ background-color: #d1d5db;
239
+ }
240
+
241
+ .btn-secondary:focus {
242
+ box-shadow: 0 0 0 2px #ffffff, 0 0 0 4px rgba(156, 163, 175, 0.5);
243
+ }
244
+
245
+ .btn-success {
246
+ background-color: #16a34a;
247
+ color: #ffffff;
248
+ }
249
+
250
+ .btn-success:hover {
251
+ background-color: #15803d;
252
+ }
253
+
254
+ .btn-success:focus {
255
+ box-shadow: 0 0 0 2px #ffffff, 0 0 0 4px rgba(34, 197, 94, 0.5);
256
+ }
257
+
258
+ .btn-danger {
259
+ background-color: #dc2626;
260
+ color: #ffffff;
261
+ }
262
+
263
+ .btn-danger:hover {
264
+ background-color: #b91c1c;
265
+ }
266
+
267
+ .btn-danger:focus {
268
+ box-shadow: 0 0 0 2px #ffffff, 0 0 0 4px rgba(239, 68, 68, 0.5);
269
+ }
270
+
271
+ .btn-icon {
272
+ padding: 4px;
273
+ background-color: transparent;
274
+ }
275
+
276
+ .btn-icon:hover {
277
+ background-color: #f3f4f6;
278
+ }
279
+
280
+ /* Checkbox */
281
+ .checkbox {
282
+ display: flex;
283
+ align-items: center;
284
+ gap: 8px;
285
+ margin-bottom: 16px;
286
+ }
287
+ }
@@ -0,0 +1 @@
1
+ export * from './SecureFiles/index.css';
@@ -0,0 +1 @@
1
+ export type { QueuedFile, FileItem, FileTableProps, UploadProps, ShareModalProps, FileRowProps, ApiRow, EnhancedInputProps } from './src/types';
@@ -0,0 +1 @@
1
+ export type { QueuedFile, FileItem, FileTableProps, UploadProps, ShareModalProps, FileRowProps, ApiRow, EnhancedInputProps } from './types';
@@ -0,0 +1,88 @@
1
+
2
+ export interface FileItem {
3
+ id: number | string;
4
+ filename: string;
5
+ uploader_id: string;
6
+ filepath: string;
7
+ created_at: string;
8
+ download_count: number;
9
+ download_limit: number | null;
10
+ shareable: boolean;
11
+ needsPassword: boolean;
12
+ share_password: string | null;
13
+ password_str: string | null;
14
+ }
15
+
16
+ export interface ApiRow {
17
+ id: number | string;
18
+ filename: string;
19
+ uploader_id: string;
20
+ filepath: string;
21
+ created_at: string;
22
+ download_count: number;
23
+ download_limit: number | null;
24
+ shareable: boolean;
25
+ needsPassword: boolean;
26
+ share_password: string;
27
+ password_str: string | null;
28
+ }
29
+
30
+ export interface FileListResponse {
31
+ files?: ApiRow[];
32
+ }
33
+
34
+ export interface FileTableProps {
35
+ files: FileItem[];
36
+ loading: boolean;
37
+ error: Error | null;
38
+ onDownload(id: any): Promise<void>;
39
+ onToggleShare(id: any): Promise<void>;
40
+ onPatchShare(id: any): Promise<void>;
41
+ onDelete(id: any): Promise<void>;
42
+ }
43
+
44
+
45
+ export interface ShareModalProps {
46
+ file: FileItem | null;
47
+ onClose(): void;
48
+ onSave(patch: Partial<FileItem>): Promise<void>;
49
+ }
50
+ export interface UploadProps {
51
+ /** Called *after* a successful upload */
52
+ onUploaded: () => Promise<void>;
53
+ }
54
+
55
+
56
+
57
+ export interface FileRowProps {
58
+ file: FileItem;
59
+ onDownload: () => Promise<void>;
60
+ onSettings: () => void;
61
+ onToggleShare: () => Promise<void>;
62
+ onDelete: () => any;
63
+ }
64
+
65
+ export interface QueuedFile {
66
+ file: File;
67
+ relPath: string;
68
+ progress: number;
69
+ }
70
+
71
+ export interface InputProps {
72
+ label?: any;
73
+ type?: any;
74
+ value?: any;
75
+ onChange?: any;
76
+ disabled?: any;
77
+ placeholder?: any;
78
+ error?: string;
79
+
80
+ }
81
+
82
+ export interface FileInputExtra {
83
+ directory?: boolean; // true → allow folder selection
84
+ multiple?: boolean; // true → allow multiple files
85
+ accept?: string; // optional MIME filter
86
+ }
87
+ /** keep other InputProps fields … */
88
+ export type EnhancedInputProps = InputProps & FileInputExtra;
File without changes
package/testit.mjs CHANGED
File without changes
package/testit.ts CHANGED
File without changes
package/tsconfig.json CHANGED
File without changes