@kolkrabbi/kol-styleguide 0.1.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.
@@ -0,0 +1,68 @@
1
+ /**
2
+ * typographyCuts — Right Grotesk cut / weight / case data for TypeBlock.
3
+ *
4
+ * Ported from the monorepo apps/brand styleguide (`data/typography-cuts.js`,
5
+ * 2026-07). The port keeps the shared, framework-agnostic helpers a specimen
6
+ * consumer needs — the weight list, the cut list, and `familyFor` (the
7
+ * cut-key → CSS `font-family` resolver whose strings name the theme's Right
8
+ * Grotesk / JetBrains Mono `@font-face` declarations). Consumer-facing control
9
+ * UIs read WEIGHTS / CUTS / CASES to build their dropdowns.
10
+ *
11
+ * Deviations from source:
12
+ * • `applyCase` (JS string mutation: toUpperCase / charAt(0).toUpperCase())
13
+ * is NOT ported — KOL forbids JS-side casing of content. TypeBlock drives
14
+ * case through the CSS `text-transform` keyword instead (see CASES), so
15
+ * the sample string is never mutated. Sentence-case is dropped; author the
16
+ * sample string in the case it should render (KOL "default to authoring").
17
+ * • `familyFor`'s parameter is renamed `cut` (was `width`); behaviour is
18
+ * identical.
19
+ */
20
+
21
+ /* Right Grotesk weight axis — PP naming convention.
22
+ * Fine 100 · Light 300 · Regular 400 · Medium 500 · Dark 600 · Bold 700 · Black 900. */
23
+ export const WEIGHTS = [
24
+ { id: 100, label: 'Fine' },
25
+ { id: 300, label: 'Light' },
26
+ { id: 400, label: 'Regular' },
27
+ { id: 500, label: 'Medium' },
28
+ { id: 600, label: 'Dark' },
29
+ { id: 700, label: 'Bold' },
30
+ { id: 900, label: 'Black' },
31
+ ]
32
+
33
+ /* Right Grotesk cuts loaded by the theme (@font-face in kol-typography.css),
34
+ * plus the mono escape hatch (JetBrains Mono, kol-typography-mono.css). `id` is
35
+ * the key passed to TypeBlock's `cut` prop and to `familyFor`. */
36
+ export const CUTS = [
37
+ { id: 'base', label: 'Right Grotesk' },
38
+ { id: 'Narrow', label: 'Narrow' },
39
+ { id: 'Compact', label: 'Compact' },
40
+ { id: 'Tall', label: 'Tall' },
41
+ { id: 'Wide', label: 'Wide' },
42
+ { id: 'Spatial', label: 'Spatial' },
43
+ { id: 'Tight', label: 'Tight' },
44
+ { id: 'Text', label: 'Text' },
45
+ { id: 'mono', label: 'JetBrains Mono' },
46
+ ]
47
+
48
+ /* Case control — the four CSS `text-transform` keywords TypeBlock understands.
49
+ * `id` is the value passed straight to the `case` prop → CSS text-transform.
50
+ * Default is `none` (render the string exactly as authored). */
51
+ export const CASES = [
52
+ { id: 'none', label: 'As authored' },
53
+ { id: 'uppercase', label: 'Uppercase' },
54
+ { id: 'lowercase', label: 'Lowercase' },
55
+ { id: 'capitalize', label: 'Capitalize' },
56
+ ]
57
+
58
+ /**
59
+ * familyFor — resolve a cut key to a CSS `font-family` string.
60
+ * The returned name matches a theme `@font-face` family: 'JetBrains Mono'
61
+ * (mono token), 'Right Grotesk' (base), or 'Right Grotesk <Cut>' for a width
62
+ * variant (Narrow / Compact / Tall / Wide / Spatial / Tight / Text).
63
+ */
64
+ export const familyFor = (cut) => {
65
+ if (cut === 'mono') return 'JetBrains Mono'
66
+ if (cut === 'base') return 'Right Grotesk'
67
+ return `Right Grotesk ${cut}`
68
+ }