@widgetic/file-browser 0.5.23 → 0.5.24
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 +24 -4
- package/dist/components/FolderTree.svelte.d.ts +6 -2
- package/dist/components/core/FileBrowser.svelte +45 -43
- package/dist/components/modals/SearchModal.svelte.d.ts +1 -1
- package/dist/stores/fileStore.d.ts +3 -3
- package/dist/stores/navigationStore.d.ts +1 -1
- package/dist/stores/persistentSelectStore.d.ts +1 -1
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -80,10 +80,30 @@ To develop the package:
|
|
|
80
80
|
# Install dependencies
|
|
81
81
|
npm install
|
|
82
82
|
|
|
83
|
-
>
|
|
84
|
-
>
|
|
85
|
-
|
|
86
|
-
|
|
83
|
+
> Its bins (`check-runtime-deps`, used by `npm run check:deps` /
|
|
84
|
+
> `test:deps`) come from the installed `@widgetic/dev-tools` dependency.
|
|
85
|
+
|
|
86
|
+
## Sibling packages
|
|
87
|
+
|
|
88
|
+
This app compiles sibling `@widgetic/*` source in dev through the dev-alias
|
|
89
|
+
setup `@widgetic/dev-tools` owns. The alias tables, the `$lib` remap, and
|
|
90
|
+
everything else the mapping needs come from the installed
|
|
91
|
+
`@widgetic/dev-tools` dependency. An ordinary `npm install` is the whole
|
|
92
|
+
setup — there is no linking step.
|
|
93
|
+
|
|
94
|
+
The why and the silent-degrade failure mode live in
|
|
95
|
+
[the dev-tools README](../dev-tools/README.md).
|
|
96
|
+
|
|
97
|
+
## Publishing
|
|
98
|
+
|
|
99
|
+
Publishing starts here: `npm run package` builds the `dist/` directory that
|
|
100
|
+
is the only content the published tarball ships. Linked consumers keep
|
|
101
|
+
resolving this checkout’s files until the release lands, so a change is not
|
|
102
|
+
real for anyone else until it publishes. After publishing, each consumer
|
|
103
|
+
package bumps its dependency to the new version and refreshes its lockfile
|
|
104
|
+
with `npm install`, so `npm ci` resolves the release from the registry. A
|
|
105
|
+
consumer that skips the lockfile refresh keeps resolving the old version, so
|
|
106
|
+
the version bump and the lockfile refresh land as one commit.
|
|
87
107
|
|
|
88
108
|
|
|
89
109
|
# Start the server
|
|
@@ -13,10 +13,14 @@ interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> =
|
|
|
13
13
|
z_$$bindings?: Bindings;
|
|
14
14
|
}
|
|
15
15
|
declare const FolderTree: $$__sveltets_2_IsomorphicComponent<{
|
|
16
|
-
folder:
|
|
16
|
+
folder: FileSystemItem & {
|
|
17
|
+
displayChildren?: FileSystemItem[];
|
|
18
|
+
};
|
|
17
19
|
selectedFolder: FileSystemItem | undefined;
|
|
18
20
|
immediateParentId: string | null;
|
|
19
|
-
onSelect: (folder:
|
|
21
|
+
onSelect: (folder: FileSystemItem & {
|
|
22
|
+
displayChildren?: FileSystemItem[];
|
|
23
|
+
}) => void;
|
|
20
24
|
getFolderIconForItem: (folder: FileSystemItem) => string;
|
|
21
25
|
customClasses?: string;
|
|
22
26
|
iconSize?: string;
|
|
@@ -445,6 +445,8 @@
|
|
|
445
445
|
|
|
446
446
|
// Set up window key handler
|
|
447
447
|
window.addEventListener('keydown', handleKeyDown);
|
|
448
|
+
window.addEventListener('widgetic:file-browser-command', handleFileBrowserCommand);
|
|
449
|
+
publishFileBrowserNav();
|
|
448
450
|
|
|
449
451
|
if (data) {
|
|
450
452
|
isLoading = false;
|
|
@@ -556,6 +558,7 @@
|
|
|
556
558
|
// REMOVE EVENT LISTENERS
|
|
557
559
|
window.removeEventListener('resize', handleResize);
|
|
558
560
|
window.removeEventListener('keydown', handleKeyDown);
|
|
561
|
+
window.removeEventListener('widgetic:file-browser-command', handleFileBrowserCommand);
|
|
559
562
|
});
|
|
560
563
|
|
|
561
564
|
// Add logging to key reactive statements
|
|
@@ -757,26 +760,21 @@
|
|
|
757
760
|
* Syncs current path with store updates
|
|
758
761
|
* Ensures UI stays in sync with navigation state
|
|
759
762
|
*/
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
// Subscribe to navigation store changes
|
|
763
|
+
// Follow the history index. A stale folder must not put the view
|
|
764
|
+
// back on the folder we just left.
|
|
763
765
|
$: {
|
|
764
766
|
if ($navPathStore) {
|
|
765
|
-
|
|
766
|
-
currentPath =
|
|
767
|
-
if (JSON.stringify($currentFolder) !== JSON.stringify(
|
|
768
|
-
currentFolder.set(
|
|
767
|
+
const livePath = pathAtHistoryIndex();
|
|
768
|
+
currentPath = livePath;
|
|
769
|
+
if (JSON.stringify($currentFolder) !== JSON.stringify(livePath)) {
|
|
770
|
+
currentFolder.set(livePath);
|
|
769
771
|
}
|
|
770
|
-
// Reset the flag after the update
|
|
771
|
-
setTimeout(() => {
|
|
772
|
-
isNavigating = false;
|
|
773
|
-
}, 0);
|
|
774
772
|
}
|
|
775
773
|
}
|
|
776
774
|
|
|
777
|
-
// Only update current path when folder changes
|
|
778
775
|
$: {
|
|
779
|
-
|
|
776
|
+
const livePath = pathAtHistoryIndex();
|
|
777
|
+
if ($currentFolder && JSON.stringify($currentFolder) === JSON.stringify(livePath)) {
|
|
780
778
|
currentPath = $currentFolder;
|
|
781
779
|
}
|
|
782
780
|
}
|
|
@@ -1741,19 +1739,41 @@
|
|
|
1741
1739
|
}
|
|
1742
1740
|
|
|
1743
1741
|
// Add these new handlers
|
|
1744
|
-
function
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
1742
|
+
function pathAtHistoryIndex(): string[] {
|
|
1743
|
+
const state = get(navigationStore);
|
|
1744
|
+
const path = state.pathsArray[state.currentIndex];
|
|
1745
|
+
return Array.isArray(path) ? path : [];
|
|
1746
|
+
}
|
|
1749
1747
|
|
|
1748
|
+
function publishFileBrowserNav() {
|
|
1749
|
+
if (!isBrowser) return;
|
|
1750
|
+
window.dispatchEvent(new CustomEvent('widgetic:file-browser-nav', {
|
|
1751
|
+
detail: {
|
|
1752
|
+
instanceId,
|
|
1753
|
+
currentPath,
|
|
1754
|
+
currentPathNames,
|
|
1755
|
+
canGoBack: get(canGoBackStore),
|
|
1756
|
+
canGoForward: get(canGoForwardStore),
|
|
1757
|
+
},
|
|
1758
|
+
}));
|
|
1759
|
+
}
|
|
1760
|
+
|
|
1761
|
+
function handleFileBrowserCommand(event: Event) {
|
|
1762
|
+
const detail = (event as CustomEvent).detail;
|
|
1763
|
+
if (!detail || detail.instanceId !== instanceId) return;
|
|
1764
|
+
if (detail.command === 'back') handleNavigateBack();
|
|
1765
|
+
else if (detail.command === 'forward') handleNavigateForward();
|
|
1766
|
+
else if (detail.command === 'index') {
|
|
1767
|
+
navigateToBreadcrumb({ detail: detail.index } as CustomEvent<number>);
|
|
1768
|
+
} else if (detail.command === 'publish') {
|
|
1769
|
+
publishFileBrowserNav();
|
|
1770
|
+
}
|
|
1771
|
+
}
|
|
1772
|
+
|
|
1773
|
+
function handleNavigateBack() {
|
|
1750
1774
|
if(showLogs) console.log('Handling back navigation');
|
|
1751
1775
|
navigationStore.navigateBack();
|
|
1752
|
-
const newPath =
|
|
1753
|
-
if (!Array.isArray(newPath)) {
|
|
1754
|
-
if(showLogs) console.error('Invalid path received from navigation store:', newPath);
|
|
1755
|
-
return;
|
|
1756
|
-
}
|
|
1776
|
+
const newPath = pathAtHistoryIndex();
|
|
1757
1777
|
if(showLogs) console.log('Back Navigation Details:', {
|
|
1758
1778
|
from: currentPath,
|
|
1759
1779
|
to: newPath
|
|
@@ -1763,18 +1783,9 @@
|
|
|
1763
1783
|
}
|
|
1764
1784
|
|
|
1765
1785
|
function handleNavigateForward() {
|
|
1766
|
-
// if (modalOpen) {
|
|
1767
|
-
// console.log('Modal is open, skipping forward navigation');
|
|
1768
|
-
// return;
|
|
1769
|
-
// }
|
|
1770
|
-
|
|
1771
1786
|
if(showLogs) console.log('Handling forward navigation');
|
|
1772
1787
|
navigationStore.navigateForward();
|
|
1773
|
-
const newPath =
|
|
1774
|
-
if (!Array.isArray(newPath)) {
|
|
1775
|
-
if(showLogs) console.error('Invalid path received from navigation store:', newPath);
|
|
1776
|
-
return;
|
|
1777
|
-
}
|
|
1788
|
+
const newPath = pathAtHistoryIndex();
|
|
1778
1789
|
if(showLogs) console.log('Forward Navigation Details:', {
|
|
1779
1790
|
from: currentPath,
|
|
1780
1791
|
to: newPath
|
|
@@ -1805,6 +1816,7 @@
|
|
|
1805
1816
|
} else {
|
|
1806
1817
|
currentPathNames = [];
|
|
1807
1818
|
}
|
|
1819
|
+
publishFileBrowserNav();
|
|
1808
1820
|
}
|
|
1809
1821
|
|
|
1810
1822
|
// Update the deduplication function to handle items with the same name
|
|
@@ -2743,16 +2755,6 @@ mainGridClass="app-main-grid"
|
|
|
2743
2755
|
on:cancel={() => { showNewFolderDialog = false; }}
|
|
2744
2756
|
/>
|
|
2745
2757
|
{/if}
|
|
2746
|
-
target={rootContainerClass}
|
|
2747
|
-
{currentPath}
|
|
2748
|
-
{currentPathNames}
|
|
2749
|
-
showTitle={false}
|
|
2750
|
-
confirmLabel="Create"
|
|
2751
|
-
cancelLabel="Cancel"
|
|
2752
|
-
on:create={handleNewFolder}
|
|
2753
|
-
on:cancel={() => { showNewFolderDialog = false; }}
|
|
2754
|
-
/>
|
|
2755
|
-
|
|
2756
2758
|
|
|
2757
2759
|
<!-- STYLES -->
|
|
2758
2760
|
<style>
|
|
@@ -5,15 +5,15 @@ export declare const fileStore: {
|
|
|
5
5
|
update: (this: void, updater: import("svelte/store").Updater<FileSystemRoot>) => void;
|
|
6
6
|
};
|
|
7
7
|
export declare const currentFolder: import("svelte/store").Writable<string[]>;
|
|
8
|
-
export declare const sortCriteria: import("svelte/store").Writable<"
|
|
9
|
-
export declare const sortDirection: import("svelte/store").Writable<"
|
|
8
|
+
export declare const sortCriteria: import("svelte/store").Writable<"size" | "name" | "date">;
|
|
9
|
+
export declare const sortDirection: import("svelte/store").Writable<"desc" | "asc">;
|
|
10
10
|
export declare const selectedFiles: import("svelte/store").Writable<FileSystemItem[]>;
|
|
11
11
|
export declare const fileFilter: import("svelte/store").Writable<string[]>;
|
|
12
12
|
/**
|
|
13
13
|
* Derived store that automatically sorts files based on criteria
|
|
14
14
|
* Maintains folder priority (folders always appear before files)
|
|
15
15
|
*/
|
|
16
|
-
export declare const sortedFiles: import("svelte/store").Readable<
|
|
16
|
+
export declare const sortedFiles: import("svelte/store").Readable<FileSystemRoot>;
|
|
17
17
|
/**
|
|
18
18
|
* Initializes or updates the file store with new data
|
|
19
19
|
* Includes validation and error handling
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { currentFolder } from './fileStore';
|
|
2
|
-
export declare const currentPathNames: import("svelte/store").Readable<
|
|
2
|
+
export declare const currentPathNames: import("svelte/store").Readable<string[]>;
|
|
3
3
|
export { currentFolder };
|
|
4
4
|
export declare const navigationActions: import("svelte/store").Writable<{
|
|
5
5
|
navigateToPath: (path: string[]) => void;
|
|
@@ -14,5 +14,5 @@ export declare const persistentSelectStore: {
|
|
|
14
14
|
update(this: void, updater: import("svelte/store").Updater<StoredSelections>): void;
|
|
15
15
|
subscribe(this: void, run: import("svelte/store").Subscriber<StoredSelections>, invalidate?: () => void): import("svelte/store").Unsubscriber;
|
|
16
16
|
};
|
|
17
|
-
export declare const validSelections: import("svelte/store").Readable<(filterType: FileFilterType, files: FileSystemItem[]) =>
|
|
17
|
+
export declare const validSelections: import("svelte/store").Readable<(filterType: FileFilterType, files: FileSystemItem[]) => FileSystemItem[]>;
|
|
18
18
|
export {};
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@widgetic/file-browser",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.24",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
|
-
"url": "https://gitlab.com/widgeticai/Frontend/file-browser.git"
|
|
7
|
+
"url": "git+https://gitlab.com/widgeticai/Frontend/file-browser.git"
|
|
8
8
|
},
|
|
9
9
|
"publishConfig": {
|
|
10
10
|
"access": "public"
|
|
@@ -61,7 +61,6 @@
|
|
|
61
61
|
"clean-modules": "rm -rf node_modules",
|
|
62
62
|
"clean-all": "rm -rf node_modules",
|
|
63
63
|
"lds": "volta run npm link @widgetic/design-system",
|
|
64
|
-
"ldt": "volta run npm link @widgetic/dev-tools",
|
|
65
64
|
"dev": "npm run dev-sv -- --open",
|
|
66
65
|
"dev-sv": "NODE_ENV=development vite dev",
|
|
67
66
|
"dev-pack": "concurrently \"npm run dev-sv\" \"npm run package:watch\"",
|
|
@@ -81,6 +80,7 @@
|
|
|
81
80
|
"publish-package": "npm run package && npm publish",
|
|
82
81
|
"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
|
|
83
82
|
"check:deps": "check-runtime-deps",
|
|
83
|
+
"check:peers": "check-design-system-peers ..",
|
|
84
84
|
"test:deps": "check-runtime-deps-fixtures",
|
|
85
85
|
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",
|
|
86
86
|
"lint": "prettier --check . && eslint .",
|
|
@@ -95,7 +95,7 @@
|
|
|
95
95
|
"@types/node": "^22.13.4",
|
|
96
96
|
"@widgetic/cache-layer": "^0.1.1",
|
|
97
97
|
"@widgetic/design-system": "^0.5.12",
|
|
98
|
-
"@widgetic/dev-tools": "^0.
|
|
98
|
+
"@widgetic/dev-tools": "^0.3.0",
|
|
99
99
|
"concurrently": "^9.1.2",
|
|
100
100
|
"eslint": "^9.0.0",
|
|
101
101
|
"eslint-config-prettier": "^9.1.0",
|