@makolabs/ripple 0.2.1-0 → 0.2.2-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.
@@ -1,7 +1,7 @@
1
1
  <script lang="ts">
2
2
  import { onMount } from 'svelte';
3
3
  import { Button, Table, Color, Size } from '../index.js';
4
- import type { TableColumn } from '../index.js';
4
+ import type { TableColumn, FileBrowserProps } from '../index.js';
5
5
  import { formatDate } from '../utils/dateUtils.js';
6
6
  import type {
7
7
  StorageAdapter,
@@ -9,7 +9,7 @@
9
9
  Breadcrumb,
10
10
  FileAction,
11
11
  FileActionBatch,
12
- FileActionSingle
12
+ FileActionSingle,
13
13
  } from '../adapters/storage/index.js';
14
14
 
15
15
  let {
@@ -18,16 +18,7 @@
18
18
  actions = [],
19
19
  infoSection,
20
20
  selectedFiles = $bindable([])
21
- } = $props<{
22
- adapter: StorageAdapter;
23
- startPath?: string;
24
- actions?: FileAction[];
25
- selectedFiles?: string[];
26
- infoSection?: (props: {
27
- selectedFiles: string[];
28
- navToFileFolder: (fileKey: string) => void;
29
- }) => any;
30
- }>();
21
+ }: FileBrowserProps = $props();
31
22
 
32
23
  let files = $state<FileItem[]>([]);
33
24
  let displayFiles = $state<FileItem[]>([]);
@@ -118,7 +109,6 @@
118
109
  const fileItem = files.find((f) => f.key === fileKey);
119
110
  if (fileItem && !selected.some((s) => s.key === fileKey)) {
120
111
  selected = [...selected, fileItem];
121
- console.log('selected [SETTIMEOUT, FILEITEM]', selected);
122
112
  }
123
113
  }
124
114
  }, 100);
@@ -251,7 +241,6 @@
251
241
  if (filesToSelect.length > 0) {
252
242
  selectedFiles = filesToSelect;
253
243
  selected = displayFiles.filter((file) => filesToSelect.includes(file.key));
254
- console.log('selected [NAVIGATETOFOLDER]', selected);
255
244
  }
256
245
 
257
246
  // Restore fileQueue to ensure we keep track of all selected files
@@ -265,10 +254,10 @@
265
254
  navigateToFolder(file.key);
266
255
  } else {
267
256
  // Check if this file is allowed to be selected based on actions
268
- const hasAllowedAction = actions.some((action: FileAction) => {
257
+ const hasAllowedAction = actions.some((action) => {
269
258
  // Only check single file actions for individual file selection
270
259
  if ('action' in action && typeof action.action === 'function') {
271
- return action.isAllowed(file);
260
+ return (action.isAllowed as FileActionSingle['isAllowed'])(file);
272
261
  }
273
262
  return false;
274
263
  });
@@ -280,20 +269,15 @@
280
269
 
281
270
  // Toggle selection for files
282
271
  const isCurrentlySelected = selectedFiles.includes(file.key);
283
- console.log('isCurrentlySelected [HANDLEROWCLICK]', isCurrentlySelected);
284
- console.log('selectedFiles [HANDLEROWCLICK]', selectedFiles);
285
- console.log('selected [HANDLEROWCLICK]', selected);
286
272
 
287
273
  if (isCurrentlySelected) {
288
274
  // Remove from selection
289
275
  selectedFiles = selectedFiles.filter((key) => key !== file.key);
290
276
  selected = selected.filter((item) => item.key !== file.key);
291
- console.log('selected [HANDLEROWCLICK, REMOVE]', selected);
292
277
  } else {
293
278
  // Add to selection
294
279
  selectedFiles = [...selectedFiles, file.key];
295
280
  selected = [...selected, file];
296
- console.log('selected [HANDLEROWCLICK, ADD]', selected);
297
281
  }
298
282
  }
299
283
  }
@@ -430,9 +414,9 @@
430
414
  // Filter out files that aren't allowed to be selected based on actions' isAllowed logic
431
415
  const allowedItems = selectedItems.filter((item) => {
432
416
  // Check if any single action allows this file
433
- const hasAllowedAction = actions.some((action: FileAction) => {
417
+ const hasAllowedAction = actions.some((action) => {
434
418
  // Only check single file actions for individual file selection
435
- if ('action' in action && typeof action.action === 'function') {
419
+ if ('action' in action && typeof action.action === 'function' && action.action) {
436
420
  return action.isAllowed(item);
437
421
  }
438
422
  return false;
@@ -537,8 +521,6 @@
537
521
  (newItem) => !existingQueue.some((existingItem) => existingItem.key === newItem.key)
538
522
  )
539
523
  ];
540
-
541
- console.log(`Selected ${selectedFiles.length} files from folders`);
542
524
  } catch (err) {
543
525
  console.error('Error in recursive folder processing:', err);
544
526
  console.error('Failed to process some folders');
@@ -1,14 +1,4 @@
1
- import type { StorageAdapter, FileAction } from '../adapters/storage/index.js';
2
- type $$ComponentProps = {
3
- adapter: StorageAdapter;
4
- startPath?: string;
5
- actions?: FileAction[];
6
- selectedFiles?: string[];
7
- infoSection?: (props: {
8
- selectedFiles: string[];
9
- navToFileFolder: (fileKey: string) => void;
10
- }) => any;
11
- };
12
- declare const FileBrowser: import("svelte").Component<$$ComponentProps, {}, "selectedFiles">;
1
+ import type { FileBrowserProps } from '../index.js';
2
+ declare const FileBrowser: import("svelte").Component<FileBrowserProps, {}, "selectedFiles">;
13
3
  type FileBrowser = ReturnType<typeof FileBrowser>;
14
4
  export default FileBrowser;
package/dist/index.d.ts CHANGED
@@ -20,6 +20,7 @@ import type { Component } from 'svelte';
20
20
  import type { HTMLButtonAttributes, HTMLAttributeAnchorTarget } from 'svelte/elements';
21
21
  import type { ECharts } from 'echarts/types/src/export/core.js';
22
22
  import type { SuperForm } from 'sveltekit-superforms';
23
+ import type { FileAction, StorageAdapter } from './adapters/storage/types.js';
23
24
  export type BadgeProps = {
24
25
  size?: VariantSizes;
25
26
  color?: VariantColors;
@@ -845,9 +846,9 @@ export { CompactFilters } from './filters/index.js';
845
846
  export * from './file-browser/index.js';
846
847
  export * from './adapters/storage/index.js';
847
848
  export interface FileBrowserProps {
848
- adapter: any;
849
+ adapter: StorageAdapter;
849
850
  startPath?: string;
850
- actions?: any[];
851
+ actions?: FileAction[];
851
852
  selectedFiles?: string[];
852
853
  infoSection?: (props: {
853
854
  selectedFiles: string[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@makolabs/ripple",
3
- "version": "0.2.1-0",
3
+ "version": "0.2.2-0",
4
4
  "description": "Simple Svelte 5 powered component library ✨",
5
5
  "repository": {
6
6
  "type": "git",