@netlify/spark-ui 1.21.1 → 1.23.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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@netlify/spark-ui",
3
3
  "description": "Assets, design tokens, components, and utilities",
4
- "version": "1.21.1",
4
+ "version": "1.23.0",
5
5
  "type": "module",
6
6
  "main": "dist/components/preact/index.js",
7
7
  "types": "dist/components/preact/index.d.ts",
@@ -36,6 +36,7 @@
36
36
  "./analytics": "./packages/analytics/index.ts"
37
37
  },
38
38
  "dependencies": {
39
+ "@astro-community/astro-embed-youtube": "^0.5.10",
39
40
  "@kapaai/react-sdk": "^0.9.0",
40
41
  "@preact/preset-vite": "^2.10.1",
41
42
  "@shikijs/transformers": "^3.3.0",
@@ -137,7 +137,7 @@ const isExternal =
137
137
  }
138
138
 
139
139
  .n-card-link {
140
- --ntl-flow-space: var(--ntl-space-l);
140
+ --ntl-flow-space: var(--ntl-space-m);
141
141
  align-self: flex-start;
142
142
  }
143
143
 
@@ -0,0 +1,141 @@
1
+ ---
2
+ import { YouTube } from '@astro-community/astro-embed-youtube';
3
+
4
+ interface Props {
5
+ id: string;
6
+ title?: string;
7
+ poster?: string;
8
+ params?: string;
9
+ class?: string;
10
+ previewVideo?: string;
11
+ previewVideoWebm?: string;
12
+ }
13
+
14
+ const {
15
+ id,
16
+ title,
17
+ poster,
18
+ params,
19
+ class: className,
20
+ previewVideo,
21
+ previewVideoWebm,
22
+ ...rest
23
+ } = Astro.props;
24
+
25
+ const hasPreviewVideo = previewVideo || previewVideoWebm;
26
+ ---
27
+
28
+ <div class:list={['n-youtube-video', className]} {...rest}>
29
+ <YouTube {id} {title} {poster} {params} />
30
+ {
31
+ hasPreviewVideo && (
32
+ <div class="n-youtube-video__bg-video">
33
+ <video autoplay muted loop playsinline>
34
+ {previewVideoWebm && <source src={previewVideoWebm} type="video/webm" />}
35
+ {previewVideo && <source src={previewVideo} type="video/mp4" />}
36
+ </video>
37
+ </div>
38
+ )
39
+ }
40
+ <div class="n-youtube-video__play-icon" aria-hidden="true" />
41
+ </div>
42
+
43
+ <style>
44
+ /* ── Container ──────────────────────────────────────────────────────── */
45
+
46
+ .n-youtube-video {
47
+ position: relative;
48
+ border-radius: var(--ntl-radius-xl);
49
+ overflow: hidden;
50
+ width: 100%;
51
+ aspect-ratio: 16 / 9;
52
+ }
53
+
54
+ .n-youtube-video :global(lite-youtube) {
55
+ max-width: 100%;
56
+ }
57
+
58
+ /* Suppress the default lite-youtube play button — we render our own */
59
+ .n-youtube-video :global(.lyt-playbtn) {
60
+ display: none;
61
+ }
62
+
63
+ /* ── Play button ────────────────────────────────────────────────────── */
64
+
65
+ .n-youtube-video__play-icon {
66
+ position: absolute;
67
+ top: 50%;
68
+ left: 50%;
69
+ transform: translate(-50%, -50%);
70
+ z-index: 2;
71
+ width: 4rem;
72
+ height: 4rem;
73
+ pointer-events: none;
74
+ }
75
+
76
+ .n-youtube-video__play-icon::after {
77
+ content: '';
78
+ position: absolute;
79
+ inset: 0;
80
+ border-radius: 50%;
81
+ background-color: var(--n-youtube-video-btn-bg, var(--ntl-neutral-800));
82
+ opacity: 0.5;
83
+ box-shadow: 0 2px 12px rgba(0, 0, 0, 0.3);
84
+ transition:
85
+ background-color 300ms ease,
86
+ box-shadow 300ms ease,
87
+ opacity 300ms ease;
88
+ }
89
+
90
+ .n-youtube-video__play-icon::before {
91
+ content: '';
92
+ position: absolute;
93
+ top: 50%;
94
+ left: 50%;
95
+ transform: translate(-50%, calc(-50% + 1px));
96
+ z-index: 1;
97
+ width: 2rem;
98
+ height: 2rem;
99
+ background-color: var(--n-youtube-video-icon-color, var(--ntl-neutral-000));
100
+ mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 640 640'%3E%3Cpath d='M187.2 100.9C174.8 94.1 159.8 94.4 147.6 101.6C135.4 108.8 128 121.9 128 136L128 504C128 518.1 135.5 531.2 147.6 538.4C159.7 545.6 174.8 545.9 187.2 539.1L523.2 355.1C536 348.1 544 334.6 544 320C544 305.4 536 291.9 523.2 284.9L187.2 100.9z'/%3E%3C/svg%3E");
101
+ mask-repeat: no-repeat;
102
+ mask-position: center;
103
+ mask-size: contain;
104
+ }
105
+
106
+ .n-youtube-video:has(lite-youtube:hover) .n-youtube-video__play-icon::after {
107
+ background-color: var(--n-youtube-video-btn-bg-hover, var(--ntl-teal-400, #00c2b0));
108
+ opacity: 0.9;
109
+ box-shadow: 0 0 24px var(--n-youtube-video-btn-bg-hover, var(--ntl-teal-400, #00c2b0));
110
+ }
111
+
112
+ .n-youtube-video:has(lite-youtube.lyt-activated) .n-youtube-video__play-icon {
113
+ display: none;
114
+ }
115
+
116
+ /* ── Preview video overlay ──────────────────────────────────────────── */
117
+
118
+ .n-youtube-video__bg-video {
119
+ position: absolute;
120
+ inset: 0;
121
+ z-index: 1;
122
+ pointer-events: none;
123
+ transition: opacity 300ms ease-in-out;
124
+ }
125
+
126
+ .n-youtube-video__bg-video video {
127
+ width: 100%;
128
+ height: 100%;
129
+ object-fit: cover;
130
+ }
131
+
132
+ .n-youtube-video:has(lite-youtube.lyt-activated) .n-youtube-video__bg-video {
133
+ opacity: 0;
134
+ }
135
+
136
+ @media (prefers-reduced-motion: reduce) {
137
+ .n-youtube-video__bg-video {
138
+ display: none;
139
+ }
140
+ }
141
+ </style>