@edwinvakayil/calligraphy 1.3.0 → 1.5.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/dist/types.d.ts CHANGED
@@ -2,38 +2,142 @@ 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
4
  /**
5
- * Built-in hero text entrance animations.
6
- * Applied via CSS keyframes — GPU-composited, 60fps safe.
5
+ * Hero entrance animations — all GPU-composited (transform + opacity + filter only).
7
6
  *
8
- * — Original
9
- * risesmooth upward fade-in (universal default)
10
- * stagger each word rises in sequence
11
- * cliptext unmasked left-to-right (editorial)
12
- * popspring scale-in (energetic)
13
- * letterseach letter slides in with a slight rotation
14
- * bluremerges from a blur (cinematic)
15
- * flip3-D perspective rotate on entry (depth)
16
- * swipeslides in from the right
17
- * typewritercharacter-by-character reveal
18
- * bouncedrops from above with a soft bounce
7
+ * ── Batch 1 originals ──────────────────────────────────────────────────
8
+ * rise smooth upward fade (universal)
9
+ * stagger per-word upward rise in sequence
10
+ * clip text unmasked left to right
11
+ * pop spring scale-in
12
+ * letters each letter slides in with rotation
13
+ * blur emerges from blur
14
+ * flip 3-D rotateX on entry
15
+ * swipe slides in from the right
16
+ * typewriter character-by-character reveal
17
+ * bounce drops from above with bounce
19
18
  *
20
- * — Modern
21
- * velvetwords drift in with a soft skew (buttery & modern)
22
- * curtaineach word clips upward like a rising curtain
23
- * morphsquash-and-stretch spring (expressive & bold)
24
- * groundwords emerge from behind the baseline (editorial)
25
- * cascadediagonal character waterfall (dynamic & layered)
26
- * spotlightexpands from compressed letterspace (cinematic)
27
- * inkwords fade in with a gentle scale (calm & precise)
28
- * hingewords rotate in from their left edge (mechanical)
29
- * stretchhorizontal rubber-band expand (playful & punchy)
30
- * peelbottom-to-top clip reveal per word (sharp)
19
+ * ── Batch 2 modern ─────────────────────────────────────────────────────
20
+ * velvet words drift in with skew
21
+ * curtain each word clips upward
22
+ * morph squash-and-stretch spring
23
+ * ground words emerge from baseline
24
+ * cascade diagonal character waterfall
25
+ * spotlight expands from compressed letterspace
26
+ * ink words fade in with gentle scale
27
+ * hinge words rotate from left edge
28
+ * stretch horizontal rubber-band expand
29
+ * peel bottom-to-top clip per word
30
+ * fold words rotate in on Z from a folded angle
31
+ * shear words skewY then settle
32
+ * ripple words scale from compressed point, elastic outward wave
33
+ * cinch chars pinch on scaleX then snap open with skew
34
+ * tiltrise words rise while untilting from a sideways lean
35
+ * cardFlip chars flip up on X from flat
36
+ * converge outer words fly in, meet in center
37
+ * splitRise alternating words from top/bottom
38
+ *
39
+ * ── Batch 3 — new untouched techniques ───────────────────────────────────
40
+ * tectonic words slam from alternating X sides with skew — collision energy
41
+ * stratify per-word Z-depth flight through blur — true depth-of-field
42
+ * unfurl line expands from horizontal center — origami opening
43
+ * gravityWell chars fall from sky with micro-rotation physics overshoot
44
+ * orbit words grow from dot while rotating on Z-axis
45
+ * liquid per-word cross-axis squash then spring — fluid inertia
46
+ * noiseFade 3 random opacity waveforms per word — signal locking in
47
+ * slab words stamp from left with scaleX — print-press energy
48
+ * thread chars float on individual sine-wave Y offsets — musical
49
+ * billboard whole line rotates in on Y-axis — turning sign
50
+ *
51
+ * ── Batch 7 — genuinely new mechanics ────────────────────────────────────
52
+ * glassReveal backdrop-filter blur evaporates as text solidifies
53
+ * wordPop per-word springs from zero scale at its own centre
54
+ * charDrop chars fall under pure gravity — no overshoot or rotation
55
+ * scanline single-pixel horizontal slice expands to full height
56
+ * chromaShift RGB channel offsets collapse to zero (printing-register feel)
57
+ * wordFade per-word cross-dissolve with warmth scale, no Y movement
58
+ * rotateIn full Y-axis card-flip per word (face-up reveal)
59
+ * pressIn presses to 0.92 then springs past 1 (physical button feel)
60
+ * maskSweep mask-image sweep reveals text left to right
61
+ * gradSweep gradient sweep across text then resolves to solid
31
62
  */
