Compare commits
	
		
			8 Commits
		
	
	
		
			v0.2.1
			...
			e1a5b0b431
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| e1a5b0b431 | |||
| cdfdd96966 | |||
| 5e70e5179f | |||
| 000813ff3b | |||
| f94c6f25a2 | |||
| d1a44d0b0f | |||
| 1b8c40d70d | |||
| b9c19ac730 | 
| @@ -15,7 +15,7 @@ This package lets you render sequence diagrams directly in Typst. The following | |||||||
| <td> | <td> | ||||||
|  |  | ||||||
| ```typst | ```typst | ||||||
| #import "@preview/chronos:0.2.1" | #import "@preview/chronos:0.2.2" | ||||||
| #chronos.diagram({ | #chronos.diagram({ | ||||||
|   import chronos: * |   import chronos: * | ||||||
|   _par("Alice") |   _par("Alice") | ||||||
|   | |||||||
| @@ -34,6 +34,7 @@ | |||||||
| /// - invisible (bool): If set to true, the participant will not be shown | /// - invisible (bool): If set to true, the participant will not be shown | ||||||
| /// - shape (str): The shape of the participant. Possible values in @@SHAPES | /// - shape (str): The shape of the participant. Possible values in @@SHAPES | ||||||
| /// - color (color): The participant's color | /// - color (color): The participant's color | ||||||
|  | /// - line-stroke (stroke): The participant's line style (defaults to a light gray dashed line) | ||||||
| /// - custom-image (none, image): If shape is 'custom', sets the custom image to display | /// - custom-image (none, image): If shape is 'custom', sets the custom image to display | ||||||
| /// - show-bottom (bool): Whether to display the bottom shape | /// - show-bottom (bool): Whether to display the bottom shape | ||||||
| /// - show-top (bool): Whether to display the top shape | /// - show-top (bool): Whether to display the top shape | ||||||
| @@ -45,6 +46,11 @@ | |||||||
|   invisible: false, |   invisible: false, | ||||||
|   shape: "participant", |   shape: "participant", | ||||||
|   color: rgb("#E2E2F0"), |   color: rgb("#E2E2F0"), | ||||||
|  |   line-stroke: ( | ||||||
|  |     dash: "dashed", | ||||||
|  |     paint: gray.darken(40%), | ||||||
|  |     thickness: .5pt | ||||||
|  |   ), | ||||||
|   custom-image: none, |   custom-image: none, | ||||||
|   show-bottom: true, |   show-bottom: true, | ||||||
|   show-top: true, |   show-top: true, | ||||||
|   | |||||||
							
								
								
									
										8
									
								
								justfile
									
									
									
									
									
								
							
							
						
						
									
										8
									
								
								justfile
									
									
									
									
									
								
							| @@ -9,4 +9,10 @@ manual: | |||||||
