@datatechsolutions/tympan-tokens 0.4.1 → 0.4.2

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.js CHANGED
@@ -929,19 +929,24 @@ function resolveTheme(config, mode, contrastOverride) {
929
929
  }],
930
930
  "sheet-inset": [inset]
931
931
  };
932
+ const shadowPins = config.shadowPins?.[mode] ?? {};
933
+ for (const [name, layers] of Object.entries(shadowPins)) shadows[name] = layers.map((l) => ({
934
+ ...l,
935
+ color: parseColor(l.color)
936
+ }));
932
937
  const R = config.radius;
933
938
  const dimensions = {
934
939
  radius: R,
935
940
  "radius-control": R,
936
- "radius-card": Math.round(R * 1.6),
937
- "radius-sheet": Math.round(R * 2.4),
941
+ "radius-card": config.radii?.card ?? Math.round(R * 1.6),
942
+ "radius-sheet": config.radii?.sheet ?? Math.round(R * 2.4),
938
943
  "radius-pill": 999,
939
944
  "radius-agent": Math.max(2, Math.round(R * .6)),
940
945
  "focus-width": contrast === "high" ? 3 : 2,
941
946
  "glass-blur-sheet": config.glass ? 20 : 0,
942
947
  "glass-blur-floating": config.glass ? 24 : 0
943
948
  };
944
- const numbers = { "glass-saturate": config.glass ? 1.15 : 1 };
949
+ const numbers = { "glass-saturate": config.glass ? config.glassSaturate?.[mode] ?? 1.15 : 1 };
945
950
  const fonts = {};
