@nocode-factory/sanity-kit 2.70.2-rc.1 → 2.71.0-rc.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +35 -1
- package/dist/{finalUrl-DYyjKCjh.js → finalUrl-D-rEV9jn.js} +6 -1
- package/dist/finalUrl-D-rEV9jn.js.map +1 -0
- package/dist/{fixCrossLanguageReferences-C4A61VWW.js → fixCrossLanguageReferences-C2WQFnlM.js} +2 -2
- package/dist/{fixCrossLanguageReferences-C4A61VWW.js.map → fixCrossLanguageReferences-C2WQFnlM.js.map} +1 -1
- package/dist/{fixCrossLanguageReferences-CfFDSTD5.d.ts → fixCrossLanguageReferences-rqwx8yPd.d.ts} +35 -1
- package/dist/index.d.ts +17 -2
- package/dist/index.js +295 -12
- package/dist/index.js.map +1 -1
- package/dist/jsonld.js +1 -1
- package/dist/schema.d.ts +1 -1
- package/dist/schema.js +2 -2
- package/package.json +1 -1
- package/src/config/resolve.ts +7 -0
- package/src/config/types.ts +37 -0
- package/src/index.ts +1 -0
- package/src/structure/toolLinkItem.tsx +43 -0
- package/src/tools/navbar/PreviewLauncher.tsx +2 -2
- package/src/tools/navbar/ToolButtons.tsx +180 -4
- package/src/tools/presentation/PagesNavigator.tsx +53 -3
- package/src/version.ts +1 -1
- package/dist/finalUrl-DYyjKCjh.js.map +0 -1
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { _ as DEFAULT_PAGE_BUILDER_FIELD, a as depth, c as segments, d as normalizePath, f as resolveConfig, g as DEFAULT_INTERNAL_FIELDS, h as DEFAULT_I18N, i as redirectMapOf, l as toPath, m as DEFAULT_COMPONENT_PREVIEW, o as pageTypeFor, p as DEFAULT_BOARD_TAGS, s as parentPath, t as finalPath, u as toUrl, v as DEFAULT_SLUG_FIELD, y as DEFAULT_TITLE_FIELD } from "./finalUrl-
|
|
1
|
+
import { _ as DEFAULT_PAGE_BUILDER_FIELD, a as depth, c as segments, d as normalizePath, f as resolveConfig, g as DEFAULT_INTERNAL_FIELDS, h as DEFAULT_I18N, i as redirectMapOf, l as toPath, m as DEFAULT_COMPONENT_PREVIEW, o as pageTypeFor, p as DEFAULT_BOARD_TAGS, s as parentPath, t as finalPath, u as toUrl, v as DEFAULT_SLUG_FIELD, y as DEFAULT_TITLE_FIELD } from "./finalUrl-D-rEV9jn.js";
|
|
2
2
|
import { a as collectTexts$1, c as valueAtKey, d as useKitContext, f as useOptionalKitConfig, i as guessDocumentTitle, l as KitProvider, o as replaceTexts, p as useOptionalKitContext, r as collectDocumentText, s as setAtKey, t as generateJsonLd, u as useKitConfig } from "./aiJsonLd-BFyxgYen.js";
|
|
3
3
|
import { a as parsePath, d as READ_DEFAULTS_RESULT, h as replaceImagePatch, m as isReplaceImageRequest, o as readAt, p as isReadDefaultsRequest } from "./inherited-BJxEcInY.js";
|
|
4
|
-
import { a as componentDefaultsMainDocument, c as defineComponentDefaults, d as syncTranslationRedirects, f as translationRedirectId, i as DEFAULT_COMPONENT_DEFAULTS_TYPE, l as requiredUnlessDefault, n as withSameLanguageReferences, o as componentDefaultsMainDocuments, p as translationRedirectOptions, r as pageTypesFromSiteRoutes, s as defaultsFieldName, t as fixCrossLanguageReferences, u as requiredUnlessDefaultFor } from "./fixCrossLanguageReferences-
|
|
4
|
+
import { a as componentDefaultsMainDocument, c as defineComponentDefaults, d as syncTranslationRedirects, f as translationRedirectId, i as DEFAULT_COMPONENT_DEFAULTS_TYPE, l as requiredUnlessDefault, n as withSameLanguageReferences, o as componentDefaultsMainDocuments, p as translationRedirectOptions, r as pageTypesFromSiteRoutes, s as defaultsFieldName, t as fixCrossLanguageReferences, u as requiredUnlessDefaultFor } from "./fixCrossLanguageReferences-C2WQFnlM.js";
|
|
5
5
|
import { i as codeEditorInput, n as CodeEmbedInput, r as CodeEditorInput, t as defineCodeEmbedType } from "./codeEmbedType-1bEOTxBT.js";
|
|
6
6
|
import { createContext, createElement, forwardRef, memo, useCallback, useContext, useEffect, useLayoutEffect, useMemo, useRef, useState, useSyncExternalStore } from "react";
|
|
7
7
|
import { ToolLink, defineField, definePlugin, defineType, pathToString, set, unset, useClient, useCurrentUser, useDocumentOperation, useFormValue, usePerspective, useSchema, useSetPerspective, useUser, useWorkspace } from "sanity";
|
|
@@ -20,6 +20,8 @@ import { CheckmarkIcon } from "@sanity/icons/Checkmark";
|
|
|
20
20
|
import { CopyIcon } from "@sanity/icons/Copy";
|
|
21
21
|
import { Menu, MenuButton, MenuDivider, MenuItem } from "@sanity/ui/menu";
|
|
22
22
|
import { EllipsisHorizontalIcon } from "@sanity/icons/EllipsisHorizontal";
|
|
23
|
+
import { CogIcon } from "@sanity/icons/Cog";
|
|
24
|
+
import { ChevronDownIcon } from "@sanity/icons/ChevronDown";
|
|
23
25
|
import { SearchIcon } from "@sanity/icons/Search";
|
|
24
26
|
import { AddIcon } from "@sanity/icons/Add";
|
|
25
27
|
import { FolderIcon } from "@sanity/icons/Folder";
|
|
@@ -31,7 +33,6 @@ import { ProjectsIcon } from "@sanity/icons/Projects";
|
|
|
31
33
|
import { CircleIcon } from "@sanity/icons/Circle";
|
|
32
34
|
import { ShareIcon } from "@sanity/icons/Share";
|
|
33
35
|
import { TranslateIcon } from "@sanity/icons/Translate";
|
|
34
|
-
import { ChevronDownIcon } from "@sanity/icons/ChevronDown";
|
|
35
36
|
import { ChevronRightIcon } from "@sanity/icons/ChevronRight";
|
|
36
37
|
import { ChevronUpIcon } from "@sanity/icons/ChevronUp";
|
|
37
38
|
import { Tooltip } from "@sanity/ui/tooltip";
|
|
@@ -1485,7 +1486,7 @@ function explainGrantError(error) {
|
|
|
1485
1486
|
* quelle version. Recopiée de `package.json` par `npm version` (scripts/sync-version.mjs) ; un test
|
|
1486
1487
|
* le vérifie.
|
|
1487
1488
|
*/
|
|
1488
|
-
const KIT_VERSION = "2.
|
|
1489
|
+
const KIT_VERSION = "2.71.0-rc.1";
|
|
1489
1490
|
/**
|
|
1490
1491
|
* Signale ce Studio au service du kit, une fois par montage.
|
|
1491
1492
|
*
|
|
@@ -1993,7 +1994,7 @@ function useKitUpdate() {
|
|
|
1993
1994
|
!controller.signal.aborted && body?.version && setLatest(body.version);
|
|
1994
1995
|
}).catch(() => {}), () => controller.abort();
|
|
1995
1996
|
}, []);
|
|
1996
|
-
let available = !!(latest && !isPrerelease(latest) && compareVersions(latest, "2.
|
|
1997
|
+
let available = !!(latest && !isPrerelease(latest) && compareVersions(latest, "2.71.0-rc.1") > 0);
|
|
1997
1998
|
return {
|
|
1998
1999
|
current: KIT_VERSION,
|
|
1999
2000
|
latest,
|
|
@@ -2159,6 +2160,12 @@ const ToolAnchor = forwardRef(function ToolAnchor({ children, ...props }, ref) {
|
|
|
2159
2160
|
* volet latéral (mobile), tout est listé.
|
|
2160
2161
|
*/
|
|
2161
2162
|
function NcfToolButtons(props) {
|
|
2163
|
+
return props.navigation ? /* @__PURE__ */ jsx(NcfGroupedToolButtons, {
|
|
2164
|
+
...props,
|
|
2165
|
+
navigation: props.navigation
|
|
2166
|
+
}) : /* @__PURE__ */ jsx(NcfFlatToolButtons, { ...props });
|
|
2167
|
+
}
|
|
2168
|
+
function NcfFlatToolButtons(props) {
|
|
2162
2169
|
let { activeToolName, context, tools, closeSidebar, isSidebarOpen, more: moreNames } = props, [main, more] = useMemo(() => splitTools(tools, moreNames), [tools, moreNames]), isSidebar = context === "sidebar", onClick = useCallback(() => {
|
|
2163
2170
|
isSidebar && isSidebarOpen && closeSidebar();
|
|
2164
2171
|
}, [
|
|
@@ -2208,6 +2215,178 @@ function NcfToolButtons(props) {
|
|
|
2208
2215
|
})]
|
|
2209
2216
|
});
|
|
2210
2217
|
}
|
|
2218
|
+
/** Outils du menu Design (navigation regroupée), dans cet ordre. */
|
|
2219
|
+
const NAV_DESIGN_TOOLS = [
|
|
2220
|
+
"ncf-components",
|
|
2221
|
+
"ncf-assets",
|
|
2222
|
+
"ncf-design-system"
|
|
2223
|
+
], NAV_SETTINGS_TOOLS = ["ncf-history", "releases"], NAV_MAIN_TOOLS = [
|
|
2224
|
+
"presentation",
|
|
2225
|
+
"ncf-pages",
|
|
2226
|
+
"structure"
|
|
2227
|
+
];
|
|
2228
|
+
/**
|
|
2229
|
+
* Répartit les outils de la navigation regroupée : onglets (Presentation, Pages,
|
|
2230
|
+
* CMS, puis les outils non classés), Settings, Design, « ··· » (outils techniques).
|
|
2231
|
+
* L'outil des réglages lui-même n'a pas d'onglet : on y entre par le menu Settings.
|
|
2232
|
+
*/
|
|
2233
|
+
function groupTools(tools, more, settingsTool) {
|
|
2234
|
+
let byName = (names) => names.map((n) => tools.find((t) => t.name === n)).filter((t) => !!t), classed = /* @__PURE__ */ new Set([
|
|
2235
|
+
...NAV_MAIN_TOOLS,
|
|
2236
|
+
...NAV_DESIGN_TOOLS,
|
|
2237
|
+
...NAV_SETTINGS_TOOLS,
|
|
2238
|
+
...more,
|
|
2239
|
+
settingsTool
|
|
2240
|
+
]);
|
|
2241
|
+
return {
|
|
2242
|
+
main: [...byName(NAV_MAIN_TOOLS), ...tools.filter((t) => !classed.has(t.name))],
|
|
2243
|
+
settings: byName(NAV_SETTINGS_TOOLS),
|
|
2244
|
+
design: byName(NAV_DESIGN_TOOLS),
|
|
2245
|
+
more: tools.filter((t) => more.includes(t.name) && !NAV_SETTINGS_TOOLS.includes(t.name))
|
|
2246
|
+
};
|
|
2247
|
+
}
|
|
2248
|
+
/** Une entrée de menu qui est un lien (ToolLink) ne se souligne pas. */
|
|
2249
|
+
const NO_UNDERLINE = { textDecoration: "none" }, titleOf = (tool) => typeof tool.title == "string" && tool.title || tool.name;
|
|
2250
|
+
/**
|
|
2251
|
+
* Navigation regroupée (option `navigation.grouped`) : Presentation, Pages, CMS en
|
|
2252
|
+
* onglets ; Settings (réglages du projet, History, planification) et Design
|
|
2253
|
+
* (Components, Assets, Design system) en menus ; « ··· » pour les outils techniques.
|
|
2254
|
+
* Dans le volet latéral (fenêtre étroite) : les mêmes groupes, à plat.
|
|
2255
|
+
*/
|
|
2256
|
+
function NcfGroupedToolButtons(props) {
|
|
2257
|
+
let { activeToolName, context, tools, closeSidebar, isSidebarOpen, more: moreNames, navigation } = props, router = useRouter(), { basePath } = useWorkspace(), groups = useMemo(() => groupTools(tools, moreNames, navigation.settingsTool), [
|
|
2258
|
+
tools,
|
|
2259
|
+
moreNames,
|
|
2260
|
+
navigation.settingsTool
|
|
2261
|
+
]), items = tools.some((t) => t.name === navigation.settingsTool) ? navigation.settingsItems : [], isSidebar = context === "sidebar", onClick = useCallback(() => {
|
|
2262
|
+
isSidebar && isSidebarOpen && closeSidebar();
|
|
2263
|
+
}, [
|
|
2264
|
+
closeSidebar,
|
|
2265
|
+
isSidebar,
|
|
2266
|
+
isSidebarOpen
|
|
2267
|
+
]), openSetting = useCallback((id) => {
|
|
2268
|
+
router.navigateUrl({ path: `${basePath.replace(/\/$/, "")}/${navigation.settingsTool}/${id}` }), onClick();
|
|
2269
|
+
}, [
|
|
2270
|
+
router,
|
|
2271
|
+
basePath,
|
|
2272
|
+
navigation.settingsTool,
|
|
2273
|
+
onClick
|
|
2274
|
+
]), button = (tool) => /* @__PURE__ */ jsx(Button, {
|
|
2275
|
+
as: ToolAnchor,
|
|
2276
|
+
name: tool.name,
|
|
2277
|
+
icon: tool.icon,
|
|
2278
|
+
text: titleOf(tool),
|
|
2279
|
+
mode: "bleed",
|
|
2280
|
+
selected: activeToolName === tool.name,
|
|
2281
|
+
justify: isSidebar ? "flex-start" : void 0,
|
|
2282
|
+
onClick,
|
|
2283
|
+
fontSize: 1,
|
|
2284
|
+
padding: 3
|
|
2285
|
+
}, tool.name), toolItem = (tool) => /* @__PURE__ */ jsx(MenuItem, {
|
|
2286
|
+
as: ToolAnchor,
|
|
2287
|
+
name: tool.name,
|
|
2288
|
+
icon: tool.icon,
|
|
2289
|
+
text: titleOf(tool),
|
|
2290
|
+
pressed: activeToolName === tool.name,
|
|
2291
|
+
style: NO_UNDERLINE
|
|
2292
|
+
}, tool.name), settingItem = (item) => /* @__PURE__ */ jsx(MenuItem, {
|
|
2293
|
+
icon: item.icon,
|
|
2294
|
+
onClick: () => openSetting(item.id),
|
|
2295
|
+
pressed: activeToolName === navigation.settingsTool,
|
|
2296
|
+
children: /* @__PURE__ */ jsxs(Stack, {
|
|
2297
|
+
gap: 2,
|
|
2298
|
+
children: [/* @__PURE__ */ jsx(Text, {
|
|
2299
|
+
size: 1,
|
|
2300
|
+
children: item.title
|
|
2301
|
+
}), item.hint ? /* @__PURE__ */ jsx(Text, {
|
|
2302
|
+
size: 0,
|
|
2303
|
+
muted: !0,
|
|
2304
|
+
children: item.hint
|
|
2305
|
+
}) : null]
|
|
2306
|
+
})
|
|
2307
|
+
}, item.id), settingsActive = activeToolName === navigation.settingsTool || groups.settings.some((t) => t.name === activeToolName), designActive = groups.design.some((t) => t.name === activeToolName);
|
|
2308
|
+
if (isSidebar) {
|
|
2309
|
+
let heading = (label) => /* @__PURE__ */ jsx(Box, {
|
|
2310
|
+
paddingX: 3,
|
|
2311
|
+
paddingTop: 3,
|
|
2312
|
+
paddingBottom: 1,
|
|
2313
|
+
children: /* @__PURE__ */ jsx(Text, {
|
|
2314
|
+
size: 0,
|
|
2315
|
+
muted: !0,
|
|
2316
|
+
weight: "medium",
|
|
2317
|
+
children: label
|
|
2318
|
+
})
|
|
2319
|
+
});
|
|
2320
|
+
return /* @__PURE__ */ jsxs(Stack, {
|
|
2321
|
+
gap: 1,
|
|
2322
|
+
children: [
|
|
2323
|
+
groups.main.map(button),
|
|
2324
|
+
items.length + groups.settings.length > 0 && heading("Settings"),
|
|
2325
|
+
items.map((item) => /* @__PURE__ */ jsx(Button, {
|
|
2326
|
+
icon: item.icon,
|
|
2327
|
+
text: item.title,
|
|
2328
|
+
mode: "bleed",
|
|
2329
|
+
justify: "flex-start",
|
|
2330
|
+
fontSize: 1,
|
|
2331
|
+
padding: 3,
|
|
2332
|
+
onClick: () => openSetting(item.id)
|
|
2333
|
+
}, item.id)),
|
|
2334
|
+
groups.settings.map(button),
|
|
2335
|
+
groups.design.length > 0 && heading("Design"),
|
|
2336
|
+
groups.design.map(button),
|
|
2337
|
+
groups.more.length > 0 && heading("More"),
|
|
2338
|
+
groups.more.map(button)
|
|
2339
|
+
]
|
|
2340
|
+
});
|
|
2341
|
+
}
|
|
2342
|
+
let dropdown = (id, label, icon, selected, menu) => /* @__PURE__ */ jsx(MenuButton, {
|
|
2343
|
+
id,
|
|
2344
|
+
button: /* @__PURE__ */ jsx(Button, {
|
|
2345
|
+
icon,
|
|
2346
|
+
iconRight: ChevronDownIcon,
|
|
2347
|
+
text: label,
|
|
2348
|
+
mode: "bleed",
|
|
2349
|
+
fontSize: 1,
|
|
2350
|
+
padding: 3,
|
|
2351
|
+
selected
|
|
2352
|
+
}),
|
|
2353
|
+
menu: /* @__PURE__ */ jsx(Menu, { children: menu }),
|
|
2354
|
+
popover: {
|
|
2355
|
+
portal: !0,
|
|
2356
|
+
placement: "bottom-start"
|
|
2357
|
+
}
|
|
2358
|
+
});
|
|
2359
|
+
return /* @__PURE__ */ jsxs(Flex, {
|
|
2360
|
+
gap: 1,
|
|
2361
|
+
align: "center",
|
|
2362
|
+
children: [
|
|
2363
|
+
groups.main.map(button),
|
|
2364
|
+
items.length + groups.settings.length > 0 && dropdown("ncf-tool-menu-settings", "Settings", CogIcon, settingsActive, /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
2365
|
+
items.map(settingItem),
|
|
2366
|
+
items.length > 0 && groups.settings.length > 0 && /* @__PURE__ */ jsx(MenuDivider, {}),
|
|
2367
|
+
groups.settings.map(toolItem)
|
|
2368
|
+
] })),
|
|
2369
|
+
groups.design.length > 0 && dropdown("ncf-tool-menu-design", "Design", ComponentIcon, designActive, /* @__PURE__ */ jsx(Fragment, { children: groups.design.map(toolItem) })),
|
|
2370
|
+
groups.more.length > 0 && /* @__PURE__ */ jsx(MenuButton, {
|
|
2371
|
+
id: "ncf-tool-menu-more",
|
|
2372
|
+
button: /* @__PURE__ */ jsx(Button, {
|
|
2373
|
+
icon: EllipsisHorizontalIcon,
|
|
2374
|
+
mode: "bleed",
|
|
2375
|
+
fontSize: 1,
|
|
2376
|
+
padding: 3,
|
|
2377
|
+
selected: groups.more.some((t) => t.name === activeToolName),
|
|
2378
|
+
title: `Technical tools (${groups.more.map(titleOf).join(", ")})`,
|
|
2379
|
+
"aria-label": "More tools"
|
|
2380
|
+
}),
|
|
2381
|
+
menu: /* @__PURE__ */ jsx(Menu, { children: groups.more.map(toolItem) }),
|
|
2382
|
+
popover: {
|
|
2383
|
+
portal: !0,
|
|
2384
|
+
placement: "bottom-end"
|
|
2385
|
+
}
|
|
2386
|
+
})
|
|
2387
|
+
]
|
|
2388
|
+
});
|
|
2389
|
+
}
|
|
2211
2390
|
/** Couleurs des trois cibles : brouillons (jaune pastel), préprod en ligne (vert pastel), prod (vert plein). */
|
|
2212
2391
|
const TARGET_TONES = {
|
|
2213
2392
|
draft: {
|
|
@@ -2241,7 +2420,8 @@ function NcfPreviewLauncher(props) {
|
|
|
2241
2420
|
gap: 2,
|
|
2242
2421
|
children: [/* @__PURE__ */ jsx(NcfToolButtons, {
|
|
2243
2422
|
...props,
|
|
2244
|
-
more: config.moreTools
|
|
2423
|
+
more: config.moreTools,
|
|
2424
|
+
navigation: config.navigation
|
|
2245
2425
|
}), topbar && /* @__PURE__ */ jsx(NcfKitUpdate, { inline: !0 })]
|
|
2246
2426
|
});
|
|
2247
2427
|
let openInStudio = (environment, perspective) => {
|
|
@@ -2264,7 +2444,8 @@ function NcfPreviewLauncher(props) {
|
|
|
2264
2444
|
children: [
|
|
2265
2445
|
/* @__PURE__ */ jsx(NcfToolButtons, {
|
|
2266
2446
|
...props,
|
|
2267
|
-
more: config.moreTools
|
|
2447
|
+
more: config.moreTools,
|
|
2448
|
+
navigation: config.navigation
|
|
2268
2449
|
}),
|
|
2269
2450
|
inline && /* @__PURE__ */ jsx(NcfKitUpdate, { inline: !0 }),
|
|
2270
2451
|
/* @__PURE__ */ jsx(InlinePopover, {
|
|
@@ -12753,6 +12934,50 @@ function withMoreTool(tools, names = DEFAULT_MORE_TOOLS) {
|
|
|
12753
12934
|
};
|
|
12754
12935
|
return [...tools.filter((tool) => !names.includes(tool.name)), more];
|
|
12755
12936
|
}
|
|
12937
|
+
/** Volet qui ouvre aussitôt un outil du Studio (History, Releases…). */
|
|
12938
|
+
function OpenToolPane(props) {
|
|
12939
|
+
let tool = props.options?.tool ?? "", router = useRouter(), { basePath } = useWorkspace();
|
|
12940
|
+
return useEffect(() => {
|
|
12941
|
+
tool && router.navigateUrl({
|
|
12942
|
+
path: `${basePath.replace(/\/$/, "")}/${tool}`,
|
|
12943
|
+
replace: !0
|
|
12944
|
+
});
|
|
12945
|
+
}, [
|
|
12946
|
+
router,
|
|
12947
|
+
basePath,
|
|
12948
|
+
tool
|
|
12949
|
+
]), /* @__PURE__ */ jsxs(Flex, {
|
|
12950
|
+
align: "center",
|
|
12951
|
+
justify: "center",
|
|
12952
|
+
gap: 3,
|
|
12953
|
+
padding: 5,
|
|
12954
|
+
children: [/* @__PURE__ */ jsx(Spinner, { muted: !0 }), /* @__PURE__ */ jsxs(Text, {
|
|
12955
|
+
size: 1,
|
|
12956
|
+
muted: !0,
|
|
12957
|
+
children: [
|
|
12958
|
+
"Opening ",
|
|
12959
|
+
props.options?.title ?? tool,
|
|
12960
|
+
"…"
|
|
12961
|
+
]
|
|
12962
|
+
})]
|
|
12963
|
+
});
|
|
12964
|
+
}
|
|
12965
|
+
/**
|
|
12966
|
+
* Entrée de structure qui OUVRE un outil du Studio (navigation regroupée : History et
|
|
12967
|
+
* Releases dans la colonne de Settings, comme dans le menu Settings de la barre). Un
|
|
12968
|
+
* outil ne s'affiche pas dans une colonne : un clic ouvre l'outil, en pleine page.
|
|
12969
|
+
*
|
|
12970
|
+
* ```ts
|
|
12971
|
+
* ncfToolLinkItem(S, {id: 'history', title: 'History', tool: 'ncf-history'})
|
|
12972
|
+
* ```
|
|
12973
|
+
*/
|
|
12974
|
+
function ncfToolLinkItem(S, options) {
|
|
12975
|
+
let item = S.listItem().id(options.id).title(options.title).child(S.component(OpenToolPane).id(`${options.id}-open`).title(options.title).options({
|
|
12976
|
+
tool: options.tool,
|
|
12977
|
+
title: options.title
|
|
12978
|
+
}));
|
|
12979
|
+
return options.icon ? item.icon(options.icon) : item;
|
|
12980
|
+
}
|
|
12756
12981
|
/**
|
|
12757
12982
|
* Bascule brouillons / en ligne, posée dans l'aperçu lui-même.
|
|
12758
12983
|
*
|
|
@@ -13160,10 +13385,18 @@ function PagesNavigator() {
|
|
|
13160
13385
|
padding: 2,
|
|
13161
13386
|
style: { flex: "none" },
|
|
13162
13387
|
children: [
|
|
13163
|
-
/* @__PURE__ */
|
|
13164
|
-
|
|
13165
|
-
|
|
13166
|
-
|
|
13388
|
+
/* @__PURE__ */ jsxs(Flex, {
|
|
13389
|
+
align: "center",
|
|
13390
|
+
justify: "space-between",
|
|
13391
|
+
gap: 2,
|
|
13392
|
+
children: [/* @__PURE__ */ jsx(Text, {
|
|
13393
|
+
size: 1,
|
|
13394
|
+
weight: "semibold",
|
|
13395
|
+
children: "Pages"
|
|
13396
|
+
}), config.navigation && /* @__PURE__ */ jsx(NewPageButton, {
|
|
13397
|
+
type: config.navigation.newPageType,
|
|
13398
|
+
locales: i18n?.locales ?? []
|
|
13399
|
+
})]
|
|
13167
13400
|
}),
|
|
13168
13401
|
/* @__PURE__ */ jsx(TextInput, {
|
|
13169
13402
|
icon: SearchIcon,
|
|
@@ -13304,6 +13537,56 @@ function ncfPresentationComponents(options) {
|
|
|
13304
13537
|
unstable_header: { component: NcfPresentationHeader }
|
|
13305
13538
|
};
|
|
13306
13539
|
}
|
|
13540
|
+
/** Nom d'une langue dans cette langue (« Français », « English »), sinon son code. */
|
|
13541
|
+
function languageName(code) {
|
|
13542
|
+
try {
|
|
13543
|
+
let name = new Intl.DisplayNames([code], { type: "language" }).of(code);
|
|
13544
|
+
return name ? name.charAt(0).toLocaleUpperCase(code) + name.slice(1) : code.toUpperCase();
|
|
13545
|
+
} catch {
|
|
13546
|
+
return code.toUpperCase();
|
|
13547
|
+
}
|
|
13548
|
+
}
|
|
13549
|
+
/**
|
|
13550
|
+
* « New page » du panneau Pages de Presentation (navigation regroupée) : ouvre le
|
|
13551
|
+
* formulaire d'une nouvelle page, dans la langue choisie (modèle `<type>-<langue>`,
|
|
13552
|
+
* le document naît avec son champ language). Une seule langue : un bouton direct.
|
|
13553
|
+
*/
|
|
13554
|
+
function NewPageButton(props) {
|
|
13555
|
+
let { type, locales } = props, router = useRouter(), schemaType = useSchema().get(type);
|
|
13556
|
+
if (!schemaType) return null;
|
|
13557
|
+
let label = schemaType.title || type, create = (locale) => router.navigateIntent("create", locale ? {
|
|
13558
|
+
type,
|
|
13559
|
+
template: `${type}-${locale}`
|
|
13560
|
+
} : { type });
|
|
13561
|
+
return locales.length <= 1 ? /* @__PURE__ */ jsx(Button, {
|
|
13562
|
+
icon: AddIcon,
|
|
13563
|
+
text: "New page",
|
|
13564
|
+
mode: "ghost",
|
|
13565
|
+
tone: "primary",
|
|
13566
|
+
fontSize: 1,
|
|
13567
|
+
padding: 2,
|
|
13568
|
+
onClick: () => create(locales[0])
|
|
13569
|
+
}) : /* @__PURE__ */ jsx(MenuButton, {
|
|
13570
|
+
id: "ncf-presentation-new-page",
|
|
13571
|
+
button: /* @__PURE__ */ jsx(Button, {
|
|
13572
|
+
icon: AddIcon,
|
|
13573
|
+
text: "New page",
|
|
13574
|
+
mode: "ghost",
|
|
13575
|
+
tone: "primary",
|
|
13576
|
+
fontSize: 1,
|
|
13577
|
+
padding: 2
|
|
13578
|
+
}),
|
|
13579
|
+
menu: /* @__PURE__ */ jsx(Menu, { children: locales.map((code) => /* @__PURE__ */ jsx(MenuItem, {
|
|
13580
|
+
icon: schemaType.icon,
|
|
13581
|
+
text: `${label} (${languageName(code)})`,
|
|
13582
|
+
onClick: () => create(code)
|
|
13583
|
+
}, code)) }),
|
|
13584
|
+
popover: {
|
|
13585
|
+
portal: !0,
|
|
13586
|
+
placement: "bottom-end"
|
|
13587
|
+
}
|
|
13588
|
+
});
|
|
13589
|
+
}
|
|
13307
13590
|
const cache = /* @__PURE__ */ new Map();
|
|
13308
13591
|
function loadDefaults(client, type, language) {
|
|
13309
13592
|
let key = `${type}:${language ?? ""}`, hit = cache.get(key);
|
|
@@ -14803,6 +15086,6 @@ function hasLanguageField(schemaType, field) {
|
|
|
14803
15086
|
let fields = schemaType?.fields;
|
|
14804
15087
|
return Array.isArray(fields) && fields.some((f) => f?.name === field);
|
|
14805
15088
|
}
|
|
14806
|
-
export { ANNOTATION_TYPE, ActorName, AssetSourceBrowser, AssetsTool, BOARD_LAYOUT_ID, BOARD_LAYOUT_TYPE, BRAIN_NODE_SIZE, BoardLayoutProvider, COLUMN_TYPE, CONTENT_SCAN_LIMIT, CONTENT_SCAN_LIMIT as OCCURRENCE_SCAN_LIMIT, CUSTOM_ENVIRONMENT_ID, CodeEditorInput, CodeEmbedInput, CollectionTable, DATA_PREFIX, DEFAULT_BOARD_TAGS, DEFAULT_COMPONENT_DEFAULTS_TYPE, DEFAULT_COMPONENT_PREVIEW, DEFAULT_I18N, DEFAULT_INTERNAL_FIELDS, DEFAULT_MORE_TOOLS, DEFAULT_PAGE_BUILDER_FIELD, DEFAULT_SLUG_FIELD, DEFAULT_TITLE_FIELD, HelpTextStyle, KIT_API_VERSION, KIT_VERSION, NCF_ASSETS_TOOL, NCF_COMPONENTS_TOOL, NCF_DESIGN_SYSTEM_TOOL, NCF_HIDDEN_TYPES, NCF_HISTORY_TOOL, NCF_MORE_TOOL, NCF_PAGES_TOOL, NCF_TOOL_NAMES, NODE_FIELD_TYPE, NODE_HEIGHT, NODE_WIDTH, NcfKitNavbar, NcfKitUpdate, NcfPreviewHeader, NcfPreviewLauncher, PERSPECTIVES, PROJECTION, SECTION_NODE_TYPE, STATUS_COLORS, STATUS_LABELS, SharePreview, UNSET_LABEL, UPGRADE_COMMAND, addColumn, addColumnOption, announce, applySavedPositions, assetName, assetsInFolder, assignmentMap, baseId, blockName, blockTypesFromSchema, buildCollectionQuery, buildCollectionRows, buildContentsQuery, buildLinkGraph, buildPageRows, buildPagesQuery, codeEditorInput, collectLinks, collectOccurrences, colorForRow, colorFromString, columnId, compareVersions, componentDefaultsMainDocument, componentDefaultsMainDocuments, countByFolder, createPreviewLauncher, customEnvironment, defaultNodeSize, defaultsFieldName, defineCodeEmbedType, defineComponentDefaults, depth, deriveCollectionColumns, deriveDocumentColumns, detectPageBuilderField, diffDocuments, diffWords, discoverCollectionTypes, downloadText, editIntentPath, explainGrantError, fallbackLayout, fetchDetail, fetchTimeline, fillTemplate, filterAssets, filterRows as filterCollectionRows, filterRows$1 as filterRows, fixCrossLanguageReferences, flatten, formatBytes, formatDocumentValue, groupComponents, groupMap, groupPageRows, groupValue, hasBlockingIssue, humanizeBlockName, isDraftId, isImageAsset, isKitType, isPrerelease, isSafeColumnKey, isSafeFieldPath, isTextChange, isVersionId, issuesForTool, keyForPath, kitSchemaTypes, layoutGraph, layoutSectionsMap, localesInRows, mergeVersions, missingPageTypes, moveColumn, nameMap, ncfAllowedOrigins, ncfCollectionTable, ncfCollections, ncfKit, ncfMainDocuments, ncfPresentationComponents, ncfPreviewComponents, normalizeInternalPath, normalizePath, occurrencesForTypes, pageThumbnailUrl, pageTypeFor, pageTypesFromSiteRoutes, pageTypesWithoutBuilder, parentPath, presentationPath, pruneSavedPositions, releaseId, removeColumn, renameColumn, requestPreviewGrant, requiredUnlessDefault, requiredUnlessDefaultFor, resolveColorBy, resolveConfig, resolvePageBuilderField, sectionNamesFromDefaults, segments, slugKey, sortAssets, sortRows as sortCollectionRows, sortRows$1 as sortRows, summarize, thumbnailUrl, titleColumn, toCsv, toKebabCase, toPath, toUrl, topLevelBlockCount, uniqueColumnId, upgradePrompt, upsertLayout, urlOn, useAnnotations, useAssetMeta, useAssetUpload, useAssets, useBoardLayout, useCollection, useComponentNames, useDocumentColumns, useHistory, useInternalColumns, useKitClient, useKitConfig, useKitContext, useKitUpdate, useOccurrences, useOptionalKitConfig, useOptionalKitContext, usePageBuilder, usePageContents, usePages, usePreviewTarget, useRegistration, validateConfig, withAlpha, withCustomNames, withMoreTool, withNcfChoiceInputs, withSameLanguageReferences };
|
|
15089
|
+
export { ANNOTATION_TYPE, ActorName, AssetSourceBrowser, AssetsTool, BOARD_LAYOUT_ID, BOARD_LAYOUT_TYPE, BRAIN_NODE_SIZE, BoardLayoutProvider, COLUMN_TYPE, CONTENT_SCAN_LIMIT, CONTENT_SCAN_LIMIT as OCCURRENCE_SCAN_LIMIT, CUSTOM_ENVIRONMENT_ID, CodeEditorInput, CodeEmbedInput, CollectionTable, DATA_PREFIX, DEFAULT_BOARD_TAGS, DEFAULT_COMPONENT_DEFAULTS_TYPE, DEFAULT_COMPONENT_PREVIEW, DEFAULT_I18N, DEFAULT_INTERNAL_FIELDS, DEFAULT_MORE_TOOLS, DEFAULT_PAGE_BUILDER_FIELD, DEFAULT_SLUG_FIELD, DEFAULT_TITLE_FIELD, HelpTextStyle, KIT_API_VERSION, KIT_VERSION, NCF_ASSETS_TOOL, NCF_COMPONENTS_TOOL, NCF_DESIGN_SYSTEM_TOOL, NCF_HIDDEN_TYPES, NCF_HISTORY_TOOL, NCF_MORE_TOOL, NCF_PAGES_TOOL, NCF_TOOL_NAMES, NODE_FIELD_TYPE, NODE_HEIGHT, NODE_WIDTH, NcfKitNavbar, NcfKitUpdate, NcfPreviewHeader, NcfPreviewLauncher, PERSPECTIVES, PROJECTION, SECTION_NODE_TYPE, STATUS_COLORS, STATUS_LABELS, SharePreview, UNSET_LABEL, UPGRADE_COMMAND, addColumn, addColumnOption, announce, applySavedPositions, assetName, assetsInFolder, assignmentMap, baseId, blockName, blockTypesFromSchema, buildCollectionQuery, buildCollectionRows, buildContentsQuery, buildLinkGraph, buildPageRows, buildPagesQuery, codeEditorInput, collectLinks, collectOccurrences, colorForRow, colorFromString, columnId, compareVersions, componentDefaultsMainDocument, componentDefaultsMainDocuments, countByFolder, createPreviewLauncher, customEnvironment, defaultNodeSize, defaultsFieldName, defineCodeEmbedType, defineComponentDefaults, depth, deriveCollectionColumns, deriveDocumentColumns, detectPageBuilderField, diffDocuments, diffWords, discoverCollectionTypes, downloadText, editIntentPath, explainGrantError, fallbackLayout, fetchDetail, fetchTimeline, fillTemplate, filterAssets, filterRows as filterCollectionRows, filterRows$1 as filterRows, fixCrossLanguageReferences, flatten, formatBytes, formatDocumentValue, groupComponents, groupMap, groupPageRows, groupValue, hasBlockingIssue, humanizeBlockName, isDraftId, isImageAsset, isKitType, isPrerelease, isSafeColumnKey, isSafeFieldPath, isTextChange, isVersionId, issuesForTool, keyForPath, kitSchemaTypes, layoutGraph, layoutSectionsMap, localesInRows, mergeVersions, missingPageTypes, moveColumn, nameMap, ncfAllowedOrigins, ncfCollectionTable, ncfCollections, ncfKit, ncfMainDocuments, ncfPresentationComponents, ncfPreviewComponents, ncfToolLinkItem, normalizeInternalPath, normalizePath, occurrencesForTypes, pageThumbnailUrl, pageTypeFor, pageTypesFromSiteRoutes, pageTypesWithoutBuilder, parentPath, presentationPath, pruneSavedPositions, releaseId, removeColumn, renameColumn, requestPreviewGrant, requiredUnlessDefault, requiredUnlessDefaultFor, resolveColorBy, resolveConfig, resolvePageBuilderField, sectionNamesFromDefaults, segments, slugKey, sortAssets, sortRows as sortCollectionRows, sortRows$1 as sortRows, summarize, thumbnailUrl, titleColumn, toCsv, toKebabCase, toPath, toUrl, topLevelBlockCount, uniqueColumnId, upgradePrompt, upsertLayout, urlOn, useAnnotations, useAssetMeta, useAssetUpload, useAssets, useBoardLayout, useCollection, useComponentNames, useDocumentColumns, useHistory, useInternalColumns, useKitClient, useKitConfig, useKitContext, useKitUpdate, useOccurrences, useOptionalKitConfig, useOptionalKitContext, usePageBuilder, usePageContents, usePages, usePreviewTarget, useRegistration, validateConfig, withAlpha, withCustomNames, withMoreTool, withNcfChoiceInputs, withSameLanguageReferences };
|
|
14807
15090
|
|
|
14808
15091
|
//# sourceMappingURL=index.js.map
|