@cloudvoyant/helical-ui 0.21.0 → 0.21.1

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/dist/index.cjs CHANGED
@@ -2629,10 +2629,10 @@ function createHelixPreset(leaderKey = "Space") {
2629
2629
  },
2630
2630
  b: {
2631
2631
  key: "b",
2632
- label: "Window Bottom",
2633
- description: "Jump to bottom of visible viewport (gb)",
2632
+ label: "Go to Bottom",
2633
+ description: "Jump to last item or bottom of document (gb)",
2634
2634
  category: "Goto",
2635
- commandId: "view.bottom"
2635
+ commandId: "motion.docEnd"
2636
2636
  },
2637
2637
  n: {
2638
2638
  key: "n",
@@ -2787,6 +2787,13 @@ function createVimPreset(leaderKey = "Space") {
2787
2787
  category: "Goto",
2788
2788
  commandId: "motion.docEnd"
2789
2789
  },
2790
+ b: {
2791
+ key: "b",
2792
+ label: "Last Line / Bottom",
2793
+ description: "Jump to last item or bottom of document (gb)",
2794
+ category: "Goto",
2795
+ commandId: "motion.docEnd"
2796
+ },
2790
2797
  h: {
2791
2798
  key: "h",
2792
2799
  label: "Start of Line",
@@ -2955,10 +2962,10 @@ function createKakounePreset(leaderKey = "Space") {
2955
2962
  },
2956
2963
  b: {
2957
2964
  key: "b",
2958
- label: "Window Bottom",
2959
- description: "Go to bottom of visible window (gb)",
2965
+ label: "Buffer Bottom",
2966
+ description: "Go to bottom of buffer or last item (gb)",
2960
2967
  category: "Goto",
2961
- commandId: "view.bottom"
2968
+ commandId: "motion.docEnd"
2962
2969
  },
2963
2970
  a: {
2964
2971
  key: "a",
@@ -3764,17 +3771,34 @@ function createWhichKeyController(options = {}) {
3764
3771
  emit();
3765
3772
  return true;
3766
3773
  }
3774
+ function isScrollableContainer(el, doc) {
3775
+ if (!doc || el === doc.body || el === doc.documentElement) return false;
3776
+ if (el.scrollHeight <= el.clientHeight + 2) return false;
3777
+ const win = doc.defaultView;
3778
+ if (!win || typeof win.getComputedStyle !== "function") return true;
3779
+ const overflowY = win.getComputedStyle(el).overflowY;
3780
+ return overflowY === "auto" || overflowY === "scroll" || overflowY === "overlay";
3781
+ }
3767
3782
  function jumpToBoundary(boundary) {
3768
3783
  const container = getActiveContainer();
3769
3784
  if (!container) return false;
3770
3785
  const items = getPaneFocusableItems(container, options.getScopeElement?.());
3771
3786
  if (items.length === 0) return false;
3787
+ const doc = resolveDoc();
3788
+ const win = doc?.defaultView ?? null;
3772
3789
  recordCurrentLocation();
3773
3790
  if (boundary === "start" || boundary === "first-in-group") {
3774
3791
  const target2 = items[0];
3775
3792
  focusElementInActivePane(target2);
3776
3793
  if (boundary === "start") {
3777
3794
  container.scrollTop = 0;
3795
+ if (win && !isScrollableContainer(container, doc)) {
3796
+ try {
3797
+ win.scrollTo({ top: 0, behavior: "instant" });
3798
+ } catch {
3799
+ win.scrollTo(0, 0);
3800
+ }
3801
+ }
3778
3802
  }
3779
3803
  recordCurrentLocation();
3780
3804
  emit();
@@ -3784,6 +3808,18 @@ function createWhichKeyController(options = {}) {
3784
3808
  focusElementInActivePane(target);
3785
3809
  if (boundary === "end") {
3786
3810
  container.scrollTop = container.scrollHeight;
3811
+ if (win && !isScrollableContainer(container, doc)) {
3812
+ const scrollMax = Math.max(
3813
+ doc?.documentElement?.scrollHeight ?? 0,
3814
+ doc?.body?.scrollHeight ?? 0,
3815
+ container.scrollHeight
3816
+ );
3817
+ try {
3818
+ win.scrollTo({ top: scrollMax, behavior: "instant" });
3819
+ } catch {
3820
+ win.scrollTo(0, scrollMax);
3821
+ }
3822
+ }
3787
3823
  }
3788
3824
  recordCurrentLocation();
3789
3825
  emit();
package/dist/index.js CHANGED
@@ -2251,10 +2251,10 @@ function createHelixPreset(leaderKey = "Space") {
2251
2251
  },
2252
2252
  b: {
2253
2253
  key: "b",
2254
- label: "Window Bottom",
2255
- description: "Jump to bottom of visible viewport (gb)",
2254
+ label: "Go to Bottom",
2255
+ description: "Jump to last item or bottom of document (gb)",
2256
2256
  category: "Goto",
2257
- commandId: "view.bottom"
2257
+ commandId: "motion.docEnd"
2258
2258
  },
2259
2259
  n: {
2260
2260
  key: "n",
@@ -2409,6 +2409,13 @@ function createVimPreset(leaderKey = "Space") {
2409
2409
  category: "Goto",
2410
2410
  commandId: "motion.docEnd"
2411
2411
  },
2412
+ b: {
2413
+ key: "b",
2414
+ label: "Last Line / Bottom",
2415
+ description: "Jump to last item or bottom of document (gb)",
2416
+ category: "Goto",
2417
+ commandId: "motion.docEnd"
2418
+ },
2412
2419
  h: {
2413
2420
  key: "h",
2414
2421
  label: "Start of Line",
@@ -2577,10 +2584,10 @@ function createKakounePreset(leaderKey = "Space") {
2577
2584
  },
2578
2585
  b: {
2579
2586
  key: "b",
2580
- label: "Window Bottom",
2581
- description: "Go to bottom of visible window (gb)",
2587
+ label: "Buffer Bottom",
2588
+ description: "Go to bottom of buffer or last item (gb)",
2582
2589
  category: "Goto",
2583
- commandId: "view.bottom"
2590
+ commandId: "motion.docEnd"
2584
2591
  },
2585
2592
  a: {
2586
2593
  key: "a",
@@ -3386,17 +3393,34 @@ function createWhichKeyController(options = {}) {
3386
3393
  emit();
3387
3394
  return true;
3388
3395
  }
3396
+ function isScrollableContainer(el, doc) {
3397
+ if (!doc || el === doc.body || el === doc.documentElement) return false;
3398
+ if (el.scrollHeight <= el.clientHeight + 2) return false;
3399
+ const win = doc.defaultView;
3400
+ if (!win || typeof win.getComputedStyle !== "function") return true;
3401
+ const overflowY = win.getComputedStyle(el).overflowY;
3402
+ return overflowY === "auto" || overflowY === "scroll" || overflowY === "overlay";
3403
+ }
3389
3404
  function jumpToBoundary(boundary) {
3390
3405
  const container = getActiveContainer();
3391
3406
  if (!container) return false;
3392
3407
  const items = getPaneFocusableItems(container, options.getScopeElement?.());
3393
3408
  if (items.length === 0) return false;
3409
+ const doc = resolveDoc();
3410
+ const win = doc?.defaultView ?? null;
3394
3411
  recordCurrentLocation();
3395
3412
  if (boundary === "start" || boundary === "first-in-group") {
3396
3413
  const target2 = items[0];
3397
3414
  focusElementInActivePane(target2);
3398
3415
  if (boundary === "start") {
3399
3416
  container.scrollTop = 0;
3417
+ if (win && !isScrollableContainer(container, doc)) {
3418
+ try {
3419
+ win.scrollTo({ top: 0, behavior: "instant" });
3420
+ } catch {
3421
+ win.scrollTo(0, 0);
3422
+ }
3423
+ }
3400
3424
  }
3401
3425
  recordCurrentLocation();
3402
3426
  emit();
@@ -3406,6 +3430,18 @@ function createWhichKeyController(options = {}) {
3406
3430
  focusElementInActivePane(target);
3407
3431
  if (boundary === "end") {
3408
3432
  container.scrollTop = container.scrollHeight;
3433
+ if (win && !isScrollableContainer(container, doc)) {
3434
+ const scrollMax = Math.max(
3435
+ doc?.documentElement?.scrollHeight ?? 0,
3436
+ doc?.body?.scrollHeight ?? 0,
3437
+ container.scrollHeight
3438
+ );
3439
+ try {
3440
+ win.scrollTo({ top: scrollMax, behavior: "instant" });
3441
+ } catch {
3442
+ win.scrollTo(0, scrollMax);
3443
+ }
3444
+ }
3409
3445
  }
3410
3446
  recordCurrentLocation();
3411
3447
  emit();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cloudvoyant/helical-ui",
3
- "version": "0.21.0",
3
+ "version": "0.21.1",
4
4
  "description": "helical-ui shared component interfaces, cva variants, and theme",
5
5
  "license": "MIT",
6
6
  "type": "module",