@nocode-factory/sanity-kit 2.28.0 → 2.29.1
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/{componentDefaults-2eWjLLBf.js → componentDefaults-CelL5Ain.js} +60 -3
- package/dist/componentDefaults-CelL5Ain.js.map +1 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +138 -119
- package/dist/index.js.map +1 -1
- package/dist/schema.d.ts +2 -1
- package/dist/schema.js +4 -3
- package/dist/schema.js.map +1 -1
- package/package.json +1 -1
- package/src/actions/PropagatePublish.tsx +159 -70
- package/src/form/TranslationTodoInput.tsx +9 -5
- package/src/index.ts +1 -1
- package/src/lib/slugify.ts +12 -0
- package/src/schema/formTabs.ts +5 -2
- package/src/version.ts +1 -1
- package/dist/componentDefaults-2eWjLLBf.js.map +0 -1
|
@@ -1,5 +1,62 @@
|
|
|
1
1
|
import { defineField, defineType } from "sanity";
|
|
2
|
-
const
|
|
2
|
+
const DEFAULT_PAGE_BUILDER_FIELD = "sections", DEFAULT_SLUG_FIELD = "slug", DEFAULT_TITLE_FIELD = "title", DEFAULT_NOINDEX_FIELDS = ["seo.noindex", "noindex"], DEFAULT_I18N = {
|
|
3
|
+
field: "language",
|
|
4
|
+
defaultLocale: "fr",
|
|
5
|
+
locales: []
|
|
6
|
+
}, DEFAULT_COMPONENT_PREVIEW = {
|
|
7
|
+
provider: "designSystemPage",
|
|
8
|
+
path: "/design-system",
|
|
9
|
+
anchor: "{name}",
|
|
10
|
+
thumbnail: "/sections/{name}.png",
|
|
11
|
+
defaultsType: "componentDefaults",
|
|
12
|
+
live: "/design-system/composant?type={name}"
|
|
13
|
+
}, DEFAULT_TOOLS = {
|
|
14
|
+
pages: !0,
|
|
15
|
+
components: !0,
|
|
16
|
+
history: !0,
|
|
17
|
+
designSystem: !0
|
|
18
|
+
}, DEFAULT_TOOLBAR_MORE = [
|
|
19
|
+
"vision",
|
|
20
|
+
"releases",
|
|
21
|
+
"schedules"
|
|
22
|
+
], DEFAULT_BOARD_TAGS = [
|
|
23
|
+
{
|
|
24
|
+
id: "en-cours",
|
|
25
|
+
label: "In progress",
|
|
26
|
+
color: "#f5a623"
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
id: "fait",
|
|
30
|
+
label: "Done",
|
|
31
|
+
color: "#43d675"
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
id: "a-relire",
|
|
35
|
+
label: "To review",
|
|
36
|
+
color: "#2276fc"
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
id: "a-refondre",
|
|
40
|
+
label: "To rework",
|
|
41
|
+
color: "#f03e3e"
|
|
42
|
+
}
|
|
43
|
+
], DEFAULT_INTERNAL_FIELDS = [
|
|
44
|
+
{
|
|
45
|
+
id: "owner",
|
|
46
|
+
label: "Owner",
|
|
47
|
+
type: "text"
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
id: "audience",
|
|
51
|
+
label: "Audience",
|
|
52
|
+
type: "text"
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
id: "role",
|
|
56
|
+
label: "Page role",
|
|
57
|
+
type: "text"
|
|
58
|
+
}
|
|
59
|
+
], DEFAULT_SERVICE_ENDPOINT = "https://dkoxgivytgsmvqmjvmjt.supabase.co/functions/v1", DEFAULT_COMPONENT_DEFAULTS_TYPE = "componentDefaults";
|
|
3
60
|
/** Nom du champ d'un composant dans le document des valeurs par défaut : `section.cta` -> `cta`. */
|
|
4
61
|
function defaultsFieldName(type, namespace = "section.") {
|
|
5
62
|
return type.startsWith(namespace) ? type.slice(namespace.length) : type;
|
|
@@ -87,6 +144,6 @@ function componentDefaultsMainDocuments(options = {}) {
|
|
|
87
144
|
route
|
|
88
145
|
}));
|
|
89
146
|
}
|
|
90
|
-
export { defineComponentDefaults as a, defaultsFieldName as i, componentDefaultsMainDocument as n, requiredUnlessDefault as o, componentDefaultsMainDocuments as r, requiredUnlessDefaultFor as s, DEFAULT_COMPONENT_DEFAULTS_TYPE as t };
|
|
147
|
+
export { DEFAULT_TOOLBAR_MORE as _, defineComponentDefaults as a, DEFAULT_BOARD_TAGS as c, DEFAULT_INTERNAL_FIELDS as d, DEFAULT_NOINDEX_FIELDS as f, DEFAULT_TITLE_FIELD as g, DEFAULT_SLUG_FIELD as h, defaultsFieldName as i, DEFAULT_COMPONENT_PREVIEW as l, DEFAULT_SERVICE_ENDPOINT as m, componentDefaultsMainDocument as n, requiredUnlessDefault as o, DEFAULT_PAGE_BUILDER_FIELD as p, componentDefaultsMainDocuments as r, requiredUnlessDefaultFor as s, DEFAULT_COMPONENT_DEFAULTS_TYPE as t, DEFAULT_I18N as u, DEFAULT_TOOLS as v };
|
|
91
148
|
|
|
92
|
-
//# sourceMappingURL=componentDefaults-
|
|
149
|
+
//# sourceMappingURL=componentDefaults-CelL5Ain.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"componentDefaults-CelL5Ain.js","names":[],"sources":["../src/config/defaults.ts","../src/schema/componentDefaults.ts"],"sourcesContent":["import type {\n NcfBoardTag,\n NcfInternalField,\n NcfComponentPreviewConfig,\n NcfI18nConfig,\n NcfToolsConfig,\n} from './types'\n\nexport const DEFAULT_PAGE_BUILDER_FIELD = 'sections'\nexport const DEFAULT_SLUG_FIELD = 'slug'\nexport const DEFAULT_TITLE_FIELD = 'title'\nexport const DEFAULT_BLOCK_NAMESPACE = ''\n\n/**\n * Chemins essayés pour savoir si une page est indexable. Le premier\n * correspond à la convention du starter (`seo.noindex`), le second couvre les\n * schémas qui portent le drapeau à la racine.\n */\nexport const DEFAULT_NOINDEX_FIELDS = ['seo.noindex', 'noindex']\n\nexport const DEFAULT_I18N: Omit<Required<NcfI18nConfig>, 'defaultsSourceLocale'> = {\n field: 'language',\n defaultLocale: 'fr',\n locales: [],\n}\n\n/**\n * Convention NoCode Factory : page `/design-system` dans le front, captures\n * dans `/sections/<nom>.png` générées au push par GitHub Actions.\n */\nexport const DEFAULT_COMPONENT_PREVIEW: Required<NcfComponentPreviewConfig> = {\n provider: 'designSystemPage',\n path: '/design-system',\n anchor: '{name}',\n thumbnail: '/sections/{name}.png',\n defaultsType: 'componentDefaults',\n live: '/design-system/composant?type={name}',\n}\n\nexport const DEFAULT_TOOLS: Required<NcfToolsConfig> = {\n pages: true,\n components: true,\n history: true,\n designSystem: true,\n}\n\n/**\n * Outils rangés dans « Plus » : Vision (console GROQ) et la planification\n * (« Scheduled drafts » quand les Releases sont désactivées, « Releases » sinon :\n * le même outil, nommé `releases` ; `schedules` couvre les anciennes versions).\n */\nexport const DEFAULT_TOOLBAR_MORE = ['vision', 'releases', 'schedules']\n\n/**\n * Étiquettes de suivi par défaut : l'avancement d'une refonte, pas un statut\n * de publication. Elles vivent dans le document de disposition du kit, donc\n * aucun schéma client n'est modifié.\n */\nexport const DEFAULT_BOARD_TAGS: NcfBoardTag[] = [\n {id: 'en-cours', label: 'In progress', color: '#f5a623'},\n {id: 'fait', label: 'Done', color: '#43d675'},\n {id: 'a-relire', label: 'To review', color: '#2276fc'},\n {id: 'a-refondre', label: 'To rework', color: '#f03e3e'},\n]\n\n/**\n * Colonnes de gestion interne par défaut. Volontairement peu nombreuses : ce\n * sont celles qu'on redemande sur tous les projets. `internalFields` les\n * remplace entièrement.\n */\nexport const DEFAULT_INTERNAL_FIELDS: NcfInternalField[] = [\n {id: 'owner', label: 'Owner', type: 'text'},\n {id: 'audience', label: 'Audience', type: 'text'},\n {id: 'role', label: 'Page role', type: 'text'},\n]\n\n/**\n * Service du kit, hébergé par NoCode Factory.\n *\n * Renseigné d'office pour qu'un Studio n'ait rien à configurer : il se\n * signale au démarrage, et c'est ce qui permet de savoir quels projets\n * utilisent le kit. `endpoint` le remplace pour une instance privée.\n */\nexport const DEFAULT_SERVICE_ENDPOINT = 'https://dkoxgivytgsmvqmjvmjt.supabase.co/functions/v1'\n","import {defineField, defineType, type Rule} from 'sanity'\n\n/**\n * VALEURS PAR DÉFAUT DES COMPOSANTS, côté Studio.\n *\n * Un document (un par langue) avec un bloc par composant de la bibliothèque,\n * GÉNÉRÉ depuis les schémas des sections : une section ajoutée y apparaît sans\n * rien faire. Une instance dont un champ est vide affiche la valeur par défaut ;\n * un champ rempli (override) n'est jamais écrasé. Côté site :\n * `@nocode-factory/sanity-kit/web/defaults`. Dans le Studio, l'onglet Composants\n * ouvre chaque composant (rendu réel + réglages), et une pastille bleue marque\n * chaque champ d'instance qui diffère de la valeur par défaut.\n *\n * Deux règles pour les champs de section, qui en découlent :\n * - jamais d'`initialValue` (ce serait un override involontaire) ;\n * - « obligatoire » = `requiredUnlessDefault`.\n */\n\ntype FieldDef = {name: string; type: string; validation?: unknown; initialValue?: unknown; fields?: FieldDef[]; of?: FieldDef[]; [k: string]: unknown}\ntype SectionDef = {name: string; title?: string; fields: FieldDef[]}\n\nexport const DEFAULT_COMPONENT_DEFAULTS_TYPE = 'componentDefaults'\n\n/** Nom du champ d'un composant dans le document des valeurs par défaut : `section.cta` -> `cta`. */\nexport function defaultsFieldName(type: string, namespace = 'section.'): string {\n return type.startsWith(namespace) ? type.slice(namespace.length) : type\n}\n\n// Dans les valeurs par défaut, rien n'est obligatoire et rien n'est prérempli.\nconst relax = (f: FieldDef): FieldDef => {\n const {validation: _v, initialValue: _i, ...rest} = f\n return {\n ...rest,\n ...(rest.fields ? {fields: rest.fields.map(relax)} : {}),\n ...(rest.of ? {of: rest.of.map(relax)} : {}),\n }\n}\n\n/** Document « Composants : valeurs par défaut », généré depuis les sections. */\nexport function defineComponentDefaults(options: {sections: readonly unknown[]; name?: string; title?: string; namespace?: string}) {\n const {name = DEFAULT_COMPONENT_DEFAULTS_TYPE, title = '🧩 Components: default values', namespace = 'section.'} = options\n return defineType({\n name,\n title,\n type: 'document',\n description:\n 'Values applied to every instance of a component whose field is empty. A field filled in an instance takes precedence (override).',\n fields: (options.sections as SectionDef[]).map((t) =>\n defineField({\n name: defaultsFieldName(t.name, namespace),\n title: t.title || t.name,\n type: 'object',\n description: 'Default values of this component. Empty = design system value.',\n options: {collapsible: true, collapsed: true},\n fields: t.fields.map(relax) as never,\n }),\n ),\n preview: {prepare: () => ({title: title.replace(/^\\S+\\s/, '')})},\n })\n}\n\nconst isEmpty = (v: unknown) => v === undefined || v === null || v === '' || (Array.isArray(v) && v.length === 0)\n\n/**\n * Règle « obligatoire SAUF si le composant a une valeur par défaut » pour un autre\n * type de document des valeurs par défaut ou un autre espace de noms.\n * `validation: requiredUnlessDefaultFor({type: 'mesDefauts'})`\n */\nexport function requiredUnlessDefaultFor(options: {type?: string; namespace?: string} = {}) {\n const {type: defaultsType = DEFAULT_COMPONENT_DEFAULTS_TYPE, namespace = 'section.'} = options\n return <R>(rule: R): R =>\n (rule as unknown as Rule).custom(async (value, context) => {\n if (!isEmpty(value)) return true\n const type = (context.parent as {_type?: string} | undefined)?._type\n const field = context.path?.[context.path.length - 1]\n const name = type ? defaultsFieldName(type, namespace) : ''\n if (!type?.startsWith(namespace) || typeof field !== 'string' || !/^\\w+$/.test(name) || !/^\\w+$/.test(field)) return 'Required.'\n const language = (context.document as {language?: string} | undefined)?.language ?? null\n const inherited = await context\n .getClient({apiVersion: '2024-10-01'})\n .fetch(\n `*[_type == $defaultsType && !(_id in path(\"drafts.**\")) && ($language == null || language == $language)][0].${name}.${field}`,\n {defaultsType, language},\n )\n return isEmpty(inherited) ? 'Required (or set it in Components > default values).' : true\n }) as unknown as R\n}\n\n/**\n * Champ de section obligatoire, SAUF si le composant a une valeur par défaut\n * pour ce champ (elle s'affichera). Tout type de champ.\n * `validation: requiredUnlessDefault`\n */\nexport const requiredUnlessDefault: <R>(rule: R) => R = requiredUnlessDefaultFor()\n\n/**\n * Presentation : la page qui rend un composant seul (par défaut\n * `/design-system/composant`) a pour document principal les valeurs par défaut.\n * Rendu réel et réglages côte à côte, en direct.\n * `presentationTool({resolve: {mainDocuments: defineDocuments([componentDefaultsMainDocument({language: 'fr'})])}})`\n */\nexport function componentDefaultsMainDocument(options: {language?: string; route?: string; type?: string} = {}): {route: string; filter: string} {\n const {language, route = '/design-system/composant', type = DEFAULT_COMPONENT_DEFAULTS_TYPE} = options\n const safeLang = language && /^[a-z]{2}(-[A-Za-z]{2})?$/.test(language) ? language : null\n return {route, filter: `_type == \"${type}\"${safeLang ? ` && language == \"${safeLang}\"` : ''}`}\n}\n\n/**\n * Presentation : les pages du design system ont pour document principal les valeurs\n * par défaut des composants. `/design-system` (toute la bibliothèque) et\n * `/design-system/composant` (un composant seul) : cliquer un composant ouvre ses\n * réglages globaux, et un style changé change le composant partout où il n'est\n * pas surchargé.\n * `presentationTool({resolve: {mainDocuments: defineDocuments(componentDefaultsMainDocuments({language: 'fr'}))}})`\n */\nexport function componentDefaultsMainDocuments(\n options: {language?: string; type?: string; routes?: string[]} = {},\n): {route: string; filter: string}[] {\n const {routes = ['/design-system/composant', '/design-system'], ...rest} = options\n return routes.map((route) => componentDefaultsMainDocument({...rest, route}))\n}\n"],"mappings":"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"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1348,7 +1348,7 @@ export declare function ActorName(props: {
|
|
|
1348
1348
|
* quelle version. Recopiée de `package.json` par `npm version` (scripts/sync-version.mjs) ; un test
|
|
1349
1349
|
* le vérifie.
|
|
1350
1350
|
*/
|
|
1351
|
-
export declare const KIT_VERSION = "2.
|
|
1351
|
+
export declare const KIT_VERSION = "2.29.1";
|
|
1352
1352
|
/**
|
|
1353
1353
|
* Données de la page proposées comme colonnes.
|
|
1354
1354
|
*
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
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-
|
|
1
|
+
import { _ as DEFAULT_TOOLBAR_MORE, a as defineComponentDefaults, c as DEFAULT_BOARD_TAGS, d as DEFAULT_INTERNAL_FIELDS, f as DEFAULT_NOINDEX_FIELDS, g as DEFAULT_TITLE_FIELD, h as DEFAULT_SLUG_FIELD, i as defaultsFieldName, l as DEFAULT_COMPONENT_PREVIEW, n as componentDefaultsMainDocument, o as requiredUnlessDefault, p as DEFAULT_PAGE_BUILDER_FIELD, r as componentDefaultsMainDocuments, s as requiredUnlessDefaultFor, t as DEFAULT_COMPONENT_DEFAULTS_TYPE, u as DEFAULT_I18N, v as DEFAULT_TOOLS } from "./componentDefaults-CelL5Ain.js";
|
|
2
2
|
import { createContext, createElement, forwardRef, memo, useCallback, useContext, useEffect, useMemo, useRef, useState, useSyncExternalStore } from "react";
|
|
3
3
|
import { ToolLink, defineField, definePlugin, defineType, pathToString, set, unset, useClient, useCurrentUser, useFormValue, usePerspective, useSchema, useSetPerspective, useUser, useWorkspace } from "sanity";
|
|
4
4
|
import { ClockIcon } from "@sanity/icons/Clock";
|
|
@@ -39,64 +39,7 @@ import { Tooltip } from "@sanity/ui/tooltip";
|
|
|
39
39
|
import { EyeClosedIcon } from "@sanity/icons/EyeClosed";
|
|
40
40
|
import { usePresentationNavigate, usePresentationParams } from "sanity/presentation";
|
|
41
41
|
import { useToast } from "@sanity/ui/toast";
|
|
42
|
-
const
|
|
43
|
-
field: "language",
|
|
44
|
-
defaultLocale: "fr",
|
|
45
|
-
locales: []
|
|
46
|
-
}, DEFAULT_COMPONENT_PREVIEW = {
|
|
47
|
-
provider: "designSystemPage",
|
|
48
|
-
path: "/design-system",
|
|
49
|
-
anchor: "{name}",
|
|
50
|
-
thumbnail: "/sections/{name}.png",
|
|
51
|
-
defaultsType: "componentDefaults",
|
|
52
|
-
live: "/design-system/composant?type={name}"
|
|
53
|
-
}, DEFAULT_TOOLS = {
|
|
54
|
-
pages: !0,
|
|
55
|
-
components: !0,
|
|
56
|
-
history: !0,
|
|
57
|
-
designSystem: !0
|
|
58
|
-
}, DEFAULT_TOOLBAR_MORE = [
|
|
59
|
-
"vision",
|
|
60
|
-
"releases",
|
|
61
|
-
"schedules"
|
|
62
|
-
], DEFAULT_BOARD_TAGS = [
|
|
63
|
-
{
|
|
64
|
-
id: "en-cours",
|
|
65
|
-
label: "In progress",
|
|
66
|
-
color: "#f5a623"
|
|
67
|
-
},
|
|
68
|
-
{
|
|
69
|
-
id: "fait",
|
|
70
|
-
label: "Done",
|
|
71
|
-
color: "#43d675"
|
|
72
|
-
},
|
|
73
|
-
{
|
|
74
|
-
id: "a-relire",
|
|
75
|
-
label: "To review",
|
|
76
|
-
color: "#2276fc"
|
|
77
|
-
},
|
|
78
|
-
{
|
|
79
|
-
id: "a-refondre",
|
|
80
|
-
label: "To rework",
|
|
81
|
-
color: "#f03e3e"
|
|
82
|
-
}
|
|
83
|
-
], DEFAULT_INTERNAL_FIELDS = [
|
|
84
|
-
{
|
|
85
|
-
id: "owner",
|
|
86
|
-
label: "Owner",
|
|
87
|
-
type: "text"
|
|
88
|
-
},
|
|
89
|
-
{
|
|
90
|
-
id: "audience",
|
|
91
|
-
label: "Audience",
|
|
92
|
-
type: "text"
|
|
93
|
-
},
|
|
94
|
-
{
|
|
95
|
-
id: "role",
|
|
96
|
-
label: "Page role",
|
|
97
|
-
type: "text"
|
|
98
|
-
}
|
|
99
|
-
], trimTrailingSlash = (url) => url.replace(/\/+$/, ""), normalizePath = (path) => {
|
|
42
|
+
const trimTrailingSlash = (url) => url.replace(/\/+$/, ""), normalizePath = (path) => {
|
|
100
43
|
let trimmed = path.trim();
|
|
101
44
|
if (!trimmed || trimmed === "/") return "/";
|
|
102
45
|
let withSlash = trimmed.startsWith("/") ? trimmed : `/${trimmed}`;
|
|
@@ -1420,7 +1363,7 @@ function explainGrantError(error) {
|
|
|
1420
1363
|
* quelle version. Recopiée de `package.json` par `npm version` (scripts/sync-version.mjs) ; un test
|
|
1421
1364
|
* le vérifie.
|
|
1422
1365
|
*/
|
|
1423
|
-
const KIT_VERSION = "2.
|
|
1366
|
+
const KIT_VERSION = "2.29.1";
|
|
1424
1367
|
/**
|
|
1425
1368
|
* Signale ce Studio au service du kit, une fois par montage.
|
|
1426
1369
|
*
|
|
@@ -1763,7 +1706,7 @@ function useKitUpdate() {
|
|
|
1763
1706
|
!controller.signal.aborted && body?.version && setLatest(body.version);
|
|
1764
1707
|
}).catch(() => {}), () => controller.abort();
|
|
1765
1708
|
}, []);
|
|
1766
|
-
let available = !!(latest && !isPrerelease(latest) && compareVersions(latest, "2.
|
|
1709
|
+
let available = !!(latest && !isPrerelease(latest) && compareVersions(latest, "2.29.1") > 0);
|
|
1767
1710
|
return {
|
|
1768
1711
|
current: KIT_VERSION,
|
|
1769
1712
|
latest,
|
|
@@ -8250,7 +8193,7 @@ function withTranslationTodo(Inner, config) {
|
|
|
8250
8193
|
return client.getDocument(sourceId).then((doc) => {
|
|
8251
8194
|
if (!alive) return;
|
|
8252
8195
|
let text = collectTexts$1(valueAtKey(doc, key)).join("").trim();
|
|
8253
|
-
setMaster(text ||
|
|
8196
|
+
setMaster(text || "(empty: follows the component default)");
|
|
8254
8197
|
}).catch(() => alive && setMaster(null)), () => {
|
|
8255
8198
|
alive = !1;
|
|
8256
8199
|
};
|
|
@@ -8266,9 +8209,12 @@ function withTranslationTodo(Inner, config) {
|
|
|
8266
8209
|
setBusy(!0), setError(null);
|
|
8267
8210
|
try {
|
|
8268
8211
|
let value = valueAtKey(await client.getDocument(todo.sourceId) ?? await client.getDocument(`drafts.${todo.sourceId}`), key);
|
|
8269
|
-
if (value
|
|
8270
|
-
|
|
8271
|
-
|
|
8212
|
+
if (!collectTexts$1(value).some((t) => t.trim())) props.onChange(unset());
|
|
8213
|
+
else {
|
|
8214
|
+
let [translated] = await translateValues(config.history, todo.sourceLanguage, language, [value]);
|
|
8215
|
+
props.onChange(set(translated));
|
|
8216
|
+
}
|
|
8217
|
+
await client.patch(todo._id).set({ paths: (todo.paths ?? []).filter((p) => p !== key) }).commit();
|
|
8272
8218
|
} catch (cause) {
|
|
8273
8219
|
setError(cause instanceof Error ? cause.message : String(cause));
|
|
8274
8220
|
} finally {
|
|
@@ -8580,37 +8526,58 @@ function propagate(target, before, after, documentType) {
|
|
|
8580
8526
|
function hasChanges(r) {
|
|
8581
8527
|
return r.toTranslate.length > 0 || r.copied.length > 0 || r.added > 0 || r.removed > 0 || r.moved;
|
|
8582
8528
|
}
|
|
8583
|
-
/**
|
|
8584
|
-
|
|
8585
|
-
|
|
8586
|
-
|
|
8587
|
-
|
|
8588
|
-
*
|
|
8589
|
-
*
|
|
8590
|
-
*
|
|
8529
|
+
/** Slug d'URL depuis un titre : sans accents, minuscules, tirets. */
|
|
8530
|
+
function slugify(input, maxLength = 96) {
|
|
8531
|
+
return input.normalize("NFD").replace(/[̀-ͯ]/g, "").toLowerCase().replace(/&/g, " and ").replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "").slice(0, maxLength).replace(/-+$/g, "");
|
|
8532
|
+
}
|
|
8533
|
+
/**
|
|
8534
|
+
* Publier la version PRINCIPALE d'une page :
|
|
8535
|
+
* - page déjà publiée qui a des traductions : « Propagate to other languages? »
|
|
8536
|
+
* applique la structure (sections ajoutées, supprimées, déplacées) et les valeurs
|
|
8537
|
+
* non textuelles (images, liens, options…) ;
|
|
8538
|
+
* - PREMIÈRE publication : « Create the other language versions? » crée la page dans
|
|
8539
|
+
* chaque langue cochée, reliée à ses traductions (hreflang, bascule de langue).
|
|
8540
|
+
* Avec « Translate with AI » (service du kit, coché par défaut) : textes traduits
|
|
8541
|
+
* par l'IA et versions PUBLIÉES directement (aucun clic de plus). Sans, ou si l'IA
|
|
8542
|
+
* échoue : brouillons, textes marqués « To translate ». Une modification d'une autre
|
|
8543
|
+
* langue ne remonte jamais à la version principale.
|
|
8591
8544
|
* `masterLocale` : langue source (défaut : langue principale du site ; les valeurs
|
|
8592
|
-
* par défaut des composants ont la leur, `i18n.defaultsSourceLocale`).
|
|
8545
|
+
* par défaut des composants ont la leur, `i18n.defaultsSourceLocale`). `allowCreate` :
|
|
8546
|
+
* propose la création des autres versions (types de pages seulement).
|
|
8593
8547
|
*/
|
|
8594
|
-
function withPropagation(Publish, config, masterLocale) {
|
|
8548
|
+
function withPropagation(Publish, config, masterLocale, options = {}) {
|
|
8595
8549
|
let i18n = config.i18n, master = masterLocale ?? i18n?.defaultLocale, Wrapped = (props) => {
|
|
8596
8550
|
let base = Publish(props), client = useKitClient(), schema = useSchema(), [run, setRun] = useState(null), current = props.draft ?? props.published;
|
|
8597
8551
|
return !base || !i18n || current?.[i18n.field] !== master ? base : {
|
|
8598
8552
|
...base,
|
|
8599
8553
|
onHandle: () => {
|
|
8600
8554
|
let before = props.published, after = props.draft;
|
|
8601
|
-
if (base.onHandle?.(), !
|
|
8602
|
-
let documentType = schema.get(props.type);
|
|
8603
|
-
findTargets(client, props.id,
|
|
8555
|
+
if (base.onHandle?.(), !after) return;
|
|
8556
|
+
let documentType = schema.get(props.type), source = String(after[i18n.field] ?? "");
|
|
8557
|
+
before ? findTargets(client, props.id, source, before, after, documentType).then((targets) => {
|
|
8604
8558
|
targets.some((t) => hasChanges(t.result)) && setRun({
|
|
8605
|
-
|
|
8559
|
+
mode: "update",
|
|
8606
8560
|
after,
|
|
8607
8561
|
targets
|
|
8608
8562
|
});
|
|
8563
|
+
}).catch(() => {}) : options.allowCreate && findMissing(client, props.id, source, i18n.locales).then((missing) => {
|
|
8564
|
+
if (!missing.length) return;
|
|
8565
|
+
let result = propagate({}, {}, after, documentType);
|
|
8566
|
+
setRun({
|
|
8567
|
+
mode: "create",
|
|
8568
|
+
after,
|
|
8569
|
+
targets: missing.map((language) => ({
|
|
8570
|
+
language,
|
|
8571
|
+
id: null,
|
|
8572
|
+
result,
|
|
8573
|
+
selected: !0
|
|
8574
|
+
}))
|
|
8575
|
+
});
|
|
8609
8576
|
}).catch(() => {});
|
|
8610
8577
|
},
|
|
8611
8578
|
dialog: run ? {
|
|
8612
8579
|
type: "dialog",
|
|
8613
|
-
header: "Propagate to other languages?",
|
|
8580
|
+
header: run.mode === "create" ? "Create the other language versions?" : "Propagate to other languages?",
|
|
8614
8581
|
width: "medium",
|
|
8615
8582
|
onClose: () => {
|
|
8616
8583
|
setRun(null), props.onComplete();
|
|
@@ -8619,7 +8586,7 @@ function withPropagation(Publish, config, masterLocale) {
|
|
|
8619
8586
|
config,
|
|
8620
8587
|
id: props.id,
|
|
8621
8588
|
type: props.type,
|
|
8622
|
-
|
|
8589
|
+
mode: run.mode,
|
|
8623
8590
|
after: run.after,
|
|
8624
8591
|
targets: run.targets,
|
|
8625
8592
|
onDone: () => {
|
|
@@ -8631,10 +8598,16 @@ function withPropagation(Publish, config, masterLocale) {
|
|
|
8631
8598
|
};
|
|
8632
8599
|
return Wrapped.action = Publish.action, Wrapped;
|
|
8633
8600
|
}
|
|
8601
|
+
async function translationsOf(client, id) {
|
|
8602
|
+
return (await client.fetch("*[_type == \"translation.metadata\" && references($id)][0].translations[]{language, \"key\": _key, \"id\": value._ref}", { id }) ?? []).map((t) => ({
|
|
8603
|
+
language: t.language ?? t.key ?? "",
|
|
8604
|
+
id: t.id ?? ""
|
|
8605
|
+
})).filter((t) => t.language && t.id);
|
|
8606
|
+
}
|
|
8634
8607
|
async function findTargets(client, id, source, before, after, documentType) {
|
|
8635
|
-
let
|
|
8636
|
-
for (let t of
|
|
8637
|
-
if (
|
|
8608
|
+
let list = [];
|
|
8609
|
+
for (let t of await translationsOf(client, id)) {
|
|
8610
|
+
if (t.id === id || t.language === source) continue;
|
|
8638
8611
|
let target = await client.getDocument(`drafts.${t.id}`) ?? await client.getDocument(t.id) ?? null;
|
|
8639
8612
|
if (!target) continue;
|
|
8640
8613
|
let result = propagate(target, before, after, documentType);
|
|
@@ -8647,45 +8620,93 @@ async function findTargets(client, id, source, before, after, documentType) {
|
|
|
8647
8620
|
}
|
|
8648
8621
|
return list;
|
|
8649
8622
|
}
|
|
8623
|
+
async function findMissing(client, id, source, locales) {
|
|
8624
|
+
let existing = new Set((await translationsOf(client, id)).map((t) => t.language));
|
|
8625
|
+
return locales.filter((l) => l !== source && !existing.has(l));
|
|
8626
|
+
}
|
|
8627
|
+
const randomId = () => typeof crypto < "u" && "randomUUID" in crypto ? crypto.randomUUID() : `${Date.now().toString(36)}${Math.random().toString(36).slice(2)}`;
|
|
8628
|
+
/** Relie les nouvelles versions à la page (translation.metadata de document-internationalization). */
|
|
8629
|
+
async function linkTranslations(client, sourceId, sourceLanguage, type, created) {
|
|
8630
|
+
if (!created.length) return;
|
|
8631
|
+
let item = (language, ref) => ({
|
|
8632
|
+
_key: language,
|
|
8633
|
+
_type: "internationalizedArrayReferenceValue",
|
|
8634
|
+
language,
|
|
8635
|
+
value: {
|
|
8636
|
+
_type: "reference",
|
|
8637
|
+
_ref: ref,
|
|
8638
|
+
_weak: !0,
|
|
8639
|
+
_strengthenOnPublish: { type }
|
|
8640
|
+
}
|
|
8641
|
+
}), meta = await client.fetch("*[_type == \"translation.metadata\" && references($id)][0]{_id}", { id: sourceId });
|
|
8642
|
+
meta ? await client.patch(meta._id).setIfMissing({ translations: [] }).append("translations", created.map((c) => item(c.language, c.id))).commit() : await client.create({
|
|
8643
|
+
_id: randomId(),
|
|
8644
|
+
_type: "translation.metadata",
|
|
8645
|
+
schemaTypes: [type],
|
|
8646
|
+
translations: [item(sourceLanguage, sourceId), ...created.map((c) => item(c.language, c.id))]
|
|
8647
|
+
});
|
|
8648
|
+
}
|
|
8650
8649
|
function PropagateDialog(props) {
|
|
8651
|
-
let { config, id, type, after, onDone } = props, client = useKitClient(), field = config.i18n?.field ?? "language", source = String(after[field] ?? ""), [targets, setTargets] = useState(props.targets), [busy, setBusy] = useState(!1), toast = useToast(), [error, setError] = useState(null), [ai, setAi] = useState(!!config.history), apply = async () => {
|
|
8650
|
+
let { config, id, type, mode, after, onDone } = props, client = useKitClient(), field = config.i18n?.field ?? "language", source = String(after[field] ?? ""), pageType = config.pageTypes.find((t) => t.type === type), [targets, setTargets] = useState(props.targets), [busy, setBusy] = useState(!1), toast = useToast(), [error, setError] = useState(null), [ai, setAi] = useState(!!config.history), hasTexts = targets.some((t) => t.result.toTranslate.length), apply = async () => {
|
|
8652
8651
|
setBusy(!0), setError(null);
|
|
8653
8652
|
try {
|
|
8654
|
-
let
|
|
8653
|
+
let published = [], drafted = [], created = [], aiError = null;
|
|
8655
8654
|
for (let t of targets) {
|
|
8656
8655
|
if (!t.selected) continue;
|
|
8657
|
-
let { _rev, _createdAt, _updatedAt, ...doc } = t.result.document, remaining = t.result.toTranslate;
|
|
8656
|
+
let { _id, _rev, _createdAt, _updatedAt, ...doc } = structuredClone(t.result.document), targetId = t.id ?? randomId(), remaining = t.result.toTranslate, translatedOk = !remaining.length;
|
|
8658
8657
|
if (ai && config.history && remaining.length) try {
|
|
8659
|
-
let
|
|
8660
|
-
remaining = remaining.filter((path, n) =>
|
|
8658
|
+
let toSend = remaining.map((path) => valueAtKey(after, path)).map((v) => collectTexts$1(v).some((s) => s.trim()) ? v : void 0), translated = await translateValues(config.history, source, t.language, toSend.map((v) => v ?? ""));
|
|
8659
|
+
remaining = remaining.filter((path, n) => !setAtKey(doc, path, toSend[n] === void 0 ? void 0 : translated[n])), translatedOk = !remaining.length;
|
|
8661
8660
|
} catch (cause) {
|
|
8662
8661
|
aiError = cause instanceof Error ? cause.message : String(cause);
|
|
8663
8662
|
}
|
|
8664
|
-
if (
|
|
8663
|
+
if (mode === "create") {
|
|
8664
|
+
doc[field] = t.language;
|
|
8665
|
+
let slugField = pageType?.slugField, titleField = pageType?.titleField ?? "title", title = typeof doc[titleField] == "string" ? doc[titleField] : "", sourceSlug = slugField ? after[slugField]?.current : void 0;
|
|
8666
|
+
if (slugField && (title || sourceSlug)) {
|
|
8667
|
+
let base = slugify(title) || String(sourceSlug), slug = base;
|
|
8668
|
+
for (let n = 2; await client.fetch(`count(*[_type == $type && ${slugField}.current == $slug && ${field} == $language && !(_id in path("drafts.**"))]) > 0`, {
|
|
8669
|
+
type,
|
|
8670
|
+
slug,
|
|
8671
|
+
language: t.language
|
|
8672
|
+
}); n++) slug = `${base}-${n}`;
|
|
8673
|
+
doc[slugField] = {
|
|
8674
|
+
_type: "slug",
|
|
8675
|
+
current: slug
|
|
8676
|
+
};
|
|
8677
|
+
}
|
|
8678
|
+
}
|
|
8679
|
+
let publish = ai && translatedOk, tx = client.transaction();
|
|
8680
|
+
publish ? (tx.createOrReplace({
|
|
8665
8681
|
...doc,
|
|
8666
|
-
_id:
|
|
8682
|
+
_id: targetId,
|
|
8667
8683
|
_type: type
|
|
8668
|
-
}),
|
|
8669
|
-
|
|
8670
|
-
|
|
8671
|
-
|
|
8672
|
-
|
|
8673
|
-
|
|
8674
|
-
|
|
8675
|
-
|
|
8676
|
-
|
|
8677
|
-
|
|
8678
|
-
|
|
8679
|
-
|
|
8684
|
+
}), t.id && tx.delete(`drafts.${t.id}`)) : tx.createOrReplace({
|
|
8685
|
+
...doc,
|
|
8686
|
+
_id: `drafts.${targetId}`,
|
|
8687
|
+
_type: type
|
|
8688
|
+
}), await tx.commit();
|
|
8689
|
+
let todoId = translationTodoId(targetId), existing = await client.fetch("*[_id == $todoId][0].paths", { todoId }) ?? [], done = new Set(t.result.toTranslate.filter((p) => !remaining.includes(p))), paths = [.../* @__PURE__ */ new Set([...existing.filter((p) => !done.has(p)), ...remaining])];
|
|
8690
|
+
(paths.length || existing.length) && await client.createOrReplace({
|
|
8691
|
+
_id: todoId,
|
|
8692
|
+
_type: TRANSLATION_TODO_TYPE,
|
|
8693
|
+
documentId: targetId,
|
|
8694
|
+
sourceId: id,
|
|
8695
|
+
sourceLanguage: source,
|
|
8696
|
+
paths
|
|
8697
|
+
}), t.id || created.push({
|
|
8698
|
+
language: t.language,
|
|
8699
|
+
id: targetId
|
|
8700
|
+
}), (publish ? published : drafted).push(t.language.toUpperCase());
|
|
8680
8701
|
}
|
|
8681
|
-
toast.push({
|
|
8702
|
+
await linkTranslations(client, id, source, type, created), toast.push({
|
|
8682
8703
|
status: aiError ? "warning" : "success",
|
|
8683
|
-
title: `
|
|
8684
|
-
description: aiError ? `AI translation failed (${aiError}):
|
|
8704
|
+
title: [published.length ? `Published: ${published.join(", ")}` : "", drafted.length ? `Drafts: ${drafted.join(", ")}` : ""].filter(Boolean).join(" · "),
|
|
8705
|
+
description: aiError ? `AI translation failed (${aiError}): saved as drafts, texts marked "To translate".` : drafted.length ? "Translate the fields marked \"To translate\", then publish each language." : "Translated with AI and published.",
|
|
8685
8706
|
duration: 8e3
|
|
8686
8707
|
}), onDone();
|
|
8687
8708
|
} catch (cause) {
|
|
8688
|
-
setError(`
|
|
8709
|
+
setError(`Failed. (${(cause instanceof Error ? cause.message : String(cause)).slice(0, 160)})`);
|
|
8689
8710
|
} finally {
|
|
8690
8711
|
setBusy(!1);
|
|
8691
8712
|
}
|
|
@@ -8697,14 +8718,12 @@ function PropagateDialog(props) {
|
|
|
8697
8718
|
/* @__PURE__ */ jsxs(Text, {
|
|
8698
8719
|
size: 1,
|
|
8699
8720
|
children: [
|
|
8700
|
-
"The
|
|
8701
|
-
|
|
8702
|
-
"
|
|
8703
|
-
ai ? "translated with AI" : "marked \"To translate\"",
|
|
8704
|
-
". Nothing is published."
|
|
8721
|
+
mode === "create" ? `The ${source.toUpperCase()} page is published. Create it in the other languages?` : `The ${source.toUpperCase()} version is published. Apply its changes to the other languages?`,
|
|
8722
|
+
" ",
|
|
8723
|
+
ai ? "Texts are translated with AI and each language is published." : "Each language is saved as a draft, texts marked \"To translate\"."
|
|
8705
8724
|
]
|
|
8706
8725
|
}),
|
|
8707
|
-
config.history &&
|
|
8726
|
+
config.history && hasTexts && /* @__PURE__ */ jsxs(Flex, {
|
|
8708
8727
|
as: "label",
|
|
8709
8728
|
align: "center",
|
|
8710
8729
|
gap: 2,
|
|
@@ -8713,7 +8732,7 @@ function PropagateDialog(props) {
|
|
|
8713
8732
|
onChange: () => setAi(!ai)
|
|
8714
8733
|
}), /* @__PURE__ */ jsx(Text, {
|
|
8715
8734
|
size: 1,
|
|
8716
|
-
children: "Translate
|
|
8735
|
+
children: "Translate with AI and publish"
|
|
8717
8736
|
})]
|
|
8718
8737
|
}),
|
|
8719
8738
|
/* @__PURE__ */ jsx(Stack, {
|
|
@@ -8727,7 +8746,7 @@ function PropagateDialog(props) {
|
|
|
8727
8746
|
align: "flex-start",
|
|
8728
8747
|
children: [/* @__PURE__ */ jsx(Checkbox, {
|
|
8729
8748
|
checked: t.selected,
|
|
8730
|
-
disabled: !hasChanges(t.result),
|
|
8749
|
+
disabled: mode === "update" && !hasChanges(t.result),
|
|
8731
8750
|
onChange: () => setTargets(targets.map((x, i) => i === index ? {
|
|
8732
8751
|
...x,
|
|
8733
8752
|
selected: !x.selected
|
|
@@ -8743,12 +8762,12 @@ function PropagateDialog(props) {
|
|
|
8743
8762
|
}), /* @__PURE__ */ jsx(Text, {
|
|
8744
8763
|
size: 1,
|
|
8745
8764
|
muted: !0,
|
|
8746
|
-
children: summary(t.result)
|
|
8765
|
+
children: mode === "create" ? `New version (${t.result.toTranslate.length} texts)` : summary(t.result)
|
|
8747
8766
|
})]
|
|
8748
8767
|
})
|
|
8749
8768
|
})]
|
|
8750
8769
|
})
|
|
8751
|
-
}, t.id))
|
|
8770
|
+
}, `${t.language}-${t.id ?? "new"}`))
|
|
8752
8771
|
}),
|
|
8753
8772
|
error && /* @__PURE__ */ jsx(Card, {
|
|
8754
8773
|
tone: "critical",
|
|
@@ -8768,7 +8787,7 @@ function PropagateDialog(props) {
|
|
|
8768
8787
|
onClick: onDone,
|
|
8769
8788
|
disabled: busy
|
|
8770
8789
|
}), /* @__PURE__ */ jsx(Button, {
|
|
8771
|
-
text: busy ? "
|
|
8790
|
+
text: busy ? "Working…" : mode === "create" ? "Create" : "Propagate",
|
|
8772
8791
|
tone: "primary",
|
|
8773
8792
|
onClick: () => void apply(),
|
|
8774
8793
|
disabled: busy || !targets.some((t) => t.selected)
|
|
@@ -9091,7 +9110,7 @@ const ncfKit = definePlugin((options) => {
|
|
|
9091
9110
|
},
|
|
9092
9111
|
document: {
|
|
9093
9112
|
newDocumentOptions: (prev) => prev.filter((option) => option.templateId !== BOARD_LAYOUT_TYPE),
|
|
9094
|
-
actions: (prev, context) => config.pageTypeNames.includes(context.schemaType) ? prev.map((action) => action.action === "unpublish" ? RemoveFromSiteAction : action.action === "publish" && config.i18n ? withPropagation(action, config) : action) : context.schemaType === config.componentPreview.defaultsType && config.i18n ? prev.map((action) => action.action === "publish" ? withPropagation(action, config, config.i18n?.defaultsSourceLocale) : action) : prev
|
|
9113
|
+
actions: (prev, context) => config.pageTypeNames.includes(context.schemaType) ? prev.map((action) => action.action === "unpublish" ? RemoveFromSiteAction : action.action === "publish" && config.i18n ? withPropagation(action, config, void 0, { allowCreate: !0 }) : action) : context.schemaType === config.componentPreview.defaultsType && config.i18n ? prev.map((action) => action.action === "publish" ? withPropagation(action, config, config.i18n?.defaultsSourceLocale) : action) : prev
|
|
9095
9114
|
},
|
|
9096
9115
|
studio: { components: { toolMenu: createPreviewLauncher(config, issues) } },
|
|
9097
9116
|
form: { components: { input: createKitInput(config) } }
|