@widgetic/file-browser 0.5.22 → 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 CHANGED
@@ -80,6 +80,31 @@ To develop the package:
80
80
  # Install dependencies
81
81
  npm install
82
82
 
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.
107
+
83
108
 
84
109
  # Start the server
85
110
  ```bash
@@ -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: any;
16
+ folder: FileSystemItem & {
17
+ displayChildren?: FileSystemItem[];
18
+ };
17
19
  selectedFolder: FileSystemItem | undefined;
18
20
  immediateParentId: string | null;
19
- onSelect: (folder: any) => void;
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
- let isNavigating = false;
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
- isNavigating = true;
766
- currentPath = $navPathStore;
767
- if (JSON.stringify($currentFolder) !== JSON.stringify($navPathStore)) {
768
- currentFolder.set($navPathStore);
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
- if ($currentFolder && !isNavigating) {
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 handleNavigateBack() {
1745
- // if (modalOpen) {
1746
- // if(showLogs) console.log('Modal is open, skipping back navigation');
1747
- // return;
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 = $navPathStore;
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 = $navPathStore;
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>
@@ -17,7 +17,7 @@ declare const SearchModal: $$__sveltets_2_IsomorphicComponent<{
17
17
  open?: boolean;
18
18
  target?: string;
19
19
  }, {
20
- action: any;
20
+ action: CustomEvent<any>;
21
21
  close: CustomEvent<any>;
22
22
  preview: CustomEvent<any>;
23
23
  navigate: CustomEvent<any>;
@@ -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<"name" | "date" | "size">;
9
- export declare const sortDirection: import("svelte/store").Writable<"asc" | "desc">;
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<any>;
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<any>;
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[]) => any[]>;
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.22",
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"
@@ -79,7 +79,9 @@
79
79
  "build-package": "vite build && npm run package && npm link",
80
80
  "publish-package": "npm run package && npm publish",
81
81
  "check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
82
- "check:deps": "node scripts/check-runtime-deps.mjs",
82
+ "check:deps": "check-runtime-deps",
83
+ "check:peers": "check-design-system-peers ..",
84
+ "test:deps": "check-runtime-deps-fixtures",
83
85
  "check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",
84
86
  "lint": "prettier --check . && eslint .",
85
87
  "format": "prettier --write ."
@@ -90,19 +92,15 @@
90
92
  "@sveltejs/package": "^2.3.7",
91
93
  "@sveltejs/vite-plugin-svelte": "^5.1.1",
92
94
  "@tailwindcss/postcss": "^4.3.0",
93
- "@types/eslint": "^9.6.0",
94
- "@types/fs-extra": "^11.0.4",
95
95
  "@types/node": "^22.13.4",
96
96
  "@widgetic/cache-layer": "^0.1.1",
97
- "@widgetic/design-system": "^0.3.89",
98
- "autoprefixer": "^10.4.20",
97
+ "@widgetic/design-system": "^0.5.12",
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",
102
102
  "eslint-plugin-svelte": "^2.36.0",
103
- "fs-extra": "^11.3.0",
104
103
  "globals": "^15.0.0",
105
- "mode-watcher": "^0.5.0",
106
104
  "postcss": "^8.4.47",
107
105
  "prettier": "^3.1.1",
108
106
  "prettier-plugin-svelte": "^3.1.2",
@@ -111,8 +109,7 @@
111
109
  "tailwindcss": "^4.3.0",
112
110
  "typescript": "^5.0.0",
113
111
  "typescript-eslint": "^8.0.0",
114
- "vite": "^6.4.3",
115
- "vite-imagetools": "^7.0.4"
112
+ "vite": "^6.4.3"
116
113
  },
117
114
  "peerDependencies": {
118
115
  "@sveltejs/kit": "^2.20.7",