@graphlearning/graphl-flow 0.7.0 → 0.8.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 CHANGED
@@ -93,6 +93,12 @@ prompt's colours, red for root's `#`; every other row is output, in ink. A comma
93
93
  (default 80) wide wrapped, so the rows after it continue the command, and the command is highlighted
94
94
  whole across the wrap. `show`, `highlight` and `focus` (`con.L12`) work as on code.
95
95
 
96
+ **psql (0.8).** A console also recognises psql's default prompt: `syndica=>` (a new statement),
97
+ `syndica-*>` / `syndica(>` / `syndica'>` (a continued line; `(` and `'` inside brackets or a string),
98
+ `*` a transaction open, `!` a failed one, and `#` a superuser (red, like root). A statement's
99
+ continuation rows are one command, highlighted as SQL across its lines; `\d`, `\q`… draw as psql's
100
+ own commands. Capture with `psql -n` (no readline) in an 80-column pty.
101
+
96
102
  A full-screen program is a **`tty`**: `screen` (its rows), `cols?` (80), `inverse?` and `bold?` runs
97
103
  as `[row, from, to)` — a fixed grid, padded to `cols`, so two captures of `top` are the same box.
98
104
  Its rows are `tty.R<n>`.
package/dist/Code.d.ts CHANGED
@@ -15,15 +15,27 @@ type Row = {
15
15
  */
16
16
  export declare function codeRows(node: Code): Row[];
17
17
  export declare const codeLineIds: (node: Code) => string[];
18
- /** A shell prompt, as the three shells the course meets draw it. `sigil` is `$`/`%`, or `#` for root. */
19
- export interface Prompt {
18
+ /**
19
+ * A prompt: a shell's, as the three shells the course meets draw it (`sigil` is `$`/`%`, or `#` for
20
+ * root), or psql's (0.8) default `%/%R%x%# ` — the database, the input state (`=` a new statement,
21
+ * `-` a continued one, `(` `'` `"` inside brackets or quotes), the transaction state (`*` open, `!`
22
+ * failed, `?` unknown) and `>`, or `#` for a superuser.
23
+ */
24
+ export type Prompt = {
25
+ style: 'debian' | 'redhat' | 'zsh';
20
26
  user: string;
21
27
  host: string;
22
28
  cwd: string;
23
29
  sigil: string;
24
- style: 'debian' | 'redhat' | 'zsh';
25
30
  cmd: string;
26
- }
31
+ } | {
32
+ style: 'psql';
33
+ db: string;
34
+ mode: string;
35
+ tx: string;
36
+ sigil: string;
37
+ cmd: string;
38
+ };
27
39
  export declare function parsePrompt(row: string): Prompt | null;
28
40
  type ConsoleRow = {
29
41
  n: number;
@@ -41,8 +53,11 @@ type ConsoleRow = {
41
53
  };
42
54
  /**
43
55
  * Classify a transcript's rows. A prompt row is a command; a command row exactly `cols` wide wrapped,
44
- * so the rows after it continue the command until one is shorter. The command is tokenized WHOLE and
45
- * its tokens cut back into rows, so a string or a path that crosses the wrap keeps its colour.
56
+ * so the rows after it continue the command until one is shorter. psql (0.8) draws a prompt on every
57
+ * line of a statement, so a psql command also takes the continuation-prompt rows after it (`-`, `(`,
58
+ * `'`, `"`) as further LINES. The command is tokenized WHOLE — lines joined by `\n` — and its tokens
59
+ * cut back into rows, so a string crossing a wrap or a line keeps its colour. A shell command is
60
+ * `shell`, a psql one `sql`.
46
61
  */
47
62
  export declare function consoleRows(lines: string[], cols: number): Map<number, ConsoleRow>;
48
63
  export declare function CodeView({ node, style }: {
@@ -5,5 +5,10 @@ export interface Tok {
5
5
  }
6
6
  export type Lang = 'python' | 'sql' | 'scala' | 'java' | 'js' | 'ts' | 'shell' | 'hcl' | 'ini' | 'nginx' | 'nft' | 'text';
7
7
  export declare function tokenize(src: string, lang: Lang): Tok[];
8
- /** Drop a leading/trailing blank line and the common indent, so scenes can use indented template literals. */
8
+ /**
9
+ * Drop the template literal's first line break, trailing blank lines and the common indent, so scenes
10
+ * can use indented template literals. Only ONE leading blank line goes (0.8): a timeline pane's
11
+ * transcript can START with blank rows — padding that aligns it with the other session — and
12
+ * stripping them all shifted the whole pane up.
13
+ */
9
14
  export declare function dedent(src: string): string[];