@nocode-factory/sanity-kit 2.25.0 → 2.27.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.
Files changed (78) hide show
  1. package/dist/{componentDefaults-BY3hQ6aD.js → componentDefaults-2eWjLLBf.js} +6 -6
  2. package/dist/componentDefaults-2eWjLLBf.js.map +1 -0
  3. package/dist/index.d.ts +11 -3
  4. package/dist/index.js +605 -406
  5. package/dist/index.js.map +1 -1
  6. package/dist/schema.js +1 -1
  7. package/dist/web-server.js +2 -2
  8. package/dist/web-server.js.map +1 -1
  9. package/dist/web.js +9 -9
  10. package/dist/web.js.map +1 -1
  11. package/package.json +1 -1
  12. package/src/actions/PropagatePublish.tsx +52 -21
  13. package/src/actions/RemoveFromSite.tsx +9 -9
  14. package/src/config/defaults.ts +8 -8
  15. package/src/config/resolve.ts +4 -1
  16. package/src/config/types.ts +8 -0
  17. package/src/config/validate.ts +24 -24
  18. package/src/context/BoardLayoutContext.tsx +1 -1
  19. package/src/context/KitContext.tsx +1 -1
  20. package/src/context/PreviewTargetContext.tsx +1 -1
  21. package/src/form/OverrideInput.tsx +67 -6
  22. package/src/form/SlugUrlInput.tsx +2 -2
  23. package/src/form/TranslationTodoInput.tsx +38 -4
  24. package/src/hooks/useHistory.ts +5 -5
  25. package/src/hooks/useOccurrences.ts +1 -1
  26. package/src/hooks/useOpenOnline.ts +4 -4
  27. package/src/hooks/useTranslationTodo.ts +2 -1
  28. package/src/index.ts +9 -5
  29. package/src/lib/aiTexts.ts +72 -0
  30. package/src/lib/aiTranslate.ts +61 -0
  31. package/src/lib/grouping.ts +2 -2
  32. package/src/lib/overrides.ts +10 -10
  33. package/src/lib/pages.ts +3 -3
  34. package/src/lib/service.ts +5 -5
  35. package/src/lib/status.ts +3 -3
  36. package/src/lib/studioLinks.ts +6 -6
  37. package/src/schema/boardLayout.ts +32 -32
  38. package/src/schema/componentDefaults.ts +5 -5
  39. package/src/schema/translationTodo.ts +6 -6
  40. package/src/tools/components/BlockCard.tsx +3 -3
  41. package/src/tools/components/ComponentsTool.tsx +17 -17
  42. package/src/tools/components/map/SectionNode.tsx +1 -1
  43. package/src/tools/components/map/SectionsMap.tsx +10 -10
  44. package/src/tools/designSystem/DesignSystemTool.tsx +3 -3
  45. package/src/tools/history/DiffPanel.tsx +23 -23
  46. package/src/tools/history/HistoryTool.tsx +21 -23
  47. package/src/tools/more/MoreTool.tsx +1 -1
  48. package/src/tools/navbar/KitUpdate.tsx +8 -8
  49. package/src/tools/navbar/PreviewLauncher.tsx +6 -6
  50. package/src/tools/navbar/ToolButtons.tsx +2 -2
  51. package/src/tools/pages/ColumnHeader.tsx +18 -18
  52. package/src/tools/pages/ColumnVisibility.tsx +10 -10
  53. package/src/tools/pages/FieldValue.tsx +9 -9
  54. package/src/tools/pages/PagesTable.tsx +11 -11
  55. package/src/tools/pages/PagesTool.tsx +19 -19
  56. package/src/tools/pages/PagesToolbar.tsx +3 -3
  57. package/src/tools/pages/PathCell.tsx +1 -1
  58. package/src/tools/pages/PreviewTarget.tsx +10 -10
  59. package/src/tools/pages/SharePreview.tsx +19 -20
  60. package/src/tools/pages/TagCell.tsx +2 -2
  61. package/src/tools/pages/ViewTabs.tsx +4 -4
  62. package/src/tools/pages/board/BoardView.tsx +11 -11
  63. package/src/tools/pages/board/PageNode.tsx +5 -5
  64. package/src/tools/pages/board/PagePanel.tsx +10 -10
  65. package/src/tools/presentation/PreviewHeader.tsx +1 -1
  66. package/src/tools/shared/AnnotationNode.tsx +3 -3
  67. package/src/ui/ActorName.tsx +1 -1
  68. package/src/ui/ConfigIssues.tsx +3 -3
  69. package/src/ui/PreviewOriginsNotice.tsx +3 -3
  70. package/src/ui/ProjectStatusNotice.tsx +7 -7
  71. package/src/ui/QueryError.tsx +2 -2
  72. package/src/ui/ToolPlaceholder.tsx +2 -2
  73. package/src/ui/formatDate.ts +1 -1
  74. package/src/version.ts +1 -1
  75. package/src/web/PreviewBanner.tsx +9 -9
  76. package/src/web/draftModeToggle.ts +1 -1
  77. package/src/web/previewGrant.ts +5 -5
  78. package/dist/componentDefaults-BY3hQ6aD.js.map +0 -1
