@nocode-factory/sanity-kit 2.17.2 → 2.19.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/README.md +4 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +181 -59
- package/dist/index.js.map +1 -1
- package/dist/web-server.js +2 -1
- package/dist/web-server.js.map +1 -1
- package/package.json +1 -1
- package/src/actions/RemoveFromSite.tsx +110 -0
- package/src/form/OverrideInput.tsx +1 -45
- package/src/form/SlugUrlInput.tsx +60 -0
- package/src/index.ts +23 -2
- package/src/lib/openComponent.ts +1 -2
- package/src/lib/status.ts +1 -1
- package/src/version.ts +1 -1
- package/src/web/previewGrant.ts +4 -1
- package/src/hooks/useInPresentation.ts +0 -26
package/README.md
CHANGED
|
@@ -83,8 +83,10 @@ Dans le Studio :
|
|
|
83
83
|
- **Onglet Composants** : un clic sur un composant (grille ou vue Map) ouvre
|
|
84
84
|
Presentation avec son rendu réel et ses valeurs par défaut côte à côte. Depuis
|
|
85
85
|
la Map, chaque page listée ouvre le formulaire sur l'instance.
|
|
86
|
-
- **
|
|
87
|
-
|
|
86
|
+
- **Retirer du site** (actions d'une page) : dépublie sans rien perdre (contenu gardé
|
|
87
|
+
en brouillon), après avoir listé les documents qui pointent vers la page.
|
|
88
|
+
- **Champ Slug d'une page** : l'adresse complète de la page en ligne s'affiche
|
|
89
|
+
dessous (préfixe et langue compris), avec « Copier » et « Ouvrir ».
|
|
88
90
|
- **Formulaire d'une page** : une pastille bleue marque tout champ d'instance
|
|
89
91
|
différent de la valeur par défaut. Au survol, elle affiche la valeur par défaut ;
|
|
90
92
|
au clic, le champ revient en héritage. Un champ qui hérite affiche la valeur par
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { a as defineComponentDefaults, i as defaultsFieldName, n as componentDefaultsMainDocument, o as requiredUnlessDefault, r as componentDefaultsMainDocuments, s as requiredUnlessDefaultFor, t as DEFAULT_COMPONENT_DEFAULTS_TYPE } from "./componentDefaults-CNiuukLt.js";
|
|
2
|
-
import { SanityClient, Schema, Tool, ToolMenuProps } from "sanity";
|
|
3
2
|
import { ReactNode } from "react";
|
|
3
|
+
import { SanityClient, Schema, Tool, ToolMenuProps } from "sanity";
|
|
4
4
|
import { PreviewHeaderProps } from "sanity/presentation";
|
|
5
5
|
/**
|
|
6
6
|
* Configuration publique du plugin. Tout est optionnel sauf `pageTypes` :
|
|
@@ -1303,7 +1303,7 @@ export declare function ActorName(props: {
|
|
|
1303
1303
|
* quelle version. Recopiée de `package.json` par `npm version` (scripts/sync-version.mjs) ; un test
|
|
1304
1304
|
* le vérifie.
|
|
1305
1305
|
*/
|
|
1306
|
-
export declare const KIT_VERSION = "2.
|
|
1306
|
+
export declare const KIT_VERSION = "2.19.0";
|
|
1307
1307
|
/**
|
|
1308
1308
|
* Données de la page proposées comme colonnes.
|
|
1309
1309
|
*
|
package/dist/index.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { a as defineComponentDefaults, i as defaultsFieldName, n as componentDefaultsMainDocument, o as requiredUnlessDefault, r as componentDefaultsMainDocuments, s as requiredUnlessDefaultFor, t as DEFAULT_COMPONENT_DEFAULTS_TYPE } from "./componentDefaults-BY3hQ6aD.js";
|
|
2
|
+
import { createContext, createElement, forwardRef, memo, useCallback, useContext, useEffect, useMemo, useRef, useState, useSyncExternalStore } from "react";
|
|
2
3
|
import { ToolLink, defineField, definePlugin, defineType, pathToString, set, unset, useClient, useCurrentUser, useFormValue, useSchema, useUser, useWorkspace } from "sanity";
|
|
3
4
|
import { ClockIcon } from "@sanity/icons/Clock";
|
|
4
5
|
import { ComponentIcon } from "@sanity/icons/Component";
|
|
5
6
|
import { DocumentsIcon } from "@sanity/icons/Documents";
|
|
6
7
|
import { ColorWheelIcon } from "@sanity/icons/ColorWheel";
|
|
7
8
|
import { Badge, Box, Button, Card, Container, Flex, Grid, Select, Spinner, Stack, Tab, TabList, TabPanel, Text, TextArea, TextInput } from "@sanity/ui";
|
|
8
|
-
import { createContext, forwardRef, memo, useCallback, useContext, useEffect, useMemo, useRef, useState, useSyncExternalStore } from "react";
|
|
9
9
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
10
|
-
import { IntentLink, useRouter
|
|
10
|
+
import { IntentLink, useRouter } from "sanity/router";
|
|
11
11
|
import { EyeOpenIcon } from "@sanity/icons/EyeOpen";
|
|
12
12
|
import { LaunchIcon } from "@sanity/icons/Launch";
|
|
13
13
|
import { ArrowUpIcon } from "@sanity/icons/ArrowUp";
|
|
@@ -36,6 +36,7 @@ import { RefreshIcon } from "@sanity/icons/Refresh";
|
|
|
36
36
|
import { RestoreIcon } from "@sanity/icons/Restore";
|
|
37
37
|
import { UndoIcon } from "@sanity/icons/Undo";
|
|
38
38
|
import { Tooltip } from "@sanity/ui/tooltip";
|
|
39
|
+
import { EyeClosedIcon } from "@sanity/icons/EyeClosed";
|
|
39
40
|
const DEFAULT_PAGE_BUILDER_FIELD = "sections", DEFAULT_SLUG_FIELD = "slug", DEFAULT_TITLE_FIELD = "title", DEFAULT_NOINDEX_FIELDS = ["seo.noindex", "noindex"], DEFAULT_I18N = {
|
|
40
41
|
field: "language",
|
|
41
42
|
defaultLocale: "fr",
|
|
@@ -685,9 +686,9 @@ const STATUS_LABELS = {
|
|
|
685
686
|
help: "En ligne, avec des modifications non publiées"
|
|
686
687
|
},
|
|
687
688
|
draft: {
|
|
688
|
-
label: "
|
|
689
|
+
label: "Non publiée",
|
|
689
690
|
tone: "default",
|
|
690
|
-
help: "
|
|
691
|
+
help: "Absente du site : jamais publiée, ou retirée du site (contenu conservé en brouillon)"
|
|
691
692
|
}
|
|
692
693
|
};
|
|
693
694
|
/**
|
|
@@ -1380,7 +1381,7 @@ function explainGrantError(error) {
|
|
|
1380
1381
|
* quelle version. Recopiée de `package.json` par `npm version` (scripts/sync-version.mjs) ; un test
|
|
1381
1382
|
* le vérifie.
|
|
1382
1383
|
*/
|
|
1383
|
-
const KIT_VERSION = "2.
|
|
1384
|
+
const KIT_VERSION = "2.19.0";
|
|
1384
1385
|
/**
|
|
1385
1386
|
* Signale ce Studio au service du kit, une fois par montage.
|
|
1386
1387
|
*
|
|
@@ -1707,7 +1708,7 @@ function useKitUpdate() {
|
|
|
1707
1708
|
!controller.signal.aborted && body?.version && setLatest(body.version);
|
|
1708
1709
|
}).catch(() => {}), () => controller.abort();
|
|
1709
1710
|
}, []);
|
|
1710
|
-
let available = !!(latest && !isPrerelease(latest) && compareVersions(latest, "2.
|
|
1711
|
+
let available = !!(latest && !isPrerelease(latest) && compareVersions(latest, "2.19.0") > 0);
|
|
1711
1712
|
return {
|
|
1712
1713
|
current: KIT_VERSION,
|
|
1713
1714
|
latest,
|
|
@@ -5891,8 +5892,7 @@ function componentIntentParams(type, namespace, preview, documentId) {
|
|
|
5891
5892
|
* Ouvre un composant : Presentation avec son rendu réel et ses valeurs par
|
|
5892
5893
|
* défaut côte à côte (le document des valeurs par défaut, champ du composant).
|
|
5893
5894
|
* Sans document de valeurs par défaut dans le schéma : la démo du design system
|
|
5894
|
-
* dans un nouvel onglet.
|
|
5895
|
-
* bouton « Modifier l'instance principale » des formulaires.
|
|
5895
|
+
* dans un nouvel onglet. Utilisé par l'onglet Composants (grille, Map).
|
|
5896
5896
|
*/
|
|
5897
5897
|
async function openComponentDefaults(options) {
|
|
5898
5898
|
let { type, config, hasDefaults, client, navigateIntent } = options, preview = config.componentPreview;
|
|
@@ -7579,23 +7579,6 @@ function useComponentDefaults(client, type, languageField, language) {
|
|
|
7579
7579
|
entry.listeners.size === 0 && entry.stop && (entry.stop(), entry.stop = null);
|
|
7580
7580
|
}, [entry]), value;
|
|
7581
7581
|
}
|
|
7582
|
-
/** Noms des outils Presentation du workspace (le nom est configurable). */
|
|
7583
|
-
function presentationToolNames(tools) {
|
|
7584
|
-
return tools.filter((t) => t.__internalApplicationType === "sanity/presentation" || t.name === "presentation").map((t) => t.name);
|
|
7585
|
-
}
|
|
7586
|
-
/** Vrai si l'adresse du Studio est dans un de ces outils (premier segment après la base). */
|
|
7587
|
-
function isInTool(pathname, names) {
|
|
7588
|
-
return pathname.split("/").some((segment) => names.includes(segment));
|
|
7589
|
-
}
|
|
7590
|
-
/**
|
|
7591
|
-
* Le formulaire est-il affiché dans Presentation ? Le routeur sert à se mettre à jour
|
|
7592
|
-
* quand on change d'outil ; l'adresse dit lequel (le formulaire de Presentation est rendu
|
|
7593
|
-
* dans la portée de son outil, qui ne porte pas le nom de l'outil).
|
|
7594
|
-
*/
|
|
7595
|
-
function useInPresentation() {
|
|
7596
|
-
let { tools } = useWorkspace();
|
|
7597
|
-
return useRouterState(), typeof window > "u" ? !1 : isInTool(window.location.pathname, presentationToolNames(tools));
|
|
7598
|
-
}
|
|
7599
7582
|
const LINK_TARGET_FIELDS = [
|
|
7600
7583
|
"page",
|
|
7601
7584
|
"fixedPath",
|
|
@@ -7718,11 +7701,7 @@ function shortValue(value, max = 32) {
|
|
|
7718
7701
|
function createOverrideInput(config) {
|
|
7719
7702
|
let { defaultsType } = config.componentPreview, namespace = config.blockNamespace;
|
|
7720
7703
|
function OverrideInput(props) {
|
|
7721
|
-
let schema = useSchema(), path = props.path, keyed = firstKeyedIndex(path), anchor = keyed >= 0 ? keyed : 0, instance = useFormValue(path.slice(0, anchor + 1)), parent = useFormValue(path.length > 1 ? path.slice(0, -1) : path), resolved = resolveFieldPath(path, anchor, instance, namespace)
|
|
7722
|
-
if (props.schemaType.jsonType === "object" && typeof own?._type == "string" && own._type.startsWith(namespace) && props.path.length > 0 && schema.get(defaultsType)) return /* @__PURE__ */ jsx(WithMainInstance, {
|
|
7723
|
-
...props,
|
|
7724
|
-
type: own._type
|
|
7725
|
-
});
|
|
7704
|
+
let schema = useSchema(), path = props.path, keyed = firstKeyedIndex(path), anchor = keyed >= 0 ? keyed : 0, instance = useFormValue(path.slice(0, anchor + 1)), parent = useFormValue(path.length > 1 ? path.slice(0, -1) : path), resolved = resolveFieldPath(path, anchor, instance, namespace);
|
|
7726
7705
|
if (!resolved || !schema.get(defaultsType) || !carriesDot(props.schemaType)) return props.renderDefault(props);
|
|
7727
7706
|
let shortName = blockName(instance._type, namespace);
|
|
7728
7707
|
return /* @__PURE__ */ jsx(WithDot, {
|
|
@@ -7769,32 +7748,6 @@ function createOverrideInput(config) {
|
|
|
7769
7748
|
})]
|
|
7770
7749
|
});
|
|
7771
7750
|
}
|
|
7772
|
-
function WithMainInstance(props) {
|
|
7773
|
-
let { type, ...inputProps } = props, client = useKitClient(), router = useRouter();
|
|
7774
|
-
if (useInPresentation()) return inputProps.renderDefault(inputProps);
|
|
7775
|
-
let open = () => void openComponentDefaults({
|
|
7776
|
-
type,
|
|
7777
|
-
config,
|
|
7778
|
-
hasDefaults: !0,
|
|
7779
|
-
client,
|
|
7780
|
-
navigateIntent: (i, p) => router.navigateIntent(i, p)
|
|
7781
|
-
});
|
|
7782
|
-
return /* @__PURE__ */ jsxs(Stack, {
|
|
7783
|
-
gap: 3,
|
|
7784
|
-
children: [/* @__PURE__ */ jsx(Flex, {
|
|
7785
|
-
justify: "flex-end",
|
|
7786
|
-
children: /* @__PURE__ */ jsx(Button, {
|
|
7787
|
-
mode: "ghost",
|
|
7788
|
-
tone: "primary",
|
|
7789
|
-
fontSize: 1,
|
|
7790
|
-
padding: 2,
|
|
7791
|
-
text: "Modifier l'instance principale",
|
|
7792
|
-
title: "Valeurs par défaut du composant : elles s'appliquent à toutes ses instances dont le champ est vide",
|
|
7793
|
-
onClick: open
|
|
7794
|
-
})
|
|
7795
|
-
}), inputProps.renderDefault(inputProps)]
|
|
7796
|
-
});
|
|
7797
|
-
}
|
|
7798
7751
|
return OverrideInput;
|
|
7799
7752
|
}
|
|
7800
7753
|
function carriesDot(schemaType) {
|
|
@@ -7853,6 +7806,163 @@ function OverrideDot(props) {
|
|
|
7853
7806
|
});
|
|
7854
7807
|
}
|
|
7855
7808
|
/**
|
|
7809
|
+
* « Retirer du site » : dépublication native de Sanity, rendue visible et expliquée.
|
|
7810
|
+
* La version EN LIGNE est supprimée, tout le contenu reste dans le BROUILLON (rien
|
|
7811
|
+
* n'est perdu) : la page disparaît du site (404 en production et en préproduction
|
|
7812
|
+
* « En ligne », purge par le webhook), l'onglet Pages l'affiche « Non publiée », et
|
|
7813
|
+
* on la remet en ligne en publiant le brouillon.
|
|
7814
|
+
*
|
|
7815
|
+
* Avant de confirmer, la liste des documents publiés qui pointent vers la page :
|
|
7816
|
+
* leurs liens vers elle disparaîtront du site. Une référence FORTE (non `weak`)
|
|
7817
|
+
* empêche Sanity de dépublier : le message l'explique au lieu d'une erreur brute.
|
|
7818
|
+
*/
|
|
7819
|
+
const RemoveFromSiteAction = (props) => {
|
|
7820
|
+
let client = useKitClient(), [open, setOpen] = useState(!1), [referrers, setReferrers] = useState(null), [busy, setBusy] = useState(!1), [error, setError] = useState(null);
|
|
7821
|
+
if (useEffect(() => {
|
|
7822
|
+
open && (setReferrers(null), client.fetch("*[references($id) && !(_id in path(\"drafts.**\")) && _type != \"translation.metadata\"]{_id, _type, \"title\": coalesce(title, name, _id)}", { id: props.id }).then(setReferrers).catch(() => setReferrers([])));
|
|
7823
|
+
}, [
|
|
7824
|
+
open,
|
|
7825
|
+
client,
|
|
7826
|
+
props.id
|
|
7827
|
+
]), !props.published) return null;
|
|
7828
|
+
let confirm = async () => {
|
|
7829
|
+
setBusy(!0), setError(null);
|
|
7830
|
+
try {
|
|
7831
|
+
let { _rev, _updatedAt, ...published } = props.published, tx = client.transaction();
|
|
7832
|
+
props.draft || tx.createIfNotExists({
|
|
7833
|
+
...published,
|
|
7834
|
+
_id: `drafts.${props.id}`
|
|
7835
|
+
}), tx.delete(props.id), await tx.commit(), setOpen(!1), props.onComplete();
|
|
7836
|
+
} catch (cause) {
|
|
7837
|
+
let message = cause instanceof Error ? cause.message : String(cause);
|
|
7838
|
+
setError(/referenc/i.test(message) ? "Sanity refuse : un document publié pointe vers cette page par une référence forte. Retirez ou modifiez ce lien, puis recommencez." : `Le retrait a échoué, rien n'a changé. (${message.slice(0, 140)})`);
|
|
7839
|
+
} finally {
|
|
7840
|
+
setBusy(!1);
|
|
7841
|
+
}
|
|
7842
|
+
};
|
|
7843
|
+
return {
|
|
7844
|
+
label: "Retirer du site",
|
|
7845
|
+
title: "Dépublier : la page quitte le site, son contenu reste en brouillon",
|
|
7846
|
+
icon: EyeClosedIcon,
|
|
7847
|
+
tone: "critical",
|
|
7848
|
+
disabled: busy,
|
|
7849
|
+
onHandle: () => setOpen(!0),
|
|
7850
|
+
dialog: open && {
|
|
7851
|
+
type: "confirm",
|
|
7852
|
+
tone: "critical",
|
|
7853
|
+
onCancel: () => {
|
|
7854
|
+
setOpen(!1), props.onComplete();
|
|
7855
|
+
},
|
|
7856
|
+
onConfirm: () => void confirm(),
|
|
7857
|
+
message: /* @__PURE__ */ jsxs(Stack, {
|
|
7858
|
+
gap: 3,
|
|
7859
|
+
children: [
|
|
7860
|
+
/* @__PURE__ */ jsx(Text, {
|
|
7861
|
+
size: 1,
|
|
7862
|
+
children: "La page quitte le site (production et préproduction « En ligne »). Tout son contenu reste dans le brouillon : pour la remettre en ligne, publiez-le."
|
|
7863
|
+
}),
|
|
7864
|
+
referrers === null ? /* @__PURE__ */ jsx(Text, {
|
|
7865
|
+
size: 1,
|
|
7866
|
+
muted: !0,
|
|
7867
|
+
children: "Recherche des liens vers cette page…"
|
|
7868
|
+
}) : referrers.length > 0 ? /* @__PURE__ */ jsxs(Text, {
|
|
7869
|
+
size: 1,
|
|
7870
|
+
children: [
|
|
7871
|
+
"Ces documents publiés pointent vers elle ; leurs liens vers cette page disparaîtront du site :",
|
|
7872
|
+
" ",
|
|
7873
|
+
referrers.map((r) => r.title || r._id).join(", "),
|
|
7874
|
+
"."
|
|
7875
|
+
]
|
|
7876
|
+
}) : /* @__PURE__ */ jsx(Text, {
|
|
7877
|
+
size: 1,
|
|
7878
|
+
muted: !0,
|
|
7879
|
+
children: "Aucun document publié ne pointe vers cette page."
|
|
7880
|
+
}),
|
|
7881
|
+
error && /* @__PURE__ */ jsx(Text, {
|
|
7882
|
+
size: 1,
|
|
7883
|
+
weight: "semibold",
|
|
7884
|
+
children: error
|
|
7885
|
+
})
|
|
7886
|
+
]
|
|
7887
|
+
})
|
|
7888
|
+
}
|
|
7889
|
+
};
|
|
7890
|
+
};
|
|
7891
|
+
RemoveFromSiteAction.action = "unpublish";
|
|
7892
|
+
/**
|
|
7893
|
+
* Sous le champ Slug d'une page (types de pages du kit) : l'adresse COMPLÈTE de la
|
|
7894
|
+
* page sur le site en ligne, avec « Copier » et « Ouvrir ». Le slug seul ne dit pas
|
|
7895
|
+
* où la page vivra (préfixe de collection, langue) ; l'adresse se met à jour à
|
|
7896
|
+
* chaque frappe. Même calcul que l'onglet Pages (toPath / toUrl).
|
|
7897
|
+
*/
|
|
7898
|
+
function createSlugUrlInput(config) {
|
|
7899
|
+
function SlugUrlInput(props) {
|
|
7900
|
+
let doc = useFormValue([]), [copied, setCopied] = useState(!1), type = typeof doc?._type == "string" ? doc._type : null, pageType = type ? pageTypeFor(type, config.pageTypes) : null, slug = props.value?.current ?? null, locale = config.i18n ? doc?.[config.i18n.field] ?? null : null, path = pageType ? toPath({
|
|
7901
|
+
slug,
|
|
7902
|
+
path: pageType.path,
|
|
7903
|
+
pathPrefix: pageType.pathPrefix,
|
|
7904
|
+
locale
|
|
7905
|
+
}, config.i18n) : null, url = toUrl(config.previewUrl, path);
|
|
7906
|
+
if (!url) return props.renderDefault(props);
|
|
7907
|
+
let copy = () => {
|
|
7908
|
+
navigator.clipboard.writeText(url).then(() => {
|
|
7909
|
+
setCopied(!0), window.setTimeout(() => setCopied(!1), 1500);
|
|
7910
|
+
});
|
|
7911
|
+
};
|
|
7912
|
+
return /* @__PURE__ */ jsxs(Stack, {
|
|
7913
|
+
gap: 2,
|
|
7914
|
+
children: [props.renderDefault(props), /* @__PURE__ */ jsx(Card, {
|
|
7915
|
+
tone: "primary",
|
|
7916
|
+
padding: 2,
|
|
7917
|
+
radius: 2,
|
|
7918
|
+
border: !0,
|
|
7919
|
+
children: /* @__PURE__ */ jsxs(Flex, {
|
|
7920
|
+
align: "center",
|
|
7921
|
+
gap: 2,
|
|
7922
|
+
children: [
|
|
7923
|
+
/* @__PURE__ */ jsx(Text, {
|
|
7924
|
+
size: 1,
|
|
7925
|
+
muted: !0,
|
|
7926
|
+
style: {
|
|
7927
|
+
flex: 1,
|
|
7928
|
+
minWidth: 0,
|
|
7929
|
+
wordBreak: "break-all"
|
|
7930
|
+
},
|
|
7931
|
+
children: url
|
|
7932
|
+
}),
|
|
7933
|
+
/* @__PURE__ */ jsx(Button, {
|
|
7934
|
+
mode: "ghost",
|
|
7935
|
+
fontSize: 1,
|
|
7936
|
+
padding: 2,
|
|
7937
|
+
text: copied ? "Copié" : "Copier",
|
|
7938
|
+
onClick: copy
|
|
7939
|
+
}),
|
|
7940
|
+
/* @__PURE__ */ jsx(Button, {
|
|
7941
|
+
as: "a",
|
|
7942
|
+
href: url,
|
|
7943
|
+
target: "_blank",
|
|
7944
|
+
rel: "noopener noreferrer",
|
|
7945
|
+
mode: "ghost",
|
|
7946
|
+
fontSize: 1,
|
|
7947
|
+
padding: 2,
|
|
7948
|
+
text: "Ouvrir"
|
|
7949
|
+
})
|
|
7950
|
+
]
|
|
7951
|
+
})
|
|
7952
|
+
})]
|
|
7953
|
+
});
|
|
7954
|
+
}
|
|
7955
|
+
return SlugUrlInput;
|
|
7956
|
+
}
|
|
7957
|
+
function isSlugInput(props) {
|
|
7958
|
+
let t = props.schemaType;
|
|
7959
|
+
for (; t;) {
|
|
7960
|
+
if (t.name === "slug") return !0;
|
|
7961
|
+
t = t.type;
|
|
7962
|
+
}
|
|
7963
|
+
return !1;
|
|
7964
|
+
}
|
|
7965
|
+
/**
|
|
7856
7966
|
* `pageTypes` déduits du registre du starter, pour ne pas redire au kit ce que
|
|
7857
7967
|
* le site sait déjà : l'accueil (chemin fixe `/`) et chaque collection avec
|
|
7858
7968
|
* son préfixe d'URL (`/blog`, `/produits`, ou la racine).
|
|
@@ -8031,7 +8141,16 @@ const NCF_PAGES_TOOL = "ncf-pages", NCF_COMPONENTS_TOOL = "ncf-components", NCF_
|
|
|
8031
8141
|
NCF_COMPONENTS_TOOL,
|
|
8032
8142
|
NCF_HISTORY_TOOL,
|
|
8033
8143
|
NCF_DESIGN_SYSTEM_TOOL
|
|
8034
|
-
]
|
|
8144
|
+
];
|
|
8145
|
+
/** Champs du formulaire : adresse sous le Slug d'une page, pastille sur les sections. */
|
|
8146
|
+
function createKitInput(config) {
|
|
8147
|
+
let Override = createOverrideInput(config), SlugUrl = createSlugUrlInput(config);
|
|
8148
|
+
function KitInput(props) {
|
|
8149
|
+
return isSlugInput(props) ? createElement(SlugUrl, props) : createElement(Override, props);
|
|
8150
|
+
}
|
|
8151
|
+
return KitInput;
|
|
8152
|
+
}
|
|
8153
|
+
const ncfKit = definePlugin((options) => {
|
|
8035
8154
|
let config = resolveConfig(options), issues = validateConfig(config);
|
|
8036
8155
|
return {
|
|
8037
8156
|
name: "@nocode-factory/sanity-kit",
|
|
@@ -8101,9 +8220,12 @@ const NCF_PAGES_TOOL = "ncf-pages", NCF_COMPONENTS_TOOL = "ncf-components", NCF_
|
|
|
8101
8220
|
types: kitSchemaTypes,
|
|
8102
8221
|
templates: (prev) => prev.filter((template) => !isKitType(template.schemaType))
|
|
8103
8222
|
},
|
|
8104
|
-
document: {
|
|
8223
|
+
document: {
|
|
8224
|
+
newDocumentOptions: (prev) => prev.filter((option) => option.templateId !== BOARD_LAYOUT_TYPE),
|
|
8225
|
+
actions: (prev, context) => config.pageTypeNames.includes(context.schemaType) ? prev.map((action) => action.action === "unpublish" ? RemoveFromSiteAction : action) : prev
|
|
8226
|
+
},
|
|
8105
8227
|
studio: { components: { toolMenu: createPreviewLauncher(config, issues) } },
|
|
8106
|
-
form: { components: { input:
|
|
8228
|
+
form: { components: { input: createKitInput(config) } }
|
|
8107
8229
|
};
|
|
8108
8230
|
});
|
|
8109
8231
|
export { ANNOTATION_TYPE, ActorName, 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, 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, KIT_API_VERSION, KIT_VERSION, 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, baseId, blockName, blockTypesFromSchema, buildContentsQuery, buildLinkGraph, buildPageRows, buildPagesQuery, collectLinks, collectOccurrences, colorForRow, colorFromString, columnId, compareVersions, componentDefaultsMainDocument, componentDefaultsMainDocuments, createPreviewLauncher, customEnvironment, defaultNodeSize, defaultsFieldName, defineComponentDefaults, depth, deriveDocumentColumns, diffDocuments, diffWords, editIntentPath, explainGrantError, fallbackLayout, fetchDetail, fetchTimeline, fillTemplate, filterRows, flatten, formatDocumentValue, groupPageRows, groupValue, hasBlockingIssue, humanizeBlockName, isDraftId, isKitType, isPrerelease, isSafeColumnKey, isSafeFieldPath, isTextChange, isVersionId, issuesForTool, keyForPath, kitSchemaTypes, layoutGraph, layoutSectionsMap, localesInRows, mergeVersions, missingPageTypes, moveColumn, ncfAllowedOrigins, ncfKit, ncfPreviewComponents, normalizeInternalPath, normalizePath, occurrencesForTypes, pageThumbnailUrl, pageTypeFor, pageTypesFromSiteRoutes, pageTypesWithoutBuilder, parentPath, presentationPath, pruneSavedPositions, releaseId, removeColumn, renameColumn, requestPreviewGrant, requiredUnlessDefault, requiredUnlessDefaultFor, resolveColorBy, resolveConfig, segments, slugKey, sortRows, summarize, toKebabCase, toPath, toUrl, topLevelBlockCount, uniqueColumnId, upsertLayout, urlOn, useAnnotations, useBoardLayout, useDocumentColumns, useHistory, useInternalColumns, useKitClient, useKitConfig, useKitContext, useKitUpdate, useOccurrences, usePageContents, usePages, usePreviewTarget, useRegistration, validateConfig, withAlpha, withMoreTool };
|