@hexdspace/react 0.1.45 → 0.1.47

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.d.ts CHANGED
@@ -933,6 +933,7 @@ declare function useVimController(): VimController;
933
933
 
934
934
  type VimBindingOptions = {
935
935
  enabled?: boolean;
936
+ allowArrowKeys?: boolean;
936
937
  };
937
938
  declare function useVimBindings(keyboardScopeId: string, options?: VimBindingOptions): void;
938
939
 
@@ -949,6 +950,7 @@ type UseVimRegionArgs = {
949
950
  focusOnCursorChange?: boolean;
950
951
  keyboardScopeId?: string;
951
952
  bindKeys?: boolean;
953
+ allowArrowKeys?: boolean;
952
954
  refreshDeps?: React__default.DependencyList;
953
955
  };
954
956
  type UseVimRegionResult = {
@@ -1134,4 +1136,6 @@ interface KbdProps extends React.HTMLAttributes<HTMLSpanElement>, VariantProps<t
1134
1136
  }
1135
1137
  declare const Kbd: React.ForwardRefExoticComponent<KbdProps & React.RefAttributes<HTMLSpanElement>>;
1136
1138
 
1137
- export { AuthController, AuthControllerCtx, type AuthControllerDeps, AuthControllerProvider, AuthDispatchCtx, AuthProvider, type AuthState, AuthStateCtx, Button, type ButtonProps, type CacheInstruction, type ClearSelectionArgs, type ClearTarget, type CombineMode, ConfirmDialog, type ConfirmDialogProps, type ConfirmPayload, type CursorFallback, CustomDialog, type CustomDialogPayload, type CustomDialogProps, type CustomInstruction, DEFAULT_NOTIFICATION_CHANNEL, type DefaultDialogPayloads, type DefaultDialogTemplateKey, DefaultDialogTemplateKeys, Dialog, DialogContent, DialogController, DialogHost, type DialogInstance, type DialogOptions, type DialogProps, type DialogTemplate, type DisableScope, DisableScopeUseCase, DropdownMenu, DropdownMenuItem, type DropdownMenuItemProps, type DropdownMenuProps, DropdownMenuSeparator, type EnableScope, EnableScopeUseCase, type ErrorResponse, Field, type FieldProps, type GenericResponse, type GroupedShortcuts, type HandleSelection, type HttpClient, HttpError, type HttpMethod, type HttpResponse, InMemorySelectionStore, InfoDialog, type InfoDialogProps, type InfoPayload, Input, type InputProps, type Instruction, type InstructionContext, type ItemId, Kbd, type KbdProps, KeyboardController, KeyboardProvider, type ListShortcuts, ListShortcutsUseCase, type ListedShortcut, MockAuthHttpClient, MockHttpClient, type Mode, type MutationFn, type Notification, type NotificationAction, NotificationHost, type NotificationInstruction, type NotificationVariant, NotifierController, type OnSuccessFn, type OptimisticSnapshot, type OptimisticUpdateFn, Popover, type PopoverProps, type QuerySelection, RedirectIfAuthed, type RedirectIfAuthedProps, type RegionId, type RegionKey, type RegionSelection, type RegisterRegionArgs, type RegisterShortcut, RegisterShortcutUseCase, type RequestConfig, RequireAuth, type RequireAuthProps, type ResolvedToastTheme, type ResponsiveMutation, type ScopeId, ScopeManager, type ScopeState, SelectionController, type SelectionControllerDeps, SelectionControllerProvider, type SelectionState, type SelectionStore, type ShortcutBinding, type ShortcutHandler, type ShortcutRegistration, type ShortcutScope, Skeleton, type SkeletonProps, Textarea, type TextareaProps, type ToastActionTheme, type ToastTheme, type ToastTransition, type ToastifyCSSVars, Tooltip, type UIFail, type UIOk, type UIResult, type UnregisterShortcut, UnregisterShortcutUseCase, type UseVimRegionArgs, type UseVimRegionResult, type User, VimController, type VimControllerDeps, VimControllerProvider, type VimDirection, type VimInterDirection, type VimKeyState, type VimPending, type VimRegionMeta, VimRegionRegistry, authController, controllerFactory, createAuthController, createSelectionController, createVimController, dialogController, httpClient as fetchHttpClient, getDialogTemplate, keyboardController, notifierController, registerDefaultDialogs, registerDialogTemplate, resolveToastTheme, ui, unregisterDialogTemplate, useAuth, useAuthActions, useAuthController, useAuthDispatch, useAuthedUser, useDialog, useKeyboardController, useResponsiveMutation, useSelectionController, useShortcut, useShortcutScope, useVimBindings, useVimController, useVimRegion };
1139
+ declare function useMotionDuration(varName: string, fallbackSeconds: number): number;
1140
+
1141
+ export { AuthController, AuthControllerCtx, type AuthControllerDeps, AuthControllerProvider, AuthDispatchCtx, AuthProvider, type AuthState, AuthStateCtx, Button, type ButtonProps, type CacheInstruction, type ClearSelectionArgs, type ClearTarget, type CombineMode, ConfirmDialog, type ConfirmDialogProps, type ConfirmPayload, type CursorFallback, CustomDialog, type CustomDialogPayload, type CustomDialogProps, type CustomInstruction, DEFAULT_NOTIFICATION_CHANNEL, type DefaultDialogPayloads, type DefaultDialogTemplateKey, DefaultDialogTemplateKeys, Dialog, DialogContent, DialogController, DialogHost, type DialogInstance, type DialogOptions, type DialogProps, type DialogTemplate, type DisableScope, DisableScopeUseCase, DropdownMenu, DropdownMenuItem, type DropdownMenuItemProps, type DropdownMenuProps, DropdownMenuSeparator, type EnableScope, EnableScopeUseCase, type ErrorResponse, Field, type FieldProps, type GenericResponse, type GroupedShortcuts, type HandleSelection, type HttpClient, HttpError, type HttpMethod, type HttpResponse, InMemorySelectionStore, InfoDialog, type InfoDialogProps, type InfoPayload, Input, type InputProps, type Instruction, type InstructionContext, type ItemId, Kbd, type KbdProps, KeyboardController, KeyboardProvider, type ListShortcuts, ListShortcutsUseCase, type ListedShortcut, MockAuthHttpClient, MockHttpClient, type Mode, type MutationFn, type Notification, type NotificationAction, NotificationHost, type NotificationInstruction, type NotificationVariant, NotifierController, type OnSuccessFn, type OptimisticSnapshot, type OptimisticUpdateFn, Popover, type PopoverProps, type QuerySelection, RedirectIfAuthed, type RedirectIfAuthedProps, type RegionId, type RegionKey, type RegionSelection, type RegisterRegionArgs, type RegisterShortcut, RegisterShortcutUseCase, type RequestConfig, RequireAuth, type RequireAuthProps, type ResolvedToastTheme, type ResponsiveMutation, type ScopeId, ScopeManager, type ScopeState, SelectionController, type SelectionControllerDeps, SelectionControllerProvider, type SelectionState, type SelectionStore, type ShortcutBinding, type ShortcutHandler, type ShortcutRegistration, type ShortcutScope, Skeleton, type SkeletonProps, Textarea, type TextareaProps, type ToastActionTheme, type ToastTheme, type ToastTransition, type ToastifyCSSVars, Tooltip, type UIFail, type UIOk, type UIResult, type UnregisterShortcut, UnregisterShortcutUseCase, type UseVimRegionArgs, type UseVimRegionResult, type User, VimController, type VimControllerDeps, VimControllerProvider, type VimDirection, type VimInterDirection, type VimKeyState, type VimPending, type VimRegionMeta, VimRegionRegistry, authController, controllerFactory, createAuthController, createSelectionController, createVimController, dialogController, httpClient as fetchHttpClient, getDialogTemplate, keyboardController, notifierController, registerDefaultDialogs, registerDialogTemplate, resolveToastTheme, ui, unregisterDialogTemplate, useAuth, useAuthActions, useAuthController, useAuthDispatch, useAuthedUser, useDialog, useKeyboardController, useMotionDuration, useResponsiveMutation, useSelectionController, useShortcut, useShortcutScope, useVimBindings, useVimController, useVimRegion };
package/dist/index.js CHANGED
@@ -3637,6 +3637,7 @@ function notify(entry) {
3637
3637
  function useVimBindings(keyboardScopeId, options = {}) {
3638
3638
  const vim = useVimController();
3639
3639
  const enabled = options.enabled ?? true;
3640
+ const allowArrowKeys = options.allowArrowKeys ?? true;
3640
3641
  const ownerIdRef = useRef3(Symbol("vim-binding-owner"));
3641
3642
  const [isOwner, setIsOwner] = useState5(false);
3642
3643
  const handleOwnerChange = useCallback5((ownerId) => {
@@ -3690,12 +3691,38 @@ function useVimBindings(keyboardScopeId, options = {}) {
3690
3691
  group: "vim"
3691
3692
  });
3692
3693
  }
3694
+ const arrowCombos = allowArrowKeys ? {
3695
+ left: "ArrowLeft",
3696
+ down: "ArrowDown",
3697
+ up: "ArrowUp",
3698
+ right: "ArrowRight"
3699
+ } : { left: null, down: null, up: null, right: null };
3693
3700
  return [
3694
3701
  ...digitBindings,
3695
- { combos: [charCombo("h")], handler: onChar("h"), description: "vim: left", group: "vim" },
3696
- { combos: [charCombo("j")], handler: onChar("j"), description: "vim: down", group: "vim" },
3697
- { combos: [charCombo("k")], handler: onChar("k"), description: "vim: up", group: "vim" },
3698
- { combos: [charCombo("l")], handler: onChar("l"), description: "vim: right", group: "vim" },
3702
+ {
3703
+ combos: [charCombo("h"), arrowCombos.left].filter(Boolean),
3704
+ handler: onChar("h"),
3705
+ description: "vim: left",
3706
+ group: "vim"
3707
+ },
3708
+ {
3709
+ combos: [charCombo("j"), arrowCombos.down].filter(Boolean),
3710
+ handler: onChar("j"),
3711
+ description: "vim: down",
3712
+ group: "vim"
3713
+ },
3714
+ {
3715
+ combos: [charCombo("k"), arrowCombos.up].filter(Boolean),
3716
+ handler: onChar("k"),
3717
+ description: "vim: up",
3718
+ group: "vim"
3719
+ },
3720
+ {
3721
+ combos: [charCombo("l"), arrowCombos.right].filter(Boolean),
3722
+ handler: onChar("l"),
3723
+ description: "vim: right",
3724
+ group: "vim"
3725
+ },
3699
3726
  { combos: [charCombo("g")], handler: onChar("g"), description: "vim: g prefix", group: "vim" },
3700
3727
  { combos: [charCombo("G")], handler: onChar("G"), description: "vim: G", group: "vim" },
3701
3728
  {
@@ -3704,10 +3731,15 @@ function useVimBindings(keyboardScopeId, options = {}) {
3704
3731
  description: "vim: toggle select",
3705
3732
  group: "vim"
3706
3733
  },
3707
- { combos: [charCombo(" ")], handler: onChar(" "), description: "vim: toggle item", group: "vim" },
3734
+ {
3735
+ combos: ["Space"],
3736
+ handler: (e) => vim.handleCharKey(" ", e),
3737
+ description: "vim: toggle item",
3738
+ group: "vim"
3739
+ },
3708
3740
  { combos: ["Escape"], handler: (e) => vim.handleEscape(e), description: "vim: escape", group: "vim" }
3709
3741
  ];
3710
- }, [enabled, isOwner, vim]);
3742
+ }, [allowArrowKeys, enabled, isOwner, vim]);
3711
3743
  useShortcut(keyboardScopeId, bindings, { ignoreTyping: true, preventDefault: true });
3712
3744
  }
3713
3745
 
@@ -3790,7 +3822,7 @@ function useVimRegion(containerRef, args) {
3790
3822
  keyboard.handleEnableScope(keyboardScopeId);
3791
3823
  return () => keyboard.handleDisableScope(keyboardScopeId);
3792
3824
  }, [bindKeys, keyboard, keyboardScopeId]);
3793
- useVimBindings(keyboardScopeId, { enabled: bindKeys });
3825
+ useVimBindings(keyboardScopeId, { enabled: bindKeys, allowArrowKeys: args.allowArrowKeys });
3794
3826
  useSyncExternalStore(
3795
3827
  (listener) => selection.subscribe(listener),
3796
3828
  () => selection.getVersion(),
@@ -4902,6 +4934,7 @@ export {
4902
4934
  useAuthedUser,
4903
4935
  useDialog,
4904
4936
  useKeyboardController,
4937
+ useMotionDuration,
4905
4938
  useResponsiveMutation,
4906
4939
  useSelectionController,
4907
4940
  useShortcut,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hexdspace/react",
3
- "version": "0.1.45",
3
+ "version": "0.1.47",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",