@@ -0,0 +1,61 @@
1
+ import {collectTexts, replaceTexts} from './aiTexts'
2
+
3
+ /** Service du kit (même clé de projet et même adresse que l'historique). */
4
+ export interface TranslateService {
5
+ endpoint: string
6
+ projectKey: string
7
+ }
8
+
9
+ const MAX_TEXTS = 250
10
+ const MAX_CHARS = 30_000
11
+
12
+ const MESSAGES: Record<string, string> = {
13
+ daily_limit: 'Daily AI translation limit reached for this project.',
14
+ project_inactive: 'This project is not active in the NCF kit.',
15
+ bad_key: 'This project is not registered in the NCF kit (npx ncf-kit setup).',
16
+ not_configured: 'AI translation is not configured on the NCF kit service.',
17
+ too_long: 'Text too long to translate at once.',
18
+ }
19
+
20
+ async function call(service: TranslateService, from: string, to: string, texts: string[]): Promise<string[]> {
21
+ const response = await fetch(`${service.endpoint}/translate`, {
22
+ method: 'POST',
23
+ headers: {'content-type': 'application/json'},
24
+ body: JSON.stringify({key: service.projectKey, from, to, texts}),
25
+ })
26
+ const body = (await response.json().catch(() => ({}))) as {texts?: string[]; error?: string}
27
+ if (!response.ok || !Array.isArray(body.texts) || body.texts.length !== texts.length)
28
+ throw new Error(MESSAGES[body.error ?? ''] ?? `AI translation failed (${body.error ?? response.status}).`)
29
+ return body.texts
30
+ }
31
+
32
+ /**
33
+ * Traduit des valeurs de champs (chaînes ou textes riches) de `from` vers `to` :
34
+ * mêmes valeurs, textes traduits. Découpe en lots si besoin.
35
+ */
36
+ export async function translateValues(service: TranslateService, from: string, to: string, values: readonly unknown[]): Promise<unknown[]> {
37
+ const perValue = values.map((v) => collectTexts(v))
38
+ const all = perValue.flat()
39
+ const translated: string[] = []
40
+ let batch: string[] = []
41
+ let size = 0
42
+ const flush = async () => {
43
+ if (!batch.length) return
44
+ translated.push(...(await call(service, from, to, batch)))
45
+ batch = []
46
+ size = 0
47
+ }
48
+ for (const text of all) {
49
+ if (batch.length >= MAX_TEXTS || size + text.length > MAX_CHARS) await flush()
50
+ batch.push(text)
51
+ size += text.length
52
+ }
53
+ await flush()
54
+ let offset = 0
55
+ return values.map((value, n) => {
56
+ const count = perValue[n]!.length
57
+ const slice = translated.slice(offset, offset + count)
58
+ offset += count
59
+ return count ? replaceTexts(value, slice) : value
60
+ })
61
+ }
@@ -15,7 +15,7 @@ export interface RowGroup {
15
15
  rows: PageRow[]
16
16
  }
17
17
 
18
- export const UNSET_LABEL = 'Non renseigné'
18
+ export const UNSET_LABEL = 'Not set'
19
19
 
