@nocode-factory/sanity-kit 2.51.0 → 2.52.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.
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { a as CodeEmbedTypeOptions, i as codeEditorInput, n as CodeEditorInput, o as defineCodeEmbedType, r as CodeLanguage, t as CodeEmbedInput } from "./CodeEmbedInput-CobMRQ5s.js";
2
2
  import { A as ResolvedDocumentColumn, C as NcfInternalFieldOption, D as NcfToolName, E as NcfPageTypeInput, M as ResolvedI18n, N as ResolvedKitConfig, O as NcfToolsConfig, P as ResolvedPageType, S as NcfInternalField, T as NcfPageTypeConfig, _ as NcfComponentPreviewConfig, a as pageTypesFromSiteRoutes, b as NcfHistoryConfig, c as componentDefaultsMainDocuments, d as requiredUnlessDefault, f as requiredUnlessDefaultFor, g as NcfBoardTag, h as KitContextValue, i as SiteRoutesRegistry, j as ResolvedHistory, k as ResolvedComponentPreview, l as defaultsFieldName, m as IssueLevel, n as fixCrossLanguageReferences, o as DEFAULT_COMPONENT_DEFAULTS_TYPE, p as ConfigIssue, r as withSameLanguageReferences, s as componentDefaultsMainDocument, t as CrossLanguageReport, u as defineComponentDefaults, v as NcfDocumentColumn, w as NcfKitConfig, x as NcfI18nConfig, y as NcfEnvironment } from "./fixCrossLanguageReferences-w3whO9xM.js";
3
3
  import { ComponentType, ReactNode } from "react";
4
- import { LayoutProps, SanityClient, Schema, Tool, ToolMenuProps } from "sanity";
4
+ import { AssetSourceComponentProps, LayoutProps, SanityClient, Schema, Tool, ToolMenuProps } from "sanity";
5
5
  import { PreviewHeaderProps } from "sanity/presentation";
6
6
  /** Garantit un chemin absolu ('accueil' -> '/accueil', '' -> '/'). */
7
7
  export declare const normalizePath: (path: string) => string;