32
- export type HeroAnimation = "rise" | "stagger" | "clip" | "pop" | "letters" | "blur" | "flip" | "swipe" | "typewriter" | "bounce" | "velvet" | "curtain" | "morph" | "ground" | "cascade" | "spotlight" | "ink" | "hinge" | "stretch" | "peel";
63
+ export type HeroAnimation = "rise" | "stagger" | "clip" | "pop" | "letters" | "blur" | "flip" | "swipe" | "typewriter" | "bounce" | "velvet" | "curtain" | "morph" | "ground" | "cascade" | "spotlight" | "ink" | "hinge" | "stretch" | "peel" | "fold" | "shear" | "ripple" | "cinch" | "tiltrise" | "cardFlip" | "converge" | "splitRise" | "tectonic" | "stratify" | "unfurl" | "gravityWell" | "orbit" | "liquid" | "noiseFade" | "slab" | "thread" | "billboard" | "glassReveal" | "wordPop" | "charDrop" | "scanline" | "chromaShift" | "wordFade" | "rotateIn" | "pressIn" | "maskSweep" | "gradSweep";
64
+ /**
65
+ * Custom motion configuration for a Typography element.
66
+ * Use this when the built-in `animation` presets don't fit your needs —
67
+ * for example when you have brand-specific easing tokens, or when you want
68
+ * to animate a non-hero variant like H2 or Body.
69
+ *
70
+ * @example
71
+ * // Whole-element fade up
72
+ * motionConfig={{
73
+ * keyframes: `from { opacity: 0; transform: translateY(24px); }
74
+ * to { opacity: 1; transform: none; }`,
75
+ * duration: "0.8s",
76
+ * easing: "cubic-bezier(0.16, 1, 0.3, 1)",
77
+ * delay: "0.2s",
78
+ * split: "none",
79
+ * }}
80
+ *
81
+ * @example
82
+ * // Per-word stagger with custom keyframe
83
+ * motionConfig={{
84
+ * keyframes: `from { opacity: 0; transform: skewX(8deg) translateX(-12px); }
85
+ * to { opacity: 1; transform: none; }`,
86
+ * duration: "0.6s",
87
+ * easing: "cubic-bezier(0.16, 1, 0.3, 1)",
88
+ * staggerDelay: 0.08,
89
+ * split: "words",
90
+ * }}
91
+ */
92
+ export interface MotionConfig {
93
+ /**
94
+ * CSS keyframes body — the content between @keyframes name { … }.
95
+ * Do not include the @keyframes rule or a name; the component generates both.
96
+ *
97
+ * @example "from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: none; }"
98
+ */
99
+ keyframes: string;
100
+ /**
101
+ * Animation duration. Accepts any CSS time value.
102
+ * @default "0.8s"
103
+ */
104
+ duration?: string;
105
+ /**
106
+ * CSS easing function.
107
+ * @default "cubic-bezier(0.16, 1, 0.3, 1)"
108
+ */
109
+ easing?: string;
110
+ /**
111
+ * Initial delay before the animation begins.
112
+ * @default "0s"
113
+ */
114
+ delay?: string;
115
+ /**
116
+ * animation-fill-mode value.
117
+ * @default "both"
118
+ */
119
+ fillMode?: "none" | "forwards" | "backwards" | "both";
120
+ /**
121
+ * How to split the text before animating.
122
+ *
123
+ * - "none" — animate the whole element (default)
124
+ * - "words" — wrap each word in a <span> and stagger them
125
+ * - "chars" — wrap each character in a <span> and stagger them
126
+ *
127
+ * @default "none"
128
+ */
129
+ split?: "none" | "words" | "chars";
130
+ /**
131
+ * Delay increment between each word or character span (in seconds).
132
+ * Only used when split is "words" or "chars".
133
+ * @default 0.07 (words) | 0.04 (chars)
134
+ */
135
+ staggerDelay?: number;
136
+ }
33
137
  export interface TypographyProps extends HTMLAttributes<HTMLElement> {
34
138
  /** Typography scale variant */
35
139
  variant?: TypographyVariant;
36
- /** Google Font name e.g. "Bricolage Grotesque", "Playfair Display" */
140
+ /** Google Font name auto-injects the Google Fonts <link> */
37
141
  font?: string;
38
142
  /** Text color — any valid CSS color */
39
143
  color?: string;
@@ -43,28 +147,46 @@ export interface TypographyProps extends HTMLAttributes<HTMLElement> {
43
147
  as?: ElementType;
44
148
  /** Truncate to single line with ellipsis */
45
149
  truncate?: boolean;
46
- /** Clamp to N lines with ellipsis */
150
+ /** Clamp to N lines */
47
151
  maxLines?: number;
48
152
  /**
49
- * Hero entrance animation. Only applies when variant is
50
- * "Display" or "H1". Injects a CSS class and keyframe stylesheet once.
153
+ * Built-in hero entrance animation.
154
+ * Only applied on variant="Display" or variant="H1".
51
155
  */
52
156
  animation?: HeroAnimation;
157
+ /**
158
+ * Custom motion config — use your own keyframes, easing, and split strategy.
159
+ * Works on ALL variants (not just heroes).
160
+ * Takes precedence over `animation` when both are provided.
161
+ *
162
+ * @see MotionConfig
163
+ */
164
+ motionConfig?: MotionConfig;
165
+ /**
166
+ * Ref callback giving direct access to the rendered DOM element.
167
+ * Use this to drive animations with GSAP, Framer Motion, or the Web
168
+ * Animations API. Called after mount and on every re-render.
169
+ * Takes precedence over both `animation` and `motionConfig`.
170
+ *
171
+ * @example
172
+ * motionRef={(el) => {
173
+ * if (!el) return;
174
+ * gsap.from(el, { opacity: 0, y: 40, duration: 0.9 });
175
+ * }}
176
+ */
177
+ motionRef?: (el: HTMLElement | null) => void;
53
178
  /**
54
179
  * Italic accent for Display / H1 heroes.
55
- * When true, any <em> child renders in Instrument Serif italic
56
- * with an accent color. Defaults to false — everything renders
57
- * in the heading font/weight with no serif or italics.
180
+ * When true, <em> children render in Instrument Serif italic + accentColor.
181
+ * Default: false.
58
182
  */
59
183
  italic?: boolean;
60
184
  /**
61
- * Accent color for the <em> italic span inside Display / H1.
62
- * Defaults to a warm sand tone (#c8b89a).
185
+ * Color for the <em> italic accent span.
186
+ * Default: "#c8b89a" (warm sand).
63
187
  */
64
188
  accentColor?: string;
65
- /** Inline style overrides */
66
189
  style?: CSSProperties;
67
- /** Additional class names */
68
190
  className?: string;
69
191
  }
70
192
  export type VariantTagMap = Record<TypographyVariant, keyof JSX.IntrinsicElements>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@edwinvakayil/calligraphy",
3
- "version": "1.3.0",
3
+ "version": "1.5.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",