@nocode-factory/sanity-kit 2.25.0 → 2.26.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 (74) 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 +2 -2
  4. package/dist/index.js +366 -366
  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 +14 -14
  13. package/src/actions/RemoveFromSite.tsx +9 -9
  14. package/src/config/defaults.ts +7 -7
  15. package/src/config/resolve.ts +1 -1
  16. package/src/config/validate.ts +24 -24
  17. package/src/context/BoardLayoutContext.tsx +1 -1
  18. package/src/context/KitContext.tsx +1 -1
  19. package/src/context/PreviewTargetContext.tsx +1 -1
  20. package/src/form/OverrideInput.tsx +5 -5
  21. package/src/form/SlugUrlInput.tsx +2 -2
  22. package/src/form/TranslationTodoInput.tsx +2 -2
  23. package/src/hooks/useHistory.ts +5 -5
  24. package/src/hooks/useOccurrences.ts +1 -1
  25. package/src/hooks/useOpenOnline.ts +4 -4
  26. package/src/index.ts +4 -4
  27. package/src/lib/grouping.ts +2 -2
  28. package/src/lib/overrides.ts +10 -10
  29. package/src/lib/pages.ts +3 -3
  30. package/src/lib/service.ts +5 -5
  31. package/src/lib/status.ts +3 -3
  32. package/src/lib/studioLinks.ts +6 -6
  33. package/src/schema/boardLayout.ts +32 -32
  34. package/src/schema/componentDefaults.ts +5 -5
  35. package/src/schema/translationTodo.ts +6 -6
  36. package/src/tools/components/BlockCard.tsx +3 -3
  37. package/src/tools/components/ComponentsTool.tsx +17 -17
  38. package/src/tools/components/map/SectionNode.tsx +1 -1
  39. package/src/tools/components/map/SectionsMap.tsx +10 -10
  40. package/src/tools/designSystem/DesignSystemTool.tsx +3 -3
  41. package/src/tools/history/DiffPanel.tsx +23 -23
  42. package/src/tools/history/HistoryTool.tsx +21 -23
  43. package/src/tools/more/MoreTool.tsx +1 -1
  44. package/src/tools/navbar/KitUpdate.tsx +8 -8
  45. package/src/tools/navbar/PreviewLauncher.tsx +6 -6
  46. package/src/tools/navbar/ToolButtons.tsx +2 -2
  47. package/src/tools/pages/ColumnHeader.tsx +18 -18
  48. package/src/tools/pages/ColumnVisibility.tsx +10 -10
  49. package/src/tools/pages/FieldValue.tsx +9 -9
  50. package/src/tools/pages/PagesTable.tsx +11 -11
  51. package/src/tools/pages/PagesTool.tsx +19 -19
  52. package/src/tools/pages/PagesToolbar.tsx +3 -3
  53. package/src/tools/pages/PathCell.tsx +1 -1
  54. package/src/tools/pages/PreviewTarget.tsx +10 -10
  55. package/src/tools/pages/SharePreview.tsx +19 -20
  56. package/src/tools/pages/TagCell.tsx +2 -2
  57. package/src/tools/pages/ViewTabs.tsx +4 -4
  58. package/src/tools/pages/board/BoardView.tsx +11 -11
  59. package/src/tools/pages/board/PageNode.tsx +5 -5
  60. package/src/tools/pages/board/PagePanel.tsx +10 -10
  61. package/src/tools/presentation/PreviewHeader.tsx +1 -1
  62. package/src/tools/shared/AnnotationNode.tsx +3 -3
  63. package/src/ui/ActorName.tsx +1 -1
  64. package/src/ui/ConfigIssues.tsx +3 -3
  65. package/src/ui/PreviewOriginsNotice.tsx +3 -3
  66. package/src/ui/ProjectStatusNotice.tsx +7 -7
  67. package/src/ui/QueryError.tsx +2 -2
  68. package/src/ui/ToolPlaceholder.tsx +2 -2
  69. package/src/ui/formatDate.ts +1 -1
  70. package/src/version.ts +1 -1
  71. package/src/web/PreviewBanner.tsx +9 -9
  72. package/src/web/draftModeToggle.ts +1 -1
  73. package/src/web/previewGrant.ts +5 -5
  74. package/dist/componentDefaults-BY3hQ6aD.js.map +0 -1
