Compare commits
	
		
			6 Commits
		
	
	
		
			v0.2.0
			...
			3eadf63db3
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 3eadf63db3 | |||
| e57e617bb9 | |||
| dfb980e366 | |||
| 3beaad03d4 | |||
| 5cb8f50f2a | |||
| e8d737ff00 | 
| @@ -1,5 +1,18 @@ | |||||||
| #import "example.typ": example | #import "example.typ": example | ||||||
|  |  | ||||||
|  | #let seq-return = example(``` | ||||||
|  | _seq( | ||||||
|  |   "Bob", "Alice", | ||||||
|  |   comment: [hello], | ||||||
|  |   enable-dst: true | ||||||
|  | ) | ||||||
|  | _seq( | ||||||
|  |   "Alice", "Alice", | ||||||
|  |   comment: [some action] | ||||||
|  | ) | ||||||
|  | _ret(comment: [bye]) | ||||||
|  | ```) | ||||||
|  |  | ||||||
| #let seq-comm-align = example(``` | #let seq-comm-align = example(``` | ||||||
| _par("p1", display-name: "Start participant") | _par("p1", display-name: "Start participant") | ||||||
| _par("p2", display-name: "End participant") | _par("p2", display-name: "End participant") | ||||||
| @@ -121,15 +134,58 @@ _sync({ | |||||||
| }) | }) | ||||||
| ```) | ```) | ||||||
|  |  | ||||||
| #let gaps-seps = example(``` | #let gaps = example(``` | ||||||
| _par("alice", display-name: "Alice") | _par("a", display-name: "Alice") | ||||||
| _par("bob", display-name: "Bob") | _par("b", display-name: "Bob") | ||||||
|  |  | ||||||
| _seq("alice", "bob", comment: "Hello") | _seq("a", "b", comment: [message 1]) | ||||||
| _gap(size: 10) | _seq("b", "a", comment: [ok], dashed: true) | ||||||
| _seq("bob", "alice", comment: "Hi") | _gap() | ||||||
| _sep("Another day") | _seq("a", "b", comment: [message 2]) | ||||||
| _seq("alice", "bob", comment: "Hello again") | _seq("b", "a", comment: [ok], dashed: true) | ||||||
|  | _gap(size: 40) | ||||||
|  | _seq("a", "b", comment: [message 3]) | ||||||
|  | _seq("b", "a", comment: [ok], dashed: true) | ||||||
|  | ```) | ||||||
|  |  | ||||||
|  | #let seps = example(``` | ||||||
|  | _par("a", display-name: "Alice") | ||||||
|  | _par("b", display-name: "Bob") | ||||||
|  |  | ||||||
|  | _sep[Initialization] | ||||||
|  | _seq("a", "b", comment: [Request 1]) | ||||||
|  | _seq( | ||||||
|  |   "b", "a", | ||||||
|  |   comment: [Response 1], | ||||||
|  |   dashed: true | ||||||
|  | ) | ||||||
|  |  | ||||||
|  | _sep[Repetition] | ||||||
|  | _seq("a", "b", comment: [Request 2]) | ||||||
|  | _seq( | ||||||
|  |   "b", "a", | ||||||
|  |   comment: [Response 2], | ||||||
|  |   dashed: true | ||||||
|  | ) | ||||||
|  | ```) | ||||||
|  |  | ||||||
|  | #let delays = example(``` | ||||||
|  | _par("a", display-name: "Alice") | ||||||
|  | _par("b", display-name: "Bob") | ||||||
|  |  | ||||||
|  | _seq("a", "b", comment: [Auth Request]) | ||||||
|  | _delay() | ||||||
|  | _seq( | ||||||
|  |   "b", "a", | ||||||
|  |   comment: [Auth Response], | ||||||
|  |   dashed: true | ||||||
|  | ) | ||||||
|  | _delay(name: [5 minutes later]) | ||||||
|  | _seq( | ||||||
|  |   "b", "a", | ||||||
|  |   comment: [Good Bye !], | ||||||
|  |   dashed: true | ||||||
|  | ) | ||||||
| ```) | ```) | ||||||
|  |  | ||||||
| #let notes-shapes = example(``` | #let notes-shapes = example(``` | ||||||
|   | |||||||
| @@ -1,8 +1,15 @@ | |||||||
| /// Creates a gap before the next element |  | ||||||
| /// - size (int): Size of the gap |  | ||||||
| #let _gap(size: 20) = {} |  | ||||||
|  |  | ||||||
| /// Creates a separator before the next element | /// Creates a separator before the next element | ||||||
| /// #examples.gaps-seps | /// #examples.seps | ||||||
| /// - name (content): Name to display in the middle of the separator | /// - name (content): Name to display in the middle of the separator | ||||||
| #let _sep(name) = {} | #let _sep(name) = {} | ||||||
|  |  | ||||||
|  | /// Creates a delay before the next element | ||||||
|  | /// #examples.delays | ||||||
|  | /// - name (content, none): Name to display in the middle of the delay area | ||||||
|  | /// - size (int): Size of the delay | ||||||
|  | #let _delay(name: none, size: 30) = {} | ||||||
|  |  | ||||||
|  | /// Creates a gap before the next element | ||||||
|  | /// #examples.gaps | ||||||
|  | /// - size (int): Size of the gap | ||||||
|  | #let _gap(size: 20) = {} | ||||||
| @@ -42,6 +42,17 @@ | |||||||
|   slant: none |   slant: none | ||||||
| ) = {} | ) = {} | ||||||
|  |  | ||||||
|  | /// Creates a return sequence | ||||||
|  | /// #examples.seq-return | ||||||
|  | /// - comment (none, content): Optional comment to display along the arrow | ||||||
|  | #let _ret(comment: none) = {} | ||||||
|  |  | ||||||
|  | /// Accepted values for `comment-align` argument of @@_seq() | ||||||
|  | /// #examples.seq-comm-align | ||||||
|  | #let comment-align = ( | ||||||
|  |   "start", "end", "left", "center", "right" | ||||||
|  | ) | ||||||
|  |  | ||||||
| /// Accepted values for `event` argument of @@_evt() | /// Accepted values for `event` argument of @@_evt() | ||||||
| ///  | ///  | ||||||
| /// `EVENTS = ("create", "destroy", "enable", "disable")` | /// `EVENTS = ("create", "destroy", "enable", "disable")` | ||||||
| @@ -52,9 +63,3 @@ | |||||||
| #let tips = ( | #let tips = ( | ||||||
|   "", ">", ">>", "\\", "\\\\", "/", "//", "x", "o", |   "", ">", ">>", "\\", "\\\\", "/", "//", "x", "o", | ||||||
| ) | ) | ||||||
|  |  | ||||||
| /// Accepted values for `comment-align` argument of @@_seq() |  | ||||||
| /// #examples.seq-comm-align |  | ||||||
| #let comment-align = ( |  | ||||||
|   "start", "end", "left", "center", "right" |  | ||||||
| ) |  | ||||||
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							| Before Width: | Height: | Size: 13 KiB After Width: | Height: | Size: 12 KiB | 
										
											Binary file not shown.
										
									
								
							| Before Width: | Height: | Size: 92 KiB After Width: | Height: | Size: 88 KiB | 
										
											Binary file not shown.
										
									
								
							| Before Width: | Height: | Size: 24 KiB After Width: | Height: | Size: 22 KiB | 
							
								
								
									
										
											BIN
										
									
								
								manual.pdf
									
									
									
									
									
								
							
							
						
						
									
										
											BIN
										
									
								
								manual.pdf
									
									
									
									
									
								
							
										
											Binary file not shown.
										
									
								
							| @@ -197,7 +197,7 @@ chronos.diagram({ | |||||||
|     examples: examples |     examples: examples | ||||||
|   ) |   ) | ||||||
| ) | ) | ||||||
| #tidy.show-module(gap-sep-docs, show-outline: false) | #tidy.show-module(gap-sep-docs, show-outline: false, sort-functions: none) | ||||||
|  |  | ||||||
| #pagebreak(weak: true) | #pagebreak(weak: true) | ||||||
|  |  | ||||||
|   | |||||||
| @@ -46,7 +46,6 @@ | |||||||
|   while i < elmts.len() { |   while i < elmts.len() { | ||||||
|     let elmt = elmts.at(i) |     let elmt = elmts.at(i) | ||||||
|     if elmt.type == "grp" { |     if elmt.type == "grp" { | ||||||
|       let grp-elmts = elmt.elmts |  | ||||||
|       elmt.elmts = elmt.elmts.map(e => { |       elmt.elmts = elmt.elmts.map(e => { | ||||||
|         if e.type == "seq" { |         if e.type == "seq" { | ||||||
|           if e.p1 == "?" { |           if e.p1 == "?" { | ||||||
| @@ -60,12 +59,17 @@ | |||||||
|       elmts.at(i) = elmt |       elmts.at(i) = elmt | ||||||
|       elmts = ( |       elmts = ( | ||||||
|         elmts.slice(0, i + 1) + |         elmts.slice(0, i + 1) + | ||||||
|         grp-elmts + |         elmt.elmts + | ||||||
|         (( |         (( | ||||||
|           type: "grp-end" |           type: "grp-end", | ||||||
|  |           start-i: i | ||||||
|         ),) + |         ),) + | ||||||
|         elmts.slice(i+1) |         elmts.slice(i+1) | ||||||
|       ) |       ) | ||||||
|  |     } else if elmt.type == "grp-end" { | ||||||
|  |       // Put back elements in group because they might have changed | ||||||
|  |       elmts.at(elmt.start-i).elmts = elmts.slice(elmt.start-i + 1, i) | ||||||
|  |  | ||||||
|     } else if elmt.type == "seq" { |     } else if elmt.type == "seq" { | ||||||
|       if elmt.enable-dst { |       if elmt.enable-dst { | ||||||
|         activation-history.push(elmt) |         activation-history.push(elmt) | ||||||
|   | |||||||
| @@ -1,4 +1,4 @@ | |||||||
| #import "@preview/cetz:0.3.1": draw | #import "@preview/cetz:0.3.3": draw | ||||||
| #import "consts.typ": * | #import "consts.typ": * | ||||||
|  |  | ||||||
| #let _grp(name, desc: none, type: "default", elmts) = { | #let _grp(name, desc: none, type: "default", elmts) = { | ||||||
|   | |||||||
| @@ -1,4 +1,4 @@ | |||||||
| #import "@preview/cetz:0.3.1": draw | #import "@preview/cetz:0.3.3": draw | ||||||
| #import "consts.typ": * | #import "consts.typ": * | ||||||
|  |  | ||||||
| #let SIDES = ( | #let SIDES = ( | ||||||
|   | |||||||
| @@ -1,4 +1,4 @@ | |||||||
| #import "@preview/cetz:0.3.1": draw | #import "@preview/cetz:0.3.3": draw | ||||||
| #import "consts.typ": * | #import "consts.typ": * | ||||||
|  |  | ||||||
| #let PAR-SPECIALS = "?[]" | #let PAR-SPECIALS = "?[]" | ||||||
|   | |||||||
| @@ -1,4 +1,4 @@ | |||||||
| #import "@preview/cetz:0.3.1": canvas, draw | #import "@preview/cetz:0.3.3": canvas, draw | ||||||
| #import "utils.typ": get-participants-i, get-style, normalize-units | #import "utils.typ": get-participants-i, get-style, normalize-units | ||||||
| #import "group.typ" | #import "group.typ" | ||||||
| #import "participant.typ" | #import "participant.typ" | ||||||
|   | |||||||
| @@ -1,4 +1,4 @@ | |||||||
| #import "@preview/cetz:0.3.1": draw | #import "@preview/cetz:0.3.3": draw | ||||||
| #import "consts.typ": * | #import "consts.typ": * | ||||||
|  |  | ||||||
| #let _sep(name) = { | #let _sep(name) = { | ||||||
|   | |||||||
| @@ -1,4 +1,4 @@ | |||||||
| #import "@preview/cetz:0.3.1": draw, vector | #import "@preview/cetz:0.3.3": draw, vector | ||||||
| #import "consts.typ": * | #import "consts.typ": * | ||||||
| #import "participant.typ" | #import "participant.typ" | ||||||
| #import "note.typ" | #import "note.typ" | ||||||
|   | |||||||
| @@ -36,6 +36,9 @@ | |||||||
|       max-i = calc.max(max-i, i1) |       max-i = calc.max(max-i, i1) | ||||||
|     } |     } | ||||||
|   } |   } | ||||||
|  |   if max-i < min-i { | ||||||
|  |     (min-i, max-i) = (max-i, min-i) | ||||||
|  |   } | ||||||
|   return (min-i, max-i) |   return (min-i, max-i) | ||||||
| } | } | ||||||
|  |  | ||||||
|   | |||||||
| @@ -1,7 +1,7 @@ | |||||||
| [package] | [package] | ||||||
| name = "chronos" | name = "chronos" | ||||||
| version = "0.2.0" | version = "0.2.1" | ||||||
| compiler = "0.12.0" | compiler = "0.13.0" | ||||||
| repository = "https://git.kb28.ch/HEL/chronos" | repository = "https://git.kb28.ch/HEL/chronos" | ||||||
| entrypoint = "src/lib.typ" | entrypoint = "src/lib.typ" | ||||||
| authors = [ | authors = [ | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user