@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.
- package/dist/{componentDefaults-BY3hQ6aD.js → componentDefaults-2eWjLLBf.js} +6 -6
- package/dist/componentDefaults-2eWjLLBf.js.map +1 -0
- package/dist/index.d.ts +11 -3
- package/dist/index.js +605 -406
- package/dist/index.js.map +1 -1
- package/dist/schema.js +1 -1
- package/dist/web-server.js +2 -2
- package/dist/web-server.js.map +1 -1
- package/dist/web.js +9 -9
- package/dist/web.js.map +1 -1
- package/package.json +1 -1
- package/src/actions/PropagatePublish.tsx +52 -21
- package/src/actions/RemoveFromSite.tsx +9 -9
- package/src/config/defaults.ts +8 -8
- package/src/config/resolve.ts +4 -1
- package/src/config/types.ts +8 -0
- package/src/config/validate.ts +24 -24
- package/src/context/BoardLayoutContext.tsx +1 -1
- package/src/context/KitContext.tsx +1 -1
- package/src/context/PreviewTargetContext.tsx +1 -1
- package/src/form/OverrideInput.tsx +67 -6
- package/src/form/SlugUrlInput.tsx +2 -2
- package/src/form/TranslationTodoInput.tsx +38 -4
- package/src/hooks/useHistory.ts +5 -5
- package/src/hooks/useOccurrences.ts +1 -1
- package/src/hooks/useOpenOnline.ts +4 -4
- package/src/hooks/useTranslationTodo.ts +2 -1
- package/src/index.ts +9 -5
- package/src/lib/aiTexts.ts +72 -0
- package/src/lib/aiTranslate.ts +61 -0
- package/src/lib/grouping.ts +2 -2
- package/src/lib/overrides.ts +10 -10
- package/src/lib/pages.ts +3 -3
- package/src/lib/service.ts +5 -5
- package/src/lib/status.ts +3 -3
- package/src/lib/studioLinks.ts +6 -6
- package/src/schema/boardLayout.ts +32 -32
- package/src/schema/componentDefaults.ts +5 -5
- package/src/schema/translationTodo.ts +6 -6
- package/src/tools/components/BlockCard.tsx +3 -3
- package/src/tools/components/ComponentsTool.tsx +17 -17
- package/src/tools/components/map/SectionNode.tsx +1 -1
- package/src/tools/components/map/SectionsMap.tsx +10 -10
- package/src/tools/designSystem/DesignSystemTool.tsx +3 -3
- package/src/tools/history/DiffPanel.tsx +23 -23
- package/src/tools/history/HistoryTool.tsx +21 -23
- package/src/tools/more/MoreTool.tsx +1 -1
- package/src/tools/navbar/KitUpdate.tsx +8 -8
- package/src/tools/navbar/PreviewLauncher.tsx +6 -6
- package/src/tools/navbar/ToolButtons.tsx +2 -2
- package/src/tools/pages/ColumnHeader.tsx +18 -18
- package/src/tools/pages/ColumnVisibility.tsx +10 -10
- package/src/tools/pages/FieldValue.tsx +9 -9
- package/src/tools/pages/PagesTable.tsx +11 -11
- package/src/tools/pages/PagesTool.tsx +19 -19
- package/src/tools/pages/PagesToolbar.tsx +3 -3
- package/src/tools/pages/PathCell.tsx +1 -1
- package/src/tools/pages/PreviewTarget.tsx +10 -10
- package/src/tools/pages/SharePreview.tsx +19 -20
- package/src/tools/pages/TagCell.tsx +2 -2
- package/src/tools/pages/ViewTabs.tsx +4 -4
- package/src/tools/pages/board/BoardView.tsx +11 -11
- package/src/tools/pages/board/PageNode.tsx +5 -5
- package/src/tools/pages/board/PagePanel.tsx +10 -10
- package/src/tools/presentation/PreviewHeader.tsx +1 -1
- package/src/tools/shared/AnnotationNode.tsx +3 -3
- package/src/ui/ActorName.tsx +1 -1
- package/src/ui/ConfigIssues.tsx +3 -3
- package/src/ui/PreviewOriginsNotice.tsx +3 -3
- package/src/ui/ProjectStatusNotice.tsx +7 -7
- package/src/ui/QueryError.tsx +2 -2
- package/src/ui/ToolPlaceholder.tsx +2 -2
- package/src/ui/formatDate.ts +1 -1
- package/src/version.ts +1 -1
- package/src/web/PreviewBanner.tsx +9 -9
- package/src/web/draftModeToggle.ts +1 -1
- package/src/web/previewGrant.ts +5 -5
- package/dist/componentDefaults-BY3hQ6aD.js.map +0 -1
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 { 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-2eWjLLBf.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";
|
|
@@ -62,38 +62,38 @@ const DEFAULT_PAGE_BUILDER_FIELD = "sections", DEFAULT_SLUG_FIELD = "slug", DEFA
|
|
|
62
62
|
], DEFAULT_BOARD_TAGS = [
|
|
63
63
|
{
|
|
64
64
|
id: "en-cours",
|
|
65
|
-
label: "
|
|
65
|
+
label: "In progress",
|
|
66
66
|
color: "#f5a623"
|
|
67
67
|
},
|
|
68
68
|
{
|
|
69
69
|
id: "fait",
|
|
70
|
-
label: "
|
|
70
|
+
label: "Done",
|
|
71
71
|
color: "#43d675"
|
|
72
72
|
},
|
|
73
73
|
{
|
|
74
74
|
id: "a-relire",
|
|
75
|
-
label: "
|
|
75
|
+
label: "To review",
|
|
76
76
|
color: "#2276fc"
|
|
77
77
|
},
|
|
78
78
|
{
|
|
79
79
|
id: "a-refondre",
|
|
80
|
-
label: "
|
|
80
|
+
label: "To rework",
|
|
81
81
|
color: "#f03e3e"
|
|
82
82
|
}
|
|
83
83
|
], DEFAULT_INTERNAL_FIELDS = [
|
|
84
84
|
{
|
|
85
85
|
id: "owner",
|
|
86
|
-
label: "
|
|
86
|
+
label: "Owner",
|
|
87
87
|
type: "text"
|
|
88
88
|
},
|
|
89
89
|
{
|
|
90
90
|
id: "audience",
|
|
91
|
-
label: "
|
|
91
|
+
label: "Audience",
|
|
92
92
|
type: "text"
|
|
93
93
|
},
|
|
94
94
|
{
|
|
95
95
|
id: "role",
|
|
96
|
-
label: "
|
|
96
|
+
label: "Page role",
|
|
97
97
|
type: "text"
|
|
98
98
|
}
|
|
99
99
|
], trimTrailingSlash = (url) => url.replace(/\/+$/, ""), normalizePath = (path) => {
|
|
@@ -127,7 +127,8 @@ function resolveConfig(input) {
|
|
|
127
127
|
})), i18n = input.i18n === !1 || input.i18n === void 0 ? null : {
|
|
128
128
|
field: input.i18n.field?.trim() || DEFAULT_I18N.field,
|
|
129
129
|
defaultLocale: input.i18n.defaultLocale?.trim() || DEFAULT_I18N.defaultLocale,
|
|
130
|
-
locales: input.i18n.locales ?? DEFAULT_I18N.locales
|
|
130
|
+
locales: input.i18n.locales ?? DEFAULT_I18N.locales,
|
|
131
|
+
defaultsSourceLocale: input.i18n.defaultsSourceLocale?.trim() || ((input.i18n.locales ?? DEFAULT_I18N.locales).includes("en") ? "en" : input.i18n.defaultLocale?.trim() || DEFAULT_I18N.defaultLocale)
|
|
131
132
|
};
|
|
132
133
|
return {
|
|
133
134
|
pageTypes,
|
|
@@ -210,7 +211,7 @@ function resolveEnvironments(input) {
|
|
|
210
211
|
url: preview
|
|
211
212
|
}], conventional = conventionalPreprodUrl(preview), hasPreprod = declared.some((environment) => environment.url === conventional || environment.id === "preprod") || input.preprodUrl === !1, preprod = conventional && !hasPreprod ? [{
|
|
212
213
|
id: "preprod",
|
|
213
|
-
label: "
|
|
214
|
+
label: "Staging",
|
|
214
215
|
url: conventional
|
|
215
216
|
}] : [];
|
|
216
217
|
return [
|
|
@@ -244,28 +245,28 @@ function validateConfig(config) {
|
|
|
244
245
|
message,
|
|
245
246
|
...tools ? { tools } : {}
|
|
246
247
|
});
|
|
247
|
-
config.pageTypes.length === 0 && error("pageTypes", "`pageTypes`
|
|
248
|
+
config.pageTypes.length === 0 && error("pageTypes", "`pageTypes` is empty. Declare at least one document type, e.g. pageTypes: ['page'].");
|
|
248
249
|
let seen = /* @__PURE__ */ new Set();
|
|
249
250
|
config.pageTypes.forEach((pageType, index) => {
|
|
250
251
|
let at = `pageTypes[${index}]`;
|
|
251
252
|
if (!pageType.type) {
|
|
252
|
-
error(`${at}.type`, "
|
|
253
|
+
error(`${at}.type`, "Document type missing or empty.");
|
|
253
254
|
return;
|
|
254
255
|
}
|
|
255
|
-
seen.has(pageType.type) && error(`${at}.type`, `
|
|
256
|
-
}), config.previewUrl && !isAbsoluteHttpUrl(config.previewUrl) && error("previewUrl",
|
|
256
|
+
seen.has(pageType.type) && error(`${at}.type`, `The type "${pageType.type}" is declared more than once.`), seen.add(pageType.type), pageType.path && pageType.pathPrefix && warn(`${at}.pathPrefix`, `"${pageType.type}" has a fixed path: its pathPrefix is ignored.`), !pageType.slugField && !pageType.path && error(`${at}`, `"${pageType.type}" has neither slugField nor path: the kit cannot build its URL. Give it a fixed path, e.g. {type: '${pageType.type}', path: '/'} for a home page.`);
|
|
257
|
+
}), config.previewUrl && !isAbsoluteHttpUrl(config.previewUrl) && error("previewUrl", `"${config.previewUrl}" is not an absolute URL. Expected: https://example.com`), config.componentPreview.provider === "designSystemPage" && (config.previewUrl || warn("previewUrl", "Component preview is enabled but `previewUrl` is missing: thumbnails and links to the design system page will be disabled.", ["components"]), !config.componentPreview.thumbnail.includes("{name}") && !config.componentPreview.thumbnail.includes("{kebab}") && warn("componentPreview.thumbnail", "The template contains neither {name} nor {kebab}: every block will show the same image.", ["components"]));
|
|
257
258
|
let seenEnvironments = /* @__PURE__ */ new Set();
|
|
258
|
-
for (let environment of config.environments) isAbsoluteHttpUrl(environment.url) || error(`environments.${environment.id}.url`,
|
|
259
|
-
config.tools.history && (config.history ? ((!config.history.endpoint || !isAbsoluteHttpUrl(config.history.endpoint)) && error("history.endpoint",
|
|
259
|
+
for (let environment of config.environments) isAbsoluteHttpUrl(environment.url) || error(`environments.${environment.id}.url`, `"${environment.url}" is not an absolute URL. The preview will not be able to load this environment.`, ["pages"]), seenEnvironments.has(environment.id) && error("environments", `Two environments share the id "${environment.id}": which one is used would be unpredictable.`, ["pages"]), seenEnvironments.add(environment.id);
|
|
260
|
+
config.tools.history && (config.history ? ((!config.history.endpoint || !isAbsoluteHttpUrl(config.history.endpoint)) && error("history.endpoint", `"${config.history.endpoint || ""}" is not an absolute URL to the read Edge Function.`, ["history"]), config.history.projectKey?.trim() || error("history.projectKey", "`history.projectKey` is empty.", ["history"]), /^eyJ|^sb_secret_|service_role/i.test(config.history.projectKey ?? "") && error("history.projectKey", "This value looks like a Supabase key. The Studio is public: only ever put an opaque project identifier here, with no write access.", ["history"])) : warn("history", "The History tab is enabled but no read key is configured. Run `npx ncf-kit setup` in the studio folder (it is written to .env), or set tools: {history: false}.", ["history"]));
|
|
260
261
|
let fieldIds = /* @__PURE__ */ new Set();
|
|
261
262
|
return config.internalFields.forEach((field, index) => {
|
|
262
263
|
let at = `internalFields[${index}]`;
|
|
263
264
|
if (!field.id?.trim()) {
|
|
264
|
-
error(`${at}.id`, "
|
|
265
|
+
error(`${at}.id`, "Field id missing.", ["pages"]);
|
|
265
266
|
return;
|
|
266
267
|
}
|
|
267
|
-
fieldIds.has(field.id) && error(`${at}.id`, `
|
|
268
|
-
}), config.pageBuilderField || error("pageBuilderField", "
|
|
268
|
+
fieldIds.has(field.id) && error(`${at}.id`, `The field "${field.id}" is declared more than once.`, ["pages"]), fieldIds.add(field.id), field.label?.trim() || warn(`${at}.label`, `The field "${field.id}" has no label: its id will be shown.`, ["pages"]), field.type === "select" && !field.options?.length && error(`${at}.options`, `The field "${field.id}" is of type select but has no options.`, ["pages"]);
|
|
269
|
+
}), config.pageBuilderField || error("pageBuilderField", "The page builder field cannot be empty.", ["pages", "components"]), issues;
|
|
269
270
|
}
|
|
270
271
|
/** Problèmes bloquant un outil donné. */
|
|
271
272
|
function issuesForTool(issues, tool) {
|
|
@@ -291,35 +292,35 @@ function KitProvider(props) {
|
|
|
291
292
|
*/
|
|
292
293
|
function useKitContext() {
|
|
293
294
|
let value = useContext(KitContext);
|
|
294
|
-
if (!value) throw Error("useKitContext
|
|
295
|
+
if (!value) throw Error("useKitContext must be called inside a tool of the @nocode-factory/sanity-kit plugin.");
|
|
295
296
|
return value;
|
|
296
297
|
}
|
|
297
298
|
const useKitConfig = () => useKitContext().config, TRANSLATION_TODO_TYPE = "ncfTranslationTodo", translationTodoId = (documentId) => `ncfTodo.${documentId.replace(/^drafts\./, "")}`, translationTodoType = defineType({
|
|
298
299
|
name: TRANSLATION_TODO_TYPE,
|
|
299
|
-
title: "
|
|
300
|
+
title: "To translate (NCF)",
|
|
300
301
|
type: "document",
|
|
301
302
|
fields: [
|
|
302
303
|
defineField({
|
|
303
304
|
name: "documentId",
|
|
304
|
-
title: "
|
|
305
|
+
title: "Translation",
|
|
305
306
|
type: "string",
|
|
306
307
|
readOnly: !0
|
|
307
308
|
}),
|
|
308
309
|
defineField({
|
|
309
310
|
name: "sourceId",
|
|
310
|
-
title: "
|
|
311
|
+
title: "Main version",
|
|
311
312
|
type: "string",
|
|
312
313
|
readOnly: !0
|
|
313
314
|
}),
|
|
314
315
|
defineField({
|
|
315
316
|
name: "sourceLanguage",
|
|
316
|
-
title: "
|
|
317
|
+
title: "Main language",
|
|
317
318
|
type: "string",
|
|
318
319
|
readOnly: !0
|
|
319
320
|
}),
|
|
320
321
|
defineField({
|
|
321
322
|
name: "paths",
|
|
322
|
-
title: "
|
|
323
|
+
title: "Fields to translate",
|
|
323
324
|
type: "array",
|
|
324
325
|
of: [{ type: "string" }],
|
|
325
326
|
readOnly: !0
|
|
@@ -327,11 +328,11 @@ const useKitConfig = () => useKitContext().config, TRANSLATION_TODO_TYPE = "ncfT
|
|
|
327
328
|
],
|
|
328
329
|
preview: {
|
|
329
330
|
select: { title: "documentId" },
|
|
330
|
-
prepare: ({ title }) => ({ title:
|
|
331
|
+
prepare: ({ title }) => ({ title: `To translate: ${title}` })
|
|
331
332
|
}
|
|
332
333
|
}), BOARD_LAYOUT_TYPE = "ncfBoardLayout", BOARD_LAYOUT_ID = "ncfBoardLayout", BOARD_NODE_TYPE = "ncfBoardNode", SECTION_NODE_TYPE = "ncfSectionNode", NODE_FIELD_TYPE = "ncfNodeField", COLUMN_TYPE = "ncfColumn", COLUMN_OPTION_TYPE = "ncfColumnOption", ANNOTATION_TYPE = "ncfAnnotation", NCF_HIDDEN_TYPES = [BOARD_LAYOUT_TYPE, TRANSLATION_TODO_TYPE], boardNodeType = defineType({
|
|
333
334
|
name: BOARD_NODE_TYPE,
|
|
334
|
-
title: "
|
|
335
|
+
title: "Page position",
|
|
335
336
|
type: "object",
|
|
336
337
|
fields: [
|
|
337
338
|
defineField({
|
|
@@ -351,22 +352,22 @@ const useKitConfig = () => useKitContext().config, TRANSLATION_TODO_TYPE = "ncfT
|
|
|
351
352
|
}),
|
|
352
353
|
defineField({
|
|
353
354
|
name: "width",
|
|
354
|
-
title: "
|
|
355
|
+
title: "Width",
|
|
355
356
|
type: "number"
|
|
356
357
|
}),
|
|
357
358
|
defineField({
|
|
358
359
|
name: "height",
|
|
359
|
-
title: "
|
|
360
|
+
title: "Height",
|
|
360
361
|
type: "number"
|
|
361
362
|
}),
|
|
362
363
|
defineField({
|
|
363
364
|
name: "tag",
|
|
364
|
-
title: "
|
|
365
|
+
title: "Tracking tag",
|
|
365
366
|
type: "string"
|
|
366
367
|
}),
|
|
367
368
|
defineField({
|
|
368
369
|
name: "fields",
|
|
369
|
-
title: "
|
|
370
|
+
title: "Internal management",
|
|
370
371
|
type: "array",
|
|
371
372
|
of: [{ type: NODE_FIELD_TYPE }]
|
|
372
373
|
})
|
|
@@ -378,7 +379,7 @@ const useKitConfig = () => useKitContext().config, TRANSLATION_TODO_TYPE = "ncfT
|
|
|
378
379
|
y: "y"
|
|
379
380
|
},
|
|
380
381
|
prepare: ({ title, x, y }) => ({
|
|
381
|
-
title: title ?? "
|
|
382
|
+
title: title ?? "No document",
|
|
382
383
|
subtitle: `${x ?? 0} × ${y ?? 0}`
|
|
383
384
|
})
|
|
384
385
|
}
|
|
@@ -389,7 +390,7 @@ const useKitConfig = () => useKitContext().config, TRANSLATION_TODO_TYPE = "ncfT
|
|
|
389
390
|
fields: [
|
|
390
391
|
defineField({
|
|
391
392
|
name: "id",
|
|
392
|
-
title: "
|
|
393
|
+
title: "ID",
|
|
393
394
|
type: "string"
|
|
394
395
|
}),
|
|
395
396
|
defineField({
|
|
@@ -406,13 +407,13 @@ const useKitConfig = () => useKitContext().config, TRANSLATION_TODO_TYPE = "ncfT
|
|
|
406
407
|
}),
|
|
407
408
|
defineField({
|
|
408
409
|
name: "kind",
|
|
409
|
-
title: "
|
|
410
|
+
title: "Kind",
|
|
410
411
|
type: "string",
|
|
411
412
|
options: { list: [{
|
|
412
|
-
title: "
|
|
413
|
+
title: "Text",
|
|
413
414
|
value: "text"
|
|
414
415
|
}, {
|
|
415
|
-
title: "
|
|
416
|
+
title: "Shape",
|
|
416
417
|
value: "rect"
|
|
417
418
|
}] }
|
|
418
419
|
}),
|
|
@@ -434,12 +435,12 @@ const useKitConfig = () => useKitContext().config, TRANSLATION_TODO_TYPE = "ncfT
|
|
|
434
435
|
}),
|
|
435
436
|
defineField({
|
|
436
437
|
name: "text",
|
|
437
|
-
title: "
|
|
438
|
+
title: "Text",
|
|
438
439
|
type: "string"
|
|
439
440
|
}),
|
|
440
441
|
defineField({
|
|
441
442
|
name: "color",
|
|
442
|
-
title: "
|
|
443
|
+
title: "Color",
|
|
443
444
|
type: "string"
|
|
444
445
|
})
|
|
445
446
|
],
|
|
@@ -449,22 +450,22 @@ const useKitConfig = () => useKitContext().config, TRANSLATION_TODO_TYPE = "ncfT
|
|
|
449
450
|
} }
|
|
450
451
|
}), columnOptionType = defineType({
|
|
451
452
|
name: COLUMN_OPTION_TYPE,
|
|
452
|
-
title: "
|
|
453
|
+
title: "Choice",
|
|
453
454
|
type: "object",
|
|
454
455
|
fields: [
|
|
455
456
|
defineField({
|
|
456
457
|
name: "id",
|
|
457
|
-
title: "
|
|
458
|
+
title: "ID",
|
|
458
459
|
type: "string"
|
|
459
460
|
}),
|
|
460
461
|
defineField({
|
|
461
462
|
name: "label",
|
|
462
|
-
title: "
|
|
463
|
+
title: "Label",
|
|
463
464
|
type: "string"
|
|
464
465
|
}),
|
|
465
466
|
defineField({
|
|
466
467
|
name: "color",
|
|
467
|
-
title: "
|
|
468
|
+
title: "Color",
|
|
468
469
|
type: "string"
|
|
469
470
|
})
|
|
470
471
|
],
|
|
@@ -474,17 +475,17 @@ const useKitConfig = () => useKitContext().config, TRANSLATION_TODO_TYPE = "ncfT
|
|
|
474
475
|
} }
|
|
475
476
|
}), columnType = defineType({
|
|
476
477
|
name: COLUMN_TYPE,
|
|
477
|
-
title: "
|
|
478
|
+
title: "Internal management column",
|
|
478
479
|
type: "object",
|
|
479
480
|
fields: [
|
|
480
481
|
defineField({
|
|
481
482
|
name: "id",
|
|
482
|
-
title: "
|
|
483
|
+
title: "ID",
|
|
483
484
|
type: "string"
|
|
484
485
|
}),
|
|
485
486
|
defineField({
|
|
486
487
|
name: "label",
|
|
487
|
-
title: "
|
|
488
|
+
title: "Name",
|
|
488
489
|
type: "string"
|
|
489
490
|
}),
|
|
490
491
|
defineField({
|
|
@@ -492,16 +493,16 @@ const useKitConfig = () => useKitContext().config, TRANSLATION_TODO_TYPE = "ncfT
|
|
|
492
493
|
title: "Type",
|
|
493
494
|
type: "string",
|
|
494
495
|
options: { list: [{
|
|
495
|
-
title: "
|
|
496
|
+
title: "Text",
|
|
496
497
|
value: "text"
|
|
497
498
|
}, {
|
|
498
|
-
title: "
|
|
499
|
+
title: "List",
|
|
499
500
|
value: "select"
|
|
500
501
|
}] }
|
|
501
502
|
}),
|
|
502
503
|
defineField({
|
|
503
504
|
name: "options",
|
|
504
|
-
title: "
|
|
505
|
+
title: "Choices",
|
|
505
506
|
type: "array",
|
|
506
507
|
of: [{ type: COLUMN_OPTION_TYPE }]
|
|
507
508
|
})
|
|
@@ -512,15 +513,15 @@ const useKitConfig = () => useKitContext().config, TRANSLATION_TODO_TYPE = "ncfT
|
|
|
512
513
|
} }
|
|
513
514
|
}), nodeFieldType = defineType({
|
|
514
515
|
name: NODE_FIELD_TYPE,
|
|
515
|
-
title: "
|
|
516
|
+
title: "Internal management field",
|
|
516
517
|
type: "object",
|
|
517
518
|
fields: [defineField({
|
|
518
519
|
name: "fieldId",
|
|
519
|
-
title: "
|
|
520
|
+
title: "Field",
|
|
520
521
|
type: "string"
|
|
521
522
|
}), defineField({
|
|
522
523
|
name: "value",
|
|
523
|
-
title: "
|
|
524
|
+
title: "Value",
|
|
524
525
|
type: "string"
|
|
525
526
|
})],
|
|
526
527
|
preview: { select: {
|
|
@@ -529,12 +530,12 @@ const useKitConfig = () => useKitContext().config, TRANSLATION_TODO_TYPE = "ncfT
|
|
|
529
530
|
} }
|
|
530
531
|
}), sectionNodeType = defineType({
|
|
531
532
|
name: SECTION_NODE_TYPE,
|
|
532
|
-
title: "
|
|
533
|
+
title: "Section position",
|
|
533
534
|
type: "object",
|
|
534
535
|
fields: [
|
|
535
536
|
defineField({
|
|
536
537
|
name: "blockName",
|
|
537
|
-
title: "
|
|
538
|
+
title: "Block type",
|
|
538
539
|
type: "string"
|
|
539
540
|
}),
|
|
540
541
|
defineField({
|
|
@@ -555,14 +556,14 @@ const useKitConfig = () => useKitContext().config, TRANSLATION_TODO_TYPE = "ncfT
|
|
|
555
556
|
y: "y"
|
|
556
557
|
},
|
|
557
558
|
prepare: ({ title, x, y }) => ({
|
|
558
|
-
title: title ?? "
|
|
559
|
+
title: title ?? "No block",
|
|
559
560
|
subtitle: `${x ?? 0} × ${y ?? 0}`
|
|
560
561
|
})
|
|
561
562
|
}
|
|
562
563
|
}), kitSchemaTypes = [
|
|
563
564
|
defineType({
|
|
564
565
|
name: BOARD_LAYOUT_TYPE,
|
|
565
|
-
title: "
|
|
566
|
+
title: "Board layout (NCF)",
|
|
566
567
|
type: "document",
|
|
567
568
|
fields: [
|
|
568
569
|
defineField({
|
|
@@ -579,29 +580,29 @@ const useKitConfig = () => useKitContext().config, TRANSLATION_TODO_TYPE = "ncfT
|
|
|
579
580
|
}),
|
|
580
581
|
defineField({
|
|
581
582
|
name: "columns",
|
|
582
|
-
title: "
|
|
583
|
+
title: "Internal management columns",
|
|
583
584
|
type: "array",
|
|
584
585
|
of: [{ type: COLUMN_TYPE }]
|
|
585
586
|
}),
|
|
586
587
|
defineField({
|
|
587
588
|
name: "columnsSet",
|
|
588
|
-
title: "
|
|
589
|
+
title: "Columns set",
|
|
589
590
|
type: "boolean"
|
|
590
591
|
}),
|
|
591
592
|
defineField({
|
|
592
593
|
name: "sections",
|
|
593
|
-
title: "
|
|
594
|
+
title: "Section positions",
|
|
594
595
|
type: "array",
|
|
595
596
|
of: [{ type: SECTION_NODE_TYPE }]
|
|
596
597
|
}),
|
|
597
598
|
defineField({
|
|
598
599
|
name: "updatedBy",
|
|
599
|
-
title: "
|
|
600
|
+
title: "Modified by",
|
|
600
601
|
type: "string",
|
|
601
602
|
readOnly: !0
|
|
602
603
|
})
|
|
603
604
|
],
|
|
604
|
-
preview: { prepare: () => ({ title: "
|
|
605
|
+
preview: { prepare: () => ({ title: "Board layout (NCF)" }) }
|
|
605
606
|
}),
|
|
606
607
|
translationTodoType,
|
|
607
608
|
boardNodeType,
|
|
@@ -714,19 +715,19 @@ function mergeVersions(docs) {
|
|
|
714
715
|
}
|
|
715
716
|
const STATUS_LABELS = {
|
|
716
717
|
published: {
|
|
717
|
-
label: "
|
|
718
|
+
label: "Published",
|
|
718
719
|
tone: "positive",
|
|
719
|
-
help: "
|
|
720
|
+
help: "Live, up to date"
|
|
720
721
|
},
|
|
721
722
|
modified: {
|
|
722
|
-
label: "
|
|
723
|
+
label: "Modified",
|
|
723
724
|
tone: "caution",
|
|
724
|
-
help: "
|
|
725
|
+
help: "Live, with unpublished changes"
|
|
725
726
|
},
|
|
726
727
|
draft: {
|
|
727
|
-
label: "
|
|
728
|
+
label: "Not published",
|
|
728
729
|
tone: "default",
|
|
729
|
-
help: "
|
|
730
|
+
help: "Not on the site: never published, or removed from the site (content kept in the draft)"
|
|
730
731
|
}
|
|
731
732
|
};
|
|
732
733
|
/**
|
|
@@ -1027,17 +1028,17 @@ function BoardLayoutProvider(props) {
|
|
|
1027
1028
|
}
|
|
1028
1029
|
function useBoardLayout() {
|
|
1029
1030
|
let value = useContext(BoardLayoutContext);
|
|
1030
|
-
if (!value) throw Error("useBoardLayout
|
|
1031
|
+
if (!value) throw Error("useBoardLayout must be called inside BoardLayoutProvider.");
|
|
1031
1032
|
return value;
|
|
1032
1033
|
}
|
|
1033
1034
|
const PERSPECTIVES = [{
|
|
1034
1035
|
id: "drafts",
|
|
1035
|
-
label: "
|
|
1036
|
-
hint: "
|
|
1036
|
+
label: "Drafts",
|
|
1037
|
+
hint: "What will go live after publishing"
|
|
1037
1038
|
}, {
|
|
1038
1039
|
id: "published",
|
|
1039
|
-
label: "
|
|
1040
|
-
hint: "
|
|
1040
|
+
label: "Published",
|
|
1041
|
+
hint: "What the public sees today"
|
|
1041
1042
|
}], trimEnd = (url) => url.replace(/\/+$/, "");
|
|
1042
1043
|
/**
|
|
1043
1044
|
* URL d'une page sur un front donné.
|
|
@@ -1059,24 +1060,24 @@ function isPublicEnvironment(environment, previewUrl) {
|
|
|
1059
1060
|
return environment ? environment.id === "production" || !!previewUrl && trimEnd(environment.url) === trimEnd(previewUrl) : !1;
|
|
1060
1061
|
}
|
|
1061
1062
|
function previewTargets(environments, previewUrl) {
|
|
1062
|
-
let previews = environments.filter((e) => !isPublicEnvironment(e, previewUrl)), publics = environments.filter((e) => isPublicEnvironment(e, previewUrl)), name = (e) => e.id === "preprod" ? "
|
|
1063
|
+
let previews = environments.filter((e) => !isPublicEnvironment(e, previewUrl)), publics = environments.filter((e) => isPublicEnvironment(e, previewUrl)), name = (e) => e.id === "preprod" ? "Staging" : e.label;
|
|
1063
1064
|
return [...previews.flatMap((environment) => [{
|
|
1064
1065
|
environment,
|
|
1065
1066
|
perspective: "drafts",
|
|
1066
|
-
label: `${name(environment)} ·
|
|
1067
|
-
hint: "
|
|
1067
|
+
label: `${name(environment)} · Drafts`,
|
|
1068
|
+
hint: "What will go live after publishing",
|
|
1068
1069
|
tone: "draft"
|
|
1069
1070
|
}, {
|
|
1070
1071
|
environment,
|
|
1071
1072
|
perspective: "published",
|
|
1072
|
-
label: `${name(environment)} ·
|
|
1073
|
-
hint: "
|
|
1073
|
+
label: `${name(environment)} · Published`,
|
|
1074
|
+
hint: "The published content, on the test version of the site",
|
|
1074
1075
|
tone: "live"
|
|
1075
1076
|
}]), ...publics.map((environment) => ({
|
|
1076
1077
|
environment,
|
|
1077
1078
|
perspective: "published",
|
|
1078
|
-
label: "Prod ·
|
|
1079
|
-
hint: "
|
|
1079
|
+
label: "Prod · Published",
|
|
1080
|
+
hint: "The public site, as visitors see it",
|
|
1080
1081
|
tone: "prod"
|
|
1081
1082
|
}))];
|
|
1082
1083
|
}
|
|
@@ -1290,7 +1291,7 @@ function PreviewTargetProvider(props) {
|
|
|
1290
1291
|
}
|
|
1291
1292
|
function usePreviewTarget() {
|
|
1292
1293
|
let value = useContext(PreviewTargetContext);
|
|
1293
|
-
if (!value) throw Error("usePreviewTarget
|
|
1294
|
+
if (!value) throw Error("usePreviewTarget must be called inside PreviewTargetProvider.");
|
|
1294
1295
|
return value;
|
|
1295
1296
|
}
|
|
1296
1297
|
/**
|
|
@@ -1332,7 +1333,7 @@ function ConfigIssues(props) {
|
|
|
1332
1333
|
children: [
|
|
1333
1334
|
/* @__PURE__ */ jsx(Text, {
|
|
1334
1335
|
weight: "semibold",
|
|
1335
|
-
children: blocking ?
|
|
1336
|
+
children: blocking ? `"${toolTitle}" is disabled: the ncfKit() configuration is incomplete.` : `"${toolTitle}" is running in degraded mode.`
|
|
1336
1337
|
}),
|
|
1337
1338
|
/* @__PURE__ */ jsx(Stack, {
|
|
1338
1339
|
gap: 3,
|
|
@@ -1349,7 +1350,7 @@ function ConfigIssues(props) {
|
|
|
1349
1350
|
/* @__PURE__ */ jsx(Text, {
|
|
1350
1351
|
size: 1,
|
|
1351
1352
|
muted: !0,
|
|
1352
|
-
children: "
|
|
1353
|
+
children: "Fix it in the ncfKit() call in sanity.config.ts."
|
|
1353
1354
|
})
|
|
1354
1355
|
]
|
|
1355
1356
|
})
|
|
@@ -1412,14 +1413,14 @@ async function requestPreviewGrant(endpoint, payload, signal) {
|
|
|
1412
1413
|
/** Messages du service, rendus lisibles pour un éditeur. */
|
|
1413
1414
|
function explainGrantError(error) {
|
|
1414
1415
|
let code = error instanceof Error ? error.message : String(error);
|
|
1415
|
-
return code === "missing_sanity_token" ? "
|
|
1416
|
+
return code === "missing_sanity_token" ? "Your Sanity session exposes no token: unable to prove your access to the project." : code === "no_project_access" ? "Your account has no access to this Sanity project." : code === "project_inactive" ? "This project is not active at NoCode Factory." : code === "unknown_project" ? "This project is not registered at NoCode Factory." : "The link could not be created.";
|
|
1416
1417
|
}
|
|
1417
1418
|
/**
|
|
1418
1419
|
* Version du kit, rapportée au service pour savoir quels projets tournent sur
|
|
1419
1420
|
* quelle version. Recopiée de `package.json` par `npm version` (scripts/sync-version.mjs) ; un test
|
|
1420
1421
|
* le vérifie.
|
|
1421
1422
|
*/
|
|
1422
|
-
const KIT_VERSION = "2.
|
|
1423
|
+
const KIT_VERSION = "2.27.0";
|
|
1423
1424
|
/**
|
|
1424
1425
|
* Signale ce Studio au service du kit, une fois par montage.
|
|
1425
1426
|
*
|
|
@@ -1472,14 +1473,14 @@ function ProjectStatusNotice(props) {
|
|
|
1472
1473
|
children: [/* @__PURE__ */ jsx(Text, {
|
|
1473
1474
|
size: 1,
|
|
1474
1475
|
weight: "semibold",
|
|
1475
|
-
children: "
|
|
1476
|
+
children: "The log is not enabled for this project yet."
|
|
1476
1477
|
}), /* @__PURE__ */ jsxs(Text, {
|
|
1477
1478
|
size: 0,
|
|
1478
1479
|
muted: !0,
|
|
1479
1480
|
children: [
|
|
1480
|
-
"NoCode Factory
|
|
1481
|
+
"NoCode Factory enables it by running ",
|
|
1481
1482
|
/* @__PURE__ */ jsx("code", { children: "npx ncf-kit setup" }),
|
|
1482
|
-
"
|
|
1483
|
+
" in the studio folder."
|
|
1483
1484
|
]
|
|
1484
1485
|
})]
|
|
1485
1486
|
})
|
|
@@ -1492,11 +1493,11 @@ function ProjectStatusNotice(props) {
|
|
|
1492
1493
|
children: [/* @__PURE__ */ jsx(Text, {
|
|
1493
1494
|
size: 1,
|
|
1494
1495
|
weight: "semibold",
|
|
1495
|
-
children: status === "expired" ? "
|
|
1496
|
+
children: status === "expired" ? "Access to this project has expired." : status === "suspended" ? "This project is suspended." : "This project is no longer authorized."
|
|
1496
1497
|
}), /* @__PURE__ */ jsx(Text, {
|
|
1497
1498
|
size: 0,
|
|
1498
1499
|
muted: !0,
|
|
1499
|
-
children: "
|
|
1500
|
+
children: "The tools remain usable, but the change log is stopped. Contact NoCode Factory to restore the service."
|
|
1500
1501
|
})]
|
|
1501
1502
|
})
|
|
1502
1503
|
});
|
|
@@ -1522,7 +1523,7 @@ function PreviewOriginsNotice() {
|
|
|
1522
1523
|
children: [
|
|
1523
1524
|
/* @__PURE__ */ jsxs(Text, {
|
|
1524
1525
|
weight: "semibold",
|
|
1525
|
-
children: ["
|
|
1526
|
+
children: ["Preview not interactive on ", missing.length > 1 ? "these environments" : "this environment"]
|
|
1526
1527
|
}),
|
|
1527
1528
|
/* @__PURE__ */ jsx(Stack, {
|
|
1528
1529
|
gap: 2,
|
|
@@ -1531,11 +1532,11 @@ function PreviewOriginsNotice() {
|
|
|
1531
1532
|
/* @__PURE__ */ jsxs(Text, {
|
|
1532
1533
|
size: 1,
|
|
1533
1534
|
children: [
|
|
1534
|
-
"Presentation
|
|
1535
|
-
missing.length > 1 ? "
|
|
1536
|
-
"
|
|
1535
|
+
"Presentation does not allow ",
|
|
1536
|
+
missing.length > 1 ? "these origins" : "this origin",
|
|
1537
|
+
": the page is shown without visual editing. In sanity.config.ts, pass ",
|
|
1537
1538
|
/* @__PURE__ */ jsx(InlineCode, { children: "allowOrigins: ncfAllowedOrigins(options)" }),
|
|
1538
|
-
"
|
|
1539
|
+
" to presentationTool."
|
|
1539
1540
|
]
|
|
1540
1541
|
})
|
|
1541
1542
|
]
|
|
@@ -1691,7 +1692,7 @@ function useOpenOnline() {
|
|
|
1691
1692
|
}
|
|
1692
1693
|
let tab = window.open("about:blank", "_blank");
|
|
1693
1694
|
if (tab) {
|
|
1694
|
-
tab.opener = null, tab.document.title = "
|
|
1695
|
+
tab.opener = null, tab.document.title = "Opening the preview…", tab.document.body.innerHTML = "<p style=\"font:15px/1.6 system-ui,sans-serif;color:#57534e;padding:2rem\">Opening the preview…</p>";
|
|
1695
1696
|
try {
|
|
1696
1697
|
let { projectId, dataset, token } = client.config();
|
|
1697
1698
|
if (!projectId || !dataset) throw Error("unknown_project");
|
|
@@ -1711,7 +1712,7 @@ function useOpenOnline() {
|
|
|
1711
1712
|
tab.location.href = signed ?? plain;
|
|
1712
1713
|
} catch (cause) {
|
|
1713
1714
|
let message = explainGrantError(cause);
|
|
1714
|
-
tab.document.title = "
|
|
1715
|
+
tab.document.title = "Preview unavailable", tab.document.body.innerHTML = "<main style=\"font:15px/1.6 system-ui,sans-serif;color:#1c1917;padding:2rem;max-width:32rem\"><h1 style=\"font-size:18px\">Unable to open the preview</h1><p style=\"color:#57534e\"></p></main>";
|
|
1715
1716
|
let paragraph = tab.document.querySelector("p");
|
|
1716
1717
|
paragraph && (paragraph.textContent = message);
|
|
1717
1718
|
}
|
|
@@ -1762,7 +1763,7 @@ function useKitUpdate() {
|
|
|
1762
1763
|
!controller.signal.aborted && body?.version && setLatest(body.version);
|
|
1763
1764
|
}).catch(() => {}), () => controller.abort();
|
|
1764
1765
|
}, []);
|
|
1765
|
-
let available = !!(latest && !isPrerelease(latest) && compareVersions(latest, "2.
|
|
1766
|
+
let available = !!(latest && !isPrerelease(latest) && compareVersions(latest, "2.27.0") > 0);
|
|
1766
1767
|
return {
|
|
1767
1768
|
current: KIT_VERSION,
|
|
1768
1769
|
latest,
|
|
@@ -1827,7 +1828,7 @@ function NcfKitUpdate(props) {
|
|
|
1827
1828
|
padding: props.inline ? 2 : 3,
|
|
1828
1829
|
icon: ArrowUpIcon,
|
|
1829
1830
|
text: `Kit ${update.latest}`,
|
|
1830
|
-
title: `
|
|
1831
|
+
title: `A newer version of the kit is available (you are running ${update.current})`,
|
|
1831
1832
|
justify: props.inline ? void 0 : "flex-start",
|
|
1832
1833
|
onClick: toggle
|
|
1833
1834
|
}),
|
|
@@ -1843,13 +1844,13 @@ function NcfKitUpdate(props) {
|
|
|
1843
1844
|
children: [
|
|
1844
1845
|
"Kit ",
|
|
1845
1846
|
update.latest,
|
|
1846
|
-
"
|
|
1847
|
+
" available"
|
|
1847
1848
|
]
|
|
1848
1849
|
}), /* @__PURE__ */ jsxs(Text, {
|
|
1849
1850
|
size: 0,
|
|
1850
1851
|
muted: !0,
|
|
1851
1852
|
children: [
|
|
1852
|
-
"
|
|
1853
|
+
"You are running ",
|
|
1853
1854
|
update.current,
|
|
1854
1855
|
"."
|
|
1855
1856
|
]
|
|
@@ -1877,7 +1878,7 @@ function NcfKitUpdate(props) {
|
|
|
1877
1878
|
fontSize: 1,
|
|
1878
1879
|
padding: 2,
|
|
1879
1880
|
icon: copied ? CheckmarkIcon : CopyIcon,
|
|
1880
|
-
text: copied ? "
|
|
1881
|
+
text: copied ? "Copied" : "Copy command",
|
|
1881
1882
|
onClick: copy
|
|
1882
1883
|
}), /* @__PURE__ */ jsx(Button, {
|
|
1883
1884
|
as: "a",
|
|
@@ -1887,7 +1888,7 @@ function NcfKitUpdate(props) {
|
|
|
1887
1888
|
mode: "bleed",
|
|
1888
1889
|
fontSize: 1,
|
|
1889
1890
|
padding: 2,
|
|
1890
|
-
text: "
|
|
1891
|
+
text: "What's new"
|
|
1891
1892
|
})]
|
|
1892
1893
|
}),
|
|
1893
1894
|
/* @__PURE__ */ jsx(Box, {
|
|
@@ -1899,14 +1900,14 @@ function NcfKitUpdate(props) {
|
|
|
1899
1900
|
size: 0,
|
|
1900
1901
|
muted: !0,
|
|
1901
1902
|
children: [
|
|
1902
|
-
"
|
|
1903
|
+
"Run it in ",
|
|
1903
1904
|
/* @__PURE__ */ jsx("code", { children: "studio/" }),
|
|
1904
|
-
"
|
|
1905
|
+
" then ",
|
|
1905
1906
|
/* @__PURE__ */ jsx("code", { children: "web/" }),
|
|
1906
|
-
",
|
|
1907
|
+
", followed by",
|
|
1907
1908
|
" ",
|
|
1908
1909
|
/* @__PURE__ */ jsx("code", { children: "npx sanity deploy" }),
|
|
1909
|
-
".
|
|
1910
|
+
". The Studio cannot do it itself: it runs in your browser, not on the machine that builds it."
|
|
1910
1911
|
]
|
|
1911
1912
|
})
|
|
1912
1913
|
})
|
|
@@ -1962,12 +1963,12 @@ function NcfToolButtons(props) {
|
|
|
1962
1963
|
id: "ncf-tool-menu-more",
|
|
1963
1964
|
button: /* @__PURE__ */ jsx(Button, {
|
|
1964
1965
|
icon: EllipsisHorizontalIcon,
|
|
1965
|
-
text: "
|
|
1966
|
+
text: "More",
|
|
1966
1967
|
mode: "bleed",
|
|
1967
1968
|
fontSize: 1,
|
|
1968
1969
|
padding: 3,
|
|
1969
1970
|
selected: more.some((t) => t.name === activeToolName),
|
|
1970
|
-
title: `
|
|
1971
|
+
title: `Technical tools (${more.map((t) => t.title || t.name).join(", ")})`
|
|
1971
1972
|
}),
|
|
1972
1973
|
menu: /* @__PURE__ */ jsx(Menu, { children: more.map((tool) => /* @__PURE__ */ jsx(MenuItem, {
|
|
1973
1974
|
as: ToolAnchor,
|
|
@@ -2045,8 +2046,8 @@ function NcfPreviewLauncher(props) {
|
|
|
2045
2046
|
fontSize: 1,
|
|
2046
2047
|
padding: inline ? 2 : 3,
|
|
2047
2048
|
icon: EyeOpenIcon,
|
|
2048
|
-
text: "
|
|
2049
|
-
title: "
|
|
2049
|
+
text: "Preview",
|
|
2050
|
+
title: "Open the site in the preview",
|
|
2050
2051
|
justify: inline ? void 0 : "flex-start",
|
|
2051
2052
|
onClick: toggle
|
|
2052
2053
|
}),
|
|
@@ -2059,7 +2060,7 @@ function NcfPreviewLauncher(props) {
|
|
|
2059
2060
|
children: /* @__PURE__ */ jsx(Text, {
|
|
2060
2061
|
size: 0,
|
|
2061
2062
|
muted: !0,
|
|
2062
|
-
children: "
|
|
2063
|
+
children: "Click: opens in the Studio. The ↗ icon: opens the live site."
|
|
2063
2064
|
})
|
|
2064
2065
|
}), previewTargets(environments, config.previewUrl).map((target) => {
|
|
2065
2066
|
let tone = TARGET_TONES[target.tone];
|
|
@@ -2081,7 +2082,7 @@ function NcfPreviewLauncher(props) {
|
|
|
2081
2082
|
background: tone.background,
|
|
2082
2083
|
color: tone.color
|
|
2083
2084
|
},
|
|
2084
|
-
title: "
|
|
2085
|
+
title: "Open in the Studio (Presentation)",
|
|
2085
2086
|
children: /* @__PURE__ */ jsxs(Stack, {
|
|
2086
2087
|
gap: 1,
|
|
2087
2088
|
style: { minWidth: 0 },
|
|
@@ -2105,8 +2106,8 @@ function NcfPreviewLauncher(props) {
|
|
|
2105
2106
|
padding: 2,
|
|
2106
2107
|
fontSize: 1,
|
|
2107
2108
|
icon: LaunchIcon,
|
|
2108
|
-
title: "
|
|
2109
|
-
"aria-label": `
|
|
2109
|
+
title: "Open the live site in a new tab",
|
|
2110
|
+
"aria-label": `Open ${target.label} in a new tab`,
|
|
2110
2111
|
onClick: () => {
|
|
2111
2112
|
openOnline(target.environment, target.perspective), close();
|
|
2112
2113
|
}
|
|
@@ -2248,7 +2249,7 @@ function pageTypeFor(type, pageTypes) {
|
|
|
2248
2249
|
* qu'une cellule vide.
|
|
2249
2250
|
*/
|
|
2250
2251
|
function formatDocumentValue(value, type, invert = !1) {
|
|
2251
|
-
return value == null ? type === "boolean" && invert ? "
|
|
2252
|
+
return value == null ? type === "boolean" && invert ? "Yes" : "" : type === "boolean" ? (invert ? !value : value) ? "Yes" : "No" : type === "number" ? typeof value == "number" ? String(value) : "" : typeof value == "string" ? value.trim() : typeof value == "number" || typeof value == "boolean" ? String(value) : "";
|
|
2252
2253
|
}
|
|
2253
2254
|
function buildPageRows(docs, config, documentColumns = []) {
|
|
2254
2255
|
return mergeVersions(docs).map((merged) => {
|
|
@@ -2261,7 +2262,7 @@ function buildPageRows(docs, config, documentColumns = []) {
|
|
|
2261
2262
|
return {
|
|
2262
2263
|
id: merged.id,
|
|
2263
2264
|
type: doc._type,
|
|
2264
|
-
title: doc.ncfTitle?.trim() || "
|
|
2265
|
+
title: doc.ncfTitle?.trim() || "Untitled",
|
|
2265
2266
|
path,
|
|
2266
2267
|
url: toUrl(config.previewUrl, path),
|
|
2267
2268
|
locale: doc.ncfLocale ?? null,
|
|
@@ -2525,17 +2526,17 @@ function indexationColumn(noindexFields) {
|
|
|
2525
2526
|
const TABS = [
|
|
2526
2527
|
{
|
|
2527
2528
|
value: "list",
|
|
2528
|
-
label: "
|
|
2529
|
+
label: "List",
|
|
2529
2530
|
icon: DocumentsIcon
|
|
2530
2531
|
},
|
|
2531
2532
|
{
|
|
2532
2533
|
value: "tree",
|
|
2533
|
-
label: "
|
|
2534
|
+
label: "Tree",
|
|
2534
2535
|
icon: ProjectsIcon
|
|
2535
2536
|
},
|
|
2536
2537
|
{
|
|
2537
2538
|
value: "brain",
|
|
2538
|
-
label: "
|
|
2539
|
+
label: "Graph",
|
|
2539
2540
|
icon: CircleIcon
|
|
2540
2541
|
}
|
|
2541
2542
|
];
|
|
@@ -2548,7 +2549,7 @@ function ViewTabs(props) {
|
|
|
2548
2549
|
return /* @__PURE__ */ jsx(Flex, {
|
|
2549
2550
|
gap: 1,
|
|
2550
2551
|
role: "tablist",
|
|
2551
|
-
"aria-label": "
|
|
2552
|
+
"aria-label": "Pages view",
|
|
2552
2553
|
children: TABS.map((tab) => {
|
|
2553
2554
|
let active = props.view === tab.value;
|
|
2554
2555
|
return /* @__PURE__ */ jsx(Button, {
|
|
@@ -2593,7 +2594,7 @@ function PreviewTarget(props) {
|
|
|
2593
2594
|
let { environments, environmentId, perspective, onEnvironment, onPerspective } = props, { onCustomUrl, customUrl, productionUrl } = props, current = environments.find((environment) => environment.id === environmentId), onProduction = !!(current && productionUrl && current.url.replace(/\/+$/, "") === productionUrl.replace(/\/+$/, "")) || current?.id === "production";
|
|
2594
2595
|
return /* @__PURE__ */ jsxs(Box, {
|
|
2595
2596
|
style: { flex: "none" },
|
|
2596
|
-
children: [/* @__PURE__ */ jsx(FieldLabel, { children: "
|
|
2597
|
+
children: [/* @__PURE__ */ jsx(FieldLabel, { children: "Preview" }), /* @__PURE__ */ jsxs(Flex, {
|
|
2597
2598
|
gap: 1,
|
|
2598
2599
|
align: "center",
|
|
2599
2600
|
children: [PERSPECTIVES.map((option) => {
|
|
@@ -2605,7 +2606,7 @@ function PreviewTarget(props) {
|
|
|
2605
2606
|
fontSize: 1,
|
|
2606
2607
|
padding: 2,
|
|
2607
2608
|
text: option.label,
|
|
2608
|
-
title: unavailable ? "
|
|
2609
|
+
title: unavailable ? "Production only shows published content: review drafts on staging." : option.hint,
|
|
2609
2610
|
"aria-pressed": active,
|
|
2610
2611
|
onClick: () => onPerspective(option.id)
|
|
2611
2612
|
}, option.id);
|
|
@@ -2616,8 +2617,8 @@ function PreviewTarget(props) {
|
|
|
2616
2617
|
fontSize: 1,
|
|
2617
2618
|
padding: 2,
|
|
2618
2619
|
icon: EarthGlobeIcon,
|
|
2619
|
-
text: current?.label ?? "
|
|
2620
|
-
title: "
|
|
2620
|
+
text: current?.label ?? "Environment",
|
|
2621
|
+
title: "Site version loaded in the preview",
|
|
2621
2622
|
onClick: toggle
|
|
2622
2623
|
}),
|
|
2623
2624
|
children: ({ close }) => /* @__PURE__ */ jsxs(Stack, {
|
|
@@ -2630,7 +2631,7 @@ function PreviewTarget(props) {
|
|
|
2630
2631
|
children: /* @__PURE__ */ jsx(Text, {
|
|
2631
2632
|
size: 0,
|
|
2632
2633
|
muted: !0,
|
|
2633
|
-
children: "
|
|
2634
|
+
children: "Site version. The data does not change."
|
|
2634
2635
|
})
|
|
2635
2636
|
}),
|
|
2636
2637
|
environments.map((environment) => /* @__PURE__ */ jsx(EnvironmentRow, {
|
|
@@ -2695,7 +2696,7 @@ function EnvironmentRow(props) {
|
|
|
2695
2696
|
size: 0,
|
|
2696
2697
|
muted: !0,
|
|
2697
2698
|
textOverflow: "ellipsis",
|
|
2698
|
-
children: props.isProduction ? "
|
|
2699
|
+
children: props.isProduction ? "public site (no preview)" : hostOf(props.environment.url)
|
|
2699
2700
|
})]
|
|
2700
2701
|
}),
|
|
2701
2702
|
props.onForget && /* @__PURE__ */ jsx(Button, {
|
|
@@ -2703,8 +2704,8 @@ function EnvironmentRow(props) {
|
|
|
2703
2704
|
padding: 1,
|
|
2704
2705
|
fontSize: 0,
|
|
2705
2706
|
icon: CloseIcon,
|
|
2706
|
-
title: "
|
|
2707
|
-
"aria-label": "
|
|
2707
|
+
title: "Forget this address",
|
|
2708
|
+
"aria-label": "Forget this address",
|
|
2708
2709
|
onClick: props.onForget
|
|
2709
2710
|
})
|
|
2710
2711
|
]
|
|
@@ -2731,7 +2732,7 @@ function CustomUrlField(props) {
|
|
|
2731
2732
|
children: [/* @__PURE__ */ jsx("input", {
|
|
2732
2733
|
type: "text",
|
|
2733
2734
|
value,
|
|
2734
|
-
placeholder: props.current ? "
|
|
2735
|
+
placeholder: props.current ? "Other address…" : "Paste a preview URL…",
|
|
2735
2736
|
onChange: (event) => {
|
|
2736
2737
|
setValue(event.currentTarget.value), setRejected(!1);
|
|
2737
2738
|
},
|
|
@@ -2753,7 +2754,7 @@ function CustomUrlField(props) {
|
|
|
2753
2754
|
}), rejected && /* @__PURE__ */ jsx(Text, {
|
|
2754
2755
|
size: 0,
|
|
2755
2756
|
style: { color: "var(--card-badge-critical-dot-color, #e03131)" },
|
|
2756
|
-
children: "
|
|
2757
|
+
children: "Unusable address."
|
|
2757
2758
|
})]
|
|
2758
2759
|
})
|
|
2759
2760
|
});
|
|
@@ -2767,15 +2768,15 @@ const hostOf = (url) => {
|
|
|
2767
2768
|
}, DURATIONS = [
|
|
2768
2769
|
{
|
|
2769
2770
|
days: 1,
|
|
2770
|
-
label: "1
|
|
2771
|
+
label: "1 day"
|
|
2771
2772
|
},
|
|
2772
2773
|
{
|
|
2773
2774
|
days: 7,
|
|
2774
|
-
label: "7
|
|
2775
|
+
label: "7 days"
|
|
2775
2776
|
},
|
|
2776
2777
|
{
|
|
2777
2778
|
days: 30,
|
|
2778
|
-
label: "30
|
|
2779
|
+
label: "30 days"
|
|
2779
2780
|
}
|
|
2780
2781
|
];
|
|
2781
2782
|
/**
|
|
@@ -2828,8 +2829,8 @@ function SharePreview() {
|
|
|
2828
2829
|
fontSize: 1,
|
|
2829
2830
|
padding: 2,
|
|
2830
2831
|
icon: ShareIcon,
|
|
2831
|
-
text: "
|
|
2832
|
-
title: "
|
|
2832
|
+
text: "Share preview",
|
|
2833
|
+
title: "Create a link anyone can open, without an account",
|
|
2833
2834
|
onClick: toggle
|
|
2834
2835
|
}),
|
|
2835
2836
|
children: () => /* @__PURE__ */ jsx(Stack, {
|
|
@@ -2841,20 +2842,20 @@ function SharePreview() {
|
|
|
2841
2842
|
/* @__PURE__ */ jsx(Text, {
|
|
2842
2843
|
size: 1,
|
|
2843
2844
|
weight: "semibold",
|
|
2844
|
-
children: "
|
|
2845
|
+
children: "Nothing to share on the public site"
|
|
2845
2846
|
}),
|
|
2846
2847
|
/* @__PURE__ */ jsx(Text, {
|
|
2847
2848
|
size: 0,
|
|
2848
2849
|
muted: !0,
|
|
2849
|
-
children: "
|
|
2850
|
+
children: "Production never shows drafts: that is what protects your unpublished content. A link to it would show nothing more than an ordinary visit."
|
|
2850
2851
|
}),
|
|
2851
2852
|
/* @__PURE__ */ jsxs(Text, {
|
|
2852
2853
|
size: 0,
|
|
2853
2854
|
muted: !0,
|
|
2854
2855
|
children: [
|
|
2855
|
-
"
|
|
2856
|
-
/* @__PURE__ */ jsx("b", { children: "
|
|
2857
|
-
"
|
|
2856
|
+
"First choose a ",
|
|
2857
|
+
/* @__PURE__ */ jsx("b", { children: "preview" }),
|
|
2858
|
+
" in the environment picker on the left: a declared staging environment, or the address of a branch deployment that you paste there."
|
|
2858
2859
|
]
|
|
2859
2860
|
})
|
|
2860
2861
|
]
|
|
@@ -2863,16 +2864,16 @@ function SharePreview() {
|
|
|
2863
2864
|
size: 0,
|
|
2864
2865
|
muted: !0,
|
|
2865
2866
|
children: [
|
|
2866
|
-
"
|
|
2867
|
-
/* @__PURE__ */ jsx("b", { children: environment?.label ?? "
|
|
2868
|
-
"
|
|
2867
|
+
"A link that opens ",
|
|
2868
|
+
/* @__PURE__ */ jsx("b", { children: environment?.label ?? "the site" }),
|
|
2869
|
+
" and lets you switch between drafts and published content there. Whoever has it needs no account."
|
|
2869
2870
|
]
|
|
2870
2871
|
}),
|
|
2871
2872
|
!link && /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(TextInput, {
|
|
2872
2873
|
fontSize: 1,
|
|
2873
2874
|
padding: 2,
|
|
2874
2875
|
radius: 2,
|
|
2875
|
-
placeholder: "
|
|
2876
|
+
placeholder: "What is this link for? (optional)",
|
|
2876
2877
|
value: label,
|
|
2877
2878
|
onChange: (event) => setLabel(event.currentTarget.value)
|
|
2878
2879
|
}), /* @__PURE__ */ jsx(Flex, {
|
|
@@ -2892,7 +2893,7 @@ function SharePreview() {
|
|
|
2892
2893
|
children: [/* @__PURE__ */ jsx(Spinner, { muted: !0 }), /* @__PURE__ */ jsx(Text, {
|
|
2893
2894
|
size: 1,
|
|
2894
2895
|
muted: !0,
|
|
2895
|
-
children: "
|
|
2896
|
+
children: "Creating…"
|
|
2896
2897
|
})]
|
|
2897
2898
|
}),
|
|
2898
2899
|
error && /* @__PURE__ */ jsx(Card, {
|
|
@@ -2932,13 +2933,13 @@ function SharePreview() {
|
|
|
2932
2933
|
fontSize: 1,
|
|
2933
2934
|
padding: 2,
|
|
2934
2935
|
icon: copied ? CheckmarkIcon : ShareIcon,
|
|
2935
|
-
text: copied ? "
|
|
2936
|
+
text: copied ? "Copied" : "Copy link",
|
|
2936
2937
|
onClick: copy
|
|
2937
2938
|
}), /* @__PURE__ */ jsx(Button, {
|
|
2938
2939
|
mode: "bleed",
|
|
2939
2940
|
fontSize: 1,
|
|
2940
2941
|
padding: 2,
|
|
2941
|
-
text: "
|
|
2942
|
+
text: "Another one",
|
|
2942
2943
|
onClick: () => {
|
|
2943
2944
|
setLink(null), setCopied(!1);
|
|
2944
2945
|
}
|
|
@@ -2948,9 +2949,9 @@ function SharePreview() {
|
|
|
2948
2949
|
size: 0,
|
|
2949
2950
|
muted: !0,
|
|
2950
2951
|
children: [
|
|
2951
|
-
"
|
|
2952
|
-
new Date(expiresAt).toLocaleDateString("
|
|
2953
|
-
".
|
|
2952
|
+
"Valid until ",
|
|
2953
|
+
new Date(expiresAt).toLocaleDateString("en-US"),
|
|
2954
|
+
". Can be revoked at any time by NoCode Factory."
|
|
2954
2955
|
]
|
|
2955
2956
|
})
|
|
2956
2957
|
]
|
|
@@ -2970,7 +2971,7 @@ function useTranslationTodos() {
|
|
|
2970
2971
|
});
|
|
2971
2972
|
return useMemo(() => new Map((data ?? []).map((t) => [t.documentId, t.count])), [data]);
|
|
2972
2973
|
}
|
|
2973
|
-
const UNSET_LABEL = "
|
|
2974
|
+
const UNSET_LABEL = "Not set", fieldIdOf = (groupBy) => groupBy.startsWith("field:") ? groupBy.slice(6) : null;
|
|
2974
2975
|
/** Valeur du critère pour une ligne. Chaîne vide = non renseigné. */
|
|
2975
2976
|
function groupValue(row, groupBy, options) {
|
|
2976
2977
|
if (groupBy === "type") return row.type;
|
|
@@ -2984,7 +2985,7 @@ function groupValue(row, groupBy, options) {
|
|
|
2984
2985
|
function describe(value, groupBy, options) {
|
|
2985
2986
|
if (!value) return { label: UNSET_LABEL };
|
|
2986
2987
|
if (groupBy === "status") return { label: STATUS_LABELS[row_status(value)].label };
|
|
2987
|
-
if (groupBy === "indexation") return value === "noindex" ? { label: "
|
|
2988
|
+
if (groupBy === "indexation") return value === "noindex" ? { label: "Not indexable" } : { label: "Indexable" };
|
|
2988
2989
|
if (groupBy === "tag") {
|
|
2989
2990
|
let tag = options.tags.find((t) => t.id === value);
|
|
2990
2991
|
return tag ? {
|
|
@@ -3227,14 +3228,14 @@ function QueryError(props) {
|
|
|
3227
3228
|
children: [
|
|
3228
3229
|
/* @__PURE__ */ jsx(Text, {
|
|
3229
3230
|
weight: "semibold",
|
|
3230
|
-
children: "
|
|
3231
|
+
children: "The query failed."
|
|
3231
3232
|
}),
|
|
3232
3233
|
/* @__PURE__ */ jsx(Text, {
|
|
3233
3234
|
size: 1,
|
|
3234
3235
|
children: props.error.message
|
|
3235
3236
|
}),
|
|
3236
3237
|
/* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(Button, {
|
|
3237
|
-
text: "
|
|
3238
|
+
text: "Retry",
|
|
3238
3239
|
mode: "ghost",
|
|
3239
3240
|
onClick: props.onRetry
|
|
3240
3241
|
}) })
|
|
@@ -3251,7 +3252,7 @@ function StatusBadge(props) {
|
|
|
3251
3252
|
children: label
|
|
3252
3253
|
});
|
|
3253
3254
|
}
|
|
3254
|
-
const formatter = new Intl.DateTimeFormat("
|
|
3255
|
+
const formatter = new Intl.DateTimeFormat("en-US", {
|
|
3255
3256
|
day: "2-digit",
|
|
3256
3257
|
month: "2-digit",
|
|
3257
3258
|
year: "numeric",
|
|
@@ -3332,7 +3333,7 @@ function FieldValue(props) {
|
|
|
3332
3333
|
border: bordered ? `1px solid ${BORDER}` : void 0,
|
|
3333
3334
|
background: bordered ? "var(--card-bg-color)" : void 0
|
|
3334
3335
|
},
|
|
3335
|
-
title: `
|
|
3336
|
+
title: `Change ${(column.label || column.id).toLowerCase()}`,
|
|
3336
3337
|
children: current ? /* @__PURE__ */ jsxs(Fragment, { children: [current.color && /* @__PURE__ */ jsx(Dot, { color: current.color }), /* @__PURE__ */ jsx(Text, {
|
|
3337
3338
|
size: 0,
|
|
3338
3339
|
textOverflow: "ellipsis",
|
|
@@ -3367,7 +3368,7 @@ function OptionEditor(props) {
|
|
|
3367
3368
|
gap: 1,
|
|
3368
3369
|
children: [
|
|
3369
3370
|
onSelect && /* @__PURE__ */ jsx(Option, {
|
|
3370
|
-
label: "
|
|
3371
|
+
label: "No value",
|
|
3371
3372
|
selected: !options.some((option) => option.id === selectedId),
|
|
3372
3373
|
onSelect: () => onSelect("")
|
|
3373
3374
|
}),
|
|
@@ -3376,7 +3377,7 @@ function OptionEditor(props) {
|
|
|
3376
3377
|
children: /* @__PURE__ */ jsx(Text, {
|
|
3377
3378
|
size: 0,
|
|
3378
3379
|
muted: !0,
|
|
3379
|
-
children: "
|
|
3380
|
+
children: "No choices yet."
|
|
3380
3381
|
})
|
|
3381
3382
|
}),
|
|
3382
3383
|
options.map((option) => /* @__PURE__ */ jsx(Option, {
|
|
@@ -3419,7 +3420,7 @@ function Option(props) {
|
|
|
3419
3420
|
children: [
|
|
3420
3421
|
/* @__PURE__ */ jsx(Box, {
|
|
3421
3422
|
onClick: () => props.onColor && setPicking((value) => !value),
|
|
3422
|
-
title: props.onColor ? "
|
|
3423
|
+
title: props.onColor ? "Color" : void 0,
|
|
3423
3424
|
style: {
|
|
3424
3425
|
width: 10,
|
|
3425
3426
|
height: 10,
|
|
@@ -3453,8 +3454,8 @@ function Option(props) {
|
|
|
3453
3454
|
padding: 1,
|
|
3454
3455
|
fontSize: 0,
|
|
3455
3456
|
icon: CloseIcon,
|
|
3456
|
-
title: "
|
|
3457
|
-
"aria-label": "
|
|
3457
|
+
title: "Delete this choice",
|
|
3458
|
+
"aria-label": "Delete this choice",
|
|
3458
3459
|
onClick: props.onRemove
|
|
3459
3460
|
})
|
|
3460
3461
|
]
|
|
@@ -3480,7 +3481,7 @@ function Option(props) {
|
|
|
3480
3481
|
mode: "bleed",
|
|
3481
3482
|
padding: 1,
|
|
3482
3483
|
fontSize: 0,
|
|
3483
|
-
text: "
|
|
3484
|
+
text: "None",
|
|
3484
3485
|
onClick: () => {
|
|
3485
3486
|
props.onColor?.(null), setPicking(!1);
|
|
3486
3487
|
}
|
|
@@ -3507,7 +3508,7 @@ function NewOption(props) {
|
|
|
3507
3508
|
type: "text",
|
|
3508
3509
|
autoFocus: !0,
|
|
3509
3510
|
value: label,
|
|
3510
|
-
placeholder: "
|
|
3511
|
+
placeholder: "Choice name",
|
|
3511
3512
|
onChange: (event) => setLabel(event.currentTarget.value),
|
|
3512
3513
|
onKeyDown: (event) => {
|
|
3513
3514
|
event.key === "Enter" && submit(), event.key === "Escape" && (setLabel(""), setOpen(!1));
|
|
@@ -3537,7 +3538,7 @@ function NewOption(props) {
|
|
|
3537
3538
|
padding: 2,
|
|
3538
3539
|
fontSize: 1,
|
|
3539
3540
|
icon: AddIcon,
|
|
3540
|
-
text: "
|
|
3541
|
+
text: "Add a choice",
|
|
3541
3542
|
style: {
|
|
3542
3543
|
width: "100%",
|
|
3543
3544
|
justifyContent: "flex-start"
|
|
@@ -3567,21 +3568,21 @@ function ColumnHeader(props) {
|
|
|
3567
3568
|
/* @__PURE__ */ jsx(Text, {
|
|
3568
3569
|
size: 0,
|
|
3569
3570
|
muted: !0,
|
|
3570
|
-
children: "
|
|
3571
|
+
children: "Delete?"
|
|
3571
3572
|
}),
|
|
3572
3573
|
/* @__PURE__ */ jsx(Button, {
|
|
3573
3574
|
mode: "bleed",
|
|
3574
3575
|
tone: "critical",
|
|
3575
3576
|
padding: 1,
|
|
3576
3577
|
fontSize: 0,
|
|
3577
|
-
text: "
|
|
3578
|
+
text: "Yes",
|
|
3578
3579
|
onClick: () => onRemove(column.id)
|
|
3579
3580
|
}),
|
|
3580
3581
|
/* @__PURE__ */ jsx(Button, {
|
|
3581
3582
|
mode: "bleed",
|
|
3582
3583
|
padding: 1,
|
|
3583
3584
|
fontSize: 0,
|
|
3584
|
-
text: "
|
|
3585
|
+
text: "No",
|
|
3585
3586
|
onClick: () => setConfirming(!1)
|
|
3586
3587
|
})
|
|
3587
3588
|
]
|
|
@@ -3603,7 +3604,7 @@ function ColumnHeader(props) {
|
|
|
3603
3604
|
weight: "medium",
|
|
3604
3605
|
muted: !0,
|
|
3605
3606
|
textOverflow: "ellipsis",
|
|
3606
|
-
title: "
|
|
3607
|
+
title: "Click to rename",
|
|
3607
3608
|
children: column.label || column.id
|
|
3608
3609
|
})
|
|
3609
3610
|
}), (hovered || managing) && /* @__PURE__ */ jsxs(Flex, {
|
|
@@ -3618,8 +3619,8 @@ function ColumnHeader(props) {
|
|
|
3618
3619
|
padding: 1,
|
|
3619
3620
|
fontSize: 0,
|
|
3620
3621
|
icon: UlistIcon,
|
|
3621
|
-
title: "
|
|
3622
|
-
"aria-label": "
|
|
3622
|
+
title: "Manage choices",
|
|
3623
|
+
"aria-label": "Manage column choices",
|
|
3623
3624
|
onClick: toggle
|
|
3624
3625
|
}),
|
|
3625
3626
|
children: () => /* @__PURE__ */ jsx(OptionEditor, {
|
|
@@ -3632,8 +3633,8 @@ function ColumnHeader(props) {
|
|
|
3632
3633
|
padding: 1,
|
|
3633
3634
|
fontSize: 0,
|
|
3634
3635
|
icon: ChevronLeftIcon,
|
|
3635
|
-
title: "
|
|
3636
|
-
"aria-label": "
|
|
3636
|
+
title: "Move left",
|
|
3637
|
+
"aria-label": "Move column left",
|
|
3637
3638
|
onClick: () => onMove(column.id, -1)
|
|
3638
3639
|
}),
|
|
3639
3640
|
/* @__PURE__ */ jsx(Button, {
|
|
@@ -3641,8 +3642,8 @@ function ColumnHeader(props) {
|
|
|
3641
3642
|
padding: 1,
|
|
3642
3643
|
fontSize: 0,
|
|
3643
3644
|
icon: ChevronRightIcon,
|
|
3644
|
-
title: "
|
|
3645
|
-
"aria-label": "
|
|
3645
|
+
title: "Move right",
|
|
3646
|
+
"aria-label": "Move column right",
|
|
3646
3647
|
onClick: () => onMove(column.id, 1)
|
|
3647
3648
|
}),
|
|
3648
3649
|
/* @__PURE__ */ jsx(Button, {
|
|
@@ -3651,8 +3652,8 @@ function ColumnHeader(props) {
|
|
|
3651
3652
|
fontSize: 0,
|
|
3652
3653
|
icon: CloseIcon,
|
|
3653
3654
|
tone: "critical",
|
|
3654
|
-
title: "
|
|
3655
|
-
"aria-label": "
|
|
3655
|
+
title: "Delete column",
|
|
3656
|
+
"aria-label": "Delete column",
|
|
3656
3657
|
onClick: () => setConfirming(!0)
|
|
3657
3658
|
})
|
|
3658
3659
|
]
|
|
@@ -3667,7 +3668,7 @@ function AddColumn(props) {
|
|
|
3667
3668
|
padding: 1,
|
|
3668
3669
|
fontSize: 0,
|
|
3669
3670
|
icon: AddIcon,
|
|
3670
|
-
text: "
|
|
3671
|
+
text: "Column",
|
|
3671
3672
|
onClick: () => setOpen(!0)
|
|
3672
3673
|
});
|
|
3673
3674
|
let submit = () => {
|
|
@@ -3689,7 +3690,7 @@ function AddColumn(props) {
|
|
|
3689
3690
|
padding: 1,
|
|
3690
3691
|
radius: 2,
|
|
3691
3692
|
autoFocus: !0,
|
|
3692
|
-
placeholder: "
|
|
3693
|
+
placeholder: "Column name",
|
|
3693
3694
|
value: label,
|
|
3694
3695
|
onChange: (event) => setLabel(event.currentTarget.value),
|
|
3695
3696
|
onKeyDown: (event) => {
|
|
@@ -3702,13 +3703,13 @@ function AddColumn(props) {
|
|
|
3702
3703
|
mode: type === "text" ? "default" : "bleed",
|
|
3703
3704
|
padding: 1,
|
|
3704
3705
|
fontSize: 0,
|
|
3705
|
-
text: "
|
|
3706
|
+
text: "Text",
|
|
3706
3707
|
onClick: () => setType("text")
|
|
3707
3708
|
}), /* @__PURE__ */ jsx(Button, {
|
|
3708
3709
|
mode: type === "select" ? "default" : "bleed",
|
|
3709
3710
|
padding: 1,
|
|
3710
3711
|
fontSize: 0,
|
|
3711
|
-
text: "
|
|
3712
|
+
text: "List",
|
|
3712
3713
|
onClick: () => setType("select")
|
|
3713
3714
|
})]
|
|
3714
3715
|
}),
|
|
@@ -3719,13 +3720,13 @@ function AddColumn(props) {
|
|
|
3719
3720
|
tone: "primary",
|
|
3720
3721
|
padding: 1,
|
|
3721
3722
|
fontSize: 0,
|
|
3722
|
-
text: "
|
|
3723
|
+
text: "Add",
|
|
3723
3724
|
onClick: submit
|
|
3724
3725
|
}), /* @__PURE__ */ jsx(Button, {
|
|
3725
3726
|
mode: "bleed",
|
|
3726
3727
|
padding: 1,
|
|
3727
3728
|
fontSize: 0,
|
|
3728
|
-
text: "
|
|
3729
|
+
text: "Cancel",
|
|
3729
3730
|
onClick: () => setOpen(!1)
|
|
3730
3731
|
})]
|
|
3731
3732
|
})
|
|
@@ -3768,7 +3769,7 @@ function PathCell(props) {
|
|
|
3768
3769
|
href: url,
|
|
3769
3770
|
target: "_blank",
|
|
3770
3771
|
rel: "noreferrer",
|
|
3771
|
-
title: `
|
|
3772
|
+
title: `Open ${url}`,
|
|
3772
3773
|
onClick: (event) => {
|
|
3773
3774
|
guarded && (event.preventDefault(), open(environment, {
|
|
3774
3775
|
path: pathnameOf(url),
|
|
@@ -3827,7 +3828,7 @@ function TagCell(props) {
|
|
|
3827
3828
|
...CELL,
|
|
3828
3829
|
cursor: "pointer"
|
|
3829
3830
|
},
|
|
3830
|
-
title: "
|
|
3831
|
+
title: "Change tag",
|
|
3831
3832
|
children: current ? /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(Box, { style: {
|
|
3832
3833
|
width: 6,
|
|
3833
3834
|
height: 6,
|
|
@@ -3847,7 +3848,7 @@ function TagCell(props) {
|
|
|
3847
3848
|
children: ({ close }) => /* @__PURE__ */ jsxs(Stack, {
|
|
3848
3849
|
gap: 0,
|
|
3849
3850
|
children: [/* @__PURE__ */ jsx(TagOption, {
|
|
3850
|
-
label: "
|
|
3851
|
+
label: "No tag",
|
|
3851
3852
|
selected: !current,
|
|
3852
3853
|
onClick: () => {
|
|
3853
3854
|
onChange(null), close();
|
|
@@ -3907,28 +3908,28 @@ function TagOption(props) {
|
|
|
3907
3908
|
const BASE_COLUMNS = [
|
|
3908
3909
|
{
|
|
3909
3910
|
key: "title",
|
|
3910
|
-
label: "
|
|
3911
|
+
label: "Title",
|
|
3911
3912
|
width: "minmax(180px, 1.6fr)"
|
|
3912
3913
|
},
|
|
3913
3914
|
{
|
|
3914
3915
|
key: "path",
|
|
3915
|
-
label: "
|
|
3916
|
+
label: "Path",
|
|
3916
3917
|
width: "minmax(200px, 2fr)"
|
|
3917
3918
|
},
|
|
3918
3919
|
{
|
|
3919
3920
|
key: "status",
|
|
3920
|
-
label: "
|
|
3921
|
+
label: "Status",
|
|
3921
3922
|
width: "118px"
|
|
3922
3923
|
},
|
|
3923
3924
|
{
|
|
3924
3925
|
key: "blockCount",
|
|
3925
|
-
label: "
|
|
3926
|
+
label: "Blocks",
|
|
3926
3927
|
align: "right",
|
|
3927
3928
|
width: "64px"
|
|
3928
3929
|
},
|
|
3929
3930
|
{
|
|
3930
3931
|
key: "updatedAt",
|
|
3931
|
-
label: "
|
|
3932
|
+
label: "Updated",
|
|
3932
3933
|
width: "132px"
|
|
3933
3934
|
}
|
|
3934
3935
|
];
|
|
@@ -3976,7 +3977,7 @@ function PagesTable(props) {
|
|
|
3976
3977
|
cursor: "pointer",
|
|
3977
3978
|
userSelect: "none"
|
|
3978
3979
|
},
|
|
3979
|
-
title: `
|
|
3980
|
+
title: `Sort by ${column.label.toLowerCase()}`,
|
|
3980
3981
|
children: [/* @__PURE__ */ jsx(Text, {
|
|
3981
3982
|
size: 0,
|
|
3982
3983
|
weight: "medium",
|
|
@@ -3999,7 +4000,7 @@ function PagesTable(props) {
|
|
|
3999
4000
|
size: 0,
|
|
4000
4001
|
weight: "medium",
|
|
4001
4002
|
muted: !0,
|
|
4002
|
-
children: "
|
|
4003
|
+
children: "Tag"
|
|
4003
4004
|
}),
|
|
4004
4005
|
columns.map((column) => /* @__PURE__ */ jsx(ColumnHeader, {
|
|
4005
4006
|
column,
|
|
@@ -4092,7 +4093,7 @@ function PagesTable(props) {
|
|
|
4092
4093
|
cursor: "pointer"
|
|
4093
4094
|
},
|
|
4094
4095
|
onClick: () => onOpen(entryRow),
|
|
4095
|
-
title: "
|
|
4096
|
+
title: "Open in Presentation",
|
|
4096
4097
|
children: /* @__PURE__ */ jsx(Text, {
|
|
4097
4098
|
size: 1,
|
|
4098
4099
|
weight: "medium",
|
|
@@ -4121,13 +4122,13 @@ function PagesTable(props) {
|
|
|
4121
4122
|
!!todos?.get(entryRow.id) && /* @__PURE__ */ jsxs(Badge, {
|
|
4122
4123
|
tone: "caution",
|
|
4123
4124
|
fontSize: 0,
|
|
4124
|
-
title: "
|
|
4125
|
-
children: ["
|
|
4125
|
+
title: "Fields changed in the main version, not yet translated (marked \"To translate\" in the form)",
|
|
4126
|
+
children: ["To translate · ", todos?.get(entryRow.id)]
|
|
4126
4127
|
}),
|
|
4127
4128
|
entryRow.noindex && /* @__PURE__ */ jsx(Badge, {
|
|
4128
4129
|
tone: "caution",
|
|
4129
4130
|
fontSize: 0,
|
|
4130
|
-
title: "
|
|
4131
|
+
title: "Excluded from Google, the sitemap and llms.txt",
|
|
4131
4132
|
children: "Noindex"
|
|
4132
4133
|
})
|
|
4133
4134
|
]
|
|
@@ -4206,7 +4207,7 @@ function PagesToolbar(props) {
|
|
|
4206
4207
|
children: /* @__PURE__ */ jsx(TextInput, {
|
|
4207
4208
|
value: props.search,
|
|
4208
4209
|
onChange: (event) => props.onSearch(event.currentTarget.value),
|
|
4209
|
-
placeholder: "
|
|
4210
|
+
placeholder: "Search a title or a path",
|
|
4210
4211
|
icon: SearchIcon,
|
|
4211
4212
|
clearButton: props.search.length > 0,
|
|
4212
4213
|
onClear: () => props.onSearch(""),
|
|
@@ -4221,8 +4222,8 @@ function PagesToolbar(props) {
|
|
|
4221
4222
|
tone: "default",
|
|
4222
4223
|
fontSize: 1,
|
|
4223
4224
|
padding: 2,
|
|
4224
|
-
title: "
|
|
4225
|
-
"aria-label": "
|
|
4225
|
+
title: "Refresh",
|
|
4226
|
+
"aria-label": "Refresh",
|
|
4226
4227
|
onClick: props.onRefresh,
|
|
4227
4228
|
disabled: props.busy
|
|
4228
4229
|
})
|
|
@@ -4233,24 +4234,24 @@ function PagesToolbar(props) {
|
|
|
4233
4234
|
const HIDEABLE = [
|
|
4234
4235
|
{
|
|
4235
4236
|
key: "status",
|
|
4236
|
-
label: "
|
|
4237
|
+
label: "Status"
|
|
4237
4238
|
},
|
|
4238
4239
|
{
|
|
4239
4240
|
key: "blockCount",
|
|
4240
|
-
label: "
|
|
4241
|
+
label: "Blocks"
|
|
4241
4242
|
},
|
|
4242
4243
|
{
|
|
4243
4244
|
key: "updatedAt",
|
|
4244
|
-
label: "
|
|
4245
|
+
label: "Updated"
|
|
4245
4246
|
},
|
|
4246
4247
|
{
|
|
4247
4248
|
key: "tag",
|
|
4248
|
-
label: "
|
|
4249
|
+
label: "Tag"
|
|
4249
4250
|
}
|
|
4250
4251
|
];
|
|
4251
4252
|
/** Choix des colonnes affichées, sans quitter le tableau. */
|
|
4252
4253
|
function ColumnVisibility(props) {
|
|
4253
|
-
let { hidden, onToggle, dataColumns, shownData, onToggleData } = props, hiddenCount = HIDEABLE.filter((column) => hidden.has(column.key)).length, shownCount = dataColumns.filter((column) => shownData.has(column.key)).length, label = hiddenCount > 0 ? `
|
|
4254
|
+
let { hidden, onToggle, dataColumns, shownData, onToggleData } = props, hiddenCount = HIDEABLE.filter((column) => hidden.has(column.key)).length, shownCount = dataColumns.filter((column) => shownData.has(column.key)).length, label = hiddenCount > 0 ? `Columns · ${hiddenCount} hidden` : shownCount > 0 ? `Columns · +${shownCount}` : "Columns";
|
|
4254
4255
|
return /* @__PURE__ */ jsx(InlinePopover, {
|
|
4255
4256
|
width: 264,
|
|
4256
4257
|
trigger: ({ toggle }) => /* @__PURE__ */ jsx(Button, {
|
|
@@ -4328,7 +4329,7 @@ function DataColumnList(props) {
|
|
|
4328
4329
|
size: 0,
|
|
4329
4330
|
weight: "semibold",
|
|
4330
4331
|
muted: !0,
|
|
4331
|
-
children: "
|
|
4332
|
+
children: "Page data"
|
|
4332
4333
|
})
|
|
4333
4334
|
}),
|
|
4334
4335
|
dataColumns.length > 8 && /* @__PURE__ */ jsx(Box, {
|
|
@@ -4337,7 +4338,7 @@ function DataColumnList(props) {
|
|
|
4337
4338
|
children: /* @__PURE__ */ jsx("input", {
|
|
4338
4339
|
type: "text",
|
|
4339
4340
|
value: filter,
|
|
4340
|
-
placeholder: "
|
|
4341
|
+
placeholder: "Filter…",
|
|
4341
4342
|
onChange: (event) => setFilter(event.currentTarget.value),
|
|
4342
4343
|
style: {
|
|
4343
4344
|
width: "100%",
|
|
@@ -4362,7 +4363,7 @@ function DataColumnList(props) {
|
|
|
4362
4363
|
children: /* @__PURE__ */ jsx(Text, {
|
|
4363
4364
|
size: 0,
|
|
4364
4365
|
muted: !0,
|
|
4365
|
-
children: "
|
|
4366
|
+
children: "No matching fields."
|
|
4366
4367
|
})
|
|
4367
4368
|
})
|
|
4368
4369
|
] })]
|
|
@@ -4422,7 +4423,7 @@ function PagePanel(props) {
|
|
|
4422
4423
|
padding: 1,
|
|
4423
4424
|
fontSize: 0,
|
|
4424
4425
|
icon: CloseIcon,
|
|
4425
|
-
"aria-label": "
|
|
4426
|
+
"aria-label": "Close",
|
|
4426
4427
|
onClick: onClose
|
|
4427
4428
|
})]
|
|
4428
4429
|
}),
|
|
@@ -4453,7 +4454,7 @@ function PagePanel(props) {
|
|
|
4453
4454
|
size: 0,
|
|
4454
4455
|
muted: !0,
|
|
4455
4456
|
align: "center",
|
|
4456
|
-
children: failed ? "
|
|
4457
|
+
children: failed ? "Screenshot not generated" : "No screenshot"
|
|
4457
4458
|
})
|
|
4458
4459
|
})
|
|
4459
4460
|
}),
|
|
@@ -4488,9 +4489,9 @@ function PagePanel(props) {
|
|
|
4488
4489
|
muted: !0,
|
|
4489
4490
|
children: [
|
|
4490
4491
|
incoming,
|
|
4491
|
-
"
|
|
4492
|
+
" incoming link(s) · ",
|
|
4492
4493
|
outgoing,
|
|
4493
|
-
"
|
|
4494
|
+
" outgoing"
|
|
4494
4495
|
]
|
|
4495
4496
|
}),
|
|
4496
4497
|
/* @__PURE__ */ jsxs(Stack, {
|
|
@@ -4499,14 +4500,14 @@ function PagePanel(props) {
|
|
|
4499
4500
|
size: 0,
|
|
4500
4501
|
weight: "semibold",
|
|
4501
4502
|
muted: !0,
|
|
4502
|
-
children: "
|
|
4503
|
+
children: "Tag"
|
|
4503
4504
|
}), /* @__PURE__ */ jsxs(Select, {
|
|
4504
4505
|
fontSize: 1,
|
|
4505
4506
|
value: tag ?? "",
|
|
4506
4507
|
onChange: (event) => onTag(row.id, event.currentTarget.value || null),
|
|
4507
4508
|
children: [/* @__PURE__ */ jsx("option", {
|
|
4508
4509
|
value: "",
|
|
4509
|
-
children: "
|
|
4510
|
+
children: "No tag"
|
|
4510
4511
|
}), tags.map((option) => /* @__PURE__ */ jsx("option", {
|
|
4511
4512
|
value: option.id,
|
|
4512
4513
|
children: option.label
|
|
@@ -4519,7 +4520,7 @@ function PagePanel(props) {
|
|
|
4519
4520
|
size: 0,
|
|
4520
4521
|
weight: "semibold",
|
|
4521
4522
|
muted: !0,
|
|
4522
|
-
children: "
|
|
4523
|
+
children: "Internal management"
|
|
4523
4524
|
}), columns.map((column) => /* @__PURE__ */ jsxs(Flex, {
|
|
4524
4525
|
align: "center",
|
|
4525
4526
|
gap: 2,
|
|
@@ -4557,8 +4558,8 @@ function PagePanel(props) {
|
|
|
4557
4558
|
mode: "default",
|
|
4558
4559
|
fontSize: 1,
|
|
4559
4560
|
padding: 2,
|
|
4560
|
-
text: "
|
|
4561
|
-
title: "
|
|
4561
|
+
text: "Open page",
|
|
4562
|
+
title: "Opens in Presentation",
|
|
4562
4563
|
onClick: onOpen
|
|
4563
4564
|
}),
|
|
4564
4565
|
/* @__PURE__ */ jsx(IntentLink, {
|
|
@@ -4572,7 +4573,7 @@ function PagePanel(props) {
|
|
|
4572
4573
|
mode: "ghost",
|
|
4573
4574
|
fontSize: 1,
|
|
4574
4575
|
padding: 2,
|
|
4575
|
-
text: "
|
|
4576
|
+
text: "Edit",
|
|
4576
4577
|
as: "span"
|
|
4577
4578
|
})
|
|
4578
4579
|
}),
|
|
@@ -4591,7 +4592,7 @@ function PagePanel(props) {
|
|
|
4591
4592
|
fontSize: 1,
|
|
4592
4593
|
padding: 2,
|
|
4593
4594
|
icon: LaunchIcon,
|
|
4594
|
-
text: environments.length > 1 ? environment?.label ?? "
|
|
4595
|
+
text: environments.length > 1 ? environment?.label ?? "View" : "View live",
|
|
4595
4596
|
title: siteUrl
|
|
4596
4597
|
})
|
|
4597
4598
|
]
|
|
@@ -4815,7 +4816,7 @@ function TreeNode(props) {
|
|
|
4815
4816
|
children: /* @__PURE__ */ jsx(Text, {
|
|
4816
4817
|
size: 0,
|
|
4817
4818
|
muted: !0,
|
|
4818
|
-
children: thumbnailFailed ? "
|
|
4819
|
+
children: thumbnailFailed ? "Screenshot not generated" : siteUrl ? "Hover to preview" : "No preview"
|
|
4819
4820
|
})
|
|
4820
4821
|
})]
|
|
4821
4822
|
}), /* @__PURE__ */ jsx(Box, {
|
|
@@ -4852,7 +4853,7 @@ function TreeNode(props) {
|
|
|
4852
4853
|
fontSize: Math.round(11 * textScale),
|
|
4853
4854
|
lineHeight: 1.3
|
|
4854
4855
|
},
|
|
4855
|
-
children: tags.find((t) => t.id === tag)?.label ?? "
|
|
4856
|
+
children: tags.find((t) => t.id === tag)?.label ?? "No tag"
|
|
4856
4857
|
}) : /* @__PURE__ */ jsxs(Flex, {
|
|
4857
4858
|
gap: 2,
|
|
4858
4859
|
align: "center",
|
|
@@ -4864,7 +4865,7 @@ function TreeNode(props) {
|
|
|
4864
4865
|
onChange: (event) => onTag(props.id, event.currentTarget.value || null),
|
|
4865
4866
|
children: [/* @__PURE__ */ jsx("option", {
|
|
4866
4867
|
value: "",
|
|
4867
|
-
children: "
|
|
4868
|
+
children: "No tag"
|
|
4868
4869
|
}), tags.map((option) => /* @__PURE__ */ jsx("option", {
|
|
4869
4870
|
value: option.id,
|
|
4870
4871
|
children: option.label
|
|
@@ -4949,7 +4950,7 @@ function AnnotationNodeComponent(props) {
|
|
|
4949
4950
|
opacity: annotation.text ? 1 : .5,
|
|
4950
4951
|
overflow: "hidden"
|
|
4951
4952
|
},
|
|
4952
|
-
children: annotation.text || "Double-
|
|
4953
|
+
children: annotation.text || "Double-click to write"
|
|
4953
4954
|
}), props.selected && /* @__PURE__ */ jsxs(Flex, {
|
|
4954
4955
|
gap: 1,
|
|
4955
4956
|
style: {
|
|
@@ -4974,8 +4975,8 @@ function AnnotationNodeComponent(props) {
|
|
|
4974
4975
|
fontSize: 0,
|
|
4975
4976
|
icon: TrashIcon,
|
|
4976
4977
|
tone: "critical",
|
|
4977
|
-
title: "
|
|
4978
|
-
"aria-label": "
|
|
4978
|
+
title: "Delete annotation",
|
|
4979
|
+
"aria-label": "Delete annotation",
|
|
4979
4980
|
onClick: () => onRemove(annotation.id)
|
|
4980
4981
|
})]
|
|
4981
4982
|
})]
|
|
@@ -5289,7 +5290,7 @@ function Board(props) {
|
|
|
5289
5290
|
children: [/* @__PURE__ */ jsx(Spinner, { muted: !0 }), /* @__PURE__ */ jsx(Text, {
|
|
5290
5291
|
size: 1,
|
|
5291
5292
|
muted: !0,
|
|
5292
|
-
children: "
|
|
5293
|
+
children: "Analyzing links between pages…"
|
|
5293
5294
|
})]
|
|
5294
5295
|
});
|
|
5295
5296
|
let size = defaultNodeSize(mode, !!config.pageThumbnail), legend = colorBy === "tag" ? config.boardTags.map((tag) => ({
|
|
@@ -5331,7 +5332,7 @@ function Board(props) {
|
|
|
5331
5332
|
onChange: (event) => setTagFilter(event.currentTarget.value),
|
|
5332
5333
|
children: [/* @__PURE__ */ jsx("option", {
|
|
5333
5334
|
value: "",
|
|
5334
|
-
children: "
|
|
5335
|
+
children: "All tags"
|
|
5335
5336
|
}), config.boardTags.map((tag) => /* @__PURE__ */ jsx("option", {
|
|
5336
5337
|
value: tag.id,
|
|
5337
5338
|
children: tag.label
|
|
@@ -5351,7 +5352,7 @@ function Board(props) {
|
|
|
5351
5352
|
}),
|
|
5352
5353
|
/* @__PURE__ */ jsx(Button, {
|
|
5353
5354
|
icon: AddIcon,
|
|
5354
|
-
text: "
|
|
5355
|
+
text: "Shape",
|
|
5355
5356
|
mode: "ghost",
|
|
5356
5357
|
fontSize: 1,
|
|
5357
5358
|
padding: 2,
|
|
@@ -5361,7 +5362,7 @@ function Board(props) {
|
|
|
5361
5362
|
}))
|
|
5362
5363
|
}),
|
|
5363
5364
|
/* @__PURE__ */ jsx(Button, {
|
|
5364
|
-
text: arranging ? "
|
|
5365
|
+
text: arranging ? "Arranging…" : "Auto arrange",
|
|
5365
5366
|
mode: "ghost",
|
|
5366
5367
|
fontSize: 1,
|
|
5367
5368
|
padding: 2,
|
|
@@ -5375,8 +5376,8 @@ function Board(props) {
|
|
|
5375
5376
|
visibleNodes.length,
|
|
5376
5377
|
" pages · ",
|
|
5377
5378
|
graph.edges.length,
|
|
5378
|
-
"
|
|
5379
|
-
graph.orphans.length > 0 ? ` · ${graph.orphans.length}
|
|
5379
|
+
" links",
|
|
5380
|
+
graph.orphans.length > 0 ? ` · ${graph.orphans.length} without any link` : ""
|
|
5380
5381
|
]
|
|
5381
5382
|
})
|
|
5382
5383
|
]
|
|
@@ -5387,7 +5388,7 @@ function Board(props) {
|
|
|
5387
5388
|
tone: "critical",
|
|
5388
5389
|
children: /* @__PURE__ */ jsxs(Text, {
|
|
5389
5390
|
size: 1,
|
|
5390
|
-
children: ["
|
|
5391
|
+
children: ["The layout could not be saved: ", saveError.message]
|
|
5391
5392
|
})
|
|
5392
5393
|
}),
|
|
5393
5394
|
graph.duplicatePaths.length > 0 && /* @__PURE__ */ jsx(Card, {
|
|
@@ -5397,9 +5398,9 @@ function Board(props) {
|
|
|
5397
5398
|
children: /* @__PURE__ */ jsxs(Text, {
|
|
5398
5399
|
size: 1,
|
|
5399
5400
|
children: [
|
|
5400
|
-
"
|
|
5401
|
+
"Several pages share the same path (",
|
|
5401
5402
|
graph.duplicatePaths.join(", "),
|
|
5402
|
-
").
|
|
5403
|
+
"). A link to this path can only point to one of them."
|
|
5403
5404
|
]
|
|
5404
5405
|
})
|
|
5405
5406
|
}),
|
|
@@ -5497,7 +5498,7 @@ function Board(props) {
|
|
|
5497
5498
|
}, item.key)), /* @__PURE__ */ jsxs(Text, {
|
|
5498
5499
|
size: 0,
|
|
5499
5500
|
muted: !0,
|
|
5500
|
-
children: [legend.length === 0 ? "
|
|
5501
|
+
children: [legend.length === 0 ? "Color derived from the entered value · " : "· ", "click for details, double-click to open the page"]
|
|
5501
5502
|
})]
|
|
5502
5503
|
})
|
|
5503
5504
|
]
|
|
@@ -5553,17 +5554,17 @@ function PagesTool() {
|
|
|
5553
5554
|
let colorOptions = [
|
|
5554
5555
|
{
|
|
5555
5556
|
value: "tag",
|
|
5556
|
-
label: "
|
|
5557
|
+
label: "Tag"
|
|
5557
5558
|
},
|
|
5558
5559
|
{
|
|
5559
5560
|
value: "status",
|
|
5560
|
-
label: "
|
|
5561
|
+
label: "Status"
|
|
5561
5562
|
},
|
|
5562
5563
|
...columns.map((field) => ({
|
|
5563
5564
|
value: `field:${field.id}`,
|
|
5564
5565
|
label: field.label || field.id
|
|
5565
5566
|
}))
|
|
5566
|
-
], summary = visible.length === rows.length ? `${rows.length} page${rows.length > 1 ? "s" : ""}` : `${visible.length}
|
|
5567
|
+
], summary = visible.length === rows.length ? `${rows.length} page${rows.length > 1 ? "s" : ""}` : `${visible.length} of ${rows.length}`, loadingState = /* @__PURE__ */ jsxs(Flex, {
|
|
5567
5568
|
align: "center",
|
|
5568
5569
|
justify: "center",
|
|
5569
5570
|
padding: 6,
|
|
@@ -5571,7 +5572,7 @@ function PagesTool() {
|
|
|
5571
5572
|
children: [/* @__PURE__ */ jsx(Spinner, { muted: !0 }), /* @__PURE__ */ jsx(Text, {
|
|
5572
5573
|
size: 1,
|
|
5573
5574
|
muted: !0,
|
|
5574
|
-
children: "
|
|
5575
|
+
children: "Loading pages…"
|
|
5575
5576
|
})]
|
|
5576
5577
|
});
|
|
5577
5578
|
return /* @__PURE__ */ jsxs(Stack, {
|
|
@@ -5625,7 +5626,7 @@ function PagesTool() {
|
|
|
5625
5626
|
width: 120,
|
|
5626
5627
|
flex: "none"
|
|
5627
5628
|
},
|
|
5628
|
-
children: [/* @__PURE__ */ jsx(FieldLabel, { children: "
|
|
5629
|
+
children: [/* @__PURE__ */ jsx(FieldLabel, { children: "Language" }), /* @__PURE__ */ jsxs(Select, {
|
|
5629
5630
|
fontSize: 1,
|
|
5630
5631
|
radius: 2,
|
|
5631
5632
|
value: locale,
|
|
@@ -5634,7 +5635,7 @@ function PagesTool() {
|
|
|
5634
5635
|
},
|
|
5635
5636
|
children: [/* @__PURE__ */ jsx("option", {
|
|
5636
5637
|
value: "",
|
|
5637
|
-
children: "
|
|
5638
|
+
children: "All"
|
|
5638
5639
|
}), locales.map((code) => /* @__PURE__ */ jsx("option", {
|
|
5639
5640
|
value: code,
|
|
5640
5641
|
children: code.toUpperCase()
|
|
@@ -5646,7 +5647,7 @@ function PagesTool() {
|
|
|
5646
5647
|
width: 150,
|
|
5647
5648
|
flex: "none"
|
|
5648
5649
|
},
|
|
5649
|
-
children: [/* @__PURE__ */ jsx(FieldLabel, { children: "
|
|
5650
|
+
children: [/* @__PURE__ */ jsx(FieldLabel, { children: "Translation" }), /* @__PURE__ */ jsxs(Select, {
|
|
5650
5651
|
fontSize: 1,
|
|
5651
5652
|
radius: 2,
|
|
5652
5653
|
value: onlyTodo ? "todo" : "",
|
|
@@ -5655,11 +5656,11 @@ function PagesTool() {
|
|
|
5655
5656
|
},
|
|
5656
5657
|
children: [/* @__PURE__ */ jsx("option", {
|
|
5657
5658
|
value: "",
|
|
5658
|
-
children: "
|
|
5659
|
+
children: "All"
|
|
5659
5660
|
}), /* @__PURE__ */ jsxs("option", {
|
|
5660
5661
|
value: "todo",
|
|
5661
5662
|
children: [
|
|
5662
|
-
"
|
|
5663
|
+
"To translate (",
|
|
5663
5664
|
todos.size,
|
|
5664
5665
|
")"
|
|
5665
5666
|
]
|
|
@@ -5671,7 +5672,7 @@ function PagesTool() {
|
|
|
5671
5672
|
width: 168,
|
|
5672
5673
|
flex: "none"
|
|
5673
5674
|
},
|
|
5674
|
-
children: [/* @__PURE__ */ jsx(FieldLabel, { children: "
|
|
5675
|
+
children: [/* @__PURE__ */ jsx(FieldLabel, { children: "Group by" }), /* @__PURE__ */ jsxs(Select, {
|
|
5675
5676
|
fontSize: 1,
|
|
5676
5677
|
radius: 2,
|
|
5677
5678
|
value: groupBy,
|
|
@@ -5679,15 +5680,15 @@ function PagesTool() {
|
|
|
5679
5680
|
children: [
|
|
5680
5681
|
/* @__PURE__ */ jsx("option", {
|
|
5681
5682
|
value: "none",
|
|
5682
|
-
children: "
|
|
5683
|
+
children: "None"
|
|
5683
5684
|
}),
|
|
5684
5685
|
/* @__PURE__ */ jsx("option", {
|
|
5685
5686
|
value: "tag",
|
|
5686
|
-
children: "
|
|
5687
|
+
children: "Tag"
|
|
5687
5688
|
}),
|
|
5688
5689
|
/* @__PURE__ */ jsx("option", {
|
|
5689
5690
|
value: "status",
|
|
5690
|
-
children: "
|
|
5691
|
+
children: "Status"
|
|
5691
5692
|
}),
|
|
5692
5693
|
/* @__PURE__ */ jsx("option", {
|
|
5693
5694
|
value: "indexation",
|
|
@@ -5709,7 +5710,7 @@ function PagesTool() {
|
|
|
5709
5710
|
width: 168,
|
|
5710
5711
|
flex: "none"
|
|
5711
5712
|
},
|
|
5712
|
-
children: [/* @__PURE__ */ jsx(FieldLabel, { children: "
|
|
5713
|
+
children: [/* @__PURE__ */ jsx(FieldLabel, { children: "Color by" }), /* @__PURE__ */ jsx(Select, {
|
|
5713
5714
|
fontSize: 1,
|
|
5714
5715
|
radius: 2,
|
|
5715
5716
|
value: colorBy,
|
|
@@ -5745,12 +5746,12 @@ function PagesTool() {
|
|
|
5745
5746
|
size: 1,
|
|
5746
5747
|
weight: "medium",
|
|
5747
5748
|
align: "center",
|
|
5748
|
-
children: rows.length === 0 ? "
|
|
5749
|
+
children: rows.length === 0 ? "No pages in this dataset" : "No results"
|
|
5749
5750
|
}), /* @__PURE__ */ jsx(Text, {
|
|
5750
5751
|
size: 1,
|
|
5751
5752
|
muted: !0,
|
|
5752
5753
|
align: "center",
|
|
5753
|
-
children: rows.length === 0 ? `
|
|
5754
|
+
children: rows.length === 0 ? `The kit tracks the types ${config.pageTypeNames.join(", ")}.` : "Try another term or another language, or clear the search."
|
|
5754
5755
|
})]
|
|
5755
5756
|
})
|
|
5756
5757
|
}) : /* @__PURE__ */ jsx(PagesTable, {
|
|
@@ -5789,11 +5790,11 @@ function PagesTool() {
|
|
|
5789
5790
|
}), pageCount > 1 && /* @__PURE__ */ jsxs(Flex, {
|
|
5790
5791
|
gap: 2,
|
|
5791
5792
|
children: [/* @__PURE__ */ jsx(PageStep, {
|
|
5792
|
-
label: "
|
|
5793
|
+
label: "Previous",
|
|
5793
5794
|
disabled: current === 0,
|
|
5794
5795
|
onClick: () => setPage(current - 1)
|
|
5795
5796
|
}), /* @__PURE__ */ jsx(PageStep, {
|
|
5796
|
-
label: "
|
|
5797
|
+
label: "Next",
|
|
5797
5798
|
disabled: current >= pageCount - 1,
|
|
5798
5799
|
onClick: () => setPage(current + 1)
|
|
5799
5800
|
})]
|
|
@@ -5937,7 +5938,7 @@ function useOccurrences() {
|
|
|
5937
5938
|
map.set(id, {
|
|
5938
5939
|
id,
|
|
5939
5940
|
type: doc._type,
|
|
5940
|
-
title: (typeof title == "string" ? title.trim() : "") || "
|
|
5941
|
+
title: (typeof title == "string" ? title.trim() : "") || "Untitled"
|
|
5941
5942
|
});
|
|
5942
5943
|
}
|
|
5943
5944
|
return map;
|
|
@@ -6073,7 +6074,7 @@ function BlockCard(props) {
|
|
|
6073
6074
|
padding: 0,
|
|
6074
6075
|
as: onOpen ? "button" : void 0,
|
|
6075
6076
|
onClick: onOpen,
|
|
6076
|
-
title: onOpen ? "
|
|
6077
|
+
title: onOpen ? "See the real component and set its default values" : void 0,
|
|
6077
6078
|
style: {
|
|
6078
6079
|
height: "100%",
|
|
6079
6080
|
overflow: "hidden",
|
|
@@ -6110,7 +6111,7 @@ function BlockCard(props) {
|
|
|
6110
6111
|
size: 0,
|
|
6111
6112
|
muted: !0,
|
|
6112
6113
|
align: "center",
|
|
6113
|
-
children: failed ? "
|
|
6114
|
+
children: failed ? "Screenshot not found" : "No screenshot"
|
|
6114
6115
|
})
|
|
6115
6116
|
})
|
|
6116
6117
|
}), /* @__PURE__ */ jsx(Box, {
|
|
@@ -6143,7 +6144,7 @@ function BlockCard(props) {
|
|
|
6143
6144
|
...TABULAR,
|
|
6144
6145
|
flex: "none"
|
|
6145
6146
|
},
|
|
6146
|
-
title: unused ? "
|
|
6147
|
+
title: unused ? "Never used" : `${occurrence.count} occurrences`,
|
|
6147
6148
|
children: occurrence.count
|
|
6148
6149
|
})]
|
|
6149
6150
|
})
|
|
@@ -6238,7 +6239,7 @@ function SectionNodeComponent(props) {
|
|
|
6238
6239
|
size: 0,
|
|
6239
6240
|
muted: !0,
|
|
6240
6241
|
align: "center",
|
|
6241
|
-
children: failed ? "
|
|
6242
|
+
children: failed ? "Screenshot not found" : "No screenshot"
|
|
6242
6243
|
})
|
|
6243
6244
|
})
|
|
6244
6245
|
}), /* @__PURE__ */ jsx(Box, {
|
|
@@ -6407,7 +6408,7 @@ function MapCanvas(props) {
|
|
|
6407
6408
|
wrap: "wrap",
|
|
6408
6409
|
children: [
|
|
6409
6410
|
/* @__PURE__ */ jsx(Button, {
|
|
6410
|
-
text: "
|
|
6411
|
+
text: "Auto arrange",
|
|
6411
6412
|
mode: "ghost",
|
|
6412
6413
|
fontSize: 1,
|
|
6413
6414
|
padding: 2,
|
|
@@ -6426,7 +6427,7 @@ function MapCanvas(props) {
|
|
|
6426
6427
|
}),
|
|
6427
6428
|
/* @__PURE__ */ jsx(Button, {
|
|
6428
6429
|
icon: AddIcon,
|
|
6429
|
-
text: "
|
|
6430
|
+
text: "Shape",
|
|
6430
6431
|
mode: "ghost",
|
|
6431
6432
|
fontSize: 1,
|
|
6432
6433
|
padding: 2,
|
|
@@ -6438,7 +6439,7 @@ function MapCanvas(props) {
|
|
|
6438
6439
|
/* @__PURE__ */ jsx(Text, {
|
|
6439
6440
|
size: 0,
|
|
6440
6441
|
muted: !0,
|
|
6441
|
-
children: "
|
|
6442
|
+
children: "Dragging a tile saves its position · clicking shows its pages"
|
|
6442
6443
|
})
|
|
6443
6444
|
]
|
|
6444
6445
|
}),
|
|
@@ -6448,7 +6449,7 @@ function MapCanvas(props) {
|
|
|
6448
6449
|
tone: "critical",
|
|
6449
6450
|
children: /* @__PURE__ */ jsxs(Text, {
|
|
6450
6451
|
size: 1,
|
|
6451
|
-
children: ["
|
|
6452
|
+
children: ["The layout could not be saved: ", saveError.message]
|
|
6452
6453
|
})
|
|
6453
6454
|
}),
|
|
6454
6455
|
/* @__PURE__ */ jsxs(Flex, {
|
|
@@ -6520,22 +6521,22 @@ function MapCanvas(props) {
|
|
|
6520
6521
|
padding: 1,
|
|
6521
6522
|
fontSize: 0,
|
|
6522
6523
|
icon: CloseIcon,
|
|
6523
|
-
"aria-label": "
|
|
6524
|
+
"aria-label": "Close",
|
|
6524
6525
|
onClick: () => setSelected(null)
|
|
6525
6526
|
})]
|
|
6526
6527
|
}),
|
|
6527
6528
|
/* @__PURE__ */ jsx(Text, {
|
|
6528
6529
|
size: 0,
|
|
6529
6530
|
muted: !0,
|
|
6530
|
-
children: selectedEntry.occurrence.count === 0 ? "
|
|
6531
|
+
children: selectedEntry.occurrence.count === 0 ? "Never used on the site." : `${selectedPages.length} page${selectedPages.length > 1 ? "s" : ""} · ${selectedEntry.occurrence.count} instance${selectedEntry.occurrence.count > 1 ? "s" : ""}`
|
|
6531
6532
|
}),
|
|
6532
6533
|
openComponent && /* @__PURE__ */ jsx(Box, { children: /* @__PURE__ */ jsx(Button, {
|
|
6533
6534
|
mode: "default",
|
|
6534
6535
|
tone: "primary",
|
|
6535
6536
|
fontSize: 1,
|
|
6536
6537
|
padding: 2,
|
|
6537
|
-
text: "
|
|
6538
|
-
title: "
|
|
6538
|
+
text: "Open component",
|
|
6539
|
+
title: "Real rendering and default values, side by side",
|
|
6539
6540
|
onClick: () => openComponent(selectedEntry.block.name)
|
|
6540
6541
|
}) }),
|
|
6541
6542
|
/* @__PURE__ */ jsx(Stack, {
|
|
@@ -6573,7 +6574,7 @@ function MapCanvas(props) {
|
|
|
6573
6574
|
fontSize: 1,
|
|
6574
6575
|
padding: 2,
|
|
6575
6576
|
icon: LaunchIcon,
|
|
6576
|
-
text: "
|
|
6577
|
+
text: "View on the design system"
|
|
6577
6578
|
}) })
|
|
6578
6579
|
]
|
|
6579
6580
|
}) : /* @__PURE__ */ jsx(Flex, {
|
|
@@ -6584,7 +6585,7 @@ function MapCanvas(props) {
|
|
|
6584
6585
|
size: 0,
|
|
6585
6586
|
muted: !0,
|
|
6586
6587
|
align: "center",
|
|
6587
|
-
children: "
|
|
6588
|
+
children: "Click a section to open it (real rendering and default values) or go to where it is used in the pages."
|
|
6588
6589
|
})
|
|
6589
6590
|
})
|
|
6590
6591
|
})]
|
|
@@ -6598,19 +6599,19 @@ function SectionsMap(props) {
|
|
|
6598
6599
|
const ORDERS = [
|
|
6599
6600
|
{
|
|
6600
6601
|
value: "type",
|
|
6601
|
-
label: "
|
|
6602
|
+
label: "By type"
|
|
6602
6603
|
},
|
|
6603
6604
|
{
|
|
6604
6605
|
value: "usage",
|
|
6605
|
-
label: "
|
|
6606
|
+
label: "Most used"
|
|
6606
6607
|
},
|
|
6607
6608
|
{
|
|
6608
6609
|
value: "unused",
|
|
6609
|
-
label: "
|
|
6610
|
+
label: "Unused first"
|
|
6610
6611
|
},
|
|
6611
6612
|
{
|
|
6612
6613
|
value: "schema",
|
|
6613
|
-
label: "
|
|
6614
|
+
label: "Schema order"
|
|
6614
6615
|
}
|
|
6615
6616
|
];
|
|
6616
6617
|
function ComponentsTool() {
|
|
@@ -6636,7 +6637,7 @@ function ComponentsTool() {
|
|
|
6636
6637
|
children: [/* @__PURE__ */ jsx(Spinner, { muted: !0 }), /* @__PURE__ */ jsx(Text, {
|
|
6637
6638
|
size: 1,
|
|
6638
6639
|
muted: !0,
|
|
6639
|
-
children: "
|
|
6640
|
+
children: "Analyzing the page builder…"
|
|
6640
6641
|
})]
|
|
6641
6642
|
}) : blockTypes.length === 0 ? /* @__PURE__ */ jsx(Card, {
|
|
6642
6643
|
padding: 4,
|
|
@@ -6647,16 +6648,16 @@ function ComponentsTool() {
|
|
|
6647
6648
|
gap: 3,
|
|
6648
6649
|
children: [/* @__PURE__ */ jsx(Text, {
|
|
6649
6650
|
weight: "semibold",
|
|
6650
|
-
children: "
|
|
6651
|
+
children: "No blocks found."
|
|
6651
6652
|
}), /* @__PURE__ */ jsxs(Text, {
|
|
6652
6653
|
size: 1,
|
|
6653
6654
|
children: [
|
|
6654
|
-
"
|
|
6655
|
+
"The field \"",
|
|
6655
6656
|
config.pageBuilderField,
|
|
6656
|
-
"
|
|
6657
|
+
"\" does not exist on any of the types",
|
|
6657
6658
|
" ",
|
|
6658
6659
|
config.pageTypeNames.join(", "),
|
|
6659
|
-
",
|
|
6660
|
+
", or it is not an array. Check `pageBuilderField` in the ncfKit() call."
|
|
6660
6661
|
]
|
|
6661
6662
|
})]
|
|
6662
6663
|
})
|
|
@@ -6666,7 +6667,7 @@ function ComponentsTool() {
|
|
|
6666
6667
|
/* @__PURE__ */ jsxs(Flex, {
|
|
6667
6668
|
gap: 2,
|
|
6668
6669
|
children: [/* @__PURE__ */ jsx(Button, {
|
|
6669
|
-
text: "
|
|
6670
|
+
text: "Grid",
|
|
6670
6671
|
mode: view === "grid" ? "default" : "ghost",
|
|
6671
6672
|
fontSize: 1,
|
|
6672
6673
|
padding: 2,
|
|
@@ -6689,10 +6690,10 @@ function ComponentsTool() {
|
|
|
6689
6690
|
muted: !0,
|
|
6690
6691
|
children: [
|
|
6691
6692
|
blockTypes.length,
|
|
6692
|
-
"
|
|
6693
|
+
" blocks · ",
|
|
6693
6694
|
scanned,
|
|
6694
|
-
" pages
|
|
6695
|
-
unusedCount > 0 ? ` · ${unusedCount}
|
|
6695
|
+
" pages analyzed",
|
|
6696
|
+
unusedCount > 0 ? ` · ${unusedCount} never used` : ""
|
|
6696
6697
|
]
|
|
6697
6698
|
}), /* @__PURE__ */ jsxs(Flex, {
|
|
6698
6699
|
gap: 2,
|
|
@@ -6704,7 +6705,7 @@ function ComponentsTool() {
|
|
|
6704
6705
|
text: option.label,
|
|
6705
6706
|
onClick: () => setOrder(option.value)
|
|
6706
6707
|
}, option.value)), /* @__PURE__ */ jsx(Button, {
|
|
6707
|
-
text: "
|
|
6708
|
+
text: "Refresh",
|
|
6708
6709
|
mode: "ghost",
|
|
6709
6710
|
fontSize: 1,
|
|
6710
6711
|
padding: 2,
|
|
@@ -6720,9 +6721,9 @@ function ComponentsTool() {
|
|
|
6720
6721
|
children: /* @__PURE__ */ jsxs(Text, {
|
|
6721
6722
|
size: 1,
|
|
6722
6723
|
children: [
|
|
6723
|
-
"
|
|
6724
|
+
"Analysis limited to the first ",
|
|
6724
6725
|
1e3,
|
|
6725
|
-
"
|
|
6726
|
+
" pages: the numbers below are a minimum, not a total."
|
|
6726
6727
|
]
|
|
6727
6728
|
})
|
|
6728
6729
|
}),
|
|
@@ -6734,7 +6735,7 @@ function ComponentsTool() {
|
|
|
6734
6735
|
children: /* @__PURE__ */ jsx(Text, {
|
|
6735
6736
|
size: 1,
|
|
6736
6737
|
muted: !0,
|
|
6737
|
-
children: "
|
|
6738
|
+
children: "Thumbnails disabled: set `previewUrl` in ncfKit() to show the design system screenshots."
|
|
6738
6739
|
})
|
|
6739
6740
|
}),
|
|
6740
6741
|
view === "map" ? /* @__PURE__ */ jsx(SectionsMap, {
|
|
@@ -6764,7 +6765,7 @@ function ComponentsTool() {
|
|
|
6764
6765
|
/** Messages du service, rendus lisibles pour un éditeur. */
|
|
6765
6766
|
function explain(error) {
|
|
6766
6767
|
let code = error instanceof Error ? error.message : String(error);
|
|
6767
|
-
return code === "bad_key" ? "
|
|
6768
|
+
return code === "bad_key" ? "The read key is not recognized: run `npx ncf-kit setup` again in the studio folder, then redeploy it." : code === "project_inactive" ? "The log is not enabled for this project at NoCode Factory: `npx ncf-kit setup` enables it, or contact NoCode Factory." : code === "missing_key" ? "No read key configured." : "The log could not be loaded.";
|
|
6768
6769
|
}
|
|
6769
6770
|
/**
|
|
6770
6771
|
* Frise du journal, la plus récente d'abord.
|
|
@@ -6776,7 +6777,7 @@ function useHistory(documentId) {
|
|
|
6776
6777
|
let history = useKitConfig().history, [events, setEvents] = useState([]), [loading, setLoading] = useState(!1), [error, setError] = useState(null), [hasMore, setHasMore] = useState(!1), [before, setBefore] = useState(void 0), [nonce, setNonce] = useState(0);
|
|
6777
6778
|
return useEffect(() => {
|
|
6778
6779
|
if (!history) {
|
|
6779
|
-
setError("
|
|
6780
|
+
setError("No read key configured.");
|
|
6780
6781
|
return;
|
|
6781
6782
|
}
|
|
6782
6783
|
let controller = new AbortController();
|
|
@@ -7082,7 +7083,7 @@ function Line(props) {
|
|
|
7082
7083
|
* d'avoir à détenir un jeton Sanity par client.
|
|
7083
7084
|
*/
|
|
7084
7085
|
function ActorName(props) {
|
|
7085
|
-
let [user] = useUser(props.actorId ?? ""), label = props.actorName || user?.displayName || (props.actorId ? "
|
|
7086
|
+
let [user] = useUser(props.actorId ?? ""), label = props.actorName || user?.displayName || (props.actorId ? "Unknown account" : "—");
|
|
7086
7087
|
return /* @__PURE__ */ jsx(Text, {
|
|
7087
7088
|
size: 0,
|
|
7088
7089
|
muted: !0,
|
|
@@ -7106,7 +7107,7 @@ function DiffPanel(props) {
|
|
|
7106
7107
|
return setLoading(!0), setError(null), setRestored(null), setConflicts([]), fetchDetail(config.history.endpoint, config.history.projectKey, event.id, controller.signal).then((result) => {
|
|
7107
7108
|
controller.signal.aborted || setDetail(result);
|
|
7108
7109
|
}).catch(() => {
|
|
7109
|
-
controller.signal.aborted || setError("
|
|
7110
|
+
controller.signal.aborted || setError("This detail could not be loaded.");
|
|
7110
7111
|
}).finally(() => {
|
|
7111
7112
|
controller.signal.aborted || setLoading(!1);
|
|
7112
7113
|
}), () => controller.abort();
|
|
@@ -7165,7 +7166,7 @@ function DiffPanel(props) {
|
|
|
7165
7166
|
children: [/* @__PURE__ */ jsxs(Text, {
|
|
7166
7167
|
size: 0,
|
|
7167
7168
|
muted: !0,
|
|
7168
|
-
children: [new Date(event.occurred_at).toLocaleString("
|
|
7169
|
+
children: [new Date(event.occurred_at).toLocaleString("en-US"), " ·"]
|
|
7169
7170
|
}), /* @__PURE__ */ jsx(ActorName, {
|
|
7170
7171
|
actorId: event.actor_id,
|
|
7171
7172
|
actorName: event.actor_name
|
|
@@ -7176,7 +7177,7 @@ function DiffPanel(props) {
|
|
|
7176
7177
|
padding: 1,
|
|
7177
7178
|
fontSize: 0,
|
|
7178
7179
|
icon: CloseIcon,
|
|
7179
|
-
"aria-label": "
|
|
7180
|
+
"aria-label": "Close",
|
|
7180
7181
|
onClick: onClose
|
|
7181
7182
|
})]
|
|
7182
7183
|
}),
|
|
@@ -7187,7 +7188,7 @@ function DiffPanel(props) {
|
|
|
7187
7188
|
children: [/* @__PURE__ */ jsx(Spinner, { muted: !0 }), /* @__PURE__ */ jsx(Text, {
|
|
7188
7189
|
size: 1,
|
|
7189
7190
|
muted: !0,
|
|
7190
|
-
children: "
|
|
7191
|
+
children: "Loading…"
|
|
7191
7192
|
})]
|
|
7192
7193
|
}),
|
|
7193
7194
|
error && /* @__PURE__ */ jsx(Card, {
|
|
@@ -7209,17 +7210,17 @@ function DiffPanel(props) {
|
|
|
7209
7210
|
/* @__PURE__ */ jsxs(Text, {
|
|
7210
7211
|
size: 1,
|
|
7211
7212
|
children: [
|
|
7212
|
-
"
|
|
7213
|
-
/* @__PURE__ */ jsx("b", { children: "
|
|
7214
|
-
".
|
|
7215
|
-
/* @__PURE__ */ jsx("b", { children: "
|
|
7213
|
+
"Done ",
|
|
7214
|
+
/* @__PURE__ */ jsx("b", { children: "in the draft" }),
|
|
7215
|
+
". Nothing is live yet: open the document, check it, then ",
|
|
7216
|
+
/* @__PURE__ */ jsx("b", { children: "publish" }),
|
|
7216
7217
|
"."
|
|
7217
7218
|
]
|
|
7218
7219
|
}),
|
|
7219
7220
|
conflicts.length > 0 && /* @__PURE__ */ jsxs(Text, {
|
|
7220
7221
|
size: 1,
|
|
7221
7222
|
children: [
|
|
7222
|
-
"
|
|
7223
|
+
"Not undone, because changed since: ",
|
|
7223
7224
|
conflicts.join(", "),
|
|
7224
7225
|
"."
|
|
7225
7226
|
]
|
|
@@ -7235,7 +7236,7 @@ function DiffPanel(props) {
|
|
|
7235
7236
|
mode: "ghost",
|
|
7236
7237
|
fontSize: 1,
|
|
7237
7238
|
padding: 2,
|
|
7238
|
-
text: "
|
|
7239
|
+
text: "Open draft",
|
|
7239
7240
|
as: "span"
|
|
7240
7241
|
})
|
|
7241
7242
|
})
|
|
@@ -7246,12 +7247,12 @@ function DiffPanel(props) {
|
|
|
7246
7247
|
!detail.previous && /* @__PURE__ */ jsx(Text, {
|
|
7247
7248
|
size: 0,
|
|
7248
7249
|
muted: !0,
|
|
7249
|
-
children: "
|
|
7250
|
+
children: "First known state: everything shows as added."
|
|
7250
7251
|
}),
|
|
7251
7252
|
changes.length === 0 ? /* @__PURE__ */ jsx(Text, {
|
|
7252
7253
|
size: 1,
|
|
7253
7254
|
muted: !0,
|
|
7254
|
-
children: "
|
|
7255
|
+
children: "No content changes, only system fields changed."
|
|
7255
7256
|
}) : /* @__PURE__ */ jsxs(Stack, {
|
|
7256
7257
|
gap: 2,
|
|
7257
7258
|
children: [/* @__PURE__ */ jsxs(Text, {
|
|
@@ -7260,7 +7261,7 @@ function DiffPanel(props) {
|
|
|
7260
7261
|
muted: !0,
|
|
7261
7262
|
children: [
|
|
7262
7263
|
changes.length,
|
|
7263
|
-
"
|
|
7264
|
+
" change",
|
|
7264
7265
|
changes.length > 1 ? "s" : ""
|
|
7265
7266
|
]
|
|
7266
7267
|
}), /* @__PURE__ */ jsx(Card, {
|
|
@@ -7288,13 +7289,13 @@ function DiffPanel(props) {
|
|
|
7288
7289
|
fontSize: 1,
|
|
7289
7290
|
padding: 3,
|
|
7290
7291
|
icon: UndoIcon,
|
|
7291
|
-
text: restoring ? "
|
|
7292
|
+
text: restoring ? "Undoing…" : "Undo this change",
|
|
7292
7293
|
disabled: restoring,
|
|
7293
7294
|
onClick: undo
|
|
7294
7295
|
}), /* @__PURE__ */ jsx(Text, {
|
|
7295
7296
|
size: 0,
|
|
7296
7297
|
muted: !0,
|
|
7297
|
-
children: "
|
|
7298
|
+
children: "Restores the values from before this change, and only those: anything changed afterwards is kept. The result goes into the draft: publish it to put it live."
|
|
7298
7299
|
})]
|
|
7299
7300
|
}), /* @__PURE__ */ jsxs(Stack, {
|
|
7300
7301
|
gap: 2,
|
|
@@ -7304,13 +7305,13 @@ function DiffPanel(props) {
|
|
|
7304
7305
|
fontSize: 1,
|
|
7305
7306
|
padding: 3,
|
|
7306
7307
|
icon: RestoreIcon,
|
|
7307
|
-
text: restoring ? "
|
|
7308
|
+
text: restoring ? "Restoring…" : "Restore the document as it was after this change",
|
|
7308
7309
|
disabled: restoring,
|
|
7309
7310
|
onClick: restore
|
|
7310
7311
|
}), /* @__PURE__ */ jsx(Text, {
|
|
7311
7312
|
size: 0,
|
|
7312
7313
|
muted: !0,
|
|
7313
|
-
children: "
|
|
7314
|
+
children: "Puts the ENTIRE document back in the state that followed this change (more recent changes are lost), in the draft. The published version is not touched until you publish."
|
|
7314
7315
|
})]
|
|
7315
7316
|
})]
|
|
7316
7317
|
})
|
|
@@ -7323,27 +7324,27 @@ function DiffPanel(props) {
|
|
|
7323
7324
|
/** Traduit l'échec d'une restauration en une phrase actionnable. */
|
|
7324
7325
|
function explainRestore(cause) {
|
|
7325
7326
|
let message = cause instanceof Error ? cause.message : String(cause);
|
|
7326
|
-
return /permission|insufficient|not allowed/i.test(message) ? "
|
|
7327
|
+
return /permission|insufficient|not allowed/i.test(message) ? "Your permissions on this dataset do not allow writing this document." : /schema|unknown type|invalid/i.test(message) ? "This state no longer matches the current schema: the type has changed since. It cannot be restored without manual intervention." : `Restore failed, nothing was changed. (${message.slice(0, 120)})`;
|
|
7327
7328
|
}
|
|
7328
7329
|
const OPERATION = {
|
|
7329
7330
|
create: {
|
|
7330
|
-
label: "
|
|
7331
|
+
label: "created",
|
|
7331
7332
|
tone: "positive"
|
|
7332
7333
|
},
|
|
7333
7334
|
update: {
|
|
7334
|
-
label: "
|
|
7335
|
+
label: "updated",
|
|
7335
7336
|
tone: "primary"
|
|
7336
7337
|
},
|
|
7337
7338
|
delete: {
|
|
7338
|
-
label: "
|
|
7339
|
+
label: "deleted",
|
|
7339
7340
|
tone: "critical"
|
|
7340
7341
|
}
|
|
7341
7342
|
}, SCOPES = [{
|
|
7342
7343
|
id: "all",
|
|
7343
|
-
label: "
|
|
7344
|
+
label: "All"
|
|
7344
7345
|
}, {
|
|
7345
7346
|
id: "published",
|
|
7346
|
-
label: "
|
|
7347
|
+
label: "Published"
|
|
7347
7348
|
}];
|
|
7348
7349
|
/** Journal des modifications du dataset, alimenté par les webhooks Sanity. */
|
|
7349
7350
|
function HistoryTool() {
|
|
@@ -7377,7 +7378,7 @@ function HistoryTool() {
|
|
|
7377
7378
|
fontSize: 1,
|
|
7378
7379
|
padding: 3,
|
|
7379
7380
|
radius: 2,
|
|
7380
|
-
placeholder: "
|
|
7381
|
+
placeholder: "Filter by document, type or author…",
|
|
7381
7382
|
value: search,
|
|
7382
7383
|
onChange: (event) => setSearch(event.currentTarget.value)
|
|
7383
7384
|
})
|
|
@@ -7398,7 +7399,7 @@ function HistoryTool() {
|
|
|
7398
7399
|
fontSize: 1,
|
|
7399
7400
|
padding: 3,
|
|
7400
7401
|
icon: RefreshIcon,
|
|
7401
|
-
text: "
|
|
7402
|
+
text: "Refresh",
|
|
7402
7403
|
onClick: refresh
|
|
7403
7404
|
})
|
|
7404
7405
|
]
|
|
@@ -7419,7 +7420,7 @@ function HistoryTool() {
|
|
|
7419
7420
|
children: [/* @__PURE__ */ jsx(Spinner, { muted: !0 }), /* @__PURE__ */ jsx(Text, {
|
|
7420
7421
|
size: 1,
|
|
7421
7422
|
muted: !0,
|
|
7422
|
-
children: "
|
|
7423
|
+
children: "Loading the log…"
|
|
7423
7424
|
})]
|
|
7424
7425
|
}),
|
|
7425
7426
|
!loading && !error && events.length === 0 && /* @__PURE__ */ jsx(Card, {
|
|
@@ -7432,11 +7433,11 @@ function HistoryTool() {
|
|
|
7432
7433
|
children: [/* @__PURE__ */ jsx(Text, {
|
|
7433
7434
|
size: 1,
|
|
7434
7435
|
weight: "semibold",
|
|
7435
|
-
children: "
|
|
7436
|
+
children: "No changes recorded"
|
|
7436
7437
|
}), /* @__PURE__ */ jsx(Text, {
|
|
7437
7438
|
size: 1,
|
|
7438
7439
|
muted: !0,
|
|
7439
|
-
children: "
|
|
7440
|
+
children: "The log is filled by this project's Sanity webhook. If it was just set up, only upcoming changes will appear: nothing is rebuilt retroactively. Also check that the webhook targets this Studio's dataset."
|
|
7440
7441
|
})]
|
|
7441
7442
|
})
|
|
7442
7443
|
}),
|
|
@@ -7479,7 +7480,7 @@ function HistoryTool() {
|
|
|
7479
7480
|
tone: event.is_draft ? "caution" : "positive",
|
|
7480
7481
|
fontSize: 0,
|
|
7481
7482
|
padding: 1,
|
|
7482
|
-
children: event.is_draft ? "
|
|
7483
|
+
children: event.is_draft ? "draft" : "published"
|
|
7483
7484
|
})
|
|
7484
7485
|
}),
|
|
7485
7486
|
/* @__PURE__ */ jsx(Box, {
|
|
@@ -7510,7 +7511,7 @@ function HistoryTool() {
|
|
|
7510
7511
|
children: /* @__PURE__ */ jsx(Text, {
|
|
7511
7512
|
size: 0,
|
|
7512
7513
|
muted: !0,
|
|
7513
|
-
children: new Date(event.occurred_at).toLocaleString("
|
|
7514
|
+
children: new Date(event.occurred_at).toLocaleString("en-US", {
|
|
7514
7515
|
day: "2-digit",
|
|
7515
7516
|
month: "2-digit",
|
|
7516
7517
|
hour: "2-digit",
|
|
@@ -7528,7 +7529,7 @@ function HistoryTool() {
|
|
|
7528
7529
|
mode: "ghost",
|
|
7529
7530
|
fontSize: 1,
|
|
7530
7531
|
padding: 3,
|
|
7531
|
-
text: loading ? "
|
|
7532
|
+
text: loading ? "Loading…" : "Load more",
|
|
7532
7533
|
disabled: loading,
|
|
7533
7534
|
onClick: loadMore
|
|
7534
7535
|
})
|
|
@@ -7536,7 +7537,7 @@ function HistoryTool() {
|
|
|
7536
7537
|
search && visible.length === 0 && events.length > 0 && /* @__PURE__ */ jsx(Text, {
|
|
7537
7538
|
size: 1,
|
|
7538
7539
|
muted: !0,
|
|
7539
|
-
children: "
|
|
7540
|
+
children: "No matching events. The filter only applies to events already loaded."
|
|
7540
7541
|
})
|
|
7541
7542
|
]
|
|
7542
7543
|
}), selected && /* @__PURE__ */ jsx(DiffPanel, {
|
|
@@ -7555,14 +7556,14 @@ function HistoryTool() {
|
|
|
7555
7556
|
/* @__PURE__ */ jsx(Text, {
|
|
7556
7557
|
size: 1,
|
|
7557
7558
|
weight: "semibold",
|
|
7558
|
-
children: "
|
|
7559
|
+
children: "History not configured"
|
|
7559
7560
|
}),
|
|
7560
7561
|
/* @__PURE__ */ jsxs(Text, {
|
|
7561
7562
|
size: 1,
|
|
7562
7563
|
children: [
|
|
7563
|
-
"
|
|
7564
|
+
"No read key. In the studio folder, the following command enables the project, writes the key to ",
|
|
7564
7565
|
/* @__PURE__ */ jsx("code", { children: ".env" }),
|
|
7565
|
-
"
|
|
7566
|
+
" and creates the log webhook:"
|
|
7566
7567
|
]
|
|
7567
7568
|
}),
|
|
7568
7569
|
/* @__PURE__ */ jsx(Text, {
|
|
@@ -7574,14 +7575,14 @@ function HistoryTool() {
|
|
|
7574
7575
|
size: 0,
|
|
7575
7576
|
muted: !0,
|
|
7576
7577
|
children: [
|
|
7577
|
-
"
|
|
7578
|
+
"Then add ",
|
|
7578
7579
|
/* @__PURE__ */ jsxs("code", { children: [
|
|
7579
7580
|
"history: ",
|
|
7580
7581
|
"{",
|
|
7581
7582
|
"projectKey: process.env.SANITY_STUDIO_NCF_PROJECT_KEY",
|
|
7582
7583
|
"}"
|
|
7583
7584
|
] }),
|
|
7584
|
-
"
|
|
7585
|
+
" to sanity.config.ts and redeploy the studio. Or hide this tab with",
|
|
7585
7586
|
" ",
|
|
7586
7587
|
/* @__PURE__ */ jsxs("code", { children: [
|
|
7587
7588
|
"tools: ",
|
|
@@ -7637,10 +7638,10 @@ function DesignSystemTool() {
|
|
|
7637
7638
|
/* @__PURE__ */ jsx(Text, {
|
|
7638
7639
|
size: 1,
|
|
7639
7640
|
muted: !0,
|
|
7640
|
-
children: available ? `
|
|
7641
|
+
children: available ? `Opens the ${config.componentPreview.path} page in Presentation, with the component default values. A style changed here changes the component everywhere it is not overridden.` : "No component default values document and no previewUrl: nothing to open. See the kit checklist (README)."
|
|
7641
7642
|
}),
|
|
7642
7643
|
available && /* @__PURE__ */ jsx(Flex, { children: /* @__PURE__ */ jsx(Button, {
|
|
7643
|
-
text: "
|
|
7644
|
+
text: "Open design system",
|
|
7644
7645
|
tone: "primary",
|
|
7645
7646
|
fontSize: 1,
|
|
7646
7647
|
onClick: open
|
|
@@ -7649,6 +7650,92 @@ function DesignSystemTool() {
|
|
|
7649
7650
|
})
|
|
7650
7651
|
});
|
|
7651
7652
|
}
|
|
7653
|
+
const isObj$1 = (v) => typeof v == "object" && !!v && !Array.isArray(v);
|
|
7654
|
+
/** Textes d'une valeur, dans l'ordre. */
|
|
7655
|
+
function collectTexts$1(value) {
|
|
7656
|
+
if (typeof value == "string") return [value];
|
|
7657
|
+
if (!Array.isArray(value)) return [];
|
|
7658
|
+
let out = [];
|
|
7659
|
+
for (let item of value) if (typeof item == "string") out.push(item);
|
|
7660
|
+
else if (isObj$1(item) && Array.isArray(item.children)) for (let child of item.children) isObj$1(child) && typeof child.text == "string" && out.push(child.text);
|
|
7661
|
+
return out;
|
|
7662
|
+
}
|
|
7663
|
+
/** La même valeur avec ses textes remplacés (dans l'ordre de `collectTexts`). */
|
|
7664
|
+
function replaceTexts(value, texts) {
|
|
7665
|
+
let i = 0, next = () => texts[i++] ?? "";
|
|
7666
|
+
return typeof value == "string" ? next() : Array.isArray(value) ? value.map((item) => typeof item == "string" ? next() : isObj$1(item) && Array.isArray(item.children) ? {
|
|
7667
|
+
...item,
|
|
7668
|
+
children: item.children.map((child) => isObj$1(child) && typeof child.text == "string" ? {
|
|
7669
|
+
...child,
|
|
7670
|
+
text: next()
|
|
7671
|
+
} : child)
|
|
7672
|
+
} : item) : value;
|
|
7673
|
+
}
|
|
7674
|
+
/** `sections[a].title` → segments (`[x]` : clé d'élément de liste, ou rang). */
|
|
7675
|
+
function parsePathKey(path) {
|
|
7676
|
+
let out = [];
|
|
7677
|
+
for (let m of path.matchAll(/([^.[\]]+)|\[([^\]]+)\]/g)) out.push(m[1] === void 0 ? { item: m[2] } : { field: m[1] });
|
|
7678
|
+
return out;
|
|
7679
|
+
}
|
|
7680
|
+
function itemOf(list, key) {
|
|
7681
|
+
return list.find((i) => isObj$1(i) && i._key === key) ?? (/^\d+$/.test(key) ? list[Number(key)] : void 0);
|
|
7682
|
+
}
|
|
7683
|
+
/** Valeur d'un document au chemin `sections[a].title`. */
|
|
7684
|
+
function valueAtKey(doc, path) {
|
|
7685
|
+
let cur = doc;
|
|
7686
|
+
for (let seg of parsePathKey(path)) {
|
|
7687
|
+
if (cur == null) return;
|
|
7688
|
+
cur = "field" in seg ? isObj$1(cur) ? cur[seg.field] : void 0 : Array.isArray(cur) ? itemOf(cur, seg.item) : void 0;
|
|
7689
|
+
}
|
|
7690
|
+
return cur;
|
|
7691
|
+
}
|
|
7692
|
+
/** Écrit `value` au chemin dans `doc` (modifié sur place). Faux si le chemin n'existe pas. */
|
|
7693
|
+
function setAtKey(doc, path, value) {
|
|
7694
|
+
let segs = parsePathKey(path), cur = doc;
|
|
7695
|
+
for (let n = 0; n < segs.length - 1; n++) {
|
|
7696
|
+
let seg = segs[n];
|
|
7697
|
+
if (cur = "field" in seg ? isObj$1(cur) ? cur[seg.field] : void 0 : Array.isArray(cur) ? itemOf(cur, seg.item) : void 0, cur == null) return !1;
|
|
7698
|
+
}
|
|
7699
|
+
let last = segs[segs.length - 1];
|
|
7700
|
+
return !last || !("field" in last) || !isObj$1(cur) ? !1 : (cur[last.field] = value, !0);
|
|
7701
|
+
}
|
|
7702
|
+
const MESSAGES = {
|
|
7703
|
+
daily_limit: "Daily AI translation limit reached for this project.",
|
|
7704
|
+
project_inactive: "This project is not active in the NCF kit.",
|
|
7705
|
+
bad_key: "This project is not registered in the NCF kit (npx ncf-kit setup).",
|
|
7706
|
+
not_configured: "AI translation is not configured on the NCF kit service.",
|
|
7707
|
+
too_long: "Text too long to translate at once."
|
|
7708
|
+
};
|
|
7709
|
+
async function call(service, from, to, texts) {
|
|
7710
|
+
let response = await fetch(`${service.endpoint}/translate`, {
|
|
7711
|
+
method: "POST",
|
|
7712
|
+
headers: { "content-type": "application/json" },
|
|
7713
|
+
body: JSON.stringify({
|
|
7714
|
+
key: service.projectKey,
|
|
7715
|
+
from,
|
|
7716
|
+
to,
|
|
7717
|
+
texts
|
|
7718
|
+
})
|
|
7719
|
+
}), body = await response.json().catch(() => ({}));
|
|
7720
|
+
if (!response.ok || !Array.isArray(body.texts) || body.texts.length !== texts.length) throw Error(MESSAGES[body.error ?? ""] ?? `AI translation failed (${body.error ?? response.status}).`);
|
|
7721
|
+
return body.texts;
|
|
7722
|
+
}
|
|
7723
|
+
/**
|
|
7724
|
+
* Traduit des valeurs de champs (chaînes ou textes riches) de `from` vers `to` :
|
|
7725
|
+
* mêmes valeurs, textes traduits. Découpe en lots si besoin.
|
|
7726
|
+
*/
|
|
7727
|
+
async function translateValues(service, from, to, values) {
|
|
7728
|
+
let perValue = values.map((v) => collectTexts$1(v)), all = perValue.flat(), translated = [], batch = [], size = 0, flush = async () => {
|
|
7729
|
+
batch.length && (translated.push(...await call(service, from, to, batch)), batch = [], size = 0);
|
|
7730
|
+
};
|
|
7731
|
+
for (let text of all) (batch.length >= 250 || size + text.length > 3e4) && await flush(), batch.push(text), size += text.length;
|
|
7732
|
+
await flush();
|
|
7733
|
+
let offset = 0;
|
|
7734
|
+
return values.map((value, n) => {
|
|
7735
|
+
let count = perValue[n].length, slice = translated.slice(offset, offset + count);
|
|
7736
|
+
return offset += count, count ? replaceTexts(value, slice) : value;
|
|
7737
|
+
});
|
|
7738
|
+
}
|
|
7652
7739
|
const store$1 = /* @__PURE__ */ new Map();
|
|
7653
7740
|
function entryFor$1(client, type, languageField, language) {
|
|
7654
7741
|
let { projectId, dataset } = client.config(), key = `${projectId}:${dataset}:${type}:${language ?? ""}`, entry = store$1.get(key);
|
|
@@ -7757,20 +7844,20 @@ function sameValue(a, b) {
|
|
|
7757
7844
|
}
|
|
7758
7845
|
/** Valeur par défaut lisible, pour la bulle de la pastille. */
|
|
7759
7846
|
function describeValue(value) {
|
|
7760
|
-
if (isEmptyValue(value)) return "
|
|
7761
|
-
if (typeof value == "string") return value.length > 60 ?
|
|
7762
|
-
if (typeof value == "boolean") return value ? "
|
|
7847
|
+
if (isEmptyValue(value)) return "empty (design system value)";
|
|
7848
|
+
if (typeof value == "string") return value.length > 60 ? `"${value.slice(0, 57)}…"` : `"${value}"`;
|
|
7849
|
+
if (typeof value == "boolean") return value ? "Yes" : "No";
|
|
7763
7850
|
if (typeof value == "number") return String(value);
|
|
7764
|
-
if (Array.isArray(value)) return `${value.length}
|
|
7851
|
+
if (Array.isArray(value)) return `${value.length} item${value.length > 1 ? "s" : ""}`;
|
|
7765
7852
|
if (value && typeof value == "object") {
|
|
7766
7853
|
let v = value;
|
|
7767
|
-
if (typeof v.token == "string") return `
|
|
7768
|
-
if (typeof v.customHex == "string") return `
|
|
7769
|
-
if (typeof v.label == "string") return
|
|
7770
|
-
if (v.asset) return "
|
|
7771
|
-
if (typeof v._ref == "string") return "
|
|
7854
|
+
if (typeof v.token == "string") return `color ${v.token}`;
|
|
7855
|
+
if (typeof v.customHex == "string") return `color ${v.customHex}`;
|
|
7856
|
+
if (typeof v.label == "string") return `"${v.label}"`;
|
|
7857
|
+
if (v.asset) return "an image";
|
|
7858
|
+
if (typeof v._ref == "string") return "a document";
|
|
7772
7859
|
}
|
|
7773
|
-
return "
|
|
7860
|
+
return "a value";
|
|
7774
7861
|
}
|
|
7775
7862
|
/**
|
|
7776
7863
|
* Ce que fait « Réinitialiser » : remettre le champ en HÉRITAGE (le vider en
|
|
@@ -7816,7 +7903,28 @@ function createOverrideInput(config) {
|
|
|
7816
7903
|
});
|
|
7817
7904
|
}
|
|
7818
7905
|
function WithDot(props) {
|
|
7819
|
-
let { rel, inList, shortName, parent, ...inputProps } = props, client = useKitClient(), languageField = config.i18n?.field ?? "language", language = useFormValue([languageField]) ?? null,
|
|
7906
|
+
let { rel, inList, shortName, parent, ...inputProps } = props, client = useKitClient(), languageField = config.i18n?.field ?? "language", language = useFormValue([languageField]) ?? null, defaults = useComponentDefaults(client, defaultsType, languageField, language), inherited = defaultValueAt(defaults, shortName, rel), field = rel[rel.length - 1] ?? "", sourceLocale = config.i18n?.defaultsSourceLocale ?? null, sourceDefault = defaultValueAt(useComponentDefaults(client, defaultsType, languageField, sourceLocale), shortName, rel), [translating, setTranslating] = useState(!1), [translateError, setTranslateError] = useState(null), untranslatedDefault = !!(config.history && config.i18n && language && sourceLocale && language !== sourceLocale) && !inputProps.readOnly && isEmptyValue(inputProps.value) && collectTexts$1(sourceDefault).some((t) => t.trim()) && (isEmptyValue(inherited) || JSON.stringify(inherited) === JSON.stringify(sourceDefault)), translateDefault = async () => {
|
|
7907
|
+
let localeId = defaults?._id?.replace(/^drafts\./, "");
|
|
7908
|
+
if (config.history && sourceLocale && language) {
|
|
7909
|
+
setTranslating(!0), setTranslateError(null);
|
|
7910
|
+
try {
|
|
7911
|
+
if (!localeId) throw Error(`No ${language.toUpperCase()} component defaults document.`);
|
|
7912
|
+
let [translated] = await translateValues(config.history, sourceLocale, language, [sourceDefault]), published = await client.getDocument(localeId), path = [shortName, ...rel].map((seg, n) => typeof seg == "number" ? `[${seg}]` : n ? `.${seg}` : seg).join(""), tx = client.transaction();
|
|
7913
|
+
if (published) {
|
|
7914
|
+
let { _rev, _updatedAt, _createdAt, ...copy } = published;
|
|
7915
|
+
tx.createIfNotExists({
|
|
7916
|
+
...copy,
|
|
7917
|
+
_id: `drafts.${localeId}`
|
|
7918
|
+
});
|
|
7919
|
+
}
|
|
7920
|
+
tx.patch(`drafts.${localeId}`, (patch) => patch.set({ [path]: translated })), await tx.commit();
|
|
7921
|
+
} catch (cause) {
|
|
7922
|
+
setTranslateError(cause instanceof Error ? cause.message : String(cause));
|
|
7923
|
+
} finally {
|
|
7924
|
+
setTranslating(!1);
|
|
7925
|
+
}
|
|
7926
|
+
}
|
|
7927
|
+
}, router = useRouter(), inherits = isEmptyValue(inputProps.value) && !isEmptyValue(inherited), st = inputProps.schemaType, freeText = (st.jsonType === "string" || st.jsonType === "number") && !st.options?.list?.length, placeholder = inherits && freeText ? inheritedPlaceholder(inherited) : null, shown = placeholder === null ? inputProps : {
|
|
7820
7928
|
...inputProps,
|
|
7821
7929
|
elementProps: {
|
|
7822
7930
|
...inputProps.elementProps,
|
|
@@ -7829,14 +7937,48 @@ function createOverrideInput(config) {
|
|
|
7829
7937
|
children: [/* @__PURE__ */ jsxs(Box, {
|
|
7830
7938
|
flex: 1,
|
|
7831
7939
|
style: { minWidth: 0 },
|
|
7832
|
-
children: [
|
|
7833
|
-
|
|
7834
|
-
|
|
7835
|
-
|
|
7836
|
-
|
|
7837
|
-
|
|
7940
|
+
children: [
|
|
7941
|
+
inputProps.renderDefault(shown),
|
|
7942
|
+
untranslatedDefault && /* @__PURE__ */ jsxs(Flex, {
|
|
7943
|
+
align: "center",
|
|
7944
|
+
gap: 2,
|
|
7945
|
+
marginTop: 2,
|
|
7946
|
+
wrap: "wrap",
|
|
7947
|
+
children: [
|
|
7948
|
+
/* @__PURE__ */ jsxs(Text, {
|
|
7949
|
+
size: 0,
|
|
7950
|
+
muted: !0,
|
|
7951
|
+
children: [
|
|
7952
|
+
"Default not translated to ",
|
|
7953
|
+
String(language).toUpperCase(),
|
|
7954
|
+
"."
|
|
7955
|
+
]
|
|
7956
|
+
}),
|
|
7957
|
+
/* @__PURE__ */ jsx(Button, {
|
|
7958
|
+
mode: "ghost",
|
|
7959
|
+
tone: "primary",
|
|
7960
|
+
fontSize: 0,
|
|
7961
|
+
padding: 2,
|
|
7962
|
+
text: translating ? "Translating…" : "Translate default with AI",
|
|
7963
|
+
disabled: translating,
|
|
7964
|
+
onClick: () => void translateDefault()
|
|
7965
|
+
}),
|
|
7966
|
+
translateError && /* @__PURE__ */ jsx(Text, {
|
|
7967
|
+
size: 0,
|
|
7968
|
+
style: { color: "var(--card-badge-critical-fg-color, #c00)" },
|
|
7969
|
+
children: translateError
|
|
7970
|
+
})
|
|
7971
|
+
]
|
|
7972
|
+
}),
|
|
7973
|
+
inherits && placeholder === null && /* @__PURE__ */ jsx(Box, {
|
|
7974
|
+
marginTop: 2,
|
|
7975
|
+
children: /* @__PURE__ */ jsxs(Text, {
|
|
7976
|
+
size: 0,
|
|
7977
|
+
muted: !0,
|
|
7978
|
+
children: ["Component default value: ", describeValue(inherited)]
|
|
7979
|
+
})
|
|
7838
7980
|
})
|
|
7839
|
-
|
|
7981
|
+
]
|
|
7840
7982
|
}), override && !inputProps.readOnly && /* @__PURE__ */ jsx(OverrideDot, {
|
|
7841
7983
|
hasDefault: action.kind !== "noDefault",
|
|
7842
7984
|
full: describeValue(inherited),
|
|
@@ -7857,7 +7999,7 @@ function carriesDot(schemaType) {
|
|
|
7857
7999
|
return !1;
|
|
7858
8000
|
}
|
|
7859
8001
|
function OverrideDot(props) {
|
|
7860
|
-
let [hover, setHover] = useState(!1), label = props.hasDefault ? `↺ ${props.short}` : "
|
|
8002
|
+
let [hover, setHover] = useState(!1), label = props.hasDefault ? `↺ ${props.short}` : "No default value";
|
|
7861
8003
|
return /* @__PURE__ */ jsx(Tooltip, {
|
|
7862
8004
|
portal: !0,
|
|
7863
8005
|
placement: "left",
|
|
@@ -7866,7 +8008,7 @@ function OverrideDot(props) {
|
|
|
7866
8008
|
style: { maxWidth: 280 },
|
|
7867
8009
|
children: /* @__PURE__ */ jsx(Text, {
|
|
7868
8010
|
size: 1,
|
|
7869
|
-
children: props.hasDefault ? `
|
|
8011
|
+
children: props.hasDefault ? `Different from the component default value (${props.full}). Click to go back to the default value: the field will follow it, even if it changes.` : "This component has no default value for this field. Click to set it (Components: default values)."
|
|
7870
8012
|
})
|
|
7871
8013
|
}),
|
|
7872
8014
|
children: /* @__PURE__ */ jsx("button", {
|
|
@@ -7876,7 +8018,7 @@ function OverrideDot(props) {
|
|
|
7876
8018
|
onMouseLeave: () => setHover(!1),
|
|
7877
8019
|
onFocus: () => setHover(!0),
|
|
7878
8020
|
onBlur: () => setHover(!1),
|
|
7879
|
-
"aria-label": props.hasDefault ? `
|
|
8021
|
+
"aria-label": props.hasDefault ? `Go back to the component default value: ${props.full}` : "Set the component default value",
|
|
7880
8022
|
style: {
|
|
7881
8023
|
marginTop: 9,
|
|
7882
8024
|
flex: "none",
|
|
@@ -7932,14 +8074,14 @@ const RemoveFromSiteAction = (props) => {
|
|
|
7932
8074
|
}), tx.delete(props.id), await tx.commit(), setOpen(!1), props.onComplete();
|
|
7933
8075
|
} catch (cause) {
|
|
7934
8076
|
let message = cause instanceof Error ? cause.message : String(cause);
|
|
7935
|
-
setError(/referenc/i.test(message) ? "Sanity
|
|
8077
|
+
setError(/referenc/i.test(message) ? "Sanity refused: a published document points to this page with a strong reference. Remove or change that link, then try again." : `Removal failed, nothing was changed. (${message.slice(0, 140)})`);
|
|
7936
8078
|
} finally {
|
|
7937
8079
|
setBusy(!1);
|
|
7938
8080
|
}
|
|
7939
8081
|
};
|
|
7940
8082
|
return {
|
|
7941
|
-
label: "
|
|
7942
|
-
title: "
|
|
8083
|
+
label: "Remove from site",
|
|
8084
|
+
title: "Unpublish: the page leaves the site, its content stays in the draft",
|
|
7943
8085
|
icon: EyeClosedIcon,
|
|
7944
8086
|
tone: "critical",
|
|
7945
8087
|
disabled: busy,
|
|
@@ -7956,16 +8098,16 @@ const RemoveFromSiteAction = (props) => {
|
|
|
7956
8098
|
children: [
|
|
7957
8099
|
/* @__PURE__ */ jsx(Text, {
|
|
7958
8100
|
size: 1,
|
|
7959
|
-
children: "
|
|
8101
|
+
children: "The page leaves the site (production and staging \"Published\"). All its content stays in the draft: to put it back online, publish it."
|
|
7960
8102
|
}),
|
|
7961
8103
|
referrers === null ? /* @__PURE__ */ jsx(Text, {
|
|
7962
8104
|
size: 1,
|
|
7963
8105
|
muted: !0,
|
|
7964
|
-
children: "
|
|
8106
|
+
children: "Looking for links to this page…"
|
|
7965
8107
|
}) : referrers.length > 0 ? /* @__PURE__ */ jsxs(Text, {
|
|
7966
8108
|
size: 1,
|
|
7967
8109
|
children: [
|
|
7968
|
-
"
|
|
8110
|
+
"These published documents point to it; their links to this page will disappear from the site:",
|
|
7969
8111
|
" ",
|
|
7970
8112
|
referrers.map((r) => r.title || r._id).join(", "),
|
|
7971
8113
|
"."
|
|
@@ -7973,7 +8115,7 @@ const RemoveFromSiteAction = (props) => {
|
|
|
7973
8115
|
}) : /* @__PURE__ */ jsx(Text, {
|
|
7974
8116
|
size: 1,
|
|
7975
8117
|
muted: !0,
|
|
7976
|
-
children: "
|
|
8118
|
+
children: "No published document points to this page."
|
|
7977
8119
|
}),
|
|
7978
8120
|
error && /* @__PURE__ */ jsx(Text, {
|
|
7979
8121
|
size: 1,
|
|
@@ -8029,7 +8171,7 @@ function createSlugUrlInput(config) {
|
|
|
8029
8171
|
mode: "ghost",
|
|
8030
8172
|
fontSize: 1,
|
|
8031
8173
|
padding: 2,
|
|
8032
|
-
text: copied ? "
|
|
8174
|
+
text: copied ? "Copied" : "Copy",
|
|
8033
8175
|
onClick: copy
|
|
8034
8176
|
}),
|
|
8035
8177
|
/* @__PURE__ */ jsx(Button, {
|
|
@@ -8040,7 +8182,7 @@ function createSlugUrlInput(config) {
|
|
|
8040
8182
|
mode: "ghost",
|
|
8041
8183
|
fontSize: 1,
|
|
8042
8184
|
padding: 2,
|
|
8043
|
-
text: "
|
|
8185
|
+
text: "Open"
|
|
8044
8186
|
})
|
|
8045
8187
|
]
|
|
8046
8188
|
})
|
|
@@ -8067,7 +8209,7 @@ function entryFor(client, documentId) {
|
|
|
8067
8209
|
}, store.set(key, entry));
|
|
8068
8210
|
let e = entry;
|
|
8069
8211
|
if (!e.stop) {
|
|
8070
|
-
let load = () => client.fetch("*[_id == $id][0]{_id, sourceLanguage, paths}", { id }).then((value) => {
|
|
8212
|
+
let load = () => client.fetch("*[_id == $id][0]{_id, sourceId, sourceLanguage, paths}", { id }).then((value) => {
|
|
8071
8213
|
e.value = value, e.listeners.forEach((l) => l());
|
|
8072
8214
|
}).catch(() => {});
|
|
8073
8215
|
load();
|
|
@@ -8095,40 +8237,74 @@ function fieldPathKey(path) {
|
|
|
8095
8237
|
}
|
|
8096
8238
|
/**
|
|
8097
8239
|
* Sous un champ d'une traduction modifié dans la version principale (propagation) :
|
|
8098
|
-
* « À traduire », avec « Marquer comme traduit » qui le retire de la liste
|
|
8240
|
+
* « À traduire », avec « Marquer comme traduit » qui le retire de la liste, et
|
|
8241
|
+
* « Translate with AI » (service du kit) : traduit le texte de la version principale
|
|
8242
|
+
* dans ce champ (brouillon de cette langue), puis le retire de la liste.
|
|
8099
8243
|
*/
|
|
8100
8244
|
function withTranslationTodo(Inner, config) {
|
|
8101
8245
|
function TranslationTodoInput(props) {
|
|
8102
|
-
let id = useFormValue(["_id"]), client = useKitClient(), todo = useTranslationTodo(client, config.i18n ? id : void 0), [busy, setBusy] = useState(!1), key = fieldPathKey(props.path), inner = createElement(Inner, props), show = !!todo?.paths?.includes(key), done = () => {
|
|
8246
|
+
let id = useFormValue(["_id"]), client = useKitClient(), todo = useTranslationTodo(client, config.i18n ? id : void 0), [busy, setBusy] = useState(!1), [error, setError] = useState(null), language = useFormValue([config.i18n?.field ?? "language"]), key = fieldPathKey(props.path), inner = createElement(Inner, props), show = !!todo?.paths?.includes(key), done = () => {
|
|
8103
8247
|
todo && (setBusy(!0), client.patch(todo._id).set({ paths: (todo.paths ?? []).filter((p) => p !== key) }).commit().finally(() => setBusy(!1)));
|
|
8248
|
+
}, translate = async () => {
|
|
8249
|
+
if (todo?.sourceId && todo.sourceLanguage && language && config.history) {
|
|
8250
|
+
setBusy(!0), setError(null);
|
|
8251
|
+
try {
|
|
8252
|
+
let value = valueAtKey(await client.getDocument(todo.sourceId) ?? await client.getDocument(`drafts.${todo.sourceId}`), key);
|
|
8253
|
+
if (value === void 0) throw Error("Source text not found.");
|
|
8254
|
+
let [translated] = await translateValues(config.history, todo.sourceLanguage, language, [value]);
|
|
8255
|
+
props.onChange(set(translated)), await client.patch(todo._id).set({ paths: (todo.paths ?? []).filter((p) => p !== key) }).commit();
|
|
8256
|
+
} catch (cause) {
|
|
8257
|
+
setError(cause instanceof Error ? cause.message : String(cause));
|
|
8258
|
+
} finally {
|
|
8259
|
+
setBusy(!1);
|
|
8260
|
+
}
|
|
8261
|
+
}
|
|
8104
8262
|
};
|
|
8105
8263
|
return /* @__PURE__ */ jsxs(Stack, {
|
|
8106
8264
|
gap: 2,
|
|
8107
|
-
children: [inner, show && /* @__PURE__ */
|
|
8265
|
+
children: [inner, show && /* @__PURE__ */ jsxs(Card, {
|
|
8108
8266
|
tone: "caution",
|
|
8109
8267
|
padding: 2,
|
|
8110
8268
|
radius: 2,
|
|
8111
8269
|
border: !0,
|
|
8112
|
-
children: /* @__PURE__ */ jsxs(Flex, {
|
|
8270
|
+
children: [/* @__PURE__ */ jsxs(Flex, {
|
|
8113
8271
|
align: "center",
|
|
8114
8272
|
gap: 2,
|
|
8115
|
-
children: [
|
|
8116
|
-
|
|
8117
|
-
|
|
8118
|
-
|
|
8119
|
-
|
|
8120
|
-
|
|
8121
|
-
|
|
8122
|
-
|
|
8123
|
-
|
|
8124
|
-
|
|
8125
|
-
|
|
8126
|
-
|
|
8127
|
-
|
|
8128
|
-
|
|
8129
|
-
|
|
8130
|
-
|
|
8131
|
-
|
|
8273
|
+
children: [
|
|
8274
|
+
/* @__PURE__ */ jsxs(Text, {
|
|
8275
|
+
size: 1,
|
|
8276
|
+
style: { flex: 1 },
|
|
8277
|
+
children: [
|
|
8278
|
+
"To translate: changed in the ",
|
|
8279
|
+
(todo?.sourceLanguage ?? "").toUpperCase(),
|
|
8280
|
+
" version."
|
|
8281
|
+
]
|
|
8282
|
+
}),
|
|
8283
|
+
config.history && !props.readOnly && /* @__PURE__ */ jsx(Button, {
|
|
8284
|
+
tone: "primary",
|
|
8285
|
+
fontSize: 1,
|
|
8286
|
+
padding: 2,
|
|
8287
|
+
text: busy ? "Translating…" : "Translate with AI",
|
|
8288
|
+
disabled: busy,
|
|
8289
|
+
onClick: () => void translate()
|
|
8290
|
+
}),
|
|
8291
|
+
/* @__PURE__ */ jsx(Button, {
|
|
8292
|
+
mode: "ghost",
|
|
8293
|
+
fontSize: 1,
|
|
8294
|
+
padding: 2,
|
|
8295
|
+
text: "Mark as translated",
|
|
8296
|
+
disabled: busy,
|
|
8297
|
+
onClick: done
|
|
8298
|
+
})
|
|
8299
|
+
]
|
|
8300
|
+
}), error && /* @__PURE__ */ jsx(Text, {
|
|
8301
|
+
size: 1,
|
|
8302
|
+
style: {
|
|
8303
|
+
marginTop: 8,
|
|
8304
|
+
color: "var(--card-badge-critical-fg-color, #c00)"
|
|
8305
|
+
},
|
|
8306
|
+
children: error
|
|
8307
|
+
})]
|
|
8132
8308
|
})]
|
|
8133
8309
|
});
|
|
8134
8310
|
}
|
|
@@ -8377,13 +8553,16 @@ function hasChanges(r) {
|
|
|
8377
8553
|
* part normalement, puis « Propager aux autres langues ? » propose d'appliquer aux
|
|
8378
8554
|
* BROUILLONS des traductions la structure (sections ajoutées, supprimées, déplacées)
|
|
8379
8555
|
* et les valeurs non textuelles (images, liens, options…). Les textes traduits ne
|
|
8380
|
-
* sont jamais écrasés : les textes modifiés sont
|
|
8381
|
-
*
|
|
8382
|
-
|
|
8383
|
-
|
|
8384
|
-
|
|
8556
|
+
* sont jamais écrasés à la main : les textes modifiés sont traduits par l'IA
|
|
8557
|
+
* (« Translate with AI », service du kit, coché par défaut) ou marqués « à
|
|
8558
|
+
* traduire ». Rien n'est publié dans les autres langues : on relit, on publie.
|
|
8559
|
+
* `masterLocale` : langue source (défaut : langue principale du site ; les valeurs
|
|
8560
|
+
* par défaut des composants ont la leur, `i18n.defaultsSourceLocale`).
|
|
8561
|
+
*/
|
|
8562
|
+
function withPropagation(Publish, config, masterLocale) {
|
|
8563
|
+
let i18n = config.i18n, master = masterLocale ?? i18n?.defaultLocale, Wrapped = (props) => {
|
|
8385
8564
|
let base = Publish(props), client = useKitClient(), schema = useSchema(), [run, setRun] = useState(null), current = props.draft ?? props.published;
|
|
8386
|
-
return !base || !i18n || current?.[i18n.field] !==
|
|
8565
|
+
return !base || !i18n || current?.[i18n.field] !== master ? base : {
|
|
8387
8566
|
...base,
|
|
8388
8567
|
onHandle: () => {
|
|
8389
8568
|
let before = props.published, after = props.draft;
|
|
@@ -8399,7 +8578,7 @@ function withPropagation(Publish, config) {
|
|
|
8399
8578
|
},
|
|
8400
8579
|
dialog: run ? {
|
|
8401
8580
|
type: "dialog",
|
|
8402
|
-
header: "
|
|
8581
|
+
header: "Propagate to other languages?",
|
|
8403
8582
|
width: "medium",
|
|
8404
8583
|
onClose: () => {
|
|
8405
8584
|
setRun(null), props.onComplete();
|
|
@@ -8437,18 +8616,24 @@ async function findTargets(client, id, source, before, after, documentType) {
|
|
|
8437
8616
|
return list;
|
|
8438
8617
|
}
|
|
8439
8618
|
function PropagateDialog(props) {
|
|
8440
|
-
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), apply = async () => {
|
|
8619
|
+
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 () => {
|
|
8441
8620
|
setBusy(!0), setError(null);
|
|
8442
8621
|
try {
|
|
8443
|
-
let applied = [];
|
|
8622
|
+
let applied = [], translatedCount = 0, aiError = null;
|
|
8444
8623
|
for (let t of targets) {
|
|
8445
8624
|
if (!t.selected) continue;
|
|
8446
|
-
let { _rev, _createdAt, _updatedAt, ...doc } = t.result.document;
|
|
8625
|
+
let { _rev, _createdAt, _updatedAt, ...doc } = t.result.document, remaining = t.result.toTranslate;
|
|
8626
|
+
if (ai && config.history && remaining.length) try {
|
|
8627
|
+
let values = remaining.map((path) => valueAtKey(after, path)), translated = await translateValues(config.history, source, t.language, values);
|
|
8628
|
+
remaining = remaining.filter((path, n) => values[n] === void 0 || !setAtKey(doc, path, translated[n])), translatedCount += t.result.toTranslate.length - remaining.length;
|
|
8629
|
+
} catch (cause) {
|
|
8630
|
+
aiError = cause instanceof Error ? cause.message : String(cause);
|
|
8631
|
+
}
|
|
8447
8632
|
if (await client.createOrReplace({
|
|
8448
8633
|
...doc,
|
|
8449
8634
|
_id: `drafts.${t.id}`,
|
|
8450
8635
|
_type: type
|
|
8451
|
-
}),
|
|
8636
|
+
}), remaining.length) {
|
|
8452
8637
|
let todoId = translationTodoId(t.id), existing = await client.fetch("*[_id == $todoId][0].paths", { todoId });
|
|
8453
8638
|
await client.createOrReplace({
|
|
8454
8639
|
_id: todoId,
|
|
@@ -8456,19 +8641,19 @@ function PropagateDialog(props) {
|
|
|
8456
8641
|
documentId: t.id,
|
|
8457
8642
|
sourceId: id,
|
|
8458
8643
|
sourceLanguage: source,
|
|
8459
|
-
paths: [.../* @__PURE__ */ new Set([...existing ?? [], ...
|
|
8644
|
+
paths: [.../* @__PURE__ */ new Set([...existing ?? [], ...remaining])]
|
|
8460
8645
|
});
|
|
8461
8646
|
}
|
|
8462
8647
|
applied.push(t.language.toUpperCase());
|
|
8463
8648
|
}
|
|
8464
8649
|
toast.push({
|
|
8465
|
-
status: "success",
|
|
8466
|
-
title: `
|
|
8467
|
-
description: "
|
|
8650
|
+
status: aiError ? "warning" : "success",
|
|
8651
|
+
title: `Drafts updated: ${applied.join(", ")}`,
|
|
8652
|
+
description: aiError ? `AI translation failed (${aiError}): the changed texts are marked "To translate".` : translatedCount ? `${translatedCount} text${translatedCount > 1 ? "s" : ""} translated with AI. Review, then publish each language.` : "Translate the fields marked \"To translate\", then publish each language.",
|
|
8468
8653
|
duration: 8e3
|
|
8469
8654
|
}), onDone();
|
|
8470
8655
|
} catch (cause) {
|
|
8471
|
-
setError(`
|
|
8656
|
+
setError(`Propagation failed, nothing was published. (${(cause instanceof Error ? cause.message : String(cause)).slice(0, 140)})`);
|
|
8472
8657
|
} finally {
|
|
8473
8658
|
setBusy(!1);
|
|
8474
8659
|
}
|
|
@@ -8480,11 +8665,25 @@ function PropagateDialog(props) {
|
|
|
8480
8665
|
/* @__PURE__ */ jsxs(Text, {
|
|
8481
8666
|
size: 1,
|
|
8482
8667
|
children: [
|
|
8483
|
-
"
|
|
8668
|
+
"The ",
|
|
8484
8669
|
source.toUpperCase(),
|
|
8485
|
-
"
|
|
8670
|
+
" version is published. Apply its changes to the drafts of the other languages? Changed texts are ",
|
|
8671
|
+
ai ? "translated with AI" : "marked \"To translate\"",
|
|
8672
|
+
". Nothing is published."
|
|
8486
8673
|
]
|
|
8487
8674
|
}),
|
|
8675
|
+
config.history && targets.some((t) => t.result.toTranslate.length) && /* @__PURE__ */ jsxs(Flex, {
|
|
8676
|
+
as: "label",
|
|
8677
|
+
align: "center",
|
|
8678
|
+
gap: 2,
|
|
8679
|
+
children: [/* @__PURE__ */ jsx(Checkbox, {
|
|
8680
|
+
checked: ai,
|
|
8681
|
+
onChange: () => setAi(!ai)
|
|
8682
|
+
}), /* @__PURE__ */ jsx(Text, {
|
|
8683
|
+
size: 1,
|
|
8684
|
+
children: "Translate changed texts with AI"
|
|
8685
|
+
})]
|
|
8686
|
+
}),
|
|
8488
8687
|
/* @__PURE__ */ jsx(Stack, {
|
|
8489
8688
|
gap: 3,
|
|
8490
8689
|
children: targets.map((t, index) => /* @__PURE__ */ jsx(Card, {
|
|
@@ -8532,12 +8731,12 @@ function PropagateDialog(props) {
|
|
|
8532
8731
|
justify: "flex-end",
|
|
8533
8732
|
gap: 2,
|
|
8534
8733
|
children: [/* @__PURE__ */ jsx(Button, {
|
|
8535
|
-
text: "
|
|
8734
|
+
text: "Skip",
|
|
8536
8735
|
mode: "ghost",
|
|
8537
8736
|
onClick: onDone,
|
|
8538
8737
|
disabled: busy
|
|
8539
8738
|
}), /* @__PURE__ */ jsx(Button, {
|
|
8540
|
-
text: busy ? "
|
|
8739
|
+
text: busy ? "Propagating…" : "Propagate",
|
|
8541
8740
|
tone: "primary",
|
|
8542
8741
|
onClick: () => void apply(),
|
|
8543
8742
|
disabled: busy || !targets.some((t) => t.selected)
|
|
@@ -8547,9 +8746,9 @@ function PropagateDialog(props) {
|
|
|
8547
8746
|
});
|
|
8548
8747
|
}
|
|
8549
8748
|
function summary(r) {
|
|
8550
|
-
if (!hasChanges(r)) return "
|
|
8749
|
+
if (!hasChanges(r)) return "Already up to date.";
|
|
8551
8750
|
let parts = [];
|
|
8552
|
-
return r.added && parts.push(`${r.added}
|
|
8751
|
+
return r.added && parts.push(`${r.added} item${r.added > 1 ? "s" : ""} added`), r.removed && parts.push(`${r.removed} removed`), r.moved && parts.push("order updated"), r.copied.length && parts.push(`${r.copied.length} value${r.copied.length > 1 ? "s" : ""} copied (images, links, options…)`), r.toTranslate.length && parts.push(`${r.toTranslate.length} text${r.toTranslate.length > 1 ? "s" : ""} to translate`), parts.join(" · ");
|
|
8553
8752
|
}
|
|
8554
8753
|
/**
|
|
8555
8754
|
* `pageTypes` déduits du registre du starter, pour ne pas redire au kit ce que
|
|
@@ -8639,7 +8838,7 @@ function withMoreTool(tools, names = DEFAULT_MORE_TOOLS) {
|
|
|
8639
8838
|
if (hidden.length === 0) return tools;
|
|
8640
8839
|
let more = {
|
|
8641
8840
|
name: NCF_MORE_TOOL,
|
|
8642
|
-
title: "
|
|
8841
|
+
title: "More",
|
|
8643
8842
|
icon: EllipsisHorizontalIcon,
|
|
8644
8843
|
component: MoreToolComponent,
|
|
8645
8844
|
options: { tools: hidden }
|
|
@@ -8683,7 +8882,7 @@ function NcfPreviewHeader(props) {
|
|
|
8683
8882
|
children: [/* @__PURE__ */ jsx(Text, {
|
|
8684
8883
|
size: 0,
|
|
8685
8884
|
muted: !0,
|
|
8686
|
-
children: "
|
|
8885
|
+
children: "Data"
|
|
8687
8886
|
}), /* @__PURE__ */ jsx(Flex, {
|
|
8688
8887
|
gap: 1,
|
|
8689
8888
|
children: PERSPECTIVES.map((option) => {
|
|
@@ -8812,11 +9011,11 @@ const ncfKit = definePlugin((options) => {
|
|
|
8812
9011
|
name: "components",
|
|
8813
9012
|
tool: {
|
|
8814
9013
|
name: NCF_COMPONENTS_TOOL,
|
|
8815
|
-
title: "
|
|
9014
|
+
title: "Components",
|
|
8816
9015
|
icon: ComponentIcon,
|
|
8817
9016
|
component: createToolComponent({
|
|
8818
9017
|
name: "components",
|
|
8819
|
-
title: "
|
|
9018
|
+
title: "Components",
|
|
8820
9019
|
config,
|
|
8821
9020
|
issues,
|
|
8822
9021
|
Component: ComponentsTool
|
|
@@ -8827,11 +9026,11 @@ const ncfKit = definePlugin((options) => {
|
|
|
8827
9026
|
name: "history",
|
|
8828
9027
|
tool: {
|
|
8829
9028
|
name: NCF_HISTORY_TOOL,
|
|
8830
|
-
title: "
|
|
9029
|
+
title: "History",
|
|
8831
9030
|
icon: ClockIcon,
|
|
8832
9031
|
component: createToolComponent({
|
|
8833
9032
|
name: "history",
|
|
8834
|
-
title: "
|
|
9033
|
+
title: "History",
|
|
8835
9034
|
config,
|
|
8836
9035
|
issues,
|
|
8837
9036
|
Component: HistoryTool
|
|
@@ -8860,7 +9059,7 @@ const ncfKit = definePlugin((options) => {
|
|
|
8860
9059
|
},
|
|
8861
9060
|
document: {
|
|
8862
9061
|
newDocumentOptions: (prev) => prev.filter((option) => option.templateId !== BOARD_LAYOUT_TYPE),
|
|
8863
|
-
actions: (prev, context) => config.pageTypeNames.includes(context.schemaType) ? prev.map((action) => action.action === "unpublish" ? RemoveFromSiteAction : action.action === "publish" && config.i18n ? withPropagation(action, config) : action) : prev
|
|
9062
|
+
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
|
|
8864
9063
|
},
|
|
8865
9064
|
studio: { components: { toolMenu: createPreviewLauncher(config, issues) } },
|
|
8866
9065
|
form: { components: { input: createKitInput(config) } }
|