@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,68 @@
1
+ // src/ops/terminal/types.ts
2
+ var XENO_TERMINAL_THEME_KEYS = [
3
+ "background",
4
+ "foreground",
5
+ "cursor",
6
+ "cursorAccent",
7
+ "selectionBackground",
8
+ "black",
9
+ "red",
10
+ "green",
11
+ "yellow",
12
+ "blue",
13
+ "magenta",
14
+ "cyan",
15
+ "white",
16
+ "brightBlack",
17
+ "brightRed",
18
+ "brightGreen",
19
+ "brightYellow",
20
+ "brightBlue",
21
+ "brightMagenta",
22
+ "brightCyan",
23
+ "brightWhite"
24
+ ];
25
+ function terminalThemeVar(key) {
26
+ return `--xeno-terminal-${key.replace(/[A-Z]/g, (c) => "-" + c.toLowerCase())}`;
27
+ }
28
+ function readTerminalTheme(element) {
29
+ const view = element?.ownerDocument?.defaultView;
30
+ if (!view) return {};
31
+ const style = view.getComputedStyle(element);
32
+ const theme = {};
33
+ for (const key of XENO_TERMINAL_THEME_KEYS) {
34
+ const value = style.getPropertyValue(terminalThemeVar(key)).trim();
35
+ if (value) theme[key] = value;
36
+ }
37
+ return theme;
38
+ }
39
+ function measuredSize(size) {
40
+ if (!size) return false;
41
+ return Number.isFinite(size.cols) && Number.isFinite(size.rows) && size.cols > 1 && size.rows > 1;
42
+ }
43
+ function isLive(status) {
44
+ return status === "running";
45
+ }
46
+ function statusLabel(session) {
47
+ switch (session.status) {
48
+ case "idle":
49
+ return "not started";
50
+ case "starting":
51
+ return "starting\u2026";
52
+ case "running":
53
+ return session.pty === false ? "no pty" : null;
54
+ case "exited":
55
+ return session.exitCode === 0 || session.exitCode === void 0 ? "exited" : `exited ${session.exitCode}`;
56
+ case "failed":
57
+ return "failed";
58
+ }
59
+ }
60
+
61
+ export {
62
+ XENO_TERMINAL_THEME_KEYS,
63
+ terminalThemeVar,
64
+ readTerminalTheme,
65
+ measuredSize,
66
+ isLive,
67
+ statusLabel
68
+ };
package/dist/index.d.ts CHANGED
@@ -4,6 +4,6 @@
4
4
  * `/agent`. This root re-exports nothing on purpose: import the family you mount, so a product
5
5
  * carries only it. Naming rule: `XENO PACKAGE NAMING - STANDARD.md`.
6
6
  */
7
- declare const BLOCKS_VERSION = "0.3.0";
7
+ declare const BLOCKS_VERSION = "0.4.0";
8
8
 
9
9
  export { BLOCKS_VERSION };
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  // src/index.ts
2
- var BLOCKS_VERSION = "0.3.0";
2
+ var BLOCKS_VERSION = "0.4.0";
3
3
  export {
4
4
  BLOCKS_VERSION
5
5
  };