@latty-ds/tokens 0.6.0 → 0.8.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.
@@ -1,11 +1,29 @@
1
+ /**
2
+ * Border width applied to control chrome (outlined buttons, inputs, chips, surfaces).
3
+ * Named presets: `thin` = 1px (default), `medium` = 2px, `thick` = 4px.
4
+ * Any other CSS length (e.g. `'1.5px'`) passes through unchanged.
5
+ */
6
+ type BorderWidth = 'thin' | 'medium' | 'thick' | (string & {});
1
7
  interface LattyConfig {
2
8
  /** Built-in names: primary, secondary, success, warning, error, info. Any additional name generates a new palette. */
3
9
  colors?: Record<string, string>;
4
10
  font?: {
11
+ /**
12
+ * A CSS `font-family` value (e.g. `'Inter, sans-serif'`), or a Google
13
+ * Fonts CSS2 stylesheet URL (e.g.
14
+ * `'https://fonts.googleapis.com/css2?family=Hanken+Grotesk:ital,wght@0,100..900&display=swap'`).
15
+ * URLs get `@import`ed automatically and the family name is derived from
16
+ * the `family=` query param — no separate `<link>` tag needed. Stylesheet
17
+ * URLs from providers other than `fonts.googleapis.com` are still loaded,
18
+ * but since there's no reliable way to guess the family name from an
19
+ * arbitrary CDN, pass the resulting name as a plain value instead (or
20
+ * open an issue if there's a provider worth special-casing).
21
+ */
5
22
  family?: string;
6
23
  };
7
24
  border?: {
8
25
  radius?: string;
26
+ width?: BorderWidth;
9
27
  };
10
28
  /**
11
29
  * Controls which semantic token layer is emitted.
@@ -32,6 +50,10 @@ declare const createStyleSheet: (userConfig?: LattyConfig) => string;
32
50
  * For zero FOUC on initial load, also add this one-liner before your module script:
33
51
  * `<style>html[data-lt]:not([data-lt-ready]){visibility:hidden}</style>`
34
52
  *
53
+ * `font.family` also accepts a Google Fonts CSS2 stylesheet URL — configure()
54
+ * both `@import`s it and derives the font-family name for you, so no separate
55
+ * `<link>` tag is needed.
56
+ *
35
57
  * @example
36
58
  * ```html
37
59
  * <html lang="en" data-lt>
@@ -41,8 +63,8 @@ declare const createStyleSheet: (userConfig?: LattyConfig) => string;
41
63
  * import { configure } from '@latty-ds/tokens/configure';
42
64
  * configure({
43
65
  * colors: { primary: '#6366f1', secondary: '#f59e0b' },
44
- * font: { family: 'Inter, sans-serif' },
45
- * border: { radius: '0.375rem' },
66
+ * font: { family: 'https://fonts.googleapis.com/css2?family=Hanken+Grotesk:ital,wght@0,100..900;1,100..900&display=swap' },
67
+ * border: { radius: '0.375rem', width: 'medium' },
46
68
  * });
47
69
  * </script>
48
70
  * </head>
@@ -51,4 +73,4 @@ declare const createStyleSheet: (userConfig?: LattyConfig) => string;
51
73
  */
52
74
  declare const configure: (userConfig?: LattyConfig) => void;
53
75
 
54
- export { type LattyConfig, configure, createStyleSheet };
76
+ export { type BorderWidth, type LattyConfig, configure, createStyleSheet };
package/dist/configure.js CHANGED
@@ -32,6 +32,12 @@ var REM_BASE_PX = 16;
32
32
 
33
33
  // src/constants/tokens.constants.ts
34
34
  var DEFAULT_BORDER_RADIUS = "0.5rem";
35
+ var DEFAULT_BORDER_WIDTH = "1px";
36
+ var BORDER_WIDTH_PRESETS = {
37
+ thin: "1px",
38
+ medium: "2px",
39
+ thick: "4px"
40
+ };
35
41
  var DEFAULT_FONT_FAMILY = '"Hanken Grotesk", sans-serif';
36
42
 
37
43
  // src/spacing/spacing.ts
@@ -165,7 +171,7 @@ var buildTokens = (cfg) => {
165
171
  let color = buildColorTokens(cfg);
166
172
  color = addSystemColors(color);
167
173
  const spacing = buildSpacing();
168
- const border = { radius: DEFAULT_BORDER_RADIUS };
174
+ const border = { radius: DEFAULT_BORDER_RADIUS, width: DEFAULT_BORDER_WIDTH };
169
175
  const typography = { fontFamily: DEFAULT_FONT_FAMILY };
170
176
  const elevation = buildElevation(color.neutral);
171
177
  return { color, spacing, border, typography, elevation };
@@ -313,6 +319,36 @@ var buildDarkSemanticTokens = (opts = {}) => {
313
319
  };
314
320
  var buildSemanticTokens = (mode = "light", opts = {}) => mode === "dark" ? buildDarkSemanticTokens(opts) : buildLightSemanticTokens(opts);
315
321
 
322
+ // src/configure/font.ts
323
+ var unwrapQuotes = (value) => {
324
+ const trimmed = value.trim();
325
+ const first = trimmed[0];
326
+ if (trimmed.length > 1 && (first === '"' || first === "'") && trimmed[trimmed.length - 1] === first) {
327
+ return trimmed.slice(1, -1).trim();
328
+ }
329
+ return trimmed;
330
+ };
331
+ var isUrl = (value) => /^https?:\/\//i.test(value);
332
+ var namesFromFamilyParam = (raw) => raw.split("|").map((part) => part.split(":")[0].trim()).filter(Boolean);
333
+ var quoteIfNeeded = (name) => /\s/.test(name) ? `"${name}"` : name;
334
+ var resolveFontFamily = (value) => {
335
+ const unwrapped = unwrapQuotes(value);
336
+ if (!isUrl(unwrapped)) return { family: unwrapped, importUrl: null };
337
+ let parsed;
338
+ try {
339
+ parsed = new URL(unwrapped);
340
+ } catch {
341
+ return { family: unwrapped, importUrl: null };
342
+ }
343
+ if (parsed.hostname.toLowerCase() === "fonts.googleapis.com") {
344
+ const names = [...new Set(parsed.searchParams.getAll("family").flatMap(namesFromFamilyParam))];
345
+ if (names.length > 0) {
346
+ return { family: `${names.map(quoteIfNeeded).join(", ")}, sans-serif`, importUrl: unwrapped };
347
+ }
348
+ }
349
+ return { family: "", importUrl: unwrapped };
350
+ };
351
+
316
352
  // tokens.config.json
317
353
  var tokens_config_default = {
318
354
  color: {
@@ -332,27 +368,43 @@ var tokens_config_default = {
332
368
  var DEFAULTS = {
333
369
  colors: tokens_config_default.color,
334
370
  font: { family: DEFAULT_FONT_FAMILY },
335
- border: { radius: DEFAULT_BORDER_RADIUS }
371
+ border: { radius: DEFAULT_BORDER_RADIUS, width: DEFAULT_BORDER_WIDTH }
336
372
  };
337
373
  var toInternalConfig = (userConfig) => ({
338
374
  color: { ...DEFAULTS.colors, ...userConfig.colors }
339
375
  });
376
+ var resolveBorderWidth = (width) => BORDER_WIDTH_PRESETS[width] ?? width;
340
377
  var createStyleSheet = (userConfig = {}) => {
341
378
  const cfg = toInternalConfig(userConfig);
342
379
  let tokens = buildTokens(cfg);
380
+ let fontImportUrl = null;
343
381
  if (userConfig.font?.family) {
344
- tokens = { ...tokens, typography: { fontFamily: userConfig.font.family } };
382
+ const resolvedFont = resolveFontFamily(userConfig.font.family);
383
+ fontImportUrl = resolvedFont.importUrl;
384
+ if (resolvedFont.family) {
385
+ tokens = { ...tokens, typography: { fontFamily: resolvedFont.family } };
386
+ }
345
387
  }
346
388
  if (userConfig.border?.radius) {
347
389
  tokens = { ...tokens, border: { ...tokens.border, radius: userConfig.border.radius } };
348
390
  }
391
+ if (userConfig.border?.width) {
392
+ tokens = { ...tokens, border: { ...tokens.border, width: resolveBorderWidth(userConfig.border.width) } };
393
+ }
349
394
  const primitives = tokensToCss(tokens);
350
395
  const theme = userConfig.theme ?? "light";
351
396
  const primary = tokens.color.primary;
352
397
  const semanticOpts = { primary500: primary["500"], primary400: primary["400"] };
353
- if (theme === "dark") return primitives + "\n" + semanticTokensToCss(buildSemanticTokens("dark", semanticOpts));
354
- if (theme === "light") return primitives + "\n" + semanticTokensToCss(buildSemanticTokens("light", semanticOpts));
355
- return primitives + "\n" + semanticTokensToCss(buildSemanticTokens("light", semanticOpts)) + "\n" + semanticTokensToCss(buildSemanticTokens("dark", semanticOpts), "@media (prefers-color-scheme: dark)") + "\n" + semanticTokensToCss(buildSemanticTokens("dark", semanticOpts), '[data-theme="dark"]') + "\n" + semanticTokensToCss(buildSemanticTokens("light", semanticOpts), '[data-theme="light"]');
398
+ let body;
399
+ if (theme === "dark") {
400
+ body = primitives + "\n" + semanticTokensToCss(buildSemanticTokens("dark", semanticOpts));
401
+ } else if (theme === "light") {
402
+ body = primitives + "\n" + semanticTokensToCss(buildSemanticTokens("light", semanticOpts));
403
+ } else {
404
+ body = primitives + "\n" + semanticTokensToCss(buildSemanticTokens("light", semanticOpts)) + "\n" + semanticTokensToCss(buildSemanticTokens("dark", semanticOpts), "@media (prefers-color-scheme: dark)") + "\n" + semanticTokensToCss(buildSemanticTokens("dark", semanticOpts), '[data-theme="dark"]') + "\n" + semanticTokensToCss(buildSemanticTokens("light", semanticOpts), '[data-theme="light"]');
405
+ }
406
+ return fontImportUrl ? `@import url("${fontImportUrl}");
407
+ ${body}` : body;
356
408
  };
357
409
  var configure = (userConfig = {}) => {
358
410
  const root = document.documentElement;
@@ -363,7 +415,9 @@ var configure = (userConfig = {}) => {
363
415
  style.id = "lt-tokens";
364
416
  document.head.prepend(style);
365
417
  }
366
- style.textContent = "html[data-lt]:not([data-lt-ready]){visibility:hidden}\n" + createStyleSheet(userConfig);
418
+ const guard = "html[data-lt]:not([data-lt-ready]){visibility:hidden}\n";
419
+ const css = createStyleSheet(userConfig);
420
+ style.textContent = css.startsWith("@import") ? css.replace(/^(@import[^\n]*\n)/, `$1${guard}`) : guard + css;
367
421
  requestAnimationFrame(() => root.setAttribute("data-lt-ready", ""));
368
422
  };
369
423
  export {
@@ -1,2 +1,12 @@
1
1
  export declare const DEFAULT_BORDER_RADIUS: "0.5rem";
2
+ export declare const DEFAULT_BORDER_WIDTH: "1px";
3
+ /**
4
+ * Named presets accepted by `border.width` in `LattyConfig`.
5
+ * Any other CSS length passes through unchanged.
6
+ */
7
+ export declare const BORDER_WIDTH_PRESETS: {
8
+ readonly thin: "1px";
9
+ readonly medium: "2px";
10
+ readonly thick: "4px";
11
+ };
2
12
  export declare const DEFAULT_FONT_FAMILY: "\"Hanken Grotesk\", sans-serif";
package/dist/tokens.css CHANGED
@@ -1,5 +1,6 @@
1
1
  :root{
2
2
  --lt-border-radius: 0.5rem;
3
+ --lt-border-width: 1px;
3
4
  --lt-color-black: #000000;
4
5
  --lt-color-error-100: #ffc8c1;
5
6
  --lt-color-error-200: #ffa198;
package/dist/tokens.js CHANGED
@@ -1 +1 @@
1
- export const tokens = {"color":{"primary":{"50":"#f0e5df","100":"#ffd4b5","200":"#ffbb87","300":"#ffa860","400":"#ff9539","500":"#ff8200","600":"#d56400","700":"#963b00","800":"#5e3c25","900":"#3c1d05"},"primary-muted":{"50":"#e9e7e6","100":"#e8dfda","200":"#dfd1c8","300":"#dac8bd","400":"#d2beb2","500":"#c6b1a5","600":"#a08e82","700":"#6b5c53","800":"#50453e","900":"#2b2521"},"secondary":{"50":"#e5e7f1","100":"#cbd2ff","200":"#a3acf7","300":"#8a93f4","400":"#7076e5","500":"#5252c5","600":"#4544ad","700":"#333187","800":"#2e3254","900":"#202343"},"secondary-muted":{"50":"#e7e8e9","100":"#d5d7df","200":"#b4b7c4","300":"#a0a3b3","400":"#898c9e","500":"#6c6f81","600":"#5a5d6d","700":"#414351","800":"#363742","900":"#25262c"},"success":{"50":"#e1ebe2","100":"#beedc6","200":"#94e4a4","300":"#70df8b","400":"#4bd573","500":"#22c55e","600":"#00a244","700":"#006f22","800":"#2b4d32","900":"#0c2e16"},"success-muted":{"50":"#e7e8e7","100":"#dbe3dc","200":"#cad7cc","300":"#bfcfc1","400":"#b3c5b6","500":"#a5b8a8","600":"#839586","700":"#546256","800":"#404a41","900":"#222823"},"warning":{"50":"#ece7de","100":"#f5e0b5","200":"#f6d289","300":"#f9c962","400":"#f7bf3a","500":"#eeb308","600":"#c38e00","700":"#845a00","800":"#584720","900":"#332400"},"warning-muted":{"50":"#e8e8e6","100":"#e7e4dc","200":"#e2dcd0","300":"#ded7c8","400":"#dad1c0","500":"#d2c9b8","600":"#a9a090","700":"#6d6659","800":"#504c42","900":"#292621"},"error":{"50":"#f3e4e2","100":"#ffc8c1","200":"#ffa198","300":"#ff847b","400":"#ff6560","500":"#ef4444","600":"#cb2d31","700":"#950e18","800":"#5a312e","900":"#3f1917"},"error-muted":{"50":"#e9e7e7","100":"#e6dad8","200":"#d6c3c1","300":"#cdb4b2","400":"#bfa4a1","500":"#ab908d","600":"#8d7572","700":"#624e4c","800":"#4c3d3b","900":"#2d2423"},"info":{"50":"#e1e9ef","100":"#bce4fe","200":"#8fd2fd","300":"#6ac7ff","400":"#43b9fa","500":"#0ea5e9","600":"#0087c4","700":"#005c8d","800":"#1e465d","900":"#082a3c"},"info-muted":{"50":"#e7e8e9","100":"#d9e0e5","200":"#c5d0d7","300":"#b8c6cf","400":"#aab9c4","500":"#99a9b3","600":"#7a8993","700":"#4f5b63","800":"#3d464c","900":"#22272a"},"neutral":{"50":"#fafafa","100":"#f3f3f3","200":"#e4e4e4","300":"#cacaca","400":"#ababab","500":"#868686","600":"#696969","700":"#4d4d4d","800":"#333333","900":"#1b1b1b"},"white":"#FFFFFF","black":"#000000"},"spacing":{"px":{"0":"0px","1":"4px","2":"8px","3":"12px","4":"16px","5":"20px","6":"24px","7":"28px","8":"32px","9":"36px","10":"40px","11":"44px","12":"48px","13":"52px","14":"56px","15":"60px","16":"64px","17":"68px","18":"72px","19":"76px","20":"80px","21":"84px","22":"88px","23":"92px","24":"96px"},"rem":{"0":"0rem","1":"0.25rem","2":"0.5rem","3":"0.75rem","4":"1rem","5":"1.25rem","6":"1.5rem","7":"1.75rem","8":"2rem","9":"2.25rem","10":"2.5rem","11":"2.75rem","12":"3rem","13":"3.25rem","14":"3.5rem","15":"3.75rem","16":"4rem","17":"4.25rem","18":"4.5rem","19":"4.75rem","20":"5rem","21":"5.25rem","22":"5.5rem","23":"5.75rem","24":"6rem"}},"border":{"radius":"0.5rem"},"typography":{"fontFamily":"\"Hanken Grotesk\", sans-serif"},"elevation":{"0":"none","1":"0 1px 3px 0 rgb(27 27 27 / 0.1), 0 1px 2px 0 rgb(27 27 27 / 0.06)","2":"0 4px 6px -1px rgb(27 27 27 / 0.1), 0 2px 4px -1px rgb(27 27 27 / 0.06)","3":"0 10px 15px -3px rgb(27 27 27 / 0.1), 0 4px 6px -2px rgb(27 27 27 / 0.05)","4":"0 20px 25px -5px rgb(27 27 27 / 0.1), 0 10px 10px -5px rgb(27 27 27 / 0.04)","5":"0 25px 50px -12px rgb(27 27 27 / 0.25)"},"semantic":{"text-default":"color-neutral-900","text-subtle":"color-neutral-600","text-muted":"color-neutral-400","text-disabled":"color-neutral-400","text-inverse":"color-white","text-neutral":"color-neutral-700","text-primary":"color-primary-700","text-on-primary":"color-neutral-900","text-secondary":"color-secondary-700","text-on-secondary":"color-white","text-success":"color-success-700","text-on-success":"color-white","text-warning":"color-warning-700","text-on-warning":"color-warning-800","text-error":"color-error-700","text-on-error":"color-white","text-info":"color-info-700","text-on-info":"color-white","bg-default":"color-white","bg-subtle":"color-neutral-50","bg-surface":"color-neutral-100","bg-overlay":"color-neutral-200","bg-inverse":"color-neutral-900","bg-neutral-subtle":"color-neutral-100","bg-primary":"color-primary-500","bg-primary-subtle":"color-primary-100","bg-secondary":"color-secondary-500","bg-secondary-subtle":"color-secondary-100","bg-success":"color-success-500","bg-success-subtle":"color-success-100","bg-warning":"color-warning-500","bg-warning-subtle":"color-warning-100","bg-error":"color-error-500","bg-error-subtle":"color-error-100","bg-info":"color-info-500","bg-info-subtle":"color-info-100","border-default":"color-neutral-200","border-strong":"color-neutral-400","border-subtle":"color-neutral-100","border-focus":"color-primary-200","border-primary":"color-primary-200","border-primary-strong":"color-primary-500","border-secondary":"color-secondary-200","border-secondary-strong":"color-secondary-500","border-success":"color-success-200","border-success-strong":"color-success-500","border-warning":"color-warning-200","border-warning-strong":"color-warning-500","border-error":"color-error-200","border-error-strong":"color-error-500","border-info":"color-info-200","border-info-strong":"color-info-500","interactive-primary-bg":"color-primary-500","interactive-primary-bg-hover":"color-primary-600","interactive-primary-bg-active":"color-primary-700","interactive-secondary-bg":"color-secondary-500","interactive-secondary-bg-hover":"color-secondary-600","interactive-secondary-bg-active":"color-secondary-700","interactive-success-bg":"color-success-500","interactive-success-bg-hover":"color-success-600","interactive-success-bg-active":"color-success-700","interactive-warning-bg":"color-warning-500","interactive-warning-bg-hover":"color-warning-600","interactive-warning-bg-active":"color-warning-700","interactive-error-bg":"color-error-500","interactive-error-bg-hover":"color-error-600","interactive-error-bg-active":"color-error-700","interactive-info-bg":"color-info-500","interactive-info-bg-hover":"color-info-600","interactive-info-bg-active":"color-info-700"},"semanticDark":{"text-default":"color-neutral-100","text-subtle":"color-neutral-300","text-muted":"color-neutral-500","text-disabled":"color-neutral-600","text-inverse":"color-neutral-900","text-neutral":"color-neutral-200","text-primary":"color-primary-300","text-on-primary":"color-neutral-900","text-secondary":"color-secondary-300","text-on-secondary":"color-white","text-success":"color-success-300","text-on-success":"color-white","text-warning":"color-warning-300","text-on-warning":"color-warning-800","text-error":"color-error-300","text-on-error":"color-white","text-info":"color-info-300","text-on-info":"color-white","bg-default":"color-neutral-900","bg-subtle":"color-neutral-800","bg-surface":"color-neutral-800","bg-overlay":"color-neutral-700","bg-inverse":"color-neutral-50","bg-neutral-subtle":"color-neutral-800","bg-primary":"color-primary-500","bg-primary-subtle":"color-primary-900","bg-secondary":"color-secondary-500","bg-secondary-subtle":"color-secondary-900","bg-success":"color-success-500","bg-success-subtle":"color-success-900","bg-warning":"color-warning-500","bg-warning-subtle":"color-warning-900","bg-error":"color-error-500","bg-error-subtle":"color-error-900","bg-info":"color-info-500","bg-info-subtle":"color-info-900","border-default":"color-neutral-700","border-strong":"color-neutral-500","border-subtle":"color-neutral-800","border-focus":"color-primary-400","border-primary":"color-primary-700","border-primary-strong":"color-primary-500","border-secondary":"color-secondary-700","border-secondary-strong":"color-secondary-500","border-success":"color-success-700","border-success-strong":"color-success-500","border-warning":"color-warning-700","border-warning-strong":"color-warning-500","border-error":"color-error-700","border-error-strong":"color-error-500","border-info":"color-info-700","border-info-strong":"color-info-500","interactive-primary-bg":"color-primary-400","interactive-primary-bg-hover":"color-primary-300","interactive-primary-bg-active":"color-primary-500","interactive-secondary-bg":"color-secondary-400","interactive-secondary-bg-hover":"color-secondary-300","interactive-secondary-bg-active":"color-secondary-500","interactive-success-bg":"color-success-400","interactive-success-bg-hover":"color-success-300","interactive-success-bg-active":"color-success-500","interactive-warning-bg":"color-warning-400","interactive-warning-bg-hover":"color-warning-300","interactive-warning-bg-active":"color-warning-500","interactive-error-bg":"color-error-400","interactive-error-bg-hover":"color-error-300","interactive-error-bg-active":"color-error-500","interactive-info-bg":"color-info-400","interactive-info-bg-hover":"color-info-300","interactive-info-bg-active":"color-info-500"}};
1
+ export const tokens = {"color":{"primary":{"50":"#f0e5df","100":"#ffd4b5","200":"#ffbb87","300":"#ffa860","400":"#ff9539","500":"#ff8200","600":"#d56400","700":"#963b00","800":"#5e3c25","900":"#3c1d05"},"primary-muted":{"50":"#e9e7e6","100":"#e8dfda","200":"#dfd1c8","300":"#dac8bd","400":"#d2beb2","500":"#c6b1a5","600":"#a08e82","700":"#6b5c53","800":"#50453e","900":"#2b2521"},"secondary":{"50":"#e5e7f1","100":"#cbd2ff","200":"#a3acf7","300":"#8a93f4","400":"#7076e5","500":"#5252c5","600":"#4544ad","700":"#333187","800":"#2e3254","900":"#202343"},"secondary-muted":{"50":"#e7e8e9","100":"#d5d7df","200":"#b4b7c4","300":"#a0a3b3","400":"#898c9e","500":"#6c6f81","600":"#5a5d6d","700":"#414351","800":"#363742","900":"#25262c"},"success":{"50":"#e1ebe2","100":"#beedc6","200":"#94e4a4","300":"#70df8b","400":"#4bd573","500":"#22c55e","600":"#00a244","700":"#006f22","800":"#2b4d32","900":"#0c2e16"},"success-muted":{"50":"#e7e8e7","100":"#dbe3dc","200":"#cad7cc","300":"#bfcfc1","400":"#b3c5b6","500":"#a5b8a8","600":"#839586","700":"#546256","800":"#404a41","900":"#222823"},"warning":{"50":"#ece7de","100":"#f5e0b5","200":"#f6d289","300":"#f9c962","400":"#f7bf3a","500":"#eeb308","600":"#c38e00","700":"#845a00","800":"#584720","900":"#332400"},"warning-muted":{"50":"#e8e8e6","100":"#e7e4dc","200":"#e2dcd0","300":"#ded7c8","400":"#dad1c0","500":"#d2c9b8","600":"#a9a090","700":"#6d6659","800":"#504c42","900":"#292621"},"error":{"50":"#f3e4e2","100":"#ffc8c1","200":"#ffa198","300":"#ff847b","400":"#ff6560","500":"#ef4444","600":"#cb2d31","700":"#950e18","800":"#5a312e","900":"#3f1917"},"error-muted":{"50":"#e9e7e7","100":"#e6dad8","200":"#d6c3c1","300":"#cdb4b2","400":"#bfa4a1","500":"#ab908d","600":"#8d7572","700":"#624e4c","800":"#4c3d3b","900":"#2d2423"},"info":{"50":"#e1e9ef","100":"#bce4fe","200":"#8fd2fd","300":"#6ac7ff","400":"#43b9fa","500":"#0ea5e9","600":"#0087c4","700":"#005c8d","800":"#1e465d","900":"#082a3c"},"info-muted":{"50":"#e7e8e9","100":"#d9e0e5","200":"#c5d0d7","300":"#b8c6cf","400":"#aab9c4","500":"#99a9b3","600":"#7a8993","700":"#4f5b63","800":"#3d464c","900":"#22272a"},"neutral":{"50":"#fafafa","100":"#f3f3f3","200":"#e4e4e4","300":"#cacaca","400":"#ababab","500":"#868686","600":"#696969","700":"#4d4d4d","800":"#333333","900":"#1b1b1b"},"white":"#FFFFFF","black":"#000000"},"spacing":{"px":{"0":"0px","1":"4px","2":"8px","3":"12px","4":"16px","5":"20px","6":"24px","7":"28px","8":"32px","9":"36px","10":"40px","11":"44px","12":"48px","13":"52px","14":"56px","15":"60px","16":"64px","17":"68px","18":"72px","19":"76px","20":"80px","21":"84px","22":"88px","23":"92px","24":"96px"},"rem":{"0":"0rem","1":"0.25rem","2":"0.5rem","3":"0.75rem","4":"1rem","5":"1.25rem","6":"1.5rem","7":"1.75rem","8":"2rem","9":"2.25rem","10":"2.5rem","11":"2.75rem","12":"3rem","13":"3.25rem","14":"3.5rem","15":"3.75rem","16":"4rem","17":"4.25rem","18":"4.5rem","19":"4.75rem","20":"5rem","21":"5.25rem","22":"5.5rem","23":"5.75rem","24":"6rem"}},"border":{"radius":"0.5rem","width":"1px"},"typography":{"fontFamily":"\"Hanken Grotesk\", sans-serif"},"elevation":{"0":"none","1":"0 1px 3px 0 rgb(27 27 27 / 0.1), 0 1px 2px 0 rgb(27 27 27 / 0.06)","2":"0 4px 6px -1px rgb(27 27 27 / 0.1), 0 2px 4px -1px rgb(27 27 27 / 0.06)","3":"0 10px 15px -3px rgb(27 27 27 / 0.1), 0 4px 6px -2px rgb(27 27 27 / 0.05)","4":"0 20px 25px -5px rgb(27 27 27 / 0.1), 0 10px 10px -5px rgb(27 27 27 / 0.04)","5":"0 25px 50px -12px rgb(27 27 27 / 0.25)"},"semantic":{"text-default":"color-neutral-900","text-subtle":"color-neutral-600","text-muted":"color-neutral-400","text-disabled":"color-neutral-400","text-inverse":"color-white","text-neutral":"color-neutral-700","text-primary":"color-primary-700","text-on-primary":"color-neutral-900","text-secondary":"color-secondary-700","text-on-secondary":"color-white","text-success":"color-success-700","text-on-success":"color-white","text-warning":"color-warning-700","text-on-warning":"color-warning-800","text-error":"color-error-700","text-on-error":"color-white","text-info":"color-info-700","text-on-info":"color-white","bg-default":"color-white","bg-subtle":"color-neutral-50","bg-surface":"color-neutral-100","bg-overlay":"color-neutral-200","bg-inverse":"color-neutral-900","bg-neutral-subtle":"color-neutral-100","bg-primary":"color-primary-500","bg-primary-subtle":"color-primary-100","bg-secondary":"color-secondary-500","bg-secondary-subtle":"color-secondary-100","bg-success":"color-success-500","bg-success-subtle":"color-success-100","bg-warning":"color-warning-500","bg-warning-subtle":"color-warning-100","bg-error":"color-error-500","bg-error-subtle":"color-error-100","bg-info":"color-info-500","bg-info-subtle":"color-info-100","border-default":"color-neutral-200","border-strong":"color-neutral-400","border-subtle":"color-neutral-100","border-focus":"color-primary-200","border-primary":"color-primary-200","border-primary-strong":"color-primary-500","border-secondary":"color-secondary-200","border-secondary-strong":"color-secondary-500","border-success":"color-success-200","border-success-strong":"color-success-500","border-warning":"color-warning-200","border-warning-strong":"color-warning-500","border-error":"color-error-200","border-error-strong":"color-error-500","border-info":"color-info-200","border-info-strong":"color-info-500","interactive-primary-bg":"color-primary-500","interactive-primary-bg-hover":"color-primary-600","interactive-primary-bg-active":"color-primary-700","interactive-secondary-bg":"color-secondary-500","interactive-secondary-bg-hover":"color-secondary-600","interactive-secondary-bg-active":"color-secondary-700","interactive-success-bg":"color-success-500","interactive-success-bg-hover":"color-success-600","interactive-success-bg-active":"color-success-700","interactive-warning-bg":"color-warning-500","interactive-warning-bg-hover":"color-warning-600","interactive-warning-bg-active":"color-warning-700","interactive-error-bg":"color-error-500","interactive-error-bg-hover":"color-error-600","interactive-error-bg-active":"color-error-700","interactive-info-bg":"color-info-500","interactive-info-bg-hover":"color-info-600","interactive-info-bg-active":"color-info-700"},"semanticDark":{"text-default":"color-neutral-100","text-subtle":"color-neutral-300","text-muted":"color-neutral-500","text-disabled":"color-neutral-600","text-inverse":"color-neutral-900","text-neutral":"color-neutral-200","text-primary":"color-primary-300","text-on-primary":"color-neutral-900","text-secondary":"color-secondary-300","text-on-secondary":"color-white","text-success":"color-success-300","text-on-success":"color-white","text-warning":"color-warning-300","text-on-warning":"color-warning-800","text-error":"color-error-300","text-on-error":"color-white","text-info":"color-info-300","text-on-info":"color-white","bg-default":"color-neutral-900","bg-subtle":"color-neutral-800","bg-surface":"color-neutral-800","bg-overlay":"color-neutral-700","bg-inverse":"color-neutral-50","bg-neutral-subtle":"color-neutral-800","bg-primary":"color-primary-500","bg-primary-subtle":"color-primary-900","bg-secondary":"color-secondary-500","bg-secondary-subtle":"color-secondary-900","bg-success":"color-success-500","bg-success-subtle":"color-success-900","bg-warning":"color-warning-500","bg-warning-subtle":"color-warning-900","bg-error":"color-error-500","bg-error-subtle":"color-error-900","bg-info":"color-info-500","bg-info-subtle":"color-info-900","border-default":"color-neutral-700","border-strong":"color-neutral-500","border-subtle":"color-neutral-800","border-focus":"color-primary-400","border-primary":"color-primary-700","border-primary-strong":"color-primary-500","border-secondary":"color-secondary-700","border-secondary-strong":"color-secondary-500","border-success":"color-success-700","border-success-strong":"color-success-500","border-warning":"color-warning-700","border-warning-strong":"color-warning-500","border-error":"color-error-700","border-error-strong":"color-error-500","border-info":"color-info-700","border-info-strong":"color-info-500","interactive-primary-bg":"color-primary-400","interactive-primary-bg-hover":"color-primary-300","interactive-primary-bg-active":"color-primary-500","interactive-secondary-bg":"color-secondary-400","interactive-secondary-bg-hover":"color-secondary-300","interactive-secondary-bg-active":"color-secondary-500","interactive-success-bg":"color-success-400","interactive-success-bg-hover":"color-success-300","interactive-success-bg-active":"color-success-500","interactive-warning-bg":"color-warning-400","interactive-warning-bg-hover":"color-warning-300","interactive-warning-bg-active":"color-warning-500","interactive-error-bg":"color-error-400","interactive-error-bg-hover":"color-error-300","interactive-error-bg-active":"color-error-500","interactive-info-bg":"color-info-400","interactive-info-bg-hover":"color-info-300","interactive-info-bg-active":"color-info-500"}};
package/dist/tokens.json CHANGED
@@ -216,7 +216,8 @@
216
216
  }
217
217
  },
218
218
  "border": {
219
- "radius": "0.5rem"
219
+ "radius": "0.5rem",
220
+ "width": "1px"
220
221
  },
221
222
  "typography": {
222
223
  "fontFamily": "\"Hanken Grotesk\", sans-serif"
@@ -39,6 +39,7 @@ export type Tokens = {
39
39
  spacing: SpacingTokens;
40
40
  border: {
41
41
  radius: string;
42
+ width: string;
42
43
  };
43
44
  typography: {
44
45
  fontFamily: string;
@@ -46,14 +47,32 @@ export type Tokens = {
46
47
  elevation: ElevationTokens;
47
48
  };
48
49
  export type { Config, TokenColorName } from './';
50
+ /**
51
+ * Border width applied to control chrome (outlined buttons, inputs, chips, surfaces).
52
+ * Named presets: `thin` = 1px (default), `medium` = 2px, `thick` = 4px.
53
+ * Any other CSS length (e.g. `'1.5px'`) passes through unchanged.
54
+ */
55
+ export type BorderWidth = 'thin' | 'medium' | 'thick' | (string & {});
49
56
  export interface LattyConfig {
50
57
  /** Built-in names: primary, secondary, success, warning, error, info. Any additional name generates a new palette. */
51
58
  colors?: Record<string, string>;
52
59
  font?: {
60
+ /**
61
+ * A CSS `font-family` value (e.g. `'Inter, sans-serif'`), or a Google
62
+ * Fonts CSS2 stylesheet URL (e.g.
63
+ * `'https://fonts.googleapis.com/css2?family=Hanken+Grotesk:ital,wght@0,100..900&display=swap'`).
64
+ * URLs get `@import`ed automatically and the family name is derived from
65
+ * the `family=` query param — no separate `<link>` tag needed. Stylesheet
66
+ * URLs from providers other than `fonts.googleapis.com` are still loaded,
67
+ * but since there's no reliable way to guess the family name from an
68
+ * arbitrary CDN, pass the resulting name as a plain value instead (or
69
+ * open an issue if there's a provider worth special-casing).
70
+ */
53
71
  family?: string;
54
72
  };
55
73
  border?: {
56
74
  radius?: string;
75
+ width?: BorderWidth;
57
76
  };
58
77
  /**
59
78
  * Controls which semantic token layer is emitted.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@latty-ds/tokens",
3
- "version": "0.6.0",
3
+ "version": "0.8.0",
4
4
  "description": "Design tokens for the Latty design system — generates CSS custom properties, JSON, and JavaScript exports from a single config file",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -53,12 +53,12 @@
53
53
  "clean": "rm -rf dist dist-scripts"
54
54
  },
55
55
  "devDependencies": {
56
- "@latty-ds/utils": "0.6.0",
56
+ "@latty-ds/utils": "0.7.0",
57
57
  "@types/culori": "^4.0.1",
58
58
  "typescript": "^5.5.4"
59
59
  },
60
60
  "dependencies": {
61
61
  "culori": "^4.0.2"
62
62
  },
63
- "gitHead": "5f2e9dbee20f32bc24117a40f8f2f65a4de07979"
63
+ "gitHead": "144dd8d2f7440fd5fd8ecb4f396407c4ce3be9f2"
64
64
  }