@noya-app/noya-file-explorer 0.0.16 → 0.0.18

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/dist/index.d.mts CHANGED
@@ -1,6 +1,6 @@
1
- import { ListView, CollectionViewType, CollectionProps, MediaThumbnailProps, RelativeDropPosition } from '@noya-app/noya-designsystem';
1
+ import { ListView, CollectionViewType, CollectionProps, MediaThumbnailProps, RelativeDropPosition, CollectionThumbnailProps } from '@noya-app/noya-designsystem';
2
2
  import { MultiplayerPatchMetadata } from '@noya-app/noya-multiplayer-react';
3
- import { MediaMap, FolderMediaItem, AssetMediaItem, FileMediaItem, MediaItem } from '@noya-app/noya-schemas';
3
+ import { MediaMap, FolderMediaItem, AssetMediaItem, FileMediaItem, MediaItem, ResourceTree, ResourceMap, Resource, ResourceCreateMap, AssetResourceCreate } from '@noya-app/noya-schemas';
4
4
  import React, { ReactNode } from 'react';
5
5
  import * as tree_visit_lib_types from 'tree-visit/lib/types';
6
6
  import * as tree_visit from 'tree-visit';
@@ -45499,17 +45499,17 @@ declare const createMediaItemTree: (mediaMap: MediaMap) => {
45499
45499
  };
45500
45500
  type MediaItemTree = ReturnType<typeof createMediaItemTree>;
45501
45501
 
