@skylab-kulubu/skylcn-ui 0.1.3 → 0.1.4
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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"skylab-loader.d.ts","sourceRoot":"","sources":["../../src/components/skylab-loader.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"skylab-loader.d.ts","sourceRoot":"","sources":["../../src/components/skylab-loader.tsx"],"names":[],"mappings":"AAYA,MAAM,MAAM,iBAAiB,GAAG;IAC9B,iFAAiF;IACjF,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,iEAAiE;IACjE,KAAK,CAAC,EAAE,SAAS,GAAG,MAAM,CAAC;IAC3B,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,gGAAgG;AAChG,wBAAgB,YAAY,CAAC,EAAE,IAAS,EAAE,KAAiB,EAAE,SAAS,EAAE,EAAE,iBAAiB,+BAgE1F"}
|
|
@@ -1,12 +1,22 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useId } from 'react';
|
|
3
|
+
import { SKYLAB_MARK_PATHS, SKYLAB_MARK_VIEWBOX } from '../assets/skylab-mark.js';
|
|
3
4
|
import { cn } from '../lib/cn.js';
|
|
4
|
-
|
|
5
|
+
// Fatih Naz's loader from forms-frontend lights the mark in seven groups from the centre out.
|
|
6
|
+
// Each path's group, in SKYLAB_MARK_PATHS order.
|
|
7
|
+
const GROUPS = [4, 2, 0, 3, 4, 2, 5, 6, 3, 1, 4, 2, 3, 4, 2, 5, 6, 3, 1];
|
|
8
|
+
const STAGGER_MS = 80;
|
|
9
|
+
// Below these sizes the shimmer, halo and steel outline only muddy the mark.
|
|
10
|
+
const RICH_FROM = 32;
|
|
11
|
+
const METAL_FROM = 64;
|
|
5
12
|
/** The SKY LAB mark lighting up from its centre; the one loading indicator of every product. */
|
|
6
13
|
export function SkylabLoader({ size = 80, state = 'loading', className }) {
|
|
14
|
+
// useId's characters do not all survive inside url(#…)
|
|
15
|
+
const steelId = `skylcn-steel-${useId().replace(/[^\w-]/g, '')}`;
|
|
7
16
|
const animate = state === 'loading';
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
17
|
+
const rich = animate && size >= RICH_FROM;
|
|
18
|
+
const metal = animate && size >= METAL_FROM;
|
|
19
|
+
const paths = SKYLAB_MARK_PATHS.map((d, i) => (_jsx("path", { d: d, style: animate ? { animationDelay: `${GROUPS[i] * STAGGER_MS}ms` } : undefined }, i)));
|
|
20
|
+
return (_jsxs("span", { "data-slot": "skylab-loader", "aria-hidden": true, className: cn('relative inline-block shrink-0 text-secondary-foreground', animate && 'skylcn-loader', rich && 'skylcn-loader-rich', className), style: { width: size, height: size }, children: [rich ? _jsx("span", { className: "skylcn-loader-halo absolute inset-0 rounded-full" }) : null, _jsx("svg", { viewBox: SKYLAB_MARK_VIEWBOX, fill: "currentColor", className: "skylcn-loader-mark relative block size-full", children: _jsx("g", { fillRule: "evenodd", children: paths }) }), metal ? (_jsxs("svg", { viewBox: SKYLAB_MARK_VIEWBOX, fill: "none", className: "skylcn-loader-metal absolute inset-0 block size-full", children: [_jsx("defs", { children: _jsxs("linearGradient", { id: steelId, x1: "0", y1: "0", x2: "586", y2: "554", gradientUnits: "userSpaceOnUse", children: [_jsx("stop", { offset: "0", stopColor: "var(--skylcn-steel-hi)" }), _jsx("stop", { offset: "0.22", stopColor: "var(--skylcn-steel-lo)" }), _jsx("stop", { offset: "0.45", stopColor: "var(--skylcn-steel-hi)" }), _jsx("stop", { offset: "0.6", stopColor: "var(--skylcn-steel-lo)" }), _jsx("stop", { offset: "0.82", stopColor: "var(--skylcn-steel-hi)" }), _jsx("stop", { offset: "1", stopColor: "var(--skylcn-steel-lo)" })] }) }), _jsx("g", { stroke: `url(#${steelId})`, strokeWidth: size >= 120 ? 5 : 7, strokeLinejoin: "round", children: paths })] })) : null] }));
|
|
11
21
|
}
|
|
12
22
|
//# sourceMappingURL=skylab-loader.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"skylab-loader.js","sourceRoot":"","sources":["../../src/components/skylab-loader.tsx"],"names":[],"mappings":";AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"skylab-loader.js","sourceRoot":"","sources":["../../src/components/skylab-loader.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,OAAO,CAAC;AAC9B,OAAO,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAClF,OAAO,EAAE,EAAE,EAAE,MAAM,cAAc,CAAC;AAElC,8FAA8F;AAC9F,iDAAiD;AACjD,MAAM,MAAM,GAAG,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;AACzE,MAAM,UAAU,GAAG,EAAE,CAAC;AACtB,6EAA6E;AAC7E,MAAM,SAAS,GAAG,EAAE,CAAC;AACrB,MAAM,UAAU,GAAG,EAAE,CAAC;AAUtB,gGAAgG;AAChG,MAAM,UAAU,YAAY,CAAC,EAAE,IAAI,GAAG,EAAE,EAAE,KAAK,GAAG,SAAS,EAAE,SAAS,EAAqB;IACzF,uDAAuD;IACvD,MAAM,OAAO,GAAG,gBAAgB,KAAK,EAAE,CAAC,OAAO,CAAC,SAAS,EAAE,EAAE,CAAC,EAAE,CAAC;IACjE,MAAM,OAAO,GAAG,KAAK,KAAK,SAAS,CAAC;IACpC,MAAM,IAAI,GAAG,OAAO,IAAI,IAAI,IAAI,SAAS,CA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AS,EAAC,wBAAwB,GAAG,EACzD,eAAM,MAAM,EAAC,KAAK,EAAC,SAAS,EAAC,wBAAwB,GAAG,EACxD,eAAM,MAAM,EAAC,MAAM,EAAC,SAAS,EAAC,wBAAwB,GAAG,EACzD,eAAM,MAAM,EAAC,GAAG,EAAC,SAAS,EAAC,wBAAwB,GAAG,IACvC,GACZ,EACP,YAAG,MAAM,EAAE,QAAQ,OAAO,GAAG,EAAE,WAAW,EAAE,IAAI,IAAI,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,cAAc,EAAC,OAAO,YACpF,KAAK,GACJ,IACA,CACP,CAAC,CAAC,CAAC,IAAI,IACH,CACR,CAAC;AACJ,CAAC"}
|
package/dist/styles/theme.css
CHANGED
|
@@ -260,31 +260,129 @@
|
|
|
260
260
|
}
|
|
261
261
|
}
|
|
262
262
|
|
|
263
|
-
/*
|
|
263
|
+
/*
|
|
264
|
+
* SkylabLoader: the mark lights up group by group from its centre (each path's delay comes
|
|
265
|
+
* from the component), never fading below a floor, with a shimmer band and a soft halo from
|
|
266
|
+
* 32px and a diagonal glint along a steel outline from 64px. Still under reduced motion.
|
|
267
|
+
*/
|
|
264
268
|
@layer components {
|
|
265
|
-
.skylcn-
|
|
266
|
-
|
|
267
|
-
|
|
269
|
+
.skylcn-loader {
|
|
270
|
+
--skylcn-loader-cycle: 2.4s;
|
|
271
|
+
--skylcn-loader-floor: 0.2;
|
|
272
|
+
--skylcn-steel-hi: color-mix(in srgb, currentColor 30%, white);
|
|
273
|
+
--skylcn-steel-lo: color-mix(in srgb, currentColor 55%, black);
|
|
274
|
+
}
|
|
275
|
+
:where([data-theme='light']) .skylcn-loader {
|
|
276
|
+
--skylcn-loader-floor: 0.3;
|
|
277
|
+
--skylcn-steel-hi: color-mix(in srgb, currentColor 35%, white);
|
|
278
|
+
--skylcn-steel-lo: color-mix(in srgb, currentColor 80%, black);
|
|
279
|
+
}
|
|
280
|
+
.skylcn-loader .skylcn-loader-mark path,
|
|
281
|
+
.skylcn-loader .skylcn-loader-metal path {
|
|
282
|
+
animation: skylcn-loader-reveal var(--skylcn-loader-cycle) ease-in-out infinite both;
|
|
283
|
+
}
|
|
284
|
+
.skylcn-loader-rich .skylcn-loader-mark {
|
|
285
|
+
/* a 200-unit bright band crossing the 586-unit mark; the mask is four times as wide */
|
|
286
|
+
mask-image: linear-gradient(
|
|
287
|
+
90deg,
|
|
288
|
+
rgb(0 0 0 / 0.55) 0%,
|
|
289
|
+
rgb(0 0 0 / 0.55) 45.74%,
|
|
290
|
+
#000 50%,
|
|
291
|
+
rgb(0 0 0 / 0.55) 54.26%,
|
|
292
|
+
rgb(0 0 0 / 0.55) 100%
|
|
293
|
+
);
|
|
294
|
+
mask-size: 400% 100%;
|
|
295
|
+
mask-repeat: no-repeat;
|
|
296
|
+
animation: skylcn-loader-shimmer var(--skylcn-loader-cycle) ease-in-out infinite;
|
|
297
|
+
}
|
|
298
|
+
.skylcn-loader-metal {
|
|
299
|
+
mask-image: linear-gradient(
|
|
300
|
+
115deg,
|
|
301
|
+
transparent 0%,
|
|
302
|
+
transparent 44%,
|
|
303
|
+
#000 49%,
|
|
304
|
+
#000 51%,
|
|
305
|
+
transparent 56%,
|
|
306
|
+
transparent 100%
|
|
307
|
+
);
|
|
308
|
+
mask-size: 400% 400%;
|
|
309
|
+
mask-repeat: no-repeat;
|
|
310
|
+
animation: skylcn-loader-glint var(--skylcn-loader-cycle) ease-in-out infinite;
|
|
311
|
+
}
|
|
312
|
+
.skylcn-loader-halo {
|
|
313
|
+
background: radial-gradient(
|
|
314
|
+
circle,
|
|
315
|
+
color-mix(in srgb, currentColor 14%, transparent) 0%,
|
|
316
|
+
transparent 70%
|
|
317
|
+
);
|
|
318
|
+
filter: blur(8px);
|
|
319
|
+
animation: skylcn-loader-halo var(--skylcn-loader-cycle) ease-in-out infinite;
|
|
268
320
|
}
|
|
269
321
|
|
|
270
322
|
@media (prefers-reduced-motion: reduce) {
|
|
271
|
-
.skylcn-mark
|
|
323
|
+
.skylcn-loader .skylcn-loader-mark,
|
|
324
|
+
.skylcn-loader .skylcn-loader-mark path {
|
|
272
325
|
animation: none;
|
|
273
|
-
|
|
326
|
+
mask-image: none;
|
|
327
|
+
}
|
|
328
|
+
.skylcn-loader .skylcn-loader-metal,
|
|
329
|
+
.skylcn-loader .skylcn-loader-halo {
|
|
330
|
+
display: none;
|
|
274
331
|
}
|
|
275
332
|
}
|
|
276
|
-
[data-motion='reduced'] .skylcn-mark
|
|
333
|
+
[data-motion='reduced'] .skylcn-loader .skylcn-loader-mark,
|
|
334
|
+
[data-motion='reduced'] .skylcn-loader .skylcn-loader-mark path {
|
|
277
335
|
animation: none;
|
|
336
|
+
mask-image: none;
|
|
337
|
+
}
|
|
338
|
+
[data-motion='reduced'] .skylcn-loader .skylcn-loader-metal,
|
|
339
|
+
[data-motion='reduced'] .skylcn-loader .skylcn-loader-halo {
|
|
340
|
+
display: none;
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
@keyframes skylcn-loader-reveal {
|
|
345
|
+
0%,
|
|
346
|
+
100% {
|
|
347
|
+
opacity: var(--skylcn-loader-floor);
|
|
348
|
+
}
|
|
349
|
+
37.5%,
|
|
350
|
+
70.8% {
|
|
278
351
|
opacity: 1;
|
|
279
352
|
}
|
|
280
353
|
}
|
|
281
354
|
|
|
282
|
-
|
|
355
|
+
/* the band's centre runs from the mark's left edge to past its right one */
|
|
356
|
+
@keyframes skylcn-loader-shimmer {
|
|
357
|
+
from {
|
|
358
|
+
mask-position: 66.67% 0;
|
|
359
|
+
}
|
|
360
|
+
to {
|
|
361
|
+
mask-position: 21.17% 0;
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
@keyframes skylcn-loader-glint {
|
|
366
|
+
0%,
|
|
367
|
+
15% {
|
|
368
|
+
mask-position: 70% 70%;
|
|
369
|
+
}
|
|
370
|
+
65%,
|
|
371
|
+
100% {
|
|
372
|
+
mask-position: 25% 25%;
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
@keyframes skylcn-loader-halo {
|
|
283
377
|
0%,
|
|
284
378
|
100% {
|
|
285
|
-
opacity: 0
|
|
379
|
+
opacity: 0;
|
|
380
|
+
}
|
|
381
|
+
30%,
|
|
382
|
+
75% {
|
|
383
|
+
opacity: 0.6;
|
|
286
384
|
}
|
|
287
|
-
|
|
385
|
+
50% {
|
|
288
386
|
opacity: 1;
|
|
289
387
|
}
|
|
290
388
|
}
|