@xenosystem/blocks 0.3.0 → 0.4.1
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/dist/chunk-WE6A2DTY.js +68 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/ops/index.d.ts +2235 -0
- package/dist/ops/index.js +3757 -0
- package/dist/xterm-R3GIKSHA.js +83 -0
- package/package.json +21 -3
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import {
|
|
2
|
+
readTerminalTheme
|
|
3
|
+
} from "./chunk-WE6A2DTY.js";
|
|
4
|
+
|
|
5
|
+
// src/ops/terminal/xterm.ts
|
|
6
|
+
function themeScope() {
|
|
7
|
+
if (typeof document === "undefined") return null;
|
|
8
|
+
return document.querySelector(".xeno") ?? document.documentElement;
|
|
9
|
+
}
|
|
10
|
+
function monoFamily() {
|
|
11
|
+
const scope = themeScope();
|
|
12
|
+
const value = scope ? getComputedStyle(scope).getPropertyValue("--xeno-font-mono").trim() : "";
|
|
13
|
+
return value || "monospace";
|
|
14
|
+
}
|
|
15
|
+
async function createXtermEmulator(options = {}) {
|
|
16
|
+
const xtermSpecifier = "@xterm/xterm";
|
|
17
|
+
const fitSpecifier = "@xterm/addon-fit";
|
|
18
|
+
const [{ Terminal }, { FitAddon }] = await Promise.all([
|
|
19
|
+
import(
|
|
20
|
+
/* @vite-ignore */
|
|
21
|
+
xtermSpecifier
|
|
22
|
+
),
|
|
23
|
+
import(
|
|
24
|
+
/* @vite-ignore */
|
|
25
|
+
fitSpecifier
|
|
26
|
+
)
|
|
27
|
+
]);
|
|
28
|
+
const terminal = new Terminal({
|
|
29
|
+
cursorBlink: true,
|
|
30
|
+
cursorStyle: "block",
|
|
31
|
+
// the rung-1 mono stack; xterm needs a resolved family, so the var is read at construction
|
|
32
|
+
fontFamily: options.fontFamily ?? monoFamily(),
|
|
33
|
+
fontSize: options.fontSize ?? 12,
|
|
34
|
+
lineHeight: 1.15,
|
|
35
|
+
letterSpacing: 0,
|
|
36
|
+
scrollback: options.scrollback ?? 5e3,
|
|
37
|
+
convertEol: options.convertEol ?? false,
|
|
38
|
+
// The COMPLETE sixteen-colour palette, read from --xeno-terminal-* at the mount point (the tokens live
|
|
39
|
+
// in rung 1). A partial one lets xterm's own defaults through for the colours you did not set.
|
|
40
|
+
theme: { ...readTerminalTheme(themeScope()), ...options.theme }
|
|
41
|
+
});
|
|
42
|
+
const fitAddon = new FitAddon();
|
|
43
|
+
terminal.loadAddon(fitAddon);
|
|
44
|
+
return {
|
|
45
|
+
open(element) {
|
|
46
|
+
terminal.open(element);
|
|
47
|
+
},
|
|
48
|
+
write(data) {
|
|
49
|
+
terminal.write(data);
|
|
50
|
+
},
|
|
51
|
+
clear() {
|
|
52
|
+
terminal.clear();
|
|
53
|
+
},
|
|
54
|
+
fit() {
|
|
55
|
+
try {
|
|
56
|
+
fitAddon.fit();
|
|
57
|
+
} catch {
|
|
58
|
+
return null;
|
|
59
|
+
}
|
|
60
|
+
return { cols: terminal.cols, rows: terminal.rows };
|
|
61
|
+
},
|
|
62
|
+
size() {
|
|
63
|
+
return { cols: terminal.cols, rows: terminal.rows };
|
|
64
|
+
},
|
|
65
|
+
onData(handler) {
|
|
66
|
+
const disposable = terminal.onData(handler);
|
|
67
|
+
return () => disposable.dispose();
|
|
68
|
+
},
|
|
69
|
+
onResize(handler) {
|
|
70
|
+
const disposable = terminal.onResize(({ cols, rows }) => handler({ cols, rows }));
|
|
71
|
+
return () => disposable.dispose();
|
|
72
|
+
},
|
|
73
|
+
setFontSize(size) {
|
|
74
|
+
terminal.options.fontSize = size;
|
|
75
|
+
},
|
|
76
|
+
dispose() {
|
|
77
|
+
terminal.dispose();
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
export {
|
|
82
|
+
createXtermEmulator
|
|
83
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xenosystem/blocks",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.1",
|
|
4
4
|
"description": "XENO Blocks \u2014 rung 3 of the front ladder: components composed into a contract-bearing unit (manifest: ports, intents, commands, agent surface), rendered by @xenosystem/workbench. ONE package, one subpath per family (/auth, /edit, /data, /time, /ops, /trust, /agent), one named export per block \u2014 XENO PACKAGE NAMING - STANDARD.md.",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"type": "module",
|
|
@@ -17,6 +17,10 @@
|
|
|
17
17
|
"./trust": {
|
|
18
18
|
"types": "./dist/trust/index.d.ts",
|
|
19
19
|
"import": "./dist/trust/index.js"
|
|
20
|
+
},
|
|
21
|
+
"./ops": {
|
|
22
|
+
"types": "./dist/ops/index.d.ts",
|
|
23
|
+
"import": "./dist/ops/index.js"
|
|
20
24
|
}
|
|
21
25
|
},
|
|
22
26
|
"files": [
|
|
@@ -37,7 +41,10 @@
|
|
|
37
41
|
"@xenosystem/workbench": "^1.0.0",
|
|
38
42
|
"react": ">=18.0.0",
|
|
39
43
|
"react-dom": ">=18.0.0",
|
|
40
|
-
"@xenosystem/block-sdk": "^0.1.1"
|
|
44
|
+
"@xenosystem/block-sdk": "^0.1.1",
|
|
45
|
+
"@xenosystem/tree-core": "^0.1.0",
|
|
46
|
+
"@xterm/xterm": ">=5.5.0",
|
|
47
|
+
"@xterm/addon-fit": ">=0.10.0"
|
|
41
48
|
},
|
|
42
49
|
"devDependencies": {
|
|
43
50
|
"@types/node": "^22.0.0",
|
|
@@ -54,9 +61,20 @@
|
|
|
54
61
|
"tsup": "^8.0.0",
|
|
55
62
|
"typescript": "^5.4.0",
|
|
56
63
|
"vitest": "^4.1.0",
|
|
57
|
-
"@xenosystem/block-sdk": "^0.1.1"
|
|
64
|
+
"@xenosystem/block-sdk": "^0.1.1",
|
|
65
|
+
"@xenosystem/tree-core": "^0.1.0",
|
|
66
|
+
"@xterm/xterm": "^6.0.0",
|
|
67
|
+
"@xterm/addon-fit": "^0.11.0"
|
|
58
68
|
},
|
|
59
69
|
"publishConfig": {
|
|
60
70
|
"access": "public"
|
|
71
|
+
},
|
|
72
|
+
"peerDependenciesMeta": {
|
|
73
|
+
"@xterm/xterm": {
|
|
74
|
+
"optional": true
|
|
75
|
+
},
|
|
76
|
+
"@xterm/addon-fit": {
|
|
77
|
+
"optional": true
|
|
78
|
+
}
|
|
61
79
|
}
|
|
62
80
|
}
|