@octaviaflow/type 1.0.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.
Files changed (49) hide show
  1. package/README.md +239 -0
  2. package/es/index.js +850 -0
  3. package/index.scss +14 -0
  4. package/lib/index.js +922 -0
  5. package/package.json +59 -0
  6. package/scss/_classes.scss +42 -0
  7. package/scss/_default-type.scss +50 -0
  8. package/scss/_font-family.scss +105 -0
  9. package/scss/_prefix.scss +28 -0
  10. package/scss/_reset.scss +42 -0
  11. package/scss/_scale.scss +58 -0
  12. package/scss/_styles.scss +902 -0
  13. package/src/__tests__/__snapshots__/fontFamily-test.js.snap +13 -0
  14. package/src/__tests__/__snapshots__/fontFamily.test.js.snap +13 -0
  15. package/src/__tests__/__snapshots__/fontWeight-test.js.snap +11 -0
  16. package/src/__tests__/__snapshots__/fontWeight.test.js.snap +11 -0
  17. package/src/__tests__/__snapshots__/reset-test.js.snap +11 -0
  18. package/src/__tests__/__snapshots__/reset.test.js.snap +11 -0
  19. package/src/__tests__/__snapshots__/scale-test.js.snap +29 -0
  20. package/src/__tests__/__snapshots__/scale.test.js.snap +29 -0
  21. package/src/__tests__/__snapshots__/styles-test.js.snap +411 -0
  22. package/src/__tests__/__snapshots__/styles.test.js.snap +411 -0
  23. package/src/__tests__/exports-test.js +88 -0
  24. package/src/__tests__/exports.test.js +88 -0
  25. package/src/__tests__/fluid-test.js +71 -0
  26. package/src/__tests__/fluid.test.js +71 -0
  27. package/src/__tests__/fontFamily-test.js +33 -0
  28. package/src/__tests__/fontFamily.test.js +33 -0
  29. package/src/__tests__/fontWeight-test.js +33 -0
  30. package/src/__tests__/fontWeight.test.js +33 -0
  31. package/src/__tests__/reset-test.js +23 -0
  32. package/src/__tests__/reset.test.js +23 -0
  33. package/src/__tests__/scale-test.js +31 -0
  34. package/src/__tests__/scale.test.js +31 -0
  35. package/src/__tests__/styles-test.js +18 -0
  36. package/src/__tests__/styles.test.js +18 -0
  37. package/src/__tests__/tokens-test.js +21 -0
  38. package/src/__tests__/tokens.test.js +21 -0
  39. package/src/fluid.js +89 -0
  40. package/src/fontFamily.js +33 -0
  41. package/src/fontWeight.js +27 -0
  42. package/src/index.js +31 -0
  43. package/src/print.js +39 -0
  44. package/src/reset.js +32 -0
  45. package/src/scale.js +33 -0
  46. package/src/styles.js +491 -0
  47. package/src/tokens.js +132 -0
  48. package/telemetry.yml +16 -0
  49. package/umd/index.js +926 -0