45502
- type FileKindFilter = "assets" | "directories" | "all";
45503
- type ExpandedMap = Record<string, boolean | undefined>;
45504
- type GetVisibleItemsOptions = {
45505
- expandedMap: ExpandedMap;
45506
- fileKindFilter: FileKindFilter;
45502
+ type MediaFileKindFilter = "assets" | "directories" | "all";
45503
+ type MediaExpandedMap = Record<string, boolean | undefined>;
45504
+ type MediaGetVisibleItemsOptions = {
45505
+ expandedMap: MediaExpandedMap;
45506
+ fileKindFilter: MediaFileKindFilter;
45507
45507
  rootItemId: string;
45508
45508
  tree: MediaItemTree;
45509
45509
  showAllDescendants: boolean;
45510
45510
  showRootItem: boolean;
45511
45511
  };
45512
- declare const getVisibleItems: ({ expandedMap, fileKindFilter, rootItemId, tree, showAllDescendants, showRootItem, }: GetVisibleItemsOptions) => ({
45512
+ declare const mediaGetVisibleItems: ({ expandedMap, fileKindFilter, rootItemId, tree, showAllDescendants, showRootItem, }: MediaGetVisibleItemsOptions) => ({
45513
45513
  id: string;
45514
45514
  kind: "folder";
45515
45515
  } | {
@@ -45526,20 +45526,12 @@ declare const getVisibleItems: ({ expandedMap, fileKindFilter, rootItemId, tree,
45526
45526
  kind: "noyaFile";
45527
45527
  fileId: string;
45528
45528
  })[];
45529
- /**
45530
- * Validates if a basename follows typical file naming conventions
45531
- * Disallows:
45532
- * - Path separators (/ and \)
45533
- * - Characters typically invalid in filesystems (<, >, :, ", |, ?, *)
45534
- * - Empty names
45535
- */
45536
- declare const basenameValidator: (basename: string) => boolean;
45537
- declare const validateMediaItemRename: ({ basename, selectedItemPath, media, }: {
45529
+ declare const mediaValidateMediaItemRename: ({ basename, selectedItemPath, media, }: {
45538
45530
  basename: string;
45539
45531
  selectedItemPath: string;
45540
45532
  media: MediaMap;
45541
45533
  }) => boolean;
45542
- declare const movePathsIntoTarget: ({ media, sourceItemPaths, targetItemPath, tree, }: {
45534
+ declare const mediaMovePathsIntoTarget: ({ media, sourceItemPaths, targetItemPath, tree, }: {
45543
45535
  media: MediaMap;
45544
45536
  sourceItemPaths: string[];
45545
45537
  targetItemPath: string;
@@ -45563,7 +45555,7 @@ declare const movePathsIntoTarget: ({ media, sourceItemPaths, targetItemPath, tr
45563
45555
  fileId: string;
45564
45556
  };
45565
45557
  };
45566
- declare const moveUpAFolder: ({ tree, media, selectedIds, }: {
45558
+ declare const mediaMoveUpAFolder: ({ tree, media, selectedIds, }: {
45567
45559
  tree: MediaItemTree;
45568
45560
  media: MediaMap;
45569
45561
  selectedIds: string[];
@@ -45586,20 +45578,20 @@ declare const moveUpAFolder: ({ tree, media, selectedIds, }: {
45586
45578
  fileId: string;
45587
45579
  };
45588
45580
  } | undefined;
45589
- declare const getDepthMap: (item: MediaItem, tree: MediaItemTree, showAllDescendants: boolean) => Record<string, number>;
45590
- declare const updateExpandedMap: ({ item, expanded, expandable, expandedMap, tree, }: {
45581
+ declare const mediaGetDepthMap: (item: MediaItem, tree: MediaItemTree, showAllDescendants: boolean) => Record<string, number>;
45582
+ declare const mediaUpdateExpandedMap: ({ item, expanded, expandable, expandedMap, tree, }: {
45591
45583
  item: MediaItem;
45592
45584
  expanded: boolean;
45593
45585
  expandable: boolean;
45594
- expandedMap: ExpandedMap;
45586
+ expandedMap: MediaExpandedMap;
45595
45587
  tree: MediaItemTree;
45596
- }) => ExpandedMap;
45597
- declare const deleteMediaItems: ({ selectedIds, media, tree, }: {
45588
+ }) => MediaExpandedMap;
45589
+ declare const mediaDeleteMediaItems: ({ selectedIds, media, tree, }: {
45598
45590
  selectedIds: string[];
45599
45591
  media: MediaMap;
45600
45592
  tree: MediaItemTree;
45601
45593
  }) => MediaMap;
45602
- declare const moveMediaInsideFolder: ({ sourceItemIds, targetItemId, media, tree, }: {
45594
+ declare const mediaMoveMediaInsideFolder: ({ sourceItemIds, targetItemId, media, tree, }: {
45603
45595
  sourceItemIds: string[];
45604
45596
  targetItemId: string;
45605
45597
  media: MediaMap;
@@ -45623,7 +45615,7 @@ declare const moveMediaInsideFolder: ({ sourceItemIds, targetItemId, media, tree
45623
45615
  fileId: string;
45624
45616
  };
45625
45617
  };
45626
- declare const getParentDirectories: (mediaMap: MediaMap, folderId: string) => ({
45618
+ declare const mediaGetParentDirectories: (mediaMap: MediaMap, folderId: string) => ({
45627
45619
  id: string;
45628
45620
  kind: "folder";
45629
45621
  } | {
@@ -45640,7 +45632,7 @@ declare const getParentDirectories: (mediaMap: MediaMap, folderId: string) => ({
45640
45632
  kind: "noyaFile";
45641
45633
  fileId: string;
45642
45634
  })[];
45643
- declare const renameMediaItemAndDescendantPaths: ({ newName, selectedItemPath, media, tree, }: {
45635
+ declare const mediaRenameMediaItemAndDescendantPaths: ({ newName, selectedItemPath, media, tree, }: {
45644
45636
  newName: string;
45645
45637
  selectedItemPath: string;
45646
45638
  media: MediaMap;
@@ -45665,7 +45657,7 @@ declare const renameMediaItemAndDescendantPaths: ({ newName, selectedItemPath, m
45665
45657
  };
45666
45658
  };
45667
45659
 
45668
- type MenuAction = "preview" | "download" | "upload" | "rename" | "replace" | "delete" | "move" | "addFolder";
45660
+ type MenuAction$1 = "preview" | "download" | "upload" | "rename" | "replace" | "delete" | "move" | "addFolder";
45669
45661
  type MediaCollectionRef = {
45670
45662
  upload: (selectedId: string) => void;
45671
45663
  delete: (selectedIds: string[]) => void;
@@ -45692,7 +45684,7 @@ declare const MediaCollection: React.NamedExoticComponent<{
45692
45684
  *
45693
45685
  * @default "all"
45694
45686
  * */
45695
- fileKindFilter?: FileKindFilter;
45687
+ fileKindFilter?: MediaFileKindFilter;
45696
45688
  /**
45697
45689
  * Whether to show the root item
45698
45690
  *
@@ -45700,7 +45692,7 @@ declare const MediaCollection: React.NamedExoticComponent<{
45700
45692
  * */
45701
45693
  showRootItem?: boolean;
45702
45694
  /** Whether to expand all directories by default */
45703
- initialExpanded?: ExpandedMap;
45695
+ initialExpanded?: MediaExpandedMap;
45704
45696
  /**
45705
45697
  * Callback for when an item is double-clicked
45706
45698
  */
@@ -45718,11 +45710,12 @@ declare const MediaCollection: React.NamedExoticComponent<{
45718
45710
  * @default true
45719
45711
  * */
45720
45712
  showAllDescendants?: boolean;
45721
- renderAction?: Exclude<CollectionProps<MediaItem, MenuAction>["renderAction"], "menu">;
45713
+ renderAction?: Exclude<CollectionProps<MediaItem, MenuAction$1>["renderAction"], "menu">;
45722
45714
  /** @default false */
45723
45715
  sortable?: boolean;
45724
45716
  renderThumbnailIcon?: MediaThumbnailProps["renderThumbnailIcon"];
45725
45717
  onDidDeleteItems?: (items: [string, MediaItem][]) => void;
45718
+ onAssetsUploaded?: (mediaMap: Record<string, AssetMediaItem>) => void;
45726
45719
  } & Pick<CollectionProps<{
45727
45720
  id: string;
45728
45721
  kind: "folder";
@@ -45739,7 +45732,7 @@ declare const MediaCollection: React.NamedExoticComponent<{
45739
45732
  id: string;
45740
45733
  kind: "noyaFile";
45741
45734
  fileId: string;
45742
- }, MenuAction>, "size" | "scrollable" | "renderEmptyState" | "sharedDragProps" | "expandable" | "sortableId" | "renamable" | "onClickItem"> & React.RefAttributes<MediaCollectionRef>>;
45735
+ }, MenuAction$1>, "size" | "scrollable" | "renderEmptyState" | "sharedDragProps" | "expandable" | "sortableId" | "renamable" | "onClickItem"> & React.RefAttributes<MediaCollectionRef>>;
45743
45736
  declare function acceptsMediaItemDrop(parameters: {
45744
45737
  position: RelativeDropPosition;
45745
45738
  sourceItem: MediaItem;
@@ -45747,4 +45740,602 @@ declare function acceptsMediaItemDrop(parameters: {
45747
45740
  tree: MediaItemTree;
45748
45741
  }): boolean;
45749
45742
 
45750
- export { type ExpandedMap, type FileKindFilter, type GetVisibleItemsOptions, MediaCollection, type MediaCollectionRef, type MediaItemTree, PLACEHOLDER_ITEM_NAME, acceptsMediaItemDrop, basenameValidator, createMediaAsset, createMediaFile, createMediaFolder, createMediaItem, createMediaItemTree, deleteMediaItems, getDepthMap, getParentDirectories, getVisibleItems, moveMediaInsideFolder, movePathsIntoTarget, moveUpAFolder, renameMediaItemAndDescendantPaths, rootMediaItem, rootMediaItemName, rootMediaItemPath, updateExpandedMap, validateMediaItemRename };
45743
+ type FileKindFilter = "assets" | "directories" | "resources" | "all";
45744
+ type ExpandedMap = Record<string, boolean | undefined>;
45745
+ type GetVisibleItemsOptions = {
45746
+ expandedMap: ExpandedMap;
45747
+ fileKindFilter: FileKindFilter;
45748
+ rootItemId: string;
45749
+ tree: ResourceTree;
45750
+ showAllDescendants: boolean;
45751
+ showRootItem: boolean;
45752
+ };
45753
+ declare const getVisibleItems: ({ expandedMap, fileKindFilter, rootItemId, tree, showAllDescendants, showRootItem, }: GetVisibleItemsOptions) => ({
45754
+ url?: string | undefined;
45755
+ accessibleByFile?: {
45756
+ id: string;
45757
+ name: string;
45758
+ toolId: string;
45759
+ } | undefined;
45760
+ id: string;
45761
+ type: "asset";
45762
+ path: string;
45763
+ createdAt: string;
45764
+ assetId: string;
45765
+ stableId: string;
45766
+ updatedAt: string;
45767
+ accessibleByFileId: string | null;
45768
+ accessibleByFileVersionId: string | null;
45769
+ } | {
45770
+ url?: string | undefined;
45771
+ accessibleByFile?: {
45772
+ id: string;
45773
+ name: string;
45774
+ toolId: string;
45775
+ } | undefined;
45776
+ id: string;
45777
+ type: "file";
45778
+ path: string;
45779
+ createdAt: string;
45780
+ fileId: string;
45781
+ stableId: string;
45782
+ updatedAt: string;
45783
+ accessibleByFileId: string | null;
45784
+ accessibleByFileVersionId: string | null;
45785
+ } | {
45786
+ url?: string | undefined;
45787
+ accessibleByFile?: {
45788
+ id: string;
45789
+ name: string;
45790
+ toolId: string;
45791
+ } | undefined;
45792
+ id: string;
45793
+ type: "directory";
45794
+ path: string;
45795
+ createdAt: string;
45796
+ stableId: string;
45797
+ updatedAt: string;
45798
+ accessibleByFileId: string | null;
45799
+ accessibleByFileVersionId: string | null;
45800
+ } | {
45801
+ url?: string | undefined;
45802
+ accessibleByFile?: {
45803
+ id: string;
45804
+ name: string;
45805
+ toolId: string;
45806
+ } | undefined;
45807
+ id: string;
45808
+ type: "resource";
45809
+ path: string;
45810
+ createdAt: string;
45811
+ fileId: string;
45812
+ resourceId: string;
45813
+ stableId: string;
45814
+ updatedAt: string;
45815
+ accessibleByFileId: string | null;
45816
+ accessibleByFileVersionId: string | null;
45817
+ })[];
45818
+ /**
45819
+ * Validates if a basename follows typical file naming conventions
45820
+ * Disallows:
45821
+ * - Path separators (/ and \)
45822
+ * - Characters typically invalid in filesystems (<, >, :, ", |, ?, *)
45823
+ * - Empty names
45824
+ */
45825
+ declare const basenameValidator: (basename: string) => boolean;
45826
+ declare const validateResourceRename: ({ basename, selectedItemPath, media, }: {
45827
+ basename: string;
45828
+ selectedItemPath: string;
45829
+ media: ResourceMap;
45830
+ }) => boolean;
45831
+ declare const movePathsIntoTarget: ({ media, sourceItemPaths, targetItemPath, tree, }: {
45832
+ media: ResourceMap;
45833
+ sourceItemPaths: string[];
45834
+ targetItemPath: string;
45835
+ tree: ResourceTree;
45836
+ }) => {
45837
+ [x: string]: {
45838
+ url?: string | undefined;
45839
+ accessibleByFile?: {
45840
+ id: string;
45841
+ name: string;
45842
+ toolId: string;
45843
+ } | undefined;
45844
+ id: string;
45845
+ type: "asset";
45846
+ path: string;
45847
+ createdAt: string;
45848
+ assetId: string;
45849
+ stableId: string;
45850
+ updatedAt: string;
45851
+ accessibleByFileId: string | null;
45852
+ accessibleByFileVersionId: string | null;
45853
+ } | {
45854
+ url?: string | undefined;
45855
+ accessibleByFile?: {
45856
+ id: string;
45857
+ name: string;
45858
+ toolId: string;
45859
+ } | undefined;
45860
+ id: string;
45861
+ type: "file";
45862
+ path: string;
45863
+ createdAt: string;
45864
+ fileId: string;
45865
+ stableId: string;
45866
+ updatedAt: string;
45867
+ accessibleByFileId: string | null;
45868
+ accessibleByFileVersionId: string | null;
45869
+ } | {
45870
+ url?: string | undefined;
45871
+ accessibleByFile?: {
45872
+ id: string;
45873
+ name: string;
45874
+ toolId: string;
45875
+ } | undefined;
45876
+ id: string;
45877
+ type: "directory";
45878
+ path: string;
45879
+ createdAt: string;
45880
+ stableId: string;
45881
+ updatedAt: string;
45882
+ accessibleByFileId: string | null;
45883
+ accessibleByFileVersionId: string | null;
45884
+ } | {
45885
+ url?: string | undefined;
45886
+ accessibleByFile?: {
45887
+ id: string;
45888
+ name: string;
45889
+ toolId: string;
45890
+ } | undefined;
45891
+ id: string;
45892
+ type: "resource";
45893
+ path: string;
45894
+ createdAt: string;
45895
+ fileId: string;
45896
+ resourceId: string;
45897
+ stableId: string;
45898
+ updatedAt: string;
45899
+ accessibleByFileId: string | null;
45900
+ accessibleByFileVersionId: string | null;
45901
+ };
45902
+ };
45903
+ declare const moveUpAFolder: ({ tree, media, selectedIds, }: {
45904
+ tree: ResourceTree;
45905
+ media: ResourceMap;
45906
+ selectedIds: string[];
45907
+ }) => {
45908
+ [x: string]: {
45909
+ url?: string | undefined;
45910
+ accessibleByFile?: {
45911
+ id: string;
45912
+ name: string;
45913
+ toolId: string;
45914
+ } | undefined;
45915
+ id: string;
45916
+ type: "asset";
45917
+ path: string;
45918
+ createdAt: string;
45919
+ assetId: string;
45920
+ stableId: string;
45921
+ updatedAt: string;
45922
+ accessibleByFileId: string | null;
45923
+ accessibleByFileVersionId: string | null;
45924
+ } | {
45925
+ url?: string | undefined;
45926
+ accessibleByFile?: {
45927
+ id: string;
45928
+ name: string;
45929
+ toolId: string;
45930
+ } | undefined;
45931
+ id: string;
45932
+ type: "file";
45933
+ path: string;
45934
+ createdAt: string;
45935
+ fileId: string;
45936
+ stableId: string;
45937
+ updatedAt: string;
45938
+ accessibleByFileId: string | null;
45939
+ accessibleByFileVersionId: string | null;
45940
+ } | {
45941
+ url?: string | undefined;
45942
+ accessibleByFile?: {
45943
+ id: string;
45944
+ name: string;
45945
+ toolId: string;
45946
+ } | undefined;
45947
+ id: string;
45948
+ type: "directory";
45949
+ path: string;
45950
+ createdAt: string;
45951
+ stableId: string;
45952
+ updatedAt: string;
45953
+ accessibleByFileId: string | null;
45954
+ accessibleByFileVersionId: string | null;
45955
+ } | {
45956
+ url?: string | undefined;
45957
+ accessibleByFile?: {
45958
+ id: string;
45959
+ name: string;
45960
+ toolId: string;
45961
+ } | undefined;
45962
+ id: string;
45963
+ type: "resource";
45964
+ path: string;
45965
+ createdAt: string;
45966
+ fileId: string;
45967
+ resourceId: string;
45968
+ stableId: string;
45969
+ updatedAt: string;
45970
+ accessibleByFileId: string | null;
45971
+ accessibleByFileVersionId: string | null;
45972
+ };
45973
+ } | undefined;
45974
+ declare const getDepthMap: (item: Resource, tree: ResourceTree, showAllDescendants: boolean) => Record<string, number>;
45975
+ declare const updateExpandedMap: ({ item, expanded, expandable, expandedMap, tree, }: {
45976
+ item: Resource;
45977
+ expanded: boolean;
45978
+ expandable: boolean;
45979
+ expandedMap: ExpandedMap;
45980
+ tree: ResourceTree;
45981
+ }) => ExpandedMap;
45982
+ declare const deleteResources: ({ selectedIds, media, tree, }: {
45983
+ selectedIds: string[];
45984
+ media: ResourceMap;
45985
+ tree: ResourceTree;
45986
+ }) => ResourceMap;
45987
+ declare const moveMediaInsideFolder: ({ sourceItemIds, targetItemId, media, tree, }: {
45988
+ sourceItemIds: string[];
45989
+ targetItemId: string;
45990
+ media: ResourceMap;
45991
+ tree: ResourceTree;
45992
+ }) => ResourceMap;
45993
+ declare const getParentDirectories: (resourceMap: ResourceMap, folderId: string) => ({
45994
+ url?: string | undefined;
45995
+ accessibleByFile?: {
45996
+ id: string;
45997
+ name: string;
45998
+ toolId: string;
45999
+ } | undefined;
46000
+ id: string;
46001
+ type: "asset";
46002
+ path: string;
46003
+ createdAt: string;
46004
+ assetId: string;
46005
+ stableId: string;
46006
+ updatedAt: string;
46007
+ accessibleByFileId: string | null;
46008
+ accessibleByFileVersionId: string | null;
46009
+ } | {
46010
+ url?: string | undefined;
46011
+ accessibleByFile?: {
46012
+ id: string;
46013
+ name: string;
46014
+ toolId: string;
46015
+ } | undefined;
46016
+ id: string;
46017
+ type: "file";
46018
+ path: string;
46019
+ createdAt: string;
46020
+ fileId: string;
46021
+ stableId: string;
46022
+ updatedAt: string;
46023
+ accessibleByFileId: string | null;
46024
+ accessibleByFileVersionId: string | null;
46025
+ } | {
46026
+ url?: string | undefined;
46027
+ accessibleByFile?: {
46028
+ id: string;
46029
+ name: string;
46030
+ toolId: string;
46031
+ } | undefined;
46032
+ id: string;
46033
+ type: "directory";
46034
+ path: string;
46035
+ createdAt: string;
46036
+ stableId: string;
46037
+ updatedAt: string;
46038
+ accessibleByFileId: string | null;
46039
+ accessibleByFileVersionId: string | null;
46040
+ } | {
46041
+ url?: string | undefined;
46042
+ accessibleByFile?: {
46043
+ id: string;
46044
+ name: string;
46045
+ toolId: string;
46046
+ } | undefined;
46047
+ id: string;
46048
+ type: "resource";
46049
+ path: string;
46050
+ createdAt: string;
46051
+ fileId: string;
46052
+ resourceId: string;
46053
+ stableId: string;
46054
+ updatedAt: string;
46055
+ accessibleByFileId: string | null;
46056
+ accessibleByFileVersionId: string | null;
46057
+ })[];
46058
+ declare const renameResourceAndDescendantPaths: ({ newName, selectedItemPath, media, tree, }: {
46059
+ newName: string;
46060
+ selectedItemPath: string;
46061
+ media: ResourceMap;
46062
+ tree: ResourceTree;
46063
+ }) => {
46064
+ [x: string]: {
46065
+ url?: string | undefined;
46066
+ accessibleByFile?: {
46067
+ id: string;
46068
+ name: string;
46069
+ toolId: string;
46070
+ } | undefined;
46071
+ id: string;
46072
+ type: "asset";
46073
+ path: string;
46074
+ createdAt: string;
46075
+ assetId: string;
46076
+ stableId: string;
46077
+ updatedAt: string;
46078
+ accessibleByFileId: string | null;
46079
+ accessibleByFileVersionId: string | null;
46080
+ } | {
46081
+ url?: string | undefined;
46082
+ accessibleByFile?: {
46083
+ id: string;
46084
+ name: string;
46085
+ toolId: string;
46086
+ } | undefined;
46087
+ id: string;
46088
+ type: "file";
46089
+ path: string;
46090
+ createdAt: string;
46091
+ fileId: string;
46092
+ stableId: string;
46093
+ updatedAt: string;
46094
+ accessibleByFileId: string | null;
46095
+ accessibleByFileVersionId: string | null;
46096
+ } | {
46097
+ url?: string | undefined;
46098
+ accessibleByFile?: {
46099
+ id: string;
46100
+ name: string;
46101
+ toolId: string;
46102
+ } | undefined;
46103
+ id: string;
46104
+ type: "directory";
46105
+ path: string;
46106
+ createdAt: string;
46107
+ stableId: string;
46108
+ updatedAt: string;
46109
+ accessibleByFileId: string | null;
46110
+ accessibleByFileVersionId: string | null;
46111
+ } | {
46112
+ url?: string | undefined;
46113
+ accessibleByFile?: {
46114
+ id: string;
46115
+ name: string;
46116
+ toolId: string;
46117
+ } | undefined;
46118
+ id: string;
46119
+ type: "resource";
46120
+ path: string;
46121
+ createdAt: string;
46122
+ fileId: string;
46123
+ resourceId: string;
46124
+ stableId: string;
46125
+ updatedAt: string;
46126
+ accessibleByFileId: string | null;
46127
+ accessibleByFileVersionId: string | null;
46128
+ };
46129
+ };
46130
+
46131
+ declare const gridThumbnailDimension: {
46132
+ width: number;
46133
+ height: number;
46134
+ };
46135
+ declare const ResourceThumbnail: (props: CollectionThumbnailProps<{
46136
+ url?: string | undefined;
46137
+ accessibleByFile?: {
46138
+ id: string;
46139
+ name: string;
46140
+ toolId: string;
46141
+ } | undefined;
46142
+ id: string;
46143
+ type: "asset";
46144
+ path: string;
46145
+ createdAt: string;
46146
+ assetId: string;
46147
+ stableId: string;
46148
+ updatedAt: string;
46149
+ accessibleByFileId: string | null;
46150
+ accessibleByFileVersionId: string | null;
46151
+ } | {
46152
+ url?: string | undefined;
46153
+ accessibleByFile?: {
46154
+ id: string;
46155
+ name: string;
46156
+ toolId: string;
46157
+ } | undefined;
46158
+ id: string;
46159
+ type: "file";
46160
+ path: string;
46161
+ createdAt: string;
46162
+ fileId: string;
46163
+ stableId: string;
46164
+ updatedAt: string;
46165
+ accessibleByFileId: string | null;
46166
+ accessibleByFileVersionId: string | null;
46167
+ } | {
46168
+ url?: string | undefined;
46169
+ accessibleByFile?: {
46170
+ id: string;
46171
+ name: string;
46172
+ toolId: string;
46173
+ } | undefined;
46174
+ id: string;
46175
+ type: "directory";
46176
+ path: string;
46177
+ createdAt: string;
46178
+ stableId: string;
46179
+ updatedAt: string;
46180
+ accessibleByFileId: string | null;
46181
+ accessibleByFileVersionId: string | null;
46182
+ } | {
46183
+ url?: string | undefined;
46184
+ accessibleByFile?: {
46185
+ id: string;
46186
+ name: string;
46187
+ toolId: string;
46188
+ } | undefined;
46189
+ id: string;
46190
+ type: "resource";
46191
+ path: string;
46192
+ createdAt: string;
46193
+ fileId: string;
46194
+ resourceId: string;
46195
+ stableId: string;
46196
+ updatedAt: string;
46197
+ accessibleByFileId: string | null;
46198
+ accessibleByFileVersionId: string | null;
46199
+ }> & {
46200
+ path?: string;
46201
+ renderThumbnailIcon?: MediaThumbnailProps["renderThumbnailIcon"];
46202
+ className?: string;
46203
+ url?: string;
46204
+ contentType?: string;
46205
+ viewType?: CollectionViewType;
46206
+ }) => React.ReactElement<any> | null;
46207
+ type MenuAction = "preview" | "download" | "upload" | "rename" | "replace" | "delete" | "move" | "addFolder";
46208
+ type ResourceExplorerRef = {
46209
+ upload: (selectedId: string) => void;
46210
+ delete: (selectedIds: string[]) => void;
46211
+ download: (selectedItems: Resource[]) => void;
46212
+ rename: (selectedItemId: string) => void;
46213
+ addFolder: (currentFolderId: string) => void;
46214
+ moveUpAFolder: (selectedIds: string[]) => void;
46215
+ replace: (selectedItem: Resource) => void;
46216
+ preview: (selectedItems: Resource[]) => void;
46217
+ getItemAtIndex: (index: number) => Resource | undefined;
46218
+ };
46219
+ declare const ResourceExplorer: React.NamedExoticComponent<{
46220
+ parentFileId: string;
46221
+ onSelectionChange?: (selectedIds: string[], event?: ListView.ClickInfo) => void;
46222
+ selectedIds?: string[];
46223
+ media: ResourceMap;
46224
+ setMedia?: (metadata: Partial<MultiplayerPatchMetadata>, media: ResourceCreateMap) => void;
46225
+ /** @default false */
46226
+ readOnly?: boolean;
46227
+ /** @default "list" */
46228
+ viewType?: CollectionViewType;
46229
+ /**
46230
+ * Whether to show assets or directories or all media items
46231
+ *
46232
+ * @default "all"
46233
+ * */
46234
+ fileKindFilter?: FileKindFilter;
46235
+ /**
46236
+ * Whether to show the root item
46237
+ *
46238
+ * @default false
46239
+ * */
46240
+ showRootItem?: boolean;
46241
+ /** Whether to expand all directories by default */
46242
+ initialExpanded?: ExpandedMap;
46243
+ /**
46244
+ * Callback for when an item is double-clicked
46245
+ */
46246
+ onDoubleClickItem?: (resourceItemId: string) => void;
46247
+ /**
46248
+ * If provided, only show items that are descendants of this folder
46249
+ */
46250
+ rootItemId?: string;
46251
+ title?: ReactNode;
46252
+ right?: ReactNode;
46253
+ className?: string;
46254
+ showUploadButton?: boolean;
46255
+ /**
46256
+ * If true, show all descendants of all directories within a collection
46257
+ * @default true
46258
+ * */
46259
+ showAllDescendants?: boolean;
46260
+ renderAction?: Exclude<CollectionProps<Resource, MenuAction>["renderAction"], "menu">;
46261
+ /** @default false */
46262
+ sortable?: boolean;
46263
+ renderThumbnailIcon?: MediaThumbnailProps["renderThumbnailIcon"];
46264
+ onDidDeleteItems?: (items: [string, Resource][]) => void;
46265
+ onAssetsUploaded?: (mediaMap: Record<string, AssetResourceCreate>) => void;
46266
+ publishedResources?: Record<string, Resource>;
46267
+ virtualized?: boolean;
46268
+ renderUser?: (resource: Resource) => ReactNode;
46269
+ } & Pick<CollectionProps<{
46270
+ url?: string | undefined;
46271
+ accessibleByFile?: {
46272
+ id: string;
46273
+ name: string;
46274
+ toolId: string;
46275
+ } | undefined;
46276
+ id: string;
46277
+ type: "asset";
46278
+ path: string;
46279
+ createdAt: string;
46280
+ assetId: string;
46281
+ stableId: string;
46282
+ updatedAt: string;
46283
+ accessibleByFileId: string | null;
46284
+ accessibleByFileVersionId: string | null;
46285
+ } | {
46286
+ url?: string | undefined;
46287
+ accessibleByFile?: {
46288
+ id: string;
46289
+ name: string;
46290
+ toolId: string;
46291
+ } | undefined;
46292
+ id: string;
46293
+ type: "file";
46294
+ path: string;
46295
+ createdAt: string;
46296
+ fileId: string;
46297
+ stableId: string;
46298
+ updatedAt: string;
46299
+ accessibleByFileId: string | null;
46300
+ accessibleByFileVersionId: string | null;
46301
+ } | {
46302
+ url?: string | undefined;
46303
+ accessibleByFile?: {
46304
+ id: string;
46305
+ name: string;
46306
+ toolId: string;
46307
+ } | undefined;
46308
+ id: string;
46309
+ type: "directory";
46310
+ path: string;
46311
+ createdAt: string;
46312
+ stableId: string;
46313
+ updatedAt: string;
46314
+ accessibleByFileId: string | null;
46315
+ accessibleByFileVersionId: string | null;
46316
+ } | {
46317
+ url?: string | undefined;
46318
+ accessibleByFile?: {
46319
+ id: string;
46320
+ name: string;
46321
+ toolId: string;
46322
+ } | undefined;
46323
+ id: string;
46324
+ type: "resource";
46325
+ path: string;
46326
+ createdAt: string;
46327
+ fileId: string;
46328
+ resourceId: string;
46329
+ stableId: string;
46330
+ updatedAt: string;
46331
+ accessibleByFileId: string | null;
46332
+ accessibleByFileVersionId: string | null;
46333
+ }, MenuAction>, "size" | "scrollable" | "renderEmptyState" | "sharedDragProps" | "expandable" | "sortableId" | "renamable" | "onClickItem" | "itemStyle" | "itemClassName"> & React.RefAttributes<ResourceExplorerRef>>;
46334
+ declare function acceptsResourceDrop(parameters: {
46335
+ position: RelativeDropPosition;
46336
+ sourceItem: Resource;
46337
+ targetItem: Resource;
46338
+ tree: ResourceTree;
46339
+ }): boolean;
46340
+
46341
+ export { type ExpandedMap, type FileKindFilter, type GetVisibleItemsOptions, MediaCollection, type MediaCollectionRef, type MediaExpandedMap, type MediaFileKindFilter, type MediaGetVisibleItemsOptions, type MediaItemTree, PLACEHOLDER_ITEM_NAME, ResourceExplorer, type ResourceExplorerRef, ResourceThumbnail, acceptsMediaItemDrop, acceptsResourceDrop, basenameValidator, createMediaAsset, createMediaFile, createMediaFolder, createMediaItem, createMediaItemTree, deleteResources, getDepthMap, getParentDirectories, getVisibleItems, gridThumbnailDimension, mediaDeleteMediaItems, mediaGetDepthMap, mediaGetParentDirectories, mediaGetVisibleItems, mediaMoveMediaInsideFolder, mediaMovePathsIntoTarget, mediaMoveUpAFolder, mediaRenameMediaItemAndDescendantPaths, mediaUpdateExpandedMap, mediaValidateMediaItemRename, moveMediaInsideFolder, movePathsIntoTarget, moveUpAFolder, renameResourceAndDescendantPaths, rootMediaItem, rootMediaItemName, rootMediaItemPath, updateExpandedMap, validateResourceRename };