blecsd 0.1.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.
Files changed (109) hide show
  1. package/LICENSE +20 -0
  2. package/README.md +220 -0
  3. package/dist/3d/index.d.ts +5 -0
  4. package/dist/3d/index.js +1 -0
  5. package/dist/audio/index.d.ts +177 -0
  6. package/dist/audio/index.js +1 -0
  7. package/dist/border-D_Jb4ZJV.d.ts +257 -0
  8. package/dist/cell-DwIu2ryP.d.ts +505 -0
  9. package/dist/chunk-2UBBZFE4.js +1 -0
  10. package/dist/chunk-35LCBY6P.js +1 -0
  11. package/dist/chunk-3B7MIVW6.js +1 -0
  12. package/dist/chunk-3EGGGI5J.js +3 -0
  13. package/dist/chunk-4LWWONFK.js +1 -0
  14. package/dist/chunk-4X4N4HNQ.js +2 -0
  15. package/dist/chunk-5PELJRUQ.js +1 -0
  16. package/dist/chunk-AEJIX2MW.js +1 -0
  17. package/dist/chunk-AQ7LW75B.js +1 -0
  18. package/dist/chunk-AXZQAH4X.js +1 -0
  19. package/dist/chunk-B6Z2JFRY.js +1 -0
  20. package/dist/chunk-BCADUCOZ.js +1 -0
  21. package/dist/chunk-C5PCEQ6G.js +1 -0
  22. package/dist/chunk-CIK4AMUA.js +1 -0
  23. package/dist/chunk-DNRXW56C.js +1 -0
  24. package/dist/chunk-FC5FFAAC.js +12 -0
  25. package/dist/chunk-FGHEFXLK.js +1 -0
  26. package/dist/chunk-FYEBZAWN.js +1 -0
  27. package/dist/chunk-G7GIWWLE.js +1 -0
  28. package/dist/chunk-GYHI26UE.js +1 -0
  29. package/dist/chunk-H2YAOJDW.js +1 -0
  30. package/dist/chunk-J4JZ2NU2.js +1 -0
  31. package/dist/chunk-JKVHO4LH.js +1 -0
  32. package/dist/chunk-K2B2OXQ5.js +5 -0
  33. package/dist/chunk-K37L3G4Z.js +4 -0
  34. package/dist/chunk-KD55INV7.js +1 -0
  35. package/dist/chunk-KFAK4A3G.js +1 -0
  36. package/dist/chunk-LCN2ZITE.js +1 -0
  37. package/dist/chunk-LYSK5S63.js +1 -0
  38. package/dist/chunk-NZ55KBM6.js +1 -0
  39. package/dist/chunk-OMMJ7B5P.js +1 -0
  40. package/dist/chunk-OUXUPF3V.js +33 -0
  41. package/dist/chunk-OVT2PPGW.js +19 -0
  42. package/dist/chunk-P6CJO3BC.js +1 -0
  43. package/dist/chunk-PSXXMBVJ.js +1 -0
  44. package/dist/chunk-PXXGH3BV.js +1 -0
  45. package/dist/chunk-QIKIOVP2.js +1 -0
  46. package/dist/chunk-SHUC6JWA.js +1 -0
  47. package/dist/chunk-TDXJDLY6.js +6 -0
  48. package/dist/chunk-TWSWTBYL.js +1 -0
  49. package/dist/chunk-TYMY2TBR.js +3 -0
  50. package/dist/chunk-VNZ6CWJA.js +2 -0
  51. package/dist/chunk-VOCM5T2G.js +5 -0
  52. package/dist/chunk-W5OU7Z6J.js +1 -0
  53. package/dist/chunk-WNG4A3K7.js +4 -0
  54. package/dist/chunk-XQIGERNI.js +1 -0
  55. package/dist/chunk-XZA63ZPO.js +1 -0
  56. package/dist/chunk-YAMOSPWB.js +4 -0
  57. package/dist/chunk-YD6ULIUR.js +1 -0
  58. package/dist/chunk-Z4EZERNE.js +1 -0
  59. package/dist/cli/init.d.ts +86 -0
  60. package/dist/cli/init.js +179 -0
  61. package/dist/color-B78w3zH-.d.ts +79 -0
  62. package/dist/components/index.d.ts +10298 -0
  63. package/dist/components/index.js +1 -0
  64. package/dist/core/index.d.ts +6700 -0
  65. package/dist/core/index.js +1 -0
  66. package/dist/debug/index.d.ts +711 -0
  67. package/dist/debug/index.js +1 -0
  68. package/dist/doubleBuffer-CKQFmlPN.d.ts +95 -0
  69. package/dist/errors/index.d.ts +1110 -0
  70. package/dist/errors/index.js +1 -0
  71. package/dist/events-BbbxkgvX.d.ts +125 -0
  72. package/dist/game/index.d.ts +486 -0
  73. package/dist/game/index.js +1 -0
  74. package/dist/gameLoop-BIPW7-OY.d.ts +219 -0
  75. package/dist/index-zSGJ2eUk.d.ts +3156 -0
  76. package/dist/index.d.ts +246 -0
  77. package/dist/index.js +1 -0
  78. package/dist/input/index.d.ts +158 -0
  79. package/dist/input/index.js +1 -0
  80. package/dist/inputActions-CefRUBuT.d.ts +2637 -0
  81. package/dist/keyParser-Bwm8-l7v.d.ts +229 -0
  82. package/dist/mouseParser-Cfrbn3AX.d.ts +177 -0
  83. package/dist/parser-iMHmQuUh.d.ts +265 -0
  84. package/dist/program-BZaKqDKH.d.ts +141 -0
  85. package/dist/renderable-jTMOA-GK.d.ts +302 -0
  86. package/dist/scheduler-DcfoFuum.d.ts +86 -0
  87. package/dist/schemas/index.d.ts +936 -0
  88. package/dist/schemas/index.js +1 -0
  89. package/dist/systems/index.d.ts +4036 -0
  90. package/dist/systems/index.js +1 -0
  91. package/dist/terminal/index.d.ts +7357 -0
  92. package/dist/terminal/index.js +1 -0
  93. package/dist/terminus-14-bold-HWSPRLJD.js +1 -0
  94. package/dist/terminus-14-normal-T3SWMH4D.js +1 -0
  95. package/dist/tilemap-D1HJvKy3.d.ts +1211 -0
  96. package/dist/types-BcsvoKzf.d.ts +68 -0
  97. package/dist/utils/index.d.ts +6104 -0
  98. package/dist/utils/index.js +1 -0
  99. package/dist/viewport3d-xI33-_wq.d.ts +182 -0
  100. package/dist/virtualScrollback-DvZTRU8a.d.ts +274 -0
  101. package/dist/virtualViewport-Dx2iJliO.d.ts +2334 -0
  102. package/dist/virtualizedLineStore-DwPEvPkk.d.ts +297 -0
  103. package/dist/widgets/bigText.d.ts +230 -0
  104. package/dist/widgets/bigText.js +1 -0
  105. package/dist/widgets/fonts/index.d.ts +211 -0
  106. package/dist/widgets/fonts/index.js +1 -0
  107. package/dist/widgets/index.d.ts +8591 -0
  108. package/dist/widgets/index.js +1 -0
  109. package/package.json +213 -0