@@ -0,0 +1,902 @@
1
+ //
2
+ // Copyright OctaviaFlow. 2025
3
+ //
4
+ // This source code is licensed under the Apache-2.0 license found in the
5
+ // LICENSE file in the root directory of this source tree.
6
+ //
7
+
8
+ // stylelint-disable number-max-precision
9
+
10
+ @use 'sass:map';
11
+ @use 'sass:math';
12
+ @use '@octaviaflow/grid/scss/config' as gridconfig;
13
+ @use '@octaviaflow/grid/scss/breakpoint' as grid;
14
+ @use 'prefix' as *;
15
+ @use 'font-family';
16
+ @use 'scale';
17
+
18
+ /// @type Map
19
+ /// @access public
20
+ /// @deprecated
21
+ /// @group @octaviaflow/type
22
+ $caption-01: (
23
+ font-size: scale.type-scale(1),
24
+ font-weight: font-family.font-weight('regular'),
25
+ line-height: 1.33333,
26
+ letter-spacing: 0.32px,
27
+ ) !default;
28
+
29
+ /// @type Map
30
+ /// @access public
31
+ /// @deprecated
32
+ /// @group @octaviaflow/type
33
+ $caption-02: (
34
+ font-size: scale.type-scale(2),
35
+ font-weight: font-family.font-weight('regular'),
36
+ line-height: 1.28572,
37
+ letter-spacing: 0.32px,
38
+ ) !default;
39
+
40
+ /// @type Map
41
+ /// @access public
42
+ /// @group @octaviaflow/type
43
+ $label-01: (
44
+ font-size: scale.type-scale(1),
45
+ font-weight: font-family.font-weight('regular'),
46
+ line-height: 1.33333,
47
+ letter-spacing: 0.32px,
48
+ ) !default;
49
+
50
+ /// @type Map
51
+ /// @access public
52
+ /// @group @octaviaflow/type
53
+ $label-02: (
54
+ font-size: scale.type-scale(2),
55
+ font-weight: font-family.font-weight('regular'),
56
+ line-height: 1.28572,
57
+ letter-spacing: 0.16px,
58
+ ) !default;
59
+
60
+ /// @type Map
61
+ /// @access public
62
+ /// @group @octaviaflow/type
63
+ $legal-01: (
64
+ font-size: scale.type-scale(1),
65
+ font-weight: font-family.font-weight('regular'),
66
+ line-height: 1.33333,
67
+ letter-spacing: 0.32px,
68
+ ) !default;
69
+
70
+ /// @type Map
71
+ /// @access public
72
+ /// @group @octaviaflow/type
73
+ $legal-02: (
74
+ font-size: scale.type-scale(2),
75
+ font-weight: font-family.font-weight('regular'),
76
+ line-height: 1.28572,
77
+ letter-spacing: 0.16px,
78
+ ) !default;
79
+
80
+ /// @type Map
81
+ /// @access public
82
+ /// @deprecated
83
+ /// @group @octaviaflow/type
84
+ $helper-text-01: (
85
+ font-size: scale.type-scale(1),
86
+ line-height: 1.33333,
87
+ letter-spacing: 0.32px,
88
+ ) !default;
89
+
90
+ /// @type Map
91
+ /// @access public
92
+ /// @deprecated
93
+ /// @group @octaviaflow/type
94
+ $helper-text-02: (
95
+ font-size: scale.type-scale(2),
96
+ font-weight: font-family.font-weight('regular'),
97
+ line-height: 1.28572,
98
+ letter-spacing: 0.16px,
99
+ ) !default;
100
+
101
+ /// @type Map
102
+ /// @access public
103
+ /// @group @octaviaflow/type
104
+ $body-short-01: (
105
+ font-size: scale.type-scale(2),
106
+ font-weight: font-family.font-weight('regular'),
107
+ line-height: 1.28572,
108
+ letter-spacing: 0.16px,
109
+ ) !default;
110
+
111
+ /// @type Map
112
+ /// @access public
113
+ /// @group @octaviaflow/type
114
+ $body-compact-01: $body-short-01 !default;
115
+
116
+ /// @type Map
117
+ /// @access public
118
+ /// @group @octaviaflow/type
119
+ $body-long-01: (
120
+ font-size: scale.type-scale(2),
121
+ font-weight: font-family.font-weight('regular'),
122
+ line-height: 1.42857,
123
+ letter-spacing: 0.16px,
124
+ ) !default;
125
+
126
+ /// @type Map
127
+ /// @access public
128
+ /// @group @octaviaflow/type
129
+ $body-01: $body-long-01 !default;
130
+
131
+ /// @type Map
132
+ /// @access public
133
+ /// @group @octaviaflow/type
134
+ $body-short-02: (
135
+ font-size: scale.type-scale(3),
136
+ font-weight: font-family.font-weight('regular'),
137
+ line-height: 1.375,
138
+ letter-spacing: 0,
139
+ ) !default;
140
+
141
+ /// @type Map
142
+ /// @access public
143
+ /// @group @octaviaflow/type
144
+ $body-compact-02: $body-short-02 !default;
145
+
146
+ /// @type Map
147
+ /// @access public
148
+ /// @group @octaviaflow/type
149
+ $body-long-02: (
150
+ font-size: scale.type-scale(3),
151
+ font-weight: font-family.font-weight('regular'),
152
+ line-height: 1.5,
153
+ letter-spacing: 0,
154
+ ) !default;
155
+
156
+ /// @type Map
157
+ /// @access public
158
+ /// @group @octaviaflow/type
159
+ $body-02: $body-long-02 !default;
160
+
161
+ /// @type Map
162
+ /// @access public
163
+ /// @group @octaviaflow/type
164
+ $code-01: (
165
+ font-family: font-family.font-family('mono'),
166
+ font-size: scale.type-scale(1),
167
+ font-weight: font-family.font-weight('regular'),
168
+ line-height: 1.33333,
169
+ letter-spacing: 0.32px,
170
+ ) !default;
171
+
172
+ /// @type Map
173
+ /// @access public
174
+ /// @group @octaviaflow/type
175
+ $code-02: (
176
+ font-family: font-family.font-family('mono'),
177
+ font-size: scale.type-scale(2),
178
+ font-weight: font-family.font-weight('regular'),
179
+ line-height: 1.42857,
180
+ letter-spacing: 0.32px,
181
+ ) !default;
182
+
183
+ /// @type Map
184
+ /// @access public
185
+ /// @group @octaviaflow/type
186
+ $heading-01: (
187
+ font-size: scale.type-scale(2),
188
+ font-weight: font-family.font-weight('semibold'),
189
+ line-height: 1.42857,
190
+ letter-spacing: 0.16px,
191
+ ) !default;
192
+
193
+ /// @type Map
194
+ /// @access public
195
+ /// @group @octaviaflow/type
196
+ $productive-heading-01: (
197
+ font-size: scale.type-scale(2),
198
+ font-weight: font-family.font-weight('semibold'),
199
+ line-height: 1.28572,
200
+ letter-spacing: 0.16px,
201
+ ) !default;
202
+
203
+ /// @type Map
204
+ /// @access public
205
+ /// @group @octaviaflow/type
206
+ $heading-compact-01: $productive-heading-01 !default;
207
+
208
+ /// @type Map
209
+ /// @access public
210
+ /// @group @octaviaflow/type
211
+ $heading-02: (
212
+ font-size: scale.type-scale(3),
213
+ font-weight: font-family.font-weight('semibold'),
214
+ line-height: 1.5,
215
+ letter-spacing: 0,
216
+ ) !default;
217
+
218
+ /// @type Map
219
+ /// @access public
220
+ /// @group @octaviaflow/type
221
+ $productive-heading-02: (
222
+ font-size: scale.type-scale(3),
223
+ font-weight: font-family.font-weight('semibold'),
224
+ line-height: 1.375,
225
+ letter-spacing: 0,
226
+ ) !default;
227
+
228
+ /// @type Map
229
+ /// @access public
230
+ /// @group @octaviaflow/type
231
+ $heading-compact-02: $productive-heading-02 !default;
232
+
233
+ /// @type Map
234
+ /// @access public
235
+ /// @group @octaviaflow/type
236
+ $productive-heading-03: (
237
+ font-size: scale.type-scale(5),
238
+ font-weight: font-family.font-weight('regular'),
239
+ line-height: 1.4,
240
+ letter-spacing: 0,
241
+ ) !default;
242
+
243
+ /// @type Map
244
+ /// @access public
245
+ /// @group @octaviaflow/type
246
+ $heading-03: $productive-heading-03 !default;
247
+
248
+ /// @type Map
249
+ /// @access public
250
+ /// @group @octaviaflow/type
251
+ $productive-heading-04: (
252
+ font-size: scale.type-scale(7),
253
+ font-weight: font-family.font-weight('regular'),
254
+ line-height: 1.28572,
255
+ letter-spacing: 0,
256
+ ) !default;
257
+
258
+ /// @type Map
259
+ /// @access public
260
+ /// @group @octaviaflow/type
261
+ $heading-04: $productive-heading-04 !default;
262
+
263
+ /// @type Map
264
+ /// @access public
265
+ /// @group @octaviaflow/type
266
+ $productive-heading-05: (
267
+ font-size: scale.type-scale(8),
268
+ font-weight: font-family.font-weight('regular'),
269
+ line-height: 1.25,
270
+ letter-spacing: 0,
271
+ ) !default;
272
+
273
+ /// @type Map
274
+ /// @access public
275
+ /// @group @octaviaflow/type
276
+ $heading-05: $productive-heading-05 !default;
277
+
278
+ /// @type Map
279
+ /// @access public
280
+ /// @group @octaviaflow/type
281
+ $productive-heading-06: (
282
+ font-size: scale.type-scale(10),
283
+ font-weight: font-family.font-weight('light'),
284
+ // Extra digit needed for precision in Chrome
285
+ line-height: 1.199,
286
+ letter-spacing: 0,
287
+ ) !default;
288
+
289
+ /// @type Map
290
+ /// @access public
291
+ /// @group @octaviaflow/type
292
+ $heading-06: $productive-heading-06 !default;
293
+
294
+ /// @type Map
295
+ /// @access public
296
+ /// @group @octaviaflow/type
297
+ $productive-heading-07: (
298
+ font-size: scale.type-scale(12),
299
+ font-weight: font-family.font-weight('light'),
300
+ line-height: 1.19,
301
+ letter-spacing: 0,
302
+ ) !default;
303
+
304
+ /// @type Map
305
+ /// @access public
306
+ /// @group @octaviaflow/type
307
+ $heading-07: $productive-heading-07 !default;
308
+
309
+ /// @type Map
310
+ /// @access public
311
+ /// @group @octaviaflow/type
312
+ $expressive-heading-01: $heading-01 !default;
313
+
314
+ /// @type Map
315
+ /// @access public
316
+ /// @group @octaviaflow/type
317
+ $expressive-heading-02: $heading-02 !default;
318
+
319
+ /// @type Map
320
+ /// @access public
321
+ /// @group @octaviaflow/type
322
+ $expressive-heading-03: (
323
+ font-size: scale.type-scale(5),
324
+ font-weight: font-family.font-weight('regular'),
325
+ line-height: 1.4,
326
+ letter-spacing: 0,
327
+ breakpoints: (
328
+ xlg: (
329
+ font-size: scale.type-scale(5),
330
+ line-height: 1.4,
331
+ ),
332
+ max: (
333
+ font-size: scale.type-scale(6),
334
+ line-height: 1.334,
335
+ ),
336
+ ),
337
+ ) !default;
338
+
339
+ /// @type Map
340
+ /// @access public
341
+ /// @group @octaviaflow/type
342
+ $fluid-heading-03: $expressive-heading-03 !default;
343
+
344
+ /// @type Map
345
+ /// @access public
346
+ /// @group @octaviaflow/type
347
+ $expressive-heading-04: (
348
+ font-size: scale.type-scale(7),
349
+ font-weight: font-family.font-weight('regular'),
350
+ line-height: 1.28572,
351
+ letter-spacing: 0,
352
+ breakpoints: (
353
+ xlg: (
354
+ font-size: scale.type-scale(8),
355
+ line-height: 1.25,
356
+ font-weight: font-family.font-weight('regular'),
357
+ ),
358
+ max: (
359
+ font-size: scale.type-scale(8),
360
+ font-weight: font-family.font-weight('regular'),
361
+ ),
362
+ ),
363
+ ) !default;
364
+
365
+ /// @type Map
366
+ /// @access public
367
+ /// @group @octaviaflow/type
368
+ $fluid-heading-04: $expressive-heading-04 !default;
369
+
370
+ /// @type Map
371
+ /// @access public
372
+ /// @group @octaviaflow/type
373
+ $expressive-heading-05: (
374
+ font-size: scale.type-scale(8),
375
+ font-weight: font-family.font-weight('regular'),
376
+ line-height: 1.25,
377
+ letter-spacing: 0,
378
+ breakpoints: (
379
+ md: (
380
+ font-size: scale.type-scale(9),
381
+ font-weight: font-family.font-weight('light'),
382
+ line-height: 1.22,
383
+ ),
384
+ lg: (
385
+ font-size: scale.type-scale(10),
386
+ line-height: 1.19,
387
+ ),
388
+ xlg: (
389
+ font-size: scale.type-scale(11),
390
+ line-height: 1.17,
391
+ ),
392
+ max: (
393
+ font-size: scale.type-scale(13),
394
+ ),
395
+ ),
396
+ ) !default;
397
+
398
+ /// @type Map
399
+ /// @access public
400
+ /// @group @octaviaflow/type
401
+ $fluid-heading-05: $expressive-heading-05 !default;
402
+
403
+ /// @type Map
404
+ /// @access public
405
+ /// @group @octaviaflow/type
406
+ $expressive-heading-06: (
407
+ font-size: scale.type-scale(8),
408
+ font-weight: font-family.font-weight('semibold'),
409
+ line-height: 1.25,
410
+ letter-spacing: 0,
411
+ breakpoints: (
412
+ md: (
413
+ font-size: scale.type-scale(9),
414
+ line-height: 1.22,
415
+ ),
416
+ lg: (
417
+ font-size: scale.type-scale(10),
418
+ line-height: 1.19,
419
+ ),
420
+ xlg: (
421
+ font-size: scale.type-scale(11),
422
+ line-height: 1.17,
423
+ ),
424
+ max: (
425
+ font-size: scale.type-scale(13),
426
+ ),
427
+ ),
428
+ ) !default;
429
+
430
+ /// @type Map
431
+ /// @access public
432
+ /// @group @octaviaflow/type
433
+ $fluid-heading-06: $expressive-heading-06 !default;
434
+
435
+ /// @type Map
436
+ /// @access public
437
+ /// @group @octaviaflow/type
438
+ $expressive-paragraph-01: (
439
+ font-size: scale.type-scale(6),
440
+ font-weight: font-family.font-weight('light'),
441
+ line-height: 1.334,
442
+ letter-spacing: 0,
443
+ breakpoints: (
444
+ lg: (
445
+ font-size: scale.type-scale(7),
446
+ line-height: 1.28572,
447
+ ),
448
+ max: (
449
+ font-size: scale.type-scale(8),
450
+ line-height: 1.25,
451
+ ),
452
+ ),
453
+ );
454
+
455
+ /// @type Map
456
+ /// @access public
457
+ /// @group @octaviaflow/type
458
+ $fluid-paragraph-01: $expressive-paragraph-01 !default;
459
+
460
+ /// @type Map
461
+ /// @access public
462
+ /// @group @octaviaflow/type
463
+ $quotation-01: (
464
+ font-family: font-family.font-family('serif'),
465
+ font-size: scale.type-scale(5),
466
+ font-weight: font-family.font-weight('regular'),
467
+ line-height: 1.3,
468
+ letter-spacing: 0,
469
+ breakpoints: (
470
+ md: (
471
+ font-size: scale.type-scale(5),
472
+ ),
473
+ lg: (
474
+ font-size: scale.type-scale(6),
475
+ line-height: 1.334,
476
+ ),
477
+ xlg: (
478
+ font-size: scale.type-scale(7),
479
+ line-height: 1.28572,
480
+ ),
481
+ max: (
482
+ font-size: scale.type-scale(8),
483
+ line-height: 1.25,
484
+ ),
485
+ ),
486
+ ) !default;
487
+
488
+ /// @type Map
489
+ /// @access public
490
+ /// @group @octaviaflow/type
491
+ $fluid-quotation-01: $quotation-01 !default;
492
+
493
+ /// @type Map
494
+ /// @access public
495
+ /// @group @octaviaflow/type
496
+ $quotation-02: (
497
+ font-family: font-family.font-family('serif'),
498
+ font-size: scale.type-scale(8),
499
+ font-weight: font-family.font-weight('light'),
500
+ line-height: 1.25,
501
+ letter-spacing: 0,
502
+ breakpoints: (
503
+ md: (
504
+ font-size: scale.type-scale(9),
505
+ line-height: 1.22,
506
+ ),
507
+ lg: (
508
+ font-size: scale.type-scale(10),
509
+ line-height: 1.19,
510
+ ),
511
+ xlg: (
512
+ font-size: scale.type-scale(11),
513
+ line-height: 1.17,
514
+ ),
515
+ max: (
516
+ font-size: scale.type-scale(13),
517
+ ),
518
+ ),
519
+ ) !default;
520
+
521
+ /// @type Map
522
+ /// @access public
523
+ /// @group @octaviaflow/type
524
+ $fluid-quotation-02: $quotation-02 !default;
525
+
526
+ /// @type Map
527
+ /// @access public
528
+ /// @group @octaviaflow/type
529
+ $display-01: (
530
+ font-size: scale.type-scale(10),
531
+ font-weight: font-family.font-weight('light'),
532
+ line-height: 1.19,
533
+ letter-spacing: 0,
534
+ breakpoints: (
535
+ md: (
536
+ font-size: scale.type-scale(10),
537
+ ),
538
+ lg: (
539
+ font-size: scale.type-scale(12),
540
+ ),
541
+ xlg: (
542
+ font-size: scale.type-scale(13),
543
+ line-height: 1.17,
544
+ ),
545
+ max: (
546
+ font-size: scale.type-scale(15),
547
+ line-height: 1.13,
548
+ ),
549
+ ),
550
+ ) !default;
551
+
552
+ /// @type Map
553
+ /// @access public
554
+ /// @group @octaviaflow/type
555
+ $fluid-display-01: $display-01 !default;
556
+
557
+ /// @type Map
558
+ /// @access public
559
+ /// @group @octaviaflow/type
560
+ $display-02: (
561
+ font-size: scale.type-scale(10),
562
+ font-weight: font-family.font-weight('semibold'),
563
+ line-height: 1.19,
564
+ letter-spacing: 0,
565
+ breakpoints: (
566
+ md: (
567
+ font-size: scale.type-scale(10),
568
+ ),
569
+ lg: (
570
+ font-size: scale.type-scale(12),
571
+ ),
572
+ xlg: (
573
+ font-size: scale.type-scale(13),
574
+ line-height: 1.16,
575
+ ),
576
+ max: (
577
+ font-size: scale.type-scale(15),
578
+ line-height: 1.13,
579
+ ),
580
+ ),
581
+ ) !default;
582
+
583
+ /// @type Map
584
+ /// @access public
585
+ /// @group @octaviaflow/type
586
+ $fluid-display-02: $display-02 !default;
587
+
588
+ /// @type Map
589
+ /// @access public
590
+ /// @group @octaviaflow/type
591
+ $display-03: (
592
+ font-size: scale.type-scale(10),
593
+ font-weight: font-family.font-weight('light'),
594
+ line-height: 1.19,
595
+ letter-spacing: 0,
596
+ breakpoints: (
597
+ md: (
598
+ font-size: scale.type-scale(12),
599
+ line-height: 1.18,
600
+ ),
601
+ lg: (
602
+ font-size: scale.type-scale(13),
603
+ line-height: 1.16,
604
+ letter-spacing: -0.64px,
605
+ ),
606
+ xlg: (
607
+ font-size: scale.type-scale(15),
608
+ line-height: 1.13,
609
+ letter-spacing: -0.64px,
610
+ ),
611
+ max: (
612
+ font-size: scale.type-scale(16),
613
+ line-height: 1.11,
614
+ letter-spacing: -0.96px,
615
+ ),
616
+ ),
617
+ ) !default;
618
+
619
+ /// @type Map
620
+ /// @access public
621
+ /// @group @octaviaflow/type
622
+ $fluid-display-03: $display-03 !default;
623
+
624
+ /// @type Map
625
+ /// @access public
626
+ /// @group @octaviaflow/type
627
+ $display-04: (
628
+ font-size: scale.type-scale(10),
629
+ font-weight: font-family.font-weight('light'),
630
+ line-height: 1.19,
631
+ letter-spacing: 0,
632
+ breakpoints: (
633
+ md: (
634
+ font-size: scale.type-scale(14),
635
+ line-height: 1.15,
636
+ ),
637
+ lg: (
638
+ font-size: scale.type-scale(17),
639
+ line-height: 1.11,
640
+ letter-spacing: -0.64px,
641
+ ),
642
+ xlg: (
643
+ font-size: scale.type-scale(20),
644
+ line-height: 1.07,
645
+ letter-spacing: -0.64px,
646
+ ),
647
+ max: (
648
+ font-size: scale.type-scale(23),
649
+ line-height: 1.05,
650
+ letter-spacing: -0.96px,
651
+ ),
652
+ ),
653
+ ) !default;
654
+
655
+ /// @type Map
656
+ /// @access public
657
+ /// @group @octaviaflow/type
658
+ $fluid-display-04: $display-04 !default;
659
+
660
+ /// @type Map
661
+ /// @access public
662
+ /// @group @octaviaflow/type
663
+ $tokens: (
664
+ caption-01: $caption-01,
665
+ caption-02: $caption-02,
666
+ label-01: $label-01,
667
+ label-02: $label-02,
668
+ helper-text-01: $helper-text-01,
669
+ helper-text-02: $helper-text-02,
670
+ body-short-01: $body-short-01,
671
+ body-short-02: $body-short-02,
672
+ body-long-01: $body-long-01,
673
+ body-long-02: $body-long-02,
674
+ code-01: $code-01,
675
+ code-02: $code-02,
676
+ heading-01: $heading-01,
677
+ heading-02: $heading-02,
678
+ productive-heading-01: $productive-heading-01,
679
+ productive-heading-02: $productive-heading-02,
680
+ productive-heading-03: $productive-heading-03,
681
+ productive-heading-04: $productive-heading-04,
682
+ productive-heading-05: $productive-heading-05,
683
+ productive-heading-06: $productive-heading-06,
684
+ productive-heading-07: $productive-heading-07,
685
+ expressive-paragraph-01: $expressive-paragraph-01,
686
+ expressive-heading-01: $expressive-heading-01,
687
+ expressive-heading-02: $expressive-heading-02,
688
+ expressive-heading-03: $expressive-heading-03,
689
+ expressive-heading-04: $expressive-heading-04,
690
+ expressive-heading-05: $expressive-heading-05,
691
+ expressive-heading-06: $expressive-heading-06,
692
+ quotation-01: $quotation-01,
693
+ quotation-02: $quotation-02,
694
+ display-01: $display-01,
695
+ display-02: $display-02,
696
+ display-03: $display-03,
697
+ display-04: $display-04,
698
+ // V11 Tokens
699
+ legal-01: $legal-01,
700
+ legal-02: $legal-02,
701
+ body-compact-01: $body-compact-01,
702
+ body-compact-02: $body-compact-02,
703
+ heading-compact-01: $heading-compact-01,
704
+ heading-compact-02: $heading-compact-02,
705
+ body-01: $body-01,
706
+ body-02: $body-02,
707
+ heading-03: $heading-03,
708
+ heading-04: $heading-04,
709
+ heading-05: $heading-05,
710
+ heading-06: $heading-06,
711
+ heading-07: $heading-07,
712
+ fluid-heading-03: $fluid-heading-03,
713
+ fluid-heading-04: $fluid-heading-04,
714
+ fluid-heading-05: $fluid-heading-05,
715
+ fluid-heading-06: $fluid-heading-06,
716
+ fluid-paragraph-01: $fluid-paragraph-01,
717
+ fluid-quotation-01: $fluid-quotation-01,
718
+ fluid-quotation-02: $fluid-quotation-02,
719
+ fluid-display-01: $fluid-display-01,
720
+ fluid-display-02: $fluid-display-02,
721
+ fluid-display-03: $fluid-display-03,
722
+ fluid-display-04: $fluid-display-04,
723
+ ) !default;
724
+
725
+ /// @param {Map} $map
726
+ /// @access public
727
+ /// @group @octaviaflow/type
728
+ @mixin properties($map) {
729
+ @each $name, $value in $map {
730
+ #{$name}: $value;
731
+ }
732
+ }
733
+
734
+ /// @param {Number} $value - Number with units
735
+ /// @return {Number} Without units
736
+ /// @access public
737
+ /// @group @octaviaflow/type
738
+ @function strip-unit($value) {
739
+ @return math.div($value, $value * 0 + 1);
740
+ }
741
+
742
+ /// This helper includes fluid type styles for the given token value. Fluid type
743
+ /// means that the `font-size` is computed using `calc()` in order to be
744
+ /// determined by the screen size instead of a breakpoint. As a result, fluid
745
+ /// styles should be used with caution in fixed width contexts.
746
+ ///
747
+ /// In addition, we make use of %-based line-heights so that the line-height of
748
+ /// each type style is computed correctly due to the dynamic nature of the
749
+ /// `font-size`.
750
+ ///
751
+ /// Most of the logic for this work comes from CSS Tricks:
752
+ /// https://css-tricks.com/snippets/css/fluid-typography/
753
+ ///
754
+ /// @param {Map} $type-styles - The value of a given type token
755
+ /// @param {Map} $breakpoints [$grid-breakpoints] - Custom breakpoints to use
756
+ /// @access public
757
+ /// @group @octaviaflow/type
758
+ @mixin fluid-type($type-styles, $breakpoints: gridconfig.$grid-breakpoints) {
759
+ // Include the initial styles for the given token by default without any
760
+ // media query guard. This includes `font-size` as a fallback in the case
761
+ // that a browser does not support `calc()`
762
+ @include properties(map.remove($type-styles, breakpoints));
763
+ // We also need to include the `sm` styles by default since they don't
764
+ // appear in the fluid styles for tokens
765
+ @include fluid-type-size($type-styles, sm, $breakpoints);
766
+
767
+ // Finally, we need to go through all the breakpoints defined in the type
768
+ // token and apply the properties and fluid type size for that given
769
+ // breakpoint
770
+ @each $name, $values in map.get($type-styles, breakpoints) {
771
+ @include grid.breakpoint($name) {
772
+ @include properties($values);
773
+ @include fluid-type-size($type-styles, $name, $breakpoints);
774
+ }
775
+ }
776
+ }
777
+
778
+ /// Computes the fluid `font-size` for a given type style and breakpoint
779
+ /// @param {Map} $type-styles - The styles for a given token
780
+ /// @param {String} $name - The name of the breakpoint to which we apply the fluid
781
+ /// @param {Map} $breakpoints [$grid-breakpoints] - The breakpoints for the grid system
782
+ /// @access public
783
+ /// @group @octaviaflow/type
784
+ @mixin fluid-type-size(
785
+ $type-styles,
786
+ $name,
787
+ $breakpoints: gridconfig.$grid-breakpoints
788
+ ) {
789
+ // Get the information about the breakpoint we're currently working in. Useful
790
+ // for getting initial width information
791
+ $breakpoint: map.get($breakpoints, $name);
792
+
793
+ // Our fluid styles are captured under the 'breakpoints' property in our type
794
+ // styles map. These define what values to treat as `max-` variables below
795
+ $fluid-sizes: map.get($type-styles, breakpoints);
796
+ $fluid-breakpoint: ();
797
+ // Special case for `sm` because the styles for small are on the type style
798
+ // directly
799
+ @if $name == sm {
800
+ $fluid-breakpoint: map.remove($type-styles, breakpoints);
801
+ } @else {
802
+ $fluid-breakpoint: map.get($fluid-sizes, $name);
803
+ }
804
+
805
+ // Initialize our font-sizes to the default size for the type style
806
+ $max-font-size: map.get($type-styles, font-size);
807
+ $min-font-size: map.get($type-styles, font-size);
808
+ @if map.has-key($fluid-breakpoint, font-size) {
809
+ $min-font-size: map.get($fluid-breakpoint, font-size);
810
+ }
811
+
812
+ // Initialize our min and max width to the width of the current breakpoint
813
+ $max-vw: map.get($breakpoint, width);
814
+ $min-vw: map.get($breakpoint, width);
815
+
816
+ // We can use `breakpoint-next` to see if there is another breakpoint we can
817
+ // use to update `max-font-size` and `max-vw` with larger values
818
+ $next-breakpoint-available: grid.breakpoint-next($name, $breakpoints);
819
+ $next-fluid-breakpoint-name: null;
820
+
821
+ // We need to figure out what the next available fluid breakpoint is for our
822
+ // given $type-styles. In this loop we try and iterate through breakpoints
823
+ // until we either manually set $next-breakpoint-available to null or
824
+ // `breakpoint-next` returns null.
825
+ @while $next-breakpoint-available {
826
+ @if map.has-key($fluid-sizes, $next-breakpoint-available) {
827
+ $next-fluid-breakpoint-name: $next-breakpoint-available;
828
+ $next-breakpoint-available: null;
829
+ } @else {
830
+ $next-breakpoint-available: grid.breakpoint-next(
831
+ $next-breakpoint-available,
832
+ $breakpoints
833
+ );
834
+ }
835
+ }
836
+
837
+ // If we have found the next available fluid breakpoint name, then we know
838
+ // that we have values that we can use to set max-font-size and max-vw as both
839
+ // values derive from the next breakpoint
840
+ @if $next-fluid-breakpoint-name {
841
+ $next-fluid-breakpoint: map.get($breakpoints, $next-fluid-breakpoint-name);
842
+ $max-font-size: map.get(
843
+ map.get($fluid-sizes, $next-fluid-breakpoint-name),
844
+ font-size
845
+ );
846
+ $max-vw: map.get($next-fluid-breakpoint, width);
847
+
848
+ // prettier-ignore
849
+ font-size: calc(#{$min-font-size} +
850
+ #{strip-unit($max-font-size - $min-font-size)} *
851
+ ((100vw - #{$min-vw}) / #{strip-unit($max-vw - $min-vw)})
852
+ );
853
+ } @else {
854
+ // Otherwise, just default to setting the font size found from the type
855
+ // style or the given fluid breakpoint in the type style
856
+ font-size: $min-font-size;
857
+ }
858
+ }
859
+
860
+ // TODO move following variable and `custom-property` mixin into shared file for
861
+ // both `@octaviaflow/type` and `@octaviaflow/themes`
862
+
863
+ /// @access private
864
+ /// @group @octaviaflow/type
865
+ @mixin custom-properties($name, $value) {
866
+ @each $property, $value in $value {
867
+ #{$property}: var(
868
+ --#{$custom-property-prefix}-#{$name}-#{$property},
869
+ #{$value}
870
+ );
871
+ }
872
+ }
873
+
874
+ /// Helper mixin to include the styles for a given token in any selector in your
875
+ /// project. Also includes an optional fluid option that will enable fluid
876
+ /// styles for the token if they are defined. Fluid styles will cause the
877
+ /// token's font-size to be computed based on the viewport size. As a result, use
878
+ /// with caution in fixed contexts.
879
+ /// @param {String} $name - The name of the token to get the styles for
880
+ /// @param {Boolean} $fluid [false] - Specify whether to include fluid styles for the
881
+ /// @param {Map} $breakpoints [$grid-breakpoints] - Provide a custom breakpoint map to use
882
+ /// @access public
883
+ /// @group @octaviaflow/type
884
+ @mixin type-style(
885
+ $name,
886
+ $fluid: false,
887
+ $breakpoints: gridconfig.$grid-breakpoints
888
+ ) {
889
+ @if not map.has-key($tokens, $name) {
890
+ @error 'Unable to find a token with the name: `#{$name}`';
891
+ }
892
+
893
+ $token: map.get($tokens, $name);
894
+
895
+ // If $fluid is set to true and the token has breakpoints defined for fluid
896
+ // styles, delegate to the fluid-type helper for the given token
897
+ @if $fluid == true and map.has-key($token, 'breakpoints') {
898
+ @include fluid-type($token, $breakpoints);
899
+ } @else {
900
+ @include custom-properties($name, $token);
901
+ }
902
+ }