@starterlib/tokens 0.10.13 → 0.11.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/README.md +125 -3
- package/fesm2022/starterlib-tokens-moteur.mjs +774 -54
- package/fesm2022/starterlib-tokens-moteur.mjs.map +1 -1
- package/fesm2022/starterlib-tokens.mjs +1 -0
- package/fesm2022/starterlib-tokens.mjs.map +1 -1
- package/package.json +1 -1
- package/styles/_jetons.scss +13 -0
- package/styles/_typographie.scss +5 -0
- package/styles/exemple-blanc.tokens.json +1941 -0
- package/styles/polices/LICENSE-source-serif.txt +93 -0
- package/styles/polices/source-serif-4-latin-ext-wght-normal.woff2 +0 -0
- package/styles/polices/source-serif-4-latin-wght-normal.woff2 +0 -0
- package/styles/polices-titres.css +39 -0
- package/styles/starter-tokens-exemple-blanc.css +72 -0
- package/styles/starter-tokens.css +71 -3
- package/styles/starter-tokens.tokens.json +240 -0
- package/types/starterlib-tokens-moteur.d.ts +217 -13
- package/types/starterlib-tokens.d.ts +10 -0
|
@@ -177,6 +177,11 @@ const FAMILLES = {
|
|
|
177
177
|
teinte: 25,
|
|
178
178
|
chromaMax: .19,
|
|
179
179
|
vocation: "danger, erreur, action destructrice"
|
|
180
|
+
},
|
|
181
|
+
violet: {
|
|
182
|
+
teinte: 294,
|
|
183
|
+
chromaMax: .11,
|
|
184
|
+
vocation: "essai : environnement fictif, bac a sable (jamais un statut ni une action)"
|
|
180
185
|
}
|
|
181
186
|
};
|
|
182
187
|
const NEUTRES = {
|
|
@@ -308,6 +313,7 @@ const definitionsDesPrimitives = {
|
|
|
308
313
|
vert: rampe("vert"),
|
|
309
314
|
ambre: rampe("ambre"),
|
|
310
315
|
rouge: rampe("rouge"),
|
|
316
|
+
violet: rampe("violet"),
|
|
311
317
|
serie: engendrer(RANGS_DE_SERIE, (rang) => SERIE[rang])
|
|
312
318
|
};
|
|
313
319
|
function enHex$1(rampeDefinie) {
|
|
@@ -321,6 +327,7 @@ const primitives = {
|
|
|
321
327
|
vert: enHex$1(definitionsDesPrimitives.vert),
|
|
322
328
|
ambre: enHex$1(definitionsDesPrimitives.ambre),
|
|
323
329
|
rouge: enHex$1(definitionsDesPrimitives.rouge),
|
|
330
|
+
violet: enHex$1(definitionsDesPrimitives.violet),
|
|
324
331
|
serie: enHex$1(definitionsDesPrimitives.serie)
|
|
325
332
|
};
|
|
326
333
|
const espacement = {
|
|
@@ -489,7 +496,8 @@ const hauteurDeCommande = {
|
|
|
489
496
|
md: "2.25rem",
|
|
490
497
|
lg: "2.5rem",
|
|
491
498
|
xl: "2.75rem",
|
|
492
|
-
"2xl": "3.25rem"
|
|
499
|
+
"2xl": "3.25rem",
|
|
500
|
+
embarquee: "3rem"
|
|
493
501
|
};
|
|
494
502
|
const MODES_DE_DENSITE = [
|
|
495
503
|
"confortable",
|
|
@@ -677,7 +685,13 @@ const SOMBRE_CALCULE = {
|
|
|
677
685
|
surfaceSurvolElevee: "#383f49",
|
|
678
686
|
surfaceActive: "#424851"
|
|
679
687
|
};
|
|
680
|
-
const { neutre, bleu, azur, or, vert, ambre, rouge } = primitives;
|
|
688
|
+
const { neutre, bleu, azur, or, vert, ambre, rouge, violet, serie } = primitives;
|
|
689
|
+
function serieSombre(rang) {
|
|
690
|
+
return oklchVersHex({
|
|
691
|
+
...definitionsDesPrimitives.serie[rang].oklch,
|
|
692
|
+
l: .72
|
|
693
|
+
});
|
|
694
|
+
}
|
|
681
695
|
const themeClair = {
|
|
682
696
|
fond: RENDU.fond,
|
|
683
697
|
surface: neutre[0],
|
|
@@ -739,6 +753,18 @@ const themeClair = {
|
|
|
739
753
|
dangerDiscret: rouge[50],
|
|
740
754
|
surDangerDiscret: rouge[900],
|
|
741
755
|
dangerDiscretCourant: rouge[100],
|
|
756
|
+
erreur: rouge[600],
|
|
757
|
+
surErreur: neutre[0],
|
|
758
|
+
erreurDiscret: rouge[50],
|
|
759
|
+
surErreurDiscret: rouge[900],
|
|
760
|
+
essai: violet[600],
|
|
761
|
+
surEssai: neutre[0],
|
|
762
|
+
essaiDiscret: violet[50],
|
|
763
|
+
surEssaiDiscret: violet[900],
|
|
764
|
+
serie1: serie[1],
|
|
765
|
+
serie2: serie[2],
|
|
766
|
+
serie3: serie[3],
|
|
767
|
+
serie4: serie[4],
|
|
742
768
|
positif: RENDU.positif,
|
|
743
769
|
negatif: RENDU.texte
|
|
744
770
|
};
|
|
@@ -803,6 +829,18 @@ const themeSombre = {
|
|
|
803
829
|
dangerDiscret: rouge[900],
|
|
804
830
|
surDangerDiscret: rouge[100],
|
|
805
831
|
dangerDiscretCourant: rouge[950],
|
|
832
|
+
erreur: rouge[300],
|
|
833
|
+
surErreur: neutre[950],
|
|
834
|
+
erreurDiscret: rouge[900],
|
|
835
|
+
surErreurDiscret: rouge[100],
|
|
836
|
+
essai: violet[300],
|
|
837
|
+
surEssai: neutre[950],
|
|
838
|
+
essaiDiscret: violet[900],
|
|
839
|
+
surEssaiDiscret: violet[100],
|
|
840
|
+
serie1: serieSombre(1),
|
|
841
|
+
serie2: serieSombre(2),
|
|
842
|
+
serie3: serieSombre(3),
|
|
843
|
+
serie4: serieSombre(4),
|
|
806
844
|
positif: vert[300],
|
|
807
845
|
negatif: neutre[100]
|
|
808
846
|
};
|
|
@@ -810,6 +848,12 @@ const themes = {
|
|
|
810
848
|
clair: themeClair,
|
|
811
849
|
sombre: themeSombre
|
|
812
850
|
};
|
|
851
|
+
const aliasDeRole = {
|
|
852
|
+
erreur: "danger",
|
|
853
|
+
surErreur: "surDanger",
|
|
854
|
+
erreurDiscret: "dangerDiscret",
|
|
855
|
+
surErreurDiscret: "surDangerDiscret"
|
|
856
|
+
};
|
|
813
857
|
function surChacune(premierPlan, arrierePlans, nature = "courant") {
|
|
814
858
|
return arrierePlans.map((arrierePlan) => ({
|
|
815
859
|
premierPlan,
|
|
@@ -981,6 +1025,48 @@ const pairesDeContraste = [
|
|
|
981
1025
|
"dangerDiscret",
|
|
982
1026
|
"dangerDiscretCourant"
|
|
983
1027
|
]),
|
|
1028
|
+
{
|
|
1029
|
+
premierPlan: "surErreur",
|
|
1030
|
+
arrierePlan: "erreur",
|
|
1031
|
+
nature: "courant"
|
|
1032
|
+
},
|
|
1033
|
+
{
|
|
1034
|
+
premierPlan: "surErreurDiscret",
|
|
1035
|
+
arrierePlan: "erreurDiscret",
|
|
1036
|
+
nature: "courant"
|
|
1037
|
+
},
|
|
1038
|
+
...surChacune("erreur", [...SURFACES_DE_STATUT, "erreurDiscret"]),
|
|
1039
|
+
{
|
|
1040
|
+
premierPlan: "surEssai",
|
|
1041
|
+
arrierePlan: "essai",
|
|
1042
|
+
nature: "courant"
|
|
1043
|
+
},
|
|
1044
|
+
{
|
|
1045
|
+
premierPlan: "surEssaiDiscret",
|
|
1046
|
+
arrierePlan: "essaiDiscret",
|
|
1047
|
+
nature: "courant"
|
|
1048
|
+
},
|
|
1049
|
+
...surChacune("essai", [...SURFACES_DE_STATUT, "essaiDiscret"]),
|
|
1050
|
+
...surChacune("serie1", [
|
|
1051
|
+
"fond",
|
|
1052
|
+
"surface",
|
|
1053
|
+
"surfaceElevee"
|
|
1054
|
+
], "composant"),
|
|
1055
|
+
...surChacune("serie2", [
|
|
1056
|
+
"fond",
|
|
1057
|
+
"surface",
|
|
1058
|
+
"surfaceElevee"
|
|
1059
|
+
], "composant"),
|
|
1060
|
+
...surChacune("serie3", [
|
|
1061
|
+
"fond",
|
|
1062
|
+
"surface",
|
|
1063
|
+
"surfaceElevee"
|
|
1064
|
+
], "composant"),
|
|
1065
|
+
...surChacune("serie4", [
|
|
1066
|
+
"fond",
|
|
1067
|
+
"surface",
|
|
1068
|
+
"surfaceElevee"
|
|
1069
|
+
], "composant"),
|
|
984
1070
|
...surChacune("positif", [
|
|
985
1071
|
"surface",
|
|
986
1072
|
"fond",
|
|
@@ -1080,7 +1166,8 @@ const surfacesDuFocus = [
|
|
|
1080
1166
|
"accent",
|
|
1081
1167
|
"succes",
|
|
1082
1168
|
"information",
|
|
1083
|
-
"avertissement"
|
|
1169
|
+
"avertissement",
|
|
1170
|
+
"essaiDiscret"
|
|
1084
1171
|
];
|
|
1085
1172
|
const COUCHES = [
|
|
1086
1173
|
"repos",
|
|
@@ -1226,30 +1313,35 @@ const stylesTypographiques = {
|
|
|
1226
1313
|
interligne: "md",
|
|
1227
1314
|
graisse: "semi",
|
|
1228
1315
|
interlettrage: "approche",
|
|
1316
|
+
famille: "titre",
|
|
1229
1317
|
usage: "intertitre, titre de dialogue et de carte (18/24)"
|
|
1230
1318
|
},
|
|
1231
1319
|
"titre-3": {
|
|
1232
1320
|
taille: "xl",
|
|
1233
1321
|
graisse: "semi",
|
|
1234
1322
|
interlettrage: "approche",
|
|
1323
|
+
famille: "titre",
|
|
1235
1324
|
usage: "titre de section"
|
|
1236
1325
|
},
|
|
1237
1326
|
"titre-2": {
|
|
1238
1327
|
taille: "2xl",
|
|
1239
1328
|
graisse: "semi",
|
|
1240
1329
|
interlettrage: "approche",
|
|
1330
|
+
famille: "titre",
|
|
1241
1331
|
usage: "titre de bloc majeur"
|
|
1242
1332
|
},
|
|
1243
1333
|
"titre-1": {
|
|
1244
1334
|
taille: "3xl",
|
|
1245
1335
|
graisse: "semi",
|
|
1246
1336
|
interlettrage: "approche",
|
|
1337
|
+
famille: "titre",
|
|
1247
1338
|
usage: "titre de page (h1 de 32 px, D18)"
|
|
1248
1339
|
},
|
|
1249
1340
|
affichage: {
|
|
1250
1341
|
taille: "4xl",
|
|
1251
1342
|
graisse: "semi",
|
|
1252
1343
|
interlettrage: "approche",
|
|
1344
|
+
famille: "titre",
|
|
1253
1345
|
usage: "annonce, titre d ecran de marque"
|
|
1254
1346
|
},
|
|
1255
1347
|
"affichage-grand": {
|
|
@@ -1310,6 +1402,7 @@ function declarationsDuStyle(nom) {
|
|
|
1310
1402
|
const style = stylesTypographiques[nom];
|
|
1311
1403
|
return [
|
|
1312
1404
|
...style.famille === "mono" ? ["font-family: var(--st-police-mono);"] : [],
|
|
1405
|
+
...style.famille === "titre" ? ["font-family: var(--st-police-titre, var(--st-police-base));"] : [],
|
|
1313
1406
|
`font-size: var(--st-taille-${style.taille});`,
|
|
1314
1407
|
`line-height: var(--st-interligne-${style.interligne ?? style.taille});`,
|
|
1315
1408
|
`font-weight: var(--st-graisse-${style.graisse});`,
|
|
@@ -1342,6 +1435,27 @@ ${branches.join("")} } @else {
|
|
|
1342
1435
|
}
|
|
1343
1436
|
const LATIN = "U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD";
|
|
1344
1437
|
const LATIN_ETENDU = "U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF";
|
|
1438
|
+
const ARIAL = {
|
|
1439
|
+
unitesParEm: 2048,
|
|
1440
|
+
ascendante: 1854,
|
|
1441
|
+
descendante: 434,
|
|
1442
|
+
interligneAjoute: 67,
|
|
1443
|
+
chasseMoyenne: 904
|
|
1444
|
+
};
|
|
1445
|
+
const COURIER_NEW = {
|
|
1446
|
+
unitesParEm: 2048,
|
|
1447
|
+
ascendante: 1705,
|
|
1448
|
+
descendante: 615,
|
|
1449
|
+
interligneAjoute: 0,
|
|
1450
|
+
chasseMoyenne: 1229
|
|
1451
|
+
};
|
|
1452
|
+
const TIMES_NEW_ROMAN = {
|
|
1453
|
+
unitesParEm: 2048,
|
|
1454
|
+
ascendante: 1825,
|
|
1455
|
+
descendante: 443,
|
|
1456
|
+
interligneAjoute: 87,
|
|
1457
|
+
chasseMoyenne: 832
|
|
1458
|
+
};
|
|
1345
1459
|
const policesDuSocle = [{
|
|
1346
1460
|
famille: "Inter Variable",
|
|
1347
1461
|
graisses: "100 900",
|
|
@@ -1390,13 +1504,7 @@ const policesDuSocle = [{
|
|
|
1390
1504
|
"Liberation Sans",
|
|
1391
1505
|
"Arimo"
|
|
1392
1506
|
],
|
|
1393
|
-
metriques:
|
|
1394
|
-
unitesParEm: 2048,
|
|
1395
|
-
ascendante: 1854,
|
|
1396
|
-
descendante: 434,
|
|
1397
|
-
interligneAjoute: 67,
|
|
1398
|
-
chasseMoyenne: 904
|
|
1399
|
-
}
|
|
1507
|
+
metriques: ARIAL
|
|
1400
1508
|
}
|
|
1401
1509
|
}, {
|
|
1402
1510
|
famille: "JetBrains Mono Variable",
|
|
@@ -1426,15 +1534,42 @@ const policesDuSocle = [{
|
|
|
1426
1534
|
"Liberation Mono",
|
|
1427
1535
|
"Cousine"
|
|
1428
1536
|
],
|
|
1429
|
-
metriques:
|
|
1430
|
-
unitesParEm: 2048,
|
|
1431
|
-
ascendante: 1705,
|
|
1432
|
-
descendante: 615,
|
|
1433
|
-
interligneAjoute: 0,
|
|
1434
|
-
chasseMoyenne: 1229
|
|
1435
|
-
}
|
|
1537
|
+
metriques: COURIER_NEW
|
|
1436
1538
|
}
|
|
1437
1539
|
}];
|
|
1540
|
+
const policesDeTitre = [{
|
|
1541
|
+
famille: "Source Serif 4 Variable",
|
|
1542
|
+
graisses: "200 900",
|
|
1543
|
+
paquet: "@fontsource-variable/source-serif-4",
|
|
1544
|
+
licenceLivree: "LICENSE-source-serif.txt",
|
|
1545
|
+
fichiers: [{
|
|
1546
|
+
fichier: "source-serif-4-latin-ext-wght-normal.woff2",
|
|
1547
|
+
unicodeRange: LATIN_ETENDU,
|
|
1548
|
+
aPrecharger: false
|
|
1549
|
+
}, {
|
|
1550
|
+
fichier: "source-serif-4-latin-wght-normal.woff2",
|
|
1551
|
+
unicodeRange: LATIN,
|
|
1552
|
+
aPrecharger: false
|
|
1553
|
+
}],
|
|
1554
|
+
metriques: {
|
|
1555
|
+
unitesParEm: 1e3,
|
|
1556
|
+
ascendante: 1036,
|
|
1557
|
+
descendante: 335,
|
|
1558
|
+
interligneAjoute: 0,
|
|
1559
|
+
chasseMoyenne: 475.57
|
|
1560
|
+
},
|
|
1561
|
+
repli: {
|
|
1562
|
+
famille: "Source Serif 4 Repli",
|
|
1563
|
+
locales: [
|
|
1564
|
+
"Times New Roman",
|
|
1565
|
+
"TimesNewRomanPSMT",
|
|
1566
|
+
"Liberation Serif",
|
|
1567
|
+
"Tinos"
|
|
1568
|
+
],
|
|
1569
|
+
metriques: TIMES_NEW_ROMAN
|
|
1570
|
+
}
|
|
1571
|
+
}];
|
|
1572
|
+
const pileDeTitre = "'Source Serif 4 Variable', 'Source Serif 4 Repli', Georgia, serif";
|
|
1438
1573
|
function pourcent(valeur) {
|
|
1439
1574
|
return `${(Math.round(valeur * 1e4) / 100).toFixed(2)}%`;
|
|
1440
1575
|
}
|
|
@@ -1452,8 +1587,8 @@ function surchargesDuRepli(police) {
|
|
|
1452
1587
|
function fichiersAPrecharger() {
|
|
1453
1588
|
return policesDuSocle.flatMap((p) => p.fichiers.filter((f) => f.aPrecharger).map((f) => f.fichier));
|
|
1454
1589
|
}
|
|
1455
|
-
function
|
|
1456
|
-
|
|
1590
|
+
function facesDesPolices(polices) {
|
|
1591
|
+
return polices.flatMap((police) => {
|
|
1457
1592
|
const faces = police.fichiers.map((f) => `@font-face {
|
|
1458
1593
|
font-family: '${police.famille}';
|
|
1459
1594
|
font-style: normal;
|
|
@@ -1473,6 +1608,9 @@ function feuilleDesPolices() {
|
|
|
1473
1608
|
}`;
|
|
1474
1609
|
return [...faces, repli];
|
|
1475
1610
|
});
|
|
1611
|
+
}
|
|
1612
|
+
function feuilleDesPolices() {
|
|
1613
|
+
const blocs = facesDesPolices(policesDuSocle);
|
|
1476
1614
|
return `/* Engendre par @starterlib/tokens \u2014 ne pas modifier a la main.
|
|
1477
1615
|
Regenerer : pnpm tokens:css
|
|
1478
1616
|
|
|
@@ -1485,6 +1623,23 @@ ${fichiersAPrecharger().map((f) => ` <link rel="preload" href="\u2026/police
|
|
|
1485
1623
|
${blocs.join("\n\n")}
|
|
1486
1624
|
`;
|
|
1487
1625
|
}
|
|
1626
|
+
function feuilleDesPolicesDeTitre() {
|
|
1627
|
+
return `/* Engendre par @starterlib/tokens \u2014 ne pas modifier a la main.
|
|
1628
|
+
Regenerer : pnpm tokens:css
|
|
1629
|
+
|
|
1630
|
+
Police de TITRE, OPTIONNELLE (Source Serif 4, SIL OFL 1.1, voir polices/LICENSE-source-serif.txt) :
|
|
1631
|
+
a charger EN PLUS de polices.css par l'application qui veut ses titres en serif. Sans elle, les
|
|
1632
|
+
styles titre-* et affichage gardent la police de base, et aucun octet de plus ne part. Ne pas la
|
|
1633
|
+
precharger sur un ecran anonyme sous seuil (ADR 0031) : font-display: optional et le repli metrise
|
|
1634
|
+
excluent tout decalage a son arrivee. Recette : docs/recettes/police.md. */
|
|
1635
|
+
|
|
1636
|
+
${facesDesPolices(policesDeTitre).join("\n\n")}
|
|
1637
|
+
|
|
1638
|
+
:root {
|
|
1639
|
+
--st-police-titre: ${pileDeTitre};
|
|
1640
|
+
}
|
|
1641
|
+
`;
|
|
1642
|
+
}
|
|
1488
1643
|
const jetonsDeComposant = [
|
|
1489
1644
|
{
|
|
1490
1645
|
nom: "--st-commande-hauteur",
|
|
@@ -1508,7 +1663,8 @@ const jetonsDeComposant = [
|
|
|
1508
1663
|
"st-password-field",
|
|
1509
1664
|
"st-tag-input",
|
|
1510
1665
|
"st-file-upload",
|
|
1511
|
-
"st-pagination"
|
|
1666
|
+
"st-pagination",
|
|
1667
|
+
"st-bottom-nav"
|
|
1512
1668
|
]
|
|
1513
1669
|
},
|
|
1514
1670
|
{
|
|
@@ -1613,6 +1769,8 @@ const jetonsDeComposant = [
|
|
|
1613
1769
|
];
|
|
1614
1770
|
const contratsDHote = [
|
|
1615
1771
|
"--st-hauteur-entete",
|
|
1772
|
+
"--st-hauteur-pied",
|
|
1773
|
+
"--st-hauteur-action",
|
|
1616
1774
|
"--st-coquille-hauteur-entete",
|
|
1617
1775
|
"--st-form-actions-hauteur",
|
|
1618
1776
|
"--st-choix-interligne",
|
|
@@ -1635,7 +1793,25 @@ const variablesInternes = [
|
|
|
1635
1793
|
"--st-tableau-plan-figee",
|
|
1636
1794
|
"--st-tableau-plan-entete",
|
|
1637
1795
|
"--st-tableau-plan-coin",
|
|
1638
|
-
"--st-skeleton-derniere"
|
|
1796
|
+
"--st-skeleton-derniere",
|
|
1797
|
+
"--st-virtual-list-hauteur",
|
|
1798
|
+
"--st-avatar-group-taille",
|
|
1799
|
+
"--st-carte-espace",
|
|
1800
|
+
"--st-carte-ombre-survol",
|
|
1801
|
+
"--st-carte-trace-survol",
|
|
1802
|
+
"--st-deadline-encre",
|
|
1803
|
+
"--st-deadline-fond",
|
|
1804
|
+
"--st-dialogue-sens",
|
|
1805
|
+
"--st-form-row-colonnes",
|
|
1806
|
+
"--st-meter-encre",
|
|
1807
|
+
"--st-repartition-hauteur",
|
|
1808
|
+
"--st-skeleton-pas",
|
|
1809
|
+
"--st-tableau-decalage-figee",
|
|
1810
|
+
"--st-tableau-fond-ligne",
|
|
1811
|
+
"--st-timeline-repere",
|
|
1812
|
+
"--st-toast-cible",
|
|
1813
|
+
"--st-toast-ton",
|
|
1814
|
+
"--st-tri-rembourrage"
|
|
1639
1815
|
];
|
|
1640
1816
|
function estJetonDeComposant(nom) {
|
|
1641
1817
|
return jetonsDeComposant.some((jeton) => jeton.nom === nom);
|
|
@@ -1647,24 +1823,28 @@ function enKebab(valeur) {
|
|
|
1647
1823
|
function aplatir(prefixe, valeurs) {
|
|
1648
1824
|
return Object.entries(valeurs).map(([cle, valeur]) => ` ${prefixe}-${enKebab(cle)}: ${valeur};`);
|
|
1649
1825
|
}
|
|
1650
|
-
function selonLeTheme(clair, sombre) {
|
|
1826
|
+
function selonLeTheme$1(clair, sombre) {
|
|
1651
1827
|
return clair === sombre ? clair : `light-dark(${clair}, ${sombre})`;
|
|
1652
1828
|
}
|
|
1653
1829
|
function nomDeCouleur(jeton) {
|
|
1654
1830
|
return `${PREFIXE}-couleur-${enKebab(jeton)}`;
|
|
1655
1831
|
}
|
|
1656
|
-
function couleursEnCss() {
|
|
1657
|
-
return Object.keys(themeClair).map((jeton) =>
|
|
1832
|
+
function couleursEnCss(litteral = false) {
|
|
1833
|
+
return Object.keys(themeClair).map((jeton) => {
|
|
1834
|
+
const cible = aliasDeRole[jeton];
|
|
1835
|
+
const valeur = cible === void 0 || litteral ? selonLeTheme$1(themeClair[jeton], themeSombre[jeton]) : `var(${nomDeCouleur(cible)})`;
|
|
1836
|
+
return ` ${nomDeCouleur(jeton)}: ${valeur};`;
|
|
1837
|
+
});
|
|
1658
1838
|
}
|
|
1659
1839
|
function ombresEnCss() {
|
|
1660
1840
|
return [
|
|
1661
1841
|
` ${PREFIXE}-ombre-none: none;`,
|
|
1662
1842
|
...COUCHES.map((couche) => {
|
|
1663
|
-
const valeur = ombres[couche].map((c) => `${c.geometrie} ${selonLeTheme(c.couleur.clair, c.couleur.sombre)}`).join(", ");
|
|
1843
|
+
const valeur = ombres[couche].map((c) => `${c.geometrie} ${selonLeTheme$1(c.couleur.clair, c.couleur.sombre)}`).join(", ");
|
|
1664
1844
|
return ` ${PREFIXE}-ombre-${couche}: ${valeur};`;
|
|
1665
1845
|
}),
|
|
1666
|
-
` ${PREFIXE}-voile: ${selonLeTheme(voile.clair, voile.sombre)};`,
|
|
1667
|
-
` ${PREFIXE}-couleur-ombre: ${selonLeTheme(couleurDOmbre.clair, couleurDOmbre.sombre)};`
|
|
1846
|
+
` ${PREFIXE}-voile: ${selonLeTheme$1(voile.clair, voile.sombre)};`,
|
|
1847
|
+
` ${PREFIXE}-couleur-ombre: ${selonLeTheme$1(couleurDOmbre.clair, couleurDOmbre.sombre)};`
|
|
1668
1848
|
];
|
|
1669
1849
|
}
|
|
1670
1850
|
function cssDesEchelles() {
|
|
@@ -1693,8 +1873,8 @@ function cssDesEchelles() {
|
|
|
1693
1873
|
` ${PREFIXE}-cible-min: ${cibleMinimale};`
|
|
1694
1874
|
].join("\n");
|
|
1695
1875
|
}
|
|
1696
|
-
function cssDuTheme() {
|
|
1697
|
-
return [...couleursEnCss(), ...ombresEnCss()].join("\n");
|
|
1876
|
+
function cssDuTheme(litteral = false) {
|
|
1877
|
+
return [...couleursEnCss(litteral), ...ombresEnCss()].join("\n");
|
|
1698
1878
|
}
|
|
1699
1879
|
function variablesDeDensite(mode, retrait = " ") {
|
|
1700
1880
|
return Object.entries(densite[mode]).map(([nom, valeur]) => `${retrait}${PREFIXE}-${nom}: ${valeur};`).join("\n");
|
|
@@ -1741,8 +1921,8 @@ function themeSousContrasteRenforce(theme) {
|
|
|
1741
1921
|
return rendu;
|
|
1742
1922
|
}
|
|
1743
1923
|
const aliasDeContrasteRenforce = {
|
|
1744
|
-
...Object.fromEntries(Object.entries(aliasDeContrasteRenforceParJeton).map(([jeton, cible]) => [nomDeCouleur(jeton), selonLeTheme(themeClair[cible], themeSombre[cible])])),
|
|
1745
|
-
...Object.fromEntries(Object.entries(encresDeContrasteRenforce).map(([jeton, encres]) => [nomDeCouleur(jeton), selonLeTheme(encres.clair, encres.sombre)])),
|
|
1924
|
+
...Object.fromEntries(Object.entries(aliasDeContrasteRenforceParJeton).map(([jeton, cible]) => [nomDeCouleur(jeton), selonLeTheme$1(themeClair[cible], themeSombre[cible])])),
|
|
1925
|
+
...Object.fromEntries(Object.entries(encresDeContrasteRenforce).map(([jeton, encres]) => [nomDeCouleur(jeton), selonLeTheme$1(encres.clair, encres.sombre)])),
|
|
1746
1926
|
[`${PREFIXE}-focus-epaisseur`]: `var(${PREFIXE}-epaisseur-forte)`
|
|
1747
1927
|
};
|
|
1748
1928
|
const couleursSysteme = {
|
|
@@ -1768,7 +1948,9 @@ const couleursSysteme = {
|
|
|
1768
1948
|
"succesDiscret",
|
|
1769
1949
|
"avertissementDiscret",
|
|
1770
1950
|
"dangerDiscret",
|
|
1771
|
-
"dangerDiscretCourant"
|
|
1951
|
+
"dangerDiscretCourant",
|
|
1952
|
+
"erreurDiscret",
|
|
1953
|
+
"essaiDiscret"
|
|
1772
1954
|
],
|
|
1773
1955
|
CanvasText: [
|
|
1774
1956
|
"texte",
|
|
@@ -1788,6 +1970,12 @@ const couleursSysteme = {
|
|
|
1788
1970
|
"danger",
|
|
1789
1971
|
"dangerSurvol",
|
|
1790
1972
|
"dangerActif",
|
|
1973
|
+
"erreur",
|
|
1974
|
+
"essai",
|
|
1975
|
+
"serie1",
|
|
1976
|
+
"serie2",
|
|
1977
|
+
"serie3",
|
|
1978
|
+
"serie4",
|
|
1791
1979
|
"positif",
|
|
1792
1980
|
"surPrimaireDiscret",
|
|
1793
1981
|
"surPrimaireAttenue",
|
|
@@ -1795,7 +1983,9 @@ const couleursSysteme = {
|
|
|
1795
1983
|
"surInformationDiscret",
|
|
1796
1984
|
"surSuccesDiscret",
|
|
1797
1985
|
"surAvertissementDiscret",
|
|
1798
|
-
"surDangerDiscret"
|
|
1986
|
+
"surDangerDiscret",
|
|
1987
|
+
"surErreurDiscret",
|
|
1988
|
+
"surEssaiDiscret"
|
|
1799
1989
|
],
|
|
1800
1990
|
GrayText: ["texteDesactive"],
|
|
1801
1991
|
LinkText: [
|
|
@@ -1817,7 +2007,9 @@ const encresDAplat = [
|
|
|
1817
2007
|
"surInformation",
|
|
1818
2008
|
"surSucces",
|
|
1819
2009
|
"surAvertissement",
|
|
1820
|
-
"surDanger"
|
|
2010
|
+
"surDanger",
|
|
2011
|
+
"surErreur",
|
|
2012
|
+
"surEssai"
|
|
1821
2013
|
];
|
|
1822
2014
|
const derogationsDImpression = {
|
|
1823
2015
|
fond: "#ffffff",
|
|
@@ -1833,13 +2025,15 @@ const derogationsDImpression = {
|
|
|
1833
2025
|
avertissement: "#783f03",
|
|
1834
2026
|
danger: "#960c19",
|
|
1835
2027
|
information: "#0b5776",
|
|
2028
|
+
essai: primitives.violet[700],
|
|
1836
2029
|
primaireDiscret: "#ffffff",
|
|
1837
2030
|
primaireAttenue: "#ffffff",
|
|
1838
2031
|
accentDiscret: "#ffffff",
|
|
1839
2032
|
informationDiscret: "#ffffff",
|
|
1840
2033
|
succesDiscret: "#ffffff",
|
|
1841
2034
|
avertissementDiscret: "#ffffff",
|
|
1842
|
-
dangerDiscret: "#ffffff"
|
|
2035
|
+
dangerDiscret: "#ffffff",
|
|
2036
|
+
essaiDiscret: "#ffffff"
|
|
1843
2037
|
};
|
|
1844
2038
|
const taillesDImpression = {
|
|
1845
2039
|
"2xs": "8pt",
|
|
@@ -1854,7 +2048,7 @@ const taillesDImpression = {
|
|
|
1854
2048
|
"5xl": "28pt",
|
|
1855
2049
|
"6xl": "32pt"
|
|
1856
2050
|
};
|
|
1857
|
-
function declarations(valeurs, retrait) {
|
|
2051
|
+
function declarations$1(valeurs, retrait) {
|
|
1858
2052
|
return Object.entries(valeurs).map(([nom, valeur]) => `${retrait}${nom}: ${valeur};`).join("\n");
|
|
1859
2053
|
}
|
|
1860
2054
|
function blocContrasteForce() {
|
|
@@ -1862,7 +2056,7 @@ function blocContrasteForce() {
|
|
|
1862
2056
|
for (const [systeme, jetons] of Object.entries(couleursSysteme)) for (const jeton of jetons) alias[nomDeCouleur(jeton)] = systeme;
|
|
1863
2057
|
for (const couche of ["none", ...COUCHES]) alias[`${PREFIXE}-ombre-${couche}`] = "none";
|
|
1864
2058
|
alias[`${PREFIXE}-epaisseur-capillaire`] = epaisseurCapillaire.base;
|
|
1865
|
-
return declarations(alias, " ");
|
|
2059
|
+
return declarations$1(alias, " ");
|
|
1866
2060
|
}
|
|
1867
2061
|
function blocImpression() {
|
|
1868
2062
|
const valeurs = {};
|
|
@@ -1871,12 +2065,38 @@ function blocImpression() {
|
|
|
1871
2065
|
valeurs[`${PREFIXE}-voile`] = "transparent";
|
|
1872
2066
|
valeurs[`${PREFIXE}-epaisseur-capillaire`] = epaisseurCapillaire.base;
|
|
1873
2067
|
for (const [cle, taille] of Object.entries(taillesDImpression)) valeurs[`${PREFIXE}-taille-${cle}`] = taille;
|
|
1874
|
-
return declarations(valeurs, " ");
|
|
2068
|
+
return declarations$1(valeurs, " ");
|
|
1875
2069
|
}
|
|
1876
2070
|
function affichageSelonLeTheme(theme, retrait = " ") {
|
|
1877
2071
|
const visible = "inline";
|
|
1878
2072
|
return [`${retrait}${PREFIXE}-affichage-si-clair: ${theme === "clair" ? visible : "none"};`, `${retrait}${PREFIXE}-affichage-si-sombre: ${theme === "sombre" ? visible : "none"};`].join("\n");
|
|
1879
2073
|
}
|
|
2074
|
+
const REGLAGE_DU_PREFIXE_DE_TON = `${PREFIXE}-prefixe-de-ton`;
|
|
2075
|
+
function reglesDuPrefixeDeTon() {
|
|
2076
|
+
return `.st-prefixe-de-ton {
|
|
2077
|
+
position: absolute;
|
|
2078
|
+
width: 1px;
|
|
2079
|
+
height: 1px;
|
|
2080
|
+
padding: 0;
|
|
2081
|
+
margin: -1px;
|
|
2082
|
+
overflow: hidden;
|
|
2083
|
+
clip-path: inset(50%);
|
|
2084
|
+
white-space: nowrap;
|
|
2085
|
+
border: 0;
|
|
2086
|
+
}
|
|
2087
|
+
|
|
2088
|
+
@container style(${REGLAGE_DU_PREFIXE_DE_TON}: visible) {
|
|
2089
|
+
.st-prefixe-de-ton {
|
|
2090
|
+
position: static;
|
|
2091
|
+
width: auto;
|
|
2092
|
+
height: auto;
|
|
2093
|
+
margin: 0;
|
|
2094
|
+
overflow: visible;
|
|
2095
|
+
clip-path: none;
|
|
2096
|
+
white-space: normal;
|
|
2097
|
+
}
|
|
2098
|
+
}`;
|
|
2099
|
+
}
|
|
1880
2100
|
function feuilleDeJetons() {
|
|
1881
2101
|
return `/* Engendre par @starterlib/tokens \u2014 ne pas modifier a la main.
|
|
1882
2102
|
Regenerer : pnpm tokens:css */
|
|
@@ -1944,6 +2164,17 @@ ${variablesDeDensite("compacte")}
|
|
|
1944
2164
|
}
|
|
1945
2165
|
}
|
|
1946
2166
|
|
|
2167
|
+
/* Mode embarque (ADR 0043 du socle backend, lots 276 et 300) : un ecran du socle dans la WebView
|
|
2168
|
+
d'une application mobile prend la cible des applications natives, 48 px, au pointeur fin comme
|
|
2169
|
+
au doigt. Pose sur <html> par la coquille, pour une route que son manifeste declarera
|
|
2170
|
+
embarquable (contrat a poser avec le BFF), jamais par un parametre libre de l'adresse. Apres
|
|
2171
|
+
le pointeur grossier et les densites : a (0,1,0), comme toute regle de la feuille, il l'emporte
|
|
2172
|
+
par l'ordre, zones de densite comprises. */
|
|
2173
|
+
[data-mode='embarque'],
|
|
2174
|
+
:where([data-mode='embarque']) [data-densite] {
|
|
2175
|
+
${PREFIXE}-hauteur-commande-defaut: var(${PREFIXE}-hauteur-commande-embarquee);
|
|
2176
|
+
}
|
|
2177
|
+
|
|
1947
2178
|
/* Un filet d'un vrai pixel d'ecran sur les dalles haute densite. */
|
|
1948
2179
|
@media (min-resolution: 2dppx) {
|
|
1949
2180
|
:root {
|
|
@@ -1958,26 +2189,31 @@ ${variablesDeDensite("compacte")}
|
|
|
1958
2189
|
ne se fige jamais. \`:where(:root)\` : la regle pese (0,1,0), comme les autres. */
|
|
1959
2190
|
@media (prefers-reduced-motion: reduce) {
|
|
1960
2191
|
:where(:root):not([data-mouvement='complet']) {
|
|
1961
|
-
${declarations(mouvementReduit, " ")}
|
|
2192
|
+
${declarations$1(mouvementReduit, " ")}
|
|
1962
2193
|
}
|
|
1963
2194
|
}
|
|
1964
2195
|
|
|
1965
2196
|
[data-mouvement='reduit'] {
|
|
1966
|
-
${declarations(mouvementReduit, " ")}
|
|
2197
|
+
${declarations$1(mouvementReduit, " ")}
|
|
1967
2198
|
}
|
|
1968
2199
|
|
|
1969
2200
|
/* Gel d'une image : au changement de theme ou de langue, rien ne transite le temps
|
|
1970
2201
|
d'un rendu (StTheme et StLangue posent data-gel sur <html>). Place apres le
|
|
1971
2202
|
mouvement : un mouvement complet choisi ne leve pas le gel. */
|
|
1972
2203
|
[data-gel] {
|
|
1973
|
-
${declarations(mouvementGele, " ")}
|
|
2204
|
+
${declarations$1(mouvementGele, " ")}
|
|
1974
2205
|
}
|
|
1975
2206
|
|
|
1976
|
-
/* WCAG 2.4.11 : un arret de tabulation ne remonte jamais sous l'en-tete collant
|
|
1977
|
-
|
|
1978
|
-
|
|
2207
|
+
/* WCAG 2.4.11 : un arret de tabulation ne remonte jamais sous l'en-tete collant, ni ne
|
|
2208
|
+
descend sous la barre de navigation inferieure ou sous l'action permanente flottante.
|
|
2209
|
+
\`${PREFIXE}-hauteur-entete\` est posee sur <html> par st-app-shell, qui mesure son
|
|
2210
|
+
en-tete ; \`${PREFIXE}-hauteur-pied\` par st-bottom-nav, sous md (P08-05) ;
|
|
2211
|
+
\`${PREFIXE}-hauteur-action\` par st-app-shell, sous md, du bas de la fenetre au haut de
|
|
2212
|
+
l'action qui flotte (P08-06), barre comprise. Sans elles, le repli vaut zero et rien ne
|
|
2213
|
+
change. */
|
|
1979
2214
|
html {
|
|
1980
2215
|
scroll-padding-block-start: var(${PREFIXE}-hauteur-entete, 0px);
|
|
2216
|
+
scroll-padding-block-end: max(var(${PREFIXE}-hauteur-pied, 0px), var(${PREFIXE}-hauteur-action, 0px));
|
|
1981
2217
|
}
|
|
1982
2218
|
|
|
1983
2219
|
/* Rythme vertical d'un formulaire, porte par le CONTENEUR (lot 200) : les champs du
|
|
@@ -2007,6 +2243,11 @@ html {
|
|
|
2007
2243
|
border: 0;
|
|
2008
2244
|
}
|
|
2009
2245
|
|
|
2246
|
+
/* Prefixe de ton (\u00ab Erreur : \u00bb, P08-03) : masque et lu, comme .st-vh ; affiche sous le reglage
|
|
2247
|
+
${REGLAGE_DU_PREFIXE_DE_TON}: visible, pose par l'application sur la racine, une zone ou une
|
|
2248
|
+
instance (requete de style : Chrome 111, Safari 18, Firefox 151 ; en deca, il reste masque). */
|
|
2249
|
+
${reglesDuPrefixeDeTon()}
|
|
2250
|
+
|
|
2010
2251
|
/* Contrat avec le CDK : ses surfaces (menus, popovers, infobulles, tiroirs,
|
|
2011
2252
|
dialogues) s'empilent par l'ordre du DOM dans ce conteneur, qui lit le plan. */
|
|
2012
2253
|
.cdk-overlay-container {
|
|
@@ -2016,7 +2257,7 @@ html {
|
|
|
2016
2257
|
/* Contraste renforce : alias du theme courant, clair ou sombre (01 \u00a77.1). */
|
|
2017
2258
|
@media (prefers-contrast: more) {
|
|
2018
2259
|
:root {
|
|
2019
|
-
${declarations(aliasDeContrasteRenforce, " ")}
|
|
2260
|
+
${declarations$1(aliasDeContrasteRenforce, " ")}
|
|
2020
2261
|
}
|
|
2021
2262
|
}
|
|
2022
2263
|
|
|
@@ -2068,6 +2309,114 @@ ${blocImpression()}
|
|
|
2068
2309
|
}
|
|
2069
2310
|
`;
|
|
2070
2311
|
}
|
|
2312
|
+
function feuilleDesJetonsDUnElement() {
|
|
2313
|
+
return `:host {
|
|
2314
|
+
color-scheme: light;
|
|
2315
|
+
color: var(${nomDeCouleur("texte")});
|
|
2316
|
+
${affichageSelonLeTheme("clair")}
|
|
2317
|
+
${cssDesEchelles()}
|
|
2318
|
+
${cssDuTheme()}
|
|
2319
|
+
${variablesDeDensite("confortable")}
|
|
2320
|
+
}
|
|
2321
|
+
|
|
2322
|
+
@media (prefers-color-scheme: dark) {
|
|
2323
|
+
:host(:not([data-theme='clair'])) {
|
|
2324
|
+
color-scheme: dark;
|
|
2325
|
+
${affichageSelonLeTheme("sombre", " ")}
|
|
2326
|
+
}
|
|
2327
|
+
}
|
|
2328
|
+
|
|
2329
|
+
:host([data-theme='sombre']) {
|
|
2330
|
+
color-scheme: dark;
|
|
2331
|
+
${affichageSelonLeTheme("sombre")}
|
|
2332
|
+
}
|
|
2333
|
+
|
|
2334
|
+
:host([data-theme='clair']) {
|
|
2335
|
+
color-scheme: light;
|
|
2336
|
+
${affichageSelonLeTheme("clair")}
|
|
2337
|
+
}
|
|
2338
|
+
|
|
2339
|
+
::selection {
|
|
2340
|
+
color: var(${nomDeCouleur("surSelection")});
|
|
2341
|
+
background: var(${nomDeCouleur("selection")});
|
|
2342
|
+
}
|
|
2343
|
+
|
|
2344
|
+
:host([data-densite='confortable']) {
|
|
2345
|
+
${variablesDeDensite("confortable")}
|
|
2346
|
+
}
|
|
2347
|
+
|
|
2348
|
+
:host([data-densite='dense']) {
|
|
2349
|
+
${variablesDeDensite("dense")}
|
|
2350
|
+
}
|
|
2351
|
+
|
|
2352
|
+
:host([data-densite='compacte']) {
|
|
2353
|
+
${variablesDeDensite("compacte")}
|
|
2354
|
+
}
|
|
2355
|
+
|
|
2356
|
+
@media (pointer: coarse) {
|
|
2357
|
+
:host,
|
|
2358
|
+
:host([data-densite]) {
|
|
2359
|
+
${PREFIXE}-hauteur-commande-defaut: var(${PREFIXE}-hauteur-commande-xl);
|
|
2360
|
+
${PREFIXE}-calendrier-jour-defaut: var(${PREFIXE}-cible-tactile-min);
|
|
2361
|
+
}
|
|
2362
|
+
}
|
|
2363
|
+
|
|
2364
|
+
@media (min-resolution: 2dppx) {
|
|
2365
|
+
:host {
|
|
2366
|
+
${PREFIXE}-epaisseur-capillaire: ${epaisseurCapillaire.hauteDensite};
|
|
2367
|
+
}
|
|
2368
|
+
}
|
|
2369
|
+
|
|
2370
|
+
@media (prefers-reduced-motion: reduce) {
|
|
2371
|
+
:host(:not([data-mouvement='complet'])) {
|
|
2372
|
+
${declarations$1(mouvementReduit, " ")}
|
|
2373
|
+
}
|
|
2374
|
+
}
|
|
2375
|
+
|
|
2376
|
+
:host([data-mouvement='reduit']) {
|
|
2377
|
+
${declarations$1(mouvementReduit, " ")}
|
|
2378
|
+
}
|
|
2379
|
+
|
|
2380
|
+
.st-vh,
|
|
2381
|
+
.st-vh-focalisable:where(:not(:focus-within)) {
|
|
2382
|
+
position: absolute;
|
|
2383
|
+
width: 1px;
|
|
2384
|
+
height: 1px;
|
|
2385
|
+
padding: 0;
|
|
2386
|
+
margin: -1px;
|
|
2387
|
+
overflow: hidden;
|
|
2388
|
+
clip-path: inset(50%);
|
|
2389
|
+
white-space: nowrap;
|
|
2390
|
+
border: 0;
|
|
2391
|
+
}
|
|
2392
|
+
|
|
2393
|
+
${reglesDuPrefixeDeTon()}
|
|
2394
|
+
|
|
2395
|
+
@media (prefers-contrast: more) {
|
|
2396
|
+
:host {
|
|
2397
|
+
${declarations$1(aliasDeContrasteRenforce, " ")}
|
|
2398
|
+
}
|
|
2399
|
+
}
|
|
2400
|
+
|
|
2401
|
+
@media (forced-colors: active) {
|
|
2402
|
+
:host {
|
|
2403
|
+
${blocContrasteForce()}
|
|
2404
|
+
}
|
|
2405
|
+
}
|
|
2406
|
+
|
|
2407
|
+
@media print {
|
|
2408
|
+
:host,
|
|
2409
|
+
:host([data-theme]) {
|
|
2410
|
+
color-scheme: light;
|
|
2411
|
+
${affichageSelonLeTheme("clair", " ")}
|
|
2412
|
+
}
|
|
2413
|
+
|
|
2414
|
+
:host {
|
|
2415
|
+
${blocImpression()}
|
|
2416
|
+
}
|
|
2417
|
+
}
|
|
2418
|
+
`;
|
|
2419
|
+
}
|
|
2071
2420
|
function entreeDeCarte(nom, valeur) {
|
|
2072
2421
|
const chaine = valeur.includes("'") && !valeur.includes("\"") ? `"${valeur}"` : `'${valeur}'`;
|
|
2073
2422
|
const enLigne = ` '${nom}': ${chaine},`;
|
|
@@ -2087,7 +2436,7 @@ function partielDesJetons() {
|
|
|
2087
2436
|
$jetons: (
|
|
2088
2437
|
${[
|
|
2089
2438
|
cssDesEchelles(),
|
|
2090
|
-
cssDuTheme(),
|
|
2439
|
+
cssDuTheme(true),
|
|
2091
2440
|
variablesDeDensite("confortable")
|
|
2092
2441
|
].join("\n").split("\n").map((ligne) => DECLARATION_DE_JETON.exec(ligne)).filter((trouve) => trouve !== null).map(([, nom, valeur]) => entreeDeCarte(nom ?? "", valeur ?? "")).join("\n")}
|
|
2093
2442
|
);
|
|
@@ -2108,8 +2457,8 @@ function jetonsDtcg() {
|
|
|
2108
2457
|
const jetons = {
|
|
2109
2458
|
$description: "Jetons de @starterlib/tokens au format DTCG 2025.10. Engendre par tools/generer-css.mjs : ne pas modifier.",
|
|
2110
2459
|
couleur: {
|
|
2111
|
-
clair: couleurs(themeClair),
|
|
2112
|
-
sombre: couleurs(themeSombre)
|
|
2460
|
+
clair: couleurs(themeClair, "clair"),
|
|
2461
|
+
sombre: couleurs(themeSombre, "sombre")
|
|
2113
2462
|
},
|
|
2114
2463
|
espacement: dimensions(espacement),
|
|
2115
2464
|
rayon: dimensions(rayon),
|
|
@@ -2133,12 +2482,15 @@ function jetonsDtcg() {
|
|
|
2133
2482
|
};
|
|
2134
2483
|
return `${JSON.stringify(jetons, null, 2)}\n`;
|
|
2135
2484
|
}
|
|
2136
|
-
function couleurs(theme) {
|
|
2485
|
+
function couleurs(theme, nomDuTheme) {
|
|
2137
2486
|
const noms = Object.keys(theme);
|
|
2138
|
-
return Object.fromEntries(noms.map((nom) =>
|
|
2139
|
-
|
|
2140
|
-
|
|
2141
|
-
|
|
2487
|
+
return Object.fromEntries(noms.map((nom) => {
|
|
2488
|
+
const cible = aliasDeRole[nom];
|
|
2489
|
+
return [nom, {
|
|
2490
|
+
$type: "color",
|
|
2491
|
+
$value: cible === void 0 ? couleur(theme[nom]) : `{couleur.${nomDuTheme}.${cible}}`
|
|
2492
|
+
}];
|
|
2493
|
+
}));
|
|
2142
2494
|
}
|
|
2143
2495
|
function couleur(hex) {
|
|
2144
2496
|
return {
|
|
@@ -2173,6 +2525,374 @@ function dimension(valeur) {
|
|
|
2173
2525
|
function familles(pile) {
|
|
2174
2526
|
return pile.split(",").map((famille) => famille.trim().replace(/^'(.*)'$/, "$1"));
|
|
2175
2527
|
}
|
|
2176
|
-
|
|
2528
|
+
var MarqueNonConforme = class extends Error {
|
|
2529
|
+
defauts;
|
|
2530
|
+
constructor(nom, defauts) {
|
|
2531
|
+
super(`Marque ${nom} non conforme :\n ${defauts.join("\n ")}`);
|
|
2532
|
+
this.name = "MarqueNonConforme";
|
|
2533
|
+
this.defauts = defauts;
|
|
2534
|
+
}
|
|
2535
|
+
};
|
|
2536
|
+
const pairesDuContourEleve = [{
|
|
2537
|
+
premierPlan: "bordureForteElevee",
|
|
2538
|
+
arrierePlans: [
|
|
2539
|
+
"surfaceElevee",
|
|
2540
|
+
"surfaceConteneurHaut",
|
|
2541
|
+
"surface"
|
|
2542
|
+
],
|
|
2543
|
+
nature: "composant"
|
|
2544
|
+
}];
|
|
2545
|
+
const ecartsDeMarque = [...ecartsDeSurface, {
|
|
2546
|
+
devant: "surface",
|
|
2547
|
+
derriere: "fond",
|
|
2548
|
+
minimum: 1.03,
|
|
2549
|
+
pourquoi: "une surface posee sur la page s en detache"
|
|
2550
|
+
}];
|
|
2551
|
+
const ALIAS_DU_CONTOUR_ELEVE = { bordureForteElevee: "texteDiscret" };
|
|
2552
|
+
const conteneursEleves = [
|
|
2553
|
+
"st-dialog-container",
|
|
2554
|
+
"st-dialog-content",
|
|
2555
|
+
"st-menu",
|
|
2556
|
+
"st-popover"
|
|
2557
|
+
];
|
|
2558
|
+
const NOM_DE_MARQUE = /^[a-z][a-z0-9-]{1,40}$/;
|
|
2559
|
+
const HEX = /^#[0-9a-fA-F]{6}$/;
|
|
2560
|
+
const ROLES = /* @__PURE__ */ new Set([...Object.keys(themeClair), "bordureForteElevee"]);
|
|
2561
|
+
const NATURES = /* @__PURE__ */ new Set([
|
|
2562
|
+
"courant",
|
|
2563
|
+
"grand",
|
|
2564
|
+
"composant"
|
|
2565
|
+
]);
|
|
2566
|
+
const THEMES = ["clair", "sombre"];
|
|
2567
|
+
const RAISON_MINIMALE = 40;
|
|
2568
|
+
function base(theme) {
|
|
2569
|
+
return theme === "clair" ? themeClair : themeSombre;
|
|
2570
|
+
}
|
|
2571
|
+
function enMinuscules(valeur) {
|
|
2572
|
+
return valeur.toLowerCase();
|
|
2573
|
+
}
|
|
2574
|
+
function themeDeMarque(valeurs, theme) {
|
|
2575
|
+
const posees = valeurs[theme];
|
|
2576
|
+
const rendu = { ...base(theme) };
|
|
2577
|
+
for (const [role, valeur] of Object.entries(posees)) if (valeur !== void 0) rendu[role] = enMinuscules(valeur);
|
|
2578
|
+
rendu["bordureForteElevee"] = enMinuscules(posees.bordureForteElevee ?? posees.bordureForte ?? base(theme).bordureForte);
|
|
2579
|
+
for (const [role, cible] of Object.entries(aliasDeRole)) if (posees[role] === void 0) rendu[role] = rendu[cible] ?? base(theme)[cible];
|
|
2580
|
+
return rendu;
|
|
2581
|
+
}
|
|
2582
|
+
function poseParLaMarque(valeurs, theme, role) {
|
|
2583
|
+
const valeur = valeurs[theme][role];
|
|
2584
|
+
if (valeur === void 0) return false;
|
|
2585
|
+
if (role === "bordureForteElevee") return true;
|
|
2586
|
+
const cible = aliasDeRole[role];
|
|
2587
|
+
const sansElle = cible === void 0 ? base(theme)[role] : enMinuscules(valeurs[theme][cible] ?? base(theme)[cible]);
|
|
2588
|
+
return enMinuscules(valeur) !== sansElle;
|
|
2589
|
+
}
|
|
2590
|
+
function themeDeMarqueSousContrasteRenforce(valeurs, theme) {
|
|
2591
|
+
const normal = themeDeMarque(valeurs, theme);
|
|
2592
|
+
const rendu = { ...normal };
|
|
2593
|
+
const alias = {
|
|
2594
|
+
...aliasDeContrasteRenforceParJeton,
|
|
2595
|
+
...ALIAS_DU_CONTOUR_ELEVE
|
|
2596
|
+
};
|
|
2597
|
+
for (const [role, cible] of Object.entries(alias)) rendu[role] = normal[cible];
|
|
2598
|
+
for (const [role, encres] of Object.entries(encresDeContrasteRenforce)) if (!poseParLaMarque(valeurs, theme, role)) rendu[role] = encres[theme];
|
|
2599
|
+
return rendu;
|
|
2600
|
+
}
|
|
2601
|
+
function mesure(theme, jetons, devant, derriere) {
|
|
2602
|
+
const rapport = rapportDeContraste(jetons[devant], jetons[derriere]);
|
|
2603
|
+
return `${theme} : ${devant} (${jetons[devant]}) sur ${derriere} (${jetons[derriere]}) = ${rapport.toFixed(2)}:1`;
|
|
2604
|
+
}
|
|
2605
|
+
function memeEcart(e, a, b) {
|
|
2606
|
+
return e[0] === a && e[1] === b || e[0] === b && e[1] === a;
|
|
2607
|
+
}
|
|
2608
|
+
function estUnObjet(valeur) {
|
|
2609
|
+
return typeof valeur === "object" && valeur !== null && !Array.isArray(valeur);
|
|
2610
|
+
}
|
|
2611
|
+
function citee(valeur) {
|
|
2612
|
+
if (valeur === void 0) return "absent";
|
|
2613
|
+
return typeof valeur === "string" ? valeur : JSON.stringify(valeur);
|
|
2614
|
+
}
|
|
2615
|
+
function liste(valeur) {
|
|
2616
|
+
return Array.isArray(valeur) ? valeur : [];
|
|
2617
|
+
}
|
|
2618
|
+
function raisonEcrite(valeur) {
|
|
2619
|
+
return typeof valeur === "string" && valeur.length >= RAISON_MINIMALE;
|
|
2620
|
+
}
|
|
2621
|
+
function defautsDeForme(valeurs) {
|
|
2622
|
+
if (!estUnObjet(valeurs)) return ["la marque n est pas un objet"];
|
|
2623
|
+
const defauts = [];
|
|
2624
|
+
const nom = valeurs["nom"];
|
|
2625
|
+
if (typeof nom !== "string" || !NOM_DE_MARQUE.test(nom)) defauts.push(`nom : « ${citee(nom)} » hors de ^[a-z][a-z0-9-]{1,40}$`);
|
|
2626
|
+
for (const theme of THEMES) {
|
|
2627
|
+
const couleurs = valeurs[theme];
|
|
2628
|
+
if (!estUnObjet(couleurs)) {
|
|
2629
|
+
defauts.push(`${theme} : un objet de roles est attendu (vide s il n y a rien a poser)`);
|
|
2630
|
+
continue;
|
|
2631
|
+
}
|
|
2632
|
+
for (const [role, valeur] of Object.entries(couleurs)) {
|
|
2633
|
+
if (!ROLES.has(role)) defauts.push(`${theme} : role inconnu « ${role} »`);
|
|
2634
|
+
if (typeof valeur !== "string" || !HEX.test(valeur)) defauts.push(`${theme} : ${role} = « ${citee(valeur)} », hexadecimal #rrggbb attendu`);
|
|
2635
|
+
}
|
|
2636
|
+
}
|
|
2637
|
+
const malFormees = [
|
|
2638
|
+
"exemptions",
|
|
2639
|
+
"paires",
|
|
2640
|
+
"pairesExclues"
|
|
2641
|
+
].filter((cle) => valeurs[cle] !== void 0 && !Array.isArray(valeurs[cle]));
|
|
2642
|
+
if (malFormees.length > 0) return [...defauts, ...malFormees.map((cle) => `${cle} : une liste est attendue`)];
|
|
2643
|
+
const primitives = valeurs["primitives"];
|
|
2644
|
+
if (primitives !== void 0 && !estUnObjet(primitives)) defauts.push("primitives : un objet de familles est attendu");
|
|
2645
|
+
else for (const [famille, pas] of Object.entries(primitives ?? {})) {
|
|
2646
|
+
if (!estUnObjet(pas)) {
|
|
2647
|
+
defauts.push(`primitive ${famille} : un objet de pas est attendu`);
|
|
2648
|
+
continue;
|
|
2649
|
+
}
|
|
2650
|
+
for (const [cle, valeur] of Object.entries(pas)) if (typeof valeur !== "string" || !HEX.test(valeur)) defauts.push(`primitive ${famille}.${cle} = « ${citee(valeur)} », hexadecimal #rrggbb attendu`);
|
|
2651
|
+
}
|
|
2652
|
+
for (const exemption of liste(valeurs["exemptions"])) {
|
|
2653
|
+
const ecart = estUnObjet(exemption) ? exemption["ecart"] : void 0;
|
|
2654
|
+
if (!estUnObjet(exemption) || !Array.isArray(ecart) || ecart.length !== 2 || !ecart.every((role) => typeof role === "string")) {
|
|
2655
|
+
defauts.push("exemption : `ecart` attend deux roles, [devant, derriere]");
|
|
2656
|
+
continue;
|
|
2657
|
+
}
|
|
2658
|
+
const [devant, derriere] = ecart;
|
|
2659
|
+
const cle = `exemption ${devant}/${derriere}`;
|
|
2660
|
+
if (!ecartsDeMarque.some((e) => memeEcart([e.devant, e.derriere], devant, derriere))) defauts.push(`${cle} : aucun ecart de surface de ce nom (ecartsDeMarque)`);
|
|
2661
|
+
const theme = exemption["theme"];
|
|
2662
|
+
if (theme !== void 0 && theme !== "clair" && theme !== "sombre") defauts.push(`${cle} : theme « ${citee(theme)} » inconnu`);
|
|
2663
|
+
if (!raisonEcrite(exemption["raison"])) defauts.push(`${cle} : raison absente ou trop courte (${RAISON_MINIMALE.toString()} caracteres au moins)`);
|
|
2664
|
+
}
|
|
2665
|
+
for (const paire of liste(valeurs["paires"])) {
|
|
2666
|
+
const premierPlan = estUnObjet(paire) ? paire["premierPlan"] : void 0;
|
|
2667
|
+
const arrierePlans = estUnObjet(paire) ? paire["arrierePlans"] : void 0;
|
|
2668
|
+
if (!estUnObjet(paire) || !Array.isArray(arrierePlans)) {
|
|
2669
|
+
defauts.push(`paire ${citee(premierPlan)} : \`arrierePlans\` attend une liste de roles`);
|
|
2670
|
+
continue;
|
|
2671
|
+
}
|
|
2672
|
+
for (const role of [premierPlan, ...arrierePlans]) if (typeof role !== "string" || !ROLES.has(role)) defauts.push(`paire : role inconnu « ${citee(role)} »`);
|
|
2673
|
+
const nature = paire["nature"];
|
|
2674
|
+
if (typeof nature !== "string" || !NATURES.has(nature)) defauts.push(`paire ${citee(premierPlan)} : nature « ${citee(nature)} » inconnue`);
|
|
2675
|
+
}
|
|
2676
|
+
for (const exclue of liste(valeurs["pairesExclues"])) {
|
|
2677
|
+
if (!estUnObjet(exclue)) {
|
|
2678
|
+
defauts.push("paire exclue : un objet est attendu");
|
|
2679
|
+
continue;
|
|
2680
|
+
}
|
|
2681
|
+
const premierPlan = exclue["premierPlan"];
|
|
2682
|
+
const arrierePlan = exclue["arrierePlan"];
|
|
2683
|
+
for (const role of [premierPlan, arrierePlan]) if (typeof role !== "string" || !ROLES.has(role)) defauts.push(`paire exclue : role inconnu « ${citee(role)} »`);
|
|
2684
|
+
if (!raisonEcrite(exclue["raison"])) defauts.push(`paire exclue ${citee(premierPlan)}/${citee(arrierePlan)} : raison absente ou trop courte`);
|
|
2685
|
+
}
|
|
2686
|
+
return defauts;
|
|
2687
|
+
}
|
|
2688
|
+
function pairesExigees(valeurs) {
|
|
2689
|
+
const exclues = valeurs.pairesExclues ?? [];
|
|
2690
|
+
const toutes = [...pairesDeContraste, ...[...pairesDuContourEleve, ...valeurs.paires ?? []].flatMap((p) => p.arrierePlans.map((arrierePlan) => ({
|
|
2691
|
+
premierPlan: p.premierPlan,
|
|
2692
|
+
arrierePlan,
|
|
2693
|
+
nature: p.nature
|
|
2694
|
+
})))];
|
|
2695
|
+
const vues = /* @__PURE__ */ new Set();
|
|
2696
|
+
return toutes.filter((p) => {
|
|
2697
|
+
const cle = `${p.premierPlan}/${p.arrierePlan}`;
|
|
2698
|
+
if (vues.has(cle)) return false;
|
|
2699
|
+
vues.add(cle);
|
|
2700
|
+
return !exclues.some((e) => e.premierPlan === p.premierPlan && e.arrierePlan === p.arrierePlan);
|
|
2701
|
+
});
|
|
2702
|
+
}
|
|
2703
|
+
function defautsDeLaMarque(entree) {
|
|
2704
|
+
const forme = defautsDeForme(entree);
|
|
2705
|
+
if (forme.length > 0) return forme;
|
|
2706
|
+
const valeurs = entree;
|
|
2707
|
+
const defauts = [];
|
|
2708
|
+
const paires = pairesExigees(valeurs);
|
|
2709
|
+
for (const theme of THEMES) {
|
|
2710
|
+
const rendus = [[theme, themeDeMarque(valeurs, theme)], [`${theme} (contraste renforce)`, themeDeMarqueSousContrasteRenforce(valeurs, theme)]];
|
|
2711
|
+
for (const [nomDuRendu, jetons] of rendus) {
|
|
2712
|
+
for (const p of paires) {
|
|
2713
|
+
const seuil = seuilExige("AA", p.nature);
|
|
2714
|
+
if (rapportDeContraste(jetons[p.premierPlan], jetons[p.arrierePlan]) < seuil) defauts.push(`${mesure(nomDuRendu, jetons, p.premierPlan, p.arrierePlan)}, minimum ${String(seuil)}:1`);
|
|
2715
|
+
}
|
|
2716
|
+
for (const surface of surfacesDuFocus) {
|
|
2717
|
+
const anneau = rapportDeContraste(jetons.anneauFocus, jetons[surface]);
|
|
2718
|
+
const lisere = rapportDeContraste(jetons.lisereFocus, jetons[surface]);
|
|
2719
|
+
if (Math.max(anneau, lisere) < 3) defauts.push(`${nomDuRendu} : focus sur ${surface} (${jetons[surface]}) : anneau ${anneau.toFixed(2)}:1, lisere ${lisere.toFixed(2)}:1, l'un des deux a 3:1 au moins`);
|
|
2720
|
+
}
|
|
2721
|
+
}
|
|
2722
|
+
const jetons = themeDeMarque(valeurs, theme);
|
|
2723
|
+
for (const e of ecartsDeMarque) {
|
|
2724
|
+
if (rapportDeContraste(jetons[e.devant], jetons[e.derriere]) >= e.minimum) continue;
|
|
2725
|
+
if (!(valeurs.exemptions ?? []).some((x) => memeEcart(x.ecart, e.devant, e.derriere) && (x.theme === void 0 || x.theme === theme))) {
|
|
2726
|
+
defauts.push(`${mesure(theme, jetons, e.devant, e.derriere)}, ecart minimum ${String(e.minimum)}:1 (${e.pourquoi}) : relever l'ecart, ou l'exempter avec sa raison (le filet porte la separation)`);
|
|
2727
|
+
continue;
|
|
2728
|
+
}
|
|
2729
|
+
const filet = Math.max(rapportDeContraste(jetons.bordure, jetons[e.devant]), rapportDeContraste(jetons.bordure, jetons[e.derriere]));
|
|
2730
|
+
if (filet < 1.2) defauts.push(`${theme} : ecart ${e.devant}/${e.derriere} exempte, mais le filet bordure (${jetons.bordure}) n'y est perceptible sur aucune des deux surfaces (${filet.toFixed(2)}:1, minimum ${String(SEUIL_DE_PERCEPTIBILITE)}:1)`);
|
|
2731
|
+
}
|
|
2732
|
+
for (const { jeton } of exemptesDeContraste) if (rapportDeContraste(jetons[jeton], jetons.surface) < 1.2) defauts.push(`${mesure(theme, jetons, jeton, "surface")}, jeton exempte qui doit rester perceptible (${String(SEUIL_DE_PERCEPTIBILITE)}:1)`);
|
|
2733
|
+
}
|
|
2734
|
+
for (const exclue of valeurs.pairesExclues ?? []) if (!THEMES.some((theme) => {
|
|
2735
|
+
const jetons = themeDeMarque(valeurs, theme);
|
|
2736
|
+
return rapportDeContraste(jetons[exclue.premierPlan], jetons[exclue.arrierePlan]) < 4.5;
|
|
2737
|
+
})) defauts.push(`paire exclue ${exclue.premierPlan}/${exclue.arrierePlan} : elle tient dans les deux themes, la redeclarer en paire`);
|
|
2738
|
+
return defauts;
|
|
2739
|
+
}
|
|
2740
|
+
function selonLeTheme(clair, sombre) {
|
|
2741
|
+
return clair === sombre ? clair : `light-dark(${clair}, ${sombre})`;
|
|
2742
|
+
}
|
|
2743
|
+
function nomDuRole(role) {
|
|
2744
|
+
return nomDeCouleur(role);
|
|
2745
|
+
}
|
|
2746
|
+
function rolesPoses(valeurs) {
|
|
2747
|
+
return [...Object.keys(themeClair), "bordureForteElevee"].filter((role) => role === "bordureForteElevee" || THEMES.some((t) => poseParLaMarque(valeurs, t, role)));
|
|
2748
|
+
}
|
|
2749
|
+
function encreDImpression(ecran, derogation) {
|
|
2750
|
+
const couleur = hexVersOklch(ecran);
|
|
2751
|
+
const plafond = hexVersOklch(derogation).l;
|
|
2752
|
+
return couleur.l <= plafond ? ecran : oklchVersHex({
|
|
2753
|
+
...couleur,
|
|
2754
|
+
l: plafond
|
|
2755
|
+
});
|
|
2756
|
+
}
|
|
2757
|
+
function declarations(lignes, retrait) {
|
|
2758
|
+
return lignes.map(([nom, valeur]) => `${retrait}${nom}: ${valeur};`).join("\n");
|
|
2759
|
+
}
|
|
2760
|
+
function feuilleDeMarque(valeurs) {
|
|
2761
|
+
const defauts = defautsDeLaMarque(valeurs);
|
|
2762
|
+
if (defauts.length > 0) throw new MarqueNonConforme(valeurs.nom, defauts);
|
|
2763
|
+
const clair = themeDeMarque(valeurs, "clair");
|
|
2764
|
+
const sombre = themeDeMarque(valeurs, "sombre");
|
|
2765
|
+
const poses = rolesPoses(valeurs);
|
|
2766
|
+
const racine = poses.map((role) => [nomDuRole(role), selonLeTheme(clair[role], sombre[role])]);
|
|
2767
|
+
const renforceClair = themeDeMarqueSousContrasteRenforce(valeurs, "clair");
|
|
2768
|
+
const renforceSombre = themeDeMarqueSousContrasteRenforce(valeurs, "sombre");
|
|
2769
|
+
const renforces = [
|
|
2770
|
+
...Object.keys(aliasDeContrasteRenforceParJeton),
|
|
2771
|
+
...Object.keys(encresDeContrasteRenforce),
|
|
2772
|
+
...Object.keys(ALIAS_DU_CONTOUR_ELEVE)
|
|
2773
|
+
];
|
|
2774
|
+
const contrasteRenforce = [...new Set(renforces)].map((role) => [nomDuRole(role), selonLeTheme(renforceClair[role], renforceSombre[role])]);
|
|
2775
|
+
const systeme = /* @__PURE__ */ new Map();
|
|
2776
|
+
for (const [couleur, jetons] of Object.entries(couleursSysteme)) for (const jeton of jetons) systeme.set(jeton, couleur);
|
|
2777
|
+
systeme.set("bordureForteElevee", systeme.get("bordureForte") ?? "CanvasText");
|
|
2778
|
+
const contrasteForce = poses.filter((role) => systeme.has(role)).map((role) => [nomDuRole(role), systeme.get(role) ?? "CanvasText"]);
|
|
2779
|
+
const derogations = derogationsDImpression;
|
|
2780
|
+
const impression = poses.flatMap((role) => {
|
|
2781
|
+
const prolonge = role === "bordureForteElevee" ? "bordureForte" : aliasDeRole[role];
|
|
2782
|
+
const derogation = derogations[role] ?? (prolonge === void 0 ? void 0 : derogations[prolonge]);
|
|
2783
|
+
if (derogation === void 0) return [];
|
|
2784
|
+
const fond = derogation.toLowerCase() === "#ffffff";
|
|
2785
|
+
return [[nomDuRole(role), fond ? derogation : encreDImpression(clair[role], derogation)]];
|
|
2786
|
+
});
|
|
2787
|
+
return `/* Engendre par @starterlib/tokens — ne pas modifier a la main.
|
|
2788
|
+
Marque « ${valeurs.nom} »${valeurs.description === void 0 ? "" : ` : ${valeurs.description}`}
|
|
2789
|
+
A charger APRES starter-tokens.css. Regenerer : pnpm tokens:css (socle) ou
|
|
2790
|
+
starter-web jetons --marque <fichier> (application). Roles et gardes : README de @starterlib/tokens,
|
|
2791
|
+
niveau 2 bis. */
|
|
2792
|
+
|
|
2793
|
+
:root {
|
|
2794
|
+
${declarations(racine, " ")}
|
|
2795
|
+
}
|
|
2796
|
+
|
|
2797
|
+
/* Les conteneurs eleves (fond surface-elevee) : leurs champs prennent le contour que la marque a
|
|
2798
|
+
prouve a 3:1 sur ces surfaces. Sans feuille de marque, rien ne change. */
|
|
2799
|
+
${conteneursEleves.join(",\n")} {
|
|
2800
|
+
${PREFIXE}-couleur-bordure-forte: var(${PREFIXE}-couleur-bordure-forte-elevee);
|
|
2801
|
+
}
|
|
2802
|
+
|
|
2803
|
+
/* Contraste renforce : les alias du socle, resolus dans la marque. */
|
|
2804
|
+
@media (prefers-contrast: more) {
|
|
2805
|
+
:root {
|
|
2806
|
+
${declarations(contrasteRenforce, " ")}
|
|
2807
|
+
}
|
|
2808
|
+
}
|
|
2809
|
+
|
|
2810
|
+
/* Contraste force : les roles poses par la marque, vers leur couleur systeme. */
|
|
2811
|
+
@media (forced-colors: active) {
|
|
2812
|
+
:root {
|
|
2813
|
+
${declarations(contrasteForce, " ")}
|
|
2814
|
+
}
|
|
2815
|
+
}
|
|
2816
|
+
|
|
2817
|
+
/* Impression : les derogations du socle pour les roles poses ; une encre ne fait que foncer. */
|
|
2818
|
+
@media print {
|
|
2819
|
+
:root {
|
|
2820
|
+
${declarations(impression, " ")}
|
|
2821
|
+
}
|
|
2822
|
+
}
|
|
2823
|
+
`;
|
|
2824
|
+
}
|
|
2825
|
+
function jetonsDtcgDeMarque(valeurs) {
|
|
2826
|
+
const defauts = defautsDeLaMarque(valeurs);
|
|
2827
|
+
if (defauts.length > 0) throw new MarqueNonConforme(valeurs.nom, defauts);
|
|
2828
|
+
const couleur = (hex) => {
|
|
2829
|
+
return {
|
|
2830
|
+
colorSpace: "srgb",
|
|
2831
|
+
components: [
|
|
2832
|
+
1,
|
|
2833
|
+
3,
|
|
2834
|
+
5
|
|
2835
|
+
].map((debut) => Number.parseInt(hex.slice(debut, debut + 2), 16) / 255).map((canal) => Number(canal.toFixed(4))),
|
|
2836
|
+
alpha: 1,
|
|
2837
|
+
hex
|
|
2838
|
+
};
|
|
2839
|
+
};
|
|
2840
|
+
const theme = (nomDuTheme) => {
|
|
2841
|
+
const jetons = themeDeMarque(valeurs, nomDuTheme);
|
|
2842
|
+
return Object.fromEntries(Object.keys(jetons).map((nom) => {
|
|
2843
|
+
const cible = aliasDeRole[nom];
|
|
2844
|
+
return [nom, {
|
|
2845
|
+
$type: "color",
|
|
2846
|
+
$value: (cible !== void 0 && !poseParLaMarque(valeurs, nomDuTheme, nom) ? `{couleur.${nomDuTheme}.${cible}}` : null) ?? couleur(jetons[nom])
|
|
2847
|
+
}];
|
|
2848
|
+
}));
|
|
2849
|
+
};
|
|
2850
|
+
const primitives = Object.fromEntries(Object.entries(valeurs.primitives ?? {}).map(([famille, pas]) => [famille, Object.fromEntries(Object.entries(pas).map(([cle, valeur]) => [cle, {
|
|
2851
|
+
$type: "color",
|
|
2852
|
+
$value: couleur(enMinuscules(valeur))
|
|
2853
|
+
}]))]));
|
|
2854
|
+
const fichier = {
|
|
2855
|
+
$description: `Marque ${valeurs.nom} de @starterlib/tokens au format DTCG 2025.10 : les deux themes complets (socle ecrase par la marque). Engendre : ne pas modifier.`,
|
|
2856
|
+
couleur: {
|
|
2857
|
+
clair: theme("clair"),
|
|
2858
|
+
sombre: theme("sombre")
|
|
2859
|
+
},
|
|
2860
|
+
...Object.keys(primitives).length > 0 ? { primitive: primitives } : {}
|
|
2861
|
+
};
|
|
2862
|
+
return `${JSON.stringify(fichier, null, 2)}\n`;
|
|
2863
|
+
}
|
|
2864
|
+
const marqueExempleBlanc = {
|
|
2865
|
+
nom: "exemple-blanc",
|
|
2866
|
+
description: "fond blanc et gris froids, erreur a l'encre du texte (exemple du socle)",
|
|
2867
|
+
clair: {
|
|
2868
|
+
fond: "#ffffff",
|
|
2869
|
+
surface: "#ffffff",
|
|
2870
|
+
surfaceEnfoncee: "#f4f6f8",
|
|
2871
|
+
surfaceSelection: "#e9edf2",
|
|
2872
|
+
bordure: "#e1e6ec",
|
|
2873
|
+
bordureForte: "#7b8794",
|
|
2874
|
+
bordureForteElevee: "#7e848b",
|
|
2875
|
+
erreur: "#161c24",
|
|
2876
|
+
erreurDiscret: "#f4f6f8",
|
|
2877
|
+
surErreurDiscret: "#161c24"
|
|
2878
|
+
},
|
|
2879
|
+
sombre: {
|
|
2880
|
+
bordureForte: "#5d6982",
|
|
2881
|
+
bordureForteElevee: "#7e848b",
|
|
2882
|
+
erreur: "#f2f4f6",
|
|
2883
|
+
erreurDiscret: "#2b3139",
|
|
2884
|
+
surErreurDiscret: "#f2f4f6"
|
|
2885
|
+
},
|
|
2886
|
+
exemptions: [{
|
|
2887
|
+
ecart: ["surface", "fond"],
|
|
2888
|
+
theme: "clair",
|
|
2889
|
+
raison: "Fond = surface = blanc : une carte posee sur le fond se detache par son filet, jamais par un aplat."
|
|
2890
|
+
}, {
|
|
2891
|
+
ecart: ["surfaceEnfoncee", "surface"],
|
|
2892
|
+
theme: "clair",
|
|
2893
|
+
raison: "Retrait #f4f6f8 a 1,08:1 du blanc, sous le seuil 1,12 du socle : tout creux porte un filet ou un contour."
|
|
2894
|
+
}]
|
|
2895
|
+
};
|
|
2896
|
+
export { CLES_DE_TAILLE, COUCHES, C_PAS, FAMILLES, L_PAS, MODES_DE_DENSITE, MarqueNonConforme, PAS_DE_RAMPE, PAS_NEUTRES, PREFIXE, RANGS_DE_SERIE, REGLAGE_DU_PREFIXE_DE_TON, SEUIL_DE_PERCEPTIBILITE, aliasDeContrasteRenforce, aliasDeContrasteRenforceParJeton, aliasDeRole, apca, cadence, cadenceMinimale, cibleMinimale, cibleTactileMinimale, composer, conteneursEleves, contratsDHote, couleurDOmbre, couleursSysteme, courbe, cssDesEchelles, cssDuTheme, declarationsDuStyle, defautsDeLaMarque, definitionDuPas, definitionsDesPrimitives, densite, deplacement, derogationsDImpression, duree, ecartsDeMarque, ecartsDeSurface, enKebab, encresDAplat, encresDeContrasteRenforce, epaisseur, epaisseurCapillaire, espacement, estJetonDeComposant, exemptesDeContraste, feuilleDeJetons, feuilleDeMarque, feuilleDesJetonsDUnElement, feuilleDesPolices, feuilleDesPolicesDeTitre, fichiersAPrecharger, focus, hauteurDeCommande, hexVersOklch, interlettrageDuStyle, jetonsDeComposant, jetonsDtcg, jetonsDtcgDeMarque, largeur, lireCouleur, luminanceRelative, marqueExempleBlanc, mouvementGele, mouvementReduit, nomDeCouleur, nombreDeJetonsDeCouleur, oklchEnCss, oklchVersHex, oklchVersSrgb, ombreDuTheme, ombres, pairesDeContraste, pairesDuContourEleve, pairesExclues, partielDeTypographie, partielDesJetons, pileDeTitre, plan, policesDeTitre, policesDuSocle, primitives, rapportDeContraste, rayon, respecteLeContraste, rolesDesPrimitives, seuilExige, stylesTypographiques, surchargesDuRepli, surfacesDuFocus, taillesDImpression, themeClair, themeDeMarque, themeDeMarqueSousContrasteRenforce, themeSombre, themeSousContrasteRenforce, themes, typographie, variablesInternes, versRvb, voile };
|
|
2177
2897
|
|
|
2178
2898
|
//# sourceMappingURL=starterlib-tokens-moteur.mjs.map
|