@graphlearning/graphl-flow 0.5.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
@@ -47,6 +47,10 @@ That period is the recorder's loop (`PULSE_S` in `@graphlearning/shell`'s record
47
47
  video has no jump at the join. `pulse: false` on a scene turns it off. `npm run capture` freezes the
48
48
  animation at t = 0, so stills are reproducible.
49
49
 
50
+ **`dashed: true`** draws a group's frame dashed — a boundary that is a PLACE, not a thing (an AWS
51
+ Region or Availability Zone, as AWS's own diagrams draw them). Only the line style changes, so
52
+ dashing a group never moves anything.
53
+
50
54
  **`spread: true`** on a group spaces its children evenly over its full height when the group is
51
55
  stretched taller than them (a short column beside a tall one).
52
56
 
@@ -68,13 +72,34 @@ column), not below it — an edge is routed in the gap between two siblings, nev
68
72
  `tag` draws a short pill before a row (`PK`, `FK`, `sp`); `tone` on a row tints it.
69
73
 
70
74
  **Code.** `code` takes the source as a (template-literal) string; its common indent is dropped.
71
- `lang` is `python | sql | scala | java | js | ts | shell | 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
72
76
  token colours per theme, sharing one keyword set (Java's primitive types, `record`, `sealed` and
73
77
  `switch` included); an `@Name` — a Java annotation, a Python decorator — draws as a keyword, and a
74
78
  number keeps its separators and suffix (`1_000_000L`). `show` keeps only those line ranges and folds
75
79
  each skipped run into `··· N lines`; `show` and `highlight` use the FILE's line numbers, and so do
76
80
  edges: `src.L17`.
77
- `terminal: true` draws a terminal — `$ ` lines are commands, `! ` lines errors, the rest output.
81
+ `terminal: true` draws a terminal — `$ ` lines are commands, `! ` lines errors, the rest output;
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`.
78
103
 
79
104
  **IDE frames.** Three columns: `tree` | (editor `code` over terminal `code`, in a `bare` group) |
80
105
  a SIDE PANE — a `bare` group with a fixed width `w`. The IDE alone is narrower than 16:9; the side
@@ -129,15 +154,16 @@ writes `captures/<id>-<theme>.png`.
129
154
 
130
155
  | Type | Fields |
131
156
  |---------|--------|
132
- | `item` | `id`, `title`, `sub?`, `icon?`, `bullets?`, `stack?`, `chip?`, `tone?`, `span?` |
133
- | `group` | `id`, `children`, `title?`, `sub?`, `icon?`, `badge?`, `dir?: 'row' \| 'col' \| 'grid'`, `cols?`, `bare?`, `spread?`, `cell?: number \| true`, `tone?`, `span?` |
157
+ | `item` | `id`, `title`, `muted?`, `sub?`, `icon?`, `bullets?`, `stack?`, `chip?`, `tone?`, `span?` |
158
+ | `group` | `id`, `children`, `title?`, `sub?`, `icon?`, `badge?`, `dir?: 'row' \| 'col' \| 'grid'`, `cols?`, `bare?`, `dashed?`, `muted?`, `spread?`, `cell?: number \| true`, `tone?`, `span?` |
134
159
  | `table` | `id`, `rows`, `columns?`, `title?`, `tone?`, `span?` — a row is `[cells…]` or `{ cells, id?, tag?, tone? }` |
135
- | `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 |
136
162
  | `plot` | `id`, `x`, `y` (axes: `min`, `max`, `step?`, `label?`, or `labels` for categories), `series`, `title?`, `axes?`, `grid?` |
137
163
  | `tree` | `id`, `entries` (`name`, `children?`, `folder?`, `state?: active \| new \| muted`, `note?`, `icon?`), `title?` |
138
164
  | `note` | `id`, `text`, `tone?` — a dashed callout of wrapping prose |
139
165
  | any node | `minW?`/`minH?` (floors), `maxW?`/`maxH?` (caps), `w?`/`h?` (exact), `fill?`, `span?`, `tone?`; groups also `bare?` |
140
- | `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?` |
141
167
  | `Scene` | `nodes`, `edges?`, `title?`, `sub?`, `dir?`, `pulse?` |
142
168
 
143
169
  **Layout.** A group lays its children out as `dir: 'col'` (default), `'row'` (one column per child)
@@ -155,15 +181,22 @@ Siblings in a row stretch to equal height.
155
181
 
156
182
  The theme (`dark` | `light`) picks the shade; repos cannot recolour.
157
183
 
158
- **Icons** share one key space across four sets; an unknown key draws no icon. Keys match
184
+ **Icons** share one key space across five sets; an unknown key draws no icon. Keys match
159
185
  `@graphlearning/flow`'s where both have the icon, so scenes port without renaming.
160
186
 
161
187
  | set | drawn in | keys |
162
188
  |---|---|---|
163
- | 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` |
164
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` |
165
- | AWS | its own tile | `apigateway athena aurora cloudformation cloudwatch dms dynamodb ec2 eks elasticache emr eventbridge firehose glue iam kinesis kms lakeformation lambda msk mwaa rds redshift s3 sagemaker secretsmanager sns sqs stepfunctions vpc` |
166
- | 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` |
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` |
192
+ | AWS group mark | its own tile (for a group's `icon`) | `account autoscaling privatesubnet publicsubnet region` |
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` |
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` |
195
+
196
+ **`muted: true`** draws an item greyed, or a group as a plain grey outline — a part the system does
197
+ not have yet, at its full size and place (paint only, so muting moves nothing; a muted group does not
198
+ dim its children). An architecture that grows course by course draws its
199
+ whole final shape from the start.
167
200
 
168
201
  **`chip: true`** draws an item as a small framed pill — a thing counted, not described (`Task 1`,
169
202
  `Local disk`); chips fill their grid cell, so a row of them lines up.
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;
@@ -8,11 +9,42 @@ type Row = {
8
9
  };
9
10
  /**
10
11
  * The lines a `code` node draws: every line, or only the `show` ranges with each skipped run
11
- * folded into one `··· N lines` row. Line numbers are the FILE's. Shared with the edge planner via
12
+ * folded into one `··· N lines` row — a terminal too (0.6: a long Terraform plan keeps its command,
13
+ * its resource line and its summary). Line numbers are the FILE's. Shared with the edge planner via
12
14
  * `codeLineIds`, so a line edges can address is a line that is drawn.
13
15
  */
14
16
  export declare function codeRows(node: Code): Row[];
15
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>;
16
48
  export declare function CodeView({ node, style }: {
17
49
  node: Code;
18
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' | '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/icons.d.ts CHANGED
@@ -11,6 +11,11 @@ export declare const AZURE: Record<string, ComponentType<{
11
11
  export declare const AWS: Record<string, ComponentType<{
12
12
  size?: number | string;
13
13
  }>>;
14
+ /** AWS RESOURCE icons: a single-colour glyph, no tile — the parts inside a service (a NAT gateway, a
15
+ * task, a queue), drawn smaller-looking than a service on purpose, as AWS's own diagrams do. */
16
+ export declare const AWS_RESOURCE: Record<string, ComponentType<{
17
+ size?: number | string;
18
+ }>>;
14
19
  /** Open-source / product marks (simple-icons), in the brand's colour unless it would vanish. */
15
20
  export declare const BRAND: Record<string, {
16
21
  title: 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';