@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.
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=6,i=1;function a(t){return Math.max(0,t.scrollWidth-t.clientWidth)}function h(t){return a(t)>i}function S(t){return t.scrollLeft>i}function L(t){return t.scrollLeft<a(t)-i}function s(t,e){const n=t.items[e];if(!n)return 0;const r=t.align==="start"?n.start-t.paddingStart:(n.start+n.end)/2-(t.paddingStart+(t.clientWidth-t.paddingStart-t.paddingEnd)/2);return Math.min(Math.max(0,r),a(t))}function u(t){const e=t.scrollLeft-i,n=t.scrollLeft+t.clientWidth+i,r=[];return t.items.forEach((l,c)=>{l.start>=e&&l.end<=n&&r.push(c)}),r}function f(t){let e=0,n=1/0;return t.items.forEach((r,l)=>{const c=Math.abs(s(t,l)-t.scrollLeft);c<n&&(e=l,n=c)}),e}function m(t){const e=u(t);return e.length?e[0]:f(t)}function x(t,e){const n=t.items.length;if(!n)return 0;const r=u(t),l=r.length?r[0]:f(t),c=Math.max(1,r.length);let o=Math.min(n-1,Math.max(0,l+e*c));for(;o>0&&o<n-1&&Math.abs(s(t,o)-t.scrollLeft)<=i;)o+=e;return s(t,o)}exports.CAROUSEL_DRAG_THRESHOLD=d;exports.CAROUSEL_TOLERANCE=i;exports.canScrollNext=L;exports.canScrollPrev=S;exports.currentIndex=m;exports.fullyVisible=u;exports.maxScroll=a;exports.nearestIndex=f;exports.overflows=h;exports.pageTarget=x;exports.snapPosition=s;
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 E = 6, u = 1;
2
- function a(t) {
1
+ const L = 6, h = 1;
2
+ function u(t) {
3
3
  return Math.max(0, t.scrollWidth - t.clientWidth);
4
4
  }
5
- function L(t) {
6
- return a(t) > 1;
5
+ function R(t) {
6
+ return u(t) > 1;
7
7
  }
8
- function h(t) {
8
+ function A(t) {
9
9
  return t.scrollLeft > 1;
10
10
  }
11
- function d(t) {
12
- return t.scrollLeft < a(t) - 1;
11
+ function O(t) {
12
+ return t.scrollLeft < u(t) - 1;
13
13
  }
14
- function o(t, e) {
15
- const n = t.items[e];
16
- if (!n) return 0;
17
- const r = t.align === "start" ? n.start - t.paddingStart : (n.start + n.end) / 2 - (t.paddingStart + (t.clientWidth - t.paddingStart - t.paddingEnd) / 2);
18
- return Math.min(Math.max(0, r), a(t));
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 l(t) {
21
- const e = t.scrollLeft - 1, n = t.scrollLeft + t.clientWidth + 1, r = [];
22
- return t.items.forEach((i, s) => {
23
- i.start >= e && i.end <= n && r.push(s);
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 f(t) {
27
- let e = 0, n = 1 / 0;
26
+ function E(t) {
27
+ let n = 0, e = 1 / 0;
28
28
  return t.items.forEach((r, i) => {
29
- const s = Math.abs(o(t, i) - t.scrollLeft);
30
- s < n && (e = i, n = s);
31
- }), e;
29
+ const c = Math.abs(l(t, i) - t.scrollLeft);
30
+ c < e && (n = i, e = c);
31
+ }), n;
32
32
  }
33
- function R(t) {
34
- const e = l(t);
35
- return e.length ? e[0] : f(t);
36
- }
37
- function A(t, e) {
38
- const n = t.items.length;
39
- if (!n) return 0;
40
- const r = l(t), i = r.length ? r[0] : f(t), s = Math.max(1, r.length);
41
- let c = Math.min(n - 1, Math.max(0, i + e * s));
42
- for (; c > 0 && c < n - 1 && Math.abs(o(t, c) - t.scrollLeft) <= 1; )
43
- c += e;
44
- return o(t, c);
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
- E as CAROUSEL_DRAG_THRESHOLD,
48
- u as CAROUSEL_TOLERANCE,
49
- d as canScrollNext,
50
- h as canScrollPrev,
51
- R as currentIndex,
52
- l as fullyVisible,
53
- a as maxScroll,
54
- f as nearestIndex,
55
- L as overflows,
56
- A as pageTarget,
57
- o as snapPosition
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;
@@ -0,0 +1,10 @@
1
+ function e() {
2
+ try {
3
+ return process.env.NODE_ENV !== "production";
4
+ } catch {
5
+ return !0;
6
+ }
7
+ }
8
+ export {
9
+ e as isDevelopment
10
+ };
package/dist/meta.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "5.13.0",
3
- "tests": 2431,
4
- "testFiles": 606
2
+ "version": "5.14.0",
3
+ "tests": 2481,
4
+ "testFiles": 618
5
5
  }