@blakesteve/roster 5.13.0 → 5.14.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/README.md +87 -4
- package/dist/components/molecules/Carousel/Carousel.cjs +1 -1
- package/dist/components/molecules/Carousel/Carousel.d.ts +65 -3
- package/dist/components/molecules/Carousel/Carousel.js +376 -225
- package/dist/components/molecules/Carousel/carousel-math.cjs +1 -1
- package/dist/components/molecules/Carousel/carousel-math.d.ts +16 -0
- package/dist/components/molecules/Carousel/carousel-math.js +63 -44
- package/dist/components/molecules/Carousel/carousel-selection.cjs +1 -0
- package/dist/components/molecules/Carousel/carousel-selection.d.ts +28 -0
- package/dist/components/molecules/Carousel/carousel-selection.js +23 -0
- package/dist/internal/dev.cjs +1 -0
- package/dist/internal/dev.d.ts +10 -0
- package/dist/internal/dev.js +10 -0
- package/dist/meta.json +3 -3
- package/dist/roster.css +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const p=6,a=1;function u(t){return Math.max(0,t.scrollWidth-t.clientWidth)}function m(t){return u(t)>a}function L(t){return t.scrollLeft>a}function x(t){return t.scrollLeft<u(t)-a}function o(t,n){const e=t.items[n];if(!e)return 0;const r=t.align==="start"?e.start-t.paddingStart:(e.start+e.end)/2-(t.paddingStart+(t.clientWidth-t.paddingStart-t.paddingEnd)/2);return Math.min(Math.max(0,r),u(t))}function f(t){const n=t.scrollLeft-a,e=t.scrollLeft+t.clientWidth+a,r=[];return t.items.forEach((i,l)=>{i.start>=n&&i.end<=e&&r.push(l)}),r}function h(t){let n=0,e=1/0;return t.items.forEach((r,i)=>{const l=Math.abs(o(t,i)-t.scrollLeft);l<e&&(n=i,e=l)}),n}function E(t){const n=f(t);return n.length?n[0]:h(t)}function b(t,n){const e=t.items.length;if(!e)return 0;const r=f(t),i=r.length?r[0]:h(t),l=Math.max(1,r.length);let c=Math.min(e-1,Math.max(0,i+n*l));for(;c>0&&c<e-1&&Math.abs(o(t,c)-t.scrollLeft)<=a;)c+=n;return o(t,c)}function v(t){return Math.max(1,f(t).length)}function M(t,n,e=t.scrollLeft){const r=t.items[n];if(!r)return null;const i=s=>[s+t.paddingStart-a,s+t.clientWidth-t.paddingEnd+a],[l,c]=i(e);if(r.start>=l&&r.end<=c)return null;if(t.align==="center"||r.start<l)return o(t,n);for(let s=0;s<=n;s++){const d=o(t,s);if(d<e)continue;const[,S]=i(d);if(r.end<=S)return d}return o(t,n)}exports.CAROUSEL_DRAG_THRESHOLD=p;exports.CAROUSEL_TOLERANCE=a;exports.canScrollNext=x;exports.canScrollPrev=L;exports.currentIndex=E;exports.fullyVisible=f;exports.maxScroll=u;exports.nearestIndex=h;exports.overflows=m;exports.pageStep=v;exports.pageTarget=b;exports.revealTarget=M;exports.snapPosition=o;
|
|
@@ -58,3 +58,19 @@ export declare function currentIndex(g: CarouselGeometry): number;
|
|
|
58
58
|
* Returns the target `scrollLeft`.
|
|
59
59
|
*/
|
|
60
60
|
export declare function pageTarget(g: CarouselGeometry, direction: 1 | -1): number;
|
|
61
|
+
/**
|
|
62
|
+
* How far Page Up and Page Down move in selection mode: as many options as
|
|
63
|
+
* are wholly in view, at least one.
|
|
64
|
+
*/
|
|
65
|
+
export declare function pageStep(g: CarouselGeometry): number;
|
|
66
|
+
/**
|
|
67
|
+
* The `scrollLeft` that brings item `i` wholly into view, measured from
|
|
68
|
+
* `from` (where the row is, or where a glide is taking it), or `null` when it
|
|
69
|
+
* already is. Inside the scroll padding, so a revealed item clears the gutter.
|
|
70
|
+
*
|
|
71
|
+
* The row moves as little as it can and always lands on a snap point, which
|
|
72
|
+
* the browser would snap it to anyway: an item off the leading side snaps to
|
|
73
|
+
* its own place; one off the trailing side lands on the first snap point that
|
|
74
|
+
* shows it whole. With `center`, an item out of view is centered.
|
|
75
|
+
*/
|
|
76
|
+
export declare function revealTarget(g: CarouselGeometry, i: number, from?: number): number | null;
|
|
@@ -1,58 +1,77 @@
|
|
|
1
|
-
const
|
|
2
|
-
function
|
|
1
|
+
const L = 6, h = 1;
|
|
2
|
+
function u(t) {
|
|
3
3
|
return Math.max(0, t.scrollWidth - t.clientWidth);
|
|
4
4
|
}
|
|
5
|
-
function
|
|
6
|
-
return
|
|
5
|
+
function R(t) {
|
|
6
|
+
return u(t) > 1;
|
|
7
7
|
}
|
|
8
|
-
function
|
|
8
|
+
function A(t) {
|
|
9
9
|
return t.scrollLeft > 1;
|
|
10
10
|
}
|
|
11
|
-
function
|
|
12
|
-
return t.scrollLeft <
|
|
11
|
+
function O(t) {
|
|
12
|
+
return t.scrollLeft < u(t) - 1;
|
|
13
13
|
}
|
|
14
|
-
function
|
|
15
|
-
const
|
|
16
|
-
if (!
|
|
17
|
-
const r = t.align === "start" ?
|
|
18
|
-
return Math.min(Math.max(0, r),
|
|
14
|
+
function l(t, n) {
|
|
15
|
+
const e = t.items[n];
|
|
16
|
+
if (!e) return 0;
|
|
17
|
+
const r = t.align === "start" ? e.start - t.paddingStart : (e.start + e.end) / 2 - (t.paddingStart + (t.clientWidth - t.paddingStart - t.paddingEnd) / 2);
|
|
18
|
+
return Math.min(Math.max(0, r), u(t));
|
|
19
19
|
}
|
|
20
|
-
function
|
|
21
|
-
const
|
|
22
|
-
return t.items.forEach((i,
|
|
23
|
-
i.start >=
|
|
20
|
+
function f(t) {
|
|
21
|
+
const n = t.scrollLeft - 1, e = t.scrollLeft + t.clientWidth + 1, r = [];
|
|
22
|
+
return t.items.forEach((i, c) => {
|
|
23
|
+
i.start >= n && i.end <= e && r.push(c);
|
|
24
24
|
}), r;
|
|
25
25
|
}
|
|
26
|
-
function
|
|
27
|
-
let
|
|
26
|
+
function E(t) {
|
|
27
|
+
let n = 0, e = 1 / 0;
|
|
28
28
|
return t.items.forEach((r, i) => {
|
|
29
|
-
const
|
|
30
|
-
|
|
31
|
-
}),
|
|
29
|
+
const c = Math.abs(l(t, i) - t.scrollLeft);
|
|
30
|
+
c < e && (n = i, e = c);
|
|
31
|
+
}), n;
|
|
32
32
|
}
|
|
33
|
-
function
|
|
34
|
-
const
|
|
35
|
-
return
|
|
36
|
-
}
|
|
37
|
-
function
|
|
38
|
-
const
|
|
39
|
-
if (!
|
|
40
|
-
const r =
|
|
41
|
-
let
|
|
42
|
-
for (;
|
|
43
|
-
|
|
44
|
-
return
|
|
33
|
+
function C(t) {
|
|
34
|
+
const n = f(t);
|
|
35
|
+
return n.length ? n[0] : E(t);
|
|
36
|
+
}
|
|
37
|
+
function S(t, n) {
|
|
38
|
+
const e = t.items.length;
|
|
39
|
+
if (!e) return 0;
|
|
40
|
+
const r = f(t), i = r.length ? r[0] : E(t), c = Math.max(1, r.length);
|
|
41
|
+
let s = Math.min(e - 1, Math.max(0, i + n * c));
|
|
42
|
+
for (; s > 0 && s < e - 1 && Math.abs(l(t, s) - t.scrollLeft) <= 1; )
|
|
43
|
+
s += n;
|
|
44
|
+
return l(t, s);
|
|
45
|
+
}
|
|
46
|
+
function m(t) {
|
|
47
|
+
return Math.max(1, f(t).length);
|
|
48
|
+
}
|
|
49
|
+
function p(t, n, e = t.scrollLeft) {
|
|
50
|
+
const r = t.items[n];
|
|
51
|
+
if (!r) return null;
|
|
52
|
+
const i = (a) => [a + t.paddingStart - 1, a + t.clientWidth - t.paddingEnd + 1], [c, s] = i(e);
|
|
53
|
+
if (r.start >= c && r.end <= s) return null;
|
|
54
|
+
if (t.align === "center" || r.start < c) return l(t, n);
|
|
55
|
+
for (let a = 0; a <= n; a++) {
|
|
56
|
+
const o = l(t, a);
|
|
57
|
+
if (o < e) continue;
|
|
58
|
+
const [, d] = i(o);
|
|
59
|
+
if (r.end <= d) return o;
|
|
60
|
+
}
|
|
61
|
+
return l(t, n);
|
|
45
62
|
}
|
|
46
63
|
export {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
64
|
+
L as CAROUSEL_DRAG_THRESHOLD,
|
|
65
|
+
h as CAROUSEL_TOLERANCE,
|
|
66
|
+
O as canScrollNext,
|
|
67
|
+
A as canScrollPrev,
|
|
68
|
+
C as currentIndex,
|
|
69
|
+
f as fullyVisible,
|
|
70
|
+
u as maxScroll,
|
|
71
|
+
E as nearestIndex,
|
|
72
|
+
R as overflows,
|
|
73
|
+
m as pageStep,
|
|
74
|
+
S as pageTarget,
|
|
75
|
+
p as revealTarget,
|
|
76
|
+
l as snapPosition
|
|
58
77
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=700;function d(r,t,n,i){if(!r||!n)return-1;const e=[...n].every(l=>l===n[0]),f=e?n[0]:n,u=e?t+1:t;for(let l=0;l<r;l++){const a=((u+l)%r+r)%r;if(i(a).trim().toLowerCase().startsWith(f))return a}return-1}function h(r,t,n){if(n===null)return null;const i=r.indexOf(n);if(i===-1)return null;for(let e=i+1;e<r.length;e++)if(t.has(r[e]))return r[e];for(let e=i-1;e>=0;e--)if(t.has(r[e]))return r[e];return null}exports.TYPEAHEAD_RESET_MS=s;exports.survivingNeighbor=h;exports.typeaheadIndex=d;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Selection mode's decisions that need no DOM: which option type-ahead lands
|
|
3
|
+
* on, and where the active option goes when the one it was on leaves.
|
|
4
|
+
*
|
|
5
|
+
* Pure, so they're tested with literals; the stories drive the real keys.
|
|
6
|
+
*/
|
|
7
|
+
/** How long a pause starts type-ahead over, in ms. */
|
|
8
|
+
export declare const TYPEAHEAD_RESET_MS = 700;
|
|
9
|
+
/**
|
|
10
|
+
* The option type-ahead lands on, or -1 for none.
|
|
11
|
+
*
|
|
12
|
+
* `text` is everything typed since the last pause, lowercased. One letter, or
|
|
13
|
+
* the same letter again and again, steps through the options starting with
|
|
14
|
+
* it, beginning after `from` and wrapping, so pressing "g" three times visits
|
|
15
|
+
* the third option starting with "g". Anything longer matches from `from`
|
|
16
|
+
* itself, so "gl" typed after "g" stays put when the active option already
|
|
17
|
+
* starts with "gl".
|
|
18
|
+
*
|
|
19
|
+
* `labelAt(i)` is option `i`'s text, read only as far as the search goes.
|
|
20
|
+
*/
|
|
21
|
+
export declare function typeaheadIndex(count: number, from: number, text: string, labelAt: (index: number) => string): number;
|
|
22
|
+
/**
|
|
23
|
+
* Where the active option goes when its own has left the row: the nearest
|
|
24
|
+
* option after it that's still there, in the order before the change, else
|
|
25
|
+
* the nearest before it. `null` when none of its old neighbors is left, or
|
|
26
|
+
* when it wasn't in the old order at all.
|
|
27
|
+
*/
|
|
28
|
+
export declare function survivingNeighbor(previous: readonly string[], present: ReadonlySet<string>, lost: string | null): string | null;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
const u = 700;
|
|
2
|
+
function h(r, e, t, i) {
|
|
3
|
+
if (!r || !t) return -1;
|
|
4
|
+
const n = [...t].every((f) => f === t[0]), a = n ? t[0] : t, s = n ? e + 1 : e;
|
|
5
|
+
for (let f = 0; f < r; f++) {
|
|
6
|
+
const l = ((s + f) % r + r) % r;
|
|
7
|
+
if (i(l).trim().toLowerCase().startsWith(a)) return l;
|
|
8
|
+
}
|
|
9
|
+
return -1;
|
|
10
|
+
}
|
|
11
|
+
function c(r, e, t) {
|
|
12
|
+
if (t === null) return null;
|
|
13
|
+
const i = r.indexOf(t);
|
|
14
|
+
if (i === -1) return null;
|
|
15
|
+
for (let n = i + 1; n < r.length; n++) if (e.has(r[n])) return r[n];
|
|
16
|
+
for (let n = i - 1; n >= 0; n--) if (e.has(r[n])) return r[n];
|
|
17
|
+
return null;
|
|
18
|
+
}
|
|
19
|
+
export {
|
|
20
|
+
u as TYPEAHEAD_RESET_MS,
|
|
21
|
+
c as survivingNeighbor,
|
|
22
|
+
h as typeaheadIndex
|
|
23
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function e(){try{return process.env.NODE_ENV!=="production"}catch{return!0}}exports.isDevelopment=e;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Whether this is a development build of the consuming app, for warnings
|
|
3
|
+
* that cost something to check and say nothing a user needs.
|
|
4
|
+
*
|
|
5
|
+
* Written as `process.env.NODE_ENV` in full, because that's the expression a
|
|
6
|
+
* consumer's bundler replaces (Vite, webpack, Next). Roster's own build leaves
|
|
7
|
+
* it alone, so the consumer's build decides. A page with no bundler and no
|
|
8
|
+
* `process` counts as development.
|
|
9
|
+
*/
|
|
10
|
+
export declare function isDevelopment(): boolean;
|
package/dist/meta.json
CHANGED