@imput/helium-prism 0.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/LICENSE +673 -0
- package/README.md +77 -0
- package/dist/components/Button.svelte +38 -0
- package/dist/components/Button.svelte.d.ts +13 -0
- package/dist/components/Button.svelte.d.ts.map +1 -0
- package/dist/components/CardLink.svelte +41 -0
- package/dist/components/CardLink.svelte.d.ts +11 -0
- package/dist/components/CardLink.svelte.d.ts.map +1 -0
- package/dist/components/Checkbox.svelte +151 -0
- package/dist/components/Checkbox.svelte.d.ts +23 -0
- package/dist/components/Checkbox.svelte.d.ts.map +1 -0
- package/dist/components/CopyIcon.svelte +71 -0
- package/dist/components/CopyIcon.svelte.d.ts +10 -0
- package/dist/components/CopyIcon.svelte.d.ts.map +1 -0
- package/dist/components/Dropdown.svelte +128 -0
- package/dist/components/Dropdown.svelte.d.ts +32 -0
- package/dist/components/Dropdown.svelte.d.ts.map +1 -0
- package/dist/components/GradientShimmer.svelte +467 -0
- package/dist/components/GradientShimmer.svelte.d.ts +13 -0
- package/dist/components/GradientShimmer.svelte.d.ts.map +1 -0
- package/dist/components/HeliumLogo.svelte +40 -0
- package/dist/components/HeliumLogo.svelte.d.ts +10 -0
- package/dist/components/HeliumLogo.svelte.d.ts.map +1 -0
- package/dist/components/Input.svelte +117 -0
- package/dist/components/Input.svelte.d.ts +17 -0
- package/dist/components/Input.svelte.d.ts.map +1 -0
- package/dist/components/OuterLink.svelte +30 -0
- package/dist/components/OuterLink.svelte.d.ts +10 -0
- package/dist/components/OuterLink.svelte.d.ts.map +1 -0
- package/dist/components/SearchBar.svelte +68 -0
- package/dist/components/SearchBar.svelte.d.ts +15 -0
- package/dist/components/SearchBar.svelte.d.ts.map +1 -0
- package/dist/components/Skeleton.svelte +47 -0
- package/dist/components/Skeleton.svelte.d.ts +10 -0
- package/dist/components/Skeleton.svelte.d.ts.map +1 -0
- package/dist/components/Spinner.svelte +44 -0
- package/dist/components/Spinner.svelte.d.ts +9 -0
- package/dist/components/Spinner.svelte.d.ts.map +1 -0
- package/dist/components/Text.svelte +83 -0
- package/dist/components/Text.svelte.d.ts +24 -0
- package/dist/components/Text.svelte.d.ts.map +1 -0
- package/dist/components/Toggle.svelte +109 -0
- package/dist/components/Toggle.svelte.d.ts +19 -0
- package/dist/components/Toggle.svelte.d.ts.map +1 -0
- package/dist/components/Tooltip.svelte +130 -0
- package/dist/components/Tooltip.svelte.d.ts +10 -0
- package/dist/components/Tooltip.svelte.d.ts.map +1 -0
- package/dist/components/icons/IconArrowDown.svelte +15 -0
- package/dist/components/icons/IconArrowDown.svelte.d.ts +27 -0
- package/dist/components/icons/IconArrowDown.svelte.d.ts.map +1 -0
- package/dist/components/icons/IconArrowLeft.svelte +15 -0
- package/dist/components/icons/IconArrowLeft.svelte.d.ts +27 -0
- package/dist/components/icons/IconArrowLeft.svelte.d.ts.map +1 -0
- package/dist/components/icons/IconArrowRight.svelte +15 -0
- package/dist/components/icons/IconArrowRight.svelte.d.ts +27 -0
- package/dist/components/icons/IconArrowRight.svelte.d.ts.map +1 -0
- package/dist/components/icons/IconArrowUp.svelte +15 -0
- package/dist/components/icons/IconArrowUp.svelte.d.ts +27 -0
- package/dist/components/icons/IconArrowUp.svelte.d.ts.map +1 -0
- package/dist/components/icons/IconBang.svelte +16 -0
- package/dist/components/icons/IconBang.svelte.d.ts +27 -0
- package/dist/components/icons/IconBang.svelte.d.ts.map +1 -0
- package/dist/components/icons/IconCheck.svelte +13 -0
- package/dist/components/icons/IconCheck.svelte.d.ts +27 -0
- package/dist/components/icons/IconCheck.svelte.d.ts.map +1 -0
- package/dist/components/icons/IconChevronDown.svelte +13 -0
- package/dist/components/icons/IconChevronDown.svelte.d.ts +27 -0
- package/dist/components/icons/IconChevronDown.svelte.d.ts.map +1 -0
- package/dist/components/icons/IconCopy.svelte +18 -0
- package/dist/components/icons/IconCopy.svelte.d.ts +27 -0
- package/dist/components/icons/IconCopy.svelte.d.ts.map +1 -0
- package/dist/components/icons/IconDownload.svelte +15 -0
- package/dist/components/icons/IconDownload.svelte.d.ts +27 -0
- package/dist/components/icons/IconDownload.svelte.d.ts.map +1 -0
- package/dist/components/icons/IconExternalLink.svelte +15 -0
- package/dist/components/icons/IconExternalLink.svelte.d.ts +27 -0
- package/dist/components/icons/IconExternalLink.svelte.d.ts.map +1 -0
- package/dist/components/icons/IconInfo.svelte +15 -0
- package/dist/components/icons/IconInfo.svelte.d.ts +27 -0
- package/dist/components/icons/IconInfo.svelte.d.ts.map +1 -0
- package/dist/components/icons/IconLink.svelte +15 -0
- package/dist/components/icons/IconLink.svelte.d.ts +27 -0
- package/dist/components/icons/IconLink.svelte.d.ts.map +1 -0
- package/dist/components/icons/IconLoader.svelte +13 -0
- package/dist/components/icons/IconLoader.svelte.d.ts +27 -0
- package/dist/components/icons/IconLoader.svelte.d.ts.map +1 -0
- package/dist/components/icons/IconSearch.svelte +14 -0
- package/dist/components/icons/IconSearch.svelte.d.ts +27 -0
- package/dist/components/icons/IconSearch.svelte.d.ts.map +1 -0
- package/dist/components/icons/IconWorld.svelte +17 -0
- package/dist/components/icons/IconWorld.svelte.d.ts +27 -0
- package/dist/components/icons/IconWorld.svelte.d.ts.map +1 -0
- package/dist/components/icons/IconX.svelte +14 -0
- package/dist/components/icons/IconX.svelte.d.ts +27 -0
- package/dist/components/icons/IconX.svelte.d.ts.map +1 -0
- package/dist/components/icons/LICENSE +21 -0
- package/dist/components/logos/HeliumLogoRaw.svelte +6 -0
- package/dist/components/logos/HeliumLogoRaw.svelte.d.ts +27 -0
- package/dist/components/logos/HeliumLogoRaw.svelte.d.ts.map +1 -0
- package/dist/components/logos/HeliumTextRaw.svelte +16 -0
- package/dist/components/logos/HeliumTextRaw.svelte.d.ts +27 -0
- package/dist/components/logos/HeliumTextRaw.svelte.d.ts.map +1 -0
- package/dist/gradient-shimmer.d.ts +85 -0
- package/dist/gradient-shimmer.d.ts.map +1 -0
- package/dist/gradient-shimmer.js +227 -0
- package/dist/index.d.ts +32 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +33 -0
- package/dist/styles.css +386 -0
- package/package.json +54 -0
|
@@ -0,0 +1,467 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { onMount } from "svelte";
|
|
3
|
+
import type { ClassValue } from "svelte/elements";
|
|
4
|
+
import * as Shimmer from "../gradient-shimmer";
|
|
5
|
+
|
|
6
|
+
const GRAIN_SIZE = 180;
|
|
7
|
+
|
|
8
|
+
type Colors = {
|
|
9
|
+
alpha: number;
|
|
10
|
+
grainAlpha: number;
|
|
11
|
+
grainLuminance: number;
|
|
12
|
+
grainContrast: number;
|
|
13
|
+
grainSaturation: number;
|
|
14
|
+
introAlpha: number;
|
|
15
|
+
start: string;
|
|
16
|
+
highlight: string;
|
|
17
|
+
speedUpShineBoost: number;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
type Props = {
|
|
21
|
+
intro?: boolean;
|
|
22
|
+
background?: boolean;
|
|
23
|
+
class?: ClassValue;
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
let {
|
|
27
|
+
intro: shouldIntro,
|
|
28
|
+
background,
|
|
29
|
+
class: className,
|
|
30
|
+
}: Props = $props();
|
|
31
|
+
|
|
32
|
+
let canvas: HTMLCanvasElement;
|
|
33
|
+
let shimmerController: Shimmer.GradientShimmerControls | null = null;
|
|
34
|
+
|
|
35
|
+
const createGrainPattern = (
|
|
36
|
+
context: CanvasRenderingContext2D,
|
|
37
|
+
colors: Colors,
|
|
38
|
+
) => {
|
|
39
|
+
const grainCanvas = document.createElement("canvas");
|
|
40
|
+
const grainContext = grainCanvas.getContext("2d")!;
|
|
41
|
+
|
|
42
|
+
grainCanvas.width = GRAIN_SIZE;
|
|
43
|
+
grainCanvas.height = GRAIN_SIZE;
|
|
44
|
+
|
|
45
|
+
const imageData = grainContext.createImageData(
|
|
46
|
+
GRAIN_SIZE,
|
|
47
|
+
GRAIN_SIZE,
|
|
48
|
+
);
|
|
49
|
+
const pixels = imageData.data;
|
|
50
|
+
|
|
51
|
+
for (let index = 0; index < pixels.length; index += 4) {
|
|
52
|
+
const luminance = colors.grainLuminance
|
|
53
|
+
+ (Math.random() - 0.5) * colors.grainContrast;
|
|
54
|
+
const redShift = (Math.random() - 0.5) * colors.grainSaturation;
|
|
55
|
+
const greenShift = (Math.random() - 0.5) * colors.grainSaturation;
|
|
56
|
+
const blueShift = (Math.random() - 0.5) * colors.grainSaturation;
|
|
57
|
+
|
|
58
|
+
pixels[index] = Shimmer.clamp(luminance + redShift, 0, 255);
|
|
59
|
+
pixels[index + 1] = Shimmer.clamp(luminance + greenShift, 0, 255);
|
|
60
|
+
pixels[index + 2] = Shimmer.clamp(luminance + blueShift, 0, 255);
|
|
61
|
+
pixels[index + 3] = 255;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
grainContext.putImageData(imageData, 0, 0);
|
|
65
|
+
|
|
66
|
+
return context.createPattern(grainCanvas, "repeat")!;
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
export function intro() {
|
|
70
|
+
shimmerController?.intro();
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
export function emphasize() {
|
|
74
|
+
shimmerController?.emphasize();
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
const drawGrain = (
|
|
78
|
+
context: CanvasRenderingContext2D,
|
|
79
|
+
pattern: CanvasPattern,
|
|
80
|
+
size: Shimmer.Size,
|
|
81
|
+
colors: Colors,
|
|
82
|
+
) => {
|
|
83
|
+
context.save();
|
|
84
|
+
context.globalAlpha = colors.grainAlpha;
|
|
85
|
+
context.globalCompositeOperation = "overlay";
|
|
86
|
+
context.fillStyle = pattern;
|
|
87
|
+
context.fillRect(0, 0, size.width, size.height);
|
|
88
|
+
context.restore();
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
const drawStripe = (
|
|
92
|
+
context: CanvasRenderingContext2D,
|
|
93
|
+
stripe: Shimmer.Stripe,
|
|
94
|
+
index: number,
|
|
95
|
+
stripeWidth: number,
|
|
96
|
+
size: Shimmer.Size,
|
|
97
|
+
colors: Colors,
|
|
98
|
+
time: number,
|
|
99
|
+
introAnimation: Shimmer.IntroAnimation | null,
|
|
100
|
+
stripeCount: number,
|
|
101
|
+
wavePhase: number,
|
|
102
|
+
secondaryWavePhase: number,
|
|
103
|
+
shineProgress: number,
|
|
104
|
+
) => {
|
|
105
|
+
const revealProgress = Shimmer.getIntroRevealProgress(
|
|
106
|
+
time,
|
|
107
|
+
introAnimation,
|
|
108
|
+
index,
|
|
109
|
+
stripeCount,
|
|
110
|
+
);
|
|
111
|
+
const idleProgress = Shimmer.getIntroIdleProgress(
|
|
112
|
+
time,
|
|
113
|
+
introAnimation,
|
|
114
|
+
index,
|
|
115
|
+
stripeCount,
|
|
116
|
+
);
|
|
117
|
+
const alpha = colors.introAlpha
|
|
118
|
+
+ (colors.alpha - colors.introAlpha) * idleProgress;
|
|
119
|
+
const x = Shimmer.snapToDevicePixel(index * stripeWidth, size.dpr);
|
|
120
|
+
const nextX = index === stripeCount - 1
|
|
121
|
+
? size.width
|
|
122
|
+
: Shimmer.snapToDevicePixel((index + 1) * stripeWidth, size.dpr);
|
|
123
|
+
const width = nextX - x;
|
|
124
|
+
const introCenter = Shimmer.lerp(
|
|
125
|
+
Shimmer.INTRO.startCenter,
|
|
126
|
+
Shimmer.INTRO.idleCenter,
|
|
127
|
+
revealProgress,
|
|
128
|
+
);
|
|
129
|
+
const idleCenter = Shimmer.getIdleCenter(
|
|
130
|
+
stripe,
|
|
131
|
+
wavePhase,
|
|
132
|
+
secondaryWavePhase,
|
|
133
|
+
);
|
|
134
|
+
const center = introCenter + (idleCenter - introCenter) * idleProgress;
|
|
135
|
+
const bandStart = Shimmer.clamp(
|
|
136
|
+
center - Shimmer.GRADIENT.bandWidth,
|
|
137
|
+
Shimmer.GRADIENT.minStop,
|
|
138
|
+
Shimmer.GRADIENT.maxStop,
|
|
139
|
+
);
|
|
140
|
+
const bandEnd = Shimmer.clamp(
|
|
141
|
+
center + Shimmer.GRADIENT.bandWidth,
|
|
142
|
+
Shimmer.GRADIENT.minStop,
|
|
143
|
+
Shimmer.GRADIENT.maxStop,
|
|
144
|
+
);
|
|
145
|
+
const gradient = context.createLinearGradient(
|
|
146
|
+
x,
|
|
147
|
+
size.height * -0.35,
|
|
148
|
+
nextX,
|
|
149
|
+
size.height * 1.35,
|
|
150
|
+
);
|
|
151
|
+
|
|
152
|
+
context.globalAlpha = alpha;
|
|
153
|
+
context.fillStyle = colors.start;
|
|
154
|
+
context.fillRect(x, 0, width, size.height);
|
|
155
|
+
|
|
156
|
+
gradient.addColorStop(0, colors.highlight);
|
|
157
|
+
gradient.addColorStop(bandStart, colors.start);
|
|
158
|
+
gradient.addColorStop(center, colors.highlight);
|
|
159
|
+
gradient.addColorStop(bandEnd, colors.start);
|
|
160
|
+
gradient.addColorStop(1, colors.start);
|
|
161
|
+
|
|
162
|
+
context.globalAlpha = Shimmer.clamp(
|
|
163
|
+
alpha * (1 + shineProgress * colors.speedUpShineBoost),
|
|
164
|
+
) * revealProgress;
|
|
165
|
+
context.fillStyle = gradient;
|
|
166
|
+
context.fillRect(x, 0, width, size.height);
|
|
167
|
+
};
|
|
168
|
+
|
|
169
|
+
onMount(() => {
|
|
170
|
+
const context = canvas.getContext("2d", {
|
|
171
|
+
alpha: true,
|
|
172
|
+
colorSpace: "display-p3",
|
|
173
|
+
});
|
|
174
|
+
|
|
175
|
+
if (!context) {
|
|
176
|
+
return;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
const stripes: Shimmer.Stripe[] = [];
|
|
180
|
+
const colorSchemeQuery = window.matchMedia(
|
|
181
|
+
"(prefers-color-scheme: dark)",
|
|
182
|
+
);
|
|
183
|
+
const reducedMotionQuery = window.matchMedia(
|
|
184
|
+
"(prefers-reduced-motion: reduce)",
|
|
185
|
+
);
|
|
186
|
+
|
|
187
|
+
let size: Shimmer.Size;
|
|
188
|
+
let stripeWidth: number;
|
|
189
|
+
let colors: Colors;
|
|
190
|
+
let grainPattern: CanvasPattern | null = null;
|
|
191
|
+
let animationFrame: number | null = null;
|
|
192
|
+
let resizeFrame: number | null = null;
|
|
193
|
+
let introAnimation: Shimmer.IntroAnimation | null = null;
|
|
194
|
+
let speedUpAnimation: Shimmer.WaveSpeedUpAnimation | null = null;
|
|
195
|
+
let wavePhase = Shimmer.getRandomWavePhase();
|
|
196
|
+
let secondaryWavePhase = -wavePhase * 0.7;
|
|
197
|
+
let lastFrameTime: number | null = null;
|
|
198
|
+
|
|
199
|
+
const cancelResizeFrame = () => {
|
|
200
|
+
if (resizeFrame === null) {
|
|
201
|
+
return;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
cancelAnimationFrame(resizeFrame);
|
|
205
|
+
resizeFrame = null;
|
|
206
|
+
};
|
|
207
|
+
|
|
208
|
+
const cancelAnimation = () => {
|
|
209
|
+
if (animationFrame === null) {
|
|
210
|
+
return;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
cancelAnimationFrame(animationFrame);
|
|
214
|
+
animationFrame = null;
|
|
215
|
+
};
|
|
216
|
+
|
|
217
|
+
const startIntro = () => {
|
|
218
|
+
if (reducedMotionQuery.matches) {
|
|
219
|
+
introAnimation = null;
|
|
220
|
+
drawFrame(performance.now());
|
|
221
|
+
return;
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
introAnimation = { startedAt: performance.now() };
|
|
225
|
+
};
|
|
226
|
+
|
|
227
|
+
const startWaveSpeedUp = () => {
|
|
228
|
+
if (reducedMotionQuery.matches) {
|
|
229
|
+
speedUpAnimation = null;
|
|
230
|
+
drawFrame(performance.now());
|
|
231
|
+
return;
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
const time = performance.now();
|
|
235
|
+
|
|
236
|
+
speedUpAnimation = Shimmer.triggerSpeedUpAnimation(
|
|
237
|
+
time,
|
|
238
|
+
speedUpAnimation,
|
|
239
|
+
);
|
|
240
|
+
};
|
|
241
|
+
|
|
242
|
+
const controller: Shimmer.GradientShimmerControls = {
|
|
243
|
+
intro: startIntro,
|
|
244
|
+
emphasize: startWaveSpeedUp,
|
|
245
|
+
};
|
|
246
|
+
|
|
247
|
+
const readColors = () => {
|
|
248
|
+
const styles = getComputedStyle(canvas);
|
|
249
|
+
|
|
250
|
+
colors = {
|
|
251
|
+
alpha: Shimmer.readCssNumber(styles, "--shimmer-alpha"),
|
|
252
|
+
grainAlpha: Shimmer.readCssNumber(
|
|
253
|
+
styles,
|
|
254
|
+
"--shimmer-grain-alpha",
|
|
255
|
+
),
|
|
256
|
+
grainLuminance: Shimmer.readCssNumber(
|
|
257
|
+
styles,
|
|
258
|
+
"--shimmer-grain-luminance",
|
|
259
|
+
),
|
|
260
|
+
grainContrast: Shimmer.readCssNumber(
|
|
261
|
+
styles,
|
|
262
|
+
"--shimmer-grain-contrast",
|
|
263
|
+
),
|
|
264
|
+
grainSaturation: Shimmer.readCssNumber(
|
|
265
|
+
styles,
|
|
266
|
+
"--shimmer-grain-saturation",
|
|
267
|
+
),
|
|
268
|
+
introAlpha: Shimmer.readCssNumber(
|
|
269
|
+
styles,
|
|
270
|
+
"--shimmer-intro-alpha",
|
|
271
|
+
),
|
|
272
|
+
start: Shimmer.readCssString(styles, "--shimmer-start"),
|
|
273
|
+
highlight: Shimmer.readCssString(
|
|
274
|
+
styles,
|
|
275
|
+
"--shimmer-highlight",
|
|
276
|
+
),
|
|
277
|
+
speedUpShineBoost: Shimmer.readCssNumber(
|
|
278
|
+
styles,
|
|
279
|
+
"--shimmer-speed-up-shine-boost",
|
|
280
|
+
),
|
|
281
|
+
};
|
|
282
|
+
grainPattern = createGrainPattern(context, colors);
|
|
283
|
+
};
|
|
284
|
+
|
|
285
|
+
const applyResize = () => {
|
|
286
|
+
size = Shimmer.resizeCanvas(canvas, context);
|
|
287
|
+
stripeWidth = Shimmer.syncStripeCount(stripes, size.width);
|
|
288
|
+
readColors();
|
|
289
|
+
};
|
|
290
|
+
|
|
291
|
+
const scheduleResize = () => {
|
|
292
|
+
cancelResizeFrame();
|
|
293
|
+
resizeFrame = requestAnimationFrame((time) => {
|
|
294
|
+
applyResize();
|
|
295
|
+
drawFrame(time);
|
|
296
|
+
});
|
|
297
|
+
};
|
|
298
|
+
|
|
299
|
+
const drawFrame = (time: number) => {
|
|
300
|
+
const reducedMotion = reducedMotionQuery.matches;
|
|
301
|
+
const deltaSeconds = reducedMotion || lastFrameTime === null
|
|
302
|
+
? 0
|
|
303
|
+
: Math.min((time - lastFrameTime) / 1000, 0.064);
|
|
304
|
+
const speedUpState = Shimmer.updateSpeedUpAnimation(
|
|
305
|
+
time,
|
|
306
|
+
speedUpAnimation,
|
|
307
|
+
);
|
|
308
|
+
const activeIntroAnimation = reducedMotion ? null : introAnimation;
|
|
309
|
+
|
|
310
|
+
lastFrameTime = reducedMotion ? null : time;
|
|
311
|
+
speedUpAnimation = reducedMotion ? null : speedUpState.animation;
|
|
312
|
+
|
|
313
|
+
if (!reducedMotion) {
|
|
314
|
+
wavePhase += Shimmer.IDLE_WAVE.speed
|
|
315
|
+
* speedUpState.multiplier
|
|
316
|
+
* deltaSeconds;
|
|
317
|
+
secondaryWavePhase += Shimmer.IDLE_WAVE.secondarySpeed
|
|
318
|
+
* speedUpState.multiplier
|
|
319
|
+
* deltaSeconds;
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
context.globalAlpha = 1;
|
|
323
|
+
context.clearRect(0, 0, size.width, size.height);
|
|
324
|
+
|
|
325
|
+
for (const [index, stripe] of stripes.entries()) {
|
|
326
|
+
drawStripe(
|
|
327
|
+
context,
|
|
328
|
+
stripe,
|
|
329
|
+
index,
|
|
330
|
+
stripeWidth,
|
|
331
|
+
size,
|
|
332
|
+
colors,
|
|
333
|
+
time,
|
|
334
|
+
activeIntroAnimation,
|
|
335
|
+
stripes.length,
|
|
336
|
+
wavePhase,
|
|
337
|
+
secondaryWavePhase,
|
|
338
|
+
reducedMotion ? 0 : speedUpState.shineProgress,
|
|
339
|
+
);
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
if (grainPattern) {
|
|
343
|
+
drawGrain(context, grainPattern, size, colors);
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
if (Shimmer.isIntroComplete(time, introAnimation, stripes.length)) {
|
|
347
|
+
introAnimation = null;
|
|
348
|
+
}
|
|
349
|
+
};
|
|
350
|
+
|
|
351
|
+
const draw = (time: number) => {
|
|
352
|
+
animationFrame = null;
|
|
353
|
+
drawFrame(time);
|
|
354
|
+
|
|
355
|
+
if (!reducedMotionQuery.matches) {
|
|
356
|
+
animationFrame = requestAnimationFrame(draw);
|
|
357
|
+
}
|
|
358
|
+
};
|
|
359
|
+
|
|
360
|
+
const requestAnimation = () => {
|
|
361
|
+
if (animationFrame !== null || reducedMotionQuery.matches) {
|
|
362
|
+
return;
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
animationFrame = requestAnimationFrame(draw);
|
|
366
|
+
};
|
|
367
|
+
|
|
368
|
+
applyResize();
|
|
369
|
+
|
|
370
|
+
if (shouldIntro !== false) {
|
|
371
|
+
startIntro();
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
shimmerController = controller;
|
|
375
|
+
|
|
376
|
+
const resizeObserver = new ResizeObserver(scheduleResize);
|
|
377
|
+
resizeObserver.observe(canvas);
|
|
378
|
+
|
|
379
|
+
const scheduleColorRead = () => {
|
|
380
|
+
cancelResizeFrame();
|
|
381
|
+
resizeFrame = requestAnimationFrame((time) => {
|
|
382
|
+
readColors();
|
|
383
|
+
drawFrame(time);
|
|
384
|
+
});
|
|
385
|
+
};
|
|
386
|
+
|
|
387
|
+
const themeObserver = new MutationObserver(scheduleColorRead);
|
|
388
|
+
themeObserver.observe(document.documentElement, { attributes: true });
|
|
389
|
+
|
|
390
|
+
const updateMotionPreference = () => {
|
|
391
|
+
if (reducedMotionQuery.matches) {
|
|
392
|
+
introAnimation = null;
|
|
393
|
+
speedUpAnimation = null;
|
|
394
|
+
cancelAnimation();
|
|
395
|
+
drawFrame(performance.now());
|
|
396
|
+
return;
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
lastFrameTime = null;
|
|
400
|
+
requestAnimation();
|
|
401
|
+
};
|
|
402
|
+
|
|
403
|
+
colorSchemeQuery.addEventListener("change", scheduleColorRead);
|
|
404
|
+
reducedMotionQuery.addEventListener("change", updateMotionPreference);
|
|
405
|
+
|
|
406
|
+
updateMotionPreference();
|
|
407
|
+
|
|
408
|
+
return () => {
|
|
409
|
+
if (shimmerController === controller) {
|
|
410
|
+
shimmerController = null;
|
|
411
|
+
}
|
|
412
|
+
|
|
413
|
+
cancelAnimation();
|
|
414
|
+
cancelResizeFrame();
|
|
415
|
+
resizeObserver.disconnect();
|
|
416
|
+
themeObserver.disconnect();
|
|
417
|
+
colorSchemeQuery.removeEventListener("change", scheduleColorRead);
|
|
418
|
+
reducedMotionQuery.removeEventListener("change", updateMotionPreference);
|
|
419
|
+
};
|
|
420
|
+
});
|
|
421
|
+
</script>
|
|
422
|
+
|
|
423
|
+
<canvas
|
|
424
|
+
bind:this={canvas}
|
|
425
|
+
class={[background && "background", className]}
|
|
426
|
+
aria-hidden="true"
|
|
427
|
+
></canvas>
|
|
428
|
+
|
|
429
|
+
<style>
|
|
430
|
+
canvas {
|
|
431
|
+
--shimmer-alpha: 0.35;
|
|
432
|
+
--shimmer-grain-alpha: 0.15;
|
|
433
|
+
--shimmer-grain-luminance: 220;
|
|
434
|
+
--shimmer-grain-contrast: 34;
|
|
435
|
+
--shimmer-grain-saturation: 8;
|
|
436
|
+
--shimmer-intro-alpha: 0.6;
|
|
437
|
+
--shimmer-speed-up-shine-boost: 0.3;
|
|
438
|
+
--shimmer-highlight: var(--bg-gradient-end);
|
|
439
|
+
--shimmer-start: var(--bg-gradient-start);
|
|
440
|
+
|
|
441
|
+
display: block;
|
|
442
|
+
z-index: 0;
|
|
443
|
+
width: 100%;
|
|
444
|
+
height: 100%;
|
|
445
|
+
pointer-events: none;
|
|
446
|
+
}
|
|
447
|
+
|
|
448
|
+
canvas.background {
|
|
449
|
+
position: fixed;
|
|
450
|
+
top: 0;
|
|
451
|
+
left: 0;
|
|
452
|
+
width: 100vw;
|
|
453
|
+
height: 100vh;
|
|
454
|
+
}
|
|
455
|
+
|
|
456
|
+
@media (prefers-color-scheme: dark) {
|
|
457
|
+
canvas {
|
|
458
|
+
--shimmer-alpha: 0.7;
|
|
459
|
+
--shimmer-grain-alpha: 0.15;
|
|
460
|
+
--shimmer-grain-luminance: 144;
|
|
461
|
+
--shimmer-grain-contrast: 64;
|
|
462
|
+
--shimmer-grain-saturation: 32;
|
|
463
|
+
--shimmer-intro-alpha: 1;
|
|
464
|
+
--shimmer-speed-up-shine-boost: 0.15;
|
|
465
|
+
}
|
|
466
|
+
}
|
|
467
|
+
</style>
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { ClassValue } from "svelte/elements";
|
|
2
|
+
type Props = {
|
|
3
|
+
intro?: boolean;
|
|
4
|
+
background?: boolean;
|
|
5
|
+
class?: ClassValue;
|
|
6
|
+
};
|
|
7
|
+
declare const GradientShimmer: import("svelte").Component<Props, {
|
|
8
|
+
intro: () => void;
|
|
9
|
+
emphasize: () => void;
|
|
10
|
+
}, "">;
|
|
11
|
+
type GradientShimmer = ReturnType<typeof GradientShimmer>;
|
|
12
|
+
export default GradientShimmer;
|
|
13
|
+
//# sourceMappingURL=GradientShimmer.svelte.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GradientShimmer.svelte.d.ts","sourceRoot":"","sources":["../../src/lib/components/GradientShimmer.svelte.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAgB9C,KAAK,KAAK,GAAG;IACT,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,KAAK,CAAC,EAAE,UAAU,CAAC;CACtB,CAAC;AA6ZN,QAAA,MAAM,eAAe;;;MAAwC,CAAC;AAC9D,KAAK,eAAe,GAAG,UAAU,CAAC,OAAO,eAAe,CAAC,CAAC;AAC1D,eAAe,eAAe,CAAC"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { ClassValue } from "svelte/elements";
|
|
3
|
+
import HeliumLogoRaw from "./logos/HeliumLogoRaw.svelte";
|
|
4
|
+
import HeliumTextRaw from "./logos/HeliumTextRaw.svelte";
|
|
5
|
+
|
|
6
|
+
type Props = {
|
|
7
|
+
height?: string;
|
|
8
|
+
text?: boolean;
|
|
9
|
+
class?: ClassValue;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
let {
|
|
13
|
+
height = "28px",
|
|
14
|
+
text = false,
|
|
15
|
+
class: className,
|
|
16
|
+
}: Props = $props();
|
|
17
|
+
</script>
|
|
18
|
+
|
|
19
|
+
<span class={["helium-logo", className]} style:height aria-hidden="true">
|
|
20
|
+
{#if text}
|
|
21
|
+
<HeliumTextRaw />
|
|
22
|
+
{:else}
|
|
23
|
+
<HeliumLogoRaw />
|
|
24
|
+
{/if}
|
|
25
|
+
</span>
|
|
26
|
+
|
|
27
|
+
<style>
|
|
28
|
+
.helium-logo {
|
|
29
|
+
display: inline-flex;
|
|
30
|
+
color: currentColor;
|
|
31
|
+
flex: 0 0 auto;
|
|
32
|
+
width: auto;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.helium-logo :global(svg) {
|
|
36
|
+
display: block;
|
|
37
|
+
width: auto;
|
|
38
|
+
height: 100%;
|
|
39
|
+
}
|
|
40
|
+
</style>
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { ClassValue } from "svelte/elements";
|
|
2
|
+
type Props = {
|
|
3
|
+
height?: string;
|
|
4
|
+
text?: boolean;
|
|
5
|
+
class?: ClassValue;
|
|
6
|
+
};
|
|
7
|
+
declare const HeliumLogo: import("svelte").Component<Props, {}, "">;
|
|
8
|
+
type HeliumLogo = ReturnType<typeof HeliumLogo>;
|
|
9
|
+
export default HeliumLogo;
|
|
10
|
+
//# sourceMappingURL=HeliumLogo.svelte.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HeliumLogo.svelte.d.ts","sourceRoot":"","sources":["../../src/lib/components/HeliumLogo.svelte.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAK9C,KAAK,KAAK,GAAG;IACT,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,KAAK,CAAC,EAAE,UAAU,CAAC;CACtB,CAAC;AA0BN,QAAA,MAAM,UAAU,2CAAwC,CAAC;AACzD,KAAK,UAAU,GAAG,UAAU,CAAC,OAAO,UAAU,CAAC,CAAC;AAChD,eAAe,UAAU,CAAC"}
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { Snippet } from "svelte";
|
|
3
|
+
import type { HTMLInputAttributes } from "svelte/elements";
|
|
4
|
+
|
|
5
|
+
type NativeInputProps = Omit<
|
|
6
|
+
HTMLInputAttributes,
|
|
7
|
+
"aria-label" | "id" | "input" | "size" | "value" | "width"
|
|
8
|
+
>;
|
|
9
|
+
|
|
10
|
+
type Props = NativeInputProps & {
|
|
11
|
+
id: string;
|
|
12
|
+
"aria-label": string;
|
|
13
|
+
value?: HTMLInputAttributes["value"];
|
|
14
|
+
small?: boolean;
|
|
15
|
+
width?: string;
|
|
16
|
+
input?: HTMLInputElement | undefined;
|
|
17
|
+
leading?: Snippet;
|
|
18
|
+
trailing?: Snippet;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
let {
|
|
22
|
+
id,
|
|
23
|
+
value = $bindable(),
|
|
24
|
+
small = false,
|
|
25
|
+
width,
|
|
26
|
+
input = $bindable(),
|
|
27
|
+
leading,
|
|
28
|
+
trailing,
|
|
29
|
+
class: className,
|
|
30
|
+
placeholder,
|
|
31
|
+
"aria-label": ariaLabel,
|
|
32
|
+
disabled,
|
|
33
|
+
...rest
|
|
34
|
+
}: Props = $props();
|
|
35
|
+
</script>
|
|
36
|
+
|
|
37
|
+
<label
|
|
38
|
+
class={["input-field", small && "small", disabled && "disabled", className]}
|
|
39
|
+
style:width
|
|
40
|
+
>
|
|
41
|
+
{#if leading}
|
|
42
|
+
<span class="input-accessory" aria-hidden="true">
|
|
43
|
+
{@render leading()}
|
|
44
|
+
</span>
|
|
45
|
+
{/if}
|
|
46
|
+
<input
|
|
47
|
+
bind:this={input}
|
|
48
|
+
bind:value
|
|
49
|
+
{id}
|
|
50
|
+
{placeholder}
|
|
51
|
+
aria-label={ariaLabel}
|
|
52
|
+
{disabled}
|
|
53
|
+
{...rest}
|
|
54
|
+
/>
|
|
55
|
+
{#if trailing}
|
|
56
|
+
<span class="input-accessory" aria-hidden="true">
|
|
57
|
+
{@render trailing()}
|
|
58
|
+
</span>
|
|
59
|
+
{/if}
|
|
60
|
+
</label>
|
|
61
|
+
|
|
62
|
+
<style>
|
|
63
|
+
.input-field {
|
|
64
|
+
--input-font-size: 16px;
|
|
65
|
+
--input-icon-size: 18px;
|
|
66
|
+
--input-line-height: 122%;
|
|
67
|
+
--input-padding: 13px 16px;
|
|
68
|
+
|
|
69
|
+
padding: var(--input-padding);
|
|
70
|
+
min-height: 46px;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
.small {
|
|
74
|
+
--input-font-size: 14px;
|
|
75
|
+
--input-icon-size: 16px;
|
|
76
|
+
--input-line-height: 120%;
|
|
77
|
+
--input-padding: 10px 16px;
|
|
78
|
+
|
|
79
|
+
min-height: 38px;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
input {
|
|
83
|
+
font-size: var(--input-font-size);
|
|
84
|
+
line-height: var(--input-line-height);
|
|
85
|
+
padding: 0;
|
|
86
|
+
|
|
87
|
+
&[type="number"] {
|
|
88
|
+
appearance: textfield;
|
|
89
|
+
-moz-appearance: textfield;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
&::-webkit-outer-spin-button,
|
|
93
|
+
&::-webkit-inner-spin-button {
|
|
94
|
+
-webkit-appearance: none;
|
|
95
|
+
margin: 0;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
.input-accessory {
|
|
100
|
+
color: var(--tertiary);
|
|
101
|
+
flex: 0 0 auto;
|
|
102
|
+
display: inline-flex;
|
|
103
|
+
align-items: center;
|
|
104
|
+
justify-content: center;
|
|
105
|
+
line-height: 1;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
.input-field:focus-within .input-accessory {
|
|
109
|
+
color: var(--primary);
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
.input-accessory :global(svg) {
|
|
113
|
+
width: var(--input-icon-size);
|
|
114
|
+
height: var(--input-icon-size);
|
|
115
|
+
stroke-width: 1.8px;
|
|
116
|
+
}
|
|
117
|
+
</style>
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { Snippet } from "svelte";
|
|
2
|
+
import type { HTMLInputAttributes } from "svelte/elements";
|
|
3
|
+
type NativeInputProps = Omit<HTMLInputAttributes, "aria-label" | "id" | "input" | "size" | "value" | "width">;
|
|
4
|
+
type Props = NativeInputProps & {
|
|
5
|
+
id: string;
|
|
6
|
+
"aria-label": string;
|
|
7
|
+
value?: HTMLInputAttributes["value"];
|
|
8
|
+
small?: boolean;
|
|
9
|
+
width?: string;
|
|
10
|
+
input?: HTMLInputElement | undefined;
|
|
11
|
+
leading?: Snippet;
|
|
12
|
+
trailing?: Snippet;
|
|
13
|
+
};
|
|
14
|
+
declare const Input: import("svelte").Component<Props, {}, "value" | "input">;
|
|
15
|
+
type Input = ReturnType<typeof Input>;
|
|
16
|
+
export default Input;
|
|
17
|
+
//# sourceMappingURL=Input.svelte.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Input.svelte.d.ts","sourceRoot":"","sources":["../../src/lib/components/Input.svelte.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AACtC,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAGvD,KAAK,gBAAgB,GAAG,IAAI,CACxB,mBAAmB,EACnB,YAAY,GAAG,IAAI,GAAG,OAAO,GAAG,MAAM,GAAG,OAAO,GAAG,OAAO,CAC7D,CAAC;AAEF,KAAK,KAAK,GAAG,gBAAgB,GAAG;IAC5B,EAAE,EAAE,MAAM,CAAC;IACX,YAAY,EAAE,MAAM,CAAC;IACrB,KAAK,CAAC,EAAE,mBAAmB,CAAC,OAAO,CAAC,CAAC;IACrC,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,gBAAgB,GAAG,SAAS,CAAC;IACrC,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACtB,CAAC;AAyCN,QAAA,MAAM,KAAK,0DAAwC,CAAC;AACpD,KAAK,KAAK,GAAG,UAAU,CAAC,OAAO,KAAK,CAAC,CAAC;AACtC,eAAe,KAAK,CAAC"}
|