@edwinvakayil/calligraphy 1.2.6 → 1.4.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.
@@ -1,15 +1,12 @@
1
1
  import { HeroAnimation } from "./types";
2
2
  export declare function injectAnimationStyles(): void;
3
3
  export declare function getAnimationClass(animation: HeroAnimation): string;
4
+ export declare function isSplitAnimation(animation: HeroAnimation): boolean;
4
5
  /**
5
- * Wraps each word in an animated span.
6
- * <em> tokens are preserved as-is in the HTML Typography's useEffect
7
- * will apply inline styles to them after mount.
6
+ * Called by Typography after dangerouslySetInnerHTML for "thread" animation.
7
+ * Stamps the sine-wave Y offset as --ty on each character span.
8
8
  */
9
- export declare function buildStaggerHTML(html: string): string;
10
- /**
11
- * Wraps each character in an animated span.
12
- * <em> tags are preserved in the output — Typography's useEffect applies
13
- * the actual italic/non-italic inline styles after the DOM is ready.
14
- */
15
- export declare function buildLettersHTML(html: string): string;
9
+ export declare function applyThreadOffsets(container: HTMLElement): void;
10
+ export declare function buildSplitHTML(animation: HeroAnimation, html: string): string;
11
+ export declare const buildStaggerHTML: (html: string) => string;
12
+ export declare const buildLettersHTML: (html: string) => string;
package/dist/index.d.ts CHANGED
@@ -1,27 +1,87 @@
1
1
  import React, { HTMLAttributes, ElementType, CSSProperties } from 'react';
2
2
 
3
+ interface TypographyTheme {
4
+ /** Default Google Font for all Typography components */
5
+ font?: string;
6
+ /** Default accent color for <em> italic spans in Display / H1 */
7
+ accentColor?: string;
8
+ /** Default italic setting for Display / H1 heroes */
9
+ italic?: boolean;
10
+ /** Default entrance animation for Display / H1 heroes */
11
+ animation?: HeroAnimation;
12
+ /** Default text color applied to all variants */
13
+ color?: string;
14
+ }
15
+ interface TypographyProviderProps {
16
+ theme: TypographyTheme;
17
+ children: React.ReactNode;
18
+ }
19
+ declare const TypographyProvider: React.FC<TypographyProviderProps>;
20
+
3
21
  type TypographyVariant = "Display" | "H1" | "H2" | "H3" | "H4" | "H5" | "H6" | "Subheading" | "Overline" | "Body" | "Label" | "Caption";
4
22
  type TextAlign = "left" | "center" | "right" | "justify";
5
23
  /**
6
- * Built-in hero text entrance animations.
7
- * Applied via CSS keyframes — GPU-composited, 60fps safe.
24
+ * Hero entrance animations — all GPU-composited (transform + opacity + filter only).
25
+ *
26
+ * ── Batch 1 — originals ──────────────────────────────────────────────────
27
+ * rise smooth upward fade (universal)
28
+ * stagger per-word upward rise in sequence
29
+ * clip text unmasked left to right
30
+ * pop spring scale-in
31
+ * letters each letter slides in with rotation
32
+ * blur emerges from blur
33
+ * flip 3-D rotateX on entry
34
+ * swipe slides in from the right
35
+ * typewriter character-by-character reveal
36
+ * bounce drops from above with bounce
37
+ *
38
+ * ── Batch 2 — modern ─────────────────────────────────────────────────────
39
+ * velvet words drift in with skew
40
+ * curtain each word clips upward
41
+ * morph squash-and-stretch spring
42
+ * ground words emerge from baseline
43
+ * cascade diagonal character waterfall
44
+ * spotlight expands from compressed letterspace
45
+ * ink words fade in with gentle scale
46
+ * hinge words rotate from left edge
47
+ * stretch horizontal rubber-band expand
48
+ * peel bottom-to-top clip per word
49
+ * fold words rotate in on Z from a folded angle
50
+ * shear words skewY then settle
51
+ * ripple words scale from compressed point, elastic outward wave
52
+ * cinch chars pinch on scaleX then snap open with skew
53
+ * tiltrise words rise while untilting from a sideways lean
54
+ * cardFlip chars flip up on X from flat
55
+ * converge outer words fly in, meet in center
56
+ * splitRise alternating words from top/bottom
8
57
  *
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
- * typewritercharacter-by-character reveal
18
- * bounce — drops from above with a soft bounce
58
+ * ── Batch 3 new untouched techniques ───────────────────────────────────
59
+ * tectonic words slam from alternating X sides with skew — collision energy
60
+ * stratify per-word Z-depth flight through blur true depth-of-field
61
+ * unfurl line expands from horizontal center origami opening
62
+ * gravityWell chars fall from sky with micro-rotation physics overshoot
63
+ * orbit words grow from dot while rotating on Z-axis
64
+ * liquid per-word cross-axis squash then spring fluid inertia
65
+ * noiseFade 3 random opacity waveforms per word — signal locking in
66
+ * slab words stamp from left with scaleX print-press energy
67
+ * thread chars float on individual sine-wave Y offsets — musical
68
+ * billboard whole line rotates in on Y-axis — turning sign
69
+ *
70
+ * ── Batch 7 — genuinely new mechanics ────────────────────────────────────
71
+ * glassReveal backdrop-filter blur evaporates as text solidifies
72
+ * wordPop per-word springs from zero scale at its own centre
73
+ * charDrop chars fall under pure gravity — no overshoot or rotation
74
+ * scanline single-pixel horizontal slice expands to full height
75
+ * chromaShift RGB channel offsets collapse to zero (printing-register feel)
76
+ * wordFade per-word cross-dissolve with warmth scale, no Y movement
77
+ * rotateIn full Y-axis card-flip per word (face-up reveal)
78
+ * pressIn presses to 0.92 then springs past 1 (physical button feel)
19
79
  */
