@graphlearning/graphl-flow 0.6.0 → 0.7.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,26 @@ 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
+ A full-screen program is a **`tty`**: `screen` (its rows), `cols?` (80), `inverse?` and `bold?` runs
97
+ as `[row, from, to)` — a fixed grid, padded to `cols`, so two captures of `top` are the same box.
98
+ Its rows are `tty.R<n>`.
99
+
100
+ **Console frames (0.7).** Two columns, both FIXED: the console (or a `tty` in its slot, same `w`/`h`) |
101
+ the PICTURE of what it just showed — a `bare` group of the rest of 16:9. No edges between them; ring
102
+ the console line with `focus`. See `dev/fixtures/studies/console-frame.ts`.
83
103
 
84
104
  **IDE frames.** Three columns: `tree` | (editor `code` over terminal `code`, in a `bare` group) |
85
105
  a SIDE PANE — a `bare` group with a fixed width `w`. The IDE alone is narrower than 16:9; the side
@@ -137,12 +157,13 @@ writes `captures/<id>-<theme>.png`.
137
157
  | `item` | `id`, `title`, `muted?`, `sub?`, `icon?`, `bullets?`, `stack?`, `chip?`, `tone?`, `span?` |
138
158
  | `group` | `id`, `children`, `title?`, `sub?`, `icon?`, `badge?`, `dir?: 'row' \| 'col' \| 'grid'`, `cols?`, `bare?`, `dashed?`, `muted?`, `spread?`, `cell?: number \| true`, `tone?`, `span?` |
139
159
  | `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?` |
160
+ | `code` | `id`, `code`, `lang?`, `filename?`, `show?: [from, to][]`, `highlight?: number[]`, `terminal?`, `output?`, `console?`, `cols?`, `tone?`, `span?` |
161
+ | `tty` | `id`, `screen: string[]`, `title?`, `cols?`, `inverse?`, `bold?` (`[row, from, to][]`) — a full-screen program's grid |
141
162
  | `plot` | `id`, `x`, `y` (axes: `min`, `max`, `step?`, `label?`, or `labels` for categories), `series`, `title?`, `axes?`, `grid?` |
142
163
  | `tree` | `id`, `entries` (`name`, `children?`, `folder?`, `state?: active \| new \| muted`, `note?`, `icon?`), `title?` |
143
164
  | `note` | `id`, `text`, `tone?` — a dashed callout of wrapping prose |
144
165
  | 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?` |
166
+ | `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
167
  | `Scene` | `nodes`, `edges?`, `title?`, `sub?`, `dir?`, `pulse?` |
147
168
 
148
169
  **Layout.** A group lays its children out as `dir: 'col'` (default), `'row'` (one column per child)
@@ -165,12 +186,12 @@ The theme (`dark` | `light`) picks the shade; repos cannot recolour.
165
186
 
166
187
  | set | drawn in | keys |
167
188
  |---|---|---|
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` |
189
+ | 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
190
  | 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
191
  | 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
192
  | AWS group mark | its own tile (for a group's `icon`) | `account autoscaling privatesubnet publicsubnet region` |
172
193
  | 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` |
194
+ | 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
195
 
175
196
  **`muted: true`** draws an item greyed, or a group as a plain grey outline — a part the system does
176
197
  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,36 @@ type Row = {
14
15
  */
15
16
  export declare function codeRows(node: Code): Row[];
16
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 {
20
+ user: string;
21
+ host: string;
22
+ cwd: string;
23
+ sigil: string;
24
+ style: 'debian' | 'redhat' | 'zsh';
25
+ cmd: string;
26
+ }
27
+ export declare function parsePrompt(row: string): Prompt | null;
28
+ type ConsoleRow = {
29
+ n: number;
30
+ kind: 'cmd';
31
+ prompt: Prompt;
32
+ toks: Tok[];
33
+ } | {
34
+ n: number;
35
+ kind: 'cont';
36
+ toks: Tok[];
37
+ } | {
38
+ n: number;
39
+ kind: 'out';
40
+ text: string;
41
+ };
42
+ /**
43
+ * 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.
46
+ */
47
+ export declare function consoleRows(lines: string[], cols: number): Map<number, ConsoleRow>;
17
48
  export declare function CodeView({ node, style }: {
18
49
  node: Code;
19
50
  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,7 @@ 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
8
  /** Drop a leading/trailing blank line and the common indent, so scenes can use indented template literals. */
9
9
  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';