# UJN language UJN 0.1 draft · revision 23 · November 29, 2026 UJN (UI Journey Notation) writes a UI journey as text: the screens a user sees, what the system does between them, where the user leaves the app and comes back, and how the journey ends. A journey file is a PlantUML diagram that runs from `@startujn` to `@endujn` and holds one journey, one statement per line: the journey line, the nodes and the arrows between them, and blocks that set display ids, colors and the drawing. A PlantUML module reads the file and gives up to three outputs: a **drawing** of the journey, as SVG or PNG; **warnings** for the rules the journey breaks, listed under the drawing; and, when PlantUML runs with `--ujn-model`, a **model**, a JSON file with every node and arrow and its meaning worked out, for tools to read. ## About this spec **Who it is for.** People who write or read journeys, people who build tools that read or write UJN, and AI assistants that write journeys or answer questions about them. It defines the whole language: every statement, key, default and warning. **What it is not.** It is not a tutorial. It states each rule in full where it belongs and does not teach step by step; the primer is the short introduction. It is not a PlantUML manual either. Where UJN relies on PlantUML, as for the preprocessor and the output formats, PlantUML works as it does for its other diagrams. **Which text wins.** Where two texts disagree, this spec's prose wins. Next come the grammar summary in section 22, then the model schema, version 5 (`ujn-model-v5.schema.json`), then the primer and the examples. **Two terms.** "The module" is the PlantUML module that draws UJN, checks it and writes the model. "The platform" is the wider AI development platform UJN is part of. **How it is organized.** - **Sections 1 to 10**, the file and the statement: a complete example at a glance, the file layout, the journey line, the node statement, values, display ids, unique ids, flags, the attributes any node may carry, and colors. - **Sections 11 to 18**, the kinds of node, with arrows in section 13: view (11), actor and system (12), action (14), handoff (15), data (16), start and end (17), and journey reference (18). Each of these sections has the same subsections, as far as they apply: the statement, the types, the attributes, the rules for that kind, what is drawn where, examples, and what goes into the model. - **Sections 19 and 20**, the drawing and the model: the `render` block and what it switches, the palette, the legend and the warnings box, then the model JSON in full. - **Section 21**, errors and warnings, all in one table. - **Section 22**, a summary of the grammar. - **Section 23**, the questions still open. - **Appendix A**, how the drawing is laid out: how the module places what direction hints ask for (13.3), routes arrows and places their labels (13.10), and spaces the text along an arrow (19.8). It is part of the spec: its rules bind the module as they did in those sections. **A draft.** UJN 0.1 is a draft. Names, keys and rules may still change; section 23 lists the questions still open. **This revision.** Revision 23 is editorial: no rule, key, value, default, type, warning, grammar line or example changes. It changes wording only, and moves the module's layout detail into Appendix A. Its changes, and those of the earlier revisions, are listed in the changes file, "UJN language: changes". --- ## 1. At a glance ``` @startujn !include theme.puml journey AUTH "Authentication" description: "Login, registration, recovery, SMS and email links, MFA" context: "Customer · Web" unique_id_friendly: auth increment { auto view_prefix: "AUTH" view_delimiter: "-" view_start: 2 view_digits: 3 ' 001 instead of 1 } view_color { color_frame: #887788 color_icon: #887788 color_title: #000000 color_description: #070707 } ' a modal sets only these; frame, description and background come from view_color view_color_modal { color_icon: #5b3d8f color_title: #000000 } actor customer [ACT-001] { title: "Customer" role: Policyholder } ' an explicit display id can be anything view login [AUTH-10] { type: plain title: "Login" flags: [legacy] description: "Email and password\nor a passkey" route: /login trace: [req:AUTH-01, test:e2e/login.spec.ts] color_frame: #5555d0 unique_id: 6f2f4d29ca5 ' AUTO GENERATED - DO NOT CHANGE } ' gets AUTH-002 view forgot_login { title: "Forgot password" description: "Enter your email" route: /forgot unique_id: {{auto}} ' run java -jar plantuml.jar -populate_ids auth.puml } ' gets AUTH-003 view bad_login { type: toast title: "Incorrect credentials" description: "Try again" } ' gets AUTH-004 view passkey { title: "Passkey prompt" flags: [future, idea] route: /login/passkey } ' gets AUTH-005, drawn with its handle as the title view register ' gets AUTH-006 view sms ' arrows: section 13 login --> forgot_login : [Forgot password] login --> passkey : [Use passkey] bad_login ..> login @endujn ``` Every node statement has the same shape: ``` keyword handle [DISPLAY-ID] ← the header line; only keyword and handle are required { ← may also end the header line type: … ← the type menu; the keyword's default when left out title: "…" ← shown title; the handle when left out flags: [ … ] description: "…" … ← everything else: meta, behavior, trace, ids, colors } ``` The block is optional. `view register` alone declares a plain view titled "register". --- ## 2. File layout - A UJN diagram runs from **`@startujn`** to **`@endujn`**. It is its own PlantUML diagram type, like `@startchen` or `@startmindmap`. - **One journey per diagram.** The journey line (section 3) comes before every node and arrow. Only preprocessor lines, `increment`, color blocks and `render` may come before it, so a shared file of settings can be included first. Other journeys are referenced by id and never drawn here. - **One statement per line.** A block `{ … }` may run over several lines. Blank lines and indentation are free. - **The opening brace** ends the header line (`view login {`) or stands alone on the next line. PlantUML already accepts both for its own blocks. - **Comments:** - a line whose first non-blank character is `'`; - a block between `/'` and `'/`, which may also sit inside or at the end of a line; - a **trailing comment**: a `'` outside double quotes, after a space or a tab, runs to the end of the line (`view_digits: 3 ' 001 instead of 1`). Text that holds an apostrophe must therefore be quoted: `title: "Customer's claims"`. PlantUML itself removes only the first two kinds; the UJN statements remove trailing comments themselves. - **The PlantUML preprocessor works as everywhere.** `!include theme.puml` brings in shared color blocks (section 10), and a shared file can declare the actors and systems every journey uses. Python lines and `!python` blocks work too, with one limit: a `unique_id: {{auto}}` that a loop or a macro produces cannot be filled by `-populate_ids` (section 7). - **Keywords are lowercase.** Sections 1 to 12 define `journey`, `increment`, `view`, `actor` and `system`, and the color blocks `view_color`, `actor_color` and `system_color` (with a type suffix: `view_color_modal`); section 13.9 adds `arrow_color`. Sections 14 and 15 add `action` and `handoff`, with `action_color` and `handoff_color`. Sections 16 to 18 add `data`, `start`, `end` and `ref`, with `data_color`, `start_color`, `end_color` and `ref_color`. Section 19 adds `render`. - **Order does not matter** for nodes, arrows, `increment` and color blocks: references and display ids are worked out after the whole diagram is read. An arrow to a handle that no statement declares is an error; a node is never created implicitly, because it needs a shape. --- ## 3. The journey line ``` journey "" <key>: <value> <key>: <value> ``` ``` journey AUTH "Authentication" description: "Login, registration, recovery, SMS and email links, MFA" context: "Customer · Web" trace: [req:EPIC-AUTH] unique_id: 3c90e1d5a7b ' AUTO GENERATED - DO NOT CHANGE unique_id_friendly: auth ``` - The **journey id** is required and always written by the designer, never assigned: other journeys and the tools that read the model refer to it. A short name in capitals: `AUTH`, `CLAIM`. (The sample journeys use the longer form `JRN-AUTH`; both are valid.) - The **title** is required, in double quotes; the renderer uses it as the diagram's title. - **Journey entries** are `key: value` lines **directly under the journey line**, before any other statement. The same line further down would read as if it belonged to the node above it, so it is an error there. - Journey keys: the common attributes `description`, `context`, `trace`, `a11y` (section 9), and `unique_id` and `unique_id_friendly` (section 7). Here `unique_id_friendly` is the namespace for the friendly ids of the journey's nodes. --- ## 4. The node statement ### 4.1 Header line ``` <keyword> <handle> [<DISPLAY-ID>] ``` ### 4.2 Handle The name a node is known by inside the diagram: arrows and `parent:` use it. - Letters, digits and `_`, starting with a letter: `login`, `forgot_login`, `step2`. - Case-sensitive, unique within the journey across every kind of node. - Not a keyword (`view`, `actor`, `system`, `journey`, `increment`, or a reserved word). - Not drawn, except as the title when the block has no `title`. It becomes `key` in the model, and the default name in the node's friendly id (section 7.4). - A handle may be renamed freely: arrows in the same file follow it, and links from other files use `unique_id`, which does not change. ### 4.3 Display id - Optional, in square brackets after the handle: `[AUTH-10]`. - **Anything except `]`**: the designer chooses it. Unique within the journey. - Drawn in a tab under the node's bottom edge, or on its type line (4.6). Nothing else: **a display id is for viewing only**. It may change, and nothing should link to it. - A node without one gets an assigned display id when `increment` has `auto` (section 6), and no id tab otherwise. ### 4.4 Block ``` view forgot_login { title: "Forgot password"; route: /forgot } ``` is the same statement as ``` view forgot_login { title: "Forgot password" route: /forgot } ``` - It opens with `{` at the end of the header line or alone on the next line, and closes with `}`. - Entries are `key: value`, one per line, or separated by `;` on one line. - The key ends at the first colon, so values may hold colons (`route: /policy/:id`, `trace: [req:AUTH-01]`). - **A key on its own means `true`**: `collapsed` is `collapsed: true`. - Keys are lowercase letters, digits and `_`: `route`, `a11y`, `color_frame`, `unique_id`. - A key that is not defined for this keyword or type is a warning. Its value is kept in the model under `extra`, so tools can try out a field before the language adopts it. ### 4.5 Keys every node takes | Key | Value | Default | Section | |---|---|---|---| | `type` | a type of this keyword | `plain` for a view and a start, `internal` for a system, `action` for an action, `returns` for a handoff, `server-database` for a store, `success` for an end; an actor and a reference have none | 11.2, 12.1, 14.2, 15.2, 16.2, 17.2 | | `title` | text | the handle | below | | `flags` | list of flags | none | 8 | | `description`, `trace`, `a11y`, `context` | | | 9 | | `unique_id`, `unique_id_friendly` | | | 7 | | `color_frame`, `color_icon`, `color_title`, `color_description`, `color_background` | color | the color blocks, then the theme | 10 | | `id_position` | `outside`, `inside`, `inside-top`, `inside-bottom`, `hidden` | the `render` block's, else `outside` | 4.6 | | `tooltip` | text | none | 9.3 | **Title.** The name drawn in the node's body. `\n` breaks the line, and the renderer breaks lines only where `\n` is written; the node grows to fit. It takes the same markup as a description (section 9.1). **Type.** Lowercase, with hyphens for two words (`new-window`). The type changes the icon and the type name in the drawing, never the frame. For a view it also sets default behavior that one view may override (section 11.4). An unknown type is a warning, and the node is drawn with its default type. ### 4.6 Where the display id is drawn | `id_position` | Drawn | |---|---| | `outside` | In a tab under the bottom edge, right-aligned. The default | | `inside`, `inside-top` | On a badge at the right of the type line ("View", "Action", "End, failure"), left of any flag tabs | | `inside-bottom` | On a badge at the right of the last line: after the route or meta line (`/login`, `SMS · 5 min`, `table users`, a reference's journey id), or after a start's or an end's description. A node with no such line gets a row for it | | `hidden` | Not drawn. The node still has its display id | ``` render { id_position: inside } view login [AUTH-10] { title: "Login" } ' inside, from the render block system idp [SYS-1] { title: "Identity provider"; id_position: outside } ' in a tab under it view forgot [AUTH-11] { title: "Forgot password"; route: /forgot; id_position: inside-bottom } ' after the route end locked [END-1] { type: failure; id_position: hidden } ' not drawn ``` - `id_position` goes in the `render` block for every node (19.1), or on one node; the node's own wins. - Outside or inside, the id is dark bold text on the node's light tint, outlined in the node's frame color (19.3), so it stands out from the node's own text and its outline follows a `color_frame`. On a view's title bar, which already has that tint, the chip is white. In black and white it is near-black on light gray (19.4). - `inside` and `inside-top` are the same. The type line has the most room and an id there never makes the node taller; `inside-bottom` keeps the type line clear and puts the id beside the route, but a node with no route, meta line or description gets a row for it. - A fork or join bar has no type line, so any inside value draws its id where `outside` does, past the bar's far end (14.2). - An id drawn inside, or not drawn, hangs nothing under the node: arrows may meet the whole of that side (13.10). - As in the `render` block, quotes and case do not matter: `id_position: "Inside"` is `inside`. - A value other than these five is a warning: a node then uses the `render` block's, and the `render` block uses `outside`. - `id_position` is a drawing setting, like `point` (18.2): the model leaves it out (section 20). --- ## 5. Values | Kind | Written as | Examples | |---|---|---| | Text | bare to the end of the entry, trimmed; in double quotes when it holds `;`, `}`, `'`, a `,` inside a list, or should keep leading or trailing spaces. In quotes, `\"` is a quote; every other backslash reads as in any PlantUML label: `\n` is a line break, `\\` a backslash, `\t` a tab | `Email and password`, `"Step 2; documents"`, `"Line one\nline two"` | | List | `[` items separated by commas `]`; quote an item that holds a comma. For one item the brackets may be left out | `[escape, close]`, `[legacy]`, `legacy` | | True or false | `true` or `false`, in any case; a key on its own means `true` | `blocks: false`, `collapsed` | | Number | digits | `view_start: 2` | | Duration | a number and a unit: `ms`, `s`, `min`, `h`, `d`; the space is optional | `5 s`, `30 min`, `24h` | | Color | `#` and 3, 6 or 8 hex digits, or a PlantUML color name; any other name is a warning | `#887788`, `#fff`, `LightBlue` | | Handle | a handle declared in the journey | `parent: new_claim` | | Trace link | `kind:reference` | `req:AUTH-01`, `component:LoginForm` | | Placeholder | `{{auto}}`, for `unique_id` only | `unique_id: {{auto}}` | **A key written twice.** For a list key (`trace`, `a11y`) the values add up. For any other key the last one wins, with a warning. --- ## 6. Display ids: `increment` ``` increment { auto view_prefix: "AUTH" view_delimiter: "-" view_start: 2 view_digits: 3 ' 001 instead of 1 } ``` - **`auto`** turns assignment on. Without it, or without an `increment` block, a node with no `[ID]` has no display id and no id tab. - With `auto`, every node written without `[ID]` gets **prefix + delimiter + counter**, the counter padded with zeros to `digits`. - The other keys are per kind: `<kind>_prefix`, `<kind>_delimiter`, `<kind>_start`, `<kind>_digits`, where kind is `view`, `actor`, `system`, `action`, `handoff`, `data`, `start`, `end` or `ref`. | Key | Default | |---|---| | `<kind>_prefix` | `VIEW`, `ACT`, `SYS`, `ACTN`, `HND`, `DAT`, `START`, `END`, `REF` | | `<kind>_delimiter` | `-` | | `<kind>_start` | `1` | | `<kind>_digits` | `3` | **How the counter runs.** - One counter per prefix, in the order the statements appear. Kinds that share a prefix share the counter, so their ids never collide; give them the same start (different starts are a warning). - It skips every number an explicit id already takes: an explicit id that reads as prefix, delimiter and a number takes that number, whatever its padding. With the block above, `[AUTH-10]` takes 10, so the counter never gives out AUTH-010. **Display ids move, and that is fine.** An assigned display id depends on the node's position: insert a view above it and it is renumbered. `-populate_ids` never writes display ids into the file (section 7), and nothing links to them; links use `unique_id`. At most one `increment` block per journey. A second one is a warning, and its entries are added to the first. --- ## 7. Unique ids A **unique id** is a node's permanent identity: 11 random lowercase hex digits such as `6f2f4d29ca5`. It does not depend on anything people edit (the handle, the title, the display id, the position), so it is what tests, code, requirements and other diagrams link to. ### 7.1 Writing one Before: ``` unique_id: {{auto}} ' run java -jar plantuml.jar -populate_ids auth.puml ``` After `-populate_ids`: ``` unique_id: 6f2f4d29ca5 ' AUTO GENERATED - DO NOT CHANGE ``` - The designer writes the placeholder **`{{auto}}`**. `-populate_ids` replaces it with a new random id, once, and from then on the id never changes. - **The rule: every `{{auto}}` is populated before the file's first commit.** - The hint comment on the `{{auto}}` line is optional: the warning prints the same command with the real path (7.2). A literal `{{this_file}}` in that comment is only text. - `unique_id` may be written on any node and on the journey (section 3). - A node without `unique_id` is allowed, so a quick sketch stays short. A node with trace links but no `unique_id` gets a warning: other files cannot link back to it. ### 7.2 Rendering without `-populate_ids` The node is drawn normally, the model marks its unique id as pending (`"uniqueId": null`, `"uniqueIdPending": true`), and a warning names the command: ``` forgot_login: unique_id is still {{auto}}. Generate it before your first commit: java -jar plantuml.jar -populate_ids src/journeys/auth.puml ``` ### 7.3 Rendering with `-populate_ids` ``` java -jar plantuml.jar -populate_ids auth.puml ``` - **Only for a file rendered locally.** With `-pipe`, on the PlantUML server, or for any source that is not a file, the flag is an error and nothing is written. - Each `{{auto}}` is replaced in **the file and line it came from**. PlantUML keeps the file and line of every line it reads, so a placeholder in an `!include`d file is filled in that file. - On that line, the value becomes the new id and **the trailing comment becomes `' AUTO GENERATED - DO NOT CHANGE`**, replacing any comment that was there. The indentation and the column where the comment starts stay as they were. - **Nothing else in the file changes**: other lines, line endings and encoding stay as they were. Display ids are never written. - A `{{auto}}` that a `!python` loop or a macro produced has no single spot to write back to: that is an error, asking for the id to be written in literally. - After writing, the diagram is drawn as usual. - `-populate_ids` is a new command-line flag, added next to `-pipe` and `-tsvg` in the module's copy of PlantUML (`cli/CliFlag.java`). **Before the first commit.** The viewer can only warn. A git pre-commit hook can enforce the rule by refusing staged `.puml` files that still contain `{{auto}}`, with the same message; it belongs in the repository that holds the diagrams. ### 7.4 Friendly ids A **friendly id** is a readable name for a node across files: the journey's namespace, a period, and the node's name. | Where | Key | Default | |---|---|---| | journey entry | `unique_id_friendly` = the namespace | the journey id in lowercase (`auth`) | | node block | `unique_id_friendly` = the node's name | the handle | ``` journey AUTH "Authentication" unique_id_friendly: auth view forgot_login { unique_id_friendly: forgot_password ' auth.forgot_password instead of auth.forgot_login } ``` - Letters, digits and `_`, like a handle. Unique within the journey. - Write the node key only to keep a friendly id when the handle is renamed, or to choose a different one. - A friendly id is for people to read; it changes whenever someone edits it. A link that must survive edits uses the unique id. ### 7.5 Checks | Problem | Result | |---|---| | Two nodes with the same `unique_id` (usually a pasted block) | syntax error | | Two nodes with the same friendly id | syntax error | | A `unique_id` that is neither `{{auto}}` nor 11 lowercase hex digits | warning | | `{{auto}}` still in the file | warning with the command (7.2) | "DO NOT CHANGE" cannot be checked from one file: the parser cannot see what the id used to be. The guard is a check across files, later: a test, code comment or requirement that links to a unique id no diagram declares is reported as a broken link. --- ## 8. Flags ``` flags: [future, idea] ``` Eleven flags, in the `flags` list of a node's block. A flag never changes a shape: the node keeps its frame, its border goes dotted, and the flag's glyph sits in a tab inside the right edge (filled = set here, outlined = inherited). - Several are allowed, in any order. A flag written twice is a warning. - Only flags **set here** are written. Inherited flags are worked out by the module, never written; writing one sets it on that node. - An unknown flag is a warning and is ignored. **Delivery flags** say where a part of the journey stands. They **propagate**: everything reachable only through the flagged node inherits the flag. | Flag | Meaning | |---|---| | `idea` | A concept to consider, not approved | | `future` | Planned for a later release | | `not-implemented` | Defined but absent from the product today | | `out-of-scope` | Explicitly excluded | | `deprecated` | Existing behavior being retired | **Review flags** ask for attention. They **stay where they are set**. | Flag | Meaning | |---|---| | `experiment` | An A/B test or pilot | | `risk` | A known issue or dependency | | `security` | Needs a security control or review | | `needs-decision` | An open product question | | `needs-updates` | Exists, but its design or code is out of date | **Pending** | Flag | Meaning | |---|---| | `legacy` | Old but staying, as opposed to deprecated, which is being retired. Whether it propagates is still open; the proposal is that it stays where it is set. See 23.3 and 23.4. | `legacy` and `needs-updates` have no glyph yet. They will be designed in the shape set before the renderer draws them. See 23.3 and 23.4. --- ## 9. Attributes any node may carry Every node and the journey accept these four. `description` is drawn; the other three live only in the model. | Key | Value | Drawn | Meaning | |---|---|---|---| | `description` | text | in the body, under the title | A short line or two about the node | | `trace` | list of trace links | no | What this node implements or is tested by | | `a11y` | text; repeatable | no | An accessibility note for the implementer: focus order, announcements, labels | | `context` | text | no | Background for the implementer: who uses it, business rules, why it exists | ### 9.1 Markup in titles and descriptions Titles and descriptions take PlantUML's own text markup, which the renderer already draws: | Markup | Gives | |---|---| | `\n` | a line break (the only place a line breaks) | | `<b>…</b>`, `**…**` | bold | | `<i>…</i>`, `//…//` | italic | | `<u>…</u>`, `__…__` | underline | | `<s>…</s>`, `--…--` | strike-through | | `<color:#c00>…</color>` | a color | | `<size:10>…</size>` | a size | It is not full HTML: no `<div>`, `<p>` or links. The model keeps the text as written, markup included. ### 9.2 Trace links The thread from requirement to code: Requirement → Journey → View → Component → Test → Code. Each link is `kind:reference`. | Kind | Points at | Example | |---|---|---| | `req` | a requirement or epic | `req:AUTH-01` | | `story` | a user story or ticket | `story:B2B-1432` | | `design` | a design file or frame | `design:figma/login-v3` | | `component` | a UI component | `component:LoginForm` | | `test` | a test case or file | `test:e2e/login.spec.ts` | | `code` | a source file or module | `code:src/auth/login.tsx` | | `doc` | a document | `doc:confluence/AUTH` | Other kinds are accepted and passed on to the tools that read the model; the validator may warn about kinds it does not know. Trace links point **out** of the diagram; links from other files **into** it use the unique id (section 7). ``` view login [AUTH-10] { title: "Login" trace: [req:AUTH-01, component:LoginForm, test:e2e/login.spec.ts] a11y: "Focus starts in the email field" a11y: "Errors are announced with role=alert" context: "Most traffic comes from the mobile app's web view" unique_id: 6f2f4d29ca5 ' AUTO GENERATED - DO NOT CHANGE } ``` --- ### 9.3 Hover text In an SVG drawing, resting the pointer on a node or an arrow shows what it is, then what the drawing shortens or leaves out: | On | Shown | |---|---| | A node | Its title and type; its `tooltip`; its whole description; its route, role, host, channel, timeout, resume, location or journey, spelled out; its context; its flags and inherited flags, each with what it means; its trace links; its accessibility notes; its display id and unique id | | An arrow | Its trigger and guard; its kind, its role when it is not an exit, and the nodes it joins; its `tooltip`; its payload; `returns`; its context, flags, trace links and accessibility notes | ``` view login [AUTH-10] { title: "Login" route: /login tooltip: "The only way in for customers" } action validate { title: "Validate credentials" } login --> validate : [Sign in] { tooltip: "Sends the form over TLS" } ``` - `tooltip` is text, on any node or arrow. It comes first, after the line that says what it is. - Titles, descriptions, triggers, guards, payloads and return labels, which the drawing reads as creole, show the words the drawing shows: `**Save**` shows as Save, `<U+00E9>` as é, and `price < 10` stays. A table, a tree or code shows as written. Every other key, `tooltip` included, shows as written, its backslashes read as in a label (`\n` starts a new line); so does the title of a start, an end or a bar, which the drawing leaves out. - An id that `id_position: hidden` keeps out of the drawing still shows on hover. - PNG has no hover; open the SVG in a browser. Other formats ignore it. - `tooltip` is part of the model (20.4, 20.5); the rest of the hover text is worked out from the other keys. ## 10. Colors Colors are presentation only. They never carry meaning: flags are glyphs and a dotted border, and every diagram must read in black and white (section 19.4). ### 10.1 On a node | Key | Colors | |---|---| | `color_frame` | the outline | | `color_icon` | the type icon | | `color_title` | the title | | `color_description` | the description | | `color_background` | the fill | ### 10.2 Defaults blocks ``` view_color { color_frame: #887788 color_icon: #887788 color_title: #000000 color_description: #070707 } view_color_modal { color_icon: #5b3d8f } ``` - `<kind>_color` sets the defaults for every node of a kind: `view_color`, `actor_color`, `system_color`, `action_color`, `handoff_color`, `data_color`, `start_color`, `end_color`, `ref_color`. - `<kind>_color_<type>` sets them for one type: `view_color_modal`, `view_color_toast`, `system_color_external`. - Both take only `color_*` keys. ### 10.3 The cascade For each part, the first color found wins: 1. the node's own `color_*` key; 2. its type's block (`view_color_modal`); 3. its kind's block (`view_color`); 4. the palette (section 19.3). A plain view therefore takes from `view_color`, never from `view_color_modal`. A `view_color_plain` block is allowed when plain views should differ from the other types. ### 10.4 Themes A theme is an ordinary file of color blocks, brought in with PlantUML's `!include theme.puml`. A journey's own blocks, written after the include, add to it, and for the same key the later one wins. --- ## 11. View Anything the user sees as a window: a page, a modal, a drawer, a popover, a toast, a set of tabs, a wizard, embedded content, a new browser window, a waiting state. Every view is its own node; a modal is not drawn inside the page that opens it but linked to it by an arrow in and a return out. ### 11.1 Statement ``` view <handle> [<DISPLAY-ID>] [{ block }] ``` ### 11.2 Types | Type | Type name drawn | What it is | |---|---|---| | `plain` (default) | View | A screen of its own, usually with a route | | `modal` | Modal | A dialog that blocks the view that opened it until closed | | `drawer` | Drawer | A panel attached to an edge; the view behind stays live | | `popover` | Popover | A small panel anchored to a control; closes on a click outside | | `toast` | Toast | A transient message; no interaction | | `tabs` | Tabs | A view whose children are shown one at a time, each tab its own view | | `wizard` | Wizard | A view whose children are shown in order, each step its own view | | `embedded` | Embedded | Third-party content inside the app, sandboxed (a payment widget, a map) | | `new-window` | New window | Opens in a separate browser tab or window | | `waiting` | Waiting | A loading state; the user waits while the system works | The name of the default type, `plain` or `normal`, is still open. See 23.6. ### 11.3 View attributes On top of the keys every node takes (section 4.5): | Key | Value | Drawn | Meaning | |---|---|---|---| | `route` | text | the meta line, bottom left, monospace | The URL path or full URL; `:name` marks a parameter (`/policy/:id`) | | `collapsed` | true or false | a chevron in the title bar | The content stays hidden until the user opens it (an accordion section); any type | | `parent` | handle of a view | no | The view this one belongs to: a step to its wizard, a tab to its tabs view, or an overlay to the one view it always opens over | | `blocks`, `dismiss`, `focus`, `duration`, `target` | see 11.4 | no | Behavior overrides | **Children of tabs and wizards.** Each tab or step is a view of its own, linked by arrows in order. Nothing is drawn inside anything. `parent:` records which wizard or tabs view a step belongs to, so the tools that read the model know how to group them: ``` view new_claim [CLAIM-007] { type: wizard; title: "New claim"; description: "3 steps"; route: /claims/new } view details [CLAIM-050] { title: "Details"; description: "Step 1"; parent: new_claim } view documents [CLAIM-051] { title: "Documents"; description: "Step 2"; parent: new_claim } view review [CLAIM-052] { title: "Review"; description: "Step 3"; parent: new_claim } ' arrows: section 13 new_claim --> details : [Start] details --> documents : [Next] documents --> review : [Next] ``` ### 11.4 Type behavior and overrides A type is a bundle of behavior that the platform implements: every modal blocks the view under it, traps focus, and closes on Escape. One view may override part of its bundle with a key in its block. | Key | Values | Meaning | |---|---|---| | `blocks` | true, false | While it is open, the view underneath cannot be used | | `dismiss` | list of `escape`, `outside`, `close`, `timeout`, or `none` | How the user can close it without taking an exit: the Escape key, a click outside, a close button, by itself after `duration` | | `focus` | `trap`, `move`, `stay` | trap: focus moves in and cannot leave until it closes. move: focus moves to the start of the view. stay: focus stays where it was | | `duration` | duration | How long it stays before it closes by itself | | `target` | `tab`, `window` | Where a new window opens | The defaults per type (a dash means the key does not apply, and writing it is a warning): | Type | `blocks` | `dismiss` | `focus` | `duration` | `target` | |---|---|---|---|---|---| | `plain` | – | – | move | – | – | | `modal` | true | escape, close | trap | – | – | | `drawer` | false | escape, close | move | – | – | | `popover` | false | escape, outside | move | – | – | | `toast` | false | timeout | stay | 5 s | – | | `tabs` | – | – | move | – | – | | `wizard` | – | – | move | – | – | | `embedded` | – | – | move | – | – | | `new-window` | – | – | move | – | tab | | `waiting` | – | – | stay | – | – | Plain, tabs, wizard, embedded and waiting are left only by an exit, so `blocks` and `dismiss` do not apply to them. A wait's time limit belongs to the action the user is waiting for (section 14.3), not to the view. **Overrides in use:** ``` ' this drawer locks the list behind it view filters { type: drawer; title: "Filters"; blocks } ' no Escape and no close button: the user must choose an exit view confirm_pay { type: modal; title: "Confirm payment"; dismiss: [none] } view saved { type: toast; title: "Saved"; duration: 3 s } view help { type: new-window; title: "Help center"; target: window; route: https://help.example.com } ``` In the model, a view carries its effective behavior (the defaults merged with the overrides) and the list of keys that were overridden, so a generator never needs the defaults table. ### 11.5 What is drawn where | Part of the frame | From | |---|---| | Title bar: the type icon in its cell, the type name, a chevron when collapsed | `type`, `collapsed` | | Body: the title, then the description | `title` (or the handle), `description` | | Meta line, bottom left, monospace | `route` | | Flag tabs, inside the right edge under the title bar | `flags`, plus the inherited ones | | Id tab, under the bottom edge, right-aligned | `[DISPLAY-ID]` or the assigned display id; none without either | | Dotted border | any flag, set or inherited | | Colors | `color_*` keys and the cascade (section 10) | ### 11.6 Examples ``` view login [VIEW-001] { title: "Login"; description: "Email and password"; route: /login } view dashboard [VIEW-002] { title: "Dashboard"; description: "Signed-in home"; route: /home } view delete_claim [VIEW-041] { type: modal title: "Delete claim" flags: [risk] description: "Cannot be undone" unique_id: a41c09e7b2d ' AUTO GENERATED - DO NOT CHANGE } view deleted [VIEW-042] { type: toast; title: "Claim deleted"; description: "Closes after 5 s" } view account { type: tabs; title: "Account"; description: "Overview · Claims · Settings"; route: /account } view card { type: embedded title: "Card payment" flags: [security, experiment] description: "Stripe Elements" color_background: #f4f8ff } view signing_in { type: waiting; title: "Signing in"; description: "Checking credentials…" } view advanced { title: "Advanced options"; collapsed } view intake_v2 { type: wizard; title: "Claim intake v2"; flags: [future, needs-decision]; description: "Guided, 4 steps" } view register ``` ### 11.7 In the model ```json { "key": "delete_claim", "kind": "view", "type": "modal", "title": "Delete claim", "id": "VIEW-041", "idAssigned": false, "uniqueId": "a41c09e7b2d", "uniqueIdPending": false, "friendlyId": "claim.delete_claim", "flags": ["risk"], "inherited": [], "description": "Cannot be undone", "route": null, "collapsed": false, "parent": null, "behavior": { "blocks": true, "dismiss": ["escape", "close"], "focus": "trap" }, "overrides": [], "trace": [], "a11y": [], "context": null, "style": { "frame": "#887788", "icon": "#5b3d8f", "title": "#000000", "description": "#070707" } } ``` - `id` is the display id, assigned or written; `idAssigned` says which. It may change between versions of the file. - `uniqueId` is `null` with `uniqueIdPending: true` while the file still says `{{auto}}`, and `null` with `uniqueIdPending: false` for a node without `unique_id`. - `style` holds the colors the text sets for the node after the cascade (node, type block, kind block). Colors left to the theme are not listed. The model schema, version 5 (`ujn-model-v5.schema.json`), uses the names above. --- ## 12. Actor and System Who or what the flow talks to. An **actor** is a person: the customer who starts a journey, or an agent inline in the flow doing a manual task. A **system** is a service inside the solution; an **external** system is a third party the flow calls while the user stays in the app. When the user is sent to the third party's own pages, that is a handoff (section 15), not a system. Both are drawn with the participant frame: a box with its four corners cut and a filled band down its left side, so a participant is never mistaken for a step. ### 12.1 Statements ``` actor <handle> [<DISPLAY-ID>] [{ block }] system <handle> [<DISPLAY-ID>] [{ block }] ``` | Statement | Type name drawn | Icon | Default prefix | |---|---|---|---| | `actor` | Actor | a person | ACT | | `system`, or `system` with `type: internal` | System | a server | SYS | | `system` with `type: external` | System, external | a cloud | SYS | An actor has no type menu, so `type` on an actor is a warning. A system's type is `internal` (the default) or `external`. ### 12.2 Attributes On top of the keys every node takes (section 4.5): | Key | On | Value | Drawn | Meaning | |---|---|---|---|---| | `role` | actor | text | the meta line | The person's role: `Policyholder`, `Back office`, `Senior adjuster` | | `host` | system | text | the meta line | Where the service lives: `identity.internal`, `api.pay.example` | `role` on a system or `host` on an actor is a warning. ### 12.3 How actors and systems take part Section 13.5 gives the exit rules; in short: - **The actor who starts a journey** points at the journey's start node (section 17.4), with no trigger. There are no swimlanes: the actor is a node like any other. - **An actor inline in the flow** is a manual task: an arrow comes in, and the person picks one outcome. Each arrow out carries that outcome as its label (`[Approve]`, `[Reject]`), the way a view's exits carry a trigger. UJN has no decision diamond, so this is how a person's decision is drawn. - **A system** is called by an action (section 14.5), with the payload on the arrow. The user stays in the app. ### 12.4 What is drawn where | Part of the frame | From | |---|---| | Top left, inside the band: the icon white in a filled circle, the type name | `actor` or `system` and its `type` | | Body: the title, then the description | `title` (or the handle), `description` | | Meta line, bottom left, monospace | `role` or `host` | | Flag tabs, inside the right edge, from under the top-right cut | `flags`, plus the inherited ones | | Id tab, on the straight part of the bottom edge | `[DISPLAY-ID]` or the assigned display id | | Dotted outline, over the band too | any flag, set or inherited | | Colors | `color_*` keys, `actor_color`, `system_color`, `system_color_<type>` | ### 12.5 Examples ``` actor customer [ACT-001] { title: "Customer"; role: Policyholder } actor agent [ACT-002] { title: "Claims agent"; role: Back office; description: "Reviews claims over 10k" } actor senior { title: "Senior adjuster"; flags: [needs-decision]; description: "Who reviews above 10k?" } system identity [SYS-001] { title: "Identity service"; host: identity.internal; description: "Issues and checks tokens" } system payments [SYS-002] { type: external title: "Payment provider" host: api.pay.example description: "Cards and bank transfers" unique_id: 0b7e2c4f19d ' AUTO GENERATED - DO NOT CHANGE } system bank_gw { type: external; title: "Bank gateway"; flags: [deprecated]; host: gw.bank.example } system bureau { type: external; title: "Credit bureau"; flags: [risk, security]; host: api.bureau.example } system_color_external { color_icon: #2f6f9f } ' an agent inline as a manual task (section 13.5) view review_q { title: "Review queue"; route: /claims/review } view approved { type: toast; title: "Claim approved" } view rejected { title: "Rejection letter"; route: /claims/:id/rejection } review_q --> agent : [Open claim] agent --> approved : [Approve] agent -x-> rejected : [Reject] ``` ### 12.6 In the model ```json { "key": "payments", "kind": "system", "type": "external", "title": "Payment provider", "id": "SYS-002", "idAssigned": false, "uniqueId": "0b7e2c4f19d", "uniqueIdPending": false, "friendlyId": "claim.payments", "flags": [], "inherited": [], "description": "Cards and bank transfers", "host": "api.pay.example", "trace": [], "a11y": [], "context": null, "style": { "icon": "#2f6f9f" } } ``` An actor has `"kind": "actor"`, `"type": "actor"`, and `role` in place of `host`. --- ## 13. Arrows An arrow says how the flow moves from one node to the next: which way, why, and what crosses with it. The shapes are the ones on the arrow page of the shape set; this section gives their text. ### 13.1 Statement ``` <from> <arrow> <to> [: <label>] [{ block }] ``` ``` view login { title: "Login"; route: /login } view dashboard { title: "Dashboard"; route: /home } login --> dashboard : [Sign in] valid credentials { payload: [email, password] } ``` - **The source comes first, the target second.** Both are handles declared somewhere in the journey, before or after the arrow. A reversed arrow (`dashboard <-- login`) is a syntax error that says to write the source first. - **The label** follows a colon: a trigger in square brackets, a guard, or both (13.4). - **The block** takes the same form as a node's: on the line, or opening alone on the next line. Payload, returns, flags, trace links and colors go there. - **No handle and no display id.** The model keys an arrow on its two ends and its label, so arrows have no id tab. - **An arrow may start and end at the same node**, such as a filter that reloads its list. It is drawn as a small loop. ### 13.2 Kinds | Token | Kind | Drawn | Meaning | |---|---|---|---| | `-->` | navigation | solid, filled head | The flow moves on | | `-x->` | negative | solid, a cross in a white disc at the middle of its longest straight piece (13.10); red in color | A failure path: an error, a rejection, a lockout | | `..>` | return | dashed, open head | Going back: a modal closing, the user's Back, a toast going away | | `.x.>` | return, failed | dashed, open head, the cross; red in color | Going back because something failed: the way back of a negative journey (13.7) | - The cross keeps a negative readable in black and white; red is only the color theme's default. - PlantUML's shorter forms mean the same here: `->` is `-->`, and `.>` is `..>`. In a PlantUML class diagram the length of an arrow affects the layout; in UJN it does not. Use a direction hint (13.3) instead. ### 13.3 Direction hints A direction word inside the token asks the layout to place the target on that side of the source: | | right | left | up | down | |---|---|---|---|---| | navigation | `-right->` | `-left->` | `-up->` | `-down->` | | negative | `-right-x->` | `-left-x->` | `-up-x->` | `-down-x->` | | return | `.right.>` | `.left.>` | `.up.>` | `.down.>` | | failed return | `.right.x.>` | `.left.x.>` | `.up.x.>` | `.down.x.>` | - One letter works too: `-r->`, `-d-x->`, `.u.>`, `.l.x.>`. - A hint is a wish, never an error. The layout honors it where it does not break a routing rule (13.10). What the layout does with a hint depends on the flow, which runs right or down (`render { direction: down }`, 19.2): | Hint | Flow right | Flow down | The layout | |---|---|---|---| | Along the flow | `-right->` | `-down->` | Places the target after its source, as it would anyway | | Against the flow | `-left->` | `-up->` | Places the target before its source; the arrow still points from the source to the target | | Across the flow | `-up->`, `-down->` | `-left->`, `-right->` | Puts the target right beside its source, on that side, with a straight arrow between them | ``` view claims { title: "Claims"; route: /claims } view details { title: "Claim details" } view help { title: "Help" } claims --> details : [Open] claims -down-> help : [Help] ' Help goes right under Claims help ..> claims : [Close] ' drawn beside the arrow (13.7) ``` A hint across the flow takes its target out of the flow, so it stays a wish when that would harm other arrows. The target then goes where the layout puts it, and the arrow keeps its label: - **The target has other arrows**, beyond the hinted one and the returns drawn beside it. Moving it would bend them. - **The flow runs right, the hint is `up`, and the source has an arrow to itself.** That arrow loops over the source's top. A hint that stays a wish draws no warning. Several hints across the flow to the same side of a node put their targets in a row on that side, in the order the arrows are written, the row centered on the node. How the module lays out the arrows, the lanes and the pills of such a row is in Appendix A.1. ``` view login { title: "Login"; route: /login } ref registration { journey: REG; title: "Registration" } ref sso { journey: SSO; title: "Single sign-on" } login -up-> registration : [Create account] ' both above Login, side by side login -up-> sso : [Company login] ``` A return needs no hint to go back: the layout already places its target before its source (13.7). A navigation or a negative arrow that goes back, such as a retry or a way back to the start after a reset, says nothing about that in its token, so it takes a hint against the flow: `-left->` or `-left-x->` when the flow runs right, `-up->` or `-up-x->` when it runs down. ### 13.4 Labels: trigger and guard ``` <from> <arrow> <to> : [Trigger] guard ``` | Part | Written as | Says | Example | |---|---|---|---| | Trigger | in square brackets, any text except `]` | What the user (or an inline actor) does: a button, a link, a gesture, an outcome | `[Sign in]`, `[Forgot password]`, `[Approve]` | | Guard | the text after the trigger, to the end of the label | When this exit is the one taken | `valid credentials`, `fifth failed attempt` | - A label can be a trigger alone, a trigger and a guard, a guard alone (out of an action, section 14.4), or nothing. - The pill shows both joined by a middle dot: `[Sign in] valid credentials` is drawn "Sign in · valid credentials". - Quote the guard when it holds `{`, `}` or an apostrophe: `: [Resume] "a draft exists"`. A middle dot inside a guard is plain text (`: Valid · no MFA`). - UJN has no decision diamond: the guard sits on the arrow itself. The question a diamond would ask is read from the guards of the arrows that leave the same node. ### 13.5 Exit rules What the arrows leaving a node mean depends on what kind of node they leave: | Leaving | What happens | Labels | |---|---|---| | a **view** | The user takes one exit. | Every navigation or negative exit needs a trigger. Exits that share a trigger each need a guard, and the guards tell them apart. A return (`..>`) may stay unlabeled: Escape, a click outside, a toast timing out. | | an **actor** inline in the flow | The person picks one outcome: a manual task. | Each exit needs the outcome as its trigger: `[Approve]`, `[Reject]`. Outcomes that share a trigger need guards, as for a view. | | an **action** (section 14.4) | Exits without a guard all fire. Among exits with a guard, exactly one fires. An arrow into a system is a call, not an exit. | No trigger: the system acts, not the user. Mixing guarded and unguarded exits on one action is a warning. | | a **system** (section 14.5) | It answers the action that called it, with a `..>` reply. | No label. | | a **handoff** (section 15.4) | The user comes back by one of its resume arrows (`..>`). | As for a view: each needs a trigger, and resume arrows that share one need guards. | | a **data store** (section 16.4) | It is read by the action its arrow goes to. | No label. | | a **start** (section 17.4) | As out of an action. | No trigger. | | an **end** (section 17.4) | Nothing leaves an end. | | | a **journey reference** (section 18.3) | The other journey comes back by one of its `..>` arrows. | No trigger; a guard names the outcome when there is more than one. | One trigger, three outcomes, read straight from the view: ``` view login { title: "Login"; route: /login } view dashboard { title: "Dashboard"; route: /home } view bad_login { type: toast; title: "Incorrect credentials" } view locked { title: "Account locked"; route: /locked } login --> dashboard : [Sign in] valid credentials login -x-> bad_login : [Sign in] wrong password login -x-> locked : [Sign in] fifth failed attempt bad_login ..> login ``` The same branch out of an action, where guards alone decide: ``` view login { title: "Login"; route: /login } view dashboard { title: "Dashboard"; route: /home } view enter_code { title: "Enter code"; route: /login/code } view bad_login { type: toast; title: "Incorrect credentials" } ' an action (section 14) action validate { title: "Validate credentials" } login --> validate : [Sign in] { payload: [email, password] } validate --> dashboard : valid, no MFA validate --> enter_code : valid, MFA on validate -x-> bad_login : invalid ``` ### 13.6 Payload ``` login --> validate : [Sign in] { payload: [email, password] } ``` - `payload` lists what crosses the arrow: fields, a record, a file. - It is drawn in monospace braces, `{email, password}`, under the line and below the label pill, or under the pill itself where the arrow is vertical. It moves with the pill (13.10). - Where the pill is under its line (an arrow that runs left with its return drawn beside it, a return under its arrow, a pill moved under its line), the payload is under the pill. Where there is no room under the line, it is over the pill: on a loop back to its own node, for the pill of a return that stands over its own line, and for a pill of a pair moved past the pair's other line to over it. - Under a return that has a label too, the payload and that label stand side by side (13.10). - An arrow with a payload and no label, such as a call (14.5), has the payload where the pill would be: over the line, and under it for the reply drawn beside the call. - Braces always open a block, so the payload is a block key, not braces after the label (`: [Sign in] {email, password}`). ### 13.7 Returns There are two kinds of return. **A return the designer draws** is a `..>` arrow: a modal closing, the user's Back, a toast going away. ``` view claims { title: "Claims"; route: /claims } view delete_claim { type: modal; title: "Delete claim" } claims --> delete_claim : [Delete] delete_claim ..> claims : [Cancel] ``` When a return goes back to the node its outgoing arrow came from, the renderer runs it right under that arrow, between the same two nodes, never around the boxes. Its pill sits on the outside of the pair: under its own line, as the arrow's pill sits over the arrow, when the arrow runs right; the other way round when it runs left (13.10). Any other return is placed going back: its target comes before its source, as with a hint against the flow (13.3). A loop that a return closes is drawn with the return as the way back, and the arrows that lead into the loop keep leading forward. ``` view login { title: "Login"; route: /login } view dashboard { title: "Dashboard"; route: /home } view bad_login { type: toast; title: "Incorrect credentials" } action validate { title: "Validate credentials" } login --> validate : [Sign in] validate --> dashboard : valid validate -x-> bad_login : invalid bad_login ..> login ' goes back: Login stays first ``` - A hint on a return wins over this: `.right.>` keeps it going forward in a flow that runs right. - Two kinds of arrow written `..>` keep the flow's direction, because the user goes on: a resume, out of a handoff or a journey reference (15.4, 18.3), and a return into an end, which ends the journey. **A failed return** is written `.x.>`: the user goes back because something failed. It is a return in every way: it is placed going back, it runs right beside the arrow it answers, it is not a path forward (reachability, 17.5; flags, section 8), and it follows the same rules for triggers and guards. Only its look is a failure's: dashed with an open head like any return, red with the cross like a negative arrow. ``` view login { title: "Login"; route: /login } action validate { title: "Validate credentials" } view dashboard { title: "Dashboard"; route: /home } view locked { type: modal; title: "Account locked" } login --> validate : [Sign in] attempts left validate --> dashboard : valid validate .x.> login : invalid ' failed: straight back to Login, no error screen login -x-> locked : [Sign in] fifth failed attempt locked .x.> login : [Back] ' the way back of that failure, drawn beside it ``` - Through an error screen, the failure is the negative arrow into it, and its way back may be a failed return too: `validate -x-> bad_login : invalid` then `bad_login .x.> login`. Plain `..>` there is still right; `.x.>` shows that the loop is a failure's. - Out of a handoff, `.x.>` is a resume that failed, such as a link that has expired. **A return the renderer draws** comes from the `returns` key, on an arrow into a journey reference (section 18) or a handoff (section 15). The designer writes only the outgoing arrow; the renderer adds the dashed return under it, back to the source. ``` view login { title: "Login"; route: /login } ' a reference to another journey (section 18) ref registration { journey: REG; title: "Registration" } login --> registration : [Create account] { returns } ``` - `returns` on its own is an unlabeled return; a journey call's return usually is. `returns: "Done"` labels it. - A handoff that resumes somewhere else, at a handoff-return start (section 17), is drawn with an explicit `..>` instead. - `returns` on any other arrow is a warning, and nothing extra is drawn. - In the model, a rendered return is not a second arrow: the call carries `"returns": true`. ### 13.8 Flags on arrows ``` view login { title: "Login"; route: /login } view passkey { title: "Passkey prompt"; route: /login/passkey } login --> passkey : [Use passkey] { flags: [future] } ``` - A flagged arrow is **dotted**, and the flag's glyph sits in a tab closed on all four sides, right of the label pill (at the label spot when there is no label). - Dotted wins over dashed: a flagged return is dotted with an open head. A flagged negative keeps its cross. - **Delivery flags propagate** from an arrow to everything reachable only through it; review flags stay on the arrow (section 8). - An arrow downstream of a flagged node is dotted **with no tab**: the nodes carry the flag. As on nodes, inherited flags are never written. - `#` always means a color, so flags go in the block, not after the label as `#future`. ### 13.9 Other arrow keys and colors | Key | Value | Drawn | Meaning | |---|---|---|---| | `flags` | list of flags | dotted line, glyph tab | 13.8 | | `payload` | list | under the line, with its pill | 13.6 | | `returns` | true, or text for the return's label | a dashed return under the arrow | 13.7 | | `trace` | list of trace links | no | For example the test of this transition: `test:e2e/login.spec.ts#lockout` | | `context` | text | no | Background for the implementer | | `a11y` | text; repeatable | no | For example "Enter submits the form" | | `tooltip` | text | on hover, in SVG | 9.3 | | `arrow_spacing` | pixels, `0` or more, or `default` | the room the layout counts on each side of its text | 19.8 | | `color_line` | color | the line and the head | | | `color_text` | color | the label and the payload | | | `color_background` | color | the label pill | | Defaults blocks work as for nodes (section 10): `arrow_color` for every arrow, and `arrow_color_navigation`, `arrow_color_negative` and `arrow_color_return` per kind; a failed return (`.x.>`) is drawn as a failure, so it takes `arrow_color_negative`. For each part, the arrow's own key wins, then its kind's block, then `arrow_color`, then the theme. ``` arrow_color { color_line: #555555 } arrow_color_negative { color_line: #c0392b } ``` ### 13.10 How arrows are drawn and routed | Part | From | |---|---| | Line and head | the token: `-->`, `-x->`, `..>`, `.x.>` | | Pill at the middle of a straight piece of the arrow: over it, beside it where the arrow is vertical (below) | the trigger and the guard, joined by ` · ` | | Bold monospace line under the arrow, below the pill | `payload` | | Glyph tab right of the pill | `flags` | | Dotted line | any flag, set or inherited | | Cross in a white disc at the middle of the longest straight piece | `-x->`, `.x.>` | | Dashed return under the arrow | `returns` | The designer writes no coordinates. The layout follows these rules: - right-angle lines with rounded corners (or square ones, 19.2); - as few crossings as possible; arrows never overlap; no arrow starts or ends on an id tab; a pill overlaps nothing (below); - **the anchor rule**: one arrow on a side leaves from its middle; several of the same kind share one point and fan out, nested so they do not cross (the one that runs farthest turns first); one going and one returning sit 25% apart, centered; going arrows that arrive on a side where others leave sit 25% apart from them too, centered, so no arrowhead lands on a line that leaves; - **two lanes**: when two nodes have going arrows both ways between them (a Submit and a retry), each keeps to the right of its travel, as a return does, so the two run side by side and do not cross. The layout tries this first and gives it up only for a way with clearly fewer crossings (below); - a return to the node its arrow came from runs right under that arrow, and a call and its return run as concentric parallel tracks; - a journey reference points away from the node its arrow comes from, also when a hint across the flow puts it beside that node; its `point` key turns it by hand (18.2); - a return goes back: its target is placed before its source (13.7). Direction hints (13.3) are honored where they do not break these rules. **Where a pill goes.** How the module places each pill, the same in every drawing, with `arrow_spacing` (19.8) or without it, is in Appendix A.2. A pill with no free place, after the layout was made again with more room along its arrow, is drawn off its own line, where it covers the least of anything else. The drawing gets a warning that names the arrow and its line (19.6, section 21): `no free place by the arrow for its label, which is drawn where it is least in the way`. Within these rules a journey can still be drawn many ways, and the layout engine's first try is not always the clearest. So the layout draws it a few ways and keeps the clearest. How the module weighs them is in Appendix A.2. - **Write nodes in the order the journey goes.** The layout reads that order as the direction of the journey: an arrow to a node written later should go with the flow, and an arrow back to a node written earlier is a loop going back, which is fine. - A tie keeps the first way tried, so the same text always gives the same drawing. ### 13.11 Example A sign-in that uses every kind of arrow: ``` @startujn journey AUTH "Authentication" increment { auto; view_prefix: "AUTH" } view login { title: "Login"; route: /login } view dashboard { title: "Dashboard"; route: /home } view bad_login { type: toast; title: "Incorrect credentials" } view locked { title: "Account locked"; route: /locked } view forgot { title: "Forgot password"; route: /forgot } view terms { type: modal; title: "Terms of use" } view passkey { title: "Passkey prompt"; route: /login/passkey } ' a reference to another journey (section 18) ref registration { journey: REG; title: "Registration" } login --> dashboard : [Sign in] valid credentials { payload: [email, password] trace: [test:e2e/login.spec.ts] } login -x-> bad_login : [Sign in] wrong password login -x-> locked : [Sign in] fifth failed attempt bad_login ..> login login -right-> forgot : [Forgot password] login --> terms : [Terms of use] terms ..> login : [Close] login --> passkey : [Use passkey] { flags: [future] } login --> registration : [Create account] { returns } @endujn ``` ### 13.12 In the model ```json { "from": "login", "to": "dashboard", "kind": "navigation", "role": "exit", "trigger": "Sign in", "guard": "valid credentials", "payload": ["email", "password"], "returns": false, "returnLabel": null, "direction": null, "flags": [], "inherited": [], "trace": ["test:e2e/login.spec.ts"], "context": null, "a11y": [], "style": {} } ``` - Arrows are listed in the order they are written. - `role` is `exit`, `call`, `reply` or `resume` (14.8). - `kind` is `navigation`, `negative` or `return`; `direction` is `right`, `left`, `up`, `down` or `null`. - `style` holds the colors the text sets for the arrow after the cascade, as for nodes. --- ## 14. Action An action is something the system does between views: it validates, sends a message, waits, receives an event, asks for a login or for consent. The user never sees an action as a window, only its outcome. The shape is the action box: no title bar; the type icon white in a filled circle at the top left, then the type name; the title, the description and a meta line; flag tabs inside the right edge from the top; the id tab under the bottom edge. ### 14.1 Statement ``` action <handle> [<DISPLAY-ID>] [{ block }] ``` ``` action validate [ACTN-001] { title: "Validate credentials" description: "Email and password" timeout: 10 s trace: [code:src/auth/validate.ts] unique_id: 9a03c4e1f2b ' AUTO GENERATED - DO NOT CHANGE } ``` `action validate` alone is a complete statement too: a plain action titled "validate". ### 14.2 Types The type menu: | Type | Type name drawn | Icon | Meta line | What it is | |---|---|---|---|---| | `action` (default) | Action | a gear | `timeout` | The system does something: validates, saves, creates a token | | `message` | Message | an envelope | `channel` | Sends an SMS, an email or a push notification; the user stays in the app | | `wait` | Wait | a clock | `timeout` | A delay, a countdown or an expiry | | `event` | Event | a lightning bolt | `timeout` | Something that arrives on its own, not from the UI: a webhook, a review completed | | `auth` | Auth | a padlock | `timeout` | A login, MFA or step-up required at this point | | `permission` | Permission | a shield | – | Asks the user for consent: camera, location, notifications | | `fork` | none: a bar | – | – | The flow splits into paths that run at the same time | | `join` | none: a bar | – | – | Paths that ran at the same time meet; it waits for every arrow coming in | **Fork and join are bars**, the one geometric exception in the action menu: a thick bar across the flow, with no title, description or meta drawn (they are kept in the model): upright when the flow runs right, flat when it runs down. A flagged bar is hollow and dotted, with its flag tabs on its downstream side. Its id goes past its far end, clear of the arrows, which meet the bar's long sides: under an upright bar, beside the right end of a flat one. ### 14.3 Action attributes On top of the keys every node takes (section 4.5): | Key | On types | Value | Drawn | Meaning | |---|---|---|---|---| | `timeout` | action, wait, event, auth | duration | the meta line | How long the action may take, or how long the wait lasts | | `channel` | message | text | the meta line | How the message goes out: `SMS`, `email`, `push` | The meta line shows the value as written, bottom left in monospace: `10 s`, `SMS`. **The timeout exit.** When an action has a `timeout`, one of its exits is taken when the time runs out: the exit whose guard is exactly `timeout`. An action with a `timeout` and no such exit is a warning, and so is an exit guarded `timeout` from an action without one. ``` action send_code { type: message; title: "Send SMS code"; channel: SMS } action code_expiry { type: wait; title: "Code expires"; description: "Countdown in the UI"; timeout: 5 min } view enter_code { title: "Enter code"; route: /login/code } view code_expired { type: toast; title: "Code expired" } send_code --> enter_code send_code --> code_expiry code_expiry -x-> code_expired : timeout ``` The message's two exits have no guard, so both fire: the code screen opens and the countdown starts. ### 14.4 Exits and calls The arrows out of an action are of two kinds. - **Calls** go into a system (14.5), and **writes** into a data store (16.4). A call is part of the action itself: it happens while the action runs, it takes no trigger and no guard, and it is not an exit. - **Exits** are all the other arrows out of the action. An exit takes no trigger, since the system acts and not the user: - exits **without a guard all fire**: "send the confirmation and show the next screen" is two unguarded exits; - among exits **with a guard, exactly one fires**, so their guards must not overlap; - guarded and unguarded exits on the same action are a warning (section 23): put a fork after the guarded exit instead. - A `fork` has only unguarded exits, all of which fire. A `join` has one exit, taken once every arrow into it has arrived. One action, three outcomes, and a timeout: ``` view login { title: "Login"; route: /login } view dashboard { title: "Dashboard"; route: /home } view enter_code { title: "Enter code"; route: /login/code } view bad_login { type: toast; title: "Incorrect credentials" } view slow { type: toast; title: "This is taking too long" } action validate { title: "Validate credentials"; timeout: 10 s } action send_code { type: message; title: "Send SMS code"; channel: SMS } login --> validate : [Sign in] { payload: [email, password] } validate --> dashboard : valid, no MFA validate --> send_code : valid, MFA on validate -x-> bad_login : invalid validate -x-> slow : timeout send_code --> enter_code ``` Two things at once (send a notification and open the next screen): ``` view review { title: "Review claim"; route: /claims/new/review } view submitted { title: "Claim submitted"; route: /claims/:id } action submit { title: "Submit claim" } action confirm { type: message; title: "Send confirmation"; channel: email } review --> submit : [Submit] { payload: [claim, files] } submit --> confirm submit --> submitted ``` Paths that must all finish before the flow goes on: ``` view documents { title: "Documents"; route: /claims/new/documents } view decision { title: "Claim decision"; route: /claims/:id/decision } action checks { type: fork } action credit_check { title: "Credit check" } action fraud_check { title: "Fraud check" } action checks_done { type: join } documents --> checks : [Next] checks --> credit_check checks --> fraud_check credit_check --> checks_done fraud_check --> checks_done checks_done --> decision ``` ### 14.5 Calling a system ``` action validate { title: "Validate credentials" } system identity { title: "Identity service"; host: identity.internal } validate --> identity { payload: [email, password] } identity ..> validate { payload: [token] } ``` - **The call** is a `-->` from the action into the system. Its payload is the request. - **The reply** is a `..>` from the system back to the action that called it. Its payload is what comes back. It is drawn right under the call, as every return to the node its arrow came from (13.7). A call without a reply is fire-and-forget. - **Only an action calls a system.** An arrow into a system from anything else is a warning, and so is any arrow out of a system other than a reply to an action that calls it. - A call takes no label: a trigger or a guard on a call is a warning. The payload says what is sent. ### 14.6 What is drawn where | Part of the box | From | |---|---| | Top left: the icon white in a filled circle, then the type name | `type` | | Body: the title, then the description | `title` (or the handle), `description` | | Meta line, bottom left, monospace | `timeout`, or `channel` on a message | | Flag tabs, inside the right edge from the top | `flags`, plus the inherited ones | | Id tab, under the bottom edge, right-aligned (past a bar's far end, 14.2) | `[DISPLAY-ID]` or the assigned display id | | Dotted border (a hollow dotted bar for fork and join) | any flag, set or inherited | | Colors | `color_*` keys, `action_color`, `action_color_<type>` | The colors of section 10 apply: `color_frame` is the border, `color_icon` the circle behind the icon and the type name, and `color_background` the fill. ### 14.7 Examples ``` action validate [ACTN-001] { title: "Validate credentials"; description: "Email and password"; timeout: 10 s } action send_sms [ACTN-002] { type: message; title: "Send SMS code"; description: "One-time code"; channel: SMS } action code_expires [ACTN-003] { type: wait; title: "Code expires"; description: "Countdown in the UI"; timeout: 5 min } action review_done [ACTN-004] { type: event; title: "Review completed"; description: "From the claims service" } action mfa_gate [ACTN-005] { type: auth; title: "MFA gate"; description: "Step-up before payment" } action camera [ACTN-006] { type: permission; title: "Camera access"; description: "Browser prompt" } action passkey_check { type: auth; title: "Passkey check"; description: "WebAuthn"; flags: [future] } action paths { type: fork; flags: [experiment] } ``` ### 14.8 In the model ```json { "key": "validate", "kind": "action", "type": "action", "title": "Validate credentials", "id": "ACTN-001", "idAssigned": false, "uniqueId": "9a03c4e1f2b", "uniqueIdPending": false, "friendlyId": "auth.validate", "flags": [], "inherited": [], "description": "Email and password", "timeout": "10 s", "channel": null, "trace": ["code:src/auth/validate.ts"], "a11y": [], "context": null, "style": {} } ``` Sections 14 and 15 also give every arrow a `role` in the model, worked out from its two ends so a generator never has to: `exit` (the default), `call` (an action into a system), `reply` (a system back to the action that called it), or `resume` (out of a handoff, section 15.4). --- ## 15. Handoff A journey break: the user **leaves the app or its channel** and may come back. They open a link in an SMS or an email, sign in at an identity provider, pay on a payment page, approve in a bank app, or call a phone line. The shape is the action box with a **dashed border**. The border stays dashed when the handoff is flagged: its identity wins, and the tabs show the flags. ### 15.1 Statement ``` handoff <handle> [<DISPLAY-ID>] [{ block }] ``` ``` handoff email_link [HND-001] { title: "Reset link" description: "The user opens their inbox" channel: email timeout: 24 h resume: /reset/:token } ``` ### 15.2 Types | Type | Type name drawn | Icon | What it is | |---|---|---|---| | `returns` (default) | Handoff, returns | an arrow coming back | The user comes back to this journey | | `no-return` | Handoff, no return | an arrow against a bar | The user does not come back: the journey ends out there | ### 15.3 Handoff attributes On top of the keys every node takes (section 4.5): | Key | Value | Drawn | Meaning | |---|---|---|---| | `channel` | text | the meta line | Where the user goes: `SMS`, `email`, `identity provider`, `payment page`, `bank app`, `phone` | | `timeout` | duration | the meta line, after the channel | How long the link or the session out there stays valid | | `resume` | text | no | The deep link the user comes back through: `/reset/:token`. A `:name` marks a parameter | The meta line joins the two with a middle dot: `email · 24 h`. ### 15.4 Leaving and coming back **Leaving.** The arrow into a handoff is where the user leaves: from a view, with the trigger that sends them (`[Pay with bank app]`); or from an action, such as the message that sends the link. **Coming back** works in one of two ways. 1. **Back where they left**: `{ returns }` on the arrow into the handoff. The renderer draws the dashed return under that arrow, back to its source (13.7). ``` view checkout { title: "Checkout"; route: /checkout } handoff bank { title: "Bank app"; channel: bank app; timeout: 5 min } checkout --> bank : [Pay with bank app] { returns } ``` 2. **Somewhere else**: one or more `..>` arrows out of the handoff, its **resume** arrows. Each says what the user does out there as its trigger, with guards when they share one. A resume arrow may go straight to the view the link opens, or into a start of the kind *handoff return* (17.4), which carries the route the user lands on. ``` view forgot { title: "Forgot password"; route: /forgot } view reset { title: "New password"; route: /reset/:token } view link_expired { title: "Link expired"; route: /reset/expired } action send_link { type: message; title: "Send reset link"; channel: email } handoff email_link { title: "Reset link"; channel: email; timeout: 24 h; resume: /reset/:token } forgot --> send_link : [Send link] { payload: [email] } send_link --> email_link email_link ..> reset : [Open link] valid email_link ..> link_expired : [Open link] expired ``` A **no-return** handoff has neither: ``` view help { title: "Help"; route: /help } handoff call_us { type: no-return; title: "Call support"; channel: phone } help --> call_us : [Call us] ``` **The rules:** - A handoff is left only by its resume arrows. A `-->` or `-x->` out of a handoff is a warning. - Resume arrows follow the rule for views (13.5): each needs a trigger, and resume arrows that share a trigger each need a guard. - A `returns` handoff with no way back (no `{ returns }` on an arrow into it and no resume arrow) is a warning. So is a `no-return` handoff with either. - A flagged resume arrow is dotted, like every flagged return (13.8). ### 15.5 What is drawn where | Part of the box | From | |---|---| | Dashed border, also when flagged | `handoff` | | Top left: the icon white in a filled circle, then the type name | `type` | | Body: the title, then the description | `title` (or the handle), `description` | | Meta line, bottom left, monospace | `channel · timeout` | | Flag tabs, inside the right edge from the top | `flags`, plus the inherited ones | | Id tab, under the bottom edge, right-aligned | `[DISPLAY-ID]` or the assigned display id | | The way in: solid; the way back: dashed with an open head | the arrow into it; `{ returns }` or the resume arrows | | Colors | `color_*` keys, `handoff_color`, `handoff_color_<type>` | ### 15.6 In the model ```json { "key": "email_link", "kind": "handoff", "type": "returns", "title": "Reset link", "id": "HND-001", "idAssigned": false, "uniqueId": null, "uniqueIdPending": false, "friendlyId": "auth.email_link", "flags": [], "inherited": [], "description": "The user opens their inbox", "channel": "email", "timeout": "24 h", "resume": "/reset/:token", "trace": [], "a11y": [], "context": null, "style": {} } ``` The model schema, version 5 (`ujn-model-v5.schema.json`), describes every kind of node and arrow (section 20). --- ## 16. Data A data store is where an action reads or writes: a file, a folder, the browser's storage, a server database, an API. The shape is one cylinder for every kind of store: a light-filled lid; under it, the type icon white in a filled circle and the type name; the title, the description, and the location on the meta line; flag tabs inside the right side under the lid; the id tab under the bottom arc, at the right. ### 16.1 Statement ``` data <handle> [<DISPLAY-ID>] [{ block }] ``` ``` data drafts [DAT-004] { type: browser-storage title: "Draft form" description: "Saved on every change" location: "localStorage · draft" } ``` ### 16.2 Types The six storage kinds: | Type | Type name drawn | Icon | Location is | What it is | |---|---|---|---|---| | `file` | File | a page with a folded corner | a path | One document | | `folder` | Folder | a folder | a path | A set of files | | `browser-cache` | Browser cache | a browser window with two slashes | a key | Volatile, in the browser | | `browser-storage` | Browser storage | a browser window with a bar | a key | Persistent, in the browser | | `server-database` (default) | Server database | a small cylinder | a table | Persistent, on the server | | `api` | API | braces | an endpoint | Read or written through a service | ### 16.3 Data attributes On top of the keys every node takes (section 4.5): | Key | Value | Drawn | Meaning | |---|---|---|---| | `location` | text | the meta line | Where the data lives: `/exports/2026-11.csv`, `localStorage · draft`, `table policies`, `POST /claims` | ### 16.4 Reads and writes Only an action reads or writes a store. The arrow points **the way the data moves**: - **A write** goes from the action into the store: `save_draft --> drafts`. - **A read** comes out of the store into the action: `drafts --> load_draft`. ``` view claim_form { title: "Claim form"; route: /claims/new } view saved { type: toast; title: "Draft saved" } action save_draft { title: "Save draft" } action load_draft { title: "Load draft" } data drafts { type: browser-storage; title: "Draft form"; location: "localStorage · draft" } claim_form --> save_draft : [Save] { payload: [claim] } save_draft --> drafts { payload: [claim] } save_draft --> saved drafts --> load_draft { payload: [claim] } load_draft --> claim_form ``` - Reads and writes take no trigger and no guard. Their payload says what moves. - Like a call into a system (14.4), a write is part of its action, not an exit of it. A read is an input to its action, not an exit of the store. - A store's arrows go only to and from actions. An arrow between a store and anything else is a warning. > **Still open**: whether a read points the way the data moves, as > written here and in every example, or always away from the action, with `read` on the arrow > (`load_draft --> drafts : read`). This section changes if the second is chosen. See 23.13 and 23.21. ### 16.5 What is drawn where | Part of the cylinder | From | |---|---| | Lid, light-filled | `data` | | Under the lid: the icon white in a filled circle, then the type name | `type` | | Body: the title, then the description | `title` (or the handle), `description` | | Meta line, bottom left, monospace | `location` | | Flag tabs, inside the right side under the lid | `flags`, plus the inherited ones | | Id tab, under the bottom arc at the right | `[DISPLAY-ID]` or the assigned display id | | Dotted body and lid | any flag, set or inherited | | Colors | `color_*` keys, `data_color`, `data_color_<type>` | ### 16.6 Examples ``` data export [DAT-001] { type: file; title: "Export.csv"; description: "Claims of the month"; location: /exports/2026-11.csv } data uploads [DAT-002] { type: folder; title: "Uploads"; description: "Documents from the claimant"; location: "/uploads/{claimId}" } data session [DAT-003] { type: browser-cache; title: "Session cache"; description: "Dashboard layout"; location: sessionStorage } data policies [DAT-005] { title: "Policies"; description: "Master data"; location: table policies } data claims_api [DAT-006] { type: api; title: "Claims API"; description: "Read and write claims"; location: POST /claims; flags: [future] } ``` ### 16.7 In the model ```json { "key": "drafts", "kind": "data", "type": "browser-storage", "title": "Draft form", "id": "DAT-004", "idAssigned": false, "uniqueId": null, "uniqueIdPending": false, "friendlyId": "claim.drafts", "flags": [], "inherited": [], "description": "Saved on every change", "location": "localStorage · draft", "trace": [], "a11y": [], "context": null, "style": {} } ``` Arrows gain two roles: `write` (an action into a store) and `read` (a store into an action). --- ## 17. Start and End Where a journey begins and how it ends (one start node with an entry kind, several allowed per journey). The shapes are a ring for a start and a bullseye for an end, each over a **label plate** that carries the type name, the description, the flag tabs and the id tab. ### 17.1 Statements ``` start <handle> [<DISPLAY-ID>] [{ block }] end <handle> [<DISPLAY-ID>] [{ block }] ``` ``` start from_email [START-002] { type: deep-link description: "The link in the welcome email" route: /welcome/:token } end signed_in [END-001] { type: success; description: "On the dashboard" } ``` ### 17.2 Types | Statement and type | Type name drawn | Glyph | What it is | |---|---|---|---| | `start`, `plain` (default) | Start | an entry arrow in the ring | The journey begins here | | `start`, `deep-link` | Start, deep link | a link | Entered by URL | | `start`, `notification` | Start, notification | a bell | Entered from a push or an email | | `start`, `handoff-return` | Start, handoff return | a return arrow | Re-entry after a handoff (section 15) | | `end`, `success` (default) | End, success | a check in the bullseye | The intended outcome was reached | | `end`, `failure` | End, failure | a cross | Ended without the outcome | | `end`, `abandoned` | End, abandoned | a square, in an octagon | The user left | The default start type is named after the default view type, so it follows the `plain` or `normal` decision (section 23). ### 17.3 Start and End attributes On top of the keys every node takes (section 4.5): | Key | On | Value | Drawn | Meaning | |---|---|---|---|---| | `route` | start | text | no | The URL or deep link that opens here; for a handoff return, the route the user comes back through | The plate draws the type name and the description. The title is kept in the model but not drawn: the type name already says what the node is. ### 17.4 Arrows at a start and an end - **Out of a start**: exits as out of an action (14.4), with no trigger. One exit is the usual case. - **Into a start**: only from an actor, the person who starts the journey (12.3), or, into a `handoff-return` start, a handoff's resume arrow (15.4). An actor's arrow into a start needs no trigger. Any other arrow into a start is a warning. - **An end** has arrows in and none out. A journey with two ways in, and a handoff that comes back through its own start: ``` actor customer { title: "Customer"; role: Policyholder } start open_app { description: "From the home screen" } start from_link { type: deep-link; route: /login } start back_from_bank { type: handoff-return; route: /checkout/return } view checkout { title: "Checkout"; route: /checkout } view paid { title: "Payment received"; route: /checkout/done } handoff bank { title: "Bank app"; channel: bank app; timeout: 5 min; resume: /checkout/return } end done { type: success; description: "Order paid" } end gave_up { type: abandoned; description: "Left at the bank" } customer --> open_app open_app --> checkout from_link --> checkout checkout --> bank : [Pay with bank app] bank ..> back_from_bank : [Approve] bank ..> gave_up : [Close the app] back_from_bank --> paid paid --> done : [Done] ``` - When a handoff's resume arrow goes into a `handoff-return` start, the handoff's `resume` and the start's `route` say the same thing. Writing both with different values is a warning. ### 17.5 Every node is reached Once a journey has at least one start, **every node needs a path from a start**: through exits, resumes, calls, writes and reads. A node that no path reaches gets a warning, except actors and data stores, which may stand outside the flow. ### 17.6 What is drawn where | Part | From | |---|---| | Start: a ring, light-filled, with the entry glyph | `start` and its `type` | | End: a bullseye, the white glyph on the filled disc; an octagon for abandoned | `end` and its `type` | | Plate under the ring: the type name, then the description | `type`, `description` | | Flag tabs, inside the plate's right edge | `flags`, plus the inherited ones | | Id tab, centered under the plate | `[DISPLAY-ID]` or the assigned display id | | Dotted ring and plate | any flag, set or inherited | | Colors: green for a start and a success, red for a failure, gray for abandoned | the theme; `color_*` keys, `start_color`, `end_color_<type>` | ### 17.7 In the model ```json { "key": "from_email", "kind": "start", "type": "deep-link", "title": "from_email", "id": "START-002", "idAssigned": false, "uniqueId": null, "uniqueIdPending": false, "friendlyId": "auth.from_email", "flags": [], "inherited": [], "description": "The link in the welcome email", "route": "/welcome/:token", "trace": [], "a11y": [], "context": null, "style": {} } ``` An end has `"kind": "end"`, its outcome as `type`, and no `route`. --- ## 18. Journey reference Another journey, named here and drawn elsewhere (one journey per diagram). The shape is a box with **one pointed side**. The point faces away from the node the arrow comes from, or the way its `point` key says (18.2). The title is the other journey's name, and its id goes on the meta line. ### 18.1 Statement ``` ref <handle> [<DISPLAY-ID>] [{ block }] ``` ``` ref registration [REF-001] { journey: REG title: "Registration" description: "Create an account" } ``` A reference has no type menu. ### 18.2 Reference attributes On top of the keys every node takes (section 4.5): | Key | Value | Drawn | Meaning | |---|---|---|---| | `journey` | a journey id | the meta line | The journey this node stands for: the id on that journey's own journey line. Required | | `point` | `auto`, `up`, `down`, `left`, `right` | the pointed side | Which way the point faces. `auto`, the default: away from the node its first arrow comes from, along the flow, or away from the source a hint across the flow puts it beside (13.3) | A reference without `journey` is a warning. Two references may name the same journey, so that one journey is used from two places in the flow. A check across files, later, can confirm that the id exists. ``` view login { title: "Login"; route: /login } ref registration { journey: REG; title: "Registration" } ref help { journey: HELP; title: "Help center"; point: left } login -up-> registration : [Create account] ' above Login, pointing up: auto login --> help : [Help] ' after Login, pointing left: as written ``` - `point` only turns the shape; where the reference goes is the layout's, with any hint (13.3). - Quotes and case do not matter, as in the `render` block. A `point` that is none of the five is a warning, and `auto` is used. - `point` is a drawing setting, like `render` (section 19): the model leaves it out (section 20). ### 18.3 Going and coming back - **A go-to**: an arrow into the reference, without `returns`. The user carries on in the other journey and does not come back to this one. - **A call**: `{ returns }` on the arrow into the reference. The user comes back to the node the arrow came from, and the renderer draws the return under the arrow (13.7). A call's return is usually unlabeled. - **Coming back elsewhere**: `..>` arrows out of the reference, one for each outcome of the other journey that leads somewhere different. These are resume arrows, as out of a handoff, but they take no trigger: the other journey ends, and nobody clicks anything here. When there is more than one, a guard names each outcome. ``` view login { title: "Login"; route: /login } view dashboard { title: "Dashboard"; route: /home } ref registration { journey: REG; title: "Registration" } ref help { journey: HELP; title: "Help center" } login --> registration : [Create account] registration ..> dashboard : registered registration ..> login : cancelled login --> help : [Help] { returns } ``` - Any arrow out of a reference other than a `..>` is a warning, and so is a trigger on one. ### 18.4 What is drawn where | Part of the box | From | |---|---| | The pointed side, facing away from the arrow that comes in | the layout | | Top left: the icon white in a filled circle (a box with an arrow leaving it), then the type name "Journey" | `ref` | | Body: the title, then the description | `title` (or the handle), `description` | | Meta line, bottom left, monospace | `journey` | | Flag tabs, on a straight vertical side: the right one, or the left one when the point is on the right | `flags`, plus the inherited ones | | Id tab, under the bottom edge, right-aligned; above the top edge when the point is at the bottom | `[DISPLAY-ID]` or the assigned display id | | Colors | `color_*` keys, `ref_color` | ### 18.5 In the model ```json { "key": "registration", "kind": "ref", "type": "ref", "title": "Registration", "id": "REF-001", "idAssigned": false, "uniqueId": null, "uniqueIdPending": false, "friendlyId": "auth.registration", "flags": [], "inherited": [], "description": "Create an account", "journey": "REG", "trace": [], "a11y": [], "context": null, "style": {} } ``` The model schema, version 5 (`ujn-model-v5.schema.json`), describes every kind of node and arrow (section 20). The roles of an arrow are now `exit`, `call`, `reply`, `resume`, `write` and `read`. --- ## 19. The drawing What a UJN diagram looks like on the page, and the switches that change it. None of this changes the model: a journey means the same in color and in black and white. ### 19.1 The `render` block ``` render { colors: mono corners: square direction: down legend warnings: hide } ``` | Key | Values | Default | What it changes | |---|---|---|---| | `colors` | `color`, `mono` | `color` | The palette: section 19.3, or black and white, 19.4 | | `corners` | `rounded`, `square` | `rounded` | The bends of the arrows (19.2) | | `direction` | `right`, `down` | `right` | Which way the flow runs | | `legend` | `true`, `false` | `false` | A strip under the drawing that explains what it uses (19.5) | | `warnings` | `show`, `hide` | `show` | The warnings box under the drawing (19.6) | | `id_position` | `outside`, `inside`, `inside-top`, `inside-bottom`, `hidden` | `outside` | Where display ids are drawn; a node's own key wins (4.6) | | `arrow_spacing` | pixels, `0` or more, or `default` | `default` | The room the layout counts from a box to an arrow's text and from that text to the next box; an arrow's own key wins (19.8) | - `render` is a top-level block, like `increment` and the color blocks. It may come before the journey line, so a shared file brought in with `!include` can set it for every journey. - At most one per diagram. A second one is a warning, and its entries are added to the first. - An unknown key or value is a warning, and the default is used. ### 19.2 Arrows: corners and direction **Corners.** With `rounded` (the default), every bend of an arrow is a quarter circle of radius 28, or half the shorter of its two pieces when that is less. A return drawn beside its arrow keeps the gap through the bend, so its corners are concentric with the arrow's: on the outside the radius grows by the gap, on the inside it shrinks. With `square`, every bend is a sharp right angle. Only arrows change; each shape keeps its own corners. Arrows that leave one point together, or reach one together (13.10), part in a wider curve, up to 60 px. A pill keeps clear of a bend as it is drawn, curve included (13.10). **Direction.** With `right` (the default), the flow runs from left to right: the layout puts each node to the right of the nodes that lead to it. With `down`, it runs from top to bottom. Everything that section 13.10 says about sides turns with it. A pill sits beside a vertical piece of its arrow, at its middle, as always (13.10). A journey reference arrived at from above points down, with its id tab above its top edge (18.4). The anchor rule (13.10) holds in both directions: one arrow on a side meets it in the middle, arrows of the same kind share one point, and a going arrow and a return sit a quarter of the side apart. ### 19.3 The color palette The palette is the last step of the color cascade (section 10.3): what a part is drawn in when no `color_*` key and no color block gives it a color. | Family | Line, icon circle and type name | Light fill (title bar, lid, ring, plate) | |---|---|---| | View | `#2563EB` | `#E8F0FE` | | Action | `#64748B` | none: the box is white | | Handoff | `#C2410C` | none: the box is white | | Data | `#0F766E` | `#D1FAE5` | | Actor, System | `#334155` | none: the band is the line color | | Start, End success | `#15803D` | `#DCFCE7` | | End failure | `#DC2626` | `#FEE2E2` | | End abandoned | `#6B7280` | `#F3F4F6` | | Journey reference | `#7C3AED` | none: the box is white | | Part | Color | |---|---| | Title | `#111827` | | Description | `#6B7280` | | Meta line, payload | bold `#4B5563` | | Id tab or badge | bold `#111827` text on the node's light tint, outlined in its frame color; white inside a view's title bar | | Arrow: navigation, negative, return | `#2563EB`, `#DC2626`, `#64748B` | | Label pill | white, outlined in the arrow's color, `#111827` text | | Warnings box | `#78350F` text on `#FFFBEB`, outlined `#F59E0B` | The flags have a color each, the same on every shape: | Flag | Color | Flag | Color | |---|---|---|---| | `idea` | `#CA8A04` | `experiment` | `#0F766E` | | `future` | `#7C3AED` | `risk` | `#DC2626` | | `not-implemented` | `#EA580C` | `security` | `#1D4ED8` | | `out-of-scope` | `#6B7280` | `needs-decision` | `#D97706` | | `deprecated` | `#92400E` | `needs-updates`, `legacy` | not designed yet (section 23) | ### 19.4 Black and white Every symbol must read without color. `colors: mono` draws the whole diagram in one ink: - every line, icon circle, flag tab and type name in `#111111`; - every light fill in `#EFEFEF`, every box body white; - titles in `#111111`, descriptions in `#555555`, meta lines and payloads bold `#444444`, id tabs and badges `#111111` on `#EFEFEF`, outlined `#111111`; - `color_*` keys and color blocks are ignored. Nothing else changes, because nothing depends on color: | What | Told apart in black and white by | |---|---| | The kind of node | its shape: title bar, icon circle, dashed box, cylinder, cut corners and band, ring, bullseye, pointed side | | The type of a node | its icon and its type name | | The kind of arrow | its line and head: solid with a filled head, the cross in a white disc, dashed with an open head | | A flag | its glyph in the tab; a dotted border or line | | Set or inherited | a filled tab or an outlined one | | The outcome of an end | its glyph, and the octagon for abandoned | ### 19.5 The legend `legend` adds a strip under the drawing that explains **only what this diagram uses**: each kind and type of node that appears (drawn small, with its type name), each kind of arrow (a failed return apart from the plain ones, as "Return after a failure"), and each flag, with its glyph, its name and its meaning from section 8. A journey that uses no flags shows no flags in its legend. ### 19.6 The header and the warnings - **The header**, above the drawing, shows the journey's title in bold, its id beside it, and its description under it. It is always drawn. - **The warnings box**, under the drawing (and under the legend), lists every warning of section 21 with its line and the handle it concerns. `warnings: hide` leaves the box out of the drawing; the warnings stay in the model. A warning about the drawing itself, a pill with no free place (13.10), is in the box only: the model does not depend on the layout. - **A syntax error** stops the drawing: PlantUML shows its usual error image, naming the line. No model is written. ### 19.7 Formats The module draws through PlantUML, so the formats are PlantUML's: `-tsvg` (the one to use, since it keeps the text as text), and `-tpng`. The model is a separate file (section 20). ### 19.8 Space along an arrow `arrow_spacing` is the room, in pixels, that the layout counts from a box to the text on its arrow, and from that text to the next box. In the `render` block it holds for every arrow; in an arrow's block, for that arrow. It sets how long an arrow is, not where its pill sits: that is the middle of a straight piece, as in every drawing (13.10). A pill that is squeezed in (13.10) can be nearer its box than that. ``` render { arrow_spacing: 10 } journey CHK "Checkout" view cart { title: "Cart" } view pay { title: "Payment" } view done { title: "Done" } cart --> pay : [Check out] { arrow_spacing: 40 } ' 40 px before the pill and after it pay --> done : [Pay] ' 10 px, as the render block says ``` | Value | Room | |---|---| | No key, or `default` | The layout's own: 70 px at least on each side of the arrow's text, 70 between two boxes on an arrow with no text. `default` draws exactly as no key does | | A number, `0` or more | That many pixels, `px` after it or not: `10`, `10px`, `7.5` | | `default` on an arrow | The layout's own 70, whatever the `render` block says. With no key, an arrow takes the `render` block's | - How the module counts this room and places pills along an arrow is in Appendix A.3, with the reasons an arrow can come out longer than its value. - **It sets room along the flow only.** Boxes stacked in one column stay 46 px apart. - A value that is not a number of `0` or more, or `default`, is a warning: the `render` block then uses the default, an arrow the `render` block's. - `arrow_spacing` is a drawing setting, like `point` and `id_position`: the model leaves it out (section 20). --- ## 20. The model The model is what tools read: every node and arrow with its meaning worked out. The module writes it beside the diagram file as `<name>.ujn.json` when PlantUML runs with `--ujn-model` (alias `-ujn_model`). It is described by the model schema, version 5 (`ujn-model-v5.schema.json`). It covers sections 1 to 21. Drawing settings stay out of it: the `render` block, a reference's `point`, a node's `id_position` and an arrow's `arrow_spacing`. A light Python parser is tested against this output. ### 20.1 Conventions - **Every key is always there.** A value that is not written is `null`, and a list that is not written is `[]`. The one exception is `extra`, present only when the text has keys the language does not define. - **Order is the order written**: nodes in the order of their statements, arrows in the order of theirs. - **Keys are camelCase**: `uniqueId`, `friendlyId`, `returnLabel`. - **Text is as written**, quotes removed, markup and `\n` kept. - **What the module works out** is in the model too, so no reader has to repeat it: assigned display ids, inherited flags, a view's effective behavior, arrow roles, colors after the cascade, and the warnings. - **What to key on.** Across versions of a file, a node is its `uniqueId`. Within one version, `key` (the handle) is enough. A display id (`id`) may change, so never key on it. ### 20.2 Top level | Key | Value | |---|---| | `language` | `"ujn-parts-1-4"`: it names sections 1 to 18, the ones that add model keys. Sections 19 to 21 add no model keys, so it does not change | | `journey` | the journey, 20.3 | | `nodes` | every node, 20.4 | | `arrows` | every arrow, 20.5 | | `warnings` | every warning, 20.6 | ### 20.3 The journey | Key | Value | From | |---|---|---| | `id`, `title` | text | the journey line (section 3) | | `description`, `context` | text or null | journey entries | | `trace`, `a11y` | lists | journey entries | | `uniqueId` | 11 hex digits or null | `unique_id` (section 7) | | `uniqueIdPending` | true while the text says `{{auto}}` | `unique_id` | | `friendlyNamespace` | text | `unique_id_friendly`, else the journey id in lowercase | ### 20.4 Nodes Every node has these keys: | Key | Value | From | |---|---|---| | `key` | the handle | the header line | | `kind` | `view`, `actor`, `system`, `action`, `handoff`, `data`, `start`, `end`, `ref` | the keyword | | `type` | the type, or the kind for an actor (`actor`) and a reference (`ref`) | `type`, else the default | | `title` | text | `title`, else the handle | | `id`, `idAssigned` | the display id or null; whether `increment` assigned it | `[ID]` or section 6 | | `uniqueId`, `uniqueIdPending` | as for the journey | `unique_id` | | `friendlyId` | `namespace.name` | section 7.4 | | `flags`, `inherited` | flags set here; delivery flags reaching it | `flags`; section 8 | | `description`, `context`, `tooltip` | text or null | section 9 | | `trace`, `a11y` | lists | section 9 | | `style` | `frame`, `icon`, `title`, `description`, `background`: the colors the text sets, after the cascade | section 10 | | `extra` | keys the language does not define, as written | section 4.4 | And, by kind: | Kind | Keys | |---|---| | `view` | `route`, `collapsed`, `parent`, `behavior` (the type's defaults merged with the overrides), `overrides` | | `actor` | `role` | | `system` | `host` | | `action` | `timeout`, `channel` | | `handoff` | `channel`, `timeout`, `resume` | | `data` | `location` | | `start` | `route` | | `end` | none | | `ref` | `journey` | ### 20.5 Arrows | Key | Value | From | |---|---|---| | `from`, `to` | handles | the arrow line | | `kind` | `navigation`, `negative`, `return` | the token; `.x.>` is a `return` | | `negative` | true or false | true for `-x->` and `.x.>`: a failure, going on or going back | | `role` | `exit`, `call`, `reply`, `resume`, `write`, `read` | the kinds of its two ends (14.8, 16.4) | | `trigger`, `guard` | text or null | the label | | `payload` | list | `payload` | | `returns`, `returnLabel` | whether a return is drawn for it; that return's label | `returns` | | `direction` | `right`, `left`, `up`, `down` or null | the token | | `flags`, `inherited` | flags set here; delivery flags from its source | `flags`; section 13.8 | | `trace`, `context`, `a11y`, `tooltip` | as for nodes | the block | | `style` | `line`, `text`, `background`, after the cascade | section 13.9 | | `extra` | as for nodes | the block | A return drawn from `returns` is not an arrow of its own: the arrow that carries `"returns": true` stands for both. ### 20.6 Warnings | Key | Value | |---|---| | `message` | what rule is broken, in words | | `handle` | the node or arrow it concerns (`from token to` for an arrow), or null | | `line` | the line in the diagram file, or null | A warning about the drawing itself, a pill with no free place (13.10), is not in the model: it depends on the layout, and the model does not. A diagram with a syntax error has no model: the error image is the only output. --- ## 21. Errors and warnings The module draws what it can. A **syntax error** stops the drawing and shows PlantUML's usual error image, naming the line. A **warning** lets the diagram draw and is listed in a box under it, with the rule and the node's handle (19.6). | Problem | Result | |---|---| | No `journey` line, or a node or arrow before it | syntax error | | A `key: value` line outside a block that is not directly under the journey line | syntax error | | A line that matches no statement; a block that is never closed | syntax error | | A node header without a handle (`view` alone) | syntax error | | Two nodes with the same handle, display id, unique id or friendly id | syntax error | | An arrow to a handle that no statement declares | syntax error | | `-populate_ids` with no file to write (`-pipe`, the server) | error; nothing written | | `-populate_ids` and a `{{auto}}` that a loop or a macro produced | error; nothing written | | `unique_id: {{auto}}` still in the file | warning with the command | | A `unique_id` that is neither `{{auto}}` nor 11 lowercase hex digits | warning | | A node with trace links and no `unique_id` | warning | | An unknown type, or `type` on an actor | warning; drawn with the default type | | A `point` that is not `auto`, `up`, `down`, `left` or `right` | warning; `auto` is used | | An `id_position` that is not `outside`, `inside`, `inside-top`, `inside-bottom` or `hidden` | warning; a node uses the `render` block's, the block `outside` | | An `arrow_spacing` that is not a number of `0` or more, or `default` | warning; an arrow uses the `render` block's, the block the default | | An unknown flag, or a flag written twice | warning; ignored | | An unknown key, or a key that does not apply to this keyword or type | warning; kept under `extra` | | A single-value key written twice | warning; the last one wins | | `parent:` naming a handle that is not a view | warning; ignored | | A value of the wrong kind (`collapsed: maybe`, `duration: soon`, `color_frame: blue-ish`) | warning; ignored | | Kinds that share a prefix with different starts | warning | | A second `increment` block | warning; its entries are added | | A reversed arrow (`b <-- a`) or an unknown arrow token | syntax error; the message says to write the source first | | An arrow block that is never closed | syntax error | | A navigation or negative exit from a view or an inline actor without a trigger | warning | | Two exits from one view or actor with the same trigger, one of them without a guard | warning | | A trigger on an exit from an action | warning | | An action with both guarded and unguarded exits | warning | | `returns` on an arrow into anything but a journey reference or a handoff | warning; nothing extra drawn | | The same arrow twice: same ends, kind, trigger and guard | warning; drawn once | | A key that does not apply to an arrow (`route`, `type`) | warning; kept under `extra` | | An action with a `timeout` and no exit guarded `timeout`, or an exit guarded `timeout` from an action without one | warning | | `timeout` or `channel` on an action type it does not apply to | warning; kept under `extra` | | A `fork` with a guarded exit, or a `join` with more than one exit | warning | | A trigger or a guard on a call into a system | warning | | An arrow into a system from anything but an action, or out of a system other than a `..>` reply to an action that calls it | warning | | A `-->` or `-x->` out of a handoff | warning | | A `returns` handoff with no way back, or a `no-return` handoff with one | warning | | An arrow between a data store and anything but an action, or a trigger or guard on a read or a write | warning | | An arrow into a start that comes neither from an actor nor, into a `handoff-return` start, from a handoff | warning | | A start with no exit, or an end with one | warning | | A handoff's `resume` that differs from the `route` of the start its resume arrow goes to | warning | | A reference without `journey`; an arrow out of a reference other than a `..>`, or with a trigger | warning | | A node that no path from a start reaches, in a journey with a start (actors and data stores aside) | warning | | An unknown key or value in `render` | warning; the default is used | | A second `render` block | warning; its entries are added | | A pill with no free place, after the layout was made again with more room along its arrow (13.10) | warning, in the drawing only: `no free place by the arrow for its label, which is drawn where it is least in the way`. The pill is drawn off its own line, where it covers the least of anything else | Every rule of sections 1 to 21 is in this table. --- ## 22. Grammar summary Informal; the schema and the module's grammar will be written from it. ``` diagram = "@startujn" NL { ( preproc | increment | colors | render ) NL } journey { NL line } NL "@endujn" journey = "journey" JOURNEY-ID STRING { NL KEY ":" value } (entries right under it) line = node | increment | colors | render | arrow | comment | empty node = KIND HANDLE [ "[" DISPLAY-ID "]" ] [ block ] KIND = "view" | "actor" | "system" | "action" | "handoff" | "data" | "start" | "end" | "ref" increment = "increment" block render = "render" block (keys: section 19.1) colors = ( KIND "_color" [ "_" TYPE ] | "arrow_color" [ "_" ARROW-KIND ] ) block (KIND here: every node kind) arrow = HANDLE TOKEN HANDLE [ ":" label ] [ block ] TOKEN = "-->" | "->" | "-x->" | "..>" | ".>" | ".x.>" | "-" DIR "->" | "-" DIR "-x->" | "." DIR ".>" | "." DIR ".x.>" DIR = "right" | "left" | "up" | "down" | "r" | "l" | "u" | "d" label = [ "[" TRIGGER "]" ] [ GUARD ] (TRIGGER: any text except "]") ARROW-KIND = "navigation" | "negative" | "return" block = [ NL ] "{" entry { ( ";" | NL ) entry } "}" entry = KEY [ ":" value ] (a key alone means true) value = text | list | BOOL | NUMBER | duration | color | HANDLE | trace-link | "{{auto}}" list = "[" [ item { "," item } ] "]" | item HANDLE = letter { letter | digit | "_" } not a keyword KEY = lower { lower | digit | "_" } TYPE, FLAG = lower { lower | digit | "-" } DISPLAY-ID = any characters except "]" JOURNEY-ID = ( letter | digit ) { letter | digit | "-" | "_" | "." } STRING = '"' { char | '\"' | "\" char } '"' "\n" breaks the line BOOL = "true" | "false" (any case) comment = a line starting with "'" | "/'" … "'/" | WS "'" … to the end of the line, outside quotes ``` --- ## 23. Still open These questions are still open. For each one, this spec states the current proposal, and that proposal holds until the question is settled. ### 23.1 Should a journey have a unique id of its own? About: 3, 7.1. Current proposal: The journey takes `unique_id`, as a node does, so other journeys and requirements can link to the journey as a whole. Other options: Drop `unique_id` from the journey. ### 23.2 Is there a pre-commit hook that enforces the `{{auto}}` rule? About: 7.3. Current proposal: Section 7.3 describes a git pre-commit hook that refuses staged `.puml` files that still contain `{{auto}}`, with the same message as the warning. It belongs in the repository that holds the diagrams. It is described but not written yet. ### 23.3 Does the `legacy` flag propagate? About: 8. Current proposal: `legacy` stays where it is set, like the review flags. Other options: It propagates, like the delivery flags. ### 23.4 What glyphs do the `legacy` and `needs-updates` flags get? About: 8. Current proposal: None yet. Both glyphs are still to be designed, along with the other shapes of the notation. What the module shows until then is in 23.28. ### 23.5 Should the meta line and the flag tabs get color keys? About: 10.1, 4.6. Current proposal: They have none. The color keys of 10.1 cover the outline, the type icon, the title, the description and the fill, and the outline of the display id follows `color_frame` (4.6). Other options: Color keys for the meta line and the flag tabs. ### 23.6 Is the default view type called `plain` or `normal`? About: 11.2, 17.2. Current proposal: `plain`, as used throughout this spec. The default start type takes the same name (17.2). Other options: `normal`. Both names have been used for it. ### 23.7 Are the default behaviors of each view type right? About: 11.4. Current proposal: The table of defaults per type in 11.4. It is a first proposal and is still to be reviewed type by type. ### 23.8 Should arrows have unique ids? About: 13.1, 7.1. Current proposal: Arrows have none. The model keys an arrow on its two ends and its label (13.1). Other options: A `unique_id` on arrows, as on nodes. A test may want to link to one transition. ### 23.9 Should `->` and `.>` mean the same as `-->` and `..>`? About: 13.2. Current proposal: Yes. PlantUML's shorter forms are accepted as synonyms, for people used to writing PlantUML. ### 23.10 Should a direction hint the layout cannot honor draw a warning? About: 13.3. Current proposal: No. A hint that stays a wish draws no warning. Other options: A warning. A warning would tell the designer that the layout could not honor the hint, but it would also fire on every sketch that hints freely. ### 23.11 Should an arrow that goes back, such as a retry, get a token of its own? About: 13.3. Current proposal: No. A navigation or a negative arrow that goes back takes a hint against the flow (`-left->` when the flow runs right, `-up->` when it runs down), which keeps it explicit. Other options: A token of its own for an arrow that goes back. A retry is common enough that it might deserve one. ### 23.12 How is a guard written? About: 13.4. Current proposal: The guard is the text after the trigger, to the end of the label: `[Sign in] valid credentials`. Other options: A keyword before the guard: `[Sign in] if valid credentials`. ### 23.13 Do arrows to and from a data store point the way the data moves? About: 13.5, 16.4. Current proposal: Yes. A write goes from the action into the store, and a read comes out of the store into the action (16.4). The alternative for reads is in 23.21. ### 23.14 Should the order of the statements steer the layout? About: 13.10. Current proposal: Yes. The layout reads the order of the statements as the direction of the journey, so an arrow to a node written later is expected to go with the flow. This makes the order in which the nodes are written matter for the drawing, not only the direction hints. Other options: Let only direction hints steer the layout. ### 23.15 How should fork and join bars be drawn? About: 14.2. Current proposal: As a bar with no icon and no title, across the direction of the layout: upright when the flow runs right, flat when it runs down. The title and the description are kept in the model. ### 23.16 Is a join that goes on at the first arrow needed too? About: 14.2, 14.4. Current proposal: A `join` waits for every arrow coming in. Its one exit is taken once all of them have arrived. Other options: Also a join that goes on as soon as the first arrow arrives. ### 23.17 Should `channel` be free text or a fixed list? About: 14.3, 15.3. Current proposal: Free text, such as `SMS`, `email` or `bank app`. Other options: A fixed list: `sms`, `email`, `push`, `idp`, `payment`. A fixed list would let a generator pick the integration. ### 23.18 May one action have both guarded and unguarded exits? About: 14.4, 13.5. Current proposal: Mixing them on one action is a warning. A fork after the guarded exit does the same job. Other options: Allow the mix: every unguarded exit fires, and one guarded exit fires as well. A requirement such as "send a notification and open the next screen" can be read this way. ### 23.19 Does a handoff need `resume` when a handoff-return start has a `route`? About: 15.3, 17.4. Current proposal: Keep both. When a resume arrow goes into a `handoff-return` start, the handoff's `resume` and the start's `route` say the same thing, and different values are a warning. Other options: Drop `resume`. ### 23.20 Should a data store have a default type? About: 16.2. Current proposal: Yes: `server-database`, the most common kind. Other options: Make `type` required on a store. ### 23.21 Which way does a read point? About: 16.4. Current proposal: The way the data moves, out of the store into the action, as in every drawing: `drafts --> load_draft`. Other options: Always away from the action, with `read` on the arrow: `load_draft --> drafts : read`. ### 23.22 Should the title of a start or an end be drawn? About: 17.3. Current proposal: No. The title is kept in the model. The plate under the ring or the bullseye draws the type name and the description, and the type name already says what the node is. ### 23.23 Should the reachability check apply only to journeys with a start? About: 17.5. Current proposal: Yes. The check applies only once a journey has at least one start, so a sketch without one draws without warnings. ### 23.24 How does a call to another journey come back somewhere else? About: 18.3. Current proposal: With `..>` arrows out of the journey reference, one for each outcome of the other journey that leads somewhere different. When there is more than one, a guard names each outcome: `registration ..> dashboard : registered`. This lets a call come back somewhere other than where it started. ### 23.25 Should the `render` settings also be command-line flags? About: 19.1. Current proposal: They are set in the `render` block. Other options: Command-line flags as well, such as `--ujn-mono`. The same file could then print in color and in black and white without an edit. ### 23.26 Should `corners: square` change the boxes too? About: 19.2. Current proposal: No. Square corners change only the arrows; each shape keeps its own corners. Other options: The boxes follow. ### 23.27 Should UJN have a dark palette? About: 19.3. Current proposal: There is none. This spec defines the color palette (19.3) and black and white (19.4). Other options: A dark palette for PlantUML's `--dark-mode` flag, or leaving dark backgrounds to `colors: mono` with a theme. ### 23.28 How are `legacy` and `needs-updates` told apart in black and white? About: 19.4, 19.3. Current proposal: Until their glyphs are designed (23.4), the module shows the letters L and U. In black and white only the glyph tells the flags apart, so these glyphs matter most there. ### 23.29 Should the legend be on by default? About: 19.5, 19.1. Current proposal: No. `legend` is `false` unless the `render` block turns it on. Other options: On by default. Every sample drawing has one. ## Appendix A. How the drawing is laid out How the module places what a journey says: routes, distances and pills. A writer sets none of it; it is here for people building a renderer and for anyone checking a drawing. ### A.1 A row of targets beside a node From section 13.3. Several hints across the flow to the same side of a node put their targets in a row on that side, in the order the arrows are written, the row centered on the node. Each arrow leaves the node from a lane of its own, and so does each return drawn beside one (13.7), on the right of its arrow's travel; the lanes are spread about the middle of the side, at most 16 px apart, in the order of the targets. An arrow whose lanes face its target runs straight; the others turn toward the middle of their target, the farthest first, each a step further out than the one before, a return one lane from its arrow. So no two cross. On a side too short for a lane each (a fork bar's end, the plate of a start), arrows with no return fan out from its middle (13.10). The top of a start or an end is its ring: the lanes meet it there. The row stands far enough off for the pills and for an arrowhead past the last turn; with labeled returns, for two pills one after the other between two targets, and with room for a pill past each end of the row. Above or below a node, a pill that fits on no longer piece sits beside the last piece of its arrow; a short pill of an arrow that turns sits at the piece that runs across: over it, or on the outside of the pair when a return is drawn beside the arrow (13.10). In a row below a node that place is 4 px under the node's box: where the middle of the piece lies under the box, the pill sits beside the last piece instead. The targets stand far enough apart for a pill beside a last piece, past the return drawn beside the next arrow too, and a lone target keeps that room beside its line. ### A.2 Placing pills and picking a layout From section 13.10. **Where a pill goes.** The same in every drawing, with `arrow_spacing` (19.8) or without it: - **At the middle of a straight piece.** A straight piece is a straight part of the line as it is drawn: from a box to the first rounded corner, or from one corner to the next (19.2). On a straight arrow the pill sits at the middle of the arrow. On an arrow that bends, it sits at the middle of the longest straight piece it fits on. Its flag tabs count as part of it. - **On its side of the line.** Over a horizontal piece; beside a vertical one, right of it first, or for an arrow of a row above or below a node (13.3) the side the layout kept room on. An arrow and the return drawn beside it (13.7) keep their pills on the two outsides of the pair: the arrow's over it, the return's under its own line, when the arrow runs right. Past the other line of its pair a pill reads as that line's label. It goes there only when none of its places on its own side keeps 2 px from everything else, and the layout is then made again with more room first, as for a pill with no place; it draws no warning. The label of a return drawn inside a loop back to its own node has no other side than past the loop's line: it stands there, and no layout is made again for it. - **The payload goes with it** (13.6): under the line below the pill, past a return that runs there; under the pill beside a vertical piece. A payload with no pill takes the pill's place. - **A payload and the label of the return under it** stand side by side under the return, as one group about the middle of the arrow's pill: the payload toward the arrow's source, the return's label toward the return's, 8 px apart, or less, down to 3 px, where the return's label would otherwise reach past the end of its piece. A return's label counts with its own payload, which is centered under its pill. The arrow's label is placed first. Where the piece has no room for the group, or the arrow's pill is itself squeezed in (an arrow of the exact length with an `arrow_spacing` under 5), the payload stays under its pill and the return's label takes the nearest free place. Where the return's label does not come to stand beside the payload, the payload goes back under its pill when that place is free; when it is not, the arrow's label is placed again as one without a group, where it then has a place on its own line. Under the cross of a failed return, the payload is 7 px lower. - **A pill overlaps nothing:** not the line, a rounded corner or the head of another arrow, not a box, an id tab or a flag tab, not the cross of a failure, not a payload, not another pill. It keeps 4 px from each of them where it can, and 6 px from its own line (its flag tabs 5 px), and it leaves the last 12 px of its arrow to the head. Where no place is free at 4 px, it takes one that keeps 3 px, then 2, then 1, with no warning. - **Not over a shared stretch.** Where arrows leave one point together, or reach one together, no pill sits over the stretch they share: nobody could tell whose it is. - **Where the middle is taken,** the pill takes the free place nearest the middle of a piece it fits on, the longer piece first, then the same on the other side of the line. Within an eighth of a piece from its middle, 12 px at least, a place still counts as the middle. - **At a cross.** The cross of a failure sits at the middle of the longest straight piece, so its pill sits a cross's radius further from the line there. When an arrow and the return beside it both have a cross, each cross sits 8 px back from the middle, so the two do not meet. - **A pill that fits on no piece, or finds no free place on the pieces it fits on,** is squeezed in: on any piece, also one shorter than itself (a long label on a short hop, a loop back to its own node), as near as 2 px to its box, and also over a shared stretch. On a piece shorter than the label with its payload it has one place: the middle of the piece, or off the box at the start of the line, or short of the head's room at its end. - **Beside a bend.** After that, a pill goes beside a piece it does not fit on, as that piece would be with square corners, where it is still by its own line: over a piece that runs across, the middle of the pill is no further than 14 px from its line; beside one that runs up or down, its near end is. Never along a stretch shared with another arrow. A loop back to its own node is small, so there any part of the pill within 14 px will do: of two loops on one node, one pill stands over the outer loop and the other beside the loops. For such a place the layout is made again with more room first, as for a pill with no place, but it draws no warning. - **The order of the places.** On its own line first: a piece it fits on, then squeezed, each with 4 px and with 3; then both with 2. Then past the other line of its pair, with 4 px and with 3; then beside a bend, with 4, 3 and 2; then past the other line with 2. Last, each of these with 1 px. One exception: the pill of a loop back to its own node that has a `returns` label too goes beside the loop, with 4 px or 3, before it takes a place on the loop with 2. The top of the loop is the one place of that label. - **At the edge of the drawing,** the drawing grows for a pill that reaches past it. - **Where no place is free,** the layout is made again with more room along that arrow: as much again as its text, 40 px at least, and twice that along an arrow that runs up or down with a labeled return beside it, where the two labels can come to stand one over the other. Of the layouts made, the one that leaves the fewest pills without a place is kept; of those, the one with the fewest pills past their pair's other line or beside a bend; of those, the one with the fewest pills only 1 px from something; the first on a tie. A pill that still has no place is drawn anyway, off its own line and where it covers the least of anything else. That can be a free place beside a bend of its line with only an end of the pill near the line, or along a stretch shared with another arrow. The drawing gets a warning that names the arrow and its line (19.6, section 21): `no free place by the arrow for its label, which is drawn where it is least in the way`. The pill with the least room is placed first. Within the rules of 13.10 a journey can still be drawn many ways, and the layout engine's first try is not always the clearest. So the layout draws it a few ways (with the arriving or the leaving arrows first where the anchor rule leaves the choice open) and keeps the one with the least of these, weighed roughly in this order: 1. an arrow drawn against the flow toward a node written later than its source: it reads backward; 2. a crossing; 3. a stretch of two arrows on top of each other, beyond the shared start of a fan; 4. length. ### A.3 Space along an arrow From section 19.8. - **The text** is the pill with its flag tabs, the payload where it is wider, and the pill of a return drawn beside the arrow (13.7); a payload and a return's pill stand side by side under the return, so there the two count together, with the 8 px between them; the return's own payload counts where it is wider than its pill. Beside an arrow that runs up or down, the payload under the pill counts too. An arrow with no text has the room between its two boxes. - **The arrowhead keeps its room.** On the side of the pill toward the target the room is never less than 12 px, so `0` puts the pill against the source and the head between the pill and the target. A payload and a return's label side by side (13.10) stand in the middle of the arrow instead: at `0` they are 6 px from each box, about 8 px where the return's own payload is the wider. Where the arrow's pill is wider than the two together, the pill sits against the source as usual, the payload under it and the return's label beside the payload. - **An id tab in the gap counts as part of its box.** In a flow that runs down, the tab under a box (or over a reference that points down) hangs into the gap below it, so the room counts from the tab. The same holds above and below a source with hints across the flow (13.3). - **Arrows side by side share the room.** The layout puts nodes in columns, and the arrows between two columns share the room between them: the one that asks for the most sets it, so there an arrow's own value is the least it gets. An arrow on its own gets its value within a pixel, for a plain pill and a whole number of pixels: a value such as `7.5` counts as 8, flag tabs count 2 px more than they are drawn, and a payload wider than its pill 2 px on each side. - **The layout is pulled together.** With any `arrow_spacing` set, nodes are placed so that connected ones line up, arrows are shortened after routing, and the channels where arrows bend between columns are no wider than the spacing. So an arrow between neighbors comes out at its spacing, its text and the head's room, within a pixel. Where that leaves some pill no free place, or only one past the other line of its pair or beside a bend (13.10), the layout is made again with more room along its arrow, then without pulling it together, then both; which of them is kept is in 13.10. An arrow of such a pill can come out longer than its spacing asks. A file without the key is never pulled together; its pills follow the same rule all the same. - **The pill sits at the middle, as in every drawing** (13.10). On an arrow longer than it asks for, because its columns are shared or its route bends, the room left over is line on both sides of the pill. Only the head's 12 px stay where they are, at the end of the arrow: so on an arrow that asks for less than 12, the pill sits its value from the source. - **Some arrows stay long.** An arrow between nodes the layout keeps apart, a column or more between them or one far above the other, is as long as their places make it: its pill sits at the middle of its longest straight piece, and the rest is line on both sides. - **An arrow with no text** asks for its value, 12 px at least for its head. It comes out at the smallest room any arrow asks for, or at twice that or more (the layout gives it a column of its own); a value between the two comes out as the nearer. So with `arrow_spacing: 10` everywhere and other arrows that carry text, it gets 10; as the only arrow it gets 12. - **Hints across the flow** (13.3): a lone target beside its source is that far off, plus its pill and the head's room. The arrows of a row turn, and a pill that fits on no longer piece sits beside its last piece, so a row keeps at least the room a pill needs there.