@@ -916,6 +916,25 @@ export declare function groupComponents(blocks: readonly BlockTypeInfo[], groupO
916
916
  * libellés du menu d'insertion) : pas d'écriture, donc pas de provider unique.
917
917
  */
918
918
  export declare function useComponentNames(): Map<string, string>;
919
+ interface AssetUploadState {
920
+ /** Téléverse des fichiers ; `onUploaded` reçoit l'id de chaque asset créé. */
921
+ upload: (files: FileList | readonly File[], onUploaded?: (assetId: string) => void) => Promise<void>;
922
+ /** Nombre de fichiers en cours de téléversement. */
923
+ uploading: number;
924
+ error: Error | null;
925
+ }
926
+ /**
927
+ * Téléverse des assets dans le dataset depuis l'outil Assets
928
+ * (`client.assets.upload`). La liste se met à jour toute seule (écoute des
929
+ * mutations d'assets) ; `onUploaded` permet de ranger l'asset dans un dossier.
930
+ */
931
+ export declare function useAssetUpload(): AssetUploadState;
932
+ /**
933
+ * Source d'asset « NCF Médias » : le sélecteur d'image/fichier d'un champ montre
934
+ * les mêmes DOSSIERS et la même recherche que l'onglet Assets. Sans ça,
935
+ * l'organisation ne servirait qu'à l'onglet et pas au choix d'un média.
936
+ */
937
+ export declare function AssetSourceBrowser(props: AssetSourceComponentProps): import("react").JSX.Element;
919
938
  /**
920
939
  * Les projections sont préfixées `ncf` pour ne jamais entrer en collision avec
921
940
  * un champ du client, quel que soit son schéma.
@@ -1398,7 +1417,7 @@ export declare function ActorName(props: {
1398
1417
  * quelle version. Recopiée de `package.json` par `npm version` (scripts/sync-version.mjs) ; un test
1399
1418
  * le vérifie.
1400
1419
  */
1401
- export declare const KIT_VERSION = "2.51.0";
1420
+ export declare const KIT_VERSION = "2.52.0";
1402
1421
  /**
1403
1422
  * Données de la page proposées comme colonnes.
1404
1423
  *
@@ -1895,5 +1914,5 @@ export declare const NCF_DESIGN_SYSTEM_TOOL = "ncf-design-system";
1895
1914
  export declare const NCF_ASSETS_TOOL = "ncf-assets";
1896
1915
  export declare const NCF_TOOL_NAMES: readonly ["ncf-pages", "ncf-components", "ncf-history", "ncf-design-system", "ncf-assets"];
1897
1916
  export declare const ncfKit: import("sanity").Plugin<NcfKitConfig>;
1898
- export { type AddColumnInput, type Annotation, type AnnotationsState, type AssetAssignment, type AssetDoc, type AssetFolder, type AssetMetaState, type AssetSortKey, type AssetTypeFilter, type AssetUsageFilter, type BlockOccurrence, type BlockTypeInfo, type BoardEdge, type BoardGraph, type BoardLayoutState, type BoardNode, CONTENT_SCAN_LIMIT as OCCURRENCE_SCAN_LIMIT, type Change, type ChangeKind, CodeEditorInput, CodeEmbedInput, type CodeEmbedTypeOptions, type CodeLanguage, type CollectedLinks, type ColorBy, type ColorOptions, type ComponentEntry, type ComponentGroup, type ComponentGrouping, type ConfigIssue, type CrossLanguageReport, DEFAULT_COMPONENT_DEFAULTS_TYPE, type DeriveOptions, type FolderSelection, type GroupBy, type GroupOptions, type HistoryDetail, type HistoryEvent, type IssueLevel, type KitContextValue, type KitUpdate, type LayoutMode, type MainDocumentRoute, type MergedDoc, type NcfBoardTag, type NcfComponentPreviewConfig, type NcfDocumentColumn, type NcfEnvironment, type NcfHistoryConfig, type NcfI18nConfig, type NcfInternalField, type NcfInternalFieldOption, type NcfKitConfig, type NcfPageTypeConfig, type NcfPageTypeInput, type NcfToolName, type NcfToolsConfig, type NodeLayout, type NodePosition, type OccurrenceInput, type OccurrencePage, type OccurrencesState, type PageBuilderResolution, type PageContent, type PageContentsState, type PageDoc, type PageFilters, type PageRow, type PageStatus, type PagesState, type PathInput, type Positioned, type PresentationOptions, type PreviewGrant, type PreviewPerspective, type PreviewTargetState, type ProjectStatus, type Registration, type ResolvedComponentPreview, type ResolvedDocumentColumn, type ResolvedHistory, type ResolvedI18n, type ResolvedKitConfig, type ResolvedPageType, type RowColor, type RowGroup, type SchemaFieldLike, type SchemaTypeLike, type SectionLayout, type SectionMapNode, type SectionOrder, type SectionsMapOptions, type Segment, type SiteRoutesRegistry, type SortDirection, type SortKey, type ThumbnailInput, type VersionedDoc, codeEditorInput, componentDefaultsMainDocument, componentDefaultsMainDocuments, defaultsFieldName, defineCodeEmbedType, defineComponentDefaults, fixCrossLanguageReferences, pageTypesFromSiteRoutes, requiredUnlessDefault, requiredUnlessDefaultFor, withSameLanguageReferences };
1917
+ export { type AddColumnInput, type Annotation, type AnnotationsState, type AssetAssignment, type AssetDoc, type AssetFolder, type AssetMetaState, type AssetSortKey, type AssetTypeFilter, type AssetUploadState, type AssetUsageFilter, type BlockOccurrence, type BlockTypeInfo, type BoardEdge, type BoardGraph, type BoardLayoutState, type BoardNode, CONTENT_SCAN_LIMIT as OCCURRENCE_SCAN_LIMIT, type Change, type ChangeKind, CodeEditorInput, CodeEmbedInput, type CodeEmbedTypeOptions, type CodeLanguage, type CollectedLinks, type ColorBy, type ColorOptions, type ComponentEntry, type ComponentGroup, type ComponentGrouping, type ConfigIssue, type CrossLanguageReport, DEFAULT_COMPONENT_DEFAULTS_TYPE, type DeriveOptions, type FolderSelection, type GroupBy, type GroupOptions, type HistoryDetail, type HistoryEvent, type IssueLevel, type KitContextValue, type KitUpdate, type LayoutMode, type MainDocumentRoute, type MergedDoc, type NcfBoardTag, type NcfComponentPreviewConfig, type NcfDocumentColumn, type NcfEnvironment, type NcfHistoryConfig, type NcfI18nConfig, type NcfInternalField, type NcfInternalFieldOption, type NcfKitConfig, type NcfPageTypeConfig, type NcfPageTypeInput, type NcfToolName, type NcfToolsConfig, type NodeLayout, type NodePosition, type OccurrenceInput, type OccurrencePage, type OccurrencesState, type PageBuilderResolution, type PageContent, type PageContentsState, type PageDoc, type PageFilters, type PageRow, type PageStatus, type PagesState, type PathInput, type Positioned, type PresentationOptions, type PreviewGrant, type PreviewPerspective, type PreviewTargetState, type ProjectStatus, type Registration, type ResolvedComponentPreview, type ResolvedDocumentColumn, type ResolvedHistory, type ResolvedI18n, type ResolvedKitConfig, type ResolvedPageType, type RowColor, type RowGroup, type SchemaFieldLike, type SchemaTypeLike, type SectionLayout, type SectionMapNode, type SectionOrder, type SectionsMapOptions, type Segment, type SiteRoutesRegistry, type SortDirection, type SortKey, type ThumbnailInput, type VersionedDoc, codeEditorInput, componentDefaultsMainDocument, componentDefaultsMainDocuments, defaultsFieldName, defineCodeEmbedType, defineComponentDefaults, fixCrossLanguageReferences, pageTypesFromSiteRoutes, requiredUnlessDefault, requiredUnlessDefaultFor, withSameLanguageReferences };
1899
1918
  //# sourceMappingURL=index.d.ts.map
package/dist/index.js CHANGED
@@ -44,6 +44,7 @@ import { UndoIcon } from "@sanity/icons/Undo";
44
44
  import { FolderIcon } from "@sanity/icons/Folder";
45
45
  import { ThLargeIcon } from "@sanity/icons/ThLarge";
46
46
  import { ThListIcon } from "@sanity/icons/ThList";
47
+ import { UploadIcon } from "@sanity/icons/Upload";
47
48
  import { DocumentIcon } from "@sanity/icons/Document";
48
49
  import { Tooltip } from "@sanity/ui/tooltip";
49
50
  import { EyeClosedIcon } from "@sanity/icons/EyeClosed";
@@ -1406,7 +1407,7 @@ function explainGrantError(error) {
1406
1407
  * quelle version. Recopiée de `package.json` par `npm version` (scripts/sync-version.mjs) ; un test
1407
1408
  * le vérifie.
1408
1409
  */
1409
- const KIT_VERSION = "2.51.0";
1410
+ const KIT_VERSION = "2.52.0";
1410
1411
  /**
1411
1412
  * Signale ce Studio au service du kit, une fois par montage.
1412
1413
  *
@@ -1904,7 +1905,7 @@ function useKitUpdate() {
1904
1905
  !controller.signal.aborted && body?.version && setLatest(body.version);
1905
1906
  }).catch(() => {}), () => controller.abort();
1906
1907
  }, []);
1907
- let available = !!(latest && !isPrerelease(latest) && compareVersions(latest, "2.51.0") > 0);
1908
+ let available = !!(latest && !isPrerelease(latest) && compareVersions(latest, "2.52.0") > 0);
1908
1909
  return {
1909
1910
  current: KIT_VERSION,
1910
1911
  latest,
@@ -8004,10 +8005,13 @@ function ComponentsToolInner() {
8004
8005
  value: groupDialog.name,
8005
8006
  autoFocus: !0,
8006
8007
  placeholder: "Nom du groupe",
8007
- onChange: (event) => setGroupDialog((d) => d && {
8008
- ...d,
8009
- name: event.currentTarget.value
8010
- }),
8008
+ onChange: (event) => {
8009
+ let value = event.currentTarget.value;
8010
+ setGroupDialog((d) => d && {
8011
+ ...d,
8012
+ name: value
8013
+ });
8014
+ },
8011
8015
  onKeyDown: (event) => {
8012
8016
  event.key === "Enter" && groupDialog.name.trim() && (groupDialog.mode === "rename" && groupDialog.id ? meta.renameGroup(groupDialog.id, groupDialog.name) : meta.createGroup(groupDialog.name), setGroupDialog(null));
8013
8017
  }
@@ -9040,6 +9044,34 @@ function useAssetMeta() {
9040
9044
  moveAssets
9041
9045
  };
9042
9046
  }
9047
+ /** Détermine le type d'asset Sanity d'après le fichier. */
9048
+ const assetKind = (file) => file.type.startsWith("image/") ? "image" : "file";
9049
+ /**
9050
+ * Téléverse des assets dans le dataset depuis l'outil Assets
9051
+ * (`client.assets.upload`). La liste se met à jour toute seule (écoute des
9052
+ * mutations d'assets) ; `onUploaded` permet de ranger l'asset dans un dossier.
9053
+ */
9054
+ function useAssetUpload() {
9055
+ let client = useKitClient(), [uploading, setUploading] = useState(0), [error, setError] = useState(null);
9056
+ return {
9057
+ upload: useCallback(async (files, onUploaded) => {
9058
+ let list = Array.from(files);
9059
+ if (list.length) {
9060
+ setError(null), setUploading((count) => count + list.length);
9061
+ for (let file of list) try {
9062
+ let asset = await client.assets.upload(assetKind(file), file, { filename: file.name });
9063
+ onUploaded?.(asset._id);
9064
+ } catch (cause) {
9065
+ setError(cause instanceof Error ? cause : Error(String(cause)));
9066
+ } finally {
9067
+ setUploading((count) => Math.max(0, count - 1));
9068
+ }
9069
+ }
9070
+ }, [client]),
9071
+ uploading,
9072
+ error
9073
+ };
9074
+ }
9043
9075
  const isImageAsset = (asset) => asset._type === "sanity.imageAsset";
9044
9076
  /** Nom affiché : titre saisi, sinon nom de fichier, sinon id. */
9045
9077
  function assetName(asset) {
@@ -9315,6 +9347,16 @@ function AssetsToolbar(props) {
9315
9347
  align: "center",
9316
9348
  wrap: "wrap",
9317
9349
  children: [
9350
+ props.onImport ? /* @__PURE__ */ jsx(Button, {
9351
+ icon: UploadIcon,
9352
+ text: props.uploading ? `Import… (${props.uploading})` : "Importer",
9353
+ tone: "primary",
9354
+ fontSize: 1,
9355
+ padding: 2,
9356
+ disabled: !!props.uploading,
9357
+ onClick: props.onImport,
9358
+ style: { flex: "none" }
9359
+ }) : null,
9318
9360
  /* @__PURE__ */ jsx(Box, {
9319
9361
  flex: 1,
9320
9362
  style: { minWidth: 180 },
@@ -9998,7 +10040,7 @@ function AssetDetail(props) {
9998
10040
  });
9999
10041
  }
10000
10042
  function AssetsTool() {
10001
- let { data, loading, error, refresh } = useAssets(), meta = useAssetMeta(), assets = useMemo(() => data ?? [], [data]), [search, setSearch] = useState(""), [type, setType] = useState("all"), [usage, setUsage] = useState("all"), [sort, setSort] = useState("date"), [direction, setDirection] = useState("desc"), [view, setView] = useState("grid"), [selection, setSelection] = useState(null), [selectedIds, setSelectedIds] = useState(/* @__PURE__ */ new Set()), [openedId, setOpenedId] = useState(null), folderMap = useMemo(() => assignmentMap(meta.assignments), [meta.assignments]), counts = useMemo(() => countByFolder(assets, folderMap), [assets, folderMap]), folderName = useCallback((id) => meta.folders.find((f) => f.id === id)?.name ?? id, [meta.folders]), folderOf = useCallback((assetId) => folderMap.get(assetId) ?? null, [folderMap]), visible = useMemo(() => sortAssets(filterAssets(assetsInFolder(assets, folderMap, selection), {
10043
+ let { data, loading, error, refresh } = useAssets(), meta = useAssetMeta(), { upload, uploading, error: uploadError } = useAssetUpload(), fileInputRef = useRef(null), [dragging, setDragging] = useState(!1), assets = useMemo(() => data ?? [], [data]), [search, setSearch] = useState(""), [type, setType] = useState("all"), [usage, setUsage] = useState("all"), [sort, setSort] = useState("date"), [direction, setDirection] = useState("desc"), [view, setView] = useState("grid"), [selection, setSelection] = useState(null), [selectedIds, setSelectedIds] = useState(/* @__PURE__ */ new Set()), [openedId, setOpenedId] = useState(null), folderMap = useMemo(() => assignmentMap(meta.assignments), [meta.assignments]), counts = useMemo(() => countByFolder(assets, folderMap), [assets, folderMap]), folderName = useCallback((id) => meta.folders.find((f) => f.id === id)?.name ?? id, [meta.folders]), folderOf = useCallback((assetId) => folderMap.get(assetId) ?? null, [folderMap]), visible = useMemo(() => sortAssets(filterAssets(assetsInFolder(assets, folderMap, selection), {
10002
10044
  search,
10003
10045
  type,
10004
10046
  usage
@@ -10033,6 +10075,15 @@ function AssetsTool() {
10033
10075
  meta,
10034
10076
  selectedIds,
10035
10077
  clearSelection
10078
+ ]), handleFiles = useCallback((files) => {
10079
+ if (!files || !files.length) return;
10080
+ let folder = typeof selection == "string" && selection !== "" ? selection : null;
10081
+ upload(files, folder ? (assetId) => meta.moveAsset(assetId, folder) : void 0).then(() => refresh());
10082
+ }, [
10083
+ upload,
10084
+ selection,
10085
+ meta,
10086
+ refresh
10036
10087
  ]);
10037
10088
  return loading && assets.length === 0 ? /* @__PURE__ */ jsx(Flex, {
10038
10089
  align: "center",
@@ -10045,8 +10096,47 @@ function AssetsTool() {
10045
10096
  }) : /* @__PURE__ */ jsxs(Flex, {
10046
10097
  gap: 4,
10047
10098
  align: "stretch",
10048
- style: { minHeight: 420 },
10099
+ style: {
10100
+ minHeight: 420,
10101
+ position: "relative"
10102
+ },
10103
+ onDragOver: (event) => {
10104
+ event.preventDefault(), dragging || setDragging(!0);
10105
+ },
10106
+ onDragLeave: (event) => {
10107
+ event.currentTarget === event.target && setDragging(!1);
10108
+ },
10109
+ onDrop: (event) => {
10110
+ event.preventDefault(), setDragging(!1), handleFiles(event.dataTransfer.files);
10111
+ },
10049
10112
  children: [
10113
+ /* @__PURE__ */ jsx("input", {
10114
+ ref: fileInputRef,
10115
+ type: "file",
10116
+ multiple: !0,
10117
+ hidden: !0,
10118
+ onChange: (event) => {
10119
+ handleFiles(event.currentTarget.files), event.currentTarget.value = "";
10120
+ }
10121
+ }),
10122
+ dragging ? /* @__PURE__ */ jsx(Flex, {
10123
+ align: "center",
10124
+ justify: "center",
10125
+ style: {
10126
+ position: "absolute",
10127
+ inset: 0,
10128
+ zIndex: 5,
10129
+ borderRadius: 6,
10130
+ border: "2px dashed var(--card-focus-ring-color, #2276fc)",
10131
+ background: "var(--card-bg-color, rgba(255,255,255,0.85))",
10132
+ pointerEvents: "none"
10133
+ },
10134
+ children: /* @__PURE__ */ jsx(Text, {
10135
+ size: 2,
10136
+ weight: "medium",
10137
+ children: "Déposer pour importer"
10138
+ })
10139
+ }) : null,
10050
10140
  /* @__PURE__ */ jsx(Box, {
10051
10141
  style: {
10052
10142
  width: 220,
@@ -10085,8 +10175,20 @@ function AssetsTool() {
10085
10175
  view,
10086
10176
  onView: setView,
10087
10177
  onRefresh: refresh,
10088
- busy: loading
10178
+ busy: loading,
10179
+ onImport: () => fileInputRef.current?.click(),
10180
+ uploading
10089
10181
  }),
10182
+ uploadError ? /* @__PURE__ */ jsx(Card, {
10183
+ tone: "critical",
10184
+ border: !0,
10185
+ radius: 2,
10186
+ padding: 3,
10187
+ children: /* @__PURE__ */ jsxs(Text, {
10188
+ size: 1,
10189
+ children: ["Import échoué : ", uploadError.message]
10190
+ })
10191
+ }) : null,
10090
10192
  selectedIds.size > 0 ? /* @__PURE__ */ jsx(Card, {
10091
10193
  tone: "primary",
10092
10194
  border: !0,
@@ -10819,6 +10921,143 @@ function createArrayNamesInput(Fallback) {
10819
10921
  });
10820
10922
  };
10821
10923
  }
10924
+ /**
10925
+ * Source d'asset « NCF Médias » : le sélecteur d'image/fichier d'un champ montre
10926
+ * les mêmes DOSSIERS et la même recherche que l'onglet Assets. Sans ça,
10927
+ * l'organisation ne servirait qu'à l'onglet et pas au choix d'un média.
10928
+ */
10929
+ function AssetSourceBrowser(props) {
10930
+ let { assetType, onSelect, onClose, dialogHeaderTitle } = props, { data, loading } = useAssets(), meta = useAssetMeta(), [search, setSearch] = useState(""), [selection, setSelection] = useState(null), wantImages = assetType !== "file", all = useMemo(() => (data ?? []).filter((asset) => wantImages ? isImageAsset(asset) : !isImageAsset(asset)), [data, wantImages]), folderMap = useMemo(() => assignmentMap(meta.assignments), [meta.assignments]), counts = useMemo(() => countByFolder(all, folderMap), [all, folderMap]), visible = useMemo(() => sortAssets(filterAssets(assetsInFolder(all, folderMap, selection), { search }), "date", "desc"), [
10931
+ all,
10932
+ folderMap,
10933
+ selection,
10934
+ search
10935
+ ]), pick = (asset) => {
10936
+ onSelect([{
10937
+ kind: "assetDocumentId",
10938
+ value: asset._id
10939
+ }]), onClose();
10940
+ };
10941
+ return /* @__PURE__ */ jsx(Dialog, {
10942
+ id: "ncf-asset-source",
10943
+ header: dialogHeaderTitle || "NCF Médias",
10944
+ width: 3,
10945
+ onClose,
10946
+ children: /* @__PURE__ */ jsxs(Flex, {
10947
+ style: { minHeight: 420 },
10948
+ align: "stretch",
10949
+ children: [/* @__PURE__ */ jsx(Box, {
10950
+ padding: 3,
10951
+ style: {
10952
+ width: 220,
10953
+ flex: "none",
10954
+ borderRight: "1px solid var(--card-border-color)"
10955
+ },
10956
+ overflow: "auto",
10957
+ children: /* @__PURE__ */ jsx(FolderSidebar, {
10958
+ folders: meta.folders,
10959
+ counts,
10960
+ total: all.length,
10961
+ selection,
10962
+ onSelect: setSelection,
10963
+ onCreate: meta.createFolder,
10964
+ onRename: meta.renameFolder,
10965
+ onDelete: (id) => {
10966
+ selection === id && setSelection(null), meta.deleteFolder(id);
10967
+ }
10968
+ })
10969
+ }), /* @__PURE__ */ jsxs(Stack, {
10970
+ flex: 1,
10971
+ gap: 3,
10972
+ padding: 3,
10973
+ style: { minWidth: 0 },
10974
+ children: [/* @__PURE__ */ jsx(TextInput, {
10975
+ value: search,
10976
+ onChange: (event) => setSearch(event.currentTarget.value),
10977
+ placeholder: "Rechercher un média",
10978
+ icon: SearchIcon,
10979
+ clearButton: search.length > 0,
10980
+ onClear: () => setSearch(""),
10981
+ fontSize: 1,
10982
+ radius: 2
10983
+ }), /* @__PURE__ */ jsx(Box, {
10984
+ flex: 1,
10985
+ overflow: "auto",
10986
+ children: loading && all.length === 0 ? /* @__PURE__ */ jsx(Flex, {
10987
+ align: "center",
10988
+ justify: "center",
10989
+ padding: 5,
10990
+ children: /* @__PURE__ */ jsx(Spinner, { muted: !0 })
10991
+ }) : visible.length === 0 ? /* @__PURE__ */ jsx(Flex, {
10992
+ align: "center",
10993
+ justify: "center",
10994
+ padding: 5,
10995
+ children: /* @__PURE__ */ jsxs(Text, {
10996
+ size: 1,
10997
+ muted: !0,
10998
+ children: [
10999
+ "Aucun média",
11000
+ selection ? " dans ce dossier" : "",
11001
+ "."
11002
+ ]
11003
+ })
11004
+ }) : /* @__PURE__ */ jsx(Grid, {
11005
+ gridTemplateColumns: [
11006
+ 2,
11007
+ 3,
11008
+ 4
11009
+ ],
11010
+ gap: 3,
11011
+ children: visible.map((asset) => {
11012
+ let thumb = thumbnailUrl(asset, {
11013
+ w: 240,
11014
+ h: 180
11015
+ });
11016
+ return /* @__PURE__ */ jsxs(Card, {
11017
+ radius: 2,
11018
+ shadow: 1,
11019
+ padding: 0,
11020
+ as: "button",
11021
+ onClick: () => pick(asset),
11022
+ style: {
11023
+ overflow: "hidden",
11024
+ cursor: "pointer",
11025
+ textAlign: "left",
11026
+ border: 0
11027
+ },
11028
+ children: [/* @__PURE__ */ jsx(Box, {
11029
+ style: {
11030
+ aspectRatio: "4 / 3",
11031
+ background: "var(--card-muted-bg-color, rgba(127,127,127,0.08))"
11032
+ },
11033
+ children: thumb ? /* @__PURE__ */ jsx("img", {
11034
+ src: thumb,
11035
+ alt: "",
11036
+ loading: "lazy",
11037
+ style: {
11038
+ width: "100%",
11039
+ height: "100%",
11040
+ objectFit: "cover",
11041
+ display: "block"
11042
+ }
11043
+ }) : null
11044
+ }), /* @__PURE__ */ jsx(Box, {
11045
+ padding: 2,
11046
+ children: /* @__PURE__ */ jsx(Text, {
11047
+ size: 0,
11048
+ textOverflow: "ellipsis",
11049
+ style: MONO,
11050
+ children: assetName(asset)
11051
+ })
11052
+ })]
11053
+ }, asset._id);
11054
+ })
11055
+ })
11056
+ })]
11057
+ })]
11058
+ })
11059
+ });
11060
+ }
10822
11061
  const store = /* @__PURE__ */ new Map();
10823
11062
  function entryFor(client, documentId) {
10824
11063
  let { projectId, dataset } = client.config(), id = translationTodoId(documentId), key = `${projectId}:${dataset}:${id}`, entry = store.get(key);
@@ -12171,7 +12410,12 @@ function ncfMainDocuments(options, extra = {}) {
12171
12410
  * pas le Studio de démarrer : l'onglet concerné affiche le détail à corriger.
12172
12411
  */
12173
12412
  /** Noms des outils dans la barre du Studio. Exportés pour filtrer `tools`. */
12174
- const NCF_PAGES_TOOL = "ncf-pages", NCF_COMPONENTS_TOOL = "ncf-components", NCF_HISTORY_TOOL = "ncf-history", NCF_DESIGN_SYSTEM_TOOL = "ncf-design-system", NCF_ASSETS_TOOL = "ncf-assets", NCF_TOOL_NAMES = [
12413
+ const NCF_PAGES_TOOL = "ncf-pages", NCF_COMPONENTS_TOOL = "ncf-components", NCF_HISTORY_TOOL = "ncf-history", NCF_DESIGN_SYSTEM_TOOL = "ncf-design-system", NCF_ASSETS_TOOL = "ncf-assets", ncfAssetSource = {
12414
+ name: "ncf-media",
12415
+ title: "NCF Médias",
12416
+ icon: ImagesIcon,
12417
+ component: AssetSourceBrowser
12418
+ }, NCF_TOOL_NAMES = [
12175
12419
  NCF_PAGES_TOOL,
12176
12420
  NCF_COMPONENTS_TOOL,
12177
12421
  NCF_HISTORY_TOOL,
@@ -12284,7 +12528,13 @@ const ncfKit = definePlugin((options) => {
12284
12528
  toolMenu: createPreviewLauncher(config, issues),
12285
12529
  layout: HelpTextStyle
12286
12530
  } },
12287
- form: { components: { input: createKitInput(config, issues) } }
12531
+ form: {
12532
+ components: { input: createKitInput(config, issues) },
12533
+ ...config.tools.assets ? {
12534
+ image: { assetSources: (prev) => [ncfAssetSource, ...prev] },
12535
+ file: { assetSources: (prev) => [ncfAssetSource, ...prev] }
12536
+ } : {}
12537
+ }
12288
12538
  };
12289
12539
  });
12290
12540
  /** Le type de document porte-t-il le champ de langue (traduit document par document) ? */
@@ -12292,6 +12542,6 @@ function hasLanguageField(schemaType, field) {
12292
12542
  let fields = schemaType?.fields;
12293
12543
  return Array.isArray(fields) && fields.some((f) => f?.name === field);
12294
12544
  }
12295
- export { ANNOTATION_TYPE, ActorName, AssetsTool, BOARD_LAYOUT_ID, BOARD_LAYOUT_TYPE, BRAIN_NODE_SIZE, BoardLayoutProvider, COLUMN_TYPE, CONTENT_SCAN_LIMIT, CONTENT_SCAN_LIMIT as OCCURRENCE_SCAN_LIMIT, CUSTOM_ENVIRONMENT_ID, CodeEditorInput, CodeEmbedInput, DATA_PREFIX, DEFAULT_BOARD_TAGS, DEFAULT_COMPONENT_DEFAULTS_TYPE, DEFAULT_COMPONENT_PREVIEW, DEFAULT_I18N, DEFAULT_INTERNAL_FIELDS, DEFAULT_MORE_TOOLS, DEFAULT_PAGE_BUILDER_FIELD, DEFAULT_SLUG_FIELD, DEFAULT_TITLE_FIELD, HelpTextStyle, KIT_API_VERSION, KIT_VERSION, NCF_ASSETS_TOOL, NCF_COMPONENTS_TOOL, NCF_DESIGN_SYSTEM_TOOL, NCF_HIDDEN_TYPES, NCF_HISTORY_TOOL, NCF_MORE_TOOL, NCF_PAGES_TOOL, NCF_TOOL_NAMES, NODE_FIELD_TYPE, NODE_HEIGHT, NODE_WIDTH, NcfKitUpdate, NcfPreviewHeader, NcfPreviewLauncher, PERSPECTIVES, PROJECTION, SECTION_NODE_TYPE, STATUS_COLORS, STATUS_LABELS, SharePreview, UNSET_LABEL, addColumn, addColumnOption, announce, applySavedPositions, assetName, assetsInFolder, assignmentMap, baseId, blockName, blockTypesFromSchema, buildContentsQuery, buildLinkGraph, buildPageRows, buildPagesQuery, codeEditorInput, collectLinks, collectOccurrences, colorForRow, colorFromString, columnId, compareVersions, componentDefaultsMainDocument, componentDefaultsMainDocuments, countByFolder, createPreviewLauncher, customEnvironment, defaultNodeSize, defaultsFieldName, defineCodeEmbedType, defineComponentDefaults, depth, deriveDocumentColumns, detectPageBuilderField, diffDocuments, diffWords, editIntentPath, explainGrantError, fallbackLayout, fetchDetail, fetchTimeline, fillTemplate, filterAssets, filterRows, fixCrossLanguageReferences, flatten, formatBytes, formatDocumentValue, groupComponents, groupMap, groupPageRows, groupValue, hasBlockingIssue, humanizeBlockName, isDraftId, isImageAsset, isKitType, isPrerelease, isSafeColumnKey, isSafeFieldPath, isTextChange, isVersionId, issuesForTool, keyForPath, kitSchemaTypes, layoutGraph, layoutSectionsMap, localesInRows, mergeVersions, missingPageTypes, moveColumn, nameMap, ncfAllowedOrigins, ncfKit, ncfMainDocuments, ncfPresentationComponents, ncfPreviewComponents, normalizeInternalPath, normalizePath, occurrencesForTypes, pageThumbnailUrl, pageTypeFor, pageTypesFromSiteRoutes, pageTypesWithoutBuilder, parentPath, presentationPath, pruneSavedPositions, releaseId, removeColumn, renameColumn, requestPreviewGrant, requiredUnlessDefault, requiredUnlessDefaultFor, resolveColorBy, resolveConfig, resolvePageBuilderField, sectionNamesFromDefaults, segments, slugKey, sortAssets, sortRows, summarize, thumbnailUrl, toKebabCase, toPath, toUrl, topLevelBlockCount, uniqueColumnId, upsertLayout, urlOn, useAnnotations, useAssetMeta, useAssets, useBoardLayout, useComponentNames, useDocumentColumns, useHistory, useInternalColumns, useKitClient, useKitConfig, useKitContext, useKitUpdate, useOccurrences, useOptionalKitConfig, useOptionalKitContext, usePageBuilder, usePageContents, usePages, usePreviewTarget, useRegistration, validateConfig, withAlpha, withCustomNames, withMoreTool, withSameLanguageReferences };
12545
+ export { ANNOTATION_TYPE, ActorName, AssetSourceBrowser, AssetsTool, BOARD_LAYOUT_ID, BOARD_LAYOUT_TYPE, BRAIN_NODE_SIZE, BoardLayoutProvider, COLUMN_TYPE, CONTENT_SCAN_LIMIT, CONTENT_SCAN_LIMIT as OCCURRENCE_SCAN_LIMIT, CUSTOM_ENVIRONMENT_ID, CodeEditorInput, CodeEmbedInput, DATA_PREFIX, DEFAULT_BOARD_TAGS, DEFAULT_COMPONENT_DEFAULTS_TYPE, DEFAULT_COMPONENT_PREVIEW, DEFAULT_I18N, DEFAULT_INTERNAL_FIELDS, DEFAULT_MORE_TOOLS, DEFAULT_PAGE_BUILDER_FIELD, DEFAULT_SLUG_FIELD, DEFAULT_TITLE_FIELD, HelpTextStyle, KIT_API_VERSION, KIT_VERSION, NCF_ASSETS_TOOL, NCF_COMPONENTS_TOOL, NCF_DESIGN_SYSTEM_TOOL, NCF_HIDDEN_TYPES, NCF_HISTORY_TOOL, NCF_MORE_TOOL, NCF_PAGES_TOOL, NCF_TOOL_NAMES, NODE_FIELD_TYPE, NODE_HEIGHT, NODE_WIDTH, NcfKitUpdate, NcfPreviewHeader, NcfPreviewLauncher, PERSPECTIVES, PROJECTION, SECTION_NODE_TYPE, STATUS_COLORS, STATUS_LABELS, SharePreview, UNSET_LABEL, addColumn, addColumnOption, announce, applySavedPositions, assetName, assetsInFolder, assignmentMap, baseId, blockName, blockTypesFromSchema, buildContentsQuery, buildLinkGraph, buildPageRows, buildPagesQuery, codeEditorInput, collectLinks, collectOccurrences, colorForRow, colorFromString, columnId, compareVersions, componentDefaultsMainDocument, componentDefaultsMainDocuments, countByFolder, createPreviewLauncher, customEnvironment, defaultNodeSize, defaultsFieldName, defineCodeEmbedType, defineComponentDefaults, depth, deriveDocumentColumns, detectPageBuilderField, diffDocuments, diffWords, editIntentPath, explainGrantError, fallbackLayout, fetchDetail, fetchTimeline, fillTemplate, filterAssets, filterRows, fixCrossLanguageReferences, flatten, formatBytes, formatDocumentValue, groupComponents, groupMap, groupPageRows, groupValue, hasBlockingIssue, humanizeBlockName, isDraftId, isImageAsset, isKitType, isPrerelease, isSafeColumnKey, isSafeFieldPath, isTextChange, isVersionId, issuesForTool, keyForPath, kitSchemaTypes, layoutGraph, layoutSectionsMap, localesInRows, mergeVersions, missingPageTypes, moveColumn, nameMap, ncfAllowedOrigins, ncfKit, ncfMainDocuments, ncfPresentationComponents, ncfPreviewComponents, normalizeInternalPath, normalizePath, occurrencesForTypes, pageThumbnailUrl, pageTypeFor, pageTypesFromSiteRoutes, pageTypesWithoutBuilder, parentPath, presentationPath, pruneSavedPositions, releaseId, removeColumn, renameColumn, requestPreviewGrant, requiredUnlessDefault, requiredUnlessDefaultFor, resolveColorBy, resolveConfig, resolvePageBuilderField, sectionNamesFromDefaults, segments, slugKey, sortAssets, sortRows, summarize, thumbnailUrl, toKebabCase, toPath, toUrl, topLevelBlockCount, uniqueColumnId, upsertLayout, urlOn, useAnnotations, useAssetMeta, useAssetUpload, useAssets, useBoardLayout, useComponentNames, useDocumentColumns, useHistory, useInternalColumns, useKitClient, useKitConfig, useKitContext, useKitUpdate, useOccurrences, useOptionalKitConfig, useOptionalKitContext, usePageBuilder, usePageContents, usePages, usePreviewTarget, useRegistration, validateConfig, withAlpha, withCustomNames, withMoreTool, withSameLanguageReferences };
12296
12546
 
12297
12547
  //# sourceMappingURL=index.js.map