|  |  | ||||||
| gallery: | gallery: | ||||||
|   for f in "{{gallery_dir}}"/*.typ; do typst c --root . "$f" "${f%typ}pdf"; done |   for f in "{{gallery_dir}}"/*.typ; do typst c --root . "$f" "${f%typ}pdf"; done | ||||||
|   for f in "{{gallery_dir}}"/readme/*.typ; do typst c --root . "$f" "${f%typ}png"; done |   for f in "{{gallery_dir}}"/readme/*.typ; do typst c --root . "$f" "${f%typ}png"; done | ||||||
|  |  | ||||||
|  | test *filter: | ||||||
|  |   tt run {{filter}} | ||||||
|  |  | ||||||
|  | update-test *filter: | ||||||
|  |   tt update {{filter}} | ||||||
							
								
								
									
										
											BIN
										
									
								
								manual.pdf
									
									
									
									
									
								
							
							
						
						
									
										
											BIN
										
									
								
								manual.pdf
									
									
									
									
									
								
							
										
											Binary file not shown.
										
									
								
							| @@ -71,7 +71,7 @@ $import | |||||||
|  |  | ||||||
| = Examples | = Examples | ||||||
|  |  | ||||||
| You can find the following examples and more in the #link("https://git.kb28.ch/HEL/circuiteria/src/branch/main/gallery")[gallery] directory | You can find the following examples and more in the #link("https://git.kb28.ch/HEL/chronos/src/branch/main/gallery")[gallery] directory | ||||||
|  |  | ||||||
| == Some groups and sequences | == Some groups and sequences | ||||||
|  |  | ||||||
|   | |||||||
							
								
								
									
										1
									
								
								src/cetz.typ
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								src/cetz.typ
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1 @@ | |||||||
|  | #import "@preview/cetz:0.3.4": * | ||||||
| @@ -1,4 +1,4 @@ | |||||||
| #let version = version(0, 2, 1) | #let version = version(0, 2, 2) | ||||||
| #import "diagram.typ": diagram, from-plantuml, _gap, _evt, _col | #import "diagram.typ": diagram, from-plantuml, _gap, _evt, _col | ||||||
|  |  | ||||||
| #import "sequence.typ": _seq, _ret | #import "sequence.typ": _seq, _ret | ||||||
|   | |||||||
| @@ -22,6 +22,11 @@ | |||||||
|   invisible: false, |   invisible: false, | ||||||
|   shape: "participant", |   shape: "participant", | ||||||
|   color: DEFAULT-COLOR, |   color: DEFAULT-COLOR, | ||||||
|  |   line-stroke: ( | ||||||
|  |     dash: "dashed", | ||||||
|  |     paint: gray.darken(40%), | ||||||
|  |     thickness: .5pt | ||||||
|  |   ), | ||||||
|   custom-image: none, |   custom-image: none, | ||||||
|   show-bottom: true, |   show-bottom: true, | ||||||
|   show-top: true, |   show-top: true, | ||||||
| @@ -37,6 +42,7 @@ | |||||||
|     invisible: invisible, |     invisible: invisible, | ||||||
|     shape: shape, |     shape: shape, | ||||||
|     color: color, |     color: color, | ||||||
|  |     line-stroke: line-stroke, | ||||||
|     custom-image: custom-image, |     custom-image: custom-image, | ||||||
|     show-bottom: show-bottom, |     show-bottom: show-bottom, | ||||||
|     show-top: show-top |     show-top: show-top | ||||||
|   | |||||||
| @@ -432,11 +432,7 @@ | |||||||
|             draw.line( |             draw.line( | ||||||
|               (x, last-y), |               (x, last-y), | ||||||
|               (x, line.at(1)), |               (x, line.at(1)), | ||||||
|               stroke: ( |               stroke: p.line-stroke | ||||||
|                 dash: "dashed", |  | ||||||
|                 paint: gray.darken(40%), |  | ||||||
|                 thickness: .5pt |  | ||||||
|               ) |  | ||||||
|             ) |             ) | ||||||
|           } |           } | ||||||
|           lines.push(line) |           lines.push(line) | ||||||
| @@ -462,11 +458,7 @@ | |||||||
|           draw.line( |           draw.line( | ||||||
|             (x, last-y), |             (x, last-y), | ||||||
|             (x, line.at(1)), |             (x, line.at(1)), | ||||||
|             stroke: ( |             stroke: p.line-stroke | ||||||
|               dash: "dashed", |  | ||||||
|               paint: gray.darken(40%), |  | ||||||
|               thickness: .5pt |  | ||||||
|             ) |  | ||||||
|           ) |           ) | ||||||
|           last-y = line.at(1) |           last-y = line.at(1) | ||||||
|         } else if event == "delay-end" { |         } else if event == "delay-end" { | ||||||
| @@ -486,11 +478,7 @@ | |||||||
|       draw.line( |       draw.line( | ||||||
|         (x, last-y), |         (x, last-y), | ||||||
|         (x, y), |         (x, y), | ||||||
|         stroke: ( |         stroke: p.line-stroke | ||||||
|           dash: "dashed", |  | ||||||
|           paint: gray.darken(40%), |  | ||||||
|           thickness: .5pt |  | ||||||
|         ) |  | ||||||
|       ) |       ) | ||||||
|  |  | ||||||
|       // Draw lifeline rectangles (reverse for bottom to top) |       // Draw lifeline rectangles (reverse for bottom to top) | ||||||
|   | |||||||
							
								
								
									
										4
									
								
								tests/empty/.gitignore
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										4
									
								
								tests/empty/.gitignore
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,4 @@ | |||||||
|  | # generated by tytanic, do not edit | ||||||
|  |  | ||||||
|  | diff/** | ||||||
|  | out/** | ||||||
							
								
								
									
										
											BIN
										
									
								
								tests/empty/ref/1.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								tests/empty/ref/1.png
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							| After Width: | Height: | Size: 105 B | 
							
								
								
									
										6
									
								
								tests/empty/test.typ
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										6
									
								
								tests/empty/test.typ
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,6 @@ | |||||||
|  | #set page(width: auto, height: auto) | ||||||
|  | #import "/src/lib.typ": * | ||||||
|  |  | ||||||
|  | #diagram({}) | ||||||
|  |  | ||||||
|  | #diagram(()) | ||||||
							
								
								
									
										4
									
								
								tests/participant/shapes/.gitignore
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										4
									
								
								tests/participant/shapes/.gitignore
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,4 @@ | |||||||
|  | # generated by tytanic, do not edit | ||||||
|  |  | ||||||
|  | diff/** | ||||||
|  | out/** | ||||||
							
								
								
									
										
											BIN
										
									
								
								tests/participant/shapes/ferris.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								tests/participant/shapes/ferris.png
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							| After Width: | Height: | Size: 25 KiB | 
							
								
								
									
										
											BIN
										
									
								
								tests/participant/shapes/gitea.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								tests/participant/shapes/gitea.png
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							| After Width: | Height: | Size: 17 KiB | 
							
								
								
									
										
											BIN
										
									
								
								tests/participant/shapes/me.jpg
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								tests/participant/shapes/me.jpg
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							| After Width: | Height: | Size: 530 KiB | 
							
								
								
									
										
											BIN
										
									
								
								tests/participant/shapes/ref/1.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								tests/participant/shapes/ref/1.png
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							| After Width: | Height: | Size: 102 KiB | 
							
								
								
									
										21
									
								
								tests/participant/shapes/test.typ
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										21
									
								
								tests/participant/shapes/test.typ
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,21 @@ | |||||||
|  | #set page(width: auto, height: auto) | ||||||
|  | #import "/src/lib.typ": * | ||||||
|  |  | ||||||
|  |  | ||||||
|  | #let TYPST = image("typst.png", width: 1.5cm, height: 1.5cm, fit: "contain") | ||||||
|  | #let FERRIS = image("ferris.png", width: 1.5cm, height: 1.5cm, fit: "contain") | ||||||
|  | #let ME = image("me.jpg", width: 1.5cm, height: 1.5cm, fit: "contain") | ||||||
|  |  | ||||||
|  | #diagram({ | ||||||
|  |   _par("Foo", display-name: "Participant", shape: "participant") | ||||||
|  |   _par("Foo1", display-name: "Actor", shape: "actor") | ||||||
|  |   _par("Foo2", display-name: "Boundary", shape: "boundary") | ||||||
|  |   _par("Foo3", display-name: "Control", shape: "control") | ||||||
|  |   _par("Foo4", display-name: "Entity", shape: "entity") | ||||||
|  |   _par("Foo5", display-name: "Database", shape: "database") | ||||||
|  |   _par("Foo6", display-name: "Collections", shape: "collections") | ||||||
|  |   _par("Foo7", display-name: "Queue", shape: "queue") | ||||||
|  |   _par("Foo8", display-name: "Typst", shape: "custom", custom-image: TYPST) | ||||||
|  |   _par("Foo9", display-name: "Ferris", shape: "custom", custom-image: FERRIS) | ||||||
|  |   _par("Foo10", display-name: "Baryhobal", shape: "custom", custom-image: ME) | ||||||
|  | }) | ||||||
							
								
								
									
										
											BIN
										
									
								
								tests/participant/shapes/typst.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								tests/participant/shapes/typst.png
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							| After Width: | Height: | Size: 42 KiB | 
| @@ -1,6 +1,6 @@ | |||||||
| [package] | [package] | ||||||
| name = "chronos" | name = "chronos" | ||||||
| version = "0.2.1" | version = "0.2.2" | ||||||
| compiler = "0.13.1" | compiler = "0.13.1" | ||||||
| repository = "https://git.kb28.ch/HEL/chronos" | repository = "https://git.kb28.ch/HEL/chronos" | ||||||
| entrypoint = "src/lib.typ" | entrypoint = "src/lib.typ" | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user