@oakoliver/bubblezone 0.0.0-stage → 1.0.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/LICENSE +22 -0
- package/README.md +185 -2
- package/dist/global.d.ts +33 -0
- package/dist/global.d.ts.map +1 -0
- package/dist/index.cjs +436 -0
- package/dist/index.d.ts +16 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +381 -0
- package/dist/manager.d.ts +64 -0
- package/dist/manager.d.ts.map +1 -0
- package/dist/messages.d.ts +19 -0
- package/dist/messages.d.ts.map +1 -0
- package/dist/scanner.d.ts +19 -0
- package/dist/scanner.d.ts.map +1 -0
- package/dist/width.d.ts +17 -0
- package/dist/width.d.ts.map +1 -0
- package/dist/zoneinfo.d.ts +51 -0
- package/dist/zoneinfo.d.ts.map +1 -0
- package/package.json +68 -4
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,436 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/index.ts
|
|
21
|
+
var index_exports = {};
|
|
22
|
+
__export(index_exports, {
|
|
23
|
+
AnyInBounds: () => AnyInBounds,
|
|
24
|
+
AnyInBoundsAndUpdate: () => AnyInBoundsAndUpdate,
|
|
25
|
+
Clear: () => Clear,
|
|
26
|
+
Close: () => Close,
|
|
27
|
+
DefaultManager: () => DefaultManager,
|
|
28
|
+
Enabled: () => Enabled,
|
|
29
|
+
Get: () => Get,
|
|
30
|
+
Manager: () => Manager,
|
|
31
|
+
Mark: () => Mark,
|
|
32
|
+
MsgZoneInBounds: () => MsgZoneInBounds,
|
|
33
|
+
New: () => New,
|
|
34
|
+
NewGlobal: () => NewGlobal,
|
|
35
|
+
NewPrefix: () => NewPrefix,
|
|
36
|
+
Scan: () => Scan,
|
|
37
|
+
SetEnabled: () => SetEnabled,
|
|
38
|
+
ZoneInfo: () => ZoneInfo,
|
|
39
|
+
anyInBounds: () => AnyInBounds,
|
|
40
|
+
anyInBoundsAndUpdate: () => AnyInBoundsAndUpdate,
|
|
41
|
+
clear: () => Clear,
|
|
42
|
+
close: () => Close,
|
|
43
|
+
enabled: () => Enabled,
|
|
44
|
+
get: () => Get,
|
|
45
|
+
mark: () => Mark,
|
|
46
|
+
newGlobal: () => NewGlobal,
|
|
47
|
+
newPrefix: () => NewPrefix,
|
|
48
|
+
printableWidth: () => printableWidth,
|
|
49
|
+
runeWidth: () => runeWidth,
|
|
50
|
+
scan: () => Scan,
|
|
51
|
+
setEnabled: () => SetEnabled
|
|
52
|
+
});
|
|
53
|
+
module.exports = __toCommonJS(index_exports);
|
|
54
|
+
|
|
55
|
+
// src/manager.ts
|
|
56
|
+
var import_bubbletea = require("@oakoliver/bubbletea");
|
|
57
|
+
|
|
58
|
+
// src/messages.ts
|
|
59
|
+
var MsgZoneInBounds = class {
|
|
60
|
+
constructor(zone, event) {
|
|
61
|
+
this.zone = zone;
|
|
62
|
+
this.event = event;
|
|
63
|
+
}
|
|
64
|
+
zone;
|
|
65
|
+
event;
|
|
66
|
+
_tag = "MsgZoneInBounds";
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
// src/zoneinfo.ts
|
|
70
|
+
function position(msg) {
|
|
71
|
+
const m = msg;
|
|
72
|
+
if (typeof m.mouse === "function") return m.mouse();
|
|
73
|
+
return { x: m.x, y: m.y };
|
|
74
|
+
}
|
|
75
|
+
var ZoneInfo = class {
|
|
76
|
+
/** The ID passed to `mark()`; empty for a zone that is not known yet. */
|
|
77
|
+
id;
|
|
78
|
+
/** @internal The generated marker sequence that stands for `id` in a view. */
|
|
79
|
+
rid;
|
|
80
|
+
/** @internal The scan this zone came from, used to drop stale zones. */
|
|
81
|
+
iteration;
|
|
82
|
+
/** X of the top-left cell of the zone. */
|
|
83
|
+
startX;
|
|
84
|
+
/** Y of the top-left cell of the zone. */
|
|
85
|
+
startY;
|
|
86
|
+
/** X of the bottom-right cell of the zone. */
|
|
87
|
+
endX;
|
|
88
|
+
/** Y of the bottom-right cell of the zone. */
|
|
89
|
+
endY;
|
|
90
|
+
constructor(init = {}) {
|
|
91
|
+
this.id = init.id ?? "";
|
|
92
|
+
this.rid = init.rid ?? "";
|
|
93
|
+
this.iteration = init.iteration ?? 0;
|
|
94
|
+
this.startX = init.startX ?? 0;
|
|
95
|
+
this.startY = init.startY ?? 0;
|
|
96
|
+
this.endX = init.endX ?? 0;
|
|
97
|
+
this.endY = init.endY ?? 0;
|
|
98
|
+
}
|
|
99
|
+
/** Reports whether the zone is not known (yet). `Manager.get()` returns such a zone for unknown IDs. */
|
|
100
|
+
isZero() {
|
|
101
|
+
return this.id === "";
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Reports whether the mouse event is inside the box between the start and end
|
|
105
|
+
* cells. Unknown zones are never in bounds. A zone whose end lies before its
|
|
106
|
+
* start (for example text that wrapped onto the next line) is never in bounds
|
|
107
|
+
* either; for shapes a box cannot describe, do the check yourself.
|
|
108
|
+
*/
|
|
109
|
+
inBounds(msg) {
|
|
110
|
+
if (this.isZero()) return false;
|
|
111
|
+
if (this.startX > this.endX || this.startY > this.endY) return false;
|
|
112
|
+
const { x, y } = position(msg);
|
|
113
|
+
if (x < this.startX || y < this.startY) return false;
|
|
114
|
+
if (x > this.endX || y > this.endY) return false;
|
|
115
|
+
return true;
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Returns the event position relative to the zone, with (0, 0) at its top-left
|
|
119
|
+
* cell, or `[-1, -1]` if the zone is unknown or the event is outside it.
|
|
120
|
+
*/
|
|
121
|
+
pos(msg) {
|
|
122
|
+
if (this.isZero() || !this.inBounds(msg)) return [-1, -1];
|
|
123
|
+
const { x, y } = position(msg);
|
|
124
|
+
return [x - this.startX, y - this.startY];
|
|
125
|
+
}
|
|
126
|
+
/** Width in cells (0 for an unknown or inverted zone). */
|
|
127
|
+
get width() {
|
|
128
|
+
return this.isZero() || this.endX < this.startX ? 0 : this.endX - this.startX + 1;
|
|
129
|
+
}
|
|
130
|
+
/** Height in rows (0 for an unknown or inverted zone). */
|
|
131
|
+
get height() {
|
|
132
|
+
return this.isZero() || this.endY < this.startY ? 0 : this.endY - this.startY + 1;
|
|
133
|
+
}
|
|
134
|
+
};
|
|
135
|
+
|
|
136
|
+
// src/width.ts
|
|
137
|
+
var ESC = 27;
|
|
138
|
+
var BEL = 7;
|
|
139
|
+
var wideEmoji = /^\p{Emoji_Presentation}$/u;
|
|
140
|
+
var zeroWidth = /^[\p{Mn}\p{Me}\p{Cf}]$/u;
|
|
141
|
+
function isWide(cp) {
|
|
142
|
+
return cp >= 4352 && (cp <= 4447 || cp === 9001 || cp === 9002 || cp >= 11904 && cp <= 12350 || cp >= 12353 && cp <= 13311 || cp >= 13312 && cp <= 19903 || cp >= 19968 && cp <= 42191 || cp >= 43360 && cp <= 43391 || cp >= 44032 && cp <= 55203 || cp >= 63744 && cp <= 64255 || cp >= 65040 && cp <= 65049 || cp >= 65072 && cp <= 65135 || cp >= 65280 && cp <= 65376 || cp >= 65504 && cp <= 65510 || cp >= 94176 && cp <= 94180 || cp >= 94208 && cp <= 101631 || cp >= 110592 && cp <= 111359 || cp >= 131072 && cp <= 262141);
|
|
143
|
+
}
|
|
144
|
+
function runeWidth(cp) {
|
|
145
|
+
if (cp < 32 || cp >= 127 && cp < 160) return 0;
|
|
146
|
+
if (cp < 768) return 1;
|
|
147
|
+
if (cp === 8203 || cp === 8205 || cp >= 65024 && cp <= 65039) return 0;
|
|
148
|
+
if (isWide(cp)) return 2;
|
|
149
|
+
if (zeroWidth.test(String.fromCodePoint(cp))) return 0;
|
|
150
|
+
if (cp >= 8986 && wideEmoji.test(String.fromCodePoint(cp))) return 2;
|
|
151
|
+
return 1;
|
|
152
|
+
}
|
|
153
|
+
var plain = /^[\x20-\x7e]*$/;
|
|
154
|
+
function printableWidth(s) {
|
|
155
|
+
if (plain.test(s)) return s.length;
|
|
156
|
+
let n = 0;
|
|
157
|
+
for (let i = 0; i < s.length; ) {
|
|
158
|
+
const cp = s.codePointAt(i);
|
|
159
|
+
const len = cp > 65535 ? 2 : 1;
|
|
160
|
+
if (cp !== ESC) {
|
|
161
|
+
n += runeWidth(cp);
|
|
162
|
+
i += len;
|
|
163
|
+
continue;
|
|
164
|
+
}
|
|
165
|
+
const next = s.charCodeAt(i + 1);
|
|
166
|
+
if (Number.isNaN(next)) break;
|
|
167
|
+
if (next === 91) {
|
|
168
|
+
i += 2;
|
|
169
|
+
while (i < s.length) {
|
|
170
|
+
const c = s.charCodeAt(i++);
|
|
171
|
+
if (c >= 64 && c <= 126) break;
|
|
172
|
+
}
|
|
173
|
+
} else if (next === 93 || next === 80 || next === 95 || next === 94 || next === 88) {
|
|
174
|
+
i += 2;
|
|
175
|
+
while (i < s.length) {
|
|
176
|
+
const c = s.charCodeAt(i);
|
|
177
|
+
if (c === BEL) {
|
|
178
|
+
i++;
|
|
179
|
+
break;
|
|
180
|
+
}
|
|
181
|
+
if (c === ESC && s.charCodeAt(i + 1) === 92) {
|
|
182
|
+
i += 2;
|
|
183
|
+
break;
|
|
184
|
+
}
|
|
185
|
+
i++;
|
|
186
|
+
}
|
|
187
|
+
} else if (next >= 32 && next <= 47) {
|
|
188
|
+
i += 2;
|
|
189
|
+
while (i < s.length && s.charCodeAt(i) >= 32 && s.charCodeAt(i) <= 47) i++;
|
|
190
|
+
i++;
|
|
191
|
+
} else {
|
|
192
|
+
i += 2;
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
return n;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
// src/scanner.ts
|
|
199
|
+
var tokens = /\x1b\[(\d+)z|\n/g;
|
|
200
|
+
function scanView(host, input, iteration) {
|
|
201
|
+
if (input.indexOf("\x1B[") === -1 && input.indexOf("\n") === -1) return input;
|
|
202
|
+
let out = "";
|
|
203
|
+
let line = "";
|
|
204
|
+
let rows = 0;
|
|
205
|
+
let last = 0;
|
|
206
|
+
const tracked = /* @__PURE__ */ new Map();
|
|
207
|
+
tokens.lastIndex = 0;
|
|
208
|
+
for (let m = tokens.exec(input); m !== null; m = tokens.exec(input)) {
|
|
209
|
+
line += input.slice(last, m.index);
|
|
210
|
+
last = m.index + m[0].length;
|
|
211
|
+
if (m[0] === "\n") {
|
|
212
|
+
out += line + "\n";
|
|
213
|
+
line = "";
|
|
214
|
+
rows++;
|
|
215
|
+
continue;
|
|
216
|
+
}
|
|
217
|
+
if (!host.enabled) continue;
|
|
218
|
+
const rid = m[0];
|
|
219
|
+
const id = host.resolve(rid);
|
|
220
|
+
if (id === void 0) continue;
|
|
221
|
+
const open = tracked.get(rid);
|
|
222
|
+
if (open) {
|
|
223
|
+
open.endX = printableWidth(line) - 1;
|
|
224
|
+
open.endY = rows;
|
|
225
|
+
host.emit(open);
|
|
226
|
+
tracked.delete(rid);
|
|
227
|
+
} else {
|
|
228
|
+
tracked.set(rid, new ZoneInfo({ id, rid, iteration, startX: printableWidth(line), startY: rows }));
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
return out + line + input.slice(last);
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
// src/manager.ts
|
|
235
|
+
var IDENT_START = "\x1B";
|
|
236
|
+
var IDENT_BRACKET = "[";
|
|
237
|
+
var IDENT_END = "z";
|
|
238
|
+
var markerCounter = 1e3;
|
|
239
|
+
var prefixCounter = 0;
|
|
240
|
+
var scanCounter = 0;
|
|
241
|
+
var Manager = class {
|
|
242
|
+
#enabled = true;
|
|
243
|
+
#closed = false;
|
|
244
|
+
#zones = /* @__PURE__ */ new Map();
|
|
245
|
+
#ids = /* @__PURE__ */ new Map();
|
|
246
|
+
// user ID -> marker sequence
|
|
247
|
+
#rids = /* @__PURE__ */ new Map();
|
|
248
|
+
// marker sequence -> user ID
|
|
249
|
+
/** Stops the manager. Later scans still strip markers but no longer store zones. */
|
|
250
|
+
close() {
|
|
251
|
+
this.#closed = true;
|
|
252
|
+
}
|
|
253
|
+
/**
|
|
254
|
+
* Enables or disables the manager. When disabled, `mark()` returns its input
|
|
255
|
+
* unchanged and `scan()` only strips markers (from views cached earlier).
|
|
256
|
+
* Disabling also forgets every stored zone.
|
|
257
|
+
*/
|
|
258
|
+
setEnabled(enabled) {
|
|
259
|
+
this.#enabled = enabled;
|
|
260
|
+
if (!enabled) this.#zones.clear();
|
|
261
|
+
}
|
|
262
|
+
/** Reports whether the manager is enabled. */
|
|
263
|
+
enabled() {
|
|
264
|
+
return this.#enabled;
|
|
265
|
+
}
|
|
266
|
+
/**
|
|
267
|
+
* Returns a prefix that is unique across calls, for components that build zone
|
|
268
|
+
* IDs of their own and must not collide with a sibling instance:
|
|
269
|
+
* `zone.mark(this.id + 'item-3', row)`.
|
|
270
|
+
*/
|
|
271
|
+
newPrefix() {
|
|
272
|
+
return "zone_" + String(++prefixCounter) + "__";
|
|
273
|
+
}
|
|
274
|
+
/**
|
|
275
|
+
* Wraps `v` in a start and end marker so `scan()` can find where it ended up
|
|
276
|
+
* on screen. Returns `v` unchanged when the manager is disabled or when `id`
|
|
277
|
+
* or `v` is empty.
|
|
278
|
+
*/
|
|
279
|
+
mark(id, v) {
|
|
280
|
+
if (!this.#enabled) return v;
|
|
281
|
+
if (id === "" || v === "") return v;
|
|
282
|
+
let gid = this.#ids.get(id);
|
|
283
|
+
if (gid === void 0) {
|
|
284
|
+
gid = IDENT_START + IDENT_BRACKET + String(++markerCounter) + IDENT_END;
|
|
285
|
+
this.#ids.set(id, gid);
|
|
286
|
+
this.#rids.set(gid, id);
|
|
287
|
+
}
|
|
288
|
+
return gid + v + gid;
|
|
289
|
+
}
|
|
290
|
+
/** Forgets the stored zone for `id`. It is recorded again by the next scan that sees it. */
|
|
291
|
+
clear(id) {
|
|
292
|
+
this.#zones.delete(id);
|
|
293
|
+
}
|
|
294
|
+
/**
|
|
295
|
+
* Returns the zone stored for `id`. For an ID that is not known (yet) it
|
|
296
|
+
* returns a zero zone whose `isZero()` is true and whose `inBounds()` is
|
|
297
|
+
* false, so `get('x').inBounds(msg)` is always safe to call.
|
|
298
|
+
*/
|
|
299
|
+
get(id) {
|
|
300
|
+
return this.#zones.get(id) ?? new ZoneInfo();
|
|
301
|
+
}
|
|
302
|
+
/**
|
|
303
|
+
* Strips the markers out of a view and records where each zone is. Call it
|
|
304
|
+
* once, on the outermost view, not inside child components.
|
|
305
|
+
*
|
|
306
|
+
* Unlike upstream, which hands the zones to a background worker, the zones are
|
|
307
|
+
* stored before `scan()` returns, so `get()` right afterwards sees them.
|
|
308
|
+
*/
|
|
309
|
+
scan(v) {
|
|
310
|
+
const iteration = ++scanCounter;
|
|
311
|
+
const found = [];
|
|
312
|
+
const out = scanView(
|
|
313
|
+
{
|
|
314
|
+
enabled: this.#enabled,
|
|
315
|
+
resolve: (rid) => this.#rids.get(rid),
|
|
316
|
+
emit: (zone) => found.push(zone)
|
|
317
|
+
},
|
|
318
|
+
v,
|
|
319
|
+
iteration
|
|
320
|
+
);
|
|
321
|
+
if (this.#closed) return out;
|
|
322
|
+
for (const zone of found) this.#zones.set(zone.id, zone);
|
|
323
|
+
for (const [id, zone] of this.#zones) {
|
|
324
|
+
if (zone.iteration !== iteration) this.#zones.delete(id);
|
|
325
|
+
}
|
|
326
|
+
return out;
|
|
327
|
+
}
|
|
328
|
+
#findInBounds(mouse) {
|
|
329
|
+
const ids = [...this.#zones.keys()].sort();
|
|
330
|
+
const hit = [];
|
|
331
|
+
for (const id of ids) {
|
|
332
|
+
const zone = this.#zones.get(id);
|
|
333
|
+
if (zone.inBounds(mouse)) hit.push(zone);
|
|
334
|
+
}
|
|
335
|
+
return hit;
|
|
336
|
+
}
|
|
337
|
+
/**
|
|
338
|
+
* Sends a `MsgZoneInBounds` to `model.update()` for every zone the mouse event
|
|
339
|
+
* is inside, in alphabetical order of their IDs. The results of `update()` are
|
|
340
|
+
* discarded.
|
|
341
|
+
*/
|
|
342
|
+
anyInBounds(model, mouse) {
|
|
343
|
+
for (const zone of this.#findInBounds(mouse)) {
|
|
344
|
+
model.update(new MsgZoneInBounds(zone, mouse));
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
/**
|
|
348
|
+
* Like `anyInBounds()`, but the model returned by each `update()` is passed to
|
|
349
|
+
* the next one and returned at the end; the commands are combined with `Batch`.
|
|
350
|
+
*/
|
|
351
|
+
anyInBoundsAndUpdate(model, mouse) {
|
|
352
|
+
const cmds = [];
|
|
353
|
+
for (const zone of this.#findInBounds(mouse)) {
|
|
354
|
+
let cmd;
|
|
355
|
+
[model, cmd] = model.update(new MsgZoneInBounds(zone, mouse));
|
|
356
|
+
cmds.push(cmd);
|
|
357
|
+
}
|
|
358
|
+
return [model, (0, import_bubbletea.Batch)(...cmds)];
|
|
359
|
+
}
|
|
360
|
+
};
|
|
361
|
+
function New() {
|
|
362
|
+
return new Manager();
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
// src/global.ts
|
|
366
|
+
var DefaultManager;
|
|
367
|
+
function manager() {
|
|
368
|
+
if (!DefaultManager) throw new Error("manager not initialized");
|
|
369
|
+
return DefaultManager;
|
|
370
|
+
}
|
|
371
|
+
function NewGlobal() {
|
|
372
|
+
if (DefaultManager) return;
|
|
373
|
+
DefaultManager = New();
|
|
374
|
+
}
|
|
375
|
+
function Close() {
|
|
376
|
+
manager().close();
|
|
377
|
+
}
|
|
378
|
+
function SetEnabled(v) {
|
|
379
|
+
manager().setEnabled(v);
|
|
380
|
+
}
|
|
381
|
+
function Enabled() {
|
|
382
|
+
return manager().enabled();
|
|
383
|
+
}
|
|
384
|
+
function NewPrefix() {
|
|
385
|
+
return manager().newPrefix();
|
|
386
|
+
}
|
|
387
|
+
function Mark(id, v) {
|
|
388
|
+
return manager().mark(id, v);
|
|
389
|
+
}
|
|
390
|
+
function Clear(id) {
|
|
391
|
+
manager().clear(id);
|
|
392
|
+
}
|
|
393
|
+
function Get(id) {
|
|
394
|
+
return manager().get(id);
|
|
395
|
+
}
|
|
396
|
+
function Scan(v) {
|
|
397
|
+
return manager().scan(v);
|
|
398
|
+
}
|
|
399
|
+
function AnyInBounds(model, mouse) {
|
|
400
|
+
manager().anyInBounds(model, mouse);
|
|
401
|
+
}
|
|
402
|
+
function AnyInBoundsAndUpdate(model, mouse) {
|
|
403
|
+
return manager().anyInBoundsAndUpdate(model, mouse);
|
|
404
|
+
}
|
|
405
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
406
|
+
0 && (module.exports = {
|
|
407
|
+
AnyInBounds,
|
|
408
|
+
AnyInBoundsAndUpdate,
|
|
409
|
+
Clear,
|
|
410
|
+
Close,
|
|
411
|
+
DefaultManager,
|
|
412
|
+
Enabled,
|
|
413
|
+
Get,
|
|
414
|
+
Manager,
|
|
415
|
+
Mark,
|
|
416
|
+
MsgZoneInBounds,
|
|
417
|
+
New,
|
|
418
|
+
NewGlobal,
|
|
419
|
+
NewPrefix,
|
|
420
|
+
Scan,
|
|
421
|
+
SetEnabled,
|
|
422
|
+
ZoneInfo,
|
|
423
|
+
anyInBounds,
|
|
424
|
+
anyInBoundsAndUpdate,
|
|
425
|
+
clear,
|
|
426
|
+
close,
|
|
427
|
+
enabled,
|
|
428
|
+
get,
|
|
429
|
+
mark,
|
|
430
|
+
newGlobal,
|
|
431
|
+
newPrefix,
|
|
432
|
+
printableWidth,
|
|
433
|
+
runeWidth,
|
|
434
|
+
scan,
|
|
435
|
+
setEnabled
|
|
436
|
+
});
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @oakoliver/bubblezone: mouse hit-zones for Bubble Tea.
|
|
3
|
+
*
|
|
4
|
+
* Port of lrstanley/bubblezone (Go) for @oakoliver/bubbletea. Wrap the part of
|
|
5
|
+
* a view you care about in `mark()`, run the whole view through `scan()` once,
|
|
6
|
+
* and ask `get(id).inBounds(msg)` when a mouse event arrives.
|
|
7
|
+
*
|
|
8
|
+
* @module
|
|
9
|
+
*/
|
|
10
|
+
export { Manager, New } from './manager.js';
|
|
11
|
+
export { ZoneInfo } from './zoneinfo.js';
|
|
12
|
+
export type { MouseLike } from './zoneinfo.js';
|
|
13
|
+
export { MsgZoneInBounds } from './messages.js';
|
|
14
|
+
export { printableWidth, runeWidth } from './width.js';
|
|
15
|
+
export { DefaultManager, NewGlobal, Close, SetEnabled, Enabled, NewPrefix, Mark, Clear, Get, Scan, AnyInBounds, AnyInBoundsAndUpdate, newGlobal, close, setEnabled, enabled, newPrefix, mark, clear, get, scan, anyInBounds, anyInBoundsAndUpdate, } from './global.js';
|
|
16
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,YAAY,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACvD,OAAO,EACL,cAAc,EACd,SAAS,EAAE,KAAK,EAAE,UAAU,EAAE,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,EAAE,IAAI,EACxE,WAAW,EAAE,oBAAoB,EACjC,SAAS,EAAE,KAAK,EAAE,UAAU,EAAE,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,EAAE,IAAI,EACxE,WAAW,EAAE,oBAAoB,GAClC,MAAM,aAAa,CAAC"}
|