946
951
  for (const role of [
947
952
  "display",
@@ -965,7 +970,10 @@ function resolveTheme(config, mode, contrastOverride) {
965
970
  dimensions,
966
971
  numbers,
967
972
  fonts,
968
- strings: config.strings ?? {},
973
+ strings: {
974
+ ...config.strings,
975
+ ...contrast === config.contrast ? config.modeStrings?.[mode] : void 0
976
+ },
969
977
  report
970
978
  };
971
979
  }
@@ -1169,8 +1177,10 @@ const fakhirPreset = {
1169
1177
  /**
1170
1178
  * The Astrlabe workflow engine's look (`data-ty-theme="astrlabe"`): slate
1171
1179
  * neutrals, an indigo brand (indigo 500 as the accent family, one step darker
1172
- * where text needs 4.5:1 on light grounds), translucent glass surfaces and the
1173
- * rounder corners of that app (12 px controls, about 20 px cards). The call to
1180
+ * where text needs 4.5:1 on light grounds), liquid-glass surfaces (gradient
1181
+ * fills, specular edges, a strong saturation boost at night), the rounder
1182
+ * corners of that app (12 px controls, 20 px cards, 24 px sheets), its
1183
+ * compact type scale and the sky, indigo and violet mark. The call to
1174
1184
  * action is the indigo to purple gradient its primary buttons fill with, and
1175
1185
  * text (headings included) uses the platform's own system fonts. The state
1176
1186
  * contract holds on every ground: running is a cyan clearly off the indigo
@@ -1225,20 +1235,23 @@ const astrlabePreset = {
1225
1235
  "on-brand": "#ffffff",
1226
1236
  bg: "#f8fafc",
1227
1237
  surface: "rgb(255 255 255 / 0.72)",
1228
- "surface-raised": "rgb(255 255 255 / 0.9)",
1238
+ "surface-raised": "rgb(255 255 255 / 0.86)",
1229
1239
  "surface-solid": "#ffffff",
1230
1240
  "surface-raised-solid": "#ffffff",
1231
- "surface-sunken": "#f1f5f9",
1232
- line: "rgb(148 163 184 / 0.3)",
1241
+ "surface-sunken": "#f2f3fa",
1242
+ line: "rgb(148 163 184 / 0.26)",
1233
1243
  "line-strong": "rgb(100 116 139 / 0.45)",
1234
1244
  ink: "#0f172a",
1235
- "ink-2": "#334155",
1236
- "ink-3": "#4d5a6b",
1245
+ "ink-2": "#475569",
1246
+ "ink-3": "#5b6779",
1237
1247
  success: "#15803d",
1238
1248
  info: "#0e7490",
1239
1249
  warning: "#a16207",
1240
1250
  danger: "#be123c",
1241
- neutral: "#4d5a6b"
1251
+ neutral: "#5b6779",
1252
+ backdrop: "rgb(15 23 42 / 0.4)",
1253
+ "ambient-1": "rgb(167 139 250 / 0.05)",
1254
+ "ambient-2": "rgb(56 189 248 / 0.03)"
1242
1255
  },
1243
1256
  dark: {
1244
1257
  brand: "#818cf8",
@@ -1246,22 +1259,25 @@ const astrlabePreset = {
1246
1259
  "brand-strong": "#a5b4fc",
1247
1260
  "brand-soft": "rgb(99 102 241 / 0.2)",
1248
1261
  "on-brand": "#1e1b4b",
1249
- bg: "#0b1220",
1250
- surface: "rgb(30 41 59 / 0.72)",
1251
- "surface-raised": "rgb(30 41 59 / 0.92)",
1262
+ bg: "#020617",
1263
+ surface: "rgb(30 41 59 / 0.7)",
1264
+ "surface-raised": "rgb(30 41 59 / 0.78)",
1252
1265
  "surface-solid": "#131c2f",
1253
1266
  "surface-raised-solid": "#1b2539",
1254
1267
  "surface-sunken": "#0b1222",
1255
- line: "rgb(148 163 184 / 0.22)",
1268
+ line: "rgb(148 163 184 / 0.24)",
1256
1269
  "line-strong": "rgb(148 163 184 / 0.36)",
1257
- ink: "#f8fafc",
1270
+ ink: "#ffffff",
1258
1271
  "ink-2": "#cbd5e1",
1259
- "ink-3": "#a3b0c0",
1272
+ "ink-3": "#94a3b8",
1260
1273
  success: "#4ade80",
1261
1274
  info: "#22d3ee",
1262
1275
  warning: "#fbbf24",
1263
1276
  danger: "#fb7185",
1264
- neutral: "#a3b0c0"
1277
+ neutral: "#94a3b8",
1278
+ backdrop: "rgb(0 0 0 / 0.5)",
1279
+ "ambient-1": "rgb(124 58 237 / 0.1)",
1280
+ "ambient-2": "rgb(2 132 199 / 0.08)"
1265
1281
  }
1266
1282
  },
1267
1283
  ctaPins: {
@@ -1276,6 +1292,174 @@ const astrlabePreset = {
1276
1292
  "#9333ea"
1277
1293
  ]
1278
1294
  },
1295
+ radii: {
1296
+ card: 20,
1297
+ sheet: 24
1298
+ },
1299
+ glassSaturate: {
1300
+ light: 1.15,
1301
+ dark: 1.5
1302
+ },
1303
+ shadowPins: {
1304
+ light: {
1305
+ sheet: [{
1306
+ x: 0,
1307
+ y: 4,
1308
+ blur: 16,
1309
+ spread: -2,
1310
+ color: "rgb(0 0 0 / 0.1)"
1311
+ }, {
1312
+ x: 0,
1313
+ y: 12,
1314
+ blur: 40,
1315
+ spread: -8,
1316
+ color: "rgb(0 0 0 / 0.06)"
1317
+ }],
1318
+ "sheet-inset": [{
1319
+ x: 0,
1320
+ y: 1,
1321
+ blur: 2,
1322
+ spread: 0,
1323
+ color: "rgb(255 255 255 / 0.7)",
1324
+ inset: true
1325
+ }, {
1326
+ x: 0,
1327
+ y: -1,
1328
+ blur: 2,
1329
+ spread: 0,
1330
+ color: "rgb(0 0 0 / 0.04)",
1331
+ inset: true
1332
+ }],
1333
+ raised: [{
1334
+ x: 0,
1335
+ y: 4,
1336
+ blur: 12,
1337
+ spread: -2,
1338
+ color: "rgb(15 23 42 / 0.08)"
1339
+ }, {
1340
+ x: 0,
1341
+ y: 2,
1342
+ blur: 4,
1343
+ spread: -2,
1344
+ color: "rgb(15 23 42 / 0.04)"
1345
+ }],
1346
+ floating: [{
1347
+ x: 0,
1348
+ y: 12,
1349
+ blur: 24,
1350
+ spread: -8,
1351
+ color: "rgb(15 23 42 / 0.12)"
1352
+ }, {
1353
+ x: 0,
1354
+ y: 4,
1355
+ blur: 8,
1356
+ spread: -4,
1357
+ color: "rgb(15 23 42 / 0.06)"
1358
+ }],
1359
+ modal: [{
1360
+ x: 0,
1361
+ y: 40,
1362
+ blur: 100,
1363
+ spread: -30,
1364
+ color: "rgb(0 0 0 / 0.45)"
1365
+ }, {
1366
+ x: 0,
1367
+ y: 16,
1368
+ blur: 40,
1369
+ spread: -12,
1370
+ color: "rgb(0 0 0 / 0.18)"
1371
+ }]
1372
+ },
1373
+ dark: {
1374
+ sheet: [{
1375
+ x: 0,
1376
+ y: 12,
1377
+ blur: 40,
1378
+ spread: -12,
1379
+ color: "rgb(0 0 0 / 0.5)"
1380
+ }],
1381
+ "sheet-inset": [{
1382
+ x: 0,
1383
+ y: 1,
1384
+ blur: 1,
1385
+ spread: 0,
1386
+ color: "rgb(255 255 255 / 0.12)",
1387
+ inset: true
1388
+ }],
1389
+ raised: [{
1390
+ x: 0,
1391
+ y: 4,
1392
+ blur: 12,
1393
+ spread: -2,
1394
+ color: "rgb(0 0 0 / 0.5)"
1395
+ }, {
1396
+ x: 0,
1397
+ y: 2,
1398
+ blur: 4,
1399
+ spread: -2,
1400
+ color: "rgb(0 0 0 / 0.3)"
1401
+ }],
1402
+ floating: [{
1403
+ x: 0,
1404
+ y: 12,
1405
+ blur: 24,
1406
+ spread: -8,
1407
+ color: "rgb(0 0 0 / 0.6)"
1408
+ }, {
1409
+ x: 0,
1410
+ y: 4,
1411
+ blur: 8,
1412
+ spread: -4,
1413
+ color: "rgb(0 0 0 / 0.4)"
1414
+ }],
1415
+ modal: [{
1416
+ x: 0,
1417
+ y: 40,
1418
+ blur: 100,
1419
+ spread: -30,
1420
+ color: "rgb(0 0 0 / 0.7)"
1421
+ }, {
1422
+ x: 0,
1423
+ y: 16,
1424
+ blur: 40,
1425
+ spread: -12,
1426
+ color: "rgb(0 0 0 / 0.5)"
1427
+ }]
1428
+ }
1429
+ },
1430
+ modeStrings: {
1431
+ light: {
1432
+ "glass-edge": "rgb(255 255 255 / 0.9) rgb(200 200 210 / 0.3) rgb(200 200 210 / 0.25) rgb(255 255 255 / 0.7)",
1433
+ "glass-edge-width": "1.5px",
1434
+ "glass-highlight": "inset 0 1px 2px 0 rgb(255 255 255 / 0.8), inset 0 -1px 2px 0 rgb(0 0 0 / 0.05)",
1435
+ "glass-fill": "linear-gradient(135deg, rgb(255 255 255 / 0.8) 0%, rgb(220 225 240 / 0.62) 40%, rgb(240 245 255 / 0.68) 70%, rgb(255 255 255 / 0.8) 100%)",
1436
+ "glass-fill-raised": "linear-gradient(135deg, rgb(255 255 255 / 0.86) 0%, rgb(215 220 238 / 0.7) 40%, rgb(235 240 255 / 0.76) 70%, rgb(255 255 255 / 0.86) 100%)",
1437
+ "mark-gradient": "linear-gradient(135deg, #38bdf8 0%, #6366f1 40%, #a855f7 100%)",
1438
+ "wordmark-gradient": "linear-gradient(90deg, #0369a1, #4338ca, #7e22ce)"
1439
+ },
1440
+ dark: {
1441
+ "glass-edge": "rgb(255 255 255 / 0.2) rgb(255 255 255 / 0.06) rgb(255 255 255 / 0.04) rgb(255 255 255 / 0.12)",
1442
+ "glass-edge-width": "1.5px",
1443
+ "glass-highlight": "inset 0 1px 1px 0 rgb(255 255 255 / 0.15)",
1444
+ "glass-fill": "linear-gradient(140deg, rgb(30 41 59 / 0.7) 0%, rgb(15 23 42 / 0.6) 45%, rgb(20 30 50 / 0.55) 100%)",
1445
+ "glass-fill-raised": "linear-gradient(140deg, rgb(30 41 59 / 0.78) 0%, rgb(15 23 42 / 0.68) 45%, rgb(20 30 50 / 0.62) 100%)",
1446
+ "mark-gradient": "linear-gradient(135deg, #38bdf8 0%, #6366f1 40%, #a855f7 100%)",
1447
+ "wordmark-gradient": "linear-gradient(90deg, #38bdf8, #818cf8, #a855f7)"
1448
+ }
1449
+ },
1450
+ strings: {
1451
+ "font-size-display": "30px",
1452
+ "font-line-height-display": "36px",
1453
+ "font-size-h1": "24px",
1454
+ "font-line-height-h1": "32px",
1455
+ "font-size-h2": "18px",
1456
+ "font-line-height-h2": "28px",
1457
+ "font-size-h3": "16px",
1458
+ "font-line-height-h3": "24px",
1459
+ "font-size-label": "14px",
1460
+ "font-line-height-label": "20px",
1461
+ "font-tracking-h1": "-0.025em"
1462
+ },
1279
1463
  fonts: {
1280
1464
  display: [
1281
1465
  "-apple-system",
@@ -4915,7 +5099,10 @@ const FORCED_COLORS_VARS = [
4915
5099
  ["--ty-shadow-floating", "none"],
4916
5100
  ["--ty-shadow-modal", "none"],
4917
5101
  ["--ty-glass-blur-sheet", "0px"],
4918
- ["--ty-glass-blur-floating", "0px"]
5102
+ ["--ty-glass-blur-floating", "0px"],
5103
+ ["--ty-glass-edge", "CanvasText"],
5104
+ ["--ty-glass-fill", "Canvas"],
5105
+ ["--ty-glass-fill-raised", "Canvas"]
4919
5106
  ];
4920
5107
  /** Reduced transparency (and no backdrop-filter support): opaque surfaces, no blur, no ambient. */
4921
5108
  const OPAQUE_VARS = [
@@ -4925,6 +5112,8 @@ const OPAQUE_VARS = [
4925
5112
  ["--ty-glass-blur-sheet", "0px !important"],
4926
5113
  ["--ty-glass-blur-floating", "0px !important"],
4927
5114
  ["--ty-glass-saturate", "1 !important"],
5115
+ ["--ty-glass-fill", "var(--ty-surface-solid) !important"],
5116
+ ["--ty-glass-fill-raised", "var(--ty-surface-raised-solid) !important"],
4928
5117
  ["--ty-ambient-1", "transparent !important"],
4929
5118
  ["--ty-ambient-2", "transparent !important"]
4930
5119
  ];