afield 0.0.0-stage → 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.
- package/LICENSE +15 -0
- package/README.md +165 -2
- package/afield +214 -0
- package/package.json +42 -4
- package/pi-extensions/afield-session.ts +59 -0
- package/pi-extensions/elastic-footer.ts +167 -0
- package/server/attach.js +264 -0
- package/server/auth.js +169 -0
- package/server/client.js +64 -0
- package/server/control.js +65 -0
- package/server/identity.js +45 -0
- package/server/index.js +375 -0
- package/server/mirror.js +159 -0
- package/server/origin.js +51 -0
- package/server/picker.js +187 -0
- package/server/places.js +348 -0
- package/server/protocol.js +51 -0
- package/server/quick-tunnel.js +40 -0
- package/server/registry.js +190 -0
- package/server/serve.js +100 -0
- package/server/session-main.js +27 -0
- package/server/session.js +112 -0
- package/server/supervisor.js +432 -0
- package/server/viewer.js +65 -0
- package/src/app.js +1683 -0
- package/src/apple-touch-icon.png +0 -0
- package/src/index.html +96 -0
- package/src/keys.js +59 -0
- package/src/pi-icon.svg +13 -0
- package/src/style.css +559 -0
- package/src/transport.js +153 -0
- package/src/ttyd.js +51 -0
- package/src/viewport.js +168 -0
- package/tsconfig.json +14 -0
- package/vendor/wterm/LICENSE +191 -0
- package/vendor/wterm/README.md +7 -0
- package/vendor/wterm/packages/@wterm/dom/src/debug.ts +347 -0
- package/vendor/wterm/packages/@wterm/dom/src/hyperlink.ts +8 -0
- package/vendor/wterm/packages/@wterm/dom/src/index.ts +13 -0
- package/vendor/wterm/packages/@wterm/dom/src/input.ts +662 -0
- package/vendor/wterm/packages/@wterm/dom/src/renderer.ts +725 -0
- package/vendor/wterm/packages/@wterm/dom/src/terminal.css +195 -0
- package/vendor/wterm/packages/@wterm/dom/src/wterm.ts +609 -0
package/src/ttyd.js
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
// The wire protocol: subprotocol `tty` on /ws, first byte is the command.
|
|
2
|
+
// `server/protocol.js` is the other half.
|
|
3
|
+
export const INPUT = '0'
|
|
4
|
+
export const RESIZE = '1'
|
|
5
|
+
|
|
6
|
+
export const OUTPUT = '0'
|
|
7
|
+
export const SET_TITLE = '1'
|
|
8
|
+
export const SET_SIZE = '3'
|
|
9
|
+
export const PROCESS = '5'
|
|
10
|
+
|
|
11
|
+
// No SWITCH/ASK_PLACES/PLACES here any more: which session a socket shows is
|
|
12
|
+
// chosen by its URL (`/ws?session=<id>`), and the session list is a plain
|
|
13
|
+
// `GET /places` on the supervisor rather than a frame on this socket.
|
|
14
|
+
|
|
15
|
+
const enc = new TextEncoder()
|
|
16
|
+
const dec = new TextDecoder()
|
|
17
|
+
|
|
18
|
+
const frame = (cmd, text) => {
|
|
19
|
+
const body = enc.encode(text)
|
|
20
|
+
const out = new Uint8Array(body.length + 1)
|
|
21
|
+
out[0] = cmd.charCodeAt(0)
|
|
22
|
+
out.set(body, 1)
|
|
23
|
+
return out
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export const encodeInput = text => frame(INPUT, text)
|
|
27
|
+
|
|
28
|
+
export const encodeResize = (columns, rows) => frame(RESIZE, JSON.stringify({ columns, rows }))
|
|
29
|
+
|
|
30
|
+
// The handshake is a bare JSON object rather than a prefixed frame, and must be
|
|
31
|
+
// the first message on the socket.
|
|
32
|
+
export const encodeHandshake = (columns, rows) =>
|
|
33
|
+
enc.encode(JSON.stringify({ columns, rows }))
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Split a server message into its command byte and payload.
|
|
37
|
+
*
|
|
38
|
+
* OUTPUT payloads stay as raw bytes: a multi-byte UTF-8 sequence can straddle
|
|
39
|
+
* two WebSocket messages, and decoding each one independently corrupts it. The
|
|
40
|
+
* VT core reassembles them, so nothing here may look at the text.
|
|
41
|
+
*/
|
|
42
|
+
export function decodeFrame(buffer) {
|
|
43
|
+
const all = new Uint8Array(buffer)
|
|
44
|
+
if (all.length === 0) throw new Error('ttyd: empty message')
|
|
45
|
+
const cmd = String.fromCharCode(all[0])
|
|
46
|
+
const payload = all.subarray(1)
|
|
47
|
+
if (cmd === OUTPUT) return { cmd, payload }
|
|
48
|
+
const text = dec.decode(payload)
|
|
49
|
+
if (cmd === SET_SIZE || cmd === PROCESS) return { cmd, text, json: JSON.parse(text) }
|
|
50
|
+
return { cmd, text }
|
|
51
|
+
}
|
package/src/viewport.js
ADDED
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
// The adapter seam. `readViewport` is the only part that touches the browser;
|
|
2
|
+
// everything downstream is pure and testable against on-device fixtures.
|
|
3
|
+
|
|
4
|
+
export const KEY_BAR_H = 44
|
|
5
|
+
|
|
6
|
+
// Keys sitting on the bottom edge of the glass are awkward to hit, and the outer
|
|
7
|
+
// two run into the display's corner curve. Lift them clear of both.
|
|
8
|
+
const BOTTOM_CLEARANCE = 10
|
|
9
|
+
|
|
10
|
+
const MIN_COLS = 20
|
|
11
|
+
const MIN_ROWS = 4
|
|
12
|
+
|
|
13
|
+
// Below this, a shrinking viewport is browser chrome, not a keyboard.
|
|
14
|
+
const KEYBOARD_MIN = 100
|
|
15
|
+
|
|
16
|
+
// `env(safe-area-inset-*)` cannot be read back through a custom property — it
|
|
17
|
+
// stays an unresolved token. Reading it as real padding on a probe element does
|
|
18
|
+
// resolve it.
|
|
19
|
+
export function readInsets() {
|
|
20
|
+
const s = getComputedStyle(document.getElementById('safe-probe'))
|
|
21
|
+
return {
|
|
22
|
+
insetTop: parseFloat(s.paddingTop),
|
|
23
|
+
insetBottom: parseFloat(s.paddingBottom),
|
|
24
|
+
insetLeft: parseFloat(s.paddingLeft),
|
|
25
|
+
insetRight: parseFloat(s.paddingRight),
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
// The last settled keyboard-down `innerHeight` and bottom inset at each window
|
|
30
|
+
// width. With the keyboard up Chrome on Android reports neither faithfully, so
|
|
31
|
+
// a reading taken then takes its grid and lift from this. By width, not
|
|
32
|
+
// orientation: Chrome turns the width at once even when it keeps the old
|
|
33
|
+
// height. Kept for the tab's life, because a reload with the keyboard up has no
|
|
34
|
+
// other source.
|
|
35
|
+
const KEYBOARD_DOWN = 'afield-keyboard-down'
|
|
36
|
+
const keyboardDown = () => JSON.parse(sessionStorage.getItem(KEYBOARD_DOWN) ?? '{}')
|
|
37
|
+
|
|
38
|
+
export function readViewport() {
|
|
39
|
+
const vv = window.visualViewport
|
|
40
|
+
return {
|
|
41
|
+
...readInsets(),
|
|
42
|
+
innerWidth: window.innerWidth,
|
|
43
|
+
innerHeight: window.innerHeight,
|
|
44
|
+
screenWidth: window.screen.width,
|
|
45
|
+
visualWidth: vv.width,
|
|
46
|
+
visualHeight: vv.height,
|
|
47
|
+
offsetTop: vv.offsetTop,
|
|
48
|
+
standalone: window.navigator.standalone === true,
|
|
49
|
+
down: keyboardDown()[window.innerWidth] ?? null,
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Keep the viewport's reading as its width's keyboard-down layout, if it was
|
|
55
|
+
* taken with the keyboard down. Only once the viewport has settled: mid-turn
|
|
56
|
+
* Chrome passes through readings that mix the two orientations. Never from a
|
|
57
|
+
* panned page: iOS pans to show a focused field over the keyboard and shrinks
|
|
58
|
+
* `innerHeight` by the pan, which closes the gap the keyboard is measured by.
|
|
59
|
+
* Returns the reading when it differs from the one already kept.
|
|
60
|
+
*/
|
|
61
|
+
export function rememberKeyboardDown() {
|
|
62
|
+
const s = readViewport()
|
|
63
|
+
const l = deriveLayout(s)
|
|
64
|
+
if (!l || l.keyboardUp || s.offsetTop > 0) return null
|
|
65
|
+
const all = keyboardDown()
|
|
66
|
+
const entry = { innerHeight: s.innerHeight, insetBottom: s.insetBottom }
|
|
67
|
+
if (JSON.stringify(all[s.innerWidth]) === JSON.stringify(entry)) return null
|
|
68
|
+
all[s.innerWidth] = entry
|
|
69
|
+
sessionStorage.setItem(KEYBOARD_DOWN, JSON.stringify(all))
|
|
70
|
+
return entry
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/** Cell metrics for the current font, measured rather than assumed. */
|
|
74
|
+
export function measureCell(fontSize) {
|
|
75
|
+
const el = document.getElementById('cell-probe')
|
|
76
|
+
el.style.fontSize = `${fontSize}px`
|
|
77
|
+
const r = el.getBoundingClientRect()
|
|
78
|
+
// Row height must be a whole pixel or rows drift out of alignment down the screen.
|
|
79
|
+
return { width: r.width / 10, height: Math.round(r.height) }
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
export const validVisualHeight = height => Number.isFinite(height) && height > 0
|
|
83
|
+
|
|
84
|
+
export function horizontalLayout(s) {
|
|
85
|
+
// iOS updates the layout width at once on a turn, while the visual width
|
|
86
|
+
// lags by ~0.5 s, past the settle that refits the grid.
|
|
87
|
+
//
|
|
88
|
+
// Chrome on Android stops the page short of a side cutout yet still reports
|
|
89
|
+
// the cutout as an inset. Screen width the window does not cover is already
|
|
90
|
+
// outside the page, so it comes off the side insets. Chrome gives no per-edge
|
|
91
|
+
// signal (screenX/screenLeft are 0, outer and avail sizes equal the screen's,
|
|
92
|
+
// visualViewport.offsetLeft is 0), so the shortfall comes off both sides and
|
|
93
|
+
// the insets name the cutout side: only that one is nonzero. On iOS it takes
|
|
94
|
+
// nothing: an iPhone's screen.width stays at the portrait width, never wider
|
|
95
|
+
// than innerWidth, and an iPad window narrower than the screen (Split View,
|
|
96
|
+
// Stage Manager) has no side insets to take it from.
|
|
97
|
+
const avoided = Math.max(0, s.screenWidth - s.innerWidth)
|
|
98
|
+
const insetLeft = Math.max(0, s.insetLeft - avoided)
|
|
99
|
+
const insetRight = Math.max(0, s.insetRight - avoided)
|
|
100
|
+
return { width: s.innerWidth - insetLeft - insetRight, insetLeft, insetRight }
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* The visual viewport is the space above the keyboard (less what is `hidden`,
|
|
105
|
+
* below), so the app is sized from it and never from `innerHeight`.
|
|
106
|
+
*
|
|
107
|
+
* Insets are asymmetric: iOS already excludes the top inset from the layout
|
|
108
|
+
* viewport in standalone mode, so honouring it again would throw away the +7
|
|
109
|
+
* rows standalone buys. The bottom inset sits inside the viewport and must be
|
|
110
|
+
* reserved.
|
|
111
|
+
*
|
|
112
|
+
* The keyboard is the gap between the layout and visual viewports. Once it is
|
|
113
|
+
* up, `s.down`, the width's last keyboard-down reading (see readViewport),
|
|
114
|
+
* sizes the grid and lifts the keys. Chrome on Android drops the bottom inset
|
|
115
|
+
* while the keyboard is up, and its visual viewport then runs that far under
|
|
116
|
+
* the keyboard unless the window shrank by as much (it does on some devices,
|
|
117
|
+
* not on others). After a turn with the keyboard up it keeps the window height
|
|
118
|
+
* the keyboard was raised at, and the viewport is out by the difference until
|
|
119
|
+
* the keyboard goes. Either way the part under the keyboard is `hidden`, and
|
|
120
|
+
* the key bar lifts its keys clear of it. iOS reports the same inset with the
|
|
121
|
+
* keyboard up and keeps the window height, so nothing is hidden there.
|
|
122
|
+
*/
|
|
123
|
+
export function deriveLayout(s) {
|
|
124
|
+
// iOS standalone can report negative heights even after a resize settles.
|
|
125
|
+
if (!validVisualHeight(s.visualHeight)) return null
|
|
126
|
+
const down = s.down ?? s
|
|
127
|
+
const hidden = Math.max(0, (down.insetBottom - s.insetBottom) - (down.innerHeight - s.innerHeight))
|
|
128
|
+
const keyboardHeight = Math.max(0, Math.round(s.innerHeight - s.visualHeight - s.offsetTop))
|
|
129
|
+
const keyboardUp = keyboardHeight >= KEYBOARD_MIN
|
|
130
|
+
// The keyboard-down layout this reading belongs to.
|
|
131
|
+
const k = keyboardUp ? down : s
|
|
132
|
+
const lift = keyboardUp ? hidden : 0
|
|
133
|
+
const appHeight = s.visualHeight
|
|
134
|
+
const { width, insetLeft, insetRight } = horizontalLayout(s)
|
|
135
|
+
|
|
136
|
+
// The home indicator only overlaps the app when the keyboard is down; with the
|
|
137
|
+
// keyboard up it sits over the keyboard, so reserving the inset there is dead
|
|
138
|
+
// space. When it is down the key bar grows to cover it, keeping its keys clear
|
|
139
|
+
// of the indicator — reserving it below the bar instead just leaves a gap.
|
|
140
|
+
const bottomReserve = k.insetBottom + BOTTOM_CLEARANCE
|
|
141
|
+
const bottomInset = keyboardUp ? 0 : bottomReserve
|
|
142
|
+
const keyBarHeight = KEY_BAR_H + bottomInset + lift
|
|
143
|
+
const keyBarPadBottom = bottomInset + lift
|
|
144
|
+
|
|
145
|
+
return {
|
|
146
|
+
keyboardHeight,
|
|
147
|
+
keyboardUp,
|
|
148
|
+
orientation: s.innerWidth > k.innerHeight ? 'landscape' : 'portrait',
|
|
149
|
+
insetLeft,
|
|
150
|
+
insetRight,
|
|
151
|
+
appHeight,
|
|
152
|
+
keyBarHeight,
|
|
153
|
+
keyBarPadBottom,
|
|
154
|
+
// What to size the *grid* from. The keyboard-down layout viewport, so the
|
|
155
|
+
// grid stays put when the keyboard opens and the visible window just shows
|
|
156
|
+
// less of it — occlude and pan, rather than reflowing pi mid-sentence.
|
|
157
|
+
stableHeight: k.innerHeight - bottomReserve - KEY_BAR_H,
|
|
158
|
+
terminal: {
|
|
159
|
+
width,
|
|
160
|
+
height: appHeight - keyBarHeight,
|
|
161
|
+
},
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
export const gridFor = (width, height, cell) => ({
|
|
166
|
+
cols: Math.max(MIN_COLS, Math.floor(width / cell.width)),
|
|
167
|
+
rows: Math.max(MIN_ROWS, Math.floor(height / cell.height)),
|
|
168
|
+
})
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ES2020",
|
|
4
|
+
"module": "ESNext",
|
|
5
|
+
"moduleResolution": "bundler",
|
|
6
|
+
"lib": ["ES2022", "DOM", "DOM.Iterable"],
|
|
7
|
+
"strict": true,
|
|
8
|
+
"esModuleInterop": true,
|
|
9
|
+
"skipLibCheck": true,
|
|
10
|
+
"forceConsistentCasingInFileNames": true,
|
|
11
|
+
"noEmit": true
|
|
12
|
+
},
|
|
13
|
+
"include": ["vendor/wterm/packages/@wterm/dom/src", "pi-extensions"]
|
|
14
|
+
}
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to the Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by the Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding any notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
Copyright 2025 Vercel, Inc.
|
|
180
|
+
|
|
181
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
182
|
+
you may not use this file except in compliance with the License.
|
|
183
|
+
You may obtain a copy of the License at
|
|
184
|
+
|
|
185
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
186
|
+
|
|
187
|
+
Unless required by applicable law or agreed to in writing, software
|
|
188
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
189
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
190
|
+
See the License for the specific language governing permissions and
|
|
191
|
+
limitations under the License.
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
# wterm (vendored fork)
|
|
2
|
+
|
|
3
|
+
A trimmed, modified fork of [vercel-labs/wterm](https://github.com/vercel-labs/wterm), vendored for afield under Apache-2.0 (see LICENSE). Imported at upstream commit `4a73024d9f9003972f9efa6fe1a9086d1c90417b` (`@wterm/dom` 0.3.4). Only `packages/@wterm/dom/src` is kept, because that is all afield renders through; the WASM engine (`@wterm/core`) comes from npm, not from this tree.
|
|
4
|
+
|
|
5
|
+
The modified files are `packages/@wterm/dom/src/input.ts`, `renderer.ts`, and `wterm.ts`, each marked at the top. The changes adapt the renderer to mobile keyboards: composition and swipe-typing input via a field-mirror delta engine, QuickPath separator emulation, backspace stand-aside, a caret kept at the field's end for Chrome on Android, a `keyChord` hook so sticky modifiers reach keyboards without real keydowns, page keys, reflowing text zoom, and `followOutput`/`onAfterPaint` hooks. `git log -p -- vendor/wterm` shows the changes from upstream, and [docs/design.md](../../docs/design.md) explains how the fork fits the client.
|
|
6
|
+
|
|
7
|
+
Upstream syncs are manual: this tree no longer matches upstream's layout, so diff against the import commit above rather than pulling a subtree.
|