@@ -30,7 +30,7 @@ export function TagCell(props: TagCellProps) {
30
30
  gap={2}
31
31
  onClick={toggle}
32
32
  style={{...CELL, cursor: 'pointer'}}
33
- title="Changer l’étiquette"
33
+ title="Change tag"
34
34
  >
35
35
  {current ? (
36
36
  <>
@@ -58,7 +58,7 @@ export function TagCell(props: TagCellProps) {
58
58
  {({close}) => (
59
59
  <Stack gap={0}>
60
60
  <TagOption
61
- label="Sans étiquette"
61
+ label="No tag"
62
62
  selected={!current}
63
63
  onClick={() => {
64
64
  onChange(null)
@@ -6,9 +6,9 @@ import {CircleIcon} from '@sanity/icons/Circle'
6
6
  export type PagesView = 'list' | 'tree' | 'brain'
7
7
 
8
8
  const TABS: {value: PagesView; label: string; icon: typeof DocumentsIcon}[] = [
9
- {value: 'list', label: 'Liste', icon: DocumentsIcon},
10
- {value: 'tree', label: 'Arbo', icon: ProjectsIcon},
11
- {value: 'brain', label: 'Cerveau', icon: CircleIcon},
9
+ {value: 'list', label: 'List', icon: DocumentsIcon},
10
+ {value: 'tree', label: 'Tree', icon: ProjectsIcon},
11
+ {value: 'brain', label: 'Graph', icon: CircleIcon},
12
12
  ]
13
13
 
14
14
  export interface ViewTabsProps {
@@ -23,7 +23,7 @@ export interface ViewTabsProps {
23
23
  */
24
24
  export function ViewTabs(props: ViewTabsProps) {
25
25
  return (
26
- <Flex gap={1} role="tablist" aria-label="Vue des pages">
26
+ <Flex gap={1} role="tablist" aria-label="Pages view">
27
27
  {TABS.map((tab) => {
28
28
  const active = props.view === tab.value
29
29
  return (
@@ -467,7 +467,7 @@ function Board(props: BoardViewProps) {
467
467
  <Flex align="center" justify="center" padding={5} gap={3}>
468
468
  <Spinner muted />
469
469
  <Text size={1} muted>
470
- Analyse des liens entre les pages…
470
+ Analyzing links between pages…
471
471
  </Text>
472
472
  </Flex>
473
473
  )
@@ -510,7 +510,7 @@ function Board(props: BoardViewProps) {
510
510
  value={tagFilter}
511
511
  onChange={(event) => setTagFilter(event.currentTarget.value)}
512
512
  >
513
- <option value="">Toutes les étiquettes</option>
513
+ <option value="">All tags</option>
514
514
  {config.boardTags.map((tag) => (
515
515
  <option key={tag.id} value={tag.id}>
516
516
  {tag.label}
@@ -528,14 +528,14 @@ function Board(props: BoardViewProps) {
528
528
  />
529
529
  <Button
530
530
  icon={AddIcon}
531
- text="Forme"
531
+ text="Shape"
532
532
  mode="ghost"
533
533
  fontSize={1}
534
534
  padding={2}
535
535
  onClick={() => addAnnotation('rect', screenToFlowPosition({x: 300, y: 320}))}
536
536
  />
537
537
  <Button
538
- text={arranging ? 'Réorganisation…' : 'Réorganiser automatiquement'}
538
+ text={arranging ? 'Arranging…' : 'Auto arrange'}
539
539
  mode="ghost"
540
540
  fontSize={1}
541
541
  padding={2}
@@ -543,22 +543,22 @@ function Board(props: BoardViewProps) {
543
543
  onClick={() => void rearrange()}
544
544
  />
545
545
  <Text size={0} muted>
546
- {visibleNodes.length} pages · {graph.edges.length} liens
547
- {graph.orphans.length > 0 ? ` · ${graph.orphans.length} sans aucun lien` : ''}
546
+ {visibleNodes.length} pages · {graph.edges.length} links
547
+ {graph.orphans.length > 0 ? ` · ${graph.orphans.length} without any link` : ''}
548
548
  </Text>
549
549
  </Flex>
550
550
 
551
551
  {saveError && (
552
552
  <Card padding={3} radius={2} tone="critical">
553
- <Text size={1}>La disposition n’a pas pu être enregistrée : {saveError.message}</Text>
553
+ <Text size={1}>The layout could not be saved: {saveError.message}</Text>
554
554
  </Card>
555
555
  )}
556
556
 
557
557
  {graph.duplicatePaths.length > 0 && (
558
558
  <Card padding={3} radius={2} tone="caution">
559
559
  <Text size={1}>
560
- Plusieurs pages partagent le même chemin ({graph.duplicatePaths.join(', ')}).
561
- Un lien vers ce chemin ne peut en désigner qu’une.
560
+ Several pages share the same path ({graph.duplicatePaths.join(', ')}).
561
+ A link to this path can only point to one of them.
562
562
  </Text>
563
563
  </Card>
564
564
  )}
@@ -642,8 +642,8 @@ function Board(props: BoardViewProps) {
642
642
  </Flex>
643
643
  ))}
644
644
  <Text size={0} muted>
645
- {legend.length === 0 ? 'Couleur déduite de la valeur saisie · ' : '· '}
646
- clic pour la fiche, double-clic pour ouvrir la page
645
+ {legend.length === 0 ? 'Color derived from the entered value · ' : '· '}
646
+ click for details, double-click to open the page
647
647
  </Text>
648
648
  </Flex>
649
649
  </Stack>
@@ -223,10 +223,10 @@ function TreeNode(props: NodeProps<PageFlowNode> & {data: PageNodeData}) {
223
223
  <Flex align="center" justify="center" style={{height: '100%'}}>
224
224
  <Text size={0} muted>
225
225
  {thumbnailFailed
226
- ? 'Capture non générée'
226
+ ? 'Screenshot not generated'
227
227
  : siteUrl
228
- ? 'Survoler pour l’aperçu'
229
- : 'Pas d’aperçu'}
228
+ ? 'Hover to preview'
229
+ : 'No preview'}
230
230
  </Text>
231
231
  </Flex>
232
232
  )}
@@ -259,7 +259,7 @@ function TreeNode(props: NodeProps<PageFlowNode> & {data: PageNodeData}) {
259
259
  textOverflow="ellipsis"
260
260
  style={{fontSize: Math.round(11 * textScale), lineHeight: 1.3}}
261
261
  >
262
- {tags.find((t) => t.id === tag)?.label ?? 'Sans étiquette'}
262
+ {tags.find((t) => t.id === tag)?.label ?? 'No tag'}
263
263
  </Text>
264
264
  ) : (
265
265
  <Flex gap={2} align="center">
@@ -272,7 +272,7 @@ function TreeNode(props: NodeProps<PageFlowNode> & {data: PageNodeData}) {
272
272
  value={tag ?? ''}
273
273
  onChange={(event) => onTag(props.id, event.currentTarget.value || null)}
274
274
  >
275
- <option value="">Sans étiquette</option>
275
+ <option value="">No tag</option>
276
276
  {tags.map((option) => (
277
277
  <option key={option.id} value={option.id}>
278
278
  {option.label}
@@ -83,7 +83,7 @@ export function PagePanel(props: PagePanelProps) {
83
83
  padding={1}
84
84
  fontSize={0}
85
85
  icon={CloseIcon}
86
- aria-label="Fermer"
86
+ aria-label="Close"
87
87
  onClick={onClose}
88
88
  />
89
89
  </Flex>
@@ -112,7 +112,7 @@ export function PagePanel(props: PagePanelProps) {
112
112
  ) : (
113
113
  <Flex align="center" justify="center" style={{height: '100%'}} padding={3}>
114
114
  <Text size={0} muted align="center">
115
- {failed ? 'Capture non générée' : 'Pas de capture'}
115
+ {failed ? 'Screenshot not generated' : 'No screenshot'}
116
116
  </Text>
117
117
  </Flex>
118
118
  )}
@@ -145,19 +145,19 @@ export function PagePanel(props: PagePanelProps) {
145
145
  </Text>
146
146
 
147
147
  <Text size={0} muted>
148
- {incoming} lien(s) entrant(s) · {outgoing} sortant(s)
148
+ {incoming} incoming link(s) · {outgoing} outgoing
149
149
  </Text>
150
150
 
151
151
  <Stack gap={2}>
152
152
  <Text size={0} weight="semibold" muted>
153
- Étiquette
153
+ Tag
154
154
  </Text>
155
155
  <Select
156
156
  fontSize={1}
157
157
  value={tag ?? ''}
158
158
  onChange={(event) => onTag(row.id, event.currentTarget.value || null)}
159
159
  >
160
- <option value="">Sans étiquette</option>
160
+ <option value="">No tag</option>
161
161
  {tags.map((option) => (
162
162
  <option key={option.id} value={option.id}>
163
163
  {option.label}
@@ -169,7 +169,7 @@ export function PagePanel(props: PagePanelProps) {
169
169
  {columns.length > 0 && (
170
170
  <Stack gap={2}>
171
171
  <Text size={0} weight="semibold" muted>
172
- Gestion interne
172
+ Internal management
173
173
  </Text>
174
174
  {columns.map((column) => (
175
175
  <Flex key={column.id} align="center" gap={2}>
@@ -199,8 +199,8 @@ export function PagePanel(props: PagePanelProps) {
199
199
  mode="default"
200
200
  fontSize={1}
201
201
  padding={2}
202
- text="Ouvrir la page"
203
- title="Ouvre dans Presentation"
202
+ text="Open page"
203
+ title="Opens in Presentation"
204
204
  onClick={onOpen}
205
205
  />
206
206
  <IntentLink
@@ -208,7 +208,7 @@ export function PagePanel(props: PagePanelProps) {
208
208
  params={{id: row.id, type: row.type}}
209
209
  style={{textDecoration: 'none'}}
210
210
  >
211
- <Button mode="ghost" fontSize={1} padding={2} text="Modifier" as="span" />
211
+ <Button mode="ghost" fontSize={1} padding={2} text="Edit" as="span" />
212
212
  </IntentLink>
213
213
  {siteUrl && (
214
214
  <Button
@@ -228,7 +228,7 @@ export function PagePanel(props: PagePanelProps) {
228
228
  icon={LaunchIcon}
229
229
  // Le libellé nomme l'environnement dès qu'il y a un choix :
230
230
  // « Voir en ligne » serait faux en pointant une recette.
231
- text={environments.length > 1 ? (environment?.label ?? 'Voir') : 'Voir en ligne'}
231
+ text={environments.length > 1 ? (environment?.label ?? 'View') : 'View live'}
232
232
  title={siteUrl}
233
233
  />
234
234
  )}
@@ -37,7 +37,7 @@ export function NcfPreviewHeader(props: PreviewHeaderProps) {
37
37
 
38
38
  <Flex align="center" gap={2} style={{flex: 'none'}}>
39
39
  <Text size={0} muted>
40
- Données
40
+ Data
41
41
  </Text>
42
42
  <Flex gap={1}>
43
43
  {PERSPECTIVES.map((option) => {
@@ -82,7 +82,7 @@ function AnnotationNodeComponent(props: NodeProps<AnnotationFlowNode>) {
82
82
  overflow: 'hidden',
83
83
  }}
84
84
  >
85
- {annotation.text || 'Double-clic pour écrire'}
85
+ {annotation.text || 'Double-click to write'}
86
86
  </Box>
87
87
  )}
88
88
 
@@ -112,8 +112,8 @@ function AnnotationNodeComponent(props: NodeProps<AnnotationFlowNode>) {
112
112
  fontSize={0}
113
113
  icon={TrashIcon}
114
114
  tone="critical"
115
- title="Supprimer l’annotation"
116
- aria-label="Supprimer l’annotation"
115
+ title="Delete annotation"
116
+ aria-label="Delete annotation"
117
117
  onClick={() => onRemove(annotation.id)}
118
118
  />
119
119
  </Flex>
@@ -10,7 +10,7 @@ import {useUser} from 'sanity'
10
10
  */
11
11
  export function ActorName(props: {actorId: string | null; actorName: string | null}) {
12
12
  const [user] = useUser(props.actorId ?? '')
13
- const label = props.actorName || user?.displayName || (props.actorId ? 'Compte inconnu' : '—')
13
+ const label = props.actorName || user?.displayName || (props.actorId ? 'Unknown account' : '—')
14
14
 
15
15
  return (
16
16
  <Text size={0} muted textOverflow="ellipsis" title={props.actorId ?? undefined}>
@@ -19,8 +19,8 @@ export function ConfigIssues(props: {issues: ConfigIssue[]; toolTitle: string})
19
19
  <Stack gap={4}>
20
20
  <Text weight="semibold">
21
21
  {blocking
22
- ? `« ${toolTitle} » est désactivé : la configuration de ncfKit() est incomplète.`
23
- : `« ${toolTitle} » fonctionne en mode dégradé.`}
22
+ ? `"${toolTitle}" is disabled: the ncfKit() configuration is incomplete.`
23
+ : `"${toolTitle}" is running in degraded mode.`}
24
24
  </Text>
25
25
  <Stack gap={3} as="ul">
26
26
  {issues.map((issue) => (
@@ -31,7 +31,7 @@ export function ConfigIssues(props: {issues: ConfigIssue[]; toolTitle: string})
31
31
  ))}
32
32
  </Stack>
33
33
  <Text size={1} muted>
34
- À corriger dans l'appel à ncfKit() de sanity.config.ts.
34
+ Fix it in the ncfKit() call in sanity.config.ts.
35
35
  </Text>
36
36
  </Stack>
37
37
  </Card>
@@ -22,15 +22,15 @@ export function PreviewOriginsNotice() {
22
22
  <Container width={2}>
23
23
  <Card padding={4} radius={3} shadow={1} tone="caution">
24
24
  <Stack gap={3}>
25
- <Text weight="semibold">Aperçu muet sur {missing.length > 1 ? 'ces environnements' : 'cet environnement'}</Text>
25
+ <Text weight="semibold">Preview not interactive on {missing.length > 1 ? 'these environments' : 'this environment'}</Text>
26
26
  <Stack gap={2}>
27
27
  {missing.map((origin) => (
28
28
  <InlineCode key={origin}>{origin}</InlineCode>
29
29
  ))}
30
30
  </Stack>
31
31
  <Text size={1}>
32
- Presentation n'autorise pas {missing.length > 1 ? 'ces origines' : 'cette origine'} : la page s'affiche sans édition visuelle. Dans sanity.config.ts,
33
- passer <InlineCode>allowOrigins: ncfAllowedOrigins(options)</InlineCode> à presentationTool.
32
+ Presentation does not allow {missing.length > 1 ? 'these origins' : 'this origin'}: the page is shown without visual editing. In sanity.config.ts,
33
+ pass <InlineCode>allowOrigins: ncfAllowedOrigins(options)</InlineCode> to presentationTool.
34
34
  </Text>
35
35
  </Stack>
36
36
  </Card>
@@ -25,10 +25,10 @@ export function ProjectStatusNotice(props: {registration: Registration | null})
25
25
  <Card padding={3} radius={2} tone="caution">
26
26
  <Stack gap={2}>
27
27
  <Text size={1} weight="semibold">
28
- Le journal n'est pas encore activé pour ce projet.
28
+ The log is not enabled for this project yet.
29
29
  </Text>
30
30
  <Text size={0} muted>
31
- NoCode Factory l'active en lançant <code>npx ncf-kit setup</code> dans le dossier du studio.
31
+ NoCode Factory enables it by running <code>npx ncf-kit setup</code> in the studio folder.
32
32
  </Text>
33
33
  </Stack>
34
34
  </Card>
@@ -37,10 +37,10 @@ export function ProjectStatusNotice(props: {registration: Registration | null})
37
37
 
38
38
  const message =
39
39
  status === 'expired'
40
- ? "L'accès à ce projet a expiré."
40
+ ? "Access to this project has expired."
41
41
  : status === 'suspended'
42
- ? 'Ce projet est suspendu.'
43
- : "Ce projet n'est plus autorisé."
42
+ ? 'This project is suspended.'
43
+ : "This project is no longer authorized."
44
44
 
45
45
  return (
46
46
  <Card padding={3} radius={2} tone="caution">
@@ -49,8 +49,8 @@ export function ProjectStatusNotice(props: {registration: Registration | null})
49
49
  {message}
50
50
  </Text>
51
51
  <Text size={0} muted>
52
- Les outils restent utilisables, mais le journal des modifications est arrêté.
53
- Contactez NoCode Factory pour rétablir le service.
52
+ The tools remain usable, but the change log is stopped.
53
+ Contact NoCode Factory to restore the service.
54
54
  </Text>
55
55
  </Stack>
56
56
  </Card>
@@ -5,10 +5,10 @@ export function QueryError(props: {error: Error; onRetry: () => void}) {
5
5
  return (
6
6
  <Card padding={4} radius={3} shadow={1} tone="critical">
7
7
  <Stack gap={4}>
8
- <Text weight="semibold">La requête a échoué.</Text>
8
+ <Text weight="semibold">The query failed.</Text>
9
9
  <Text size={1}>{props.error.message}</Text>
10
10
  <div>
11
- <Button text="Réessayer" mode="ghost" onClick={props.onRetry} />
11
+ <Button text="Retry" mode="ghost" onClick={props.onRetry} />
12
12
  </div>
13
13
  </Stack>
14
14
  </Card>
@@ -12,8 +12,8 @@ export function ToolPlaceholder(props: {title: string; phase: string; children?:
12
12
  {title}
13
13
  </Text>
14
14
  <Text size={1} muted>
15
- Arrive en {phase}. Le socle du plugin est en place : configuration lue, validée, et
16
- outil monté dans le Studio.
15
+ Coming in {phase}. The plugin foundation is in place: configuration read, validated, and
16
+ tool mounted in the Studio.
17
17
  </Text>
18
18
  {children}
19
19
  </Stack>
@@ -1,4 +1,4 @@
1
- const formatter = new Intl.DateTimeFormat('fr-FR', {
1
+ const formatter = new Intl.DateTimeFormat('en-US', {
2
2
  day: '2-digit',
3
3
  month: '2-digit',
4
4
  year: 'numeric',
package/src/version.ts CHANGED
@@ -3,4 +3,4 @@
3
3
  * quelle version. Recopiée de `package.json` par `npm version` (scripts/sync-version.mjs) ; un test
4
4
  * le vérifie.
5
5
  */
6
- export const KIT_VERSION = '2.25.0'
6
+ export const KIT_VERSION = '2.26.0'
@@ -61,7 +61,7 @@ export interface PreviewBannerProps {
61
61
  * `isPreviewSite()`.
62
62
  */
63
63
  export function NcfPreviewBanner(props: PreviewBannerProps) {
64
- const {isDraft, togglePath = '/api/draft-mode/toggle', label = 'Préversion'} = props
64
+ const {isDraft, togglePath = '/api/draft-mode/toggle', label = 'Preview'} = props
65
65
  const pathname = usePathname()
66
66
  // Clé de préversion mémorisée par le garde (absente avec une session Presentation).
67
67
  const grant = useSyncExternalStore(noSubscribe, readGrant, () => null)
@@ -110,32 +110,32 @@ export function NcfPreviewBanner(props: PreviewBannerProps) {
110
110
  </span>
111
111
 
112
112
  <span aria-hidden style={divider} />
113
- <span style={{opacity: 0.75}}>Données</span>
113
+ <span style={{opacity: 0.75}}>Data</span>
114
114
 
115
- <span role="group" aria-label="Données affichées" style={{display: 'inline-flex', gap: 2}}>
115
+ <span role="group" aria-label="Displayed data" style={{display: 'inline-flex', gap: 2}}>
116
116
  <a
117
117
  href={href(true)}
118
- title="Ce qui sortira après publication"
118
+ title="What will go live after publishing"
119
119
  aria-current={isDraft ? 'true' : undefined}
120
120
  style={isDraft ? segmentOn : segmentOff}
121
121
  >
122
- Brouillons
122
+ Drafts
123
123
  </a>
124
124
  <a
125
125
  href={href(false)}
126
- title="Ce que voit le public aujourd'hui"
126
+ title="What the public sees today"
127
127
  aria-current={isDraft ? undefined : 'true'}
128
128
  style={isDraft ? segmentOff : segmentOn}
129
129
  >
130
- En ligne
130
+ Published
131
131
  </a>
132
132
  </span>
133
133
 
134
134
  {grant && (
135
135
  <>
136
136
  <span aria-hidden style={divider} />
137
- <button type="button" onClick={share} title="Copier l'adresse de cette page, clé de préversion comprise" style={shareButton}>
138
- {copied ? 'Lien copié' : 'Copier le lien'}
137
+ <button type="button" onClick={share} title="Copy the address of this page, including the preview key" style={shareButton}>
138
+ {copied ? 'Link copied' : 'Copy link'}
139
139
  </button>
140
140
  </>
141
141
  )}
@@ -36,7 +36,7 @@ export function ncfDraftModeToggle(options: DraftModeToggleOptions = {}) {
36
36
  if (isProductionSite()) {
37
37
  ;(await draftMode()).disable()
38
38
  return NextResponse.json(
39
- {error: 'Le mode brouillon est désactivé en production.'},
39
+ {error: 'Draft mode is disabled in production.'},
40
40
  {status: 403},
41
41
  )
42
42
  }
@@ -193,14 +193,14 @@ function refuse(request: NextRequest): NextResponse {
193
193
  }
194
194
 
195
195
  const PAGE = `<!doctype html>
196
- <html lang="fr"><head><meta charset="utf-8">
196
+ <html lang="en"><head><meta charset="utf-8">
197
197
  <meta name="viewport" content="width=device-width,initial-scale=1">
198
198
  <meta name="robots" content="noindex">
199
- <title>Préversion privée</title></head>
199
+ <title>Private preview</title></head>
200
200
  <body style="margin:0;min-height:100vh;display:grid;place-items:center;background:#faf9f7;color:#1c1917;font:16px/1.6 ui-sans-serif,system-ui,-apple-system,Segoe UI,sans-serif">
201
201
  <main style="max-width:30rem;padding:2rem;text-align:center">
202
202
  <p style="display:inline-flex;align-items:center;gap:.5rem;margin:0 0 1.25rem;padding:.3rem .75rem;border-radius:999px;background:#fef3c7;color:#451a03;font-size:.8125rem;font-weight:500">
203
- <span style="width:7px;height:7px;border-radius:50%;background:#d97706"></span>Préversion</p>
204
- <h1 style="margin:0 0 .75rem;font-size:1.375rem;font-weight:600">Cette version du site est privée</h1>
205
- <p style="margin:0;color:#57534e">Elle sert à relire des contenus avant leur mise en ligne. Pour y accéder, demandez un lien de partage à votre interlocuteur chez NoCode Factory.</p>
203
+ <span style="width:7px;height:7px;border-radius:50%;background:#d97706"></span>Preview</p>
204
+ <h1 style="margin:0 0 .75rem;font-size:1.375rem;font-weight:600">This version of the site is private</h1>
205
+ <p style="margin:0;color:#57534e">It is used to review content before it goes live. To access it, ask your NoCode Factory contact for a share link.</p>
206
206
  </main></body></html>`
@@ -1 +0,0 @@
1
- {"version":3,"file":"componentDefaults-BY3hQ6aD.js","names":[],"sources":["../src/schema/componentDefaults.ts"],"sourcesContent":["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 = '🧩 Composants : valeurs par défaut', namespace = 'section.'} = options\n return defineType({\n name,\n title,\n type: 'document',\n description:\n 'Valeurs appliquées à chaque instance d\\'un composant dont le champ est vide. Un champ rempli dans une instance reste prioritaire (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: 'Valeurs par défaut de ce composant. Vide = valeur du design system.',\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 'Obligatoire.'\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) ? 'Obligatoire (ou à définir dans Composants > valeurs par défaut).' : 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":";AAqBA,MAAa,kCAAkC;;AAG/C,SAAgB,kBAAkB,MAAc,YAAY,YAAoB;CAC9E,OAAO,KAAK,WAA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