20
20
  export interface GroupOptions {
21
21
  /** Disposition enregistrée, qui porte étiquettes et champs internes. */
@@ -47,7 +47,7 @@ function describe(
47
47
  if (!value) return {label: UNSET_LABEL}
48
48
  if (groupBy === 'status') return {label: STATUS_LABELS[row_status(value)].label}
49
49
  if (groupBy === 'indexation') {
50
- return value === 'noindex' ? {label: 'Non indexable'} : {label: 'Indexable'}
50
+ return value === 'noindex' ? {label: 'Not indexable'} : {label: 'Indexable'}
51
51
  }
52
52
  if (groupBy === 'tag') {
53
53
  const tag = options.tags.find((t) => t.id === value)
@@ -129,20 +129,20 @@ export function sameValue(a: unknown, b: unknown): boolean {
129
129
 
130
130
  /** Valeur par défaut lisible, pour la bulle de la pastille. */
131
131
  export function describeValue(value: unknown): string {
132
- if (isEmptyValue(value)) return 'vide (valeur du design system)'
133
- if (typeof value === 'string') return value.length > 60 ? `« ${value.slice(0, 57)}… »` : `« ${value} »`
134
- if (typeof value === 'boolean') return value ? 'Oui' : 'Non'
132
+ if (isEmptyValue(value)) return 'empty (design system value)'
133
+ if (typeof value === 'string') return value.length > 60 ? `"${value.slice(0, 57)}…"` : `"${value}"`
134
+ if (typeof value === 'boolean') return value ? 'Yes' : 'No'
135
135
  if (typeof value === 'number') return String(value)
136
- if (Array.isArray(value)) return `${value.length} élément${value.length > 1 ? 's' : ''}`
136
+ if (Array.isArray(value)) return `${value.length} item${value.length > 1 ? 's' : ''}`
137
137
  if (value && typeof value === 'object') {
138
138
  const v = value as Record<string, unknown>
139
- if (typeof v.token === 'string') return `couleur ${v.token}`
140
- if (typeof v.customHex === 'string') return `couleur ${v.customHex}`
141
- if (typeof v.label === 'string') return `« ${v.label} »`
142
- if (v.asset) return 'une image'
143
- if (typeof v._ref === 'string') return 'un document'
139
+ if (typeof v.token === 'string') return `color ${v.token}`
140
+ if (typeof v.customHex === 'string') return `color ${v.customHex}`
141
+ if (typeof v.label === 'string') return `"${v.label}"`
142
+ if (v.asset) return 'an image'
143
+ if (typeof v._ref === 'string') return 'a document'
144
144
  }
145
- return 'une valeur'
145
+ return 'a value'
146
146
  }
147
147
 
148
148
  /**
package/src/lib/pages.ts CHANGED
@@ -44,8 +44,8 @@ export function formatDocumentValue(
44
44
  type: 'text' | 'boolean' | 'number',
45
45
  invert = false,
46
46
  ): string {
47
- if (value === null || value === undefined) return type === 'boolean' && invert ? 'Oui' : ''
48
- if (type === 'boolean') return (invert ? !value : Boolean(value)) ? 'Oui' : 'Non'
47
+ if (value === null || value === undefined) return type === 'boolean' && invert ? 'Yes' : ''
48
+ if (type === 'boolean') return (invert ? !value : Boolean(value)) ? 'Yes' : 'No'
49
49
  if (type === 'number') return typeof value === 'number' ? String(value) : ''
50
50
  if (typeof value === 'string') return value.trim()
51
51
  if (typeof value === 'number' || typeof value === 'boolean') return String(value)
@@ -73,7 +73,7 @@ export function buildPageRows(
73
73
  return {
74
74
  id: merged.id,
75
75
  type: doc._type,
76
- title: doc.ncfTitle?.trim() || 'Sans titre',
76
+ title: doc.ncfTitle?.trim() || 'Untitled',
77
77
  path,
78
78
  url: toUrl(config.previewUrl, path),
79
79
  locale: doc.ncfLocale ?? null,
@@ -115,10 +115,10 @@ export async function requestPreviewGrant(
115
115
  export function explainGrantError(error: unknown): string {
116
116
  const code = error instanceof Error ? error.message : String(error)
117
117
  if (code === 'missing_sanity_token') {
118
- return "Votre session Sanity n'expose pas de jeton : impossible de prouver votre accès au projet."
118
+ return "Your Sanity session exposes no token: unable to prove your access to the project."
119
119
  }
120
- if (code === 'no_project_access') return "Votre compte n'a pas accès à ce projet Sanity."
121
- if (code === 'project_inactive') return "Ce projet n'est pas actif chez NoCode Factory."
122
- if (code === 'unknown_project') return "Ce projet n'est pas enregistré chez NoCode Factory."
123
- return "Le lien n'a pas pu être créé."
120
+ if (code === 'no_project_access') return "Your account has no access to this Sanity project."
121
+ if (code === 'project_inactive') return "This project is not active at NoCode Factory."
122
+ if (code === 'unknown_project') return "This project is not registered at NoCode Factory."
123
+ return "The link could not be created."
124
124
  }
package/src/lib/status.ts CHANGED
@@ -116,7 +116,7 @@ export function mergeVersions<T extends VersionedDoc>(docs: readonly T[]): Merge
116
116
  }
117
117
 
118
118
  export const STATUS_LABELS: Record<PageStatus, {label: string; tone: 'positive' | 'caution' | 'default'; help: string}> = {
119
- published: {label: 'Publiée', tone: 'positive', help: 'En ligne, à jour'},
120
- modified: {label: 'Modifiée', tone: 'caution', help: 'En ligne, avec des modifications non publiées'},
121
- draft: {label: 'Non publiée', tone: 'default', help: 'Absente du site : jamais publiée, ou retirée du site (contenu conservé en brouillon)'},
119
+ published: {label: 'Published', tone: 'positive', help: 'Live, up to date'},
120
+ modified: {label: 'Modified', tone: 'caution', help: 'Live, with unpublished changes'},
121
+ draft: {label: 'Not published', tone: 'default', help: 'Not on the site: never published, or removed from the site (content kept in the draft)'},
122
122
  }
@@ -10,8 +10,8 @@ import type {NcfEnvironment} from '../config/types'
10
10
  export type PreviewPerspective = 'drafts' | 'published'
11
11
 
12
12
  export const PERSPECTIVES: {id: PreviewPerspective; label: string; hint: string}[] = [
13
- {id: 'drafts', label: 'Brouillons', hint: 'Ce qui sortira après publication'},
14
- {id: 'published', label: 'En ligne', hint: 'Ce que voit le public aujourd\'hui'},
13
+ {id: 'drafts', label: 'Drafts', hint: 'What will go live after publishing'},
14
+ {id: 'published', label: 'Published', hint: 'What the public sees today'},
15
15
  ]
16
16
 
17
17
  /** Retire le slash final, pour ne pas produire d'URL à double slash. */
@@ -67,13 +67,13 @@ export interface PreviewTargetEntry {
67
67
  export function previewTargets(environments: readonly NcfEnvironment[], previewUrl: string | null | undefined): PreviewTargetEntry[] {
68
68
  const previews = environments.filter((e) => !isPublicEnvironment(e, previewUrl))
69
69
  const publics = environments.filter((e) => isPublicEnvironment(e, previewUrl))
70
- const name = (e: NcfEnvironment) => (e.id === 'preprod' ? 'Préprod' : e.label)
70
+ const name = (e: NcfEnvironment) => (e.id === 'preprod' ? 'Staging' : e.label)
71
71
  return [
72
72
  ...previews.flatMap((environment): PreviewTargetEntry[] => [
73
- {environment, perspective: 'drafts', label: `${name(environment)} · Brouillons`, hint: 'Ce qui sortira après publication', tone: 'draft'},
74
- {environment, perspective: 'published', label: `${name(environment)} · En ligne`, hint: "Le contenu publié, sur la version de test du site", tone: 'live'},
73
+ {environment, perspective: 'drafts', label: `${name(environment)} · Drafts`, hint: 'What will go live after publishing', tone: 'draft'},
74
+ {environment, perspective: 'published', label: `${name(environment)} · Published`, hint: 'The published content, on the test version of the site', tone: 'live'},
75
75
  ]),
76
- ...publics.map((environment): PreviewTargetEntry => ({environment, perspective: 'published', label: 'Prod · En ligne', hint: 'Le site public, tel que le voient les visiteurs', tone: 'prod'})),
76
+ ...publics.map((environment): PreviewTargetEntry => ({environment, perspective: 'published', label: 'Prod · Published', hint: 'The public site, as visitors see it', tone: 'prod'})),
77
77
  ]
78
78
  }
79
79
 
@@ -16,26 +16,26 @@ export const NCF_HIDDEN_TYPES = [BOARD_LAYOUT_TYPE, TRANSLATION_TODO_TYPE] as co
16
16
 
17
17
  const boardNodeType = defineType({
18
18
  name: BOARD_NODE_TYPE,
19
- title: 'Position d\'une page',
19
+ title: 'Page position',
20
20
  type: 'object',
21
21
  fields: [
22
22
  defineField({name: 'documentId', title: 'Document', type: 'string'}),
23
23
  defineField({name: 'x', title: 'X', type: 'number'}),
24
24
  defineField({name: 'y', title: 'Y', type: 'number'}),
25
25
  // Taille choisie à la main ; absente tant que le nœud garde sa taille.
26
- defineField({name: 'width', title: 'Largeur', type: 'number'}),
27
- defineField({name: 'height', title: 'Hauteur', type: 'number'}),
28
- defineField({name: 'tag', title: 'Étiquette de suivi', type: 'string'}),
26
+ defineField({name: 'width', title: 'Width', type: 'number'}),
27
+ defineField({name: 'height', title: 'Height', type: 'number'}),
28
+ defineField({name: 'tag', title: 'Tracking tag', type: 'string'}),
29
29
  defineField({
30
30
  name: 'fields',
31
- title: 'Gestion interne',
31
+ title: 'Internal management',
32
32
  type: 'array',
33
33
  of: [{type: NODE_FIELD_TYPE}],
34
34
  }),
35
35
  ],
36
36
  preview: {
37
37
  select: {title: 'documentId', x: 'x', y: 'y'},
38
- prepare: ({title, x, y}) => ({title: title ?? 'Sans document', subtitle: `${x ?? 0} × ${y ?? 0}`}),
38
+ prepare: ({title, x, y}) => ({title: title ?? 'No document', subtitle: `${x ?? 0} × ${y ?? 0}`}),
39
39
  },
40
40
  })
41
41
 
@@ -45,7 +45,7 @@ const annotationType = defineType({
45
45
  title: 'Annotation',
46
46
  type: 'object',
47
47
  fields: [
48
- defineField({name: 'id', title: 'Identifiant', type: 'string'}),
48
+ defineField({name: 'id', title: 'ID', type: 'string'}),
49
49
  defineField({
50
50
  name: 'scope',
51
51
  title: 'Canvas',
@@ -54,28 +54,28 @@ const annotationType = defineType({
54
54
  }),
55
55
  defineField({
56
56
  name: 'kind',
57
- title: 'Nature',
57
+ title: 'Kind',
58
58
  type: 'string',
59
- options: {list: [{title: 'Texte', value: 'text'}, {title: 'Forme', value: 'rect'}]},
59
+ options: {list: [{title: 'Text', value: 'text'}, {title: 'Shape', value: 'rect'}]},
60
60
  }),
61
61
  defineField({name: 'x', type: 'number'}),
62
62
  defineField({name: 'y', type: 'number'}),
63
63
  defineField({name: 'width', type: 'number'}),
64
64
  defineField({name: 'height', type: 'number'}),
65
- defineField({name: 'text', title: 'Texte', type: 'string'}),
66
- defineField({name: 'color', title: 'Couleur', type: 'string'}),
65
+ defineField({name: 'text', title: 'Text', type: 'string'}),
66
+ defineField({name: 'color', title: 'Color', type: 'string'}),
67
67
  ],
68
68
  preview: {select: {title: 'text', subtitle: 'scope'}},
69
69
  })
70
70
 
71
71
  const columnOptionType = defineType({
72
72
  name: COLUMN_OPTION_TYPE,
73
- title: 'Choix',
73
+ title: 'Choice',
74
74
  type: 'object',
75
75
  fields: [
76
- defineField({name: 'id', title: 'Identifiant', type: 'string'}),
77
- defineField({name: 'label', title: 'Libellé', type: 'string'}),
78
- defineField({name: 'color', title: 'Couleur', type: 'string'}),
76
+ defineField({name: 'id', title: 'ID', type: 'string'}),
77
+ defineField({name: 'label', title: 'Label', type: 'string'}),
78
+ defineField({name: 'color', title: 'Color', type: 'string'}),
79
79
  ],
80
80
  preview: {select: {title: 'label', subtitle: 'id'}},
81
81
  })
@@ -87,29 +87,29 @@ const columnOptionType = defineType({
87
87
  */
88
88
  const columnType = defineType({
89
89
  name: COLUMN_TYPE,
90
- title: 'Colonne de gestion interne',
90
+ title: 'Internal management column',
91
91
  type: 'object',
92
92
  fields: [
93
- defineField({name: 'id', title: 'Identifiant', type: 'string'}),
94
- defineField({name: 'label', title: 'Nom', type: 'string'}),
93
+ defineField({name: 'id', title: 'ID', type: 'string'}),
94
+ defineField({name: 'label', title: 'Name', type: 'string'}),
95
95
  defineField({
96
96
  name: 'type',
97
97
  title: 'Type',
98
98
  type: 'string',
99
- options: {list: [{title: 'Texte', value: 'text'}, {title: 'Liste', value: 'select'}]},
99
+ options: {list: [{title: 'Text', value: 'text'}, {title: 'List', value: 'select'}]},
100
100
  }),
101
- defineField({name: 'options', title: 'Choix', type: 'array', of: [{type: COLUMN_OPTION_TYPE}]}),
101
+ defineField({name: 'options', title: 'Choices', type: 'array', of: [{type: COLUMN_OPTION_TYPE}]}),
102
102
  ],
103
103
  preview: {select: {title: 'label', subtitle: 'type'}},
104
104
  })
105
105
 
106
106
  const nodeFieldType = defineType({
107
107
  name: NODE_FIELD_TYPE,
108
- title: 'Champ de gestion interne',
108
+ title: 'Internal management field',
109
109
  type: 'object',
110
110
  fields: [
111
- defineField({name: 'fieldId', title: 'Champ', type: 'string'}),
112
- defineField({name: 'value', title: 'Valeur', type: 'string'}),
111
+ defineField({name: 'fieldId', title: 'Field', type: 'string'}),
112
+ defineField({name: 'value', title: 'Value', type: 'string'}),
113
113
  ],
114
114
  preview: {
115
115
  select: {title: 'fieldId', subtitle: 'value'},
@@ -118,16 +118,16 @@ const nodeFieldType = defineType({
118
118
 
119
119
  const sectionNodeType = defineType({
120
120
  name: SECTION_NODE_TYPE,
121
- title: 'Position d\'une section',
121
+ title: 'Section position',
122
122
  type: 'object',
123
123
  fields: [
124
- defineField({name: 'blockName', title: 'Type de bloc', type: 'string'}),
124
+ defineField({name: 'blockName', title: 'Block type', type: 'string'}),
125
125
  defineField({name: 'x', title: 'X', type: 'number'}),
126
126
  defineField({name: 'y', title: 'Y', type: 'number'}),
127
127
  ],
128
128
  preview: {
129
129
  select: {title: 'blockName', x: 'x', y: 'y'},
130
- prepare: ({title, x, y}) => ({title: title ?? 'Sans bloc', subtitle: `${x ?? 0} × ${y ?? 0}`}),
130
+ prepare: ({title, x, y}) => ({title: title ?? 'No block', subtitle: `${x ?? 0} × ${y ?? 0}`}),
131
131
  },
132
132
  })
133
133
 
@@ -137,7 +137,7 @@ const sectionNodeType = defineType({
137
137
  */
138
138
  const boardLayoutType = defineType({
139
139
  name: BOARD_LAYOUT_TYPE,
140
- title: 'Disposition du board (NCF)',
140
+ title: 'Board layout (NCF)',
141
141
  type: 'document',
142
142
  fields: [
143
143
  defineField({
@@ -154,26 +154,26 @@ const boardLayoutType = defineType({
154
154
  }),
155
155
  defineField({
156
156
  name: 'columns',
157
- title: 'Colonnes de gestion interne',
157
+ title: 'Internal management columns',
158
158
  type: 'array',
159
159
  of: [{type: COLUMN_TYPE}],
160
160
  }),
161
161
  // Distingue « jamais réglé » de « volontairement vidé ».
162
- defineField({name: 'columnsSet', title: 'Colonnes réglées', type: 'boolean'}),
162
+ defineField({name: 'columnsSet', title: 'Columns set', type: 'boolean'}),
163
163
  defineField({
164
164
  name: 'sections',
165
- title: 'Positions des sections',
165
+ title: 'Section positions',
166
166
  type: 'array',
167
167
  of: [{type: SECTION_NODE_TYPE}],
168
168
  }),
169
169
  defineField({
170
170
  name: 'updatedBy',
171
- title: 'Modifié par',
171
+ title: 'Modified by',
172
172
  type: 'string',
173
173
  readOnly: true,
174
174
  }),
175
175
  ],
176
- preview: {prepare: () => ({title: 'Disposition du board (NCF)'})},
176
+ preview: {prepare: () => ({title: 'Board layout (NCF)'})},
177
177
  })
178
178
 
179
179
  export const kitSchemaTypes = [
@@ -38,19 +38,19 @@ const relax = (f: FieldDef): FieldDef => {
38
38
 
39
39
  /** Document « Composants : valeurs par défaut », généré depuis les sections. */
40
40
  export function defineComponentDefaults(options: {sections: readonly unknown[]; name?: string; title?: string; namespace?: string}) {
41
- const {name = DEFAULT_COMPONENT_DEFAULTS_TYPE, title = '🧩 Composants : valeurs par défaut', namespace = 'section.'} = options
41
+ const {name = DEFAULT_COMPONENT_DEFAULTS_TYPE, title = '🧩 Components: default values', namespace = 'section.'} = options
42
42
  return defineType({
43
43
  name,
44
44
  title,
45
45
  type: 'document',
46
46
  description:
47
- 'Valeurs appliquées à chaque instance d\'un composant dont le champ est vide. Un champ rempli dans une instance reste prioritaire (override).',
47
+ 'Values applied to every instance of a component whose field is empty. A field filled in an instance takes precedence (override).',
48
48
  fields: (options.sections as SectionDef[]).map((t) =>
49
49
  defineField({
50
50
  name: defaultsFieldName(t.name, namespace),
51
51
  title: t.title || t.name,
52
52
  type: 'object',
53
- description: 'Valeurs par défaut de ce composant. Vide = valeur du design system.',
53
+ description: 'Default values of this component. Empty = design system value.',
54
54
  options: {collapsible: true, collapsed: true},
55
55
  fields: t.fields.map(relax) as never,
56
56
  }),
@@ -74,7 +74,7 @@ export function requiredUnlessDefaultFor(options: {type?: string; namespace?: st
74
74
  const type = (context.parent as {_type?: string} | undefined)?._type
75
75
  const field = context.path?.[context.path.length - 1]
76
76
  const name = type ? defaultsFieldName(type, namespace) : ''
77
- if (!type?.startsWith(namespace) || typeof field !== 'string' || !/^\w+$/.test(name) || !/^\w+$/.test(field)) return 'Obligatoire.'
77
+ if (!type?.startsWith(namespace) || typeof field !== 'string' || !/^\w+$/.test(name) || !/^\w+$/.test(field)) return 'Required.'
78
78
  const language = (context.document as {language?: string} | undefined)?.language ?? null
79
79
  const inherited = await context
80
80
  .getClient({apiVersion: '2024-10-01'})
@@ -82,7 +82,7 @@ export function requiredUnlessDefaultFor(options: {type?: string; namespace?: st
82
82
  `*[_type == $defaultsType && !(_id in path("drafts.**")) && ($language == null || language == $language)][0].${name}.${field}`,
83
83
  {defaultsType, language},
84
84
  )
85
- return isEmpty(inherited) ? 'Obligatoire (ou à définir dans Composants > valeurs par défaut).' : true
85
+ return isEmpty(inherited) ? 'Required (or set it in Components > default values).' : true
86
86
  }) as unknown as R
87
87
  }
88
88
 
@@ -11,13 +11,13 @@ export const translationTodoId = (documentId: string) => `ncfTodo.${documentId.r
11
11
 
12
12
  export const translationTodoType = defineType({
13
13
  name: TRANSLATION_TODO_TYPE,
14
- title: 'À traduire (NCF)',
14
+ title: 'To translate (NCF)',
15
15
  type: 'document',
16
16
  fields: [
17
- defineField({name: 'documentId', title: 'Traduction', type: 'string', readOnly: true}),
18
- defineField({name: 'sourceId', title: 'Version principale', type: 'string', readOnly: true}),
19
- defineField({name: 'sourceLanguage', title: 'Langue principale', type: 'string', readOnly: true}),
20
- defineField({name: 'paths', title: 'Champs à traduire', type: 'array', of: [{type: 'string'}], readOnly: true}),
17
+ defineField({name: 'documentId', title: 'Translation', type: 'string', readOnly: true}),
18
+ defineField({name: 'sourceId', title: 'Main version', type: 'string', readOnly: true}),
19
+ defineField({name: 'sourceLanguage', title: 'Main language', type: 'string', readOnly: true}),
20
+ defineField({name: 'paths', title: 'Fields to translate', type: 'array', of: [{type: 'string'}], readOnly: true}),
21
21
  ],
22
- preview: {select: {title: 'documentId'}, prepare: ({title}) => ({title: `À traduire : ${title}`})},
22
+ preview: {select: {title: 'documentId'}, prepare: ({title}) => ({title: `To translate: ${title}`})},
23
23
  })
@@ -34,7 +34,7 @@ export function BlockCard(props: BlockCardProps) {
34
34
  padding={0}
35
35
  as={onOpen ? 'button' : undefined}
36
36
  onClick={onOpen}
37
- title={onOpen ? 'Voir le composant en vrai et régler ses valeurs par défaut' : undefined}
37
+ title={onOpen ? 'See the real component and set its default values' : undefined}
38
38
  style={{height: '100%', overflow: 'hidden', width: '100%', textAlign: 'left', cursor: onOpen ? 'pointer' : undefined}}
39
39
  >
40
40
  <Stack gap={0} style={{height: '100%'}}>
@@ -56,7 +56,7 @@ export function BlockCard(props: BlockCardProps) {
56
56
  ) : (
57
57
  <Flex align="center" justify="center" style={{height: '100%'}} padding={3}>
58
58
  <Text size={0} muted align="center">
59
- {failed ? 'Capture introuvable' : 'Pas de capture'}
59
+ {failed ? 'Screenshot not found' : 'No screenshot'}
60
60
  </Text>
61
61
  </Flex>
62
62
  )}
@@ -77,7 +77,7 @@ export function BlockCard(props: BlockCardProps) {
77
77
  weight="medium"
78
78
  muted={unused}
79
79
  style={{...TABULAR, flex: 'none'}}
80
- title={unused ? 'Jamais utilisé' : `${occurrence.count} occurrences`}
80
+ title={unused ? 'Never used' : `${occurrence.count} occurrences`}
81
81
  >
82
82
  {occurrence.count}
83
83
  </Text>
@@ -13,10 +13,10 @@ type View = 'grid' | 'map'
13
13
  type Order = 'type' | 'schema' | 'usage' | 'unused'
14
14
 
15
15
  const ORDERS: {value: Order; label: string}[] = [
16
- {value: 'type', label: 'Par type'},
17
- {value: 'usage', label: 'Les plus utilisés'},
18
- {value: 'unused', label: 'Les inutilisés d’abord'},
19
- {value: 'schema', label: 'Ordre du schéma'},
16
+ {value: 'type', label: 'By type'},
17
+ {value: 'usage', label: 'Most used'},
18
+ {value: 'unused', label: 'Unused first'},
19
+ {value: 'schema', label: 'Schema order'},
20
20
  ]
21
21
 
22
22
  export function ComponentsTool() {
@@ -57,7 +57,7 @@ export function ComponentsTool() {
57
57
  <Flex align="center" justify="center" padding={5} gap={3}>
58
58
  <Spinner muted />
59
59
  <Text size={1} muted>
60
- Analyse du page builder…
60
+ Analyzing the page builder…
61
61
  </Text>
62
62
  </Flex>
63
63
  )
@@ -67,11 +67,11 @@ export function ComponentsTool() {
67
67
  return (
68
68
  <Card padding={4} radius={3} shadow={1} tone="caution">
69
69
  <Stack gap={3}>
70
- <Text weight="semibold">Aucun bloc trouvé.</Text>
70
+ <Text weight="semibold">No blocks found.</Text>
71
71
  <Text size={1}>
72
- Le champ « {config.pageBuilderField} » n’existe sur aucun des types{' '}
73
- {config.pageTypeNames.join(', ')}, ou il n’est pas un tableau. Vérifie
74
- `pageBuilderField` dans l’appel à ncfKit().
72
+ The field "{config.pageBuilderField}" does not exist on any of the types{' '}
73
+ {config.pageTypeNames.join(', ')}, or it is not an array. Check
74
+ `pageBuilderField` in the ncfKit() call.
75
75
  </Text>
76
76
  </Stack>
77
77
  </Card>
@@ -82,7 +82,7 @@ export function ComponentsTool() {
82
82
  <Stack gap={4}>
83
83
  <Flex gap={2}>
84
84
  <Button
85
- text="Grille"
85
+ text="Grid"
86
86
  mode={view === 'grid' ? 'default' : 'ghost'}
87
87
  fontSize={1}
88
88
  padding={2}
@@ -99,8 +99,8 @@ export function ComponentsTool() {
99
99
 
100
100
  <Flex align="center" justify="space-between" gap={3} wrap="wrap">
101
101
  <Text size={1} muted>
102
- {blockTypes.length} blocs · {scanned} pages analysées
103
- {unusedCount > 0 ? ` · ${unusedCount} jamais utilisé${unusedCount > 1 ? 's' : ''}` : ''}
102
+ {blockTypes.length} blocks · {scanned} pages analyzed
103
+ {unusedCount > 0 ? ` · ${unusedCount} never used` : ''}
104
104
  </Text>
105
105
 
106
106
  <Flex gap={2} wrap="wrap">
@@ -115,7 +115,7 @@ export function ComponentsTool() {
115
115
  />
116
116
  ))}
117
117
  <Button
118
- text="Rafraîchir"
118
+ text="Refresh"
119
119
  mode="ghost"
120
120
  fontSize={1}
121
121
  padding={2}
@@ -129,8 +129,8 @@ export function ComponentsTool() {
129
129
  {truncated && (
130
130
  <Card padding={3} radius={2} tone="caution">
131
131
  <Text size={1}>
132
- Analyse limitée aux {OCCURRENCE_SCAN_LIMIT} premières pages : les chiffres
133
- ci-dessous sont un minimum, pas un total.
132
+ Analysis limited to the first {OCCURRENCE_SCAN_LIMIT} pages: the numbers
133
+ below are a minimum, not a total.
134
134
  </Text>
135
135
  </Card>
136
136
  )}
@@ -138,8 +138,8 @@ export function ComponentsTool() {
138
138
  {!canPreview && (
139
139
  <Card padding={3} radius={2} tone="transparent" border>
140
140
  <Text size={1} muted>
141
- Vignettes désactivées : renseigne `previewUrl` dans ncfKit() pour afficher les
142
- captures du design system.
141
+ Thumbnails disabled: set `previewUrl` in ncfKit() to show the design system
142
+ screenshots.
143
143
  </Text>
144
144
  </Card>
145
145
  )}
@@ -66,7 +66,7 @@ function SectionNodeComponent(props: NodeProps<SectionFlowNode>) {
66
66
  ) : (
67
67
  <Flex align="center" justify="center" style={{height: '100%'}} padding={2}>
68
68
  <Text size={0} muted align="center">
69
- {failed ? 'Capture introuvable' : 'Pas de capture'}
69
+ {failed ? 'Screenshot not found' : 'No screenshot'}
70
70
  </Text>
71
71
  </Flex>
72
72
  )}