@floegence/floeterm-terminal-web 0.7.0 → 0.9.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/README.md +39 -1
- package/THEME_PROVENANCE.json +35 -0
- package/THEME_QUALITY_EVIDENCE.json +55 -0
- package/THIRD_PARTY_THEME_NOTICES.md +30 -0
- package/dist/core/TerminalCore.d.ts +3 -0
- package/dist/core/TerminalCore.d.ts.map +1 -1
- package/dist/core/TerminalCore.js +83 -33
- package/dist/core/TerminalCore.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/internal/GhosttyScrollbackCompat.d.ts +16 -0
- package/dist/internal/GhosttyScrollbackCompat.d.ts.map +1 -0
- package/dist/internal/GhosttyScrollbackCompat.js +43 -0
- package/dist/internal/GhosttyScrollbackCompat.js.map +1 -0
- package/dist/internal/TerminalResourceLoader.d.ts +27 -2
- package/dist/internal/TerminalResourceLoader.d.ts.map +1 -1
- package/dist/internal/TerminalResourceLoader.js +112 -47
- package/dist/internal/TerminalResourceLoader.js.map +1 -1
- package/dist/types.d.ts +37 -1
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/dist/utils/config.d.ts +7 -2
- package/dist/utils/config.d.ts.map +1 -1
- package/dist/utils/config.js +49 -158
- package/dist/utils/config.js.map +1 -1
- package/dist/utils/themeData.d.ts +562 -0
- package/dist/utils/themeData.d.ts.map +1 -0
- package/dist/utils/themeData.js +583 -0
- package/dist/utils/themeData.js.map +1 -0
- package/package.json +12 -7
- package/third_party_licenses/solarized-MIT.txt +19 -0
- package/third_party_licenses/tokyonight-Apache-2.0.txt +201 -0
package/README.md
CHANGED
|
@@ -129,7 +129,10 @@ the foreground revision that was active at that exact byte boundary.
|
|
|
129
129
|
## Notes
|
|
130
130
|
|
|
131
131
|
- You must provide a `TerminalTransport` and `TerminalEventSource` for the managed controller.
|
|
132
|
-
- `ghostty-web`
|
|
132
|
+
- Each `TerminalCore` owns an isolated `ghostty-web` WASM runtime; consumers must not provide or share a Ghostty runtime.
|
|
133
|
+
- `scrollback` is measured in terminal buffer rows, including separately wrapped rows, and accepts integers from 1 through 10,000. Within the supported geometry, Floeterm preserves at least the requested number of buffer rows; it does not trim to an exact physical row count. Floeterm maps that contract to a bounded byte budget for the exact pinned `ghostty-web@0.4.0-next.14.g6a1a50d` release, which currently interprets the value as bytes. The 81,920,000-byte cap limits Ghostty's scrollback arena, not the total memory of a WASM runtime. The mapping is temporary and must be reviewed and removed or updated with any Ghostty upgrade.
|
|
134
|
+
- Supported terminal geometry is limited to 500 columns. Explicit dimensions above that limit fail, while automatic fitting reports at most 500 columns.
|
|
135
|
+
- Consumer dependency overrides for `ghostty-web` are unsupported. Floeterm's compatibility guard requires the exact package pin so an upstream behavior change cannot silently apply the row-to-byte mapping twice.
|
|
133
136
|
- `TerminalCore` bridges the hidden textarea used by `ghostty-web`, so soft-keyboard and composition input continue to work on touch devices.
|
|
134
137
|
- The hidden terminal input is mounted in the document viewport plane and anchored from rendered cursor geometry, so native IME candidate windows stay aligned without expanding transformed terminal hosts.
|
|
135
138
|
- Programmatic terminal focus uses no-scroll focus by default, keeping embedded terminals stable inside scaled, projected, or otherwise transformed host surfaces.
|
|
@@ -378,3 +381,38 @@ core.setAppearance({
|
|
|
378
381
|
|
|
379
382
|
core.setFontFamily('"Iosevka Term", monospace');
|
|
380
383
|
```
|
|
384
|
+
|
|
385
|
+
## Built-in Theme Catalog
|
|
386
|
+
|
|
387
|
+
Floeterm 0.8.0 publishes 20 immutable built-in theme definitions. Hosts can use
|
|
388
|
+
the same stable catalog for validation, previews, and terminal rendering:
|
|
389
|
+
|
|
390
|
+
```ts
|
|
391
|
+
import {
|
|
392
|
+
TERMINAL_THEME_DEFINITIONS,
|
|
393
|
+
getThemeColors,
|
|
394
|
+
normalizeTerminalThemeName,
|
|
395
|
+
} from '@floegence/floeterm-terminal-web';
|
|
396
|
+
|
|
397
|
+
const selected = normalizeTerminalThemeName(persistedValue, 'dark');
|
|
398
|
+
const colors = getThemeColors(selected);
|
|
399
|
+
const lightThemes = TERMINAL_THEME_DEFINITIONS.filter(
|
|
400
|
+
(theme) => theme.appearance === 'light',
|
|
401
|
+
);
|
|
402
|
+
```
|
|
403
|
+
|
|
404
|
+
The exported arrays, definitions, and nested color objects are frozen at
|
|
405
|
+
runtime. `getThemeColors()` returns a defensive copy. Theme provenance and
|
|
406
|
+
third-party license details ship in `THEME_PROVENANCE.json` and
|
|
407
|
+
`THIRD_PARTY_THEME_NOTICES.md`. The package also includes
|
|
408
|
+
`THEME_QUALITY_EVIDENCE.json` with the catalog thresholds, measured results,
|
|
409
|
+
and Signal Safe color-vision simulation evidence.
|
|
410
|
+
|
|
411
|
+
### 0.8.0 migration
|
|
412
|
+
|
|
413
|
+
- `TerminalThemeName` now includes the full catalog; exhaustive switches must
|
|
414
|
+
handle the new IDs.
|
|
415
|
+
- `getThemeColors()` keeps its function name but returns the exact readonly
|
|
416
|
+
`TerminalThemeColors` type instead of a mutable `Record<string, string>`.
|
|
417
|
+
- `light`, `solarizedDark`, and `monokai` add `cursorAccent` equal to their
|
|
418
|
+
existing background. All other legacy fields and values are unchanged.
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
{
|
|
2
|
+
"schemaVersion": 1,
|
|
3
|
+
"generatedFor": "Floeterm terminal-web 0.8.0 design review",
|
|
4
|
+
"packageArtifactOwner": "@floegence/floeterm-terminal-web npm tarball",
|
|
5
|
+
"floetermLegacySourceCommit": "ee13df3",
|
|
6
|
+
"originalThemeNameDecision": {
|
|
7
|
+
"reference": "https://github.com/mbadolato/iTerm2-Color-Schemes/tree/97e244cf98a0eb2ce4339d2069ec1bba6c81f141/ghostty",
|
|
8
|
+
"referenceCommit": "97e244cf98a0eb2ce4339d2069ec1bba6c81f141",
|
|
9
|
+
"referenceThemeCount": 592,
|
|
10
|
+
"exactNameConflicts": [],
|
|
11
|
+
"decision": "No exact collision across 592 iTerm2-Color-Schemes Ghostty names; original compound labels approved."
|
|
12
|
+
},
|
|
13
|
+
"themes": [
|
|
14
|
+
{ "id": "dark", "classification": "legacy_existing", "source": "floeterm", "sourceCommit": "ee13df3", "spdx": "MIT", "copyright": "Floeterm contributors", "decision": "retain existing fields and values" },
|
|
15
|
+
{ "id": "light", "classification": "legacy_existing", "source": "floeterm", "sourceCommit": "ee13df3", "spdx": "MIT", "copyright": "Floeterm contributors", "decision": "retain existing fields and values; add cursorAccent equal to background" },
|
|
16
|
+
{ "id": "solarizedDark", "classification": "legacy_external", "source": "https://github.com/altercation/solarized/blob/62f656a02f93c5190a8753159e34b385588d5ff3/iterm2-colors-solarized/Solarized%20Dark.itermcolors", "sourceCommit": "62f656a02f93c5190a8753159e34b385588d5ff3", "floetermSourceCommit": "ee13df3", "spdx": "MIT", "copyright": "Copyright (c) 2011 Ethan Schoonover", "modification": "existing Floeterm ANSI mapping retained; cursorAccent added equal to background", "packageLicenseArtifact": "third_party_licenses/solarized-MIT.txt" },
|
|
17
|
+
{ "id": "monokai", "classification": "legacy_unresolved", "source": "floeterm", "sourceCommit": "ee13df3", "spdx": "NOASSERTION", "floetermSourceLicense": "MIT", "copyright": "Floeterm contributors", "risk": "The exact pre-existing palette source and upstream naming authorization could not be reconstructed reliably.", "productDecision": "Retain legacy ID, display label, and colors for backward compatibility without claiming official Monokai status or adding new third-party material; future legal review may change the display label while preserving the persisted ID.", "modification": "cursorAccent added equal to background" },
|
|
18
|
+
{ "id": "tokyoNight", "classification": "legacy_external", "source": "https://github.com/folke/tokyonight.nvim/blob/cdc07ac78467a233fd62c493de29a17e0cf2b2b6/lua/tokyonight/colors/night.lua", "terminalMapping": "https://github.com/folke/tokyonight.nvim/blob/cdc07ac78467a233fd62c493de29a17e0cf2b2b6/lua/tokyonight/extra/ghostty.lua", "sourceCommit": "cdc07ac78467a233fd62c493de29a17e0cf2b2b6", "floetermSourceCommit": "ee13df3", "spdx": "Apache-2.0", "copyright": "Folke Lemaitre and Tokyo Night contributors", "noticeFileAtSource": "none found in fixed source tree", "modification": "existing Floeterm palette retained", "packageLicenseArtifact": "third_party_licenses/tokyonight-Apache-2.0.txt" },
|
|
19
|
+
{ "id": "polarVeil", "classification": "floeterm_original", "source": "Floeterm 0.8.0 theme design", "spdx": "MIT", "copyright": "Floeterm contributors", "externalColorTableCopied": false },
|
|
20
|
+
{ "id": "copperCircuit", "classification": "floeterm_original", "source": "Floeterm 0.8.0 theme design", "spdx": "MIT", "copyright": "Floeterm contributors", "externalColorTableCopied": false },
|
|
21
|
+
{ "id": "violetDusk", "classification": "floeterm_original", "source": "Floeterm 0.8.0 theme design", "spdx": "MIT", "copyright": "Floeterm contributors", "externalColorTableCopied": false },
|
|
22
|
+
{ "id": "cedarGrove", "classification": "floeterm_original", "source": "Floeterm 0.8.0 theme design", "spdx": "MIT", "copyright": "Floeterm contributors", "externalColorTableCopied": false },
|
|
23
|
+
{ "id": "midnightInk", "classification": "floeterm_original", "source": "Floeterm 0.8.0 theme design", "spdx": "MIT", "copyright": "Floeterm contributors", "externalColorTableCopied": false },
|
|
24
|
+
{ "id": "velvetOrchid", "classification": "floeterm_original", "source": "Floeterm 0.8.0 theme design", "spdx": "MIT", "copyright": "Floeterm contributors", "externalColorTableCopied": false },
|
|
25
|
+
{ "id": "blueQuarry", "classification": "floeterm_original", "source": "Floeterm 0.8.0 theme design", "spdx": "MIT", "copyright": "Floeterm contributors", "externalColorTableCopied": false },
|
|
26
|
+
{ "id": "studioPaper", "classification": "floeterm_original", "source": "Floeterm 0.8.0 theme design", "spdx": "MIT", "copyright": "Floeterm contributors", "externalColorTableCopied": false },
|
|
27
|
+
{ "id": "softLinen", "classification": "floeterm_original", "source": "Floeterm 0.8.0 theme design", "spdx": "MIT", "copyright": "Floeterm contributors", "externalColorTableCopied": false },
|
|
28
|
+
{ "id": "mintGlass", "classification": "floeterm_original", "source": "Floeterm 0.8.0 theme design", "spdx": "MIT", "copyright": "Floeterm contributors", "externalColorTableCopied": false },
|
|
29
|
+
{ "id": "roseDawn", "classification": "floeterm_original", "source": "Floeterm 0.8.0 theme design", "spdx": "MIT", "copyright": "Floeterm contributors", "externalColorTableCopied": false },
|
|
30
|
+
{ "id": "openSky", "classification": "floeterm_original", "source": "Floeterm 0.8.0 theme design", "spdx": "MIT", "copyright": "Floeterm contributors", "externalColorTableCopied": false },
|
|
31
|
+
{ "id": "highContrastDark", "classification": "floeterm_original", "source": "Floeterm 0.8.0 theme design", "spdx": "MIT", "copyright": "Floeterm contributors", "externalColorTableCopied": false },
|
|
32
|
+
{ "id": "highContrastLight", "classification": "floeterm_original", "source": "Floeterm 0.8.0 theme design", "spdx": "MIT", "copyright": "Floeterm contributors", "externalColorTableCopied": false },
|
|
33
|
+
{ "id": "signalSafeDark", "classification": "floeterm_original", "source": "Floeterm 0.8.0 theme design", "spdx": "MIT", "copyright": "Floeterm contributors", "externalColorTableCopied": false, "certification": { "model": "Machado, Oliveira and Fernandes 2009 full dichromacy matrices", "doi": "10.1109/TVCG.2009.113", "pipeline": "linear sRGB to D65 CIELAB and CIEDE2000", "testEvidenceArtifact": "THEME_QUALITY_EVIDENCE.json", "repositoryTestEvidence": "terminal-web/src/utils/themeQuality.test.ts" } }
|
|
34
|
+
]
|
|
35
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
{
|
|
2
|
+
"schemaVersion": 1,
|
|
3
|
+
"catalogVersion": "0.8.0",
|
|
4
|
+
"catalogSha256": "84fb9d7f9015a0f872ec3cda405ae6c641d562ee9f91fbc99fa9e4613987bc70",
|
|
5
|
+
"methodology": {
|
|
6
|
+
"contrast": "WCAG relative luminance after sRGB decoding",
|
|
7
|
+
"distinctness": "weighted CIEDE2000 across background, foreground, selection background, and ANSI 0-15",
|
|
8
|
+
"colorVisionSimulation": {
|
|
9
|
+
"model": "Machado, Oliveira and Fernandes 2009 full dichromacy matrices",
|
|
10
|
+
"doi": "10.1109/TVCG.2009.113",
|
|
11
|
+
"pipeline": "sRGB decode to linear RGB -> severity 1.0 matrix -> D65 CIELAB -> CIEDE2000"
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
"thresholds": {
|
|
15
|
+
"foregroundContrast": 4.5,
|
|
16
|
+
"highContrastForeground": 7,
|
|
17
|
+
"selectionContrast": 4.5,
|
|
18
|
+
"cursorContrast": 3,
|
|
19
|
+
"cursorAccentContrast": 4.5,
|
|
20
|
+
"originalChromaticAnsiContrast": 4.5,
|
|
21
|
+
"originalBrightBlackContrast": 3,
|
|
22
|
+
"catalogNearestNeighborDeltaE00": 5,
|
|
23
|
+
"signalSafeSemanticPairDeltaE00": 10,
|
|
24
|
+
"signalSafeNormalBrightDeltaE00": 5
|
|
25
|
+
},
|
|
26
|
+
"results": {
|
|
27
|
+
"themeCount": 20,
|
|
28
|
+
"allThemesPassed": true,
|
|
29
|
+
"minimumCatalogNearestNeighborDeltaE00": 5.38,
|
|
30
|
+
"signalSafeDark": {
|
|
31
|
+
"foregroundContrast": 16.34,
|
|
32
|
+
"selectionContrast": 8.09,
|
|
33
|
+
"cursorContrast": 16.34,
|
|
34
|
+
"cursorAccentContrast": 16.34,
|
|
35
|
+
"simulations": {
|
|
36
|
+
"protanopia": {
|
|
37
|
+
"redGreenDeltaE00": 26.82,
|
|
38
|
+
"blueMagentaDeltaE00": 13.08,
|
|
39
|
+
"normalBrightDeltaE00": [13.84, 8.63, 11.16, 8.22, 7.62, 10.12, 10.49, 7.52]
|
|
40
|
+
},
|
|
41
|
+
"deuteranopia": {
|
|
42
|
+
"redGreenDeltaE00": 36.42,
|
|
43
|
+
"blueMagentaDeltaE00": 24.15,
|
|
44
|
+
"normalBrightDeltaE00": [13.75, 6.91, 12.67, 7.59, 8.78, 6.97, 13.24, 8.1]
|
|
45
|
+
},
|
|
46
|
+
"tritanopia": {
|
|
47
|
+
"redGreenDeltaE00": 58.4,
|
|
48
|
+
"blueMagentaDeltaE00": 69.53,
|
|
49
|
+
"normalBrightDeltaE00": [13.82, 8.48, 11.4, 7.17, 5.99, 11.34, 13.3, 8.87]
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
},
|
|
54
|
+
"repositoryTestEvidence": "terminal-web/src/utils/themeQuality.test.ts"
|
|
55
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# Floeterm built-in theme provenance
|
|
2
|
+
|
|
3
|
+
New themes introduced in Floeterm 0.8.0 are original Floeterm palettes released
|
|
4
|
+
under this package's MIT license. Public theme repositories were used for
|
|
5
|
+
interaction and color-system research; their color tables were not copied into
|
|
6
|
+
the new original themes. The exact per-theme records live in `THEME_PROVENANCE.json`.
|
|
7
|
+
|
|
8
|
+
## Solarized Dark
|
|
9
|
+
|
|
10
|
+
- Source: `altercation/solarized` commit `62f656a02f93c5190a8753159e34b385588d5ff3`
|
|
11
|
+
- Copyright: Copyright (c) 2011 Ethan Schoonover
|
|
12
|
+
- License: MIT, reproduced in `third_party_licenses/solarized-MIT.txt`
|
|
13
|
+
- Modification: existing Floeterm ANSI mapping retained; `cursorAccent` was added equal to the background.
|
|
14
|
+
|
|
15
|
+
## Tokyo Night
|
|
16
|
+
|
|
17
|
+
- Source: `folke/tokyonight.nvim` commit `cdc07ac78467a233fd62c493de29a17e0cf2b2b6`
|
|
18
|
+
- Copyright: Folke Lemaitre and Tokyo Night contributors
|
|
19
|
+
- License: Apache-2.0, reproduced in `third_party_licenses/tokyonight-Apache-2.0.txt`
|
|
20
|
+
- The fixed source tree contains no NOTICE file.
|
|
21
|
+
- Modification: existing Floeterm palette retained.
|
|
22
|
+
|
|
23
|
+
## Monokai legacy risk
|
|
24
|
+
|
|
25
|
+
The `monokai` ID, label, and palette predate Floeterm 0.8.0. The exact original
|
|
26
|
+
palette source and upstream naming authorization could not be reconstructed
|
|
27
|
+
reliably. Floeterm retains the existing values for persisted preference and API
|
|
28
|
+
compatibility, does not claim an official Monokai release, and adds no new
|
|
29
|
+
third-party palette material. A future legal review may change the display label
|
|
30
|
+
while preserving the persisted ID.
|
|
@@ -4,6 +4,8 @@ export declare class TerminalCore {
|
|
|
4
4
|
private container;
|
|
5
5
|
private config;
|
|
6
6
|
private terminal;
|
|
7
|
+
private ownedRuntime;
|
|
8
|
+
private ownedRuntimeMemory;
|
|
7
9
|
private fitAddon;
|
|
8
10
|
private needsFullRenderOnNextWrite;
|
|
9
11
|
private demandRenderForceAll;
|
|
@@ -48,6 +50,7 @@ export declare class TerminalCore {
|
|
|
48
50
|
private pendingPresentationScale;
|
|
49
51
|
private suppressResizeNotifications;
|
|
50
52
|
private clearResizeSuppressionRaf;
|
|
53
|
+
private readonly scrollbackRows;
|
|
51
54
|
private hasFocus;
|
|
52
55
|
private resizeNotifySeq;
|
|
53
56
|
private lastNotifiedSize;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TerminalCore.d.ts","sourceRoot":"","sources":["../../src/core/TerminalCore.ts"],"names":[],"mappings":"AAYA,OAAO,EACL,aAAa,EACb,KAAK,MAAM,EAEX,KAAK,cAAc,EACnB,KAAK,2BAA2B,EAChC,KAAK,2BAA2B,EAChC,KAAK,kBAAkB,EACvB,KAAK,qBAAqB,EAE1B,KAAK,oBAAoB,EACzB,KAAK,kBAAkB,EACvB,KAAK,oBAAoB,EAGzB,KAAK,2BAA2B,EAChC,KAAK,0BAA0B,EAC/B,KAAK,iCAAiC,EACtC,KAAK,wBAAwB,EAC7B,KAAK,0BAA0B,EAC/B,KAAK,6BAA6B,EAClC,KAAK,2BAA2B,EAChC,KAAK,4BAA4B,EAElC,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"TerminalCore.d.ts","sourceRoot":"","sources":["../../src/core/TerminalCore.ts"],"names":[],"mappings":"AAYA,OAAO,EACL,aAAa,EACb,KAAK,MAAM,EAEX,KAAK,cAAc,EACnB,KAAK,2BAA2B,EAChC,KAAK,2BAA2B,EAChC,KAAK,kBAAkB,EACvB,KAAK,qBAAqB,EAE1B,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CAAC,6BAA6B;CAKtC"}
|
|
@@ -4,7 +4,8 @@ import { cursorToFabricCursor, renderReasonFromForce, terminalLiveFabric, themeT
|
|
|
4
4
|
import { terminalFabricCoordinator } from '../fabric/TerminalFabricCoordinator.js';
|
|
5
5
|
import { TerminalState, } from '../types.js';
|
|
6
6
|
import { terminalInitializationScheduler, } from '../internal/TerminalInitializationScheduler.js';
|
|
7
|
-
import { getGhosttyFitAddonConstructor, getGhosttyLinkConstructors, getGhosttyTerminalConstructor, loadGhosttyModules, waitWithAbort, } from '../internal/TerminalResourceLoader.js';
|
|
7
|
+
import { acquireGhosttyRuntime, getGhosttyFitAddonConstructor, getGhosttyLinkConstructors, getGhosttyTerminalConstructor, inspectGhosttyRuntimeMemory, loadGhosttyModules, waitWithAbort, } from '../internal/TerminalResourceLoader.js';
|
|
8
|
+
import { capAutoFitTerminalColumns, mapGhosttyScrollbackRowsForPinnedVersion, validateTerminalColumns, validateTerminalScrollbackRows, } from '../internal/GhosttyScrollbackCompat.js';
|
|
8
9
|
import { createUnicodeSafeUrlProviderTerminal, } from '../internal/UnicodeSafeUrlProvider.js';
|
|
9
10
|
import { resolveTerminalInputElement, TerminalInputBridge } from './TerminalInputBridge.js';
|
|
10
11
|
import { terminalRenderScheduler } from './TerminalRenderScheduler.js';
|
|
@@ -12,7 +13,6 @@ import { scheduleUiTurn } from '../internal/scheduleUiTurn.js';
|
|
|
12
13
|
const TERMINAL_SNAPSHOT_VERSION = 1;
|
|
13
14
|
const DEFAULT_TERMINAL_SNAPSHOT_MAX_BYTES = 2 * 1024 * 1024;
|
|
14
15
|
const ESTIMATED_RENDERER_BYTES = 4 * 1024 * 1024;
|
|
15
|
-
const ESTIMATED_CELL_BYTES = 16;
|
|
16
16
|
const SNAPSHOT_RESET_PREFIX = '\x1bc\x1b[2J\x1b[H';
|
|
17
17
|
const encodedByteLength = (value) => new TextEncoder().encode(value).byteLength;
|
|
18
18
|
const TERMINAL_SEARCH_MAX_RESULTS = 5000;
|
|
@@ -255,14 +255,14 @@ function canSkipNativeCanvasRowRender(renderer, row, fabricActive) {
|
|
|
255
255
|
function samePresentationScale(left, right) {
|
|
256
256
|
return Math.abs(left - right) <= PRESENTATION_SCALE_EPSILON;
|
|
257
257
|
}
|
|
258
|
-
function normalizeTerminalDimensions(value) {
|
|
258
|
+
function normalizeTerminalDimensions(value, columnsLabel = 'fixedDimensions.cols') {
|
|
259
259
|
const raw = (typeof value === 'object' && value) ? value : null;
|
|
260
260
|
if (!raw) {
|
|
261
261
|
return null;
|
|
262
262
|
}
|
|
263
|
-
const cols =
|
|
263
|
+
const cols = validateTerminalColumns(raw.cols, columnsLabel);
|
|
264
264
|
const rows = Math.floor(Number(raw.rows));
|
|
265
|
-
if (!Number.isFinite(
|
|
265
|
+
if (!Number.isFinite(rows) || rows <= 0) {
|
|
266
266
|
return null;
|
|
267
267
|
}
|
|
268
268
|
return { cols, rows };
|
|
@@ -341,6 +341,8 @@ export class TerminalCore {
|
|
|
341
341
|
this.container = container;
|
|
342
342
|
this.config = config;
|
|
343
343
|
this.terminal = null;
|
|
344
|
+
this.ownedRuntime = null;
|
|
345
|
+
this.ownedRuntimeMemory = null;
|
|
344
346
|
this.fitAddon = null;
|
|
345
347
|
this.needsFullRenderOnNextWrite = false;
|
|
346
348
|
this.demandRenderForceAll = false;
|
|
@@ -406,6 +408,11 @@ export class TerminalCore {
|
|
|
406
408
|
pendingResizeReason: null,
|
|
407
409
|
pendingSearchOverlayRender: false,
|
|
408
410
|
};
|
|
411
|
+
const explicitCols = config?.cols;
|
|
412
|
+
if (explicitCols !== undefined) {
|
|
413
|
+
validateTerminalColumns(explicitCols);
|
|
414
|
+
}
|
|
415
|
+
this.scrollbackRows = validateTerminalScrollbackRows(config?.scrollback === undefined ? 1000 : config.scrollback);
|
|
409
416
|
this.eventHandlers = eventHandlers;
|
|
410
417
|
this.clipboard = TerminalCore.normalizeClipboardConfig(config?.clipboard);
|
|
411
418
|
this.fit = TerminalCore.normalizeFitConfig(config?.fit);
|
|
@@ -414,6 +421,12 @@ export class TerminalCore {
|
|
|
414
421
|
this.logicalFontSize = TerminalCore.normalizeFontSize(config?.fontSize);
|
|
415
422
|
this.presentationScale = TerminalCore.normalizePresentationScale(config?.presentationScale);
|
|
416
423
|
this.fixedDimensions = normalizeTerminalDimensions(config?.fixedDimensions);
|
|
424
|
+
this.config = {
|
|
425
|
+
...config,
|
|
426
|
+
...(explicitCols === undefined ? {} : { cols: explicitCols }),
|
|
427
|
+
fixedDimensions: this.fixedDimensions,
|
|
428
|
+
scrollback: this.scrollbackRows,
|
|
429
|
+
};
|
|
417
430
|
this.renderTask = {
|
|
418
431
|
id: TerminalCore.nextRenderTaskId,
|
|
419
432
|
run: forceAll => {
|
|
@@ -457,6 +470,11 @@ export class TerminalCore {
|
|
|
457
470
|
promise: Promise.resolve(),
|
|
458
471
|
};
|
|
459
472
|
operation.promise = (async () => {
|
|
473
|
+
const assertInitializationActive = () => {
|
|
474
|
+
if (this.isDisposed)
|
|
475
|
+
throw new Error('Cannot initialize a disposed TerminalCore');
|
|
476
|
+
lifecycleAbortController.signal.throwIfAborted();
|
|
477
|
+
};
|
|
460
478
|
const permit = await request.permit;
|
|
461
479
|
if (!permit) {
|
|
462
480
|
if (this.isDisposed)
|
|
@@ -467,20 +485,21 @@ export class TerminalCore {
|
|
|
467
485
|
}
|
|
468
486
|
operation.started = true;
|
|
469
487
|
try {
|
|
470
|
-
|
|
471
|
-
throw new Error('Cannot initialize a disposed TerminalCore');
|
|
488
|
+
assertInitializationActive();
|
|
472
489
|
await loadGhosttyModules(this.logger, lifecycleAbortController.signal);
|
|
473
|
-
|
|
474
|
-
|
|
490
|
+
assertInitializationActive();
|
|
491
|
+
const ownedRuntime = await acquireGhosttyRuntime(this.logger);
|
|
492
|
+
assertInitializationActive();
|
|
493
|
+
const ownedRuntimeMemory = inspectGhosttyRuntimeMemory(ownedRuntime);
|
|
494
|
+
assertInitializationActive();
|
|
495
|
+
this.ownedRuntime = ownedRuntime;
|
|
496
|
+
this.ownedRuntimeMemory = ownedRuntimeMemory;
|
|
475
497
|
await this.createTerminalInstance(lifecycleAbortController.signal);
|
|
476
|
-
|
|
477
|
-
throw new Error('Cannot initialize a disposed TerminalCore');
|
|
498
|
+
assertInitializationActive();
|
|
478
499
|
await this.loadAddons();
|
|
479
|
-
|
|
480
|
-
throw new Error('Cannot initialize a disposed TerminalCore');
|
|
500
|
+
assertInitializationActive();
|
|
481
501
|
await this.openTerminal(lifecycleAbortController.signal);
|
|
482
|
-
|
|
483
|
-
throw new Error('Cannot initialize a disposed TerminalCore');
|
|
502
|
+
assertInitializationActive();
|
|
484
503
|
this.setupEventListeners();
|
|
485
504
|
this.setupResponsiveListeners();
|
|
486
505
|
this.startSizeWatching();
|
|
@@ -517,14 +536,26 @@ export class TerminalCore {
|
|
|
517
536
|
return;
|
|
518
537
|
settled = true;
|
|
519
538
|
operation.waiters = Math.max(0, operation.waiters - 1);
|
|
520
|
-
if (operation.waiters
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
if (this.initializationOperation === operation
|
|
524
|
-
this.
|
|
525
|
-
|
|
526
|
-
|
|
539
|
+
if (operation.waiters !== 0 || operation.cancelled)
|
|
540
|
+
return;
|
|
541
|
+
if (operation.started) {
|
|
542
|
+
if (this.initializationOperation === operation
|
|
543
|
+
&& !this.isDisposed
|
|
544
|
+
&& this.state === TerminalState.INITIALIZING) {
|
|
545
|
+
operation.cancelled = true;
|
|
546
|
+
// Ghostty.load() cannot be cancelled. Abort the Core lifecycle so the
|
|
547
|
+
// owned runtime is discarded when that load settles, while the
|
|
548
|
+
// initialization permit remains held by the operation's finally path.
|
|
549
|
+
operation.lifecycleAbortController.abort();
|
|
527
550
|
}
|
|
551
|
+
return;
|
|
552
|
+
}
|
|
553
|
+
operation.cancelled = true;
|
|
554
|
+
operation.request.cancel();
|
|
555
|
+
if (this.initializationOperation === operation) {
|
|
556
|
+
this.initializationOperation = null;
|
|
557
|
+
if (!this.isDisposed)
|
|
558
|
+
this.setState(TerminalState.IDLE);
|
|
528
559
|
}
|
|
529
560
|
};
|
|
530
561
|
return waitWithAbort(operation.promise, signal).finally(releaseWaiter);
|
|
@@ -540,6 +571,8 @@ export class TerminalCore {
|
|
|
540
571
|
this.fabricView = null;
|
|
541
572
|
this.terminal?.dispose();
|
|
542
573
|
this.terminal = null;
|
|
574
|
+
this.ownedRuntimeMemory = null;
|
|
575
|
+
this.ownedRuntime = null;
|
|
543
576
|
this.inputElement?.remove();
|
|
544
577
|
this.inputElement = null;
|
|
545
578
|
this.fitAddon = null;
|
|
@@ -552,6 +585,9 @@ export class TerminalCore {
|
|
|
552
585
|
if (!TerminalCtor) {
|
|
553
586
|
throw new Error('ghostty-web module not loaded');
|
|
554
587
|
}
|
|
588
|
+
if (!this.ownedRuntime) {
|
|
589
|
+
throw new Error('ghostty-web runtime not acquired');
|
|
590
|
+
}
|
|
555
591
|
const defaultConfig = {
|
|
556
592
|
cols: 80,
|
|
557
593
|
rows: 24,
|
|
@@ -586,13 +622,14 @@ export class TerminalCore {
|
|
|
586
622
|
cursorBlink: typeof finalConfig.cursorBlink === 'boolean' ? finalConfig.cursorBlink : undefined,
|
|
587
623
|
cursorStyle: typeof finalConfig.cursorStyle === 'string' ? finalConfig.cursorStyle : undefined,
|
|
588
624
|
theme: initialTheme,
|
|
589
|
-
scrollback:
|
|
625
|
+
scrollback: mapGhosttyScrollbackRowsForPinnedVersion(this.scrollbackRows),
|
|
590
626
|
fontSize: this.resolveEffectiveFontSize(),
|
|
591
627
|
fontFamily: typeof finalConfig.fontFamily === 'string' ? finalConfig.fontFamily : undefined,
|
|
592
628
|
allowTransparency: typeof finalConfig.allowTransparency === 'boolean' ? finalConfig.allowTransparency : undefined,
|
|
593
629
|
convertEol: typeof finalConfig.convertEol === 'boolean' ? finalConfig.convertEol : undefined,
|
|
594
630
|
disableStdin: typeof finalConfig.disableStdin === 'boolean' ? finalConfig.disableStdin : undefined,
|
|
595
|
-
smoothScrollDuration: typeof finalConfig.smoothScrollDuration === 'number' ? finalConfig.smoothScrollDuration : undefined
|
|
631
|
+
smoothScrollDuration: typeof finalConfig.smoothScrollDuration === 'number' ? finalConfig.smoothScrollDuration : undefined,
|
|
632
|
+
ghostty: this.ownedRuntime,
|
|
596
633
|
});
|
|
597
634
|
}
|
|
598
635
|
async loadAddons() {
|
|
@@ -693,7 +730,7 @@ export class TerminalCore {
|
|
|
693
730
|
const availableWidth = Math.max(0, width - paddingLeft - paddingRight - this.fit.scrollbarReservePx);
|
|
694
731
|
const availableHeight = Math.max(0, height - paddingTop - paddingBottom);
|
|
695
732
|
return {
|
|
696
|
-
cols: Math.max(MIN_TERMINAL_COLS, Math.floor(availableWidth / cellWidth)),
|
|
733
|
+
cols: capAutoFitTerminalColumns(Math.max(MIN_TERMINAL_COLS, Math.floor(availableWidth / cellWidth))),
|
|
697
734
|
rows: Math.max(MIN_TERMINAL_ROWS, Math.floor(availableHeight / cellHeight)),
|
|
698
735
|
};
|
|
699
736
|
}
|
|
@@ -711,7 +748,7 @@ export class TerminalCore {
|
|
|
711
748
|
return null;
|
|
712
749
|
}
|
|
713
750
|
return {
|
|
714
|
-
cols: Math.max(MIN_TERMINAL_COLS, cols),
|
|
751
|
+
cols: capAutoFitTerminalColumns(Math.max(MIN_TERMINAL_COLS, cols)),
|
|
715
752
|
rows: Math.max(MIN_TERMINAL_ROWS, rows),
|
|
716
753
|
};
|
|
717
754
|
}
|
|
@@ -1915,6 +1952,16 @@ export class TerminalCore {
|
|
|
1915
1952
|
});
|
|
1916
1953
|
}
|
|
1917
1954
|
getResourceEstimate() {
|
|
1955
|
+
const wasmMemoryBytes = this.ownedRuntimeMemory?.buffer.byteLength ?? 0;
|
|
1956
|
+
if (wasmMemoryBytes <= 0) {
|
|
1957
|
+
return {
|
|
1958
|
+
bufferBytes: 0,
|
|
1959
|
+
cellCount: 0,
|
|
1960
|
+
wasmMemoryBytes: 0,
|
|
1961
|
+
estimatedBytes: 0,
|
|
1962
|
+
rendererType: this.config.rendererType ?? 'canvas',
|
|
1963
|
+
};
|
|
1964
|
+
}
|
|
1918
1965
|
const info = this.getTerminalInfo();
|
|
1919
1966
|
const cellCount = info ? Math.max(0, info.cols * info.bufferLength) : 0;
|
|
1920
1967
|
let bufferBytes = 0;
|
|
@@ -1926,7 +1973,8 @@ export class TerminalCore {
|
|
|
1926
1973
|
return {
|
|
1927
1974
|
bufferBytes,
|
|
1928
1975
|
cellCount,
|
|
1929
|
-
|
|
1976
|
+
wasmMemoryBytes,
|
|
1977
|
+
estimatedBytes: ESTIMATED_RENDERER_BYTES + wasmMemoryBytes,
|
|
1930
1978
|
rendererType: this.config.rendererType ?? 'canvas',
|
|
1931
1979
|
};
|
|
1932
1980
|
}
|
|
@@ -2895,10 +2943,14 @@ export class TerminalCore {
|
|
|
2895
2943
|
this.fabricView = null;
|
|
2896
2944
|
this.terminal?.dispose();
|
|
2897
2945
|
this.terminal = null;
|
|
2946
|
+
this.ownedRuntimeMemory = null;
|
|
2947
|
+
this.ownedRuntime = null;
|
|
2898
2948
|
this.inputElement?.remove();
|
|
2899
2949
|
this.inputElement = null;
|
|
2950
|
+
this.viewportHost?.remove();
|
|
2900
2951
|
this.viewportHost = null;
|
|
2901
2952
|
this.renderHost = null;
|
|
2953
|
+
this.fitAddon = null;
|
|
2902
2954
|
this.registeredLinkProviders.clear();
|
|
2903
2955
|
this.appliedLinkProviders.clear();
|
|
2904
2956
|
this.setState(TerminalState.DISPOSED);
|
|
@@ -3183,12 +3235,10 @@ export class TerminalCore {
|
|
|
3183
3235
|
presentationRequest.frameHandle = requestAnimationFrame(() => {
|
|
3184
3236
|
if (!this.presentationRequests.has(presentationRequest))
|
|
3185
3237
|
return;
|
|
3186
|
-
|
|
3187
|
-
|
|
3188
|
-
|
|
3189
|
-
|
|
3190
|
-
presentationRequest.resolve();
|
|
3191
|
-
});
|
|
3238
|
+
if (!this.presentationRequests.delete(presentationRequest))
|
|
3239
|
+
return;
|
|
3240
|
+
presentationRequest.frameHandle = null;
|
|
3241
|
+
presentationRequest.resolve();
|
|
3192
3242
|
});
|
|
3193
3243
|
}
|
|
3194
3244
|
}
|