20
- type HeroAnimation = "rise" | "stagger" | "clip" | "pop" | "letters" | "blur" | "flip" | "swipe" | "typewriter" | "bounce";
80
+ 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";
21
81
  interface TypographyProps extends HTMLAttributes<HTMLElement> {
22
82
  /** Typography scale variant */
23
83
  variant?: TypographyVariant;
24
- /** Google Font name e.g. "Bricolage Grotesque", "Playfair Display" */
84
+ /** Google Font name auto-injects the Google Fonts <link> */
25
85
  font?: string;
26
86
  /** Text color — any valid CSS color */
27
87
  color?: string;
@@ -31,51 +91,30 @@ interface TypographyProps extends HTMLAttributes<HTMLElement> {
31
91
  as?: ElementType;
32
92
  /** Truncate to single line with ellipsis */
33
93
  truncate?: boolean;
34
- /** Clamp to N lines with ellipsis */
94
+ /** Clamp to N lines */
35
95
  maxLines?: number;
36
96
  /**
37
- * Hero entrance animation. Only applies when variant is
38
- * "Display" or "H1". Injects a CSS class and keyframe stylesheet once.
97
+ * Hero entrance animation.
98
+ * Only applied on variant="Display" or variant="H1".
39
99
  */
40
100
  animation?: HeroAnimation;
41
101
  /**
42
102
  * Italic accent for Display / H1 heroes.
43
- * When true, any <em> child renders in Instrument Serif italic
44
- * with an accent color. Defaults to false — everything renders
45
- * in the heading font/weight with no serif or italics.
103
+ * When true, <em> children render in Instrument Serif italic + accentColor.
104
+ * Default: false.
46
105
  */
47
106
  italic?: boolean;
48
107
  /**
49
- * Accent color for the <em> italic span inside Display / H1.
50
- * Defaults to a warm sand tone (#c8b89a).
108
+ * Color for the <em> italic accent span.
109
+ * Default: "#c8b89a" (warm sand).
51
110
  */
52
111
  accentColor?: string;
53
- /** Inline style overrides */
54
112
  style?: CSSProperties;
55
- /** Additional class names */
56
113
  className?: string;
57
114
  }
58
115
 
59
116
  declare const Typography: React.FC<TypographyProps>;
60
117
 
61
- interface TypographyTheme {
62
- /** Default Google Font for all Typography components */
63
- font?: string;
64
- /** Default accent color for <em> italic spans in Display / H1 */
65
- accentColor?: string;
66
- /** Default italic setting for Display / H1 heroes */
67
- italic?: boolean;
68
- /** Default entrance animation for Display / H1 heroes */
69
- animation?: HeroAnimation;
70
- /** Default text color applied to all variants */
71
- color?: string;
72
- }
73
- interface TypographyProviderProps {
74
- theme: TypographyTheme;
75
- children: React.ReactNode;
76
- }
77
- declare const TypographyProvider: React.FC<TypographyProviderProps>;
78
-
79
118
  /**
80
119
  * A curated list of popular Google Fonts.
81
120
  * Pass any valid Google Font name to the `font` prop — if it's in this list,