@@ -0,0 +1,158 @@
1
+ import { b as KeyEvent } from '../keyParser-Bwm8-l7v.js';
2
+ import 'zod';
3
+
4
+ /**
5
+ * Vi-style navigation mode for scrollable elements.
6
+ *
7
+ * Provides vi key bindings for scrolling, cursor movement,
8
+ * and search within scrollable content. Enable with vi: true.
9
+ * Compatible with existing key bindings.
10
+ *
11
+ * @module input/viMode
12
+ */
13
+
14
+ /**
15
+ * Vi mode state.
16
+ */
17
+ type ViModeState = 'normal' | 'search' | 'command';
18
+ /**
19
+ * Vi navigation action produced by key processing.
20
+ */
21
+ type ViAction = {
22
+ readonly type: 'scroll';
23
+ readonly direction: 'up' | 'down' | 'left' | 'right';
24
+ readonly amount: number;
25
+ } | {
26
+ readonly type: 'jump';
27
+ readonly target: 'top' | 'bottom' | 'high' | 'middle' | 'low';
28
+ } | {
29
+ readonly type: 'page';
30
+ readonly direction: 'up' | 'down';
31
+ readonly amount: 'half' | 'full';
32
+ } | {
33
+ readonly type: 'search';
34
+ readonly query: string;
35
+ readonly direction: 'forward' | 'backward';
36
+ } | {
37
+ readonly type: 'searchNext';
38
+ readonly direction: 'forward' | 'backward';
39
+ } | {
40
+ readonly type: 'enterSearch';
41
+ } | {
42
+ readonly type: 'exitSearch';
43
+ } | {
44
+ readonly type: 'searchInput';
45
+ readonly char: string;
46
+ } | {
47
+ readonly type: 'none';
48
+ };
49
+ /**
50
+ * Configuration for vi navigation mode.
51
+ */
52
+ interface ViModeConfig {
53
+ /** Enable vi mode (default: false) */
54
+ readonly enabled: boolean;
55
+ /** Scroll amount for j/k (default: 1) */
56
+ readonly scrollStep: number;
57
+ /** Scroll amount for h/l (default: 1) */
58
+ readonly horizontalStep: number;
59
+ /** Number of visible lines for H/M/L calculations */
60
+ readonly viewportHeight: number;
61
+ }
62
+ /**
63
+ * Vi mode internal state.
64
+ */
65
+ interface ViState {
66
+ /** Current vi mode */
67
+ readonly mode: ViModeState;
68
+ /** Current search query buffer */
69
+ readonly searchBuffer: string;
70
+ /** Last search query */
71
+ readonly lastSearch: string;
72
+ /** Last search direction */
73
+ readonly lastSearchDirection: 'forward' | 'backward';
74
+ /** Count prefix (e.g., "5j" = move down 5) */
75
+ readonly countPrefix: number;
76
+ /** Whether g was pressed (for gg) */
77
+ readonly gPending: boolean;
78
+ }
79
+ /**
80
+ * Creates initial vi mode state.
81
+ *
82
+ * @returns Fresh vi state
83
+ *
84
+ * @example
85
+ * ```typescript
86
+ * import { createViState } from 'blecsd';
87
+ *
88
+ * const viState = createViState();
89
+ * ```
90
+ */
91
+ declare function createViState(): ViState;
92
+ /**
93
+ * Creates a vi mode configuration with defaults.
94
+ *
95
+ * @param config - Partial configuration overrides
96
+ * @returns Full vi configuration
97
+ */
98
+ declare function createViConfig(config?: Partial<ViModeConfig>): ViModeConfig;
99
+ /**
100
+ * Processes a key event in vi mode and returns the resulting action and new state.
101
+ *
102
+ * @param key - The key event to process
103
+ * @param state - Current vi state
104
+ * @param config - Vi mode configuration
105
+ * @returns Tuple of [action, newState]
106
+ *
107
+ * @example
108
+ * ```typescript
109
+ * import { createViState, createViConfig, processViKey } from 'blecsd';
110
+ *
111
+ * const state = createViState();
112
+ * const config = createViConfig({ enabled: true, viewportHeight: 40 });
113
+ *
114
+ * // Process a 'j' key press
115
+ * const [action, newState] = processViKey(keyEvent, state, config);
116
+ * if (action.type === 'scroll') {
117
+ * scrollBy(world, eid, 0, action.amount);
118
+ * }
119
+ * ```
120
+ */
121
+ declare function processViKey(key: KeyEvent, state: ViState, config: ViModeConfig): [ViAction, ViState];
122
+ /**
123
+ * Checks if a key event should be consumed by vi mode.
124
+ * Use this to prevent vi keys from bubbling to other handlers.
125
+ *
126
+ * @param key - The key event
127
+ * @param state - Current vi state
128
+ * @param config - Vi configuration
129
+ * @returns Whether vi mode wants this key
130
+ */
131
+ declare function isViKey(key: KeyEvent, state: ViState, config: ViModeConfig): boolean;
132
+ /**
133
+ * Resolves a vi page action to a concrete scroll amount.
134
+ *
135
+ * @param action - The page action
136
+ * @param viewportHeight - Number of visible lines
137
+ * @returns Scroll amount in lines
138
+ *
139
+ * @example
140
+ * ```typescript
141
+ * import { resolvePageAmount } from 'blecsd';
142
+ *
143
+ * const lines = resolvePageAmount('half', 40); // 20
144
+ * ```
145
+ */
146
+ declare function resolvePageAmount(amount: 'half' | 'full', viewportHeight: number): number;
147
+ /**
148
+ * Resolves a vi jump target to a line number.
149
+ *
150
+ * @param target - The jump target
151
+ * @param scrollTop - Current scroll top position
152
+ * @param viewportHeight - Viewport height in lines
153
+ * @param totalLines - Total content lines
154
+ * @returns Target line number (0-based)
155
+ */
156
+ declare function resolveJumpTarget(target: 'top' | 'bottom' | 'high' | 'middle' | 'low', scrollTop: number, viewportHeight: number, totalLines: number): number;
157
+
158
+ export { type ViAction, type ViModeConfig, type ViModeState, type ViState, createViConfig, createViState, isViKey, processViKey, resolveJumpTarget, resolvePageAmount };
@@ -0,0 +1 @@
1
+ export{b as createViConfig,a as createViState,d as isViKey,c as processViKey,f as resolveJumpTarget,e as resolvePageAmount}from'../chunk-GYHI26UE.js';import'../chunk-5PELJRUQ.js';