@graphlearning/graphl-flow 0.6.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
@@ -72,7 +72,7 @@ column), not below it — an edge is routed in the gap between two siblings, nev
72
72
  `tag` draws a short pill before a row (`PK`, `FK`, `sp`); `tone` on a row tints it.
73
73
 
74
74
  **Code.** `code` takes the source as a (template-literal) string; its common indent is dropped.
75
- `lang` is `python | sql | scala | java | js | ts | shell | hcl | text` — one small highlighter with seven
75
+ `lang` is `python | sql | scala | java | js | ts | shell | hcl | ini | nginx | nft | text` — one small highlighter with seven
76
76
  token colours per theme, sharing one keyword set (Java's primitive types, `record`, `sealed` and
77
77
  `switch` included); an `@Name` — a Java annotation, a Python decorator — draws as a keyword, and a
78
78
  number keeps its separators and suffix (`1_000_000L`). `show` keeps only those line ranges and folds
@@ -80,6 +80,32 @@ each skipped run into `··· N lines`; `show` and `highlight` use the FILE's li
80
80
  edges: `src.L17`.
81
81
  `terminal: true` draws a terminal — `$ ` lines are commands, `! ` lines errors, the rest output;
82
82
  `show` folds a terminal too (0.6), so a long plan keeps its command, resource line and summary.
83
+ Shell (0.7) has its own keywords (`if then fi for do done case`…), never the shared set: before it,
84
+ `/var/www` drew `var` as a keyword. Config languages (0.7) — `ini` (a systemd unit: `[Section]`,
85
+ `Key=`), `nginx` (a statement's first word is the directive) and `nft` (nftables) — have their own
86
+ words too; in shell and config files `@` and `.` are parts of an address, not an annotation or a
87
+ member access.
88
+
89
+ **Consoles (0.7).** `console: true` draws a REAL transcript, row for row as an 80-column terminal
90
+ showed it — no `$ ` convention, no `!` marks, nothing edited. A row that starts with a prompt is a
91
+ command — `ana@web-01:~$` (Debian), `[ana@web-02 ~]$` (Red Hat), `ana@mac ~ %` (zsh) — drawn in the
92
+ prompt's colours, red for root's `#`; every other row is output, in ink. A command row exactly `cols`
93
+ (default 80) wide wrapped, so the rows after it continue the command, and the command is highlighted
94
+ whole across the wrap. `show`, `highlight` and `focus` (`con.L12`) work as on code.
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
+
102
+ A full-screen program is a **`tty`**: `screen` (its rows), `cols?` (80), `inverse?` and `bold?` runs
103
+ as `[row, from, to)` — a fixed grid, padded to `cols`, so two captures of `top` are the same box.
104
+ Its rows are `tty.R<n>`.
105
+
106
+ **Console frames (0.7).** Two columns, both FIXED: the console (or a `tty` in its slot, same `w`/`h`) |
107
+ the PICTURE of what it just showed — a `bare` group of the rest of 16:9. No edges between them; ring
108
+ the console line with `focus`. See `dev/fixtures/studies/console-frame.ts`.
83
109
 
84
110
  **IDE frames.** Three columns: `tree` | (editor `code` over terminal `code`, in a `bare` group) |
85
111
  a SIDE PANE — a `bare` group with a fixed width `w`. The IDE alone is narrower than 16:9; the side
@@ -137,12 +163,13 @@ writes `captures/<id>-<theme>.png`.
137
163
  | `item` | `id`, `title`, `muted?`, `sub?`, `icon?`, `bullets?`, `stack?`, `chip?`, `tone?`, `span?` |
138
164
  | `group` | `id`, `children`, `title?`, `sub?`, `icon?`, `badge?`, `dir?: 'row' \| 'col' \| 'grid'`, `cols?`, `bare?`, `dashed?`, `muted?`, `spread?`, `cell?: number \| true`, `tone?`, `span?` |
139
165
  | `table` | `id`, `rows`, `columns?`, `title?`, `tone?`, `span?` — a row is `[cells…]` or `{ cells, id?, tag?, tone? }` |
140
- | `code` | `id`, `code`, `lang?`, `filename?`, `show?: [from, to][]`, `highlight?: number[]`, `terminal?`, `output?`, `tone?`, `span?` |
166
+ | `code` | `id`, `code`, `lang?`, `filename?`, `show?: [from, to][]`, `highlight?: number[]`, `terminal?`, `output?`, `console?`, `cols?`, `tone?`, `span?` |
167
+ | `tty` | `id`, `screen: string[]`, `title?`, `cols?`, `inverse?`, `bold?` (`[row, from, to][]`) — a full-screen program's grid |
141
168
  | `plot` | `id`, `x`, `y` (axes: `min`, `max`, `step?`, `label?`, or `labels` for categories), `series`, `title?`, `axes?`, `grid?` |
142
169
  | `tree` | `id`, `entries` (`name`, `children?`, `folder?`, `state?: active \| new \| muted`, `note?`, `icon?`), `title?` |
143
170
  | `note` | `id`, `text`, `tone?` — a dashed callout of wrapping prose |
144
171
  | any node | `minW?`/`minH?` (floors), `maxW?`/`maxH?` (caps), `w?`/`h?` (exact), `fill?`, `span?`, `tone?`; groups also `bare?` |
145
- | `Edge` | `from`, `to` (a node id; a table row `table.row`; a code line `code.L12`; a tree entry `tree.src/a.py`), `label?`, `dashed?`, `bidirectional?` |
172
+ | `Edge` | `from`, `to` (a node id; a table row `table.row`; a code line `code.L12`; a tree entry `tree.src/a.py`; a tty row `top.R7`), `label?`, `dashed?`, `bidirectional?` |
146
173
  | `Scene` | `nodes`, `edges?`, `title?`, `sub?`, `dir?`, `pulse?` |
147
174
 
148
175
  **Layout.** A group lays its children out as `dir: 'col'` (default), `'row'` (one column per child)
@@ -165,12 +192,12 @@ The theme (`dark` | `light`) picks the shade; repos cannot recolour.
165
192
 
166
193
  | set | drawn in | keys |
167
194
  |---|---|---|
168
- | generic (lucide) | the tone accent | `activity admin bell box branch building card chart check clock cloud code cpu database disk factory file filter fingerprint folder globe key layers lock network package pie screen search server settings shield stream table terminal user users workflow zap` |
195
+ | generic (lucide) | the tone accent | `activity admin bell box branch building card chart check clock cloud code archive cert cpu database disk factory file filter fingerprint firewall folder gauge globe key laptop layers lock log memory network package pie power screen search server settings shield stream table terminal timer user users workflow zap` |
169
196
  | Azure | its own colours | `adls aks analysisservices azuresql cosmos databricks datafactory defender devops eventhubs functions keyvault loganalytics monitor powerbi purview servicebus storage streamanalytics synapse vm` |
170
197
  | AWS service | its own tile | `acm apigateway athena aurora backup budgets cloudformation cloudfront cloudtrail cloudwatch costexplorer dms dynamodb ec2 ecr ecs eks elasticache elb emr eventbridge fargate firehose glue iam identitycenter kinesis kms lakeformation lambda msk mwaa organizations rds redshift route53 s3 sagemaker secretsmanager sns sqs ssm stepfunctions vpc waf xray` |
171
198
  | AWS group mark | its own tile (for a group's `icon`) | `account autoscaling privatesubnet publicsubnet region` |
172
199
  | AWS resource | a single-colour glyph, no tile | `alb bucket container ecsservice ecstask hostedzone iamrole igw message natgateway permissions queue router sts topic vpcendpoint` |
173
- | brand | its own colour (ink if it would vanish) | `airflow docker duckdb flink git github githubactions grafana java junit jupyter kafka kubernetes maven mongodb pandas postgresql prometheus python snowflakedb spark terraform` |
200
+ | brand | its own colour (ink if it would vanish) | `airflow almalinux apple arch bash debian docker duckdb fedora flink git github githubactions grafana java junit jupyter kafka kubernetes letsencrypt linux macos maven mongodb nginx pandas postgresql prometheus python redhat rocky snowflakedb spark terraform ubuntu zsh` |
174
201
 
175
202
  **`muted: true`** draws an item greyed, or a group as a plain grey outline — a part the system does
176
203
  not have yet, at its full size and place (paint only, so muting moves nothing; a muted group does not
package/dist/Code.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import type { CSSProperties } from 'react';
2
+ import { type Tok } from './highlight';
2
3
  import type { Code } from './types';
3
4
  type Row = {
4
5
  n: number;
@@ -14,6 +15,51 @@ type Row = {
14
15
  */
15
16
  export declare function codeRows(node: Code): Row[];
16
17
  export declare const codeLineIds: (node: Code) => string[];
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';
26
+ user: string;
27
+ host: string;
28
+ cwd: string;
29
+ sigil: string;
30
+ cmd: string;
31
+ } | {
32
+ style: 'psql';
33
+ db: string;
34
+ mode: string;
35
+ tx: string;
36
+ sigil: string;
37
+ cmd: string;
38
+ };
39
+ export declare function parsePrompt(row: string): Prompt | null;
40
+ type ConsoleRow = {
41
+ n: number;
42
+ kind: 'cmd';
43
+ prompt: Prompt;
44
+ toks: Tok[];
45
+ } | {
46
+ n: number;
47
+ kind: 'cont';
48
+ toks: Tok[];
49
+ } | {
50
+ n: number;
51
+ kind: 'out';
52
+ text: string;
53
+ };
54
+ /**
55
+ * Classify a transcript's rows. A prompt row is a command; a command row exactly `cols` wide wrapped,
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`.
61
+ */
62
+ export declare function consoleRows(lines: string[], cols: number): Map<number, ConsoleRow>;
17
63
  export declare function CodeView({ node, style }: {
18
64
  node: Code;
19
65
  style?: CSSProperties;
package/dist/Tty.d.ts ADDED
@@ -0,0 +1,12 @@
1
+ import type { CSSProperties } from 'react';
2
+ import type { Tty } from './types';
3
+ /** Rows addressable by edges and `focus` as `<tty>.R<n>`, 1-based like a code line. */
4
+ export declare const ttyRowIds: (node: Tty) => string[];
5
+ /**
6
+ * A full-screen program's screen: a terminal frame with a fixed grid of `cols` × the screen's rows.
7
+ * The size comes from the capture, never from the content, so two screenshots of `top` are the same box.
8
+ */
9
+ export declare function TtyView({ node, style }: {
10
+ node: Tty;
11
+ style?: CSSProperties;
12
+ }): import("react").JSX.Element;
@@ -3,7 +3,12 @@ export interface Tok {
3
3
  cls: TokClass;
4
4
  text: string;
5
5
  }
6
- export type Lang = 'python' | 'sql' | 'scala' | 'java' | 'js' | 'ts' | 'shell' | 'hcl' | 'text';
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[];
package/dist/index.d.ts CHANGED
@@ -1,2 +1,2 @@
1
1
  export { Scene } from './Scene';
2
- export type { Scene as SceneModel, SceneNode, Group, Item, Table, TableRow, Code, Plot, PlotAxis, PlotSeries, Tree, TreeEntry, Note, Edge, Tone, ThemeKey } from './types';
2
+ export type { Scene as SceneModel, SceneNode, Group, Item, Table, TableRow, Code, Plot, PlotAxis, PlotSeries, Tree, TreeEntry, Note, Tty, Edge, Tone, ThemeKey } from './types';