@nocode-factory/sanity-kit 2.3.0 → 2.5.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/index.d.ts +50 -2
- package/dist/index.js +272 -61
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/hooks/useKitUpdate.ts +56 -0
- package/src/index.ts +4 -0
- package/src/lib/studioLinks.ts +20 -0
- package/src/lib/version.ts +31 -0
- package/src/tools/navbar/KitUpdate.tsx +106 -0
- package/src/tools/navbar/PreviewLauncher.tsx +67 -28
- package/src/version.ts +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1087,6 +1087,54 @@ export declare function NcfPreviewLauncher(props: ToolMenuProps): import("react"
|
|
|
1087
1087
|
* d'aucun de leurs contextes, et doit porter le sien.
|
|
1088
1088
|
*/
|
|
1089
1089
|
export declare function createPreviewLauncher(config: ResolvedKitConfig, issues: ConfigIssue[]): (props: ToolMenuProps) => import("react").JSX.Element;
|
|
1090
|
+
/**
|
|
1091
|
+
* Signale qu'une version plus récente du kit existe.
|
|
1092
|
+
*
|
|
1093
|
+
* **Il ne met pas à jour.** Un Studio tourne dans un navigateur : il ne peut
|
|
1094
|
+
* ni installer un paquet sur le poste d'un développeur, ni se redéployer. Ce
|
|
1095
|
+
* bouton dit ce qui manque et donne la commande — prétendre faire plus serait
|
|
1096
|
+
* mentir sur ce qui se passe.
|
|
1097
|
+
*
|
|
1098
|
+
* Invisible tant que le kit est à jour : un bouton permanent qui ne dit rien
|
|
1099
|
+
* finit par ne plus être lu.
|
|
1100
|
+
*/
|
|
1101
|
+
export declare function NcfKitUpdate(props: {
|
|
1102
|
+
inline?: boolean;
|
|
1103
|
+
}): import("react").JSX.Element | null;
|
|
1104
|
+
interface KitUpdate {
|
|
1105
|
+
current: string;
|
|
1106
|
+
latest: string | null;
|
|
1107
|
+
/** Vrai seulement quand une version stable dépasse celle qui s'exécute. */
|
|
1108
|
+
available: boolean;
|
|
1109
|
+
/** Commande à lancer, prête à copier. */
|
|
1110
|
+
command: string;
|
|
1111
|
+
}
|
|
1112
|
+
/**
|
|
1113
|
+
* Compare la version exécutée à la dernière publiée.
|
|
1114
|
+
*
|
|
1115
|
+
* Un Studio tourne dans un navigateur : il ne peut ni installer un paquet ni
|
|
1116
|
+
* se redéployer. Il peut en revanche dire qu'il est en retard, et donner la
|
|
1117
|
+
* commande — c'est tout ce qu'un bouton peut honnêtement offrir ici.
|
|
1118
|
+
*
|
|
1119
|
+
* Le registre npm autorise les requêtes navigateur, et le paquet est public :
|
|
1120
|
+
* aucune authentification n'est nécessaire.
|
|
1121
|
+
*
|
|
1122
|
+
* Échoue en silence : ne pas savoir si une mise à jour existe ne doit gêner
|
|
1123
|
+
* personne.
|
|
1124
|
+
*/
|
|
1125
|
+
export declare function useKitUpdate(): KitUpdate;
|
|
1126
|
+
/**
|
|
1127
|
+
* Comparaison de deux versions sémantiques.
|
|
1128
|
+
*
|
|
1129
|
+
* Suffisant pour ce qu'on en fait — savoir si une version publiée dépasse
|
|
1130
|
+
* celle qu'on exécute. Les mentions de pré-publication (`2.4.0-rc.1`) sont
|
|
1131
|
+
* ignorées : on ne propose jamais d'y passer.
|
|
1132
|
+
*
|
|
1133
|
+
* Rend 1 si `a` est postérieure, -1 si antérieure, 0 si égales.
|
|
1134
|
+
*/
|
|
1135
|
+
export declare function compareVersions(a: string, b: string): number;
|
|
1136
|
+
/** Une version de pré-publication ne se propose pas. */
|
|
1137
|
+
export declare const isPrerelease: (version: string) => boolean;
|
|
1090
1138
|
/**
|
|
1091
1139
|
* Délivre un lien de préversion à partager.
|
|
1092
1140
|
*
|
|
@@ -1222,7 +1270,7 @@ export declare function ActorName(props: {
|
|
|
1222
1270
|
* Version du kit, rapportée au service pour savoir quels projets tournent sur
|
|
1223
1271
|
* quelle version. Tenue à jour avec `package.json`.
|
|
1224
1272
|
*/
|
|
1225
|
-
export declare const KIT_VERSION = "2.
|
|
1273
|
+
export declare const KIT_VERSION = "2.5.0";
|
|
1226
1274
|
/**
|
|
1227
1275
|
* Données de la page proposées comme colonnes.
|
|
1228
1276
|
*
|
|
@@ -1702,5 +1750,5 @@ export declare const NCF_TOOL_NAMES: readonly ["ncf-pages", "ncf-components", "n
|
|
|
1702
1750
|
* pas le Studio de démarrer : l'onglet concerné affiche le détail à corriger.
|
|
1703
1751
|
*/
|
|
1704
1752
|
export declare const ncfKit: import("sanity").Plugin<NcfKitConfig>;
|
|
1705
|
-
export { type AddColumnInput, type Annotation, type AnnotationsState, type BlockOccurrence, type BlockTypeInfo, type BoardEdge, type BoardGraph, type BoardLayoutState, type BoardNode, CONTENT_SCAN_LIMIT as OCCURRENCE_SCAN_LIMIT, type Change, type ChangeKind, type CollectedLinks, type ColorBy, type ColorOptions, type ConfigIssue, type DeriveOptions, type GroupBy, type GroupOptions, type HistoryDetail, type HistoryEvent, type IssueLevel, type KitContextValue, type LayoutMode, type MergedDoc, type NcfBoardTag, type NcfComponentPreviewConfig, type NcfDocumentColumn, type NcfEnvironment, type NcfHistoryConfig, type NcfI18nConfig, type NcfInternalField, type NcfInternalFieldOption, type NcfKitConfig, type NcfPageTypeConfig, type NcfPageTypeInput, type NcfToolName, type NcfToolsConfig, type NodeLayout, type NodePosition, type OccurrenceInput, type OccurrencePage, type OccurrencesState, type PageContent, type PageContentsState, type PageDoc, type PageFilters, type PageRow, type PageStatus, type PagesState, type PathInput, type Positioned, type PresentationOptions, type PreviewGrant, type PreviewPerspective, type PreviewTargetState, type ProjectStatus, type Registration, type ResolvedComponentPreview, type ResolvedDocumentColumn, type ResolvedHistory, type ResolvedI18n, type ResolvedKitConfig, type ResolvedPageType, type RowColor, type RowGroup, type SchemaFieldLike, type SchemaTypeLike, type SectionLayout, type SectionMapNode, type SectionOrder, type SectionsMapOptions, type Segment, type SiteRoutesRegistry, type SortDirection, type SortKey, type ThumbnailInput, type VersionedDoc };
|
|
1753
|
+
export { type AddColumnInput, type Annotation, type AnnotationsState, type BlockOccurrence, type BlockTypeInfo, type BoardEdge, type BoardGraph, type BoardLayoutState, type BoardNode, CONTENT_SCAN_LIMIT as OCCURRENCE_SCAN_LIMIT, type Change, type ChangeKind, type CollectedLinks, type ColorBy, type ColorOptions, type ConfigIssue, type DeriveOptions, type GroupBy, type GroupOptions, type HistoryDetail, type HistoryEvent, type IssueLevel, type KitContextValue, type KitUpdate, type LayoutMode, type MergedDoc, type NcfBoardTag, type NcfComponentPreviewConfig, type NcfDocumentColumn, type NcfEnvironment, type NcfHistoryConfig, type NcfI18nConfig, type NcfInternalField, type NcfInternalFieldOption, type NcfKitConfig, type NcfPageTypeConfig, type NcfPageTypeInput, type NcfToolName, type NcfToolsConfig, type NodeLayout, type NodePosition, type OccurrenceInput, type OccurrencePage, type OccurrencesState, type PageContent, type PageContentsState, type PageDoc, type PageFilters, type PageRow, type PageStatus, type PagesState, type PathInput, type Positioned, type PresentationOptions, type PreviewGrant, type PreviewPerspective, type PreviewTargetState, type ProjectStatus, type Registration, type ResolvedComponentPreview, type ResolvedDocumentColumn, type ResolvedHistory, type ResolvedI18n, type ResolvedKitConfig, type ResolvedPageType, type RowColor, type RowGroup, type SchemaFieldLike, type SchemaTypeLike, type SectionLayout, type SectionMapNode, type SectionOrder, type SectionsMapOptions, type Segment, type SiteRoutesRegistry, type SortDirection, type SortKey, type ThumbnailInput, type VersionedDoc };
|
|
1706
1754
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.js
CHANGED
|
@@ -8,7 +8,9 @@ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
|
8
8
|
import { IntentLink, useRouter } from "sanity/router";
|
|
9
9
|
import { EyeOpenIcon } from "@sanity/icons/EyeOpen";
|
|
10
10
|
import { LaunchIcon } from "@sanity/icons/Launch";
|
|
11
|
+
import { ArrowUpIcon } from "@sanity/icons/ArrowUp";
|
|
11
12
|
import { CheckmarkIcon } from "@sanity/icons/Checkmark";
|
|
13
|
+
import { CopyIcon } from "@sanity/icons/Copy";
|
|
12
14
|
import { CloseIcon } from "@sanity/icons/Close";
|
|
13
15
|
import { EarthGlobeIcon } from "@sanity/icons/EarthGlobe";
|
|
14
16
|
import { ProjectsIcon } from "@sanity/icons/Projects";
|
|
@@ -994,6 +996,19 @@ function urlOn(environment, path) {
|
|
|
994
996
|
return environment?.url ? path ? `${trimEnd(environment.url)}${path.startsWith("/") ? path : `/${path}`}` : trimEnd(environment.url) : null;
|
|
995
997
|
}
|
|
996
998
|
/**
|
|
999
|
+
* URL du vrai site, en ligne, pour un environnement et un état de contenu.
|
|
1000
|
+
*
|
|
1001
|
+
* Les brouillons passent par la route de bascule du site, qui pose le cookie
|
|
1002
|
+
* de mode brouillon puis renvoie à l'accueil. La production ne montre jamais
|
|
1003
|
+
* de brouillons : on y retombe sur l'URL simple, et la route refuserait de
|
|
1004
|
+
* toute façon.
|
|
1005
|
+
*/
|
|
1006
|
+
function onlineUrl(environment, perspective) {
|
|
1007
|
+
if (!environment?.url) return null;
|
|
1008
|
+
let base = environment.url.replace(/\/+$/, "");
|
|
1009
|
+
return perspective === "drafts" && environment.id !== "production" ? `${base}/api/draft-mode/toggle?enable=true&redirect=/` : base;
|
|
1010
|
+
}
|
|
1011
|
+
/**
|
|
997
1012
|
* Liens internes au Studio.
|
|
998
1013
|
*
|
|
999
1014
|
* Ouvrir une page doit mener à **Presentation**, pas à la structure : on veut
|
|
@@ -1272,7 +1287,7 @@ function explainGrantError(error) {
|
|
|
1272
1287
|
* Version du kit, rapportée au service pour savoir quels projets tournent sur
|
|
1273
1288
|
* quelle version. Tenue à jour avec `package.json`.
|
|
1274
1289
|
*/
|
|
1275
|
-
const KIT_VERSION = "2.
|
|
1290
|
+
const KIT_VERSION = "2.5.0";
|
|
1276
1291
|
/**
|
|
1277
1292
|
* Signale ce Studio au service du kit, une fois par montage.
|
|
1278
1293
|
*
|
|
@@ -1485,6 +1500,171 @@ const TABULAR = { fontVariantNumeric: "tabular-nums" }, MONO = {
|
|
|
1485
1500
|
addedMark: "#2f9e44"
|
|
1486
1501
|
};
|
|
1487
1502
|
/**
|
|
1503
|
+
* Comparaison de deux versions sémantiques.
|
|
1504
|
+
*
|
|
1505
|
+
* Suffisant pour ce qu'on en fait — savoir si une version publiée dépasse
|
|
1506
|
+
* celle qu'on exécute. Les mentions de pré-publication (`2.4.0-rc.1`) sont
|
|
1507
|
+
* ignorées : on ne propose jamais d'y passer.
|
|
1508
|
+
*
|
|
1509
|
+
* Rend 1 si `a` est postérieure, -1 si antérieure, 0 si égales.
|
|
1510
|
+
*/
|
|
1511
|
+
function compareVersions(a, b) {
|
|
1512
|
+
let parse = (v) => v.trim().replace(/^v/, "").split("-")[0].split(".").map((part) => Number.parseInt(part, 10) || 0), left = parse(a), right = parse(b);
|
|
1513
|
+
for (let i = 0; i < 3; i += 1) {
|
|
1514
|
+
let l = left[i] ?? 0, r = right[i] ?? 0;
|
|
1515
|
+
if (l !== r) return l > r ? 1 : -1;
|
|
1516
|
+
}
|
|
1517
|
+
return 0;
|
|
1518
|
+
}
|
|
1519
|
+
/** Une version de pré-publication ne se propose pas. */
|
|
1520
|
+
const isPrerelease = (version) => version.includes("-");
|
|
1521
|
+
/**
|
|
1522
|
+
* Compare la version exécutée à la dernière publiée.
|
|
1523
|
+
*
|
|
1524
|
+
* Un Studio tourne dans un navigateur : il ne peut ni installer un paquet ni
|
|
1525
|
+
* se redéployer. Il peut en revanche dire qu'il est en retard, et donner la
|
|
1526
|
+
* commande — c'est tout ce qu'un bouton peut honnêtement offrir ici.
|
|
1527
|
+
*
|
|
1528
|
+
* Le registre npm autorise les requêtes navigateur, et le paquet est public :
|
|
1529
|
+
* aucune authentification n'est nécessaire.
|
|
1530
|
+
*
|
|
1531
|
+
* Échoue en silence : ne pas savoir si une mise à jour existe ne doit gêner
|
|
1532
|
+
* personne.
|
|
1533
|
+
*/
|
|
1534
|
+
function useKitUpdate() {
|
|
1535
|
+
let [latest, setLatest] = useState(null);
|
|
1536
|
+
useEffect(() => {
|
|
1537
|
+
let controller = new AbortController();
|
|
1538
|
+
return fetch("https://registry.npmjs.org/@nocode-factory/sanity-kit/latest", { signal: controller.signal }).then((response) => response.ok ? response.json() : null).then((body) => {
|
|
1539
|
+
!controller.signal.aborted && body?.version && setLatest(body.version);
|
|
1540
|
+
}).catch(() => {}), () => controller.abort();
|
|
1541
|
+
}, []);
|
|
1542
|
+
let available = !!(latest && !isPrerelease(latest) && compareVersions(latest, "2.5.0") > 0);
|
|
1543
|
+
return {
|
|
1544
|
+
current: KIT_VERSION,
|
|
1545
|
+
latest,
|
|
1546
|
+
available,
|
|
1547
|
+
command: `npm install @nocode-factory/sanity-kit@${latest ?? "latest"}`
|
|
1548
|
+
};
|
|
1549
|
+
}
|
|
1550
|
+
/**
|
|
1551
|
+
* Signale qu'une version plus récente du kit existe.
|
|
1552
|
+
*
|
|
1553
|
+
* **Il ne met pas à jour.** Un Studio tourne dans un navigateur : il ne peut
|
|
1554
|
+
* ni installer un paquet sur le poste d'un développeur, ni se redéployer. Ce
|
|
1555
|
+
* bouton dit ce qui manque et donne la commande — prétendre faire plus serait
|
|
1556
|
+
* mentir sur ce qui se passe.
|
|
1557
|
+
*
|
|
1558
|
+
* Invisible tant que le kit est à jour : un bouton permanent qui ne dit rien
|
|
1559
|
+
* finit par ne plus être lu.
|
|
1560
|
+
*/
|
|
1561
|
+
function NcfKitUpdate(props) {
|
|
1562
|
+
let update = useKitUpdate(), [copied, setCopied] = useState(!1);
|
|
1563
|
+
if (!update.available) return null;
|
|
1564
|
+
let copy = async () => {
|
|
1565
|
+
try {
|
|
1566
|
+
await navigator.clipboard.writeText(update.command), setCopied(!0);
|
|
1567
|
+
} catch {
|
|
1568
|
+
setCopied(!1);
|
|
1569
|
+
}
|
|
1570
|
+
};
|
|
1571
|
+
return /* @__PURE__ */ jsx(InlinePopover, {
|
|
1572
|
+
width: 318,
|
|
1573
|
+
trigger: ({ toggle }) => /* @__PURE__ */ jsx(Button, {
|
|
1574
|
+
mode: "bleed",
|
|
1575
|
+
tone: "primary",
|
|
1576
|
+
fontSize: 1,
|
|
1577
|
+
padding: props.inline ? 2 : 3,
|
|
1578
|
+
icon: ArrowUpIcon,
|
|
1579
|
+
text: `Kit ${update.latest}`,
|
|
1580
|
+
title: `Une version plus récente du kit est disponible (vous exécutez la ${update.current})`,
|
|
1581
|
+
justify: props.inline ? void 0 : "flex-start",
|
|
1582
|
+
onClick: toggle
|
|
1583
|
+
}),
|
|
1584
|
+
children: () => /* @__PURE__ */ jsxs(Stack, {
|
|
1585
|
+
gap: 3,
|
|
1586
|
+
padding: 2,
|
|
1587
|
+
children: [
|
|
1588
|
+
/* @__PURE__ */ jsxs(Stack, {
|
|
1589
|
+
gap: 2,
|
|
1590
|
+
children: [/* @__PURE__ */ jsxs(Text, {
|
|
1591
|
+
size: 1,
|
|
1592
|
+
weight: "semibold",
|
|
1593
|
+
children: [
|
|
1594
|
+
"Kit ",
|
|
1595
|
+
update.latest,
|
|
1596
|
+
" disponible"
|
|
1597
|
+
]
|
|
1598
|
+
}), /* @__PURE__ */ jsxs(Text, {
|
|
1599
|
+
size: 0,
|
|
1600
|
+
muted: !0,
|
|
1601
|
+
children: [
|
|
1602
|
+
"Vous exécutez la ",
|
|
1603
|
+
update.current,
|
|
1604
|
+
"."
|
|
1605
|
+
]
|
|
1606
|
+
})]
|
|
1607
|
+
}),
|
|
1608
|
+
/* @__PURE__ */ jsx(Card, {
|
|
1609
|
+
padding: 2,
|
|
1610
|
+
radius: 2,
|
|
1611
|
+
style: { border: `1px solid ${BORDER}` },
|
|
1612
|
+
children: /* @__PURE__ */ jsx(Text, {
|
|
1613
|
+
size: 0,
|
|
1614
|
+
style: {
|
|
1615
|
+
...MONO,
|
|
1616
|
+
wordBreak: "break-all"
|
|
1617
|
+
},
|
|
1618
|
+
children: update.command
|
|
1619
|
+
})
|
|
1620
|
+
}),
|
|
1621
|
+
/* @__PURE__ */ jsxs(Flex, {
|
|
1622
|
+
gap: 2,
|
|
1623
|
+
wrap: "wrap",
|
|
1624
|
+
children: [/* @__PURE__ */ jsx(Button, {
|
|
1625
|
+
mode: "default",
|
|
1626
|
+
tone: "primary",
|
|
1627
|
+
fontSize: 1,
|
|
1628
|
+
padding: 2,
|
|
1629
|
+
icon: copied ? CheckmarkIcon : CopyIcon,
|
|
1630
|
+
text: copied ? "Copié" : "Copier la commande",
|
|
1631
|
+
onClick: copy
|
|
1632
|
+
}), /* @__PURE__ */ jsx(Button, {
|
|
1633
|
+
as: "a",
|
|
1634
|
+
href: "https://github.com/nocode-factory/ncf-sanity-kit/blob/main/docs/CHANGELOG.md",
|
|
1635
|
+
target: "_blank",
|
|
1636
|
+
rel: "noreferrer",
|
|
1637
|
+
mode: "bleed",
|
|
1638
|
+
fontSize: 1,
|
|
1639
|
+
padding: 2,
|
|
1640
|
+
text: "Nouveautés"
|
|
1641
|
+
})]
|
|
1642
|
+
}),
|
|
1643
|
+
/* @__PURE__ */ jsx(Box, {
|
|
1644
|
+
style: {
|
|
1645
|
+
borderTop: `1px solid ${BORDER}`,
|
|
1646
|
+
paddingTop: 10
|
|
1647
|
+
},
|
|
1648
|
+
children: /* @__PURE__ */ jsxs(Text, {
|
|
1649
|
+
size: 0,
|
|
1650
|
+
muted: !0,
|
|
1651
|
+
children: [
|
|
1652
|
+
"À lancer dans ",
|
|
1653
|
+
/* @__PURE__ */ jsx("code", { children: "studio/" }),
|
|
1654
|
+
" puis ",
|
|
1655
|
+
/* @__PURE__ */ jsx("code", { children: "web/" }),
|
|
1656
|
+
", suivi d'un",
|
|
1657
|
+
" ",
|
|
1658
|
+
/* @__PURE__ */ jsx("code", { children: "npx sanity deploy" }),
|
|
1659
|
+
". Le Studio ne peut pas le faire lui-même : il s'exécute dans votre navigateur, pas sur la machine qui le construit."
|
|
1660
|
+
]
|
|
1661
|
+
})
|
|
1662
|
+
})
|
|
1663
|
+
]
|
|
1664
|
+
})
|
|
1665
|
+
});
|
|
1666
|
+
}
|
|
1667
|
+
/**
|
|
1488
1668
|
* Lanceur d'aperçu, posé dans la barre du haut à droite des outils.
|
|
1489
1669
|
*
|
|
1490
1670
|
* Deux questions, une seule poignée : **quelle version du site**, et **quel
|
|
@@ -1497,87 +1677,118 @@ const TABULAR = { fontVariantNumeric: "tabular-nums" }, MONO = {
|
|
|
1497
1677
|
*/
|
|
1498
1678
|
function NcfPreviewLauncher(props) {
|
|
1499
1679
|
let config = useKitConfig(), router = useRouter(), environments = config.environments;
|
|
1500
|
-
if (environments.length === 0) return
|
|
1501
|
-
|
|
1680
|
+
if (environments.length === 0) return /* @__PURE__ */ jsxs(Flex, {
|
|
1681
|
+
align: "center",
|
|
1682
|
+
gap: 2,
|
|
1683
|
+
children: [props.renderDefault(props), /* @__PURE__ */ jsx(NcfKitUpdate, { inline: props.context === "topbar" })]
|
|
1684
|
+
});
|
|
1685
|
+
let openInStudio = (environment, perspective) => {
|
|
1502
1686
|
let path = presentationPath(environment.url, {
|
|
1503
1687
|
environment,
|
|
1504
1688
|
perspective
|
|
1505
1689
|
});
|
|
1506
1690
|
path && router.navigateUrl({ path });
|
|
1691
|
+
}, openOnline = (environment, perspective) => {
|
|
1692
|
+
let target = onlineUrl(environment, perspective);
|
|
1693
|
+
target && window.open(target, "_blank", "noopener");
|
|
1507
1694
|
}, inline = props.context === "topbar";
|
|
1508
1695
|
return /* @__PURE__ */ jsxs(Flex, {
|
|
1509
1696
|
align: inline ? "center" : "stretch",
|
|
1510
1697
|
direction: inline ? "row" : "column",
|
|
1511
1698
|
gap: inline ? 2 : 1,
|
|
1512
|
-
children: [
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
borderTop: `1px solid ${BORDER}`,
|
|
1530
|
-
marginTop: 4
|
|
1531
|
-
},
|
|
1699
|
+
children: [
|
|
1700
|
+
props.renderDefault(props),
|
|
1701
|
+
/* @__PURE__ */ jsx(NcfKitUpdate, { inline }),
|
|
1702
|
+
/* @__PURE__ */ jsx(InlinePopover, {
|
|
1703
|
+
width: 248,
|
|
1704
|
+
trigger: ({ toggle }) => /* @__PURE__ */ jsx(Button, {
|
|
1705
|
+
mode: "bleed",
|
|
1706
|
+
fontSize: 1,
|
|
1707
|
+
padding: inline ? 2 : 3,
|
|
1708
|
+
icon: EyeOpenIcon,
|
|
1709
|
+
text: "Prévisualiser",
|
|
1710
|
+
title: "Ouvrir le site dans l'aperçu",
|
|
1711
|
+
justify: inline ? void 0 : "flex-start",
|
|
1712
|
+
onClick: toggle
|
|
1713
|
+
}),
|
|
1714
|
+
children: ({ close }) => /* @__PURE__ */ jsxs(Stack, {
|
|
1715
|
+
gap: 1,
|
|
1532
1716
|
children: [/* @__PURE__ */ jsx(Box, {
|
|
1533
1717
|
paddingX: 2,
|
|
1534
|
-
|
|
1718
|
+
paddingTop: 1,
|
|
1719
|
+
paddingBottom: 2,
|
|
1535
1720
|
children: /* @__PURE__ */ jsx(Text, {
|
|
1536
1721
|
size: 0,
|
|
1537
|
-
weight: "semibold",
|
|
1538
1722
|
muted: !0,
|
|
1539
|
-
|
|
1540
|
-
children: environment.label
|
|
1723
|
+
children: "Cliquer : ouvre dans le Studio. L'icône ↗ : ouvre le site en ligne."
|
|
1541
1724
|
})
|
|
1542
|
-
}),
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
open(environment, option.id), close();
|
|
1548
|
-
},
|
|
1549
|
-
style: {
|
|
1550
|
-
cursor: "pointer",
|
|
1551
|
-
borderRadius: 3
|
|
1725
|
+
}), environments.map((environment, index) => /* @__PURE__ */ jsxs(Box, {
|
|
1726
|
+
paddingTop: index === 0 ? 1 : 3,
|
|
1727
|
+
style: index === 0 ? void 0 : {
|
|
1728
|
+
borderTop: `1px solid ${BORDER}`,
|
|
1729
|
+
marginTop: 4
|
|
1552
1730
|
},
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
event.currentTarget.style.background = "transparent";
|
|
1558
|
-
},
|
|
1559
|
-
children: [/* @__PURE__ */ jsxs(Stack, {
|
|
1560
|
-
gap: 1,
|
|
1561
|
-
flex: 1,
|
|
1562
|
-
style: { minWidth: 0 },
|
|
1563
|
-
children: [/* @__PURE__ */ jsx(Text, {
|
|
1564
|
-
size: 1,
|
|
1565
|
-
children: option.label
|
|
1566
|
-
}), /* @__PURE__ */ jsx(Text, {
|
|
1731
|
+
children: [/* @__PURE__ */ jsx(Box, {
|
|
1732
|
+
paddingX: 2,
|
|
1733
|
+
paddingBottom: 1,
|
|
1734
|
+
children: /* @__PURE__ */ jsx(Text, {
|
|
1567
1735
|
size: 0,
|
|
1736
|
+
weight: "semibold",
|
|
1568
1737
|
muted: !0,
|
|
1569
1738
|
textOverflow: "ellipsis",
|
|
1570
|
-
children:
|
|
1739
|
+
children: environment.label
|
|
1740
|
+
})
|
|
1741
|
+
}), PERSPECTIVES.map((option) => /* @__PURE__ */ jsxs(Flex, {
|
|
1742
|
+
align: "center",
|
|
1743
|
+
gap: 1,
|
|
1744
|
+
children: [/* @__PURE__ */ jsx(Flex, {
|
|
1745
|
+
align: "center",
|
|
1746
|
+
flex: 1,
|
|
1747
|
+
padding: 2,
|
|
1748
|
+
onClick: () => {
|
|
1749
|
+
openInStudio(environment, option.id), close();
|
|
1750
|
+
},
|
|
1751
|
+
style: {
|
|
1752
|
+
cursor: "pointer",
|
|
1753
|
+
borderRadius: 3,
|
|
1754
|
+
minWidth: 0
|
|
1755
|
+
},
|
|
1756
|
+
title: "Ouvrir dans le Studio (Presentation)",
|
|
1757
|
+
onMouseEnter: (event) => {
|
|
1758
|
+
event.currentTarget.style.background = "var(--card-muted-bg-color, rgba(127,127,127,0.12))";
|
|
1759
|
+
},
|
|
1760
|
+
onMouseLeave: (event) => {
|
|
1761
|
+
event.currentTarget.style.background = "transparent";
|
|
1762
|
+
},
|
|
1763
|
+
children: /* @__PURE__ */ jsxs(Stack, {
|
|
1764
|
+
gap: 1,
|
|
1765
|
+
style: { minWidth: 0 },
|
|
1766
|
+
children: [/* @__PURE__ */ jsx(Text, {
|
|
1767
|
+
size: 1,
|
|
1768
|
+
children: option.label
|
|
1769
|
+
}), /* @__PURE__ */ jsx(Text, {
|
|
1770
|
+
size: 0,
|
|
1771
|
+
muted: !0,
|
|
1772
|
+
textOverflow: "ellipsis",
|
|
1773
|
+
children: option.hint
|
|
1774
|
+
})]
|
|
1775
|
+
})
|
|
1776
|
+
}), /* @__PURE__ */ jsx(Button, {
|
|
1777
|
+
mode: "bleed",
|
|
1778
|
+
padding: 2,
|
|
1779
|
+
fontSize: 1,
|
|
1780
|
+
icon: LaunchIcon,
|
|
1781
|
+
title: "Ouvrir le site en ligne, dans un nouvel onglet",
|
|
1782
|
+
"aria-label": `Ouvrir ${environment.label} en ligne (${option.label})`,
|
|
1783
|
+
onClick: () => {
|
|
1784
|
+
openOnline(environment, option.id), close();
|
|
1785
|
+
}
|
|
1571
1786
|
})]
|
|
1572
|
-
}
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
flex: "none"
|
|
1576
|
-
} })]
|
|
1577
|
-
}, option.id))]
|
|
1578
|
-
}, environment.id))
|
|
1787
|
+
}, option.id))]
|
|
1788
|
+
}, environment.id))]
|
|
1789
|
+
})
|
|
1579
1790
|
})
|
|
1580
|
-
|
|
1791
|
+
]
|
|
1581
1792
|
});
|
|
1582
1793
|
}
|
|
1583
1794
|
/**
|
|
@@ -6992,6 +7203,6 @@ const NCF_PAGES_TOOL = "ncf-pages", NCF_COMPONENTS_TOOL = "ncf-components", NCF_
|
|
|
6992
7203
|
studio: { components: { toolMenu: createPreviewLauncher(config, issues) } }
|
|
6993
7204
|
};
|
|
6994
7205
|
});
|
|
6995
|
-
export { ANNOTATION_TYPE, ActorName, 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, DATA_PREFIX, DEFAULT_BOARD_TAGS, DEFAULT_COMPONENT_PREVIEW, DEFAULT_I18N, DEFAULT_INTERNAL_FIELDS, DEFAULT_MORE_TOOLS, DEFAULT_PAGE_BUILDER_FIELD, DEFAULT_SLUG_FIELD, DEFAULT_TITLE_FIELD, KIT_API_VERSION, KIT_VERSION, NCF_COMPONENTS_TOOL, NCF_HIDDEN_TYPES, NCF_HISTORY_TOOL, NCF_MORE_TOOL, NCF_PAGES_TOOL, NCF_TOOL_NAMES, NODE_FIELD_TYPE, NODE_HEIGHT, NODE_WIDTH, NcfPreviewHeader, NcfPreviewLauncher, PERSPECTIVES, PROJECTION, SECTION_NODE_TYPE, STATUS_COLORS, STATUS_LABELS, SharePreview, UNSET_LABEL, addColumn, addColumnOption, announce, applySavedPositions, baseId, blockName, blockTypesFromSchema, buildContentsQuery, buildLinkGraph, buildPageRows, buildPagesQuery, collectLinks, collectOccurrences, colorForRow, colorFromString, columnId, createPreviewLauncher, customEnvironment, defaultNodeSize, depth, deriveDocumentColumns, diffDocuments, diffWords, editIntentPath, explainGrantError, fallbackLayout, fetchDetail, fetchTimeline, fillTemplate, filterRows, flatten, formatDocumentValue, groupPageRows, groupValue, hasBlockingIssue, humanizeBlockName, isDraftId, isKitType, isSafeColumnKey, isSafeFieldPath, isTextChange, isVersionId, issuesForTool, keyForPath, kitSchemaTypes, layoutGraph, layoutSectionsMap, localesInRows, mergeVersions, missingPageTypes, moveColumn, ncfAllowedOrigins, ncfKit, ncfPreviewComponents, normalizeInternalPath, normalizePath, occurrencesForTypes, pageThumbnailUrl, pageTypeFor, pageTypesFromSiteRoutes, pageTypesWithoutBuilder, parentPath, presentationPath, pruneSavedPositions, releaseId, removeColumn, renameColumn, requestPreviewGrant, resolveColorBy, resolveConfig, segments, slugKey, sortRows, summarize, toKebabCase, toPath, toUrl, topLevelBlockCount, uniqueColumnId, upsertLayout, urlOn, useAnnotations, useBoardLayout, useDocumentColumns, useHistory, useInternalColumns, useKitClient, useKitConfig, useKitContext, useOccurrences, usePageContents, usePages, usePreviewTarget, useRegistration, validateConfig, withAlpha, withMoreTool };
|
|
7206
|
+
export { ANNOTATION_TYPE, ActorName, 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, DATA_PREFIX, DEFAULT_BOARD_TAGS, DEFAULT_COMPONENT_PREVIEW, DEFAULT_I18N, DEFAULT_INTERNAL_FIELDS, DEFAULT_MORE_TOOLS, DEFAULT_PAGE_BUILDER_FIELD, DEFAULT_SLUG_FIELD, DEFAULT_TITLE_FIELD, KIT_API_VERSION, KIT_VERSION, NCF_COMPONENTS_TOOL, NCF_HIDDEN_TYPES, NCF_HISTORY_TOOL, NCF_MORE_TOOL, NCF_PAGES_TOOL, NCF_TOOL_NAMES, NODE_FIELD_TYPE, NODE_HEIGHT, NODE_WIDTH, NcfKitUpdate, NcfPreviewHeader, NcfPreviewLauncher, PERSPECTIVES, PROJECTION, SECTION_NODE_TYPE, STATUS_COLORS, STATUS_LABELS, SharePreview, UNSET_LABEL, addColumn, addColumnOption, announce, applySavedPositions, baseId, blockName, blockTypesFromSchema, buildContentsQuery, buildLinkGraph, buildPageRows, buildPagesQuery, collectLinks, collectOccurrences, colorForRow, colorFromString, columnId, compareVersions, createPreviewLauncher, customEnvironment, defaultNodeSize, depth, deriveDocumentColumns, diffDocuments, diffWords, editIntentPath, explainGrantError, fallbackLayout, fetchDetail, fetchTimeline, fillTemplate, filterRows, flatten, formatDocumentValue, groupPageRows, groupValue, hasBlockingIssue, humanizeBlockName, isDraftId, isKitType, isPrerelease, isSafeColumnKey, isSafeFieldPath, isTextChange, isVersionId, issuesForTool, keyForPath, kitSchemaTypes, layoutGraph, layoutSectionsMap, localesInRows, mergeVersions, missingPageTypes, moveColumn, ncfAllowedOrigins, ncfKit, ncfPreviewComponents, normalizeInternalPath, normalizePath, occurrencesForTypes, pageThumbnailUrl, pageTypeFor, pageTypesFromSiteRoutes, pageTypesWithoutBuilder, parentPath, presentationPath, pruneSavedPositions, releaseId, removeColumn, renameColumn, requestPreviewGrant, resolveColorBy, resolveConfig, segments, slugKey, sortRows, summarize, toKebabCase, toPath, toUrl, topLevelBlockCount, uniqueColumnId, upsertLayout, urlOn, useAnnotations, useBoardLayout, useDocumentColumns, useHistory, useInternalColumns, useKitClient, useKitConfig, useKitContext, useKitUpdate, useOccurrences, usePageContents, usePages, usePreviewTarget, useRegistration, validateConfig, withAlpha, withMoreTool };
|
|
6996
7207
|
|
|
6997
7208
|
//# sourceMappingURL=index.js.map
|