@m13v/seo-components 0.16.0 → 0.16.2

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@m13v/seo-components",
3
- "version": "0.16.0",
3
+ "version": "0.16.2",
4
4
  "scripts": {
5
5
  "build:css": "tailwind -i src/_build.css -o dist/styles.css --minify",
6
6
  "bump:consumers": "bash scripts/bump-consumers.sh",
@@ -75,36 +75,44 @@ export function FullSiteAnalytics({
75
75
  return;
76
76
  }
77
77
  let cancelled = false;
78
- // Defer init to idle to keep it off the critical path.
79
- const ric =
80
- (typeof window !== "undefined" && window.requestIdleCallback) ||
81
- ((cb: () => void) => setTimeout(cb, 1));
82
- const cic =
83
- (typeof window !== "undefined" && window.cancelIdleCallback) ||
84
- clearTimeout;
85
- const id = ric(
86
- () => {
87
- import("posthog-js").then((mod) => {
88
- if (cancelled) return;
89
- const lib = mod.default;
90
- lib.init(posthogKey, {
91
- api_host: posthogHost,
92
- person_profiles: personProfiles,
93
- capture_pageview: capturePageview,
94
- capture_pageleave: capturePageleave,
95
- });
96
- // Legacy: some helpers still read window.posthog. Setting this
97
- // is what 3 of 4 consumer sites forgot, which silently broke
98
- // newsletter_subscribed and schedule_click events.
99
- (window as unknown as { posthog: typeof lib }).posthog = lib;
100
- setPosthog(lib as unknown as PostHogLike);
78
+ let idleId: number | undefined;
79
+ let timeoutId: ReturnType<typeof setTimeout> | undefined;
80
+
81
+ const run = () => {
82
+ import("posthog-js").then((mod) => {
83
+ if (cancelled) return;
84
+ const lib = mod.default;
85
+ lib.init(posthogKey, {
86
+ api_host: posthogHost,
87
+ person_profiles: personProfiles,
88
+ capture_pageview: capturePageview,
89
+ capture_pageleave: capturePageleave,
101
90
  });
102
- },
103
- { timeout: 3000 },
104
- );
91
+ // Legacy: some helpers still read window.posthog. Setting this
92
+ // is what 3 of 4 consumer sites forgot, which silently broke
93
+ // newsletter_subscribed and schedule_click events.
94
+ (window as unknown as { posthog: typeof lib }).posthog = lib;
95
+ setPosthog(lib as unknown as PostHogLike);
96
+ });
97
+ };
98
+
99
+ // Defer init to idle to keep it off the critical path.
100
+ if (typeof window !== "undefined" && window.requestIdleCallback) {
101
+ idleId = window.requestIdleCallback(run, { timeout: 3000 });
102
+ } else {
103
+ timeoutId = setTimeout(run, 1);
104
+ }
105
+
105
106
  return () => {
106
107
  cancelled = true;
107
- cic(id);
108
+ if (
109
+ idleId !== undefined &&
110
+ typeof window !== "undefined" &&
111
+ window.cancelIdleCallback
112
+ ) {
113
+ window.cancelIdleCallback(idleId);
114
+ }
115
+ if (timeoutId !== undefined) clearTimeout(timeoutId);
108
116
  };
109
117
  }, [
110
118
  posthogKey,
@@ -9,11 +9,42 @@ import { AbsoluteFill, interpolate, spring, useCurrentFrame, useVideoConfig } fr
9
9
  /* gradient background and a growing progress bar. */
10
10
  /* ------------------------------------------------------------------ */
11
11
 
12
+ type RemotionAccent =
13
+ | "teal"
14
+ | "cyan"
15
+ | "orange"
16
+ | "amber"
17
+ | "rose"
18
+ | "pink"
19
+ | "red"
20
+ | "green"
21
+ | "emerald"
22
+ | "blue"
23
+ | "indigo"
24
+ | "violet"
25
+ | "purple";
26
+
27
+ const ACCENT_HEX: Record<RemotionAccent, { from: string; to: string }> = {
28
+ teal: { from: "#14b8a6", to: "#0d9488" },
29
+ cyan: { from: "#06b6d4", to: "#0891b2" },
30
+ orange: { from: "#fb923c", to: "#ea580c" },
31
+ amber: { from: "#fbbf24", to: "#d97706" },
32
+ rose: { from: "#fb7185", to: "#e11d48" },
33
+ pink: { from: "#f472b6", to: "#db2777" },
34
+ red: { from: "#ef4444", to: "#b91c1c" },
35
+ green: { from: "#22c55e", to: "#15803d" },
36
+ emerald: { from: "#10b981", to: "#047857" },
37
+ blue: { from: "#3b82f6", to: "#1d4ed8" },
38
+ indigo: { from: "#6366f1", to: "#4338ca" },
39
+ violet: { from: "#8b5cf6", to: "#6d28d9" },
40
+ purple: { from: "#a855f7", to: "#7e22ce" },
41
+ };
42
+
12
43
  interface ConceptRevealProps {
13
44
  title: string;
14
45
  subtitle?: string;
15
46
  captions: string[];
16
- accent?: "teal" | "cyan";
47
+ accent?: RemotionAccent;
17
48
  /** Override hex color for the primary gradient stop. If set, takes precedence over `accent`. */
18
49
  accentHex?: string;
19
50
  /** Override hex color for the secondary (dark) gradient stop. If set, takes precedence over `accent`. */
@@ -48,8 +79,9 @@ export function ConceptReveal({
48
79
  extrapolateRight: "clamp",
49
80
  });
50
81
 
51
- const bgA = accentHex ?? (accent === "teal" ? "#14b8a6" : "#06b6d4");
52
- const bgB = accentHexDark ?? (accent === "teal" ? "#0d9488" : "#0891b2");
82
+ const palette = ACCENT_HEX[accent] ?? ACCENT_HEX.teal;
83
+ const bgA = accentHex ?? palette.from;
84
+ const bgB = accentHexDark ?? palette.to;
53
85
 
54
86
  return (
55
87
  <AbsoluteFill
@@ -171,7 +203,7 @@ interface RemotionClipProps {
171
203
  title: string;
172
204
  subtitle?: string;
173
205
  captions: string[];
174
- accent?: "teal" | "cyan";
206
+ accent?: RemotionAccent;
175
207
  /** Override hex color for the primary gradient stop. If set, takes precedence over `accent`. */
176
208
  accentHex?: string;
177
209
  /** Override hex color for the secondary (dark) gradient stop. If set, takes precedence over `accent`. */