restty 0.1.17 → 0.1.18
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/README.md +4 -9
- package/dist/{app/index.js → chunk-53vdvhe3.js} +23781 -23698
- package/dist/fonts/manager.d.ts +1 -2
- package/dist/internal.js +105 -56357
- package/dist/renderer/shapes.d.ts +1 -3
- package/dist/restty.js +20 -0
- package/dist/unicode/ghostty-symbol-ranges.d.ts +1 -0
- package/dist/unicode/symbols.d.ts +6 -0
- package/package.json +8 -61
- package/dist/fonts/index.js +0 -5333
- package/dist/grid/index.js +0 -71
- package/dist/ime/index.js +0 -84
- package/dist/index.js +0 -56354
- package/dist/input/index.js +0 -1051
- package/dist/pty/index.js +0 -338
- package/dist/renderer/index.js +0 -1715
- package/dist/selection/index.js +0 -226
- package/dist/theme/index.js +0 -11218
- package/dist/wasm/index.js +0 -6003
package/dist/grid/index.js
DELETED
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __export = (target, all) => {
|
|
3
|
-
for (var name in all)
|
|
4
|
-
__defProp(target, name, {
|
|
5
|
-
get: all[name],
|
|
6
|
-
enumerable: true,
|
|
7
|
-
configurable: true,
|
|
8
|
-
set: (newValue) => all[name] = () => newValue
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
// src/grid/grid.ts
|
|
12
|
-
function fontHeightUnits(font) {
|
|
13
|
-
if (!font)
|
|
14
|
-
return 0;
|
|
15
|
-
const height = font.height;
|
|
16
|
-
if (height !== undefined && Number.isFinite(height) && height > 0)
|
|
17
|
-
return height;
|
|
18
|
-
const asc = font.ascender ?? 0;
|
|
19
|
-
const desc = font.descender ?? 0;
|
|
20
|
-
const fallback = asc - desc;
|
|
21
|
-
if (Number.isFinite(fallback) && fallback > 0)
|
|
22
|
-
return fallback;
|
|
23
|
-
return font.upem || 1000;
|
|
24
|
-
}
|
|
25
|
-
function computeCellMetrics(font, config, dpr, shapeCluster) {
|
|
26
|
-
if (!font)
|
|
27
|
-
return null;
|
|
28
|
-
const fontSizePx = Math.max(1, Math.round(config.fontSize * dpr));
|
|
29
|
-
const scale = font.scaleForSize(fontSizePx, config.sizeMode);
|
|
30
|
-
const glyphId = font.glyphIdForChar("M");
|
|
31
|
-
const advanceUnits = glyphId !== undefined && glyphId !== null ? font.advanceWidth(glyphId) : shapeCluster("M").advance;
|
|
32
|
-
const cellW = Math.max(1, Math.round(advanceUnits * scale));
|
|
33
|
-
const lineHeight = fontHeightUnits(font) * scale;
|
|
34
|
-
const cellH = Math.max(1, Math.round(lineHeight));
|
|
35
|
-
const baselineOffset = font.ascender * scale;
|
|
36
|
-
const yPad = Math.max(0, (cellH - lineHeight) * 0.5);
|
|
37
|
-
return { cellW, cellH, fontSizePx, scale, lineHeight, baselineOffset, yPad };
|
|
38
|
-
}
|
|
39
|
-
function createGridState() {
|
|
40
|
-
return {
|
|
41
|
-
cols: 0,
|
|
42
|
-
rows: 0,
|
|
43
|
-
cellW: 0,
|
|
44
|
-
cellH: 0,
|
|
45
|
-
fontSizePx: 0,
|
|
46
|
-
scale: 1,
|
|
47
|
-
lineHeight: 0,
|
|
48
|
-
baselineOffset: 0,
|
|
49
|
-
yPad: 0
|
|
50
|
-
};
|
|
51
|
-
}
|
|
52
|
-
function updateGridState(state, metrics, canvasWidth, canvasHeight) {
|
|
53
|
-
const cols = Math.max(1, Math.floor(canvasWidth / metrics.cellW));
|
|
54
|
-
const rows = Math.max(1, Math.floor(canvasHeight / metrics.cellH));
|
|
55
|
-
if (!Number.isFinite(cols) || !Number.isFinite(rows)) {
|
|
56
|
-
return { changed: false, cols: state.cols, rows: state.rows };
|
|
57
|
-
}
|
|
58
|
-
const changed = cols !== state.cols || rows !== state.rows || metrics.fontSizePx !== state.fontSizePx || metrics.cellW !== state.cellW || metrics.cellH !== state.cellH;
|
|
59
|
-
Object.assign(state, metrics, { cols, rows });
|
|
60
|
-
return { changed, cols, rows };
|
|
61
|
-
}
|
|
62
|
-
function clamp(value, min, max) {
|
|
63
|
-
return Math.max(min, Math.min(max, value));
|
|
64
|
-
}
|
|
65
|
-
export {
|
|
66
|
-
updateGridState,
|
|
67
|
-
fontHeightUnits,
|
|
68
|
-
createGridState,
|
|
69
|
-
computeCellMetrics,
|
|
70
|
-
clamp
|
|
71
|
-
};
|
package/dist/ime/index.js
DELETED
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __export = (target, all) => {
|
|
3
|
-
for (var name in all)
|
|
4
|
-
__defProp(target, name, {
|
|
5
|
-
get: all[name],
|
|
6
|
-
enumerable: true,
|
|
7
|
-
configurable: true,
|
|
8
|
-
set: (newValue) => all[name] = () => newValue
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
// src/ime/ime.ts
|
|
12
|
-
function createImeState() {
|
|
13
|
-
return {
|
|
14
|
-
composing: false,
|
|
15
|
-
preedit: "",
|
|
16
|
-
selectionStart: 0,
|
|
17
|
-
selectionEnd: 0
|
|
18
|
-
};
|
|
19
|
-
}
|
|
20
|
-
function setPreedit(state, text, imeInput) {
|
|
21
|
-
state.preedit = text || "";
|
|
22
|
-
if (imeInput) {
|
|
23
|
-
imeInput.value = state.preedit;
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
function clearPreedit(state, imeInput) {
|
|
27
|
-
state.preedit = "";
|
|
28
|
-
state.selectionStart = 0;
|
|
29
|
-
state.selectionEnd = 0;
|
|
30
|
-
if (imeInput) {
|
|
31
|
-
imeInput.value = "";
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
function startComposition(state, data, imeInput) {
|
|
35
|
-
state.composing = true;
|
|
36
|
-
setPreedit(state, data || imeInput?.value || "");
|
|
37
|
-
}
|
|
38
|
-
function updateComposition(state, data, imeInput) {
|
|
39
|
-
setPreedit(state, data || imeInput?.value || "");
|
|
40
|
-
}
|
|
41
|
-
function endComposition(state) {
|
|
42
|
-
state.composing = false;
|
|
43
|
-
const text = state.preedit;
|
|
44
|
-
state.preedit = "";
|
|
45
|
-
state.selectionStart = 0;
|
|
46
|
-
state.selectionEnd = 0;
|
|
47
|
-
return text;
|
|
48
|
-
}
|
|
49
|
-
function syncImeSelection(state, imeInput) {
|
|
50
|
-
if (!imeInput)
|
|
51
|
-
return;
|
|
52
|
-
const start = imeInput.selectionStart ?? 0;
|
|
53
|
-
const end = imeInput.selectionEnd ?? start;
|
|
54
|
-
state.selectionStart = Math.max(0, Math.min(start, imeInput.value.length));
|
|
55
|
-
state.selectionEnd = Math.max(state.selectionStart, Math.min(end, imeInput.value.length));
|
|
56
|
-
}
|
|
57
|
-
function updateImePosition(imeInput, cursor, cellW, cellH, dpr, canvasRect) {
|
|
58
|
-
if (!imeInput || !cursor)
|
|
59
|
-
return;
|
|
60
|
-
const scale = dpr || 1;
|
|
61
|
-
const x = canvasRect.left + cursor.col * (cellW / scale);
|
|
62
|
-
const y = canvasRect.top + cursor.row * (cellH / scale);
|
|
63
|
-
imeInput.style.transform = `translate(${Math.round(x)}px, ${Math.round(y)}px)`;
|
|
64
|
-
}
|
|
65
|
-
var PREEDIT_BG = [0.16, 0.16, 0.2, 0.9];
|
|
66
|
-
var PREEDIT_ACTIVE_BG = [0.3, 0.32, 0.42, 0.95];
|
|
67
|
-
var PREEDIT_FG = [0.95, 0.95, 0.98, 1];
|
|
68
|
-
var PREEDIT_UL = [0.7, 0.7, 0.8, 0.9];
|
|
69
|
-
var PREEDIT_CARET = [0.95, 0.95, 0.98, 1];
|
|
70
|
-
export {
|
|
71
|
-
updateImePosition,
|
|
72
|
-
updateComposition,
|
|
73
|
-
syncImeSelection,
|
|
74
|
-
startComposition,
|
|
75
|
-
setPreedit,
|
|
76
|
-
endComposition,
|
|
77
|
-
createImeState,
|
|
78
|
-
clearPreedit,
|
|
79
|
-
PREEDIT_UL,
|
|
80
|
-
PREEDIT_FG,
|
|
81
|
-
PREEDIT_CARET,
|
|
82
|
-
PREEDIT_BG,
|
|
83
|
-
PREEDIT_ACTIVE_BG
|
|
84
|
-
};
|