@ariaui/typography 0.2.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,579 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __defProps = Object.defineProperties;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
6
+ var __getOwnPropNames = Object.getOwnPropertyNames;
7
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
8
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
9
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
10
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
11
+ var __spreadValues = (a, b) => {
12
+ for (var prop in b || (b = {}))
13
+ if (__hasOwnProp.call(b, prop))
14
+ __defNormalProp(a, prop, b[prop]);
15
+ if (__getOwnPropSymbols)
16
+ for (var prop of __getOwnPropSymbols(b)) {
17
+ if (__propIsEnum.call(b, prop))
18
+ __defNormalProp(a, prop, b[prop]);
19
+ }
20
+ return a;
21
+ };
22
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
23
+ var __export = (target, all) => {
24
+ for (var name in all)
25
+ __defProp(target, name, { get: all[name], enumerable: true });
26
+ };
27
+ var __copyProps = (to, from, except, desc) => {
28
+ if (from && typeof from === "object" || typeof from === "function") {
29
+ for (let key of __getOwnPropNames(from))
30
+ if (!__hasOwnProp.call(to, key) && key !== except)
31
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
32
+ }
33
+ return to;
34
+ };
35
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
36
+
37
+ // tokens.ts
38
+ var tokens_exports = {};
39
+ __export(tokens_exports, {
40
+ BREAKPOINTS: () => BREAKPOINTS,
41
+ FONT_STACKS: () => FONT_STACKS,
42
+ RATIOS: () => RATIOS,
43
+ buildFontFamily: () => buildFontFamily,
44
+ createFontStack: () => createFontStack,
45
+ createModularScale: () => createModularScale,
46
+ createTextStyle: () => createTextStyle,
47
+ deriveTextPresets: () => deriveTextPresets,
48
+ extendScale: () => extendScale,
49
+ fluidScale: () => fluidScale,
50
+ fluidSize: () => fluidSize,
51
+ fluidStyle: () => fluidStyle,
52
+ getStep: () => getStep,
53
+ listSteps: () => listSteps,
54
+ measureRange: () => measureRange,
55
+ mergeTextStyles: () => mergeTextStyles,
56
+ monoStack: () => monoStack,
57
+ optimalMeasure: () => optimalMeasure,
58
+ resolveAsScaleSteps: () => resolveAsScaleSteps,
59
+ resolveDisplayScale: () => resolveDisplayScale,
60
+ resolveFluidScale: () => resolveFluidScale,
61
+ resolveTextScale: () => resolveTextScale,
62
+ resolveTypeScale: () => resolveTypeScale,
63
+ resolveTypeStep: () => resolveTypeStep,
64
+ responsiveStyle: () => responsiveStyle,
65
+ rhythmSpacing: () => rhythmSpacing,
66
+ sansStack: () => sansStack,
67
+ serifStack: () => serifStack,
68
+ snapToBaseline: () => snapToBaseline,
69
+ sortedBreakpoints: () => sortedBreakpoints,
70
+ systemStack: () => systemStack,
71
+ toCSSDeclarations: () => toCSSDeclarations,
72
+ toCSSProperties: () => toCSSProperties,
73
+ toCSSVars: () => toCSSVars,
74
+ toTailwindClasses: () => toTailwindClasses,
75
+ verticalRhythm: () => verticalRhythm
76
+ });
77
+ module.exports = __toCommonJS(tokens_exports);
78
+
79
+ // src/scale.ts
80
+ var RATIOS = {
81
+ minorSecond: 1.067,
82
+ majorSecond: 1.125,
83
+ minorThird: 1.2,
84
+ majorThird: 1.25,
85
+ perfectFourth: 1.333,
86
+ augmentedFourth: 1.414,
87
+ perfectFifth: 1.5,
88
+ goldenRatio: 1.618
89
+ };
90
+ function round(value, decimals = 4) {
91
+ const f = Math.pow(10, decimals);
92
+ return Math.round(value * f) / f;
93
+ }
94
+ function defaultLineHeight(sizeRem) {
95
+ const ratio = Math.max(1.2, Math.min(1.6, 1.6 - (sizeRem - 0.75) * 0.1));
96
+ return round(sizeRem * ratio);
97
+ }
98
+ function defaultLetterSpacing(sizeRem) {
99
+ if (sizeRem >= 2) return "-0.02em";
100
+ if (sizeRem >= 1.5) return "-0.01em";
101
+ return "0em";
102
+ }
103
+ function createModularScale(base = 1, ratio = RATIOS.majorSecond, stepsUp = 5, stepsDown = 2) {
104
+ const result = {};
105
+ for (let i = -stepsDown; i <= stepsUp; i++) {
106
+ const sizeRem = round(base * Math.pow(ratio, i));
107
+ const lh = defaultLineHeight(sizeRem);
108
+ result[String(i)] = {
109
+ size: `${sizeRem}rem`,
110
+ lineHeight: `${lh}rem`,
111
+ letterSpacing: defaultLetterSpacing(sizeRem)
112
+ };
113
+ }
114
+ return result;
115
+ }
116
+ function extendScale(base, overrides) {
117
+ const result = __spreadValues({}, base);
118
+ for (const [key, partial] of Object.entries(overrides)) {
119
+ const existing = result[key];
120
+ if (existing) {
121
+ result[key] = __spreadValues(__spreadValues({}, existing), partial);
122
+ } else {
123
+ if (!partial.size || !partial.lineHeight || !partial.letterSpacing) {
124
+ throw new Error(
125
+ `New scale step "${key}" requires size, lineHeight, and letterSpacing`
126
+ );
127
+ }
128
+ result[key] = partial;
129
+ }
130
+ }
131
+ return result;
132
+ }
133
+ function getStep(scale, name) {
134
+ return scale[name];
135
+ }
136
+ function listSteps(scale) {
137
+ return Object.keys(scale).sort((a, b) => {
138
+ const sA = parseFloat(scale[a].size);
139
+ const sB = parseFloat(scale[b].size);
140
+ return sA - sB;
141
+ });
142
+ }
143
+
144
+ // src/fluid.ts
145
+ function round2(value, decimals = 4) {
146
+ const f = Math.pow(10, decimals);
147
+ return Math.round(value * f) / f;
148
+ }
149
+ function parseRem(value) {
150
+ const n = parseFloat(value);
151
+ if (Number.isNaN(n)) {
152
+ throw new Error(`Cannot parse rem value: "${value}"`);
153
+ }
154
+ return n;
155
+ }
156
+ function fluidSize(config) {
157
+ const { minSize, maxSize, minViewport = 320, maxViewport = 1280 } = config;
158
+ if (minSize === maxSize) {
159
+ return `${minSize}rem`;
160
+ }
161
+ const lo = Math.min(minSize, maxSize);
162
+ const hi = Math.max(minSize, maxSize);
163
+ const slope = (hi - lo) / (maxViewport - minViewport);
164
+ const slopeVw = round2(slope * 100, 4);
165
+ const intercept = round2(lo - slope * minViewport / 16, 4);
166
+ return `clamp(${lo}rem, ${intercept}rem + ${slopeVw}vw, ${hi}rem)`;
167
+ }
168
+ function fluidStyle(min, max, viewports) {
169
+ var _a;
170
+ const minSize = parseRem(min.size);
171
+ const maxSize = parseRem(max.size);
172
+ const minLh = parseRem(min.lineHeight);
173
+ const maxLh = parseRem(max.lineHeight);
174
+ const fontSize = fluidSize({
175
+ minSize,
176
+ maxSize,
177
+ minViewport: viewports == null ? void 0 : viewports.min,
178
+ maxViewport: viewports == null ? void 0 : viewports.max
179
+ });
180
+ const lineHeight = fluidSize({
181
+ minSize: minLh,
182
+ maxSize: maxLh,
183
+ minViewport: viewports == null ? void 0 : viewports.min,
184
+ maxViewport: viewports == null ? void 0 : viewports.max
185
+ });
186
+ return {
187
+ fontSize,
188
+ lineHeight,
189
+ // Use the larger step's tracking (tighter for headings)
190
+ letterSpacing: maxSize >= minSize ? max.letterSpacing : min.letterSpacing,
191
+ fontWeight: (_a = max.fontWeight) != null ? _a : min.fontWeight
192
+ };
193
+ }
194
+ function fluidScale(mobileScale, desktopScale, viewports) {
195
+ const result = {};
196
+ for (const key of Object.keys(desktopScale)) {
197
+ const mobile = mobileScale[key];
198
+ const desktop = desktopScale[key];
199
+ if (!mobile) {
200
+ result[key] = {
201
+ fontSize: desktop.size,
202
+ lineHeight: desktop.lineHeight,
203
+ letterSpacing: desktop.letterSpacing,
204
+ fontWeight: desktop.fontWeight
205
+ };
206
+ continue;
207
+ }
208
+ result[key] = fluidStyle(mobile, desktop, viewports);
209
+ }
210
+ return result;
211
+ }
212
+
213
+ // src/font-stack.ts
214
+ var systemStack = {
215
+ name: "system",
216
+ families: [
217
+ "system-ui",
218
+ "-apple-system",
219
+ "BlinkMacSystemFont",
220
+ "'Segoe UI'",
221
+ "Roboto",
222
+ "'Helvetica Neue'",
223
+ "Arial",
224
+ "sans-serif",
225
+ "'Apple Color Emoji'",
226
+ "'Segoe UI Emoji'"
227
+ ]
228
+ };
229
+ var sansStack = {
230
+ name: "sans",
231
+ families: [
232
+ "'Inter'",
233
+ "system-ui",
234
+ "-apple-system",
235
+ "BlinkMacSystemFont",
236
+ "'Segoe UI'",
237
+ "Roboto",
238
+ "'Helvetica Neue'",
239
+ "Arial",
240
+ "sans-serif"
241
+ ]
242
+ };
243
+ var serifStack = {
244
+ name: "serif",
245
+ families: [
246
+ "Georgia",
247
+ "'Times New Roman'",
248
+ "Times",
249
+ "serif"
250
+ ]
251
+ };
252
+ var monoStack = {
253
+ name: "mono",
254
+ families: [
255
+ "'JetBrains Mono'",
256
+ "'Fira Code'",
257
+ "'SF Mono'",
258
+ "Menlo",
259
+ "Consolas",
260
+ "'Liberation Mono'",
261
+ "'Courier New'",
262
+ "monospace"
263
+ ]
264
+ };
265
+ var FONT_STACKS = {
266
+ system: systemStack,
267
+ sans: sansStack,
268
+ serif: serifStack,
269
+ mono: monoStack
270
+ };
271
+ function buildFontFamily(stack) {
272
+ return stack.families.join(", ");
273
+ }
274
+ function createFontStack(name, primary, fallback = systemStack) {
275
+ const quoted = primary.includes("'") || primary.includes('"') ? primary : `'${primary}'`;
276
+ return {
277
+ name,
278
+ families: [quoted, ...fallback.families]
279
+ };
280
+ }
281
+
282
+ // src/style.ts
283
+ function createTextStyle(step, overrides) {
284
+ return __spreadValues({
285
+ fontSize: step.size,
286
+ lineHeight: step.lineHeight,
287
+ letterSpacing: step.letterSpacing,
288
+ fontWeight: step.fontWeight
289
+ }, overrides);
290
+ }
291
+ function mergeTextStyles(...styles) {
292
+ let fontSize;
293
+ let lineHeight;
294
+ let letterSpacing;
295
+ let fontWeight;
296
+ let fontFamily;
297
+ for (const style of styles) {
298
+ if (style.fontSize !== void 0) fontSize = style.fontSize;
299
+ if (style.lineHeight !== void 0) lineHeight = style.lineHeight;
300
+ if (style.letterSpacing !== void 0) letterSpacing = style.letterSpacing;
301
+ if (style.fontWeight !== void 0) fontWeight = style.fontWeight;
302
+ if (style.fontFamily !== void 0) fontFamily = style.fontFamily;
303
+ }
304
+ if (!fontSize || !lineHeight || !letterSpacing) {
305
+ throw new Error(
306
+ "mergeTextStyles: result must have fontSize, lineHeight, and letterSpacing"
307
+ );
308
+ }
309
+ return { fontSize, lineHeight, letterSpacing, fontWeight, fontFamily };
310
+ }
311
+
312
+ // src/format.ts
313
+ function toCSSProperties(style) {
314
+ const props = {
315
+ fontSize: style.fontSize,
316
+ lineHeight: style.lineHeight,
317
+ letterSpacing: style.letterSpacing
318
+ };
319
+ if (style.fontWeight) props.fontWeight = style.fontWeight;
320
+ if (style.fontFamily) props.fontFamily = style.fontFamily;
321
+ return props;
322
+ }
323
+ function toCSSDeclarations(style) {
324
+ const lines = [
325
+ `font-size: ${style.fontSize};`,
326
+ `line-height: ${style.lineHeight};`,
327
+ `letter-spacing: ${style.letterSpacing};`
328
+ ];
329
+ if (style.fontWeight) lines.push(`font-weight: ${style.fontWeight};`);
330
+ if (style.fontFamily) lines.push(`font-family: ${style.fontFamily};`);
331
+ return lines.join("\n");
332
+ }
333
+ function toCSSVars(stepName) {
334
+ const lines = [
335
+ `font-size: var(--font-size-${stepName});`,
336
+ `line-height: var(--font-size-${stepName}--line-height);`
337
+ ];
338
+ lines.push(`letter-spacing: var(--font-size-${stepName}--letter-spacing, 0em);`);
339
+ return lines.join("\n");
340
+ }
341
+ function toTailwindClasses(style) {
342
+ const parts = [
343
+ `text-[${style.fontSize}]`,
344
+ `leading-[${style.lineHeight}]`,
345
+ `tracking-[${style.letterSpacing}]`
346
+ ];
347
+ if (style.fontWeight) parts.push(`font-[${style.fontWeight}]`);
348
+ return parts.join(" ");
349
+ }
350
+
351
+ // src/responsive.ts
352
+ var BREAKPOINTS = {
353
+ sm: 640,
354
+ md: 768,
355
+ lg: 1024,
356
+ xl: 1280,
357
+ "2xl": 1536
358
+ };
359
+ function responsiveStyle(config, breakpoints = BREAKPOINTS) {
360
+ const defaultEntry = config["default"];
361
+ if (!defaultEntry) {
362
+ throw new Error('responsiveStyle: "default" entry is required');
363
+ }
364
+ const defaultStyle = isTextStyle(defaultEntry) ? defaultEntry : createTextStyle(defaultEntry);
365
+ const bps = {};
366
+ for (const [key, value] of Object.entries(config)) {
367
+ if (key === "default") continue;
368
+ if (!(key in breakpoints)) {
369
+ throw new Error(
370
+ `responsiveStyle: unknown breakpoint "${key}". Available: ${Object.keys(breakpoints).join(", ")}`
371
+ );
372
+ }
373
+ bps[key] = isTextStyle(value) ? value : createTextStyle(value);
374
+ }
375
+ return { default: defaultStyle, breakpoints: bps };
376
+ }
377
+ function sortedBreakpoints(responsive, breakpoints = BREAKPOINTS) {
378
+ return Object.entries(responsive.breakpoints).map(([name, style]) => {
379
+ var _a;
380
+ return [name, (_a = breakpoints[name]) != null ? _a : 0, style];
381
+ }).sort((a, b) => a[1] - b[1]);
382
+ }
383
+ function isTextStyle(value) {
384
+ return "fontSize" in value;
385
+ }
386
+
387
+ // src/measure.ts
388
+ function parseRem2(value) {
389
+ const n = parseFloat(value);
390
+ if (Number.isNaN(n)) {
391
+ throw new Error(`Cannot parse rem value: "${value}"`);
392
+ }
393
+ return n;
394
+ }
395
+ function round3(value, decimals = 2) {
396
+ const f = Math.pow(10, decimals);
397
+ return Math.round(value * f) / f;
398
+ }
399
+ function optimalMeasure(options) {
400
+ var _a;
401
+ const ideal = (_a = options == null ? void 0 : options.ideal) != null ? _a : 66;
402
+ return `${ideal}ch`;
403
+ }
404
+ function measureRange(options) {
405
+ var _a, _b, _c;
406
+ const min = (_a = options == null ? void 0 : options.min) != null ? _a : 45;
407
+ const max = (_b = options == null ? void 0 : options.max) != null ? _b : 75;
408
+ const ideal = (_c = options == null ? void 0 : options.ideal) != null ? _c : 66;
409
+ return {
410
+ min: `${min}ch`,
411
+ max: `${max}ch`,
412
+ ideal: `${ideal}ch`
413
+ };
414
+ }
415
+ function snapToBaseline(fontSize, config) {
416
+ var _a, _b;
417
+ const size = parseRem2(fontSize);
418
+ const grid = (_a = config == null ? void 0 : config.gridUnit) != null ? _a : 0.25;
419
+ const rounding = (_b = config == null ? void 0 : config.rounding) != null ? _b : "ceil";
420
+ const minLh = size * 1.2;
421
+ const steps = minLh / grid;
422
+ let snapped;
423
+ switch (rounding) {
424
+ case "floor":
425
+ snapped = Math.floor(steps) * grid;
426
+ if (snapped < size) snapped = Math.ceil(size / grid) * grid;
427
+ break;
428
+ case "round":
429
+ snapped = Math.round(steps) * grid;
430
+ if (snapped < size) snapped += grid;
431
+ break;
432
+ case "ceil":
433
+ default:
434
+ snapped = Math.ceil(steps) * grid;
435
+ break;
436
+ }
437
+ return `${round3(snapped, 4)}rem`;
438
+ }
439
+ function rhythmSpacing(lineHeight, lines = 1, gridUnit = 0.25) {
440
+ return `${round3(lines * gridUnit, 4)}rem`;
441
+ }
442
+ function verticalRhythm(fontSize, spacingLines = 4, config) {
443
+ var _a;
444
+ const grid = (_a = config == null ? void 0 : config.gridUnit) != null ? _a : 0.25;
445
+ const lineHeight = snapToBaseline(fontSize, config);
446
+ const spacing = rhythmSpacing(lineHeight, spacingLines, grid);
447
+ return {
448
+ lineHeight,
449
+ marginTop: spacing,
450
+ marginBottom: spacing
451
+ };
452
+ }
453
+
454
+ // src/resolve.ts
455
+ var import_tokens = require("@ariaui/tokens");
456
+ function toScaleStep(step) {
457
+ return {
458
+ size: step.size,
459
+ lineHeight: step.lineHeight,
460
+ letterSpacing: step.letterSpacing,
461
+ fontWeight: step.fontWeight
462
+ };
463
+ }
464
+ function resolveTypeStep(name) {
465
+ const step = import_tokens.typeScale[name];
466
+ if (!step) return void 0;
467
+ return createTextStyle(toScaleStep(step));
468
+ }
469
+ function resolveTypeScale() {
470
+ const result = {};
471
+ for (const [name, step] of Object.entries(import_tokens.typeScale)) {
472
+ result[name] = createTextStyle(toScaleStep(step));
473
+ }
474
+ return result;
475
+ }
476
+ function resolveDisplayScale() {
477
+ const result = {};
478
+ for (const [name, step] of Object.entries(import_tokens.typeScale)) {
479
+ if (name.startsWith("display-")) {
480
+ result[name] = createTextStyle(toScaleStep(step));
481
+ }
482
+ }
483
+ return result;
484
+ }
485
+ function resolveTextScale() {
486
+ const result = {};
487
+ for (const [name, step] of Object.entries(import_tokens.typeScale)) {
488
+ if (name.startsWith("text-")) {
489
+ result[name] = createTextStyle(toScaleStep(step));
490
+ }
491
+ }
492
+ return result;
493
+ }
494
+ function resolveAsScaleSteps() {
495
+ const result = {};
496
+ for (const [name, step] of Object.entries(import_tokens.typeScale)) {
497
+ result[name] = toScaleStep(step);
498
+ }
499
+ return result;
500
+ }
501
+ function resolveFluidScale(mobileMultiplier = 0.75, viewports) {
502
+ const result = {};
503
+ for (const [name, step] of Object.entries(import_tokens.typeScale)) {
504
+ const desktopStep = toScaleStep(step);
505
+ const desktopSize = parseFloat(step.size);
506
+ const desktopLh = parseFloat(step.lineHeight);
507
+ const mobileStep = {
508
+ size: `${round4(desktopSize * mobileMultiplier)}rem`,
509
+ lineHeight: `${round4(desktopLh * mobileMultiplier)}rem`,
510
+ letterSpacing: step.letterSpacing,
511
+ fontWeight: step.fontWeight
512
+ };
513
+ result[name] = fluidStyle(mobileStep, desktopStep, viewports);
514
+ }
515
+ return result;
516
+ }
517
+ function deriveTextPresets() {
518
+ const scale = resolveTypeScale();
519
+ return {
520
+ heading1: __spreadProps(__spreadValues({}, scale["display-2xl"]), { fontWeight: "700" }),
521
+ heading2: __spreadProps(__spreadValues({}, scale["display-xl"]), { fontWeight: "700" }),
522
+ heading3: __spreadProps(__spreadValues({}, scale["display-lg"]), { fontWeight: "600" }),
523
+ heading4: __spreadProps(__spreadValues({}, scale["display-md"]), { fontWeight: "600" }),
524
+ heading5: __spreadProps(__spreadValues({}, scale["display-sm"]), { fontWeight: "600" }),
525
+ heading6: __spreadProps(__spreadValues({}, scale["display-xs"]), { fontWeight: "600" }),
526
+ body: __spreadProps(__spreadValues({}, scale["text-md"]), { fontWeight: "400" }),
527
+ bodyLarge: __spreadProps(__spreadValues({}, scale["text-lg"]), { fontWeight: "400" }),
528
+ bodySmall: __spreadProps(__spreadValues({}, scale["text-sm"]), { fontWeight: "400" }),
529
+ caption: __spreadProps(__spreadValues({}, scale["text-xs"]), { fontWeight: "400" }),
530
+ label: __spreadProps(__spreadValues({}, scale["text-sm"]), { fontWeight: "500" }),
531
+ overline: __spreadProps(__spreadValues({}, scale["text-xs"]), {
532
+ fontWeight: "600",
533
+ letterSpacing: "0.05em"
534
+ })
535
+ };
536
+ }
537
+ function round4(value, decimals = 4) {
538
+ const f = Math.pow(10, decimals);
539
+ return Math.round(value * f) / f;
540
+ }
541
+ // Annotate the CommonJS export names for ESM import in node:
542
+ 0 && (module.exports = {
543
+ BREAKPOINTS,
544
+ FONT_STACKS,
545
+ RATIOS,
546
+ buildFontFamily,
547
+ createFontStack,
548
+ createModularScale,
549
+ createTextStyle,
550
+ deriveTextPresets,
551
+ extendScale,
552
+ fluidScale,
553
+ fluidSize,
554
+ fluidStyle,
555
+ getStep,
556
+ listSteps,
557
+ measureRange,
558
+ mergeTextStyles,
559
+ monoStack,
560
+ optimalMeasure,
561
+ resolveAsScaleSteps,
562
+ resolveDisplayScale,
563
+ resolveFluidScale,
564
+ resolveTextScale,
565
+ resolveTypeScale,
566
+ resolveTypeStep,
567
+ responsiveStyle,
568
+ rhythmSpacing,
569
+ sansStack,
570
+ serifStack,
571
+ snapToBaseline,
572
+ sortedBreakpoints,
573
+ systemStack,
574
+ toCSSDeclarations,
575
+ toCSSProperties,
576
+ toCSSVars,
577
+ toTailwindClasses,
578
+ verticalRhythm
579
+ });
@@ -0,0 +1,63 @@
1
+ import { TextStyle, ScaleStep } from './index.cjs';
2
+ export { BREAKPOINTS, BaselineConfig, Breakpoints, FONT_STACKS, FluidConfig, FontStack, RATIOS, ResponsiveTextStyle, buildFontFamily, createFontStack, createModularScale, createTextStyle, extendScale, fluidScale, fluidSize, fluidStyle, getStep, listSteps, measureRange, mergeTextStyles, monoStack, optimalMeasure, responsiveStyle, rhythmSpacing, sansStack, serifStack, snapToBaseline, sortedBreakpoints, systemStack, toCSSDeclarations, toCSSProperties, toCSSVars, toTailwindClasses, verticalRhythm } from './index.cjs';
3
+
4
+ /**
5
+ * Resolve a single token type step to a `TextStyle`.
6
+ *
7
+ * @param name - Step name, e.g. `"display-2xl"`, `"text-md"`
8
+ * @returns TextStyle, or `undefined` if the step does not exist.
9
+ *
10
+ * @example
11
+ * resolveTypeStep("display-2xl")
12
+ * // → { fontSize: "4.5rem", lineHeight: "5.625rem", letterSpacing: "-0.02em" }
13
+ */
14
+ declare function resolveTypeStep(name: string): TextStyle | undefined;
15
+ /**
16
+ * Resolve the full token type scale to a `Record<string, TextStyle>`.
17
+ */
18
+ declare function resolveTypeScale(): Record<string, TextStyle>;
19
+ /**
20
+ * Resolve only the display steps (headings).
21
+ */
22
+ declare function resolveDisplayScale(): Record<string, TextStyle>;
23
+ /**
24
+ * Resolve only the text (body) steps.
25
+ */
26
+ declare function resolveTextScale(): Record<string, TextStyle>;
27
+ /**
28
+ * Resolve the token type scale as `ScaleStep` records (for use with
29
+ * `fluidScale`, `extendScale`, etc.).
30
+ */
31
+ declare function resolveAsScaleSteps(): Record<string, ScaleStep>;
32
+ /**
33
+ * Generate fluid versions of the token type scale.
34
+ *
35
+ * Multiplies each step's font size by `mobileMultiplier` to create
36
+ * a mobile scale, then generates `clamp()` styles between mobile
37
+ * and desktop.
38
+ *
39
+ * @param mobileMultiplier - Factor for mobile sizes (default 0.75)
40
+ * @param viewports - Optional min/max viewport widths
41
+ *
42
+ * @example
43
+ * resolveFluidScale(0.75)
44
+ * // display-2xl: clamp(3.375rem, ..., 4.5rem)
45
+ * // text-md: clamp(0.75rem, ..., 1rem)
46
+ */
47
+ declare function resolveFluidScale(mobileMultiplier?: number, viewports?: {
48
+ min?: number;
49
+ max?: number;
50
+ }): Record<string, TextStyle>;
51
+ /**
52
+ * Derive text presets from the token type scale at runtime.
53
+ *
54
+ * Maps common UI roles to token steps with appropriate font weights.
55
+ *
56
+ * @example
57
+ * const presets = deriveTextPresets();
58
+ * presets.heading1 // → display-2xl, weight 700
59
+ * presets.body // → text-md, weight 400
60
+ */
61
+ declare function deriveTextPresets(): Record<string, TextStyle>;
62
+
63
+ export { ScaleStep, TextStyle, deriveTextPresets, resolveAsScaleSteps, resolveDisplayScale, resolveFluidScale, resolveTextScale, resolveTypeScale, resolveTypeStep };
@@ -0,0 +1,63 @@
1
+ import { TextStyle, ScaleStep } from './index.js';
2
+ export { BREAKPOINTS, BaselineConfig, Breakpoints, FONT_STACKS, FluidConfig, FontStack, RATIOS, ResponsiveTextStyle, buildFontFamily, createFontStack, createModularScale, createTextStyle, extendScale, fluidScale, fluidSize, fluidStyle, getStep, listSteps, measureRange, mergeTextStyles, monoStack, optimalMeasure, responsiveStyle, rhythmSpacing, sansStack, serifStack, snapToBaseline, sortedBreakpoints, systemStack, toCSSDeclarations, toCSSProperties, toCSSVars, toTailwindClasses, verticalRhythm } from './index.js';
3
+
4
+ /**
5
+ * Resolve a single token type step to a `TextStyle`.
6
+ *
7
+ * @param name - Step name, e.g. `"display-2xl"`, `"text-md"`
8
+ * @returns TextStyle, or `undefined` if the step does not exist.
9
+ *
10
+ * @example
11
+ * resolveTypeStep("display-2xl")
12
+ * // → { fontSize: "4.5rem", lineHeight: "5.625rem", letterSpacing: "-0.02em" }
13
+ */
14
+ declare function resolveTypeStep(name: string): TextStyle | undefined;
15
+ /**
16
+ * Resolve the full token type scale to a `Record<string, TextStyle>`.
17
+ */
18
+ declare function resolveTypeScale(): Record<string, TextStyle>;
19
+ /**
20
+ * Resolve only the display steps (headings).
21
+ */
22
+ declare function resolveDisplayScale(): Record<string, TextStyle>;
23
+ /**
24
+ * Resolve only the text (body) steps.
25
+ */
26
+ declare function resolveTextScale(): Record<string, TextStyle>;
27
+ /**
28
+ * Resolve the token type scale as `ScaleStep` records (for use with
29
+ * `fluidScale`, `extendScale`, etc.).
30
+ */
31
+ declare function resolveAsScaleSteps(): Record<string, ScaleStep>;
32
+ /**
33
+ * Generate fluid versions of the token type scale.
34
+ *
35
+ * Multiplies each step's font size by `mobileMultiplier` to create
36
+ * a mobile scale, then generates `clamp()` styles between mobile
37
+ * and desktop.
38
+ *
39
+ * @param mobileMultiplier - Factor for mobile sizes (default 0.75)
40
+ * @param viewports - Optional min/max viewport widths
41
+ *
42
+ * @example
43
+ * resolveFluidScale(0.75)
44
+ * // display-2xl: clamp(3.375rem, ..., 4.5rem)
45
+ * // text-md: clamp(0.75rem, ..., 1rem)
46
+ */
47
+ declare function resolveFluidScale(mobileMultiplier?: number, viewports?: {
48
+ min?: number;
49
+ max?: number;
50
+ }): Record<string, TextStyle>;
51
+ /**
52
+ * Derive text presets from the token type scale at runtime.
53
+ *
54
+ * Maps common UI roles to token steps with appropriate font weights.
55
+ *
56
+ * @example
57
+ * const presets = deriveTextPresets();
58
+ * presets.heading1 // → display-2xl, weight 700
59
+ * presets.body // → text-md, weight 400
60
+ */
61
+ declare function deriveTextPresets(): Record<string, TextStyle>;
62
+
63
+ export { ScaleStep, TextStyle, deriveTextPresets, resolveAsScaleSteps, resolveDisplayScale, resolveFluidScale, resolveTextScale, resolveTypeScale, resolveTypeStep };