@edwinvakayil/calligraphy 1.0.0 → 1.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.
- package/README.md +100 -45
- package/dist/animation.d.ts +13 -0
- package/dist/index.d.ts +36 -3
- package/dist/index.esm.js +185 -8
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +185 -8
- package/dist/index.js.map +1 -1
- package/dist/types.d.ts +35 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
# react-type-scale
|
|
2
2
|
|
|
3
|
-
A lightweight **React + TypeScript** typography component with automatic **Google Fonts** support
|
|
4
|
-
Define your text style with two props: `variant` for scale, `font` for the typeface.
|
|
3
|
+
A lightweight **React + TypeScript** typography component with automatic **Google Fonts** support, **hero entrance animations**, and an **italic accent toggle**.
|
|
5
4
|
|
|
6
5
|
---
|
|
7
6
|
|
|
8
7
|
## Install
|
|
9
8
|
|
|
10
9
|
```bash
|
|
11
|
-
npm install
|
|
10
|
+
npm install @edwinvakayil/calligraphy
|
|
12
11
|
# or
|
|
13
|
-
yarn add
|
|
12
|
+
yarn add @edwinvakayil/calligraphy
|
|
14
13
|
```
|
|
15
14
|
|
|
16
15
|
---
|
|
@@ -18,20 +17,20 @@ yarn add react-type-scale
|
|
|
18
17
|
## Quick Start
|
|
19
18
|
|
|
20
19
|
```tsx
|
|
21
|
-
import { Typography } from "
|
|
20
|
+
import { Typography } from "@edwinvakayil/calligraphy";
|
|
22
21
|
|
|
23
22
|
export default function App() {
|
|
24
23
|
return (
|
|
25
24
|
<div>
|
|
26
|
-
<Typography variant="Display" font="
|
|
27
|
-
|
|
25
|
+
<Typography variant="Display" font="Bricolage Grotesque" animation="rise">
|
|
26
|
+
Design with <em>intention</em>
|
|
28
27
|
</Typography>
|
|
29
28
|
|
|
30
29
|
<Typography variant="H1" font="Syne">
|
|
31
30
|
Page Title
|
|
32
31
|
</Typography>
|
|
33
32
|
|
|
34
|
-
<Typography variant="Body" font="
|
|
33
|
+
<Typography variant="Body" font="DM Sans">
|
|
35
34
|
Regular body copy goes here.
|
|
36
35
|
</Typography>
|
|
37
36
|
</div>
|
|
@@ -39,7 +38,7 @@ export default function App() {
|
|
|
39
38
|
}
|
|
40
39
|
```
|
|
41
40
|
|
|
42
|
-
The `font` prop auto-injects the matching Google Font `<link>` tag —
|
|
41
|
+
The `font` prop auto-injects the matching Google Font `<link>` tag — no manual imports needed.
|
|
43
42
|
|
|
44
43
|
---
|
|
45
44
|
|
|
@@ -54,7 +53,7 @@ The `font` prop auto-injects the matching Google Font `<link>` tag — **no manu
|
|
|
54
53
|
| `H4` | `h4` | Card / panel heading |
|
|
55
54
|
| `H5` | `h5` | Small heading |
|
|
56
55
|
| `H6` | `h6` | Micro heading |
|
|
57
|
-
| `Subheading` | `h6` | Supporting
|
|
56
|
+
| `Subheading` | `h6` | Supporting subtitle |
|
|
58
57
|
| `Overline` | `span` | ALL CAPS label above a heading |
|
|
59
58
|
| `Body` | `p` | Main body copy |
|
|
60
59
|
| `Label` | `label` | Form labels, tags |
|
|
@@ -66,42 +65,99 @@ The `font` prop auto-injects the matching Google Font `<link>` tag — **no manu
|
|
|
66
65
|
|
|
67
66
|
```ts
|
|
68
67
|
interface TypographyProps {
|
|
69
|
-
variant?:
|
|
70
|
-
font?:
|
|
71
|
-
color?:
|
|
72
|
-
align?:
|
|
73
|
-
as?:
|
|
74
|
-
truncate?:
|
|
75
|
-
maxLines?:
|
|
76
|
-
|
|
77
|
-
|
|
68
|
+
variant?: TypographyVariant // default: "Body"
|
|
69
|
+
font?: string // Google Font name e.g. "Bricolage Grotesque"
|
|
70
|
+
color?: string // Any CSS color value
|
|
71
|
+
align?: "left" | "center" | "right" | "justify"
|
|
72
|
+
as?: ElementType // Override rendered HTML tag
|
|
73
|
+
truncate?: boolean // Single-line ellipsis
|
|
74
|
+
maxLines?: number // Multi-line line-clamp
|
|
75
|
+
animation?: HeroAnimation // Entrance animation (Display / H1 only)
|
|
76
|
+
italic?: boolean // default: true — show serif italic accent on <em>
|
|
77
|
+
accentColor?: string // default: "#c8b89a" — color for <em> italic text
|
|
78
|
+
className?: string
|
|
79
|
+
style?: CSSProperties
|
|
78
80
|
}
|
|
79
81
|
```
|
|
80
82
|
|
|
81
83
|
---
|
|
82
84
|
|
|
83
|
-
##
|
|
85
|
+
## Hero Animations
|
|
84
86
|
|
|
85
|
-
|
|
87
|
+
The `animation` prop works on `Display` and `H1` variants only. It injects a tiny stylesheet once (no external dependency) and applies a CSS keyframe entrance.
|
|
86
88
|
|
|
87
89
|
```tsx
|
|
88
|
-
<Typography variant="
|
|
89
|
-
|
|
90
|
+
<Typography variant="Display" font="Bricolage Grotesque" animation="rise">
|
|
91
|
+
The future of design
|
|
92
|
+
</Typography>
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
### Available animations
|
|
96
|
+
|
|
97
|
+
| Value | Description |
|
|
98
|
+
|---------------|-------------------------------------------------------|
|
|
99
|
+
| `rise` | Smooth upward fade-in — clean, universal |
|
|
100
|
+
| `stagger` | Each word rises in sequence |
|
|
101
|
+
| `clip` | Text unmasked left to right — editorial feel |
|
|
102
|
+
| `pop` | Spring scale-in — energetic and confident |
|
|
103
|
+
| `letters` | Each letter slides in with a slight rotation |
|
|
104
|
+
| `blur` | Emerges from a blur — cinematic and dreamy |
|
|
105
|
+
| `flip` | 3-D perspective rotate on entry — depth and gravitas |
|
|
106
|
+
| `swipe` | Slides in from the right — directional flow |
|
|
107
|
+
| `typewriter` | Character-by-character reveal — focused |
|
|
108
|
+
| `bounce` | Drops from above with a soft bounce |
|
|
109
|
+
|
|
110
|
+
All animations use only `transform`, `opacity`, and `filter` — GPU-composited, no layout thrashing, 60fps safe.
|
|
111
|
+
|
|
112
|
+
---
|
|
113
|
+
|
|
114
|
+
## Italic Accent
|
|
115
|
+
|
|
116
|
+
When `italic={true}` (the default), any `<em>` tag inside a `Display` or `H1` hero renders in **Instrument Serif italic** with an accent color. This creates a classic editorial contrast between a bold sans-serif header and a refined serif word.
|
|
117
|
+
|
|
118
|
+
```tsx
|
|
119
|
+
// With italic accent (default)
|
|
120
|
+
<Typography variant="Display" font="Bricolage Grotesque">
|
|
121
|
+
Build with <em>intention</em>
|
|
122
|
+
</Typography>
|
|
123
|
+
|
|
124
|
+
// Turn off — everything renders in the heading font
|
|
125
|
+
<Typography variant="Display" font="Bricolage Grotesque" italic={false}>
|
|
126
|
+
Build with <em>intention</em>
|
|
90
127
|
</Typography>
|
|
128
|
+
```
|
|
91
129
|
|
|
92
|
-
|
|
93
|
-
|
|
130
|
+
### Custom accent color
|
|
131
|
+
|
|
132
|
+
```tsx
|
|
133
|
+
<Typography
|
|
134
|
+
variant="Display"
|
|
135
|
+
font="Bricolage Grotesque"
|
|
136
|
+
accentColor="#7F77DD"
|
|
137
|
+
>
|
|
138
|
+
Crafted with <em>precision</em>
|
|
94
139
|
</Typography>
|
|
95
140
|
```
|
|
96
141
|
|
|
142
|
+
The `accentColor` prop only affects the `<em>` italic span. It has no effect when `italic={false}`.
|
|
143
|
+
|
|
144
|
+
---
|
|
145
|
+
|
|
146
|
+
## Examples
|
|
147
|
+
|
|
97
148
|
### Overline + Display combo
|
|
98
149
|
|
|
99
150
|
```tsx
|
|
100
151
|
<Typography variant="Overline" color="#6366f1">
|
|
101
152
|
New Feature
|
|
102
153
|
</Typography>
|
|
103
|
-
<Typography
|
|
104
|
-
|
|
154
|
+
<Typography
|
|
155
|
+
variant="Display"
|
|
156
|
+
font="Bricolage Grotesque"
|
|
157
|
+
animation="clip"
|
|
158
|
+
accentColor="#6366f1"
|
|
159
|
+
>
|
|
160
|
+
Build faster with <em>types</em>
|
|
105
161
|
</Typography>
|
|
106
162
|
```
|
|
107
163
|
|
|
@@ -109,10 +165,10 @@ interface TypographyProps {
|
|
|
109
165
|
|
|
110
166
|
```tsx
|
|
111
167
|
<Typography variant="Body" font="Lora">
|
|
112
|
-
A well-set paragraph in a refined serif font.
|
|
168
|
+
A well-set paragraph in a refined serif font brings reading pleasure.
|
|
113
169
|
</Typography>
|
|
114
170
|
<Typography variant="Caption" color="#888">
|
|
115
|
-
Fig. 1 —
|
|
171
|
+
Fig. 1 — System architecture overview
|
|
116
172
|
</Typography>
|
|
117
173
|
```
|
|
118
174
|
|
|
@@ -126,11 +182,11 @@ interface TypographyProps {
|
|
|
126
182
|
|
|
127
183
|
{/* Multi-line clamp */}
|
|
128
184
|
<Typography variant="Body" maxLines={3}>
|
|
129
|
-
This paragraph will show at most three lines
|
|
185
|
+
This paragraph will show at most three lines...
|
|
130
186
|
</Typography>
|
|
131
187
|
```
|
|
132
188
|
|
|
133
|
-
### Override tag
|
|
189
|
+
### Override HTML tag
|
|
134
190
|
|
|
135
191
|
```tsx
|
|
136
192
|
<Typography variant="H2" as="div">
|
|
@@ -140,7 +196,7 @@ interface TypographyProps {
|
|
|
140
196
|
|
|
141
197
|
---
|
|
142
198
|
|
|
143
|
-
## Pre-loading fonts
|
|
199
|
+
## Pre-loading fonts
|
|
144
200
|
|
|
145
201
|
To avoid FOUT (flash of unstyled text), pre-load fonts at the top of your app:
|
|
146
202
|
|
|
@@ -148,25 +204,24 @@ To avoid FOUT (flash of unstyled text), pre-load fonts at the top of your app:
|
|
|
148
204
|
import { preloadFonts } from "react-type-scale";
|
|
149
205
|
|
|
150
206
|
// In your _app.tsx / main.tsx / layout.tsx
|
|
151
|
-
preloadFonts(["
|
|
207
|
+
preloadFonts(["Bricolage Grotesque", "Instrument Serif", "DM Sans"]);
|
|
152
208
|
```
|
|
153
209
|
|
|
154
210
|
---
|
|
155
211
|
|
|
156
|
-
##
|
|
157
|
-
|
|
158
|
-
The package ships with a curated list of ~40 popular Google Fonts that are auto-injected.
|
|
159
|
-
For any font not in the list, either add it to your local fork of `fonts.ts` or import it manually:
|
|
212
|
+
## Recommended hero font pairings
|
|
160
213
|
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
214
|
+
| Heading font | Style | Works well for |
|
|
215
|
+
|------------------------|------------|------------------------------|
|
|
216
|
+
| `Bricolage Grotesque` | Bold sans | Startups, SaaS, modern brand |
|
|
217
|
+
| `Syne` | Geometric | Creative, portfolio, agency |
|
|
218
|
+
| `Fraunces` | Serif | Editorial, luxury, fashion |
|
|
219
|
+
| `Bebas Neue` | Condensed | Sports, bold campaigns |
|
|
220
|
+
| `Playfair Display` | Serif | Journalism, books, culture |
|
|
221
|
+
| `Outfit` | Clean sans | Apps, dashboards, fintech |
|
|
167
222
|
|
|
168
|
-
|
|
223
|
+
All are on Google Fonts and auto-injected when passed to the `font` prop.
|
|
169
224
|
|
|
170
225
|
## License
|
|
171
226
|
|
|
172
|
-
MIT
|
|
227
|
+
MIT
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { HeroAnimation } from "./types";
|
|
2
|
+
export declare function injectAnimationStyles(): void;
|
|
3
|
+
export declare function getAnimationClass(animation: HeroAnimation): string;
|
|
4
|
+
/**
|
|
5
|
+
* For "stagger" — wraps each word in a span with a staggered delay.
|
|
6
|
+
* Preserves <em> tags for italic accent.
|
|
7
|
+
*/
|
|
8
|
+
export declare function buildStaggerHTML(html: string): string;
|
|
9
|
+
/**
|
|
10
|
+
* For "letters" — wraps each character in a span with staggered delay.
|
|
11
|
+
* Preserves <em> wrapping for italic accent characters.
|
|
12
|
+
*/
|
|
13
|
+
export declare function buildLettersHTML(html: string, italic: boolean): string;
|
package/dist/index.d.ts
CHANGED
|
@@ -2,12 +2,28 @@ import React, { HTMLAttributes, ElementType, CSSProperties } from 'react';
|
|
|
2
2
|
|
|
3
3
|
type TypographyVariant = "Display" | "H1" | "H2" | "H3" | "H4" | "H5" | "H6" | "Subheading" | "Overline" | "Body" | "Label" | "Caption";
|
|
4
4
|
type TextAlign = "left" | "center" | "right" | "justify";
|
|
5
|
+
/**
|
|
6
|
+
* Built-in hero text entrance animations.
|
|
7
|
+
* Applied via CSS keyframes — GPU-composited, 60fps safe.
|
|
8
|
+
*
|
|
9
|
+
* rise — smooth upward fade-in (universal default)
|
|
10
|
+
* stagger — each word rises in sequence
|
|
11
|
+
* clip — text unmasked left-to-right (editorial)
|
|
12
|
+
* pop — spring scale-in (energetic)
|
|
13
|
+
* letters — each letter slides in with a slight rotation
|
|
14
|
+
* blur — emerges from a blur (cinematic)
|
|
15
|
+
* flip — 3-D perspective rotate on entry (depth)
|
|
16
|
+
* swipe — slides in from the right
|
|
17
|
+
* typewriter — character-by-character reveal
|
|
18
|
+
* bounce — drops from above with a soft bounce
|
|
19
|
+
*/
|
|
20
|
+
type HeroAnimation = "rise" | "stagger" | "clip" | "pop" | "letters" | "blur" | "flip" | "swipe" | "typewriter" | "bounce";
|
|
5
21
|
interface TypographyProps extends HTMLAttributes<HTMLElement> {
|
|
6
22
|
/** Typography scale variant */
|
|
7
23
|
variant?: TypographyVariant;
|
|
8
|
-
/** Google Font name e.g. "
|
|
24
|
+
/** Google Font name e.g. "Bricolage Grotesque", "Playfair Display" */
|
|
9
25
|
font?: string;
|
|
10
|
-
/** Text color — any valid CSS color
|
|
26
|
+
/** Text color — any valid CSS color */
|
|
11
27
|
color?: string;
|
|
12
28
|
/** Text alignment */
|
|
13
29
|
align?: TextAlign;
|
|
@@ -17,6 +33,23 @@ interface TypographyProps extends HTMLAttributes<HTMLElement> {
|
|
|
17
33
|
truncate?: boolean;
|
|
18
34
|
/** Clamp to N lines with ellipsis */
|
|
19
35
|
maxLines?: number;
|
|
36
|
+
/**
|
|
37
|
+
* Hero entrance animation. Only applies when variant is
|
|
38
|
+
* "Display" or "H1". Injects a CSS class and keyframe stylesheet once.
|
|
39
|
+
*/
|
|
40
|
+
animation?: HeroAnimation;
|
|
41
|
+
/**
|
|
42
|
+
* Italic accent for Display / H1 heroes.
|
|
43
|
+
* When true (default) any <em> child renders in Instrument Serif italic
|
|
44
|
+
* with an accent color. Set to false to render everything in the heading
|
|
45
|
+
* font/weight — no serif, no italics.
|
|
46
|
+
*/
|
|
47
|
+
italic?: boolean;
|
|
48
|
+
/**
|
|
49
|
+
* Accent color for the <em> italic span inside Display / H1.
|
|
50
|
+
* Defaults to a warm sand tone (#c8b89a).
|
|
51
|
+
*/
|
|
52
|
+
accentColor?: string;
|
|
20
53
|
/** Inline style overrides */
|
|
21
54
|
style?: CSSProperties;
|
|
22
55
|
/** Additional class names */
|
|
@@ -48,4 +81,4 @@ declare function injectFont(url: string): void;
|
|
|
48
81
|
*/
|
|
49
82
|
declare function preloadFonts(families: string[]): void;
|
|
50
83
|
|
|
51
|
-
export { GOOGLE_FONTS, TextAlign, Typography, TypographyProps, TypographyVariant, buildFontUrl, Typography as default, injectFont, preloadFonts };
|
|
84
|
+
export { GOOGLE_FONTS, HeroAnimation, TextAlign, Typography, TypographyProps, TypographyVariant, buildFontUrl, Typography as default, injectFont, preloadFonts };
|
package/dist/index.esm.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import React from 'react';
|
|
2
3
|
|
|
3
4
|
/******************************************************************************
|
|
4
5
|
Copyright (c) Microsoft Corporation.
|
|
@@ -124,6 +125,113 @@ function preloadFonts(families) {
|
|
|
124
125
|
});
|
|
125
126
|
}
|
|
126
127
|
|
|
128
|
+
const STYLE_ID = "rts-hero-animations";
|
|
129
|
+
const CSS = `
|
|
130
|
+
@keyframes rts-rise{from{opacity:0;transform:translateY(32px)}to{opacity:1;transform:translateY(0)}}
|
|
131
|
+
@keyframes rts-clip{from{clip-path:inset(0 100% 0 0)}to{clip-path:inset(0 0% 0 0)}}
|
|
132
|
+
@keyframes rts-pop{0%{opacity:0;transform:scale(0.75)}60%{opacity:1;transform:scale(1.04)}100%{transform:scale(1)}}
|
|
133
|
+
@keyframes rts-blur{from{opacity:0;filter:blur(14px);transform:scale(1.04)}to{opacity:1;filter:blur(0);transform:scale(1)}}
|
|
134
|
+
@keyframes rts-flip{from{opacity:0;transform:perspective(600px) rotateX(30deg) translateY(20px)}to{opacity:1;transform:perspective(600px) rotateX(0) translateY(0)}}
|
|
135
|
+
@keyframes rts-swipe{from{opacity:0;transform:translateX(60px)}to{opacity:1;transform:translateX(0)}}
|
|
136
|
+
@keyframes rts-bounce{0%{opacity:0;transform:translateY(-60px)}60%{opacity:1;transform:translateY(10px)}80%{transform:translateY(-5px)}100%{transform:translateY(0)}}
|
|
137
|
+
@keyframes rts-type{from{width:0}to{width:100%}}
|
|
138
|
+
@keyframes rts-blink{50%{border-color:transparent}}
|
|
139
|
+
@keyframes rts-word-rise{from{opacity:0;transform:translateY(24px)}to{opacity:1;transform:translateY(0)}}
|
|
140
|
+
@keyframes rts-letter-in{from{opacity:0;transform:translateX(-16px) rotate(-4deg)}to{opacity:1;transform:none}}
|
|
141
|
+
|
|
142
|
+
.rts-rise{animation:rts-rise 0.9s cubic-bezier(0.16,1,0.3,1) both}
|
|
143
|
+
.rts-clip{animation:rts-clip 1.1s cubic-bezier(0.77,0,0.18,1) both}
|
|
144
|
+
.rts-pop{animation:rts-pop 0.7s cubic-bezier(0.34,1.56,0.64,1) both}
|
|
145
|
+
.rts-blur{animation:rts-blur 1s cubic-bezier(0.16,1,0.3,1) both}
|
|
146
|
+
.rts-flip{animation:rts-flip 0.9s cubic-bezier(0.16,1,0.3,1) both;transform-origin:center bottom}
|
|
147
|
+
.rts-swipe{animation:rts-swipe 0.8s cubic-bezier(0.16,1,0.3,1) both}
|
|
148
|
+
.rts-bounce{animation:rts-bounce 0.9s cubic-bezier(0.36,0.07,0.19,0.97) both}
|
|
149
|
+
.rts-typewriter{overflow:hidden;white-space:nowrap;border-right:2px solid currentColor;width:0;animation:rts-type 1.6s steps(22,end) both,rts-blink 0.7s step-end 1.6s 3}
|
|
150
|
+
.rts-word{display:inline-block;opacity:0;transform:translateY(24px);animation:rts-word-rise 0.7s cubic-bezier(0.16,1,0.3,1) both}
|
|
151
|
+
.rts-letter{display:inline-block;opacity:0;transform:translateX(-16px) rotate(-4deg);animation:rts-letter-in 0.5s cubic-bezier(0.16,1,0.3,1) both}
|
|
152
|
+
`;
|
|
153
|
+
function injectAnimationStyles() {
|
|
154
|
+
if (typeof document === "undefined")
|
|
155
|
+
return;
|
|
156
|
+
if (document.getElementById(STYLE_ID))
|
|
157
|
+
return;
|
|
158
|
+
const style = document.createElement("style");
|
|
159
|
+
style.id = STYLE_ID;
|
|
160
|
+
style.textContent = CSS;
|
|
161
|
+
document.head.appendChild(style);
|
|
162
|
+
}
|
|
163
|
+
function getAnimationClass(animation) {
|
|
164
|
+
var _a;
|
|
165
|
+
const map = {
|
|
166
|
+
rise: "rts-rise",
|
|
167
|
+
clip: "rts-clip",
|
|
168
|
+
pop: "rts-pop",
|
|
169
|
+
blur: "rts-blur",
|
|
170
|
+
flip: "rts-flip",
|
|
171
|
+
swipe: "rts-swipe",
|
|
172
|
+
bounce: "rts-bounce",
|
|
173
|
+
typewriter: "rts-typewriter",
|
|
174
|
+
stagger: "",
|
|
175
|
+
letters: "",
|
|
176
|
+
};
|
|
177
|
+
return (_a = map[animation]) !== null && _a !== void 0 ? _a : "";
|
|
178
|
+
}
|
|
179
|
+
/**
|
|
180
|
+
* For "stagger" — wraps each word in a span with a staggered delay.
|
|
181
|
+
* Preserves <em> tags for italic accent.
|
|
182
|
+
*/
|
|
183
|
+
function buildStaggerHTML(html) {
|
|
184
|
+
var _a;
|
|
185
|
+
// Split on spaces but keep <em>...</em> intact as single tokens
|
|
186
|
+
const tokens = (_a = html.match(/(<em>.*?<\/em>|[^\s]+)/g)) !== null && _a !== void 0 ? _a : [];
|
|
187
|
+
return tokens
|
|
188
|
+
.map((tok, i) => {
|
|
189
|
+
const delay = (i * 0.07).toFixed(2);
|
|
190
|
+
if (tok.startsWith("<em>")) {
|
|
191
|
+
return `<em><span class="rts-word" style="animation-delay:${delay}s">${tok.slice(4, -5)}</span></em>`;
|
|
192
|
+
}
|
|
193
|
+
return `<span class="rts-word" style="animation-delay:${delay}s">${tok}</span>`;
|
|
194
|
+
})
|
|
195
|
+
.join(" ");
|
|
196
|
+
}
|
|
197
|
+
/**
|
|
198
|
+
* For "letters" — wraps each character in a span with staggered delay.
|
|
199
|
+
* Preserves <em> wrapping for italic accent characters.
|
|
200
|
+
*/
|
|
201
|
+
function buildLettersHTML(html, italic) {
|
|
202
|
+
// Parse the raw string into char tokens, tracking whether inside <em>
|
|
203
|
+
const result = [];
|
|
204
|
+
let inEm = false;
|
|
205
|
+
let delay = 0;
|
|
206
|
+
const step = 0.04;
|
|
207
|
+
// Simple char-by-char parse
|
|
208
|
+
let i = 0;
|
|
209
|
+
while (i < html.length) {
|
|
210
|
+
if (html.startsWith("<em>", i)) {
|
|
211
|
+
inEm = true;
|
|
212
|
+
i += 4;
|
|
213
|
+
continue;
|
|
214
|
+
}
|
|
215
|
+
if (html.startsWith("</em>", i)) {
|
|
216
|
+
inEm = false;
|
|
217
|
+
i += 5;
|
|
218
|
+
continue;
|
|
219
|
+
}
|
|
220
|
+
const ch = html[i];
|
|
221
|
+
if (ch === " ") {
|
|
222
|
+
result.push(" ");
|
|
223
|
+
i++;
|
|
224
|
+
continue;
|
|
225
|
+
}
|
|
226
|
+
const span = `<span class="rts-letter" style="animation-delay:${delay.toFixed(2)}s">${ch}</span>`;
|
|
227
|
+
result.push(inEm && italic ? `<em>${span}</em>` : span);
|
|
228
|
+
delay += step;
|
|
229
|
+
i++;
|
|
230
|
+
}
|
|
231
|
+
return result.join("");
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
// ─── Static maps ─────────────────────────────────────────────────────────────
|
|
127
235
|
const variantTagMap = {
|
|
128
236
|
Display: "h1",
|
|
129
237
|
H1: "h1",
|
|
@@ -213,20 +321,84 @@ const variantStyleMap = {
|
|
|
213
321
|
letterSpacing: "0.03em",
|
|
214
322
|
},
|
|
215
323
|
};
|
|
324
|
+
// ─── Italic accent style injection ──────────────────────────────────────────
|
|
325
|
+
const ITALIC_STYLE_ID = "rts-italic-accent";
|
|
326
|
+
const ITALIC_FONT_URL = "https://fonts.googleapis.com/css2?family=Instrument+Serif:ital@0;1&display=swap";
|
|
327
|
+
function injectItalicAccentStyle(accentColor) {
|
|
328
|
+
if (typeof document === "undefined")
|
|
329
|
+
return;
|
|
330
|
+
if (document.getElementById(ITALIC_STYLE_ID))
|
|
331
|
+
return;
|
|
332
|
+
injectFont(ITALIC_FONT_URL);
|
|
333
|
+
const style = document.createElement("style");
|
|
334
|
+
style.id = ITALIC_STYLE_ID;
|
|
335
|
+
style.textContent = `
|
|
336
|
+
[data-rts] em {
|
|
337
|
+
font-family: 'Instrument Serif', serif;
|
|
338
|
+
font-style: italic;
|
|
339
|
+
font-weight: 400;
|
|
340
|
+
color: ${accentColor};
|
|
341
|
+
}
|
|
342
|
+
[data-rts-no-italic] em {
|
|
343
|
+
font-family: inherit;
|
|
344
|
+
font-style: normal;
|
|
345
|
+
font-weight: inherit;
|
|
346
|
+
color: inherit;
|
|
347
|
+
}
|
|
348
|
+
`;
|
|
349
|
+
document.head.appendChild(style);
|
|
350
|
+
}
|
|
351
|
+
// ─── Component ───────────────────────────────────────────────────────────────
|
|
216
352
|
const Typography = (_a) => {
|
|
217
|
-
var
|
|
218
|
-
|
|
353
|
+
var _b, _c;
|
|
354
|
+
var { variant = "Body", font, color, align, className, style, children, as, truncate, maxLines, animation, italic = true, accentColor = "#c8b89a" } = _a, rest = __rest(_a, ["variant", "font", "color", "align", "className", "style", "children", "as", "truncate", "maxLines", "animation", "italic", "accentColor"]);
|
|
355
|
+
const isHero = variant === "Display" || variant === "H1";
|
|
356
|
+
// Inject Google Font if recognised
|
|
219
357
|
if (font && GOOGLE_FONTS.includes(font)) {
|
|
220
358
|
injectFont(buildFontUrl(font));
|
|
221
359
|
}
|
|
360
|
+
// Inject animation keyframes once
|
|
361
|
+
if (animation && isHero) {
|
|
362
|
+
injectAnimationStyles();
|
|
363
|
+
}
|
|
364
|
+
// Inject italic accent styles once (always, so toggling italic prop works)
|
|
365
|
+
if (isHero) {
|
|
366
|
+
injectItalicAccentStyle(accentColor);
|
|
367
|
+
}
|
|
222
368
|
const Tag = (as !== null && as !== void 0 ? as : variantTagMap[variant]);
|
|
223
369
|
const baseStyle = variantStyleMap[variant];
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
370
|
+
// Build animation class + inner HTML for hero variants
|
|
371
|
+
let animClass = "";
|
|
372
|
+
let heroHTML = null;
|
|
373
|
+
if (animation && isHero) {
|
|
374
|
+
const rawHTML = typeof children === "string"
|
|
375
|
+
? children
|
|
376
|
+
: (_c = (_b = React.Children.map(children, (child) => {
|
|
377
|
+
if (typeof child === "string")
|
|
378
|
+
return child;
|
|
379
|
+
if (React.isValidElement(child) && child.type === "em") {
|
|
380
|
+
const text = typeof child.props.children === "string"
|
|
381
|
+
? child.props.children
|
|
382
|
+
: "";
|
|
383
|
+
return `<em>${text}</em>`;
|
|
384
|
+
}
|
|
385
|
+
return "";
|
|
386
|
+
})) === null || _b === void 0 ? void 0 : _b.join("")) !== null && _c !== void 0 ? _c : "";
|
|
387
|
+
if (animation === "stagger") {
|
|
388
|
+
heroHTML = buildStaggerHTML(rawHTML);
|
|
389
|
+
animClass = "";
|
|
390
|
+
}
|
|
391
|
+
else if (animation === "letters") {
|
|
392
|
+
heroHTML = buildLettersHTML(rawHTML, italic);
|
|
393
|
+
animClass = "";
|
|
394
|
+
}
|
|
395
|
+
else {
|
|
396
|
+
heroHTML = rawHTML;
|
|
397
|
+
animClass = getAnimationClass(animation);
|
|
229
398
|
}
|
|
399
|
+
}
|
|
400
|
+
const computedStyle = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, baseStyle), (font ? { fontFamily: `'${font}', sans-serif` } : {})), (color ? { color } : {})), (align ? { textAlign: align } : {})), (truncate
|
|
401
|
+
? { overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" }
|
|
230
402
|
: {})), (maxLines && !truncate
|
|
231
403
|
? {
|
|
232
404
|
display: "-webkit-box",
|
|
@@ -235,7 +407,12 @@ const Typography = (_a) => {
|
|
|
235
407
|
overflow: "hidden",
|
|
236
408
|
}
|
|
237
409
|
: {})), { margin: 0, padding: 0 }), style);
|
|
238
|
-
|
|
410
|
+
const dataAttrs = isHero
|
|
411
|
+
? Object.assign({ "data-rts": "" }, (italic ? {} : { "data-rts-no-italic": "" })) : {};
|
|
412
|
+
if (heroHTML !== null) {
|
|
413
|
+
return (jsx(Tag, Object.assign({ className: [animClass, className].filter(Boolean).join(" "), style: computedStyle, dangerouslySetInnerHTML: { __html: heroHTML } }, dataAttrs, rest)));
|
|
414
|
+
}
|
|
415
|
+
return (jsx(Tag, Object.assign({ className: className, style: computedStyle }, dataAttrs, rest, { children: children })));
|
|
239
416
|
};
|
|
240
417
|
|
|
241
418
|
export { GOOGLE_FONTS, Typography, buildFontUrl, Typography as default, injectFont, preloadFonts };
|
package/dist/index.esm.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.esm.js","sources":["../node_modules/tslib/tslib.es6.js","../../fonts.ts","../../Typography.tsx"],"sourcesContent":["/******************************************************************************\r\nCopyright (c) Microsoft Corporation.\r\n\r\nPermission to use, copy, modify, and/or distribute this software for any\r\npurpose with or without fee is hereby granted.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\r\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\r\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\r\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\r\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\r\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\r\nPERFORMANCE OF THIS SOFTWARE.\r\n***************************************************************************** */\r\n/* global Reflect, Promise, SuppressedError, Symbol, Iterator */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\r\n return extendStatics(d, b);\r\n};\r\n\r\nexport function __extends(d, b) {\r\n if (typeof b !== \"function\" && b !== null)\r\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\r\n\r\nexport var __assign = function() {\r\n __assign = Object.assign || function __assign(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\r\n }\r\n return t;\r\n }\r\n return __assign.apply(this, arguments);\r\n}\r\n\r\nexport function __rest(s, e) {\r\n var t = {};\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\r\n t[p] = s[p];\r\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\r\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\r\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\r\n t[p[i]] = s[p[i]];\r\n }\r\n return t;\r\n}\r\n\r\nexport function __decorate(decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n}\r\n\r\nexport function __param(paramIndex, decorator) {\r\n return function (target, key) { decorator(target, key, paramIndex); }\r\n}\r\n\r\nexport function __esDecorate(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {\r\n function accept(f) { if (f !== void 0 && typeof f !== \"function\") throw new TypeError(\"Function expected\"); return f; }\r\n var kind = contextIn.kind, key = kind === \"getter\" ? \"get\" : kind === \"setter\" ? \"set\" : \"value\";\r\n var target = !descriptorIn && ctor ? contextIn[\"static\"] ? ctor : ctor.prototype : null;\r\n var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});\r\n var _, done = false;\r\n for (var i = decorators.length - 1; i >= 0; i--) {\r\n var context = {};\r\n for (var p in contextIn) context[p] = p === \"access\" ? {} : contextIn[p];\r\n for (var p in contextIn.access) context.access[p] = contextIn.access[p];\r\n context.addInitializer = function (f) { if (done) throw new TypeError(\"Cannot add initializers after decoration has completed\"); extraInitializers.push(accept(f || null)); };\r\n var result = (0, decorators[i])(kind === \"accessor\" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);\r\n if (kind === \"accessor\") {\r\n if (result === void 0) continue;\r\n if (result === null || typeof result !== \"object\") throw new TypeError(\"Object expected\");\r\n if (_ = accept(result.get)) descriptor.get = _;\r\n if (_ = accept(result.set)) descriptor.set = _;\r\n if (_ = accept(result.init)) initializers.unshift(_);\r\n }\r\n else if (_ = accept(result)) {\r\n if (kind === \"field\") initializers.unshift(_);\r\n else descriptor[key] = _;\r\n }\r\n }\r\n if (target) Object.defineProperty(target, contextIn.name, descriptor);\r\n done = true;\r\n};\r\n\r\nexport function __runInitializers(thisArg, initializers, value) {\r\n var useValue = arguments.length > 2;\r\n for (var i = 0; i < initializers.length; i++) {\r\n value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);\r\n }\r\n return useValue ? value : void 0;\r\n};\r\n\r\nexport function __propKey(x) {\r\n return typeof x === \"symbol\" ? x : \"\".concat(x);\r\n};\r\n\r\nexport function __setFunctionName(f, name, prefix) {\r\n if (typeof name === \"symbol\") name = name.description ? \"[\".concat(name.description, \"]\") : \"\";\r\n return Object.defineProperty(f, \"name\", { configurable: true, value: prefix ? \"\".concat(prefix, \" \", name) : name });\r\n};\r\n\r\nexport function __metadata(metadataKey, metadataValue) {\r\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\r\n}\r\n\r\nexport function __awaiter(thisArg, _arguments, P, generator) {\r\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n}\r\n\r\nexport function __generator(thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === \"function\" ? Iterator : Object).prototype);\r\n return g.next = verb(0), g[\"throw\"] = verb(1), g[\"return\"] = verb(2), typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (g && (g = 0, op[0] && (_ = 0)), _) try {\r\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n}\r\n\r\nexport var __createBinding = Object.create ? (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n var desc = Object.getOwnPropertyDescriptor(m, k);\r\n if (!desc || (\"get\" in desc ? !m.__esModule : desc.writable || desc.configurable)) {\r\n desc = { enumerable: true, get: function() { return m[k]; } };\r\n }\r\n Object.defineProperty(o, k2, desc);\r\n}) : (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n o[k2] = m[k];\r\n});\r\n\r\nexport function __exportStar(m, o) {\r\n for (var p in m) if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p);\r\n}\r\n\r\nexport function __values(o) {\r\n var s = typeof Symbol === \"function\" && Symbol.iterator, m = s && o[s], i = 0;\r\n if (m) return m.call(o);\r\n if (o && typeof o.length === \"number\") return {\r\n next: function () {\r\n if (o && i >= o.length) o = void 0;\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\r\n}\r\n\r\nexport function __read(o, n) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\r\n if (!m) return o;\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\r\n }\r\n catch (error) { e = { error: error }; }\r\n finally {\r\n try {\r\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\r\n }\r\n finally { if (e) throw e.error; }\r\n }\r\n return ar;\r\n}\r\n\r\n/** @deprecated */\r\nexport function __spread() {\r\n for (var ar = [], i = 0; i < arguments.length; i++)\r\n ar = ar.concat(__read(arguments[i]));\r\n return ar;\r\n}\r\n\r\n/** @deprecated */\r\nexport function __spreadArrays() {\r\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\r\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\r\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\r\n r[k] = a[j];\r\n return r;\r\n}\r\n\r\nexport function __spreadArray(to, from, pack) {\r\n if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {\r\n if (ar || !(i in from)) {\r\n if (!ar) ar = Array.prototype.slice.call(from, 0, i);\r\n ar[i] = from[i];\r\n }\r\n }\r\n return to.concat(ar || Array.prototype.slice.call(from));\r\n}\r\n\r\nexport function __await(v) {\r\n return this instanceof __await ? (this.v = v, this) : new __await(v);\r\n}\r\n\r\nexport function __asyncGenerator(thisArg, _arguments, generator) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\r\n return i = Object.create((typeof AsyncIterator === \"function\" ? AsyncIterator : Object).prototype), verb(\"next\"), verb(\"throw\"), verb(\"return\", awaitReturn), i[Symbol.asyncIterator] = function () { return this; }, i;\r\n function awaitReturn(f) { return function (v) { return Promise.resolve(v).then(f, reject); }; }\r\n function verb(n, f) { if (g[n]) { i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; if (f) i[n] = f(i[n]); } }\r\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\r\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\r\n function fulfill(value) { resume(\"next\", value); }\r\n function reject(value) { resume(\"throw\", value); }\r\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\r\n}\r\n\r\nexport function __asyncDelegator(o) {\r\n var i, p;\r\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\r\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: false } : f ? f(v) : v; } : f; }\r\n}\r\n\r\nexport function __asyncValues(o) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var m = o[Symbol.asyncIterator], i;\r\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\r\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\r\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\r\n}\r\n\r\nexport function __makeTemplateObject(cooked, raw) {\r\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\r\n return cooked;\r\n};\r\n\r\nvar __setModuleDefault = Object.create ? (function(o, v) {\r\n Object.defineProperty(o, \"default\", { enumerable: true, value: v });\r\n}) : function(o, v) {\r\n o[\"default\"] = v;\r\n};\r\n\r\nvar ownKeys = function(o) {\r\n ownKeys = Object.getOwnPropertyNames || function (o) {\r\n var ar = [];\r\n for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;\r\n return ar;\r\n };\r\n return ownKeys(o);\r\n};\r\n\r\nexport function __importStar(mod) {\r\n if (mod && mod.__esModule) return mod;\r\n var result = {};\r\n if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== \"default\") __createBinding(result, mod, k[i]);\r\n __setModuleDefault(result, mod);\r\n return result;\r\n}\r\n\r\nexport function __importDefault(mod) {\r\n return (mod && mod.__esModule) ? mod : { default: mod };\r\n}\r\n\r\nexport function __classPrivateFieldGet(receiver, state, kind, f) {\r\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a getter\");\r\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot read private member from an object whose class did not declare it\");\r\n return kind === \"m\" ? f : kind === \"a\" ? f.call(receiver) : f ? f.value : state.get(receiver);\r\n}\r\n\r\nexport function __classPrivateFieldSet(receiver, state, value, kind, f) {\r\n if (kind === \"m\") throw new TypeError(\"Private method is not writable\");\r\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a setter\");\r\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot write private member to an object whose class did not declare it\");\r\n return (kind === \"a\" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;\r\n}\r\n\r\nexport function __classPrivateFieldIn(state, receiver) {\r\n if (receiver === null || (typeof receiver !== \"object\" && typeof receiver !== \"function\")) throw new TypeError(\"Cannot use 'in' operator on non-object\");\r\n return typeof state === \"function\" ? receiver === state : state.has(receiver);\r\n}\r\n\r\nexport function __addDisposableResource(env, value, async) {\r\n if (value !== null && value !== void 0) {\r\n if (typeof value !== \"object\" && typeof value !== \"function\") throw new TypeError(\"Object expected.\");\r\n var dispose, inner;\r\n if (async) {\r\n if (!Symbol.asyncDispose) throw new TypeError(\"Symbol.asyncDispose is not defined.\");\r\n dispose = value[Symbol.asyncDispose];\r\n }\r\n if (dispose === void 0) {\r\n if (!Symbol.dispose) throw new TypeError(\"Symbol.dispose is not defined.\");\r\n dispose = value[Symbol.dispose];\r\n if (async) inner = dispose;\r\n }\r\n if (typeof dispose !== \"function\") throw new TypeError(\"Object not disposable.\");\r\n if (inner) dispose = function() { try { inner.call(this); } catch (e) { return Promise.reject(e); } };\r\n env.stack.push({ value: value, dispose: dispose, async: async });\r\n }\r\n else if (async) {\r\n env.stack.push({ async: true });\r\n }\r\n return value;\r\n\r\n}\r\n\r\nvar _SuppressedError = typeof SuppressedError === \"function\" ? SuppressedError : function (error, suppressed, message) {\r\n var e = new Error(message);\r\n return e.name = \"SuppressedError\", e.error = error, e.suppressed = suppressed, e;\r\n};\r\n\r\nexport function __disposeResources(env) {\r\n function fail(e) {\r\n env.error = env.hasError ? new _SuppressedError(e, env.error, \"An error was suppressed during disposal.\") : e;\r\n env.hasError = true;\r\n }\r\n var r, s = 0;\r\n function next() {\r\n while (r = env.stack.pop()) {\r\n try {\r\n if (!r.async && s === 1) return s = 0, env.stack.push(r), Promise.resolve().then(next);\r\n if (r.dispose) {\r\n var result = r.dispose.call(r.value);\r\n if (r.async) return s |= 2, Promise.resolve(result).then(next, function(e) { fail(e); return next(); });\r\n }\r\n else s |= 1;\r\n }\r\n catch (e) {\r\n fail(e);\r\n }\r\n }\r\n if (s === 1) return env.hasError ? Promise.reject(env.error) : Promise.resolve();\r\n if (env.hasError) throw env.error;\r\n }\r\n return next();\r\n}\r\n\r\nexport function __rewriteRelativeImportExtension(path, preserveJsx) {\r\n if (typeof path === \"string\" && /^\\.\\.?\\//.test(path)) {\r\n return path.replace(/\\.(tsx)$|((?:\\.d)?)((?:\\.[^./]+?)?)\\.([cm]?)ts$/i, function (m, tsx, d, ext, cm) {\r\n return tsx ? preserveJsx ? \".jsx\" : \".js\" : d && (!ext || !cm) ? m : (d + ext + \".\" + cm.toLowerCase() + \"js\");\r\n });\r\n }\r\n return path;\r\n}\r\n\r\nexport default {\r\n __extends: __extends,\r\n __assign: __assign,\r\n __rest: __rest,\r\n __decorate: __decorate,\r\n __param: __param,\r\n __esDecorate: __esDecorate,\r\n __runInitializers: __runInitializers,\r\n __propKey: __propKey,\r\n __setFunctionName: __setFunctionName,\r\n __metadata: __metadata,\r\n __awaiter: __awaiter,\r\n __generator: __generator,\r\n __createBinding: __createBinding,\r\n __exportStar: __exportStar,\r\n __values: __values,\r\n __read: __read,\r\n __spread: __spread,\r\n __spreadArrays: __spreadArrays,\r\n __spreadArray: __spreadArray,\r\n __await: __await,\r\n __asyncGenerator: __asyncGenerator,\r\n __asyncDelegator: __asyncDelegator,\r\n __asyncValues: __asyncValues,\r\n __makeTemplateObject: __makeTemplateObject,\r\n __importStar: __importStar,\r\n __importDefault: __importDefault,\r\n __classPrivateFieldGet: __classPrivateFieldGet,\r\n __classPrivateFieldSet: __classPrivateFieldSet,\r\n __classPrivateFieldIn: __classPrivateFieldIn,\r\n __addDisposableResource: __addDisposableResource,\r\n __disposeResources: __disposeResources,\r\n __rewriteRelativeImportExtension: __rewriteRelativeImportExtension,\r\n};\r\n","/**\n * A curated list of popular Google Fonts.\n * Pass any valid Google Font name to the `font` prop — if it's in this list,\n * it will be auto-injected via a <link> tag. For unlisted fonts, add them here\n * or import them manually in your project.\n */\nexport const GOOGLE_FONTS: string[] = [\n // Serif\n \"Playfair Display\",\n \"Merriweather\",\n \"Lora\",\n \"EB Garamond\",\n \"Libre Baskerville\",\n \"Cormorant Garamond\",\n \"DM Serif Display\",\n \"Crimson Text\",\n \"Source Serif 4\",\n \"Fraunces\",\n\n // Sans-serif\n \"Inter\",\n \"Roboto\",\n \"Open Sans\",\n \"Nunito\",\n \"Poppins\",\n \"Raleway\",\n \"Outfit\",\n \"DM Sans\",\n \"Manrope\",\n \"Plus Jakarta Sans\",\n \"Figtree\",\n \"Syne\",\n \"Albert Sans\",\n\n // Display / Expressive\n \"Bebas Neue\",\n \"Oswald\",\n \"Anton\",\n \"Barlow Condensed\",\n \"Righteous\",\n \"Abril Fatface\",\n \"Dela Gothic One\",\n \"Space Grotesk\",\n \"Unbounded\",\n \"Big Shoulders Display\",\n\n // Mono\n \"JetBrains Mono\",\n \"Fira Code\",\n \"Source Code Pro\",\n \"Space Mono\",\n \"IBM Plex Mono\",\n];\n\nconst injectedFonts = new Set<string>();\n\n/**\n * Builds a Google Fonts URL for a given font family.\n * Requests weights 300, 400, 500, 600, 700, 800 — italic variants included.\n */\nexport function buildFontUrl(fontFamily: string): string {\n const encoded = fontFamily.replace(/ /g, \"+\");\n return `https://fonts.googleapis.com/css2?family=${encoded}:ital,wght@0,300;0,400;0,500;0,600;0,700;0,800;1,400;1,700&display=swap`;\n}\n\n/**\n * Injects a Google Fonts <link> into <head> once per unique URL.\n * Safe to call multiple times — deduped via a Set.\n */\nexport function injectFont(url: string): void {\n if (typeof document === \"undefined\") return; // SSR guard\n if (injectedFonts.has(url)) return;\n\n const link = document.createElement(\"link\");\n link.rel = \"stylesheet\";\n link.href = url;\n document.head.appendChild(link);\n injectedFonts.add(url);\n}\n\n/**\n * Pre-load a set of fonts eagerly (e.g. at app root).\n * Usage: preloadFonts([\"Playfair Display\", \"Inter\"])\n */\nexport function preloadFonts(families: string[]): void {\n families.forEach((f) => {\n if (GOOGLE_FONTS.includes(f)) {\n injectFont(buildFontUrl(f));\n } else {\n console.warn(\n `[react-type-scale] \"${f}\" is not in the bundled GOOGLE_FONTS list. ` +\n `Add it to the list or import it manually.`\n );\n }\n });\n}\n","import React, { CSSProperties } from \"react\";\nimport { TypographyProps, VariantTagMap, VariantStyleMap } from \"./types\";\nimport { GOOGLE_FONTS, buildFontUrl, injectFont } from \"./fonts\";\n\nconst variantTagMap: VariantTagMap = {\n Display: \"h1\",\n H1: \"h1\",\n H2: \"h2\",\n H3: \"h3\",\n H4: \"h4\",\n H5: \"h5\",\n H6: \"h6\",\n Subheading: \"h6\",\n Overline: \"span\",\n Body: \"p\",\n Label: \"label\",\n Caption: \"span\",\n};\n\nconst variantStyleMap: VariantStyleMap = {\n Display: {\n fontSize: \"clamp(2.5rem, 6vw, 5rem)\",\n fontWeight: 800,\n lineHeight: 1.05,\n letterSpacing: \"-0.03em\",\n },\n H1: {\n fontSize: \"clamp(2rem, 4vw, 3rem)\",\n fontWeight: 700,\n lineHeight: 1.1,\n letterSpacing: \"-0.02em\",\n },\n H2: {\n fontSize: \"clamp(1.5rem, 3vw, 2.25rem)\",\n fontWeight: 700,\n lineHeight: 1.2,\n letterSpacing: \"-0.015em\",\n },\n H3: {\n fontSize: \"clamp(1.25rem, 2.5vw, 1.75rem)\",\n fontWeight: 600,\n lineHeight: 1.25,\n letterSpacing: \"-0.01em\",\n },\n H4: {\n fontSize: \"clamp(1.1rem, 2vw, 1.375rem)\",\n fontWeight: 600,\n lineHeight: 1.3,\n letterSpacing: \"-0.005em\",\n },\n H5: {\n fontSize: \"clamp(1rem, 1.5vw, 1.125rem)\",\n fontWeight: 600,\n lineHeight: 1.35,\n letterSpacing: \"0em\",\n },\n H6: {\n fontSize: \"1rem\",\n fontWeight: 600,\n lineHeight: 1.4,\n letterSpacing: \"0em\",\n },\n Subheading: {\n fontSize: \"1.125rem\",\n fontWeight: 500,\n lineHeight: 1.5,\n letterSpacing: \"0.005em\",\n },\n Overline: {\n fontSize: \"0.6875rem\",\n fontWeight: 700,\n lineHeight: 1.6,\n letterSpacing: \"0.12em\",\n textTransform: \"uppercase\" as CSSProperties[\"textTransform\"],\n },\n Body: {\n fontSize: \"1rem\",\n fontWeight: 400,\n lineHeight: 1.7,\n letterSpacing: \"0.01em\",\n },\n Label: {\n fontSize: \"0.875rem\",\n fontWeight: 500,\n lineHeight: 1.5,\n letterSpacing: \"0.02em\",\n },\n Caption: {\n fontSize: \"0.75rem\",\n fontWeight: 400,\n lineHeight: 1.6,\n letterSpacing: \"0.03em\",\n },\n};\n\nexport const Typography: React.FC<TypographyProps> = ({\n variant = \"Body\",\n font,\n color,\n align,\n className,\n style,\n children,\n as,\n truncate,\n maxLines,\n ...rest\n}) => {\n // Inject Google Font if provided and it's a known Google Font\n if (font && GOOGLE_FONTS.includes(font)) {\n injectFont(buildFontUrl(font));\n }\n\n const Tag = (as ?? variantTagMap[variant]) as React.ElementType;\n const baseStyle = variantStyleMap[variant];\n\n const computedStyle: CSSProperties = {\n ...baseStyle,\n ...(font ? { fontFamily: `'${font}', sans-serif` } : {}),\n ...(color ? { color } : {}),\n ...(align ? { textAlign: align } : {}),\n ...(truncate\n ? {\n overflow: \"hidden\",\n textOverflow: \"ellipsis\",\n whiteSpace: \"nowrap\",\n }\n : {}),\n ...(maxLines && !truncate\n ? {\n display: \"-webkit-box\",\n WebkitLineClamp: maxLines,\n WebkitBoxOrient: \"vertical\" as CSSProperties[\"WebkitBoxOrient\"],\n overflow: \"hidden\",\n }\n : {}),\n margin: 0,\n padding: 0,\n ...style,\n };\n\n return (\n <Tag className={className} style={computedStyle} {...rest}>\n {children}\n </Tag>\n );\n};\n\nexport default Typography;\n"],"names":["_jsx"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AA0BA;AACO,SAAS,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE;AAC7B,IAAI,IAAI,CAAC,GAAG,EAAE,CAAC;AACf,IAAI,KAAK,IAAI,CAAC,IAAI,CAAC,EAAE,IAAI,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC;AACvF,QAAQ,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;AACpB,IAAI,IAAI,CAAC,IAAI,IAAI,IAAI,OAAO,MAAM,CAAC,qBAAqB,KAAK,UAAU;AACvE,QAAQ,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,MAAM,CAAC,qBAAqB,CAAC,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;AAChF,YAAY,IAAI,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,MAAM,CAAC,S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CAAA,EAAA,SAAS,EAAE,SAAS,EAAE,KAAK,EAAE,aAAa,EAAM,EAAA,IAAI,cACtD,QAAQ,EAAA,CAAA,CACL,EACN;AACJ;;;;","x_google_ignoreList":[0]}
|
|
1
|
+
{"version":3,"file":"index.esm.js","sources":["../node_modules/tslib/tslib.es6.js","../../fonts.ts","../../animation.ts","../../Typography.tsx"],"sourcesContent":["/******************************************************************************\r\nCopyright (c) Microsoft Corporation.\r\n\r\nPermission to use, copy, modify, and/or distribute this software for any\r\npurpose with or without fee is hereby granted.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\r\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\r\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\r\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\r\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\r\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\r\nPERFORMANCE OF THIS SOFTWARE.\r\n***************************************************************************** */\r\n/* global Reflect, Promise, SuppressedError, Symbol, Iterator */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\r\n return extendStatics(d, b);\r\n};\r\n\r\nexport function __extends(d, b) {\r\n if (typeof b !== \"function\" && b !== null)\r\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\r\n\r\nexport var __assign = function() {\r\n __assign = Object.assign || function __assign(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\r\n }\r\n return t;\r\n }\r\n return __assign.apply(this, arguments);\r\n}\r\n\r\nexport function __rest(s, e) {\r\n var t = {};\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\r\n t[p] = s[p];\r\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\r\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\r\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\r\n t[p[i]] = s[p[i]];\r\n }\r\n return t;\r\n}\r\n\r\nexport function __decorate(decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n}\r\n\r\nexport function __param(paramIndex, decorator) {\r\n return function (target, key) { decorator(target, key, paramIndex); }\r\n}\r\n\r\nexport function __esDecorate(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {\r\n function accept(f) { if (f !== void 0 && typeof f !== \"function\") throw new TypeError(\"Function expected\"); return f; }\r\n var kind = contextIn.kind, key = kind === \"getter\" ? \"get\" : kind === \"setter\" ? \"set\" : \"value\";\r\n var target = !descriptorIn && ctor ? contextIn[\"static\"] ? ctor : ctor.prototype : null;\r\n var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});\r\n var _, done = false;\r\n for (var i = decorators.length - 1; i >= 0; i--) {\r\n var context = {};\r\n for (var p in contextIn) context[p] = p === \"access\" ? {} : contextIn[p];\r\n for (var p in contextIn.access) context.access[p] = contextIn.access[p];\r\n context.addInitializer = function (f) { if (done) throw new TypeError(\"Cannot add initializers after decoration has completed\"); extraInitializers.push(accept(f || null)); };\r\n var result = (0, decorators[i])(kind === \"accessor\" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);\r\n if (kind === \"accessor\") {\r\n if (result === void 0) continue;\r\n if (result === null || typeof result !== \"object\") throw new TypeError(\"Object expected\");\r\n if (_ = accept(result.get)) descriptor.get = _;\r\n if (_ = accept(result.set)) descriptor.set = _;\r\n if (_ = accept(result.init)) initializers.unshift(_);\r\n }\r\n else if (_ = accept(result)) {\r\n if (kind === \"field\") initializers.unshift(_);\r\n else descriptor[key] = _;\r\n }\r\n }\r\n if (target) Object.defineProperty(target, contextIn.name, descriptor);\r\n done = true;\r\n};\r\n\r\nexport function __runInitializers(thisArg, initializers, value) {\r\n var useValue = arguments.length > 2;\r\n for (var i = 0; i < initializers.length; i++) {\r\n value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);\r\n }\r\n return useValue ? value : void 0;\r\n};\r\n\r\nexport function __propKey(x) {\r\n return typeof x === \"symbol\" ? x : \"\".concat(x);\r\n};\r\n\r\nexport function __setFunctionName(f, name, prefix) {\r\n if (typeof name === \"symbol\") name = name.description ? \"[\".concat(name.description, \"]\") : \"\";\r\n return Object.defineProperty(f, \"name\", { configurable: true, value: prefix ? \"\".concat(prefix, \" \", name) : name });\r\n};\r\n\r\nexport function __metadata(metadataKey, metadataValue) {\r\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\r\n}\r\n\r\nexport function __awaiter(thisArg, _arguments, P, generator) {\r\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n}\r\n\r\nexport function __generator(thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === \"function\" ? Iterator : Object).prototype);\r\n return g.next = verb(0), g[\"throw\"] = verb(1), g[\"return\"] = verb(2), typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (g && (g = 0, op[0] && (_ = 0)), _) try {\r\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n}\r\n\r\nexport var __createBinding = Object.create ? (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n var desc = Object.getOwnPropertyDescriptor(m, k);\r\n if (!desc || (\"get\" in desc ? !m.__esModule : desc.writable || desc.configurable)) {\r\n desc = { enumerable: true, get: function() { return m[k]; } };\r\n }\r\n Object.defineProperty(o, k2, desc);\r\n}) : (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n o[k2] = m[k];\r\n});\r\n\r\nexport function __exportStar(m, o) {\r\n for (var p in m) if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p);\r\n}\r\n\r\nexport function __values(o) {\r\n var s = typeof Symbol === \"function\" && Symbol.iterator, m = s && o[s], i = 0;\r\n if (m) return m.call(o);\r\n if (o && typeof o.length === \"number\") return {\r\n next: function () {\r\n if (o && i >= o.length) o = void 0;\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\r\n}\r\n\r\nexport function __read(o, n) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\r\n if (!m) return o;\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\r\n }\r\n catch (error) { e = { error: error }; }\r\n finally {\r\n try {\r\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\r\n }\r\n finally { if (e) throw e.error; }\r\n }\r\n return ar;\r\n}\r\n\r\n/** @deprecated */\r\nexport function __spread() {\r\n for (var ar = [], i = 0; i < arguments.length; i++)\r\n ar = ar.concat(__read(arguments[i]));\r\n return ar;\r\n}\r\n\r\n/** @deprecated */\r\nexport function __spreadArrays() {\r\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\r\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\r\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\r\n r[k] = a[j];\r\n return r;\r\n}\r\n\r\nexport function __spreadArray(to, from, pack) {\r\n if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {\r\n if (ar || !(i in from)) {\r\n if (!ar) ar = Array.prototype.slice.call(from, 0, i);\r\n ar[i] = from[i];\r\n }\r\n }\r\n return to.concat(ar || Array.prototype.slice.call(from));\r\n}\r\n\r\nexport function __await(v) {\r\n return this instanceof __await ? (this.v = v, this) : new __await(v);\r\n}\r\n\r\nexport function __asyncGenerator(thisArg, _arguments, generator) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\r\n return i = Object.create((typeof AsyncIterator === \"function\" ? AsyncIterator : Object).prototype), verb(\"next\"), verb(\"throw\"), verb(\"return\", awaitReturn), i[Symbol.asyncIterator] = function () { return this; }, i;\r\n function awaitReturn(f) { return function (v) { return Promise.resolve(v).then(f, reject); }; }\r\n function verb(n, f) { if (g[n]) { i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; if (f) i[n] = f(i[n]); } }\r\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\r\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\r\n function fulfill(value) { resume(\"next\", value); }\r\n function reject(value) { resume(\"throw\", value); }\r\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\r\n}\r\n\r\nexport function __asyncDelegator(o) {\r\n var i, p;\r\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\r\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: false } : f ? f(v) : v; } : f; }\r\n}\r\n\r\nexport function __asyncValues(o) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var m = o[Symbol.asyncIterator], i;\r\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\r\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\r\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\r\n}\r\n\r\nexport function __makeTemplateObject(cooked, raw) {\r\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\r\n return cooked;\r\n};\r\n\r\nvar __setModuleDefault = Object.create ? (function(o, v) {\r\n Object.defineProperty(o, \"default\", { enumerable: true, value: v });\r\n}) : function(o, v) {\r\n o[\"default\"] = v;\r\n};\r\n\r\nvar ownKeys = function(o) {\r\n ownKeys = Object.getOwnPropertyNames || function (o) {\r\n var ar = [];\r\n for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;\r\n return ar;\r\n };\r\n return ownKeys(o);\r\n};\r\n\r\nexport function __importStar(mod) {\r\n if (mod && mod.__esModule) return mod;\r\n var result = {};\r\n if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== \"default\") __createBinding(result, mod, k[i]);\r\n __setModuleDefault(result, mod);\r\n return result;\r\n}\r\n\r\nexport function __importDefault(mod) {\r\n return (mod && mod.__esModule) ? mod : { default: mod };\r\n}\r\n\r\nexport function __classPrivateFieldGet(receiver, state, kind, f) {\r\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a getter\");\r\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot read private member from an object whose class did not declare it\");\r\n return kind === \"m\" ? f : kind === \"a\" ? f.call(receiver) : f ? f.value : state.get(receiver);\r\n}\r\n\r\nexport function __classPrivateFieldSet(receiver, state, value, kind, f) {\r\n if (kind === \"m\") throw new TypeError(\"Private method is not writable\");\r\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a setter\");\r\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot write private member to an object whose class did not declare it\");\r\n return (kind === \"a\" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;\r\n}\r\n\r\nexport function __classPrivateFieldIn(state, receiver) {\r\n if (receiver === null || (typeof receiver !== \"object\" && typeof receiver !== \"function\")) throw new TypeError(\"Cannot use 'in' operator on non-object\");\r\n return typeof state === \"function\" ? receiver === state : state.has(receiver);\r\n}\r\n\r\nexport function __addDisposableResource(env, value, async) {\r\n if (value !== null && value !== void 0) {\r\n if (typeof value !== \"object\" && typeof value !== \"function\") throw new TypeError(\"Object expected.\");\r\n var dispose, inner;\r\n if (async) {\r\n if (!Symbol.asyncDispose) throw new TypeError(\"Symbol.asyncDispose is not defined.\");\r\n dispose = value[Symbol.asyncDispose];\r\n }\r\n if (dispose === void 0) {\r\n if (!Symbol.dispose) throw new TypeError(\"Symbol.dispose is not defined.\");\r\n dispose = value[Symbol.dispose];\r\n if (async) inner = dispose;\r\n }\r\n if (typeof dispose !== \"function\") throw new TypeError(\"Object not disposable.\");\r\n if (inner) dispose = function() { try { inner.call(this); } catch (e) { return Promise.reject(e); } };\r\n env.stack.push({ value: value, dispose: dispose, async: async });\r\n }\r\n else if (async) {\r\n env.stack.push({ async: true });\r\n }\r\n return value;\r\n\r\n}\r\n\r\nvar _SuppressedError = typeof SuppressedError === \"function\" ? SuppressedError : function (error, suppressed, message) {\r\n var e = new Error(message);\r\n return e.name = \"SuppressedError\", e.error = error, e.suppressed = suppressed, e;\r\n};\r\n\r\nexport function __disposeResources(env) {\r\n function fail(e) {\r\n env.error = env.hasError ? new _SuppressedError(e, env.error, \"An error was suppressed during disposal.\") : e;\r\n env.hasError = true;\r\n }\r\n var r, s = 0;\r\n function next() {\r\n while (r = env.stack.pop()) {\r\n try {\r\n if (!r.async && s === 1) return s = 0, env.stack.push(r), Promise.resolve().then(next);\r\n if (r.dispose) {\r\n var result = r.dispose.call(r.value);\r\n if (r.async) return s |= 2, Promise.resolve(result).then(next, function(e) { fail(e); return next(); });\r\n }\r\n else s |= 1;\r\n }\r\n catch (e) {\r\n fail(e);\r\n }\r\n }\r\n if (s === 1) return env.hasError ? Promise.reject(env.error) : Promise.resolve();\r\n if (env.hasError) throw env.error;\r\n }\r\n return next();\r\n}\r\n\r\nexport function __rewriteRelativeImportExtension(path, preserveJsx) {\r\n if (typeof path === \"string\" && /^\\.\\.?\\//.test(path)) {\r\n return path.replace(/\\.(tsx)$|((?:\\.d)?)((?:\\.[^./]+?)?)\\.([cm]?)ts$/i, function (m, tsx, d, ext, cm) {\r\n return tsx ? preserveJsx ? \".jsx\" : \".js\" : d && (!ext || !cm) ? m : (d + ext + \".\" + cm.toLowerCase() + \"js\");\r\n });\r\n }\r\n return path;\r\n}\r\n\r\nexport default {\r\n __extends: __extends,\r\n __assign: __assign,\r\n __rest: __rest,\r\n __decorate: __decorate,\r\n __param: __param,\r\n __esDecorate: __esDecorate,\r\n __runInitializers: __runInitializers,\r\n __propKey: __propKey,\r\n __setFunctionName: __setFunctionName,\r\n __metadata: __metadata,\r\n __awaiter: __awaiter,\r\n __generator: __generator,\r\n __createBinding: __createBinding,\r\n __exportStar: __exportStar,\r\n __values: __values,\r\n __read: __read,\r\n __spread: __spread,\r\n __spreadArrays: __spreadArrays,\r\n __spreadArray: __spreadArray,\r\n __await: __await,\r\n __asyncGenerator: __asyncGenerator,\r\n __asyncDelegator: __asyncDelegator,\r\n __asyncValues: __asyncValues,\r\n __makeTemplateObject: __makeTemplateObject,\r\n __importStar: __importStar,\r\n __importDefault: __importDefault,\r\n __classPrivateFieldGet: __classPrivateFieldGet,\r\n __classPrivateFieldSet: __classPrivateFieldSet,\r\n __classPrivateFieldIn: __classPrivateFieldIn,\r\n __addDisposableResource: __addDisposableResource,\r\n __disposeResources: __disposeResources,\r\n __rewriteRelativeImportExtension: __rewriteRelativeImportExtension,\r\n};\r\n","/**\n * A curated list of popular Google Fonts.\n * Pass any valid Google Font name to the `font` prop — if it's in this list,\n * it will be auto-injected via a <link> tag. For unlisted fonts, add them here\n * or import them manually in your project.\n */\nexport const GOOGLE_FONTS: string[] = [\n // Serif\n \"Playfair Display\",\n \"Merriweather\",\n \"Lora\",\n \"EB Garamond\",\n \"Libre Baskerville\",\n \"Cormorant Garamond\",\n \"DM Serif Display\",\n \"Crimson Text\",\n \"Source Serif 4\",\n \"Fraunces\",\n\n // Sans-serif\n \"Inter\",\n \"Roboto\",\n \"Open Sans\",\n \"Nunito\",\n \"Poppins\",\n \"Raleway\",\n \"Outfit\",\n \"DM Sans\",\n \"Manrope\",\n \"Plus Jakarta Sans\",\n \"Figtree\",\n \"Syne\",\n \"Albert Sans\",\n\n // Display / Expressive\n \"Bebas Neue\",\n \"Oswald\",\n \"Anton\",\n \"Barlow Condensed\",\n \"Righteous\",\n \"Abril Fatface\",\n \"Dela Gothic One\",\n \"Space Grotesk\",\n \"Unbounded\",\n \"Big Shoulders Display\",\n\n // Mono\n \"JetBrains Mono\",\n \"Fira Code\",\n \"Source Code Pro\",\n \"Space Mono\",\n \"IBM Plex Mono\",\n];\n\nconst injectedFonts = new Set<string>();\n\n/**\n * Builds a Google Fonts URL for a given font family.\n * Requests weights 300, 400, 500, 600, 700, 800 — italic variants included.\n */\nexport function buildFontUrl(fontFamily: string): string {\n const encoded = fontFamily.replace(/ /g, \"+\");\n return `https://fonts.googleapis.com/css2?family=${encoded}:ital,wght@0,300;0,400;0,500;0,600;0,700;0,800;1,400;1,700&display=swap`;\n}\n\n/**\n * Injects a Google Fonts <link> into <head> once per unique URL.\n * Safe to call multiple times — deduped via a Set.\n */\nexport function injectFont(url: string): void {\n if (typeof document === \"undefined\") return; // SSR guard\n if (injectedFonts.has(url)) return;\n\n const link = document.createElement(\"link\");\n link.rel = \"stylesheet\";\n link.href = url;\n document.head.appendChild(link);\n injectedFonts.add(url);\n}\n\n/**\n * Pre-load a set of fonts eagerly (e.g. at app root).\n * Usage: preloadFonts([\"Playfair Display\", \"Inter\"])\n */\nexport function preloadFonts(families: string[]): void {\n families.forEach((f) => {\n if (GOOGLE_FONTS.includes(f)) {\n injectFont(buildFontUrl(f));\n } else {\n console.warn(\n `[react-type-scale] \"${f}\" is not in the bundled GOOGLE_FONTS list. ` +\n `Add it to the list or import it manually.`\n );\n }\n });\n}","import { HeroAnimation } from \"./types\";\n\nconst STYLE_ID = \"rts-hero-animations\";\n\nconst CSS = `\n@keyframes rts-rise{from{opacity:0;transform:translateY(32px)}to{opacity:1;transform:translateY(0)}}\n@keyframes rts-clip{from{clip-path:inset(0 100% 0 0)}to{clip-path:inset(0 0% 0 0)}}\n@keyframes rts-pop{0%{opacity:0;transform:scale(0.75)}60%{opacity:1;transform:scale(1.04)}100%{transform:scale(1)}}\n@keyframes rts-blur{from{opacity:0;filter:blur(14px);transform:scale(1.04)}to{opacity:1;filter:blur(0);transform:scale(1)}}\n@keyframes rts-flip{from{opacity:0;transform:perspective(600px) rotateX(30deg) translateY(20px)}to{opacity:1;transform:perspective(600px) rotateX(0) translateY(0)}}\n@keyframes rts-swipe{from{opacity:0;transform:translateX(60px)}to{opacity:1;transform:translateX(0)}}\n@keyframes rts-bounce{0%{opacity:0;transform:translateY(-60px)}60%{opacity:1;transform:translateY(10px)}80%{transform:translateY(-5px)}100%{transform:translateY(0)}}\n@keyframes rts-type{from{width:0}to{width:100%}}\n@keyframes rts-blink{50%{border-color:transparent}}\n@keyframes rts-word-rise{from{opacity:0;transform:translateY(24px)}to{opacity:1;transform:translateY(0)}}\n@keyframes rts-letter-in{from{opacity:0;transform:translateX(-16px) rotate(-4deg)}to{opacity:1;transform:none}}\n\n.rts-rise{animation:rts-rise 0.9s cubic-bezier(0.16,1,0.3,1) both}\n.rts-clip{animation:rts-clip 1.1s cubic-bezier(0.77,0,0.18,1) both}\n.rts-pop{animation:rts-pop 0.7s cubic-bezier(0.34,1.56,0.64,1) both}\n.rts-blur{animation:rts-blur 1s cubic-bezier(0.16,1,0.3,1) both}\n.rts-flip{animation:rts-flip 0.9s cubic-bezier(0.16,1,0.3,1) both;transform-origin:center bottom}\n.rts-swipe{animation:rts-swipe 0.8s cubic-bezier(0.16,1,0.3,1) both}\n.rts-bounce{animation:rts-bounce 0.9s cubic-bezier(0.36,0.07,0.19,0.97) both}\n.rts-typewriter{overflow:hidden;white-space:nowrap;border-right:2px solid currentColor;width:0;animation:rts-type 1.6s steps(22,end) both,rts-blink 0.7s step-end 1.6s 3}\n.rts-word{display:inline-block;opacity:0;transform:translateY(24px);animation:rts-word-rise 0.7s cubic-bezier(0.16,1,0.3,1) both}\n.rts-letter{display:inline-block;opacity:0;transform:translateX(-16px) rotate(-4deg);animation:rts-letter-in 0.5s cubic-bezier(0.16,1,0.3,1) both}\n`;\n\nexport function injectAnimationStyles(): void {\n if (typeof document === \"undefined\") return;\n if (document.getElementById(STYLE_ID)) return;\n const style = document.createElement(\"style\");\n style.id = STYLE_ID;\n style.textContent = CSS;\n document.head.appendChild(style);\n}\n\nexport function getAnimationClass(animation: HeroAnimation): string {\n const map: Record<HeroAnimation, string> = {\n rise: \"rts-rise\",\n clip: \"rts-clip\",\n pop: \"rts-pop\",\n blur: \"rts-blur\",\n flip: \"rts-flip\",\n swipe: \"rts-swipe\",\n bounce: \"rts-bounce\",\n typewriter: \"rts-typewriter\",\n stagger: \"\",\n letters: \"\",\n };\n return map[animation] ?? \"\";\n}\n\n/**\n * For \"stagger\" — wraps each word in a span with a staggered delay.\n * Preserves <em> tags for italic accent.\n */\nexport function buildStaggerHTML(html: string): string {\n // Split on spaces but keep <em>...</em> intact as single tokens\n const tokens = html.match(/(<em>.*?<\\/em>|[^\\s]+)/g) ?? [];\n return tokens\n .map((tok, i) => {\n const delay = (i * 0.07).toFixed(2);\n if (tok.startsWith(\"<em>\")) {\n return `<em><span class=\"rts-word\" style=\"animation-delay:${delay}s\">${tok.slice(4, -5)}</span></em>`;\n }\n return `<span class=\"rts-word\" style=\"animation-delay:${delay}s\">${tok}</span>`;\n })\n .join(\" \");\n}\n\n/**\n * For \"letters\" — wraps each character in a span with staggered delay.\n * Preserves <em> wrapping for italic accent characters.\n */\nexport function buildLettersHTML(html: string, italic: boolean): string {\n // Parse the raw string into char tokens, tracking whether inside <em>\n const result: string[] = [];\n let inEm = false;\n let delay = 0;\n const step = 0.04;\n\n // Simple char-by-char parse\n let i = 0;\n while (i < html.length) {\n if (html.startsWith(\"<em>\", i)) {\n inEm = true;\n i += 4;\n continue;\n }\n if (html.startsWith(\"</em>\", i)) {\n inEm = false;\n i += 5;\n continue;\n }\n const ch = html[i];\n if (ch === \" \") {\n result.push(\" \");\n i++;\n continue;\n }\n const span = `<span class=\"rts-letter\" style=\"animation-delay:${delay.toFixed(2)}s\">${ch}</span>`;\n result.push(inEm && italic ? `<em>${span}</em>` : span);\n delay += step;\n i++;\n }\n return result.join(\"\");\n}\n","import React, { CSSProperties, useId } from \"react\";\nimport { TypographyProps, VariantTagMap, VariantStyleMap } from \"./types\";\nimport { GOOGLE_FONTS, buildFontUrl, injectFont } from \"./fonts\";\nimport {\n injectAnimationStyles,\n getAnimationClass,\n buildStaggerHTML,\n buildLettersHTML,\n} from \"./animation\";\n\n// ─── Static maps ─────────────────────────────────────────────────────────────\n\nconst variantTagMap: VariantTagMap = {\n Display: \"h1\",\n H1: \"h1\",\n H2: \"h2\",\n H3: \"h3\",\n H4: \"h4\",\n H5: \"h5\",\n H6: \"h6\",\n Subheading: \"h6\",\n Overline: \"span\",\n Body: \"p\",\n Label: \"label\",\n Caption: \"span\",\n};\n\nconst variantStyleMap: VariantStyleMap = {\n Display: {\n fontSize: \"clamp(2.5rem, 6vw, 5rem)\",\n fontWeight: 800,\n lineHeight: 1.05,\n letterSpacing: \"-0.03em\",\n },\n H1: {\n fontSize: \"clamp(2rem, 4vw, 3rem)\",\n fontWeight: 700,\n lineHeight: 1.1,\n letterSpacing: \"-0.02em\",\n },\n H2: {\n fontSize: \"clamp(1.5rem, 3vw, 2.25rem)\",\n fontWeight: 700,\n lineHeight: 1.2,\n letterSpacing: \"-0.015em\",\n },\n H3: {\n fontSize: \"clamp(1.25rem, 2.5vw, 1.75rem)\",\n fontWeight: 600,\n lineHeight: 1.25,\n letterSpacing: \"-0.01em\",\n },\n H4: {\n fontSize: \"clamp(1.1rem, 2vw, 1.375rem)\",\n fontWeight: 600,\n lineHeight: 1.3,\n letterSpacing: \"-0.005em\",\n },\n H5: {\n fontSize: \"clamp(1rem, 1.5vw, 1.125rem)\",\n fontWeight: 600,\n lineHeight: 1.35,\n letterSpacing: \"0em\",\n },\n H6: {\n fontSize: \"1rem\",\n fontWeight: 600,\n lineHeight: 1.4,\n letterSpacing: \"0em\",\n },\n Subheading: {\n fontSize: \"1.125rem\",\n fontWeight: 500,\n lineHeight: 1.5,\n letterSpacing: \"0.005em\",\n },\n Overline: {\n fontSize: \"0.6875rem\",\n fontWeight: 700,\n lineHeight: 1.6,\n letterSpacing: \"0.12em\",\n textTransform: \"uppercase\" as CSSProperties[\"textTransform\"],\n },\n Body: {\n fontSize: \"1rem\",\n fontWeight: 400,\n lineHeight: 1.7,\n letterSpacing: \"0.01em\",\n },\n Label: {\n fontSize: \"0.875rem\",\n fontWeight: 500,\n lineHeight: 1.5,\n letterSpacing: \"0.02em\",\n },\n Caption: {\n fontSize: \"0.75rem\",\n fontWeight: 400,\n lineHeight: 1.6,\n letterSpacing: \"0.03em\",\n },\n};\n\n// ─── Italic accent style injection ──────────────────────────────────────────\n\nconst ITALIC_STYLE_ID = \"rts-italic-accent\";\nconst ITALIC_FONT_URL =\n \"https://fonts.googleapis.com/css2?family=Instrument+Serif:ital@0;1&display=swap\";\n\nfunction injectItalicAccentStyle(accentColor: string): void {\n if (typeof document === \"undefined\") return;\n if (document.getElementById(ITALIC_STYLE_ID)) return;\n injectFont(ITALIC_FONT_URL);\n const style = document.createElement(\"style\");\n style.id = ITALIC_STYLE_ID;\n style.textContent = `\n [data-rts] em {\n font-family: 'Instrument Serif', serif;\n font-style: italic;\n font-weight: 400;\n color: ${accentColor};\n }\n [data-rts-no-italic] em {\n font-family: inherit;\n font-style: normal;\n font-weight: inherit;\n color: inherit;\n }\n `;\n document.head.appendChild(style);\n}\n\n// ─── Component ───────────────────────────────────────────────────────────────\n\nexport const Typography: React.FC<TypographyProps> = ({\n variant = \"Body\",\n font,\n color,\n align,\n className,\n style,\n children,\n as,\n truncate,\n maxLines,\n animation,\n italic = true,\n accentColor = \"#c8b89a\",\n ...rest\n}) => {\n const isHero = variant === \"Display\" || variant === \"H1\";\n\n // Inject Google Font if recognised\n if (font && GOOGLE_FONTS.includes(font)) {\n injectFont(buildFontUrl(font));\n }\n\n // Inject animation keyframes once\n if (animation && isHero) {\n injectAnimationStyles();\n }\n\n // Inject italic accent styles once (always, so toggling italic prop works)\n if (isHero) {\n injectItalicAccentStyle(accentColor);\n }\n\n const Tag = (as ?? variantTagMap[variant]) as React.ElementType;\n const baseStyle = variantStyleMap[variant];\n\n // Build animation class + inner HTML for hero variants\n let animClass = \"\";\n let heroHTML: string | null = null;\n\n if (animation && isHero) {\n const rawHTML =\n typeof children === \"string\"\n ? children\n : React.Children.map(children, (child) => {\n if (typeof child === \"string\") return child;\n if (React.isValidElement(child) && child.type === \"em\") {\n const text =\n typeof child.props.children === \"string\"\n ? child.props.children\n : \"\";\n return `<em>${text}</em>`;\n }\n return \"\";\n })?.join(\"\") ?? \"\";\n\n if (animation === \"stagger\") {\n heroHTML = buildStaggerHTML(rawHTML);\n animClass = \"\";\n } else if (animation === \"letters\") {\n heroHTML = buildLettersHTML(rawHTML, italic);\n animClass = \"\";\n } else {\n heroHTML = rawHTML;\n animClass = getAnimationClass(animation);\n }\n }\n\n const computedStyle: CSSProperties = {\n ...baseStyle,\n ...(font ? { fontFamily: `'${font}', sans-serif` } : {}),\n ...(color ? { color } : {}),\n ...(align ? { textAlign: align } : {}),\n ...(truncate\n ? { overflow: \"hidden\", textOverflow: \"ellipsis\", whiteSpace: \"nowrap\" }\n : {}),\n ...(maxLines && !truncate\n ? {\n display: \"-webkit-box\",\n WebkitLineClamp: maxLines,\n WebkitBoxOrient: \"vertical\" as CSSProperties[\"WebkitBoxOrient\"],\n overflow: \"hidden\",\n }\n : {}),\n margin: 0,\n padding: 0,\n ...style,\n };\n\n const dataAttrs = isHero\n ? { \"data-rts\": \"\", ...(italic ? {} : { \"data-rts-no-italic\": \"\" }) }\n : {};\n\n if (heroHTML !== null) {\n return (\n <Tag\n className={[animClass, className].filter(Boolean).join(\" \")}\n style={computedStyle}\n dangerouslySetInnerHTML={{ __html: heroHTML }}\n {...dataAttrs}\n {...rest}\n />\n );\n }\n\n return (\n <Tag\n className={className}\n style={computedStyle}\n {...dataAttrs}\n {...rest}\n >\n {children}\n </Tag>\n );\n};\n\nexport default Typography;\n"],"names":["_jsx"],"mappings":";;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AA0BA;AACO,SAAS,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE;AAC7B,IAAI,IAAI,CAAC,GAAG,EAAE,CAAC;AACf,IAAI,KAAK,IAAI,CAAC,IAAI,CAAC,EAAE,IAAI,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC;AACvF,QAAQ,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;AACpB,IAAI,IAAI,CAAC,IAAI,IAAI,IAAI,OAAO,MAAM,CAAC,qBAAqB,KAAK,UAAU;AACvE,QAAQ,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,MAAM,CAAC,qBAAqB,CAAC,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,M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CAAC,EACP,CAAA,EAAA,KAAK,CACT,CAAC;IAEF,MAAM,SAAS,GAAG,MAAM;UACrB,MAAA,CAAA,MAAA,CAAA,EAAG,UAAU,EAAE,EAAE,EAAA,GAAM,MAAM,GAAG,EAAE,GAAG,EAAE,oBAAoB,EAAE,EAAE,EAAE,EAClE,GAAE,EAAE,CAAC;AAEP,IAAA,IAAI,QAAQ,KAAK,IAAI,EAAE;AACrB,QAAA,QACEA,GAAC,CAAA,GAAG,EACF,MAAA,CAAA,MAAA,CAAA,EAAA,SAAS,EAAE,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,EAC3D,KAAK,EAAE,aAAa,EACpB,uBAAuB,EAAE,EAAE,MAAM,EAAE,QAAQ,EAAE,EACzC,EAAA,SAAS,EACT,IAAI,CAAA,CACR,EACF;KACH;AAED,IAAA,QACEA,GAAC,CAAA,GAAG,kBACF,SAAS,EAAE,SAAS,EACpB,KAAK,EAAE,aAAa,EAAA,EAChB,SAAS,EACT,IAAI,cAEP,QAAQ,EAAA,CAAA,CACL,EACN;AACJ;;;;","x_google_ignoreList":[0]}
|
package/dist/index.js
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
var jsxRuntime = require('react/jsx-runtime');
|
|
6
|
+
var React = require('react');
|
|
6
7
|
|
|
7
8
|
/******************************************************************************
|
|
8
9
|
Copyright (c) Microsoft Corporation.
|
|
@@ -128,6 +129,113 @@ function preloadFonts(families) {
|
|
|
128
129
|
});
|
|
129
130
|
}
|
|
130
131
|
|
|
132
|
+
const STYLE_ID = "rts-hero-animations";
|
|
133
|
+
const CSS = `
|
|
134
|
+
@keyframes rts-rise{from{opacity:0;transform:translateY(32px)}to{opacity:1;transform:translateY(0)}}
|
|
135
|
+
@keyframes rts-clip{from{clip-path:inset(0 100% 0 0)}to{clip-path:inset(0 0% 0 0)}}
|
|
136
|
+
@keyframes rts-pop{0%{opacity:0;transform:scale(0.75)}60%{opacity:1;transform:scale(1.04)}100%{transform:scale(1)}}
|
|
137
|
+
@keyframes rts-blur{from{opacity:0;filter:blur(14px);transform:scale(1.04)}to{opacity:1;filter:blur(0);transform:scale(1)}}
|
|
138
|
+
@keyframes rts-flip{from{opacity:0;transform:perspective(600px) rotateX(30deg) translateY(20px)}to{opacity:1;transform:perspective(600px) rotateX(0) translateY(0)}}
|
|
139
|
+
@keyframes rts-swipe{from{opacity:0;transform:translateX(60px)}to{opacity:1;transform:translateX(0)}}
|
|
140
|
+
@keyframes rts-bounce{0%{opacity:0;transform:translateY(-60px)}60%{opacity:1;transform:translateY(10px)}80%{transform:translateY(-5px)}100%{transform:translateY(0)}}
|
|
141
|
+
@keyframes rts-type{from{width:0}to{width:100%}}
|
|
142
|
+
@keyframes rts-blink{50%{border-color:transparent}}
|
|
143
|
+
@keyframes rts-word-rise{from{opacity:0;transform:translateY(24px)}to{opacity:1;transform:translateY(0)}}
|
|
144
|
+
@keyframes rts-letter-in{from{opacity:0;transform:translateX(-16px) rotate(-4deg)}to{opacity:1;transform:none}}
|
|
145
|
+
|
|
146
|
+
.rts-rise{animation:rts-rise 0.9s cubic-bezier(0.16,1,0.3,1) both}
|
|
147
|
+
.rts-clip{animation:rts-clip 1.1s cubic-bezier(0.77,0,0.18,1) both}
|
|
148
|
+
.rts-pop{animation:rts-pop 0.7s cubic-bezier(0.34,1.56,0.64,1) both}
|
|
149
|
+
.rts-blur{animation:rts-blur 1s cubic-bezier(0.16,1,0.3,1) both}
|
|
150
|
+
.rts-flip{animation:rts-flip 0.9s cubic-bezier(0.16,1,0.3,1) both;transform-origin:center bottom}
|
|
151
|
+
.rts-swipe{animation:rts-swipe 0.8s cubic-bezier(0.16,1,0.3,1) both}
|
|
152
|
+
.rts-bounce{animation:rts-bounce 0.9s cubic-bezier(0.36,0.07,0.19,0.97) both}
|
|
153
|
+
.rts-typewriter{overflow:hidden;white-space:nowrap;border-right:2px solid currentColor;width:0;animation:rts-type 1.6s steps(22,end) both,rts-blink 0.7s step-end 1.6s 3}
|
|
154
|
+
.rts-word{display:inline-block;opacity:0;transform:translateY(24px);animation:rts-word-rise 0.7s cubic-bezier(0.16,1,0.3,1) both}
|
|
155
|
+
.rts-letter{display:inline-block;opacity:0;transform:translateX(-16px) rotate(-4deg);animation:rts-letter-in 0.5s cubic-bezier(0.16,1,0.3,1) both}
|
|
156
|
+
`;
|
|
157
|
+
function injectAnimationStyles() {
|
|
158
|
+
if (typeof document === "undefined")
|
|
159
|
+
return;
|
|
160
|
+
if (document.getElementById(STYLE_ID))
|
|
161
|
+
return;
|
|
162
|
+
const style = document.createElement("style");
|
|
163
|
+
style.id = STYLE_ID;
|
|
164
|
+
style.textContent = CSS;
|
|
165
|
+
document.head.appendChild(style);
|
|
166
|
+
}
|
|
167
|
+
function getAnimationClass(animation) {
|
|
168
|
+
var _a;
|
|
169
|
+
const map = {
|
|
170
|
+
rise: "rts-rise",
|
|
171
|
+
clip: "rts-clip",
|
|
172
|
+
pop: "rts-pop",
|
|
173
|
+
blur: "rts-blur",
|
|
174
|
+
flip: "rts-flip",
|
|
175
|
+
swipe: "rts-swipe",
|
|
176
|
+
bounce: "rts-bounce",
|
|
177
|
+
typewriter: "rts-typewriter",
|
|
178
|
+
stagger: "",
|
|
179
|
+
letters: "",
|
|
180
|
+
};
|
|
181
|
+
return (_a = map[animation]) !== null && _a !== void 0 ? _a : "";
|
|
182
|
+
}
|
|
183
|
+
/**
|
|
184
|
+
* For "stagger" — wraps each word in a span with a staggered delay.
|
|
185
|
+
* Preserves <em> tags for italic accent.
|
|
186
|
+
*/
|
|
187
|
+
function buildStaggerHTML(html) {
|
|
188
|
+
var _a;
|
|
189
|
+
// Split on spaces but keep <em>...</em> intact as single tokens
|
|
190
|
+
const tokens = (_a = html.match(/(<em>.*?<\/em>|[^\s]+)/g)) !== null && _a !== void 0 ? _a : [];
|
|
191
|
+
return tokens
|
|
192
|
+
.map((tok, i) => {
|
|
193
|
+
const delay = (i * 0.07).toFixed(2);
|
|
194
|
+
if (tok.startsWith("<em>")) {
|
|
195
|
+
return `<em><span class="rts-word" style="animation-delay:${delay}s">${tok.slice(4, -5)}</span></em>`;
|
|
196
|
+
}
|
|
197
|
+
return `<span class="rts-word" style="animation-delay:${delay}s">${tok}</span>`;
|
|
198
|
+
})
|
|
199
|
+
.join(" ");
|
|
200
|
+
}
|
|
201
|
+
/**
|
|
202
|
+
* For "letters" — wraps each character in a span with staggered delay.
|
|
203
|
+
* Preserves <em> wrapping for italic accent characters.
|
|
204
|
+
*/
|
|
205
|
+
function buildLettersHTML(html, italic) {
|
|
206
|
+
// Parse the raw string into char tokens, tracking whether inside <em>
|
|
207
|
+
const result = [];
|
|
208
|
+
let inEm = false;
|
|
209
|
+
let delay = 0;
|
|
210
|
+
const step = 0.04;
|
|
211
|
+
// Simple char-by-char parse
|
|
212
|
+
let i = 0;
|
|
213
|
+
while (i < html.length) {
|
|
214
|
+
if (html.startsWith("<em>", i)) {
|
|
215
|
+
inEm = true;
|
|
216
|
+
i += 4;
|
|
217
|
+
continue;
|
|
218
|
+
}
|
|
219
|
+
if (html.startsWith("</em>", i)) {
|
|
220
|
+
inEm = false;
|
|
221
|
+
i += 5;
|
|
222
|
+
continue;
|
|
223
|
+
}
|
|
224
|
+
const ch = html[i];
|
|
225
|
+
if (ch === " ") {
|
|
226
|
+
result.push(" ");
|
|
227
|
+
i++;
|
|
228
|
+
continue;
|
|
229
|
+
}
|
|
230
|
+
const span = `<span class="rts-letter" style="animation-delay:${delay.toFixed(2)}s">${ch}</span>`;
|
|
231
|
+
result.push(inEm && italic ? `<em>${span}</em>` : span);
|
|
232
|
+
delay += step;
|
|
233
|
+
i++;
|
|
234
|
+
}
|
|
235
|
+
return result.join("");
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
// ─── Static maps ─────────────────────────────────────────────────────────────
|
|
131
239
|
const variantTagMap = {
|
|
132
240
|
Display: "h1",
|
|
133
241
|
H1: "h1",
|
|
@@ -217,20 +325,84 @@ const variantStyleMap = {
|
|
|
217
325
|
letterSpacing: "0.03em",
|
|
218
326
|
},
|
|
219
327
|
};
|
|
328
|
+
// ─── Italic accent style injection ──────────────────────────────────────────
|
|
329
|
+
const ITALIC_STYLE_ID = "rts-italic-accent";
|
|
330
|
+
const ITALIC_FONT_URL = "https://fonts.googleapis.com/css2?family=Instrument+Serif:ital@0;1&display=swap";
|
|
331
|
+
function injectItalicAccentStyle(accentColor) {
|
|
332
|
+
if (typeof document === "undefined")
|
|
333
|
+
return;
|
|
334
|
+
if (document.getElementById(ITALIC_STYLE_ID))
|
|
335
|
+
return;
|
|
336
|
+
injectFont(ITALIC_FONT_URL);
|
|
337
|
+
const style = document.createElement("style");
|
|
338
|
+
style.id = ITALIC_STYLE_ID;
|
|
339
|
+
style.textContent = `
|
|
340
|
+
[data-rts] em {
|
|
341
|
+
font-family: 'Instrument Serif', serif;
|
|
342
|
+
font-style: italic;
|
|
343
|
+
font-weight: 400;
|
|
344
|
+
color: ${accentColor};
|
|
345
|
+
}
|
|
346
|
+
[data-rts-no-italic] em {
|
|
347
|
+
font-family: inherit;
|
|
348
|
+
font-style: normal;
|
|
349
|
+
font-weight: inherit;
|
|
350
|
+
color: inherit;
|
|
351
|
+
}
|
|
352
|
+
`;
|
|
353
|
+
document.head.appendChild(style);
|
|
354
|
+
}
|
|
355
|
+
// ─── Component ───────────────────────────────────────────────────────────────
|
|
220
356
|
const Typography = (_a) => {
|
|
221
|
-
var
|
|
222
|
-
|
|
357
|
+
var _b, _c;
|
|
358
|
+
var { variant = "Body", font, color, align, className, style, children, as, truncate, maxLines, animation, italic = true, accentColor = "#c8b89a" } = _a, rest = __rest(_a, ["variant", "font", "color", "align", "className", "style", "children", "as", "truncate", "maxLines", "animation", "italic", "accentColor"]);
|
|
359
|
+
const isHero = variant === "Display" || variant === "H1";
|
|
360
|
+
// Inject Google Font if recognised
|
|
223
361
|
if (font && GOOGLE_FONTS.includes(font)) {
|
|
224
362
|
injectFont(buildFontUrl(font));
|
|
225
363
|
}
|
|
364
|
+
// Inject animation keyframes once
|
|
365
|
+
if (animation && isHero) {
|
|
366
|
+
injectAnimationStyles();
|
|
367
|
+
}
|
|
368
|
+
// Inject italic accent styles once (always, so toggling italic prop works)
|
|
369
|
+
if (isHero) {
|
|
370
|
+
injectItalicAccentStyle(accentColor);
|
|
371
|
+
}
|
|
226
372
|
const Tag = (as !== null && as !== void 0 ? as : variantTagMap[variant]);
|
|
227
373
|
const baseStyle = variantStyleMap[variant];
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
374
|
+
// Build animation class + inner HTML for hero variants
|
|
375
|
+
let animClass = "";
|
|
376
|
+
let heroHTML = null;
|
|
377
|
+
if (animation && isHero) {
|
|
378
|
+
const rawHTML = typeof children === "string"
|
|
379
|
+
? children
|
|
380
|
+
: (_c = (_b = React.Children.map(children, (child) => {
|
|
381
|
+
if (typeof child === "string")
|
|
382
|
+
return child;
|
|
383
|
+
if (React.isValidElement(child) && child.type === "em") {
|
|
384
|
+
const text = typeof child.props.children === "string"
|
|
385
|
+
? child.props.children
|
|
386
|
+
: "";
|
|
387
|
+
return `<em>${text}</em>`;
|
|
388
|
+
}
|
|
389
|
+
return "";
|
|
390
|
+
})) === null || _b === void 0 ? void 0 : _b.join("")) !== null && _c !== void 0 ? _c : "";
|
|
391
|
+
if (animation === "stagger") {
|
|
392
|
+
heroHTML = buildStaggerHTML(rawHTML);
|
|
393
|
+
animClass = "";
|
|
394
|
+
}
|
|
395
|
+
else if (animation === "letters") {
|
|
396
|
+
heroHTML = buildLettersHTML(rawHTML, italic);
|
|
397
|
+
animClass = "";
|
|
398
|
+
}
|
|
399
|
+
else {
|
|
400
|
+
heroHTML = rawHTML;
|
|
401
|
+
animClass = getAnimationClass(animation);
|
|
233
402
|
}
|
|
403
|
+
}
|
|
404
|
+
const computedStyle = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, baseStyle), (font ? { fontFamily: `'${font}', sans-serif` } : {})), (color ? { color } : {})), (align ? { textAlign: align } : {})), (truncate
|
|
405
|
+
? { overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" }
|
|
234
406
|
: {})), (maxLines && !truncate
|
|
235
407
|
? {
|
|
236
408
|
display: "-webkit-box",
|
|
@@ -239,7 +411,12 @@ const Typography = (_a) => {
|
|
|
239
411
|
overflow: "hidden",
|
|
240
412
|
}
|
|
241
413
|
: {})), { margin: 0, padding: 0 }), style);
|
|
242
|
-
|
|
414
|
+
const dataAttrs = isHero
|
|
415
|
+
? Object.assign({ "data-rts": "" }, (italic ? {} : { "data-rts-no-italic": "" })) : {};
|
|
416
|
+
if (heroHTML !== null) {
|
|
417
|
+
return (jsxRuntime.jsx(Tag, Object.assign({ className: [animClass, className].filter(Boolean).join(" "), style: computedStyle, dangerouslySetInnerHTML: { __html: heroHTML } }, dataAttrs, rest)));
|
|
418
|
+
}
|
|
419
|
+
return (jsxRuntime.jsx(Tag, Object.assign({ className: className, style: computedStyle }, dataAttrs, rest, { children: children })));
|
|
243
420
|
};
|
|
244
421
|
|
|
245
422
|
exports.GOOGLE_FONTS = GOOGLE_FONTS;
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../node_modules/tslib/tslib.es6.js","../../fonts.ts","../../Typography.tsx"],"sourcesContent":["/******************************************************************************\r\nCopyright (c) Microsoft Corporation.\r\n\r\nPermission to use, copy, modify, and/or distribute this software for any\r\npurpose with or without fee is hereby granted.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\r\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\r\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\r\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\r\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\r\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\r\nPERFORMANCE OF THIS SOFTWARE.\r\n***************************************************************************** */\r\n/* global Reflect, Promise, SuppressedError, Symbol, Iterator */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\r\n return extendStatics(d, b);\r\n};\r\n\r\nexport function __extends(d, b) {\r\n if (typeof b !== \"function\" && b !== null)\r\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\r\n\r\nexport var __assign = function() {\r\n __assign = Object.assign || function __assign(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\r\n }\r\n return t;\r\n }\r\n return __assign.apply(this, arguments);\r\n}\r\n\r\nexport function __rest(s, e) {\r\n var t = {};\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\r\n t[p] = s[p];\r\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\r\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\r\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\r\n t[p[i]] = s[p[i]];\r\n }\r\n return t;\r\n}\r\n\r\nexport function __decorate(decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n}\r\n\r\nexport function __param(paramIndex, decorator) {\r\n return function (target, key) { decorator(target, key, paramIndex); }\r\n}\r\n\r\nexport function __esDecorate(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {\r\n function accept(f) { if (f !== void 0 && typeof f !== \"function\") throw new TypeError(\"Function expected\"); return f; }\r\n var kind = contextIn.kind, key = kind === \"getter\" ? \"get\" : kind === \"setter\" ? \"set\" : \"value\";\r\n var target = !descriptorIn && ctor ? contextIn[\"static\"] ? ctor : ctor.prototype : null;\r\n var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});\r\n var _, done = false;\r\n for (var i = decorators.length - 1; i >= 0; i--) {\r\n var context = {};\r\n for (var p in contextIn) context[p] = p === \"access\" ? {} : contextIn[p];\r\n for (var p in contextIn.access) context.access[p] = contextIn.access[p];\r\n context.addInitializer = function (f) { if (done) throw new TypeError(\"Cannot add initializers after decoration has completed\"); extraInitializers.push(accept(f || null)); };\r\n var result = (0, decorators[i])(kind === \"accessor\" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);\r\n if (kind === \"accessor\") {\r\n if (result === void 0) continue;\r\n if (result === null || typeof result !== \"object\") throw new TypeError(\"Object expected\");\r\n if (_ = accept(result.get)) descriptor.get = _;\r\n if (_ = accept(result.set)) descriptor.set = _;\r\n if (_ = accept(result.init)) initializers.unshift(_);\r\n }\r\n else if (_ = accept(result)) {\r\n if (kind === \"field\") initializers.unshift(_);\r\n else descriptor[key] = _;\r\n }\r\n }\r\n if (target) Object.defineProperty(target, contextIn.name, descriptor);\r\n done = true;\r\n};\r\n\r\nexport function __runInitializers(thisArg, initializers, value) {\r\n var useValue = arguments.length > 2;\r\n for (var i = 0; i < initializers.length; i++) {\r\n value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);\r\n }\r\n return useValue ? value : void 0;\r\n};\r\n\r\nexport function __propKey(x) {\r\n return typeof x === \"symbol\" ? x : \"\".concat(x);\r\n};\r\n\r\nexport function __setFunctionName(f, name, prefix) {\r\n if (typeof name === \"symbol\") name = name.description ? \"[\".concat(name.description, \"]\") : \"\";\r\n return Object.defineProperty(f, \"name\", { configurable: true, value: prefix ? \"\".concat(prefix, \" \", name) : name });\r\n};\r\n\r\nexport function __metadata(metadataKey, metadataValue) {\r\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\r\n}\r\n\r\nexport function __awaiter(thisArg, _arguments, P, generator) {\r\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n}\r\n\r\nexport function __generator(thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === \"function\" ? Iterator : Object).prototype);\r\n return g.next = verb(0), g[\"throw\"] = verb(1), g[\"return\"] = verb(2), typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (g && (g = 0, op[0] && (_ = 0)), _) try {\r\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n}\r\n\r\nexport var __createBinding = Object.create ? (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n var desc = Object.getOwnPropertyDescriptor(m, k);\r\n if (!desc || (\"get\" in desc ? !m.__esModule : desc.writable || desc.configurable)) {\r\n desc = { enumerable: true, get: function() { return m[k]; } };\r\n }\r\n Object.defineProperty(o, k2, desc);\r\n}) : (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n o[k2] = m[k];\r\n});\r\n\r\nexport function __exportStar(m, o) {\r\n for (var p in m) if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p);\r\n}\r\n\r\nexport function __values(o) {\r\n var s = typeof Symbol === \"function\" && Symbol.iterator, m = s && o[s], i = 0;\r\n if (m) return m.call(o);\r\n if (o && typeof o.length === \"number\") return {\r\n next: function () {\r\n if (o && i >= o.length) o = void 0;\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\r\n}\r\n\r\nexport function __read(o, n) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\r\n if (!m) return o;\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\r\n }\r\n catch (error) { e = { error: error }; }\r\n finally {\r\n try {\r\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\r\n }\r\n finally { if (e) throw e.error; }\r\n }\r\n return ar;\r\n}\r\n\r\n/** @deprecated */\r\nexport function __spread() {\r\n for (var ar = [], i = 0; i < arguments.length; i++)\r\n ar = ar.concat(__read(arguments[i]));\r\n return ar;\r\n}\r\n\r\n/** @deprecated */\r\nexport function __spreadArrays() {\r\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\r\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\r\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\r\n r[k] = a[j];\r\n return r;\r\n}\r\n\r\nexport function __spreadArray(to, from, pack) {\r\n if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {\r\n if (ar || !(i in from)) {\r\n if (!ar) ar = Array.prototype.slice.call(from, 0, i);\r\n ar[i] = from[i];\r\n }\r\n }\r\n return to.concat(ar || Array.prototype.slice.call(from));\r\n}\r\n\r\nexport function __await(v) {\r\n return this instanceof __await ? (this.v = v, this) : new __await(v);\r\n}\r\n\r\nexport function __asyncGenerator(thisArg, _arguments, generator) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\r\n return i = Object.create((typeof AsyncIterator === \"function\" ? AsyncIterator : Object).prototype), verb(\"next\"), verb(\"throw\"), verb(\"return\", awaitReturn), i[Symbol.asyncIterator] = function () { return this; }, i;\r\n function awaitReturn(f) { return function (v) { return Promise.resolve(v).then(f, reject); }; }\r\n function verb(n, f) { if (g[n]) { i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; if (f) i[n] = f(i[n]); } }\r\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\r\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\r\n function fulfill(value) { resume(\"next\", value); }\r\n function reject(value) { resume(\"throw\", value); }\r\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\r\n}\r\n\r\nexport function __asyncDelegator(o) {\r\n var i, p;\r\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\r\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: false } : f ? f(v) : v; } : f; }\r\n}\r\n\r\nexport function __asyncValues(o) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var m = o[Symbol.asyncIterator], i;\r\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\r\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\r\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\r\n}\r\n\r\nexport function __makeTemplateObject(cooked, raw) {\r\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\r\n return cooked;\r\n};\r\n\r\nvar __setModuleDefault = Object.create ? (function(o, v) {\r\n Object.defineProperty(o, \"default\", { enumerable: true, value: v });\r\n}) : function(o, v) {\r\n o[\"default\"] = v;\r\n};\r\n\r\nvar ownKeys = function(o) {\r\n ownKeys = Object.getOwnPropertyNames || function (o) {\r\n var ar = [];\r\n for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;\r\n return ar;\r\n };\r\n return ownKeys(o);\r\n};\r\n\r\nexport function __importStar(mod) {\r\n if (mod && mod.__esModule) return mod;\r\n var result = {};\r\n if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== \"default\") __createBinding(result, mod, k[i]);\r\n __setModuleDefault(result, mod);\r\n return result;\r\n}\r\n\r\nexport function __importDefault(mod) {\r\n return (mod && mod.__esModule) ? mod : { default: mod };\r\n}\r\n\r\nexport function __classPrivateFieldGet(receiver, state, kind, f) {\r\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a getter\");\r\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot read private member from an object whose class did not declare it\");\r\n return kind === \"m\" ? f : kind === \"a\" ? f.call(receiver) : f ? f.value : state.get(receiver);\r\n}\r\n\r\nexport function __classPrivateFieldSet(receiver, state, value, kind, f) {\r\n if (kind === \"m\") throw new TypeError(\"Private method is not writable\");\r\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a setter\");\r\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot write private member to an object whose class did not declare it\");\r\n return (kind === \"a\" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;\r\n}\r\n\r\nexport function __classPrivateFieldIn(state, receiver) {\r\n if (receiver === null || (typeof receiver !== \"object\" && typeof receiver !== \"function\")) throw new TypeError(\"Cannot use 'in' operator on non-object\");\r\n return typeof state === \"function\" ? receiver === state : state.has(receiver);\r\n}\r\n\r\nexport function __addDisposableResource(env, value, async) {\r\n if (value !== null && value !== void 0) {\r\n if (typeof value !== \"object\" && typeof value !== \"function\") throw new TypeError(\"Object expected.\");\r\n var dispose, inner;\r\n if (async) {\r\n if (!Symbol.asyncDispose) throw new TypeError(\"Symbol.asyncDispose is not defined.\");\r\n dispose = value[Symbol.asyncDispose];\r\n }\r\n if (dispose === void 0) {\r\n if (!Symbol.dispose) throw new TypeError(\"Symbol.dispose is not defined.\");\r\n dispose = value[Symbol.dispose];\r\n if (async) inner = dispose;\r\n }\r\n if (typeof dispose !== \"function\") throw new TypeError(\"Object not disposable.\");\r\n if (inner) dispose = function() { try { inner.call(this); } catch (e) { return Promise.reject(e); } };\r\n env.stack.push({ value: value, dispose: dispose, async: async });\r\n }\r\n else if (async) {\r\n env.stack.push({ async: true });\r\n }\r\n return value;\r\n\r\n}\r\n\r\nvar _SuppressedError = typeof SuppressedError === \"function\" ? SuppressedError : function (error, suppressed, message) {\r\n var e = new Error(message);\r\n return e.name = \"SuppressedError\", e.error = error, e.suppressed = suppressed, e;\r\n};\r\n\r\nexport function __disposeResources(env) {\r\n function fail(e) {\r\n env.error = env.hasError ? new _SuppressedError(e, env.error, \"An error was suppressed during disposal.\") : e;\r\n env.hasError = true;\r\n }\r\n var r, s = 0;\r\n function next() {\r\n while (r = env.stack.pop()) {\r\n try {\r\n if (!r.async && s === 1) return s = 0, env.stack.push(r), Promise.resolve().then(next);\r\n if (r.dispose) {\r\n var result = r.dispose.call(r.value);\r\n if (r.async) return s |= 2, Promise.resolve(result).then(next, function(e) { fail(e); return next(); });\r\n }\r\n else s |= 1;\r\n }\r\n catch (e) {\r\n fail(e);\r\n }\r\n }\r\n if (s === 1) return env.hasError ? Promise.reject(env.error) : Promise.resolve();\r\n if (env.hasError) throw env.error;\r\n }\r\n return next();\r\n}\r\n\r\nexport function __rewriteRelativeImportExtension(path, preserveJsx) {\r\n if (typeof path === \"string\" && /^\\.\\.?\\//.test(path)) {\r\n return path.replace(/\\.(tsx)$|((?:\\.d)?)((?:\\.[^./]+?)?)\\.([cm]?)ts$/i, function (m, tsx, d, ext, cm) {\r\n return tsx ? preserveJsx ? \".jsx\" : \".js\" : d && (!ext || !cm) ? m : (d + ext + \".\" + cm.toLowerCase() + \"js\");\r\n });\r\n }\r\n return path;\r\n}\r\n\r\nexport default {\r\n __extends: __extends,\r\n __assign: __assign,\r\n __rest: __rest,\r\n __decorate: __decorate,\r\n __param: __param,\r\n __esDecorate: __esDecorate,\r\n __runInitializers: __runInitializers,\r\n __propKey: __propKey,\r\n __setFunctionName: __setFunctionName,\r\n __metadata: __metadata,\r\n __awaiter: __awaiter,\r\n __generator: __generator,\r\n __createBinding: __createBinding,\r\n __exportStar: __exportStar,\r\n __values: __values,\r\n __read: __read,\r\n __spread: __spread,\r\n __spreadArrays: __spreadArrays,\r\n __spreadArray: __spreadArray,\r\n __await: __await,\r\n __asyncGenerator: __asyncGenerator,\r\n __asyncDelegator: __asyncDelegator,\r\n __asyncValues: __asyncValues,\r\n __makeTemplateObject: __makeTemplateObject,\r\n __importStar: __importStar,\r\n __importDefault: __importDefault,\r\n __classPrivateFieldGet: __classPrivateFieldGet,\r\n __classPrivateFieldSet: __classPrivateFieldSet,\r\n __classPrivateFieldIn: __classPrivateFieldIn,\r\n __addDisposableResource: __addDisposableResource,\r\n __disposeResources: __disposeResources,\r\n __rewriteRelativeImportExtension: __rewriteRelativeImportExtension,\r\n};\r\n","/**\n * A curated list of popular Google Fonts.\n * Pass any valid Google Font name to the `font` prop — if it's in this list,\n * it will be auto-injected via a <link> tag. For unlisted fonts, add them here\n * or import them manually in your project.\n */\nexport const GOOGLE_FONTS: string[] = [\n // Serif\n \"Playfair Display\",\n \"Merriweather\",\n \"Lora\",\n \"EB Garamond\",\n \"Libre Baskerville\",\n \"Cormorant Garamond\",\n \"DM Serif Display\",\n \"Crimson Text\",\n \"Source Serif 4\",\n \"Fraunces\",\n\n // Sans-serif\n \"Inter\",\n \"Roboto\",\n \"Open Sans\",\n \"Nunito\",\n \"Poppins\",\n \"Raleway\",\n \"Outfit\",\n \"DM Sans\",\n \"Manrope\",\n \"Plus Jakarta Sans\",\n \"Figtree\",\n \"Syne\",\n \"Albert Sans\",\n\n // Display / Expressive\n \"Bebas Neue\",\n \"Oswald\",\n \"Anton\",\n \"Barlow Condensed\",\n \"Righteous\",\n \"Abril Fatface\",\n \"Dela Gothic One\",\n \"Space Grotesk\",\n \"Unbounded\",\n \"Big Shoulders Display\",\n\n // Mono\n \"JetBrains Mono\",\n \"Fira Code\",\n \"Source Code Pro\",\n \"Space Mono\",\n \"IBM Plex Mono\",\n];\n\nconst injectedFonts = new Set<string>();\n\n/**\n * Builds a Google Fonts URL for a given font family.\n * Requests weights 300, 400, 500, 600, 700, 800 — italic variants included.\n */\nexport function buildFontUrl(fontFamily: string): string {\n const encoded = fontFamily.replace(/ /g, \"+\");\n return `https://fonts.googleapis.com/css2?family=${encoded}:ital,wght@0,300;0,400;0,500;0,600;0,700;0,800;1,400;1,700&display=swap`;\n}\n\n/**\n * Injects a Google Fonts <link> into <head> once per unique URL.\n * Safe to call multiple times — deduped via a Set.\n */\nexport function injectFont(url: string): void {\n if (typeof document === \"undefined\") return; // SSR guard\n if (injectedFonts.has(url)) return;\n\n const link = document.createElement(\"link\");\n link.rel = \"stylesheet\";\n link.href = url;\n document.head.appendChild(link);\n injectedFonts.add(url);\n}\n\n/**\n * Pre-load a set of fonts eagerly (e.g. at app root).\n * Usage: preloadFonts([\"Playfair Display\", \"Inter\"])\n */\nexport function preloadFonts(families: string[]): void {\n families.forEach((f) => {\n if (GOOGLE_FONTS.includes(f)) {\n injectFont(buildFontUrl(f));\n } else {\n console.warn(\n `[react-type-scale] \"${f}\" is not in the bundled GOOGLE_FONTS list. ` +\n `Add it to the list or import it manually.`\n );\n }\n });\n}\n","import React, { CSSProperties } from \"react\";\nimport { TypographyProps, VariantTagMap, VariantStyleMap } from \"./types\";\nimport { GOOGLE_FONTS, buildFontUrl, injectFont } from \"./fonts\";\n\nconst variantTagMap: VariantTagMap = {\n Display: \"h1\",\n H1: \"h1\",\n H2: \"h2\",\n H3: \"h3\",\n H4: \"h4\",\n H5: \"h5\",\n H6: \"h6\",\n Subheading: \"h6\",\n Overline: \"span\",\n Body: \"p\",\n Label: \"label\",\n Caption: \"span\",\n};\n\nconst variantStyleMap: VariantStyleMap = {\n Display: {\n fontSize: \"clamp(2.5rem, 6vw, 5rem)\",\n fontWeight: 800,\n lineHeight: 1.05,\n letterSpacing: \"-0.03em\",\n },\n H1: {\n fontSize: \"clamp(2rem, 4vw, 3rem)\",\n fontWeight: 700,\n lineHeight: 1.1,\n letterSpacing: \"-0.02em\",\n },\n H2: {\n fontSize: \"clamp(1.5rem, 3vw, 2.25rem)\",\n fontWeight: 700,\n lineHeight: 1.2,\n letterSpacing: \"-0.015em\",\n },\n H3: {\n fontSize: \"clamp(1.25rem, 2.5vw, 1.75rem)\",\n fontWeight: 600,\n lineHeight: 1.25,\n letterSpacing: \"-0.01em\",\n },\n H4: {\n fontSize: \"clamp(1.1rem, 2vw, 1.375rem)\",\n fontWeight: 600,\n lineHeight: 1.3,\n letterSpacing: \"-0.005em\",\n },\n H5: {\n fontSize: \"clamp(1rem, 1.5vw, 1.125rem)\",\n fontWeight: 600,\n lineHeight: 1.35,\n letterSpacing: \"0em\",\n },\n H6: {\n fontSize: \"1rem\",\n fontWeight: 600,\n lineHeight: 1.4,\n letterSpacing: \"0em\",\n },\n Subheading: {\n fontSize: \"1.125rem\",\n fontWeight: 500,\n lineHeight: 1.5,\n letterSpacing: \"0.005em\",\n },\n Overline: {\n fontSize: \"0.6875rem\",\n fontWeight: 700,\n lineHeight: 1.6,\n letterSpacing: \"0.12em\",\n textTransform: \"uppercase\" as CSSProperties[\"textTransform\"],\n },\n Body: {\n fontSize: \"1rem\",\n fontWeight: 400,\n lineHeight: 1.7,\n letterSpacing: \"0.01em\",\n },\n Label: {\n fontSize: \"0.875rem\",\n fontWeight: 500,\n lineHeight: 1.5,\n letterSpacing: \"0.02em\",\n },\n Caption: {\n fontSize: \"0.75rem\",\n fontWeight: 400,\n lineHeight: 1.6,\n letterSpacing: \"0.03em\",\n },\n};\n\nexport const Typography: React.FC<TypographyProps> = ({\n variant = \"Body\",\n font,\n color,\n align,\n className,\n style,\n children,\n as,\n truncate,\n maxLines,\n ...rest\n}) => {\n // Inject Google Font if provided and it's a known Google Font\n if (font && GOOGLE_FONTS.includes(font)) {\n injectFont(buildFontUrl(font));\n }\n\n const Tag = (as ?? variantTagMap[variant]) as React.ElementType;\n const baseStyle = variantStyleMap[variant];\n\n const computedStyle: CSSProperties = {\n ...baseStyle,\n ...(font ? { fontFamily: `'${font}', sans-serif` } : {}),\n ...(color ? { color } : {}),\n ...(align ? { textAlign: align } : {}),\n ...(truncate\n ? {\n overflow: \"hidden\",\n textOverflow: \"ellipsis\",\n whiteSpace: \"nowrap\",\n }\n : {}),\n ...(maxLines && !truncate\n ? {\n display: \"-webkit-box\",\n WebkitLineClamp: maxLines,\n WebkitBoxOrient: \"vertical\" as CSSProperties[\"WebkitBoxOrient\"],\n overflow: \"hidden\",\n }\n : {}),\n margin: 0,\n padding: 0,\n ...style,\n };\n\n return (\n <Tag className={className} style={computedStyle} {...rest}>\n {children}\n </Tag>\n );\n};\n\nexport default Typography;\n"],"names":["_jsx"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AA0BA;AACO,SAAS,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE;AAC7B,IAAI,IAAI,CAAC,GAAG,EAAE,CAAC;AACf,IAAI,KAAK,IAAI,CAAC,IAAI,CAAC,EAAE,IAAI,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC;AACvF,QAAQ,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;AACpB,IAAI,IAAI,CAAC,IAAI,IAAI,IAAI,OAAO,MAAM,CAAC,qBAAqB,KAAK,UAAU;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AAe,EAAE,QAAQ;AACzB,YAAA,eAAe,EAAE,UAA8C;AAC/D,YAAA,QAAQ,EAAE,QAAQ;AACnB,SAAA;AACH,UAAE,EAAE,EAAC,EAAA,EACP,MAAM,EAAE,CAAC,EACT,OAAO,EAAE,CAAC,EACP,CAAA,EAAA,KAAK,CACT,CAAC;AAEF,IAAA,QACEA,cAAC,CAAA,GAAG,EAAC,MAAA,CAAA,MAAA,CAAA,EAAA,SAAS,EAAE,SAAS,EAAE,KAAK,EAAE,aAAa,EAAM,EAAA,IAAI,cACtD,QAAQ,EAAA,CAAA,CACL,EACN;AACJ;;;;;;;;;","x_google_ignoreList":[0]}
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../node_modules/tslib/tslib.es6.js","../../fonts.ts","../../animation.ts","../../Typography.tsx"],"sourcesContent":["/******************************************************************************\r\nCopyright (c) Microsoft Corporation.\r\n\r\nPermission to use, copy, modify, and/or distribute this software for any\r\npurpose with or without fee is hereby granted.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\r\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\r\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\r\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\r\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\r\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\r\nPERFORMANCE OF THIS SOFTWARE.\r\n***************************************************************************** */\r\n/* global Reflect, Promise, SuppressedError, Symbol, Iterator */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\r\n return extendStatics(d, b);\r\n};\r\n\r\nexport function __extends(d, b) {\r\n if (typeof b !== \"function\" && b !== null)\r\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\r\n\r\nexport var __assign = function() {\r\n __assign = Object.assign || function __assign(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\r\n }\r\n return t;\r\n }\r\n return __assign.apply(this, arguments);\r\n}\r\n\r\nexport function __rest(s, e) {\r\n var t = {};\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\r\n t[p] = s[p];\r\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\r\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\r\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\r\n t[p[i]] = s[p[i]];\r\n }\r\n return t;\r\n}\r\n\r\nexport function __decorate(decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n}\r\n\r\nexport function __param(paramIndex, decorator) {\r\n return function (target, key) { decorator(target, key, paramIndex); }\r\n}\r\n\r\nexport function __esDecorate(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {\r\n function accept(f) { if (f !== void 0 && typeof f !== \"function\") throw new TypeError(\"Function expected\"); return f; }\r\n var kind = contextIn.kind, key = kind === \"getter\" ? \"get\" : kind === \"setter\" ? \"set\" : \"value\";\r\n var target = !descriptorIn && ctor ? contextIn[\"static\"] ? ctor : ctor.prototype : null;\r\n var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});\r\n var _, done = false;\r\n for (var i = decorators.length - 1; i >= 0; i--) {\r\n var context = {};\r\n for (var p in contextIn) context[p] = p === \"access\" ? {} : contextIn[p];\r\n for (var p in contextIn.access) context.access[p] = contextIn.access[p];\r\n context.addInitializer = function (f) { if (done) throw new TypeError(\"Cannot add initializers after decoration has completed\"); extraInitializers.push(accept(f || null)); };\r\n var result = (0, decorators[i])(kind === \"accessor\" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);\r\n if (kind === \"accessor\") {\r\n if (result === void 0) continue;\r\n if (result === null || typeof result !== \"object\") throw new TypeError(\"Object expected\");\r\n if (_ = accept(result.get)) descriptor.get = _;\r\n if (_ = accept(result.set)) descriptor.set = _;\r\n if (_ = accept(result.init)) initializers.unshift(_);\r\n }\r\n else if (_ = accept(result)) {\r\n if (kind === \"field\") initializers.unshift(_);\r\n else descriptor[key] = _;\r\n }\r\n }\r\n if (target) Object.defineProperty(target, contextIn.name, descriptor);\r\n done = true;\r\n};\r\n\r\nexport function __runInitializers(thisArg, initializers, value) {\r\n var useValue = arguments.length > 2;\r\n for (var i = 0; i < initializers.length; i++) {\r\n value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);\r\n }\r\n return useValue ? value : void 0;\r\n};\r\n\r\nexport function __propKey(x) {\r\n return typeof x === \"symbol\" ? x : \"\".concat(x);\r\n};\r\n\r\nexport function __setFunctionName(f, name, prefix) {\r\n if (typeof name === \"symbol\") name = name.description ? \"[\".concat(name.description, \"]\") : \"\";\r\n return Object.defineProperty(f, \"name\", { configurable: true, value: prefix ? \"\".concat(prefix, \" \", name) : name });\r\n};\r\n\r\nexport function __metadata(metadataKey, metadataValue) {\r\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\r\n}\r\n\r\nexport function __awaiter(thisArg, _arguments, P, generator) {\r\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n}\r\n\r\nexport function __generator(thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === \"function\" ? Iterator : Object).prototype);\r\n return g.next = verb(0), g[\"throw\"] = verb(1), g[\"return\"] = verb(2), typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (g && (g = 0, op[0] && (_ = 0)), _) try {\r\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n}\r\n\r\nexport var __createBinding = Object.create ? (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n var desc = Object.getOwnPropertyDescriptor(m, k);\r\n if (!desc || (\"get\" in desc ? !m.__esModule : desc.writable || desc.configurable)) {\r\n desc = { enumerable: true, get: function() { return m[k]; } };\r\n }\r\n Object.defineProperty(o, k2, desc);\r\n}) : (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n o[k2] = m[k];\r\n});\r\n\r\nexport function __exportStar(m, o) {\r\n for (var p in m) if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p);\r\n}\r\n\r\nexport function __values(o) {\r\n var s = typeof Symbol === \"function\" && Symbol.iterator, m = s && o[s], i = 0;\r\n if (m) return m.call(o);\r\n if (o && typeof o.length === \"number\") return {\r\n next: function () {\r\n if (o && i >= o.length) o = void 0;\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\r\n}\r\n\r\nexport function __read(o, n) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\r\n if (!m) return o;\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\r\n }\r\n catch (error) { e = { error: error }; }\r\n finally {\r\n try {\r\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\r\n }\r\n finally { if (e) throw e.error; }\r\n }\r\n return ar;\r\n}\r\n\r\n/** @deprecated */\r\nexport function __spread() {\r\n for (var ar = [], i = 0; i < arguments.length; i++)\r\n ar = ar.concat(__read(arguments[i]));\r\n return ar;\r\n}\r\n\r\n/** @deprecated */\r\nexport function __spreadArrays() {\r\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\r\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\r\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\r\n r[k] = a[j];\r\n return r;\r\n}\r\n\r\nexport function __spreadArray(to, from, pack) {\r\n if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {\r\n if (ar || !(i in from)) {\r\n if (!ar) ar = Array.prototype.slice.call(from, 0, i);\r\n ar[i] = from[i];\r\n }\r\n }\r\n return to.concat(ar || Array.prototype.slice.call(from));\r\n}\r\n\r\nexport function __await(v) {\r\n return this instanceof __await ? (this.v = v, this) : new __await(v);\r\n}\r\n\r\nexport function __asyncGenerator(thisArg, _arguments, generator) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\r\n return i = Object.create((typeof AsyncIterator === \"function\" ? AsyncIterator : Object).prototype), verb(\"next\"), verb(\"throw\"), verb(\"return\", awaitReturn), i[Symbol.asyncIterator] = function () { return this; }, i;\r\n function awaitReturn(f) { return function (v) { return Promise.resolve(v).then(f, reject); }; }\r\n function verb(n, f) { if (g[n]) { i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; if (f) i[n] = f(i[n]); } }\r\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\r\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\r\n function fulfill(value) { resume(\"next\", value); }\r\n function reject(value) { resume(\"throw\", value); }\r\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\r\n}\r\n\r\nexport function __asyncDelegator(o) {\r\n var i, p;\r\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\r\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: false } : f ? f(v) : v; } : f; }\r\n}\r\n\r\nexport function __asyncValues(o) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var m = o[Symbol.asyncIterator], i;\r\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\r\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\r\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\r\n}\r\n\r\nexport function __makeTemplateObject(cooked, raw) {\r\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\r\n return cooked;\r\n};\r\n\r\nvar __setModuleDefault = Object.create ? (function(o, v) {\r\n Object.defineProperty(o, \"default\", { enumerable: true, value: v });\r\n}) : function(o, v) {\r\n o[\"default\"] = v;\r\n};\r\n\r\nvar ownKeys = function(o) {\r\n ownKeys = Object.getOwnPropertyNames || function (o) {\r\n var ar = [];\r\n for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;\r\n return ar;\r\n };\r\n return ownKeys(o);\r\n};\r\n\r\nexport function __importStar(mod) {\r\n if (mod && mod.__esModule) return mod;\r\n var result = {};\r\n if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== \"default\") __createBinding(result, mod, k[i]);\r\n __setModuleDefault(result, mod);\r\n return result;\r\n}\r\n\r\nexport function __importDefault(mod) {\r\n return (mod && mod.__esModule) ? mod : { default: mod };\r\n}\r\n\r\nexport function __classPrivateFieldGet(receiver, state, kind, f) {\r\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a getter\");\r\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot read private member from an object whose class did not declare it\");\r\n return kind === \"m\" ? f : kind === \"a\" ? f.call(receiver) : f ? f.value : state.get(receiver);\r\n}\r\n\r\nexport function __classPrivateFieldSet(receiver, state, value, kind, f) {\r\n if (kind === \"m\") throw new TypeError(\"Private method is not writable\");\r\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a setter\");\r\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot write private member to an object whose class did not declare it\");\r\n return (kind === \"a\" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;\r\n}\r\n\r\nexport function __classPrivateFieldIn(state, receiver) {\r\n if (receiver === null || (typeof receiver !== \"object\" && typeof receiver !== \"function\")) throw new TypeError(\"Cannot use 'in' operator on non-object\");\r\n return typeof state === \"function\" ? receiver === state : state.has(receiver);\r\n}\r\n\r\nexport function __addDisposableResource(env, value, async) {\r\n if (value !== null && value !== void 0) {\r\n if (typeof value !== \"object\" && typeof value !== \"function\") throw new TypeError(\"Object expected.\");\r\n var dispose, inner;\r\n if (async) {\r\n if (!Symbol.asyncDispose) throw new TypeError(\"Symbol.asyncDispose is not defined.\");\r\n dispose = value[Symbol.asyncDispose];\r\n }\r\n if (dispose === void 0) {\r\n if (!Symbol.dispose) throw new TypeError(\"Symbol.dispose is not defined.\");\r\n dispose = value[Symbol.dispose];\r\n if (async) inner = dispose;\r\n }\r\n if (typeof dispose !== \"function\") throw new TypeError(\"Object not disposable.\");\r\n if (inner) dispose = function() { try { inner.call(this); } catch (e) { return Promise.reject(e); } };\r\n env.stack.push({ value: value, dispose: dispose, async: async });\r\n }\r\n else if (async) {\r\n env.stack.push({ async: true });\r\n }\r\n return value;\r\n\r\n}\r\n\r\nvar _SuppressedError = typeof SuppressedError === \"function\" ? SuppressedError : function (error, suppressed, message) {\r\n var e = new Error(message);\r\n return e.name = \"SuppressedError\", e.error = error, e.suppressed = suppressed, e;\r\n};\r\n\r\nexport function __disposeResources(env) {\r\n function fail(e) {\r\n env.error = env.hasError ? new _SuppressedError(e, env.error, \"An error was suppressed during disposal.\") : e;\r\n env.hasError = true;\r\n }\r\n var r, s = 0;\r\n function next() {\r\n while (r = env.stack.pop()) {\r\n try {\r\n if (!r.async && s === 1) return s = 0, env.stack.push(r), Promise.resolve().then(next);\r\n if (r.dispose) {\r\n var result = r.dispose.call(r.value);\r\n if (r.async) return s |= 2, Promise.resolve(result).then(next, function(e) { fail(e); return next(); });\r\n }\r\n else s |= 1;\r\n }\r\n catch (e) {\r\n fail(e);\r\n }\r\n }\r\n if (s === 1) return env.hasError ? Promise.reject(env.error) : Promise.resolve();\r\n if (env.hasError) throw env.error;\r\n }\r\n return next();\r\n}\r\n\r\nexport function __rewriteRelativeImportExtension(path, preserveJsx) {\r\n if (typeof path === \"string\" && /^\\.\\.?\\//.test(path)) {\r\n return path.replace(/\\.(tsx)$|((?:\\.d)?)((?:\\.[^./]+?)?)\\.([cm]?)ts$/i, function (m, tsx, d, ext, cm) {\r\n return tsx ? preserveJsx ? \".jsx\" : \".js\" : d && (!ext || !cm) ? m : (d + ext + \".\" + cm.toLowerCase() + \"js\");\r\n });\r\n }\r\n return path;\r\n}\r\n\r\nexport default {\r\n __extends: __extends,\r\n __assign: __assign,\r\n __rest: __rest,\r\n __decorate: __decorate,\r\n __param: __param,\r\n __esDecorate: __esDecorate,\r\n __runInitializers: __runInitializers,\r\n __propKey: __propKey,\r\n __setFunctionName: __setFunctionName,\r\n __metadata: __metadata,\r\n __awaiter: __awaiter,\r\n __generator: __generator,\r\n __createBinding: __createBinding,\r\n __exportStar: __exportStar,\r\n __values: __values,\r\n __read: __read,\r\n __spread: __spread,\r\n __spreadArrays: __spreadArrays,\r\n __spreadArray: __spreadArray,\r\n __await: __await,\r\n __asyncGenerator: __asyncGenerator,\r\n __asyncDelegator: __asyncDelegator,\r\n __asyncValues: __asyncValues,\r\n __makeTemplateObject: __makeTemplateObject,\r\n __importStar: __importStar,\r\n __importDefault: __importDefault,\r\n __classPrivateFieldGet: __classPrivateFieldGet,\r\n __classPrivateFieldSet: __classPrivateFieldSet,\r\n __classPrivateFieldIn: __classPrivateFieldIn,\r\n __addDisposableResource: __addDisposableResource,\r\n __disposeResources: __disposeResources,\r\n __rewriteRelativeImportExtension: __rewriteRelativeImportExtension,\r\n};\r\n","/**\n * A curated list of popular Google Fonts.\n * Pass any valid Google Font name to the `font` prop — if it's in this list,\n * it will be auto-injected via a <link> tag. For unlisted fonts, add them here\n * or import them manually in your project.\n */\nexport const GOOGLE_FONTS: string[] = [\n // Serif\n \"Playfair Display\",\n \"Merriweather\",\n \"Lora\",\n \"EB Garamond\",\n \"Libre Baskerville\",\n \"Cormorant Garamond\",\n \"DM Serif Display\",\n \"Crimson Text\",\n \"Source Serif 4\",\n \"Fraunces\",\n\n // Sans-serif\n \"Inter\",\n \"Roboto\",\n \"Open Sans\",\n \"Nunito\",\n \"Poppins\",\n \"Raleway\",\n \"Outfit\",\n \"DM Sans\",\n \"Manrope\",\n \"Plus Jakarta Sans\",\n \"Figtree\",\n \"Syne\",\n \"Albert Sans\",\n\n // Display / Expressive\n \"Bebas Neue\",\n \"Oswald\",\n \"Anton\",\n \"Barlow Condensed\",\n \"Righteous\",\n \"Abril Fatface\",\n \"Dela Gothic One\",\n \"Space Grotesk\",\n \"Unbounded\",\n \"Big Shoulders Display\",\n\n // Mono\n \"JetBrains Mono\",\n \"Fira Code\",\n \"Source Code Pro\",\n \"Space Mono\",\n \"IBM Plex Mono\",\n];\n\nconst injectedFonts = new Set<string>();\n\n/**\n * Builds a Google Fonts URL for a given font family.\n * Requests weights 300, 400, 500, 600, 700, 800 — italic variants included.\n */\nexport function buildFontUrl(fontFamily: string): string {\n const encoded = fontFamily.replace(/ /g, \"+\");\n return `https://fonts.googleapis.com/css2?family=${encoded}:ital,wght@0,300;0,400;0,500;0,600;0,700;0,800;1,400;1,700&display=swap`;\n}\n\n/**\n * Injects a Google Fonts <link> into <head> once per unique URL.\n * Safe to call multiple times — deduped via a Set.\n */\nexport function injectFont(url: string): void {\n if (typeof document === \"undefined\") return; // SSR guard\n if (injectedFonts.has(url)) return;\n\n const link = document.createElement(\"link\");\n link.rel = \"stylesheet\";\n link.href = url;\n document.head.appendChild(link);\n injectedFonts.add(url);\n}\n\n/**\n * Pre-load a set of fonts eagerly (e.g. at app root).\n * Usage: preloadFonts([\"Playfair Display\", \"Inter\"])\n */\nexport function preloadFonts(families: string[]): void {\n families.forEach((f) => {\n if (GOOGLE_FONTS.includes(f)) {\n injectFont(buildFontUrl(f));\n } else {\n console.warn(\n `[react-type-scale] \"${f}\" is not in the bundled GOOGLE_FONTS list. ` +\n `Add it to the list or import it manually.`\n );\n }\n });\n}","import { HeroAnimation } from \"./types\";\n\nconst STYLE_ID = \"rts-hero-animations\";\n\nconst CSS = `\n@keyframes rts-rise{from{opacity:0;transform:translateY(32px)}to{opacity:1;transform:translateY(0)}}\n@keyframes rts-clip{from{clip-path:inset(0 100% 0 0)}to{clip-path:inset(0 0% 0 0)}}\n@keyframes rts-pop{0%{opacity:0;transform:scale(0.75)}60%{opacity:1;transform:scale(1.04)}100%{transform:scale(1)}}\n@keyframes rts-blur{from{opacity:0;filter:blur(14px);transform:scale(1.04)}to{opacity:1;filter:blur(0);transform:scale(1)}}\n@keyframes rts-flip{from{opacity:0;transform:perspective(600px) rotateX(30deg) translateY(20px)}to{opacity:1;transform:perspective(600px) rotateX(0) translateY(0)}}\n@keyframes rts-swipe{from{opacity:0;transform:translateX(60px)}to{opacity:1;transform:translateX(0)}}\n@keyframes rts-bounce{0%{opacity:0;transform:translateY(-60px)}60%{opacity:1;transform:translateY(10px)}80%{transform:translateY(-5px)}100%{transform:translateY(0)}}\n@keyframes rts-type{from{width:0}to{width:100%}}\n@keyframes rts-blink{50%{border-color:transparent}}\n@keyframes rts-word-rise{from{opacity:0;transform:translateY(24px)}to{opacity:1;transform:translateY(0)}}\n@keyframes rts-letter-in{from{opacity:0;transform:translateX(-16px) rotate(-4deg)}to{opacity:1;transform:none}}\n\n.rts-rise{animation:rts-rise 0.9s cubic-bezier(0.16,1,0.3,1) both}\n.rts-clip{animation:rts-clip 1.1s cubic-bezier(0.77,0,0.18,1) both}\n.rts-pop{animation:rts-pop 0.7s cubic-bezier(0.34,1.56,0.64,1) both}\n.rts-blur{animation:rts-blur 1s cubic-bezier(0.16,1,0.3,1) both}\n.rts-flip{animation:rts-flip 0.9s cubic-bezier(0.16,1,0.3,1) both;transform-origin:center bottom}\n.rts-swipe{animation:rts-swipe 0.8s cubic-bezier(0.16,1,0.3,1) both}\n.rts-bounce{animation:rts-bounce 0.9s cubic-bezier(0.36,0.07,0.19,0.97) both}\n.rts-typewriter{overflow:hidden;white-space:nowrap;border-right:2px solid currentColor;width:0;animation:rts-type 1.6s steps(22,end) both,rts-blink 0.7s step-end 1.6s 3}\n.rts-word{display:inline-block;opacity:0;transform:translateY(24px);animation:rts-word-rise 0.7s cubic-bezier(0.16,1,0.3,1) both}\n.rts-letter{display:inline-block;opacity:0;transform:translateX(-16px) rotate(-4deg);animation:rts-letter-in 0.5s cubic-bezier(0.16,1,0.3,1) both}\n`;\n\nexport function injectAnimationStyles(): void {\n if (typeof document === \"undefined\") return;\n if (document.getElementById(STYLE_ID)) return;\n const style = document.createElement(\"style\");\n style.id = STYLE_ID;\n style.textContent = CSS;\n document.head.appendChild(style);\n}\n\nexport function getAnimationClass(animation: HeroAnimation): string {\n const map: Record<HeroAnimation, string> = {\n rise: \"rts-rise\",\n clip: \"rts-clip\",\n pop: \"rts-pop\",\n blur: \"rts-blur\",\n flip: \"rts-flip\",\n swipe: \"rts-swipe\",\n bounce: \"rts-bounce\",\n typewriter: \"rts-typewriter\",\n stagger: \"\",\n letters: \"\",\n };\n return map[animation] ?? \"\";\n}\n\n/**\n * For \"stagger\" — wraps each word in a span with a staggered delay.\n * Preserves <em> tags for italic accent.\n */\nexport function buildStaggerHTML(html: string): string {\n // Split on spaces but keep <em>...</em> intact as single tokens\n const tokens = html.match(/(<em>.*?<\\/em>|[^\\s]+)/g) ?? [];\n return tokens\n .map((tok, i) => {\n const delay = (i * 0.07).toFixed(2);\n if (tok.startsWith(\"<em>\")) {\n return `<em><span class=\"rts-word\" style=\"animation-delay:${delay}s\">${tok.slice(4, -5)}</span></em>`;\n }\n return `<span class=\"rts-word\" style=\"animation-delay:${delay}s\">${tok}</span>`;\n })\n .join(\" \");\n}\n\n/**\n * For \"letters\" — wraps each character in a span with staggered delay.\n * Preserves <em> wrapping for italic accent characters.\n */\nexport function buildLettersHTML(html: string, italic: boolean): string {\n // Parse the raw string into char tokens, tracking whether inside <em>\n const result: string[] = [];\n let inEm = false;\n let delay = 0;\n const step = 0.04;\n\n // Simple char-by-char parse\n let i = 0;\n while (i < html.length) {\n if (html.startsWith(\"<em>\", i)) {\n inEm = true;\n i += 4;\n continue;\n }\n if (html.startsWith(\"</em>\", i)) {\n inEm = false;\n i += 5;\n continue;\n }\n const ch = html[i];\n if (ch === \" \") {\n result.push(\" \");\n i++;\n continue;\n }\n const span = `<span class=\"rts-letter\" style=\"animation-delay:${delay.toFixed(2)}s\">${ch}</span>`;\n result.push(inEm && italic ? `<em>${span}</em>` : span);\n delay += step;\n i++;\n }\n return result.join(\"\");\n}\n","import React, { CSSProperties, useId } from \"react\";\nimport { TypographyProps, VariantTagMap, VariantStyleMap } from \"./types\";\nimport { GOOGLE_FONTS, buildFontUrl, injectFont } from \"./fonts\";\nimport {\n injectAnimationStyles,\n getAnimationClass,\n buildStaggerHTML,\n buildLettersHTML,\n} from \"./animation\";\n\n// ─── Static maps ─────────────────────────────────────────────────────────────\n\nconst variantTagMap: VariantTagMap = {\n Display: \"h1\",\n H1: \"h1\",\n H2: \"h2\",\n H3: \"h3\",\n H4: \"h4\",\n H5: \"h5\",\n H6: \"h6\",\n Subheading: \"h6\",\n Overline: \"span\",\n Body: \"p\",\n Label: \"label\",\n Caption: \"span\",\n};\n\nconst variantStyleMap: VariantStyleMap = {\n Display: {\n fontSize: \"clamp(2.5rem, 6vw, 5rem)\",\n fontWeight: 800,\n lineHeight: 1.05,\n letterSpacing: \"-0.03em\",\n },\n H1: {\n fontSize: \"clamp(2rem, 4vw, 3rem)\",\n fontWeight: 700,\n lineHeight: 1.1,\n letterSpacing: \"-0.02em\",\n },\n H2: {\n fontSize: \"clamp(1.5rem, 3vw, 2.25rem)\",\n fontWeight: 700,\n lineHeight: 1.2,\n letterSpacing: \"-0.015em\",\n },\n H3: {\n fontSize: \"clamp(1.25rem, 2.5vw, 1.75rem)\",\n fontWeight: 600,\n lineHeight: 1.25,\n letterSpacing: \"-0.01em\",\n },\n H4: {\n fontSize: \"clamp(1.1rem, 2vw, 1.375rem)\",\n fontWeight: 600,\n lineHeight: 1.3,\n letterSpacing: \"-0.005em\",\n },\n H5: {\n fontSize: \"clamp(1rem, 1.5vw, 1.125rem)\",\n fontWeight: 600,\n lineHeight: 1.35,\n letterSpacing: \"0em\",\n },\n H6: {\n fontSize: \"1rem\",\n fontWeight: 600,\n lineHeight: 1.4,\n letterSpacing: \"0em\",\n },\n Subheading: {\n fontSize: \"1.125rem\",\n fontWeight: 500,\n lineHeight: 1.5,\n letterSpacing: \"0.005em\",\n },\n Overline: {\n fontSize: \"0.6875rem\",\n fontWeight: 700,\n lineHeight: 1.6,\n letterSpacing: \"0.12em\",\n textTransform: \"uppercase\" as CSSProperties[\"textTransform\"],\n },\n Body: {\n fontSize: \"1rem\",\n fontWeight: 400,\n lineHeight: 1.7,\n letterSpacing: \"0.01em\",\n },\n Label: {\n fontSize: \"0.875rem\",\n fontWeight: 500,\n lineHeight: 1.5,\n letterSpacing: \"0.02em\",\n },\n Caption: {\n fontSize: \"0.75rem\",\n fontWeight: 400,\n lineHeight: 1.6,\n letterSpacing: \"0.03em\",\n },\n};\n\n// ─── Italic accent style injection ──────────────────────────────────────────\n\nconst ITALIC_STYLE_ID = \"rts-italic-accent\";\nconst ITALIC_FONT_URL =\n \"https://fonts.googleapis.com/css2?family=Instrument+Serif:ital@0;1&display=swap\";\n\nfunction injectItalicAccentStyle(accentColor: string): void {\n if (typeof document === \"undefined\") return;\n if (document.getElementById(ITALIC_STYLE_ID)) return;\n injectFont(ITALIC_FONT_URL);\n const style = document.createElement(\"style\");\n style.id = ITALIC_STYLE_ID;\n style.textContent = `\n [data-rts] em {\n font-family: 'Instrument Serif', serif;\n font-style: italic;\n font-weight: 400;\n color: ${accentColor};\n }\n [data-rts-no-italic] em {\n font-family: inherit;\n font-style: normal;\n font-weight: inherit;\n color: inherit;\n }\n `;\n document.head.appendChild(style);\n}\n\n// ─── Component ───────────────────────────────────────────────────────────────\n\nexport const Typography: React.FC<TypographyProps> = ({\n variant = \"Body\",\n font,\n color,\n align,\n className,\n style,\n children,\n as,\n truncate,\n maxLines,\n animation,\n italic = true,\n accentColor = \"#c8b89a\",\n ...rest\n}) => {\n const isHero = variant === \"Display\" || variant === \"H1\";\n\n // Inject Google Font if recognised\n if (font && GOOGLE_FONTS.includes(font)) {\n injectFont(buildFontUrl(font));\n }\n\n // Inject animation keyframes once\n if (animation && isHero) {\n injectAnimationStyles();\n }\n\n // Inject italic accent styles once (always, so toggling italic prop works)\n if (isHero) {\n injectItalicAccentStyle(accentColor);\n }\n\n const Tag = (as ?? variantTagMap[variant]) as React.ElementType;\n const baseStyle = variantStyleMap[variant];\n\n // Build animation class + inner HTML for hero variants\n let animClass = \"\";\n let heroHTML: string | null = null;\n\n if (animation && isHero) {\n const rawHTML =\n typeof children === \"string\"\n ? children\n : React.Children.map(children, (child) => {\n if (typeof child === \"string\") return child;\n if (React.isValidElement(child) && child.type === \"em\") {\n const text =\n typeof child.props.children === \"string\"\n ? child.props.children\n : \"\";\n return `<em>${text}</em>`;\n }\n return \"\";\n })?.join(\"\") ?? \"\";\n\n if (animation === \"stagger\") {\n heroHTML = buildStaggerHTML(rawHTML);\n animClass = \"\";\n } else if (animation === \"letters\") {\n heroHTML = buildLettersHTML(rawHTML, italic);\n animClass = \"\";\n } else {\n heroHTML = rawHTML;\n animClass = getAnimationClass(animation);\n }\n }\n\n const computedStyle: CSSProperties = {\n ...baseStyle,\n ...(font ? { fontFamily: `'${font}', sans-serif` } : {}),\n ...(color ? { color } : {}),\n ...(align ? { textAlign: align } : {}),\n ...(truncate\n ? { overflow: \"hidden\", textOverflow: \"ellipsis\", whiteSpace: \"nowrap\" }\n : {}),\n ...(maxLines && !truncate\n ? {\n display: \"-webkit-box\",\n WebkitLineClamp: maxLines,\n WebkitBoxOrient: \"vertical\" as CSSProperties[\"WebkitBoxOrient\"],\n overflow: \"hidden\",\n }\n : {}),\n margin: 0,\n padding: 0,\n ...style,\n };\n\n const dataAttrs = isHero\n ? { \"data-rts\": \"\", ...(italic ? {} : { \"data-rts-no-italic\": \"\" }) }\n : {};\n\n if (heroHTML !== null) {\n return (\n <Tag\n className={[animClass, className].filter(Boolean).join(\" \")}\n style={computedStyle}\n dangerouslySetInnerHTML={{ __html: heroHTML }}\n {...dataAttrs}\n {...rest}\n />\n );\n }\n\n return (\n <Tag\n className={className}\n style={computedStyle}\n {...dataAttrs}\n {...rest}\n >\n {children}\n </Tag>\n );\n};\n\nexport default Typography;\n"],"names":["_jsx"],"mappings":";;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AA0BA;AACO,SAAS,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE;AAC7B,IAAI,IAAI,CAAC,GAAG,EAAE,CAAC;AACf,IAAI,KAAK,IAAI,CAAC,IAAI,CAAC,EAAE,IAAI,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC;AACvF,QAAQ,C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E;UACtE,EAAE,EAAC,GACH,QAAQ,IAAI,CAAC,QAAQ;AACvB,UAAE;AACE,YAAA,OAAO,EAAY,aAAa;AAChC,YAAA,eAAe,EAAI,QAAQ;AAC3B,YAAA,eAAe,EAAI,UAA8C;AACjE,YAAA,QAAQ,EAAW,QAAQ;AAC5B,SAAA;AACH,UAAE,EAAE,EAAC,EAAA,EACP,MAAM,EAAG,CAAC,EACV,OAAO,EAAE,CAAC,EACP,CAAA,EAAA,KAAK,CACT,CAAC;IAEF,MAAM,SAAS,GAAG,MAAM;UACrB,MAAA,CAAA,MAAA,CAAA,EAAG,UAAU,EAAE,EAAE,EAAA,GAAM,MAAM,GAAG,EAAE,GAAG,EAAE,oBAAoB,EAAE,EAAE,EAAE,EAClE,GAAE,EAAE,CAAC;AAEP,IAAA,IAAI,QAAQ,KAAK,IAAI,EAAE;AACrB,QAAA,QACEA,cAAC,CAAA,GAAG,EACF,MAAA,CAAA,MAAA,CAAA,EAAA,SAAS,EAAE,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,EAC3D,KAAK,EAAE,aAAa,EACpB,uBAAuB,EAAE,EAAE,MAAM,EAAE,QAAQ,EAAE,EACzC,EAAA,SAAS,EACT,IAAI,CAAA,CACR,EACF;KACH;AAED,IAAA,QACEA,cAAC,CAAA,GAAG,kBACF,SAAS,EAAE,SAAS,EACpB,KAAK,EAAE,aAAa,EAAA,EAChB,SAAS,EACT,IAAI,cAEP,QAAQ,EAAA,CAAA,CACL,EACN;AACJ;;;;;;;;;","x_google_ignoreList":[0]}
|
package/dist/types.d.ts
CHANGED
|
@@ -1,12 +1,28 @@
|
|
|
1
1
|
import { CSSProperties, ElementType, HTMLAttributes } from "react";
|
|
2
2
|
export type TypographyVariant = "Display" | "H1" | "H2" | "H3" | "H4" | "H5" | "H6" | "Subheading" | "Overline" | "Body" | "Label" | "Caption";
|
|
3
3
|
export type TextAlign = "left" | "center" | "right" | "justify";
|
|
4
|
+
/**
|
|
5
|
+
* Built-in hero text entrance animations.
|
|
6
|
+
* Applied via CSS keyframes — GPU-composited, 60fps safe.
|
|
7
|
+
*
|
|
8
|
+
* rise — smooth upward fade-in (universal default)
|
|
9
|
+
* stagger — each word rises in sequence
|
|
10
|
+
* clip — text unmasked left-to-right (editorial)
|
|
11
|
+
* pop — spring scale-in (energetic)
|
|
12
|
+
* letters — each letter slides in with a slight rotation
|
|
13
|
+
* blur — emerges from a blur (cinematic)
|
|
14
|
+
* flip — 3-D perspective rotate on entry (depth)
|
|
15
|
+
* swipe — slides in from the right
|
|
16
|
+
* typewriter — character-by-character reveal
|
|
17
|
+
* bounce — drops from above with a soft bounce
|
|
18
|
+
*/
|
|
19
|
+
export type HeroAnimation = "rise" | "stagger" | "clip" | "pop" | "letters" | "blur" | "flip" | "swipe" | "typewriter" | "bounce";
|
|
4
20
|
export interface TypographyProps extends HTMLAttributes<HTMLElement> {
|
|
5
21
|
/** Typography scale variant */
|
|
6
22
|
variant?: TypographyVariant;
|
|
7
|
-
/** Google Font name e.g. "
|
|
23
|
+
/** Google Font name e.g. "Bricolage Grotesque", "Playfair Display" */
|
|
8
24
|
font?: string;
|
|
9
|
-
/** Text color — any valid CSS color
|
|
25
|
+
/** Text color — any valid CSS color */
|
|
10
26
|
color?: string;
|
|
11
27
|
/** Text alignment */
|
|
12
28
|
align?: TextAlign;
|
|
@@ -16,6 +32,23 @@ export interface TypographyProps extends HTMLAttributes<HTMLElement> {
|
|
|
16
32
|
truncate?: boolean;
|
|
17
33
|
/** Clamp to N lines with ellipsis */
|
|
18
34
|
maxLines?: number;
|
|
35
|
+
/**
|
|
36
|
+
* Hero entrance animation. Only applies when variant is
|
|
37
|
+
* "Display" or "H1". Injects a CSS class and keyframe stylesheet once.
|
|
38
|
+
*/
|
|
39
|
+
animation?: HeroAnimation;
|
|
40
|
+
/**
|
|
41
|
+
* Italic accent for Display / H1 heroes.
|
|
42
|
+
* When true (default) any <em> child renders in Instrument Serif italic
|
|
43
|
+
* with an accent color. Set to false to render everything in the heading
|
|
44
|
+
* font/weight — no serif, no italics.
|
|
45
|
+
*/
|
|
46
|
+
italic?: boolean;
|
|
47
|
+
/**
|
|
48
|
+
* Accent color for the <em> italic span inside Display / H1.
|
|
49
|
+
* Defaults to a warm sand tone (#c8b89a).
|
|
50
|
+
*/
|
|
51
|
+
accentColor?: string;
|
|
19
52
|
/** Inline style overrides */
|
|
20
53
|
style?: CSSProperties;
|
|
21
54
|
/** Additional class names */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@edwinvakayil/calligraphy",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"description": "A lightweight React + TypeScript typography component with Google Fonts support. Scale from Display to Caption with a single prop.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.esm.js",
|