@xenosystem/blocks 0.3.0 → 0.4.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.
@@ -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,62 +1,80 @@
1
- {
2
- "name": "@xenosystem/blocks",
3
- "version": "0.3.0",
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
- "license": "UNLICENSED",
6
- "type": "module",
7
- "sideEffects": false,
8
- "exports": {
9
- ".": {
10
- "types": "./dist/index.d.ts",
11
- "import": "./dist/index.js"
12
- },
13
- "./auth": {
14
- "types": "./dist/auth/index.d.ts",
15
- "import": "./dist/auth/index.js"
16
- },
17
- "./trust": {
18
- "types": "./dist/trust/index.d.ts",
19
- "import": "./dist/trust/index.js"
20
- }
21
- },
22
- "files": [
23
- "dist",
24
- "README.md",
25
- "LICENSE"
26
- ],
27
- "scripts": {
28
- "build": "tsup",
29
- "typecheck": "tsc --noEmit",
30
- "test": "vitest run"
31
- },
32
- "peerDependencies": {
33
- "@xenosystem/components": "^0.6.0",
34
- "@xenosystem/elements-react": ">=0.0.1",
35
- "@xenosystem/panel-account": "^0.1.0",
36
- "@xenosystem/panel-sdk": "^1.1.0",
37
- "@xenosystem/workbench": "^1.0.0",
38
- "react": ">=18.0.0",
39
- "react-dom": ">=18.0.0",
40
- "@xenosystem/block-sdk": "^0.1.1"
41
- },
42
- "devDependencies": {
43
- "@types/node": "^22.0.0",
44
- "@types/react": "^19.0.0",
45
- "@types/react-dom": "^19.0.0",
46
- "@xenosystem/components": "^0.6.0",
47
- "@xenosystem/elements-react": "0.0.1",
48
- "@xenosystem/panel-account": "^0.1.0",
49
- "@xenosystem/panel-sdk": "^1.1.0",
50
- "@xenosystem/workbench": "^1.0.0",
51
- "jsdom": "^26.0.0",
52
- "react": "^19.0.0",
53
- "react-dom": "^19.0.0",
54
- "tsup": "^8.0.0",
55
- "typescript": "^5.4.0",
56
- "vitest": "^4.1.0",
57
- "@xenosystem/block-sdk": "^0.1.1"
58
- },
59
- "publishConfig": {
60
- "access": "public"
61
- }
62
- }
1
+ {
2
+ "name": "@xenosystem/blocks",
3
+ "version": "0.4.0",
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
+ "license": "UNLICENSED",
6
+ "type": "module",
7
+ "sideEffects": false,
8
+ "exports": {
9
+ ".": {
10
+ "types": "./dist/index.d.ts",
11
+ "import": "./dist/index.js"
12
+ },
13
+ "./auth": {
14
+ "types": "./dist/auth/index.d.ts",
15
+ "import": "./dist/auth/index.js"
16
+ },
17
+ "./trust": {
18
+ "types": "./dist/trust/index.d.ts",
19
+ "import": "./dist/trust/index.js"
20
+ },
21
+ "./ops": {
22
+ "types": "./dist/ops/index.d.ts",
23
+ "import": "./dist/ops/index.js"
24
+ }
25
+ },
26
+ "files": [
27
+ "dist",
28
+ "README.md",
29
+ "LICENSE"
30
+ ],
31
+ "scripts": {
32
+ "build": "tsup",
33
+ "typecheck": "tsc --noEmit",
34
+ "test": "vitest run"
35
+ },
36
+ "peerDependencies": {
37
+ "@xenosystem/components": "^0.6.0",
38
+ "@xenosystem/elements-react": ">=0.0.1",
39
+ "@xenosystem/panel-account": "^0.1.0",
40
+ "@xenosystem/panel-sdk": "^1.1.0",
41
+ "@xenosystem/workbench": "^1.0.0",
42
+ "react": ">=18.0.0",
43
+ "react-dom": ">=18.0.0",
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"
48
+ },
49
+ "devDependencies": {
50
+ "@types/node": "^22.0.0",
51
+ "@types/react": "^19.0.0",
52
+ "@types/react-dom": "^19.0.0",
53
+ "@xenosystem/components": "^0.6.0",
54
+ "@xenosystem/elements-react": "0.0.1",
55
+ "@xenosystem/panel-account": "^0.1.0",
56
+ "@xenosystem/panel-sdk": "^1.1.0",
57
+ "@xenosystem/workbench": "^1.0.0",
58
+ "jsdom": "^26.0.0",
59
+ "react": "^19.0.0",
60
+ "react-dom": "^19.0.0",
61
+ "tsup": "^8.0.0",
62
+ "typescript": "^5.4.0",
63
+ "vitest": "^4.1.0",
64
+ "@xenosystem/block-sdk": "^0.1.1",
65
+ "@xenosystem/tree-core": "^0.1.0",
66
+ "@xterm/xterm": "^5.5.0",
67
+ "@xterm/addon-fit": "^0.10.0"
68
+ },
69
+ "publishConfig": {
70
+ "access": "public"
71
+ },
72
+ "peerDependenciesMeta": {
73
+ "@xterm/xterm": {
74
+ "optional": true
75
+ },
76
+ "@xterm/addon-fit": {
77
+ "optional": true
78
+ }
79
+ }
80
+ }