forked from HEL/chronos
		
	bumped to Typst 0.13.1 + cetz 0.3.4
This commit is contained in:
		| @@ -5,7 +5,7 @@ | ||||
|   chronos: chronos | ||||
| ) | ||||
|  | ||||
| #let example(src, show-src: true, vertical: false, fill: true, wrap: true) = { | ||||
| #let example(src, show-src: true, vertical: false, fill: false, wrap: true) = { | ||||
|   src = src.text | ||||
|   let full-src = example-preamble + src | ||||
|   let body = eval(full-src, scope: example-scope) | ||||
| @@ -16,15 +16,15 @@ | ||||
|       box( | ||||
|         stroke: black + 1pt, | ||||
|         radius: .5em, | ||||
|         fill: if fill {color.white.darken(5%)} else {none}, | ||||
|         fill: if fill {color.white.darken(2%)} else {none}, | ||||
|         if show-src { | ||||
|           let src-block = align(left, raw(src, lang: "typc")) | ||||
|           let src-block = raw(src, block: true, lang: "typc") | ||||
|           table( | ||||
|             columns: if vertical {1} else {2}, | ||||
|             inset: 1em, | ||||
|             inset: 5pt, | ||||
|             align: horizon + center, | ||||
|             stroke: none, | ||||
|             img, | ||||
|             table.cell(inset: 1em, img), | ||||
|             if vertical {table.hline()} else {table.vline()}, src-block | ||||
|           ) | ||||
|         } else { | ||||
|   | ||||
| @@ -14,8 +14,10 @@ _ret(comment: [bye]) | ||||
| ```) | ||||
|  | ||||
| #let seq-comm-align = example(``` | ||||
| _par("p1", display-name: "Start participant") | ||||
| _par("p2", display-name: "End participant") | ||||
| _par("p1", | ||||
|      display-name: "Start participant") | ||||
| _par("p2", | ||||
|      display-name: "End participant") | ||||
| let alignments = ( | ||||
|   "start", "end", | ||||
|   "left", "right", | ||||
|   | ||||
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								manual.pdf
									
									
									
									
									
								
							
							
						
						
									
										
											BIN
										
									
								
								manual.pdf
									
									
									
									
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										74
									
								
								manual.typ
									
									
									
									
									
								
							
							
						
						
									
										74
									
								
								manual.typ
									
									
									
									
									
								
							| @@ -1,4 +1,6 @@ | ||||
| #import "@preview/tidy:0.3.0" | ||||
| #import "@preview/tidy:0.4.2" | ||||
| #import "@preview/codly:1.2.0": codly-init, codly | ||||
| #import "@preview/codly-languages:0.1.8": codly-languages | ||||
| #import "src/lib.typ" as chronos | ||||
| #import "src/participant.typ" as mod-par | ||||
| #import "docs/examples.typ" | ||||
| @@ -6,25 +8,41 @@ | ||||
|  | ||||
| #let TYPST = image("gallery/typst.png", width: 1.5cm, height: 1.5cm, fit: "contain") | ||||
|  | ||||
| #let doc-ref(target, full: false, var: false) = { | ||||
|   let (module, func) = target.split(".") | ||||
|   let label-name = module + func | ||||
|   let display-name = func | ||||
|   if full { | ||||
|     display-name = target | ||||
|   } | ||||
|   if not var { | ||||
|     label-name += "()" | ||||
|     display-name += "()" | ||||
|   } | ||||
|   link(label(label-name))[#display-name] | ||||
| } | ||||
| #show: codly-init | ||||
| #codly( | ||||
|   languages: codly-languages | ||||
| ) | ||||
|  | ||||
| #set text(font: "Source Sans 3") | ||||
|  | ||||
| #set heading(numbering: (..num) => if num.pos().len() < 4 { | ||||
|   numbering("1.1", ..num) | ||||
| }) | ||||
|  | ||||
| #align(center)[ | ||||
|   #v(2cm) | ||||
|   #text(size: 2em)[*Chronos*] | ||||
|    | ||||
|   _v#chronos.version;_ | ||||
|   #v(1cm) | ||||
|   #chronos.diagram({ | ||||
|     import chronos: * | ||||
|     _par("u", display-name: [User], shape: "actor") | ||||
|     _par("wa", display-name: [Web App]) | ||||
|     _par("tu", display-name: [Typst Universe], shape: "database") | ||||
|  | ||||
|     _seq("u", "wa", comment: [Compile document], enable-dst: true) | ||||
|     _seq("wa", "tu", comment: [Fetch Chronos]) | ||||
|     _seq("tu", "wa", dashed: true, slant: 10) | ||||
|     _seq("wa", "wa", comment: [Render]) | ||||
|     _ret(comment: [Nice sequence diagram]) | ||||
|   }) | ||||
| ] | ||||
|  | ||||
| #pagebreak() | ||||
|  | ||||
| #{ | ||||
|   outline(indent: true, depth: 3) | ||||
|   outline(indent: auto, depth: 3) | ||||
| } | ||||
| #show link: set text(fill: blue) | ||||
|  | ||||
| @@ -40,14 +58,16 @@ This package lets you create nice sequence diagrams using the CeTZ package. | ||||
|  | ||||
| = Usage | ||||
|  | ||||
| #let import-stmt = "#import \"@preview/chronos:" + str(chronos.version) + "\"" | ||||
|  | ||||
| Simply import #link("https://typst.app/universe/package/chronos/")[chronos] and call the `diagram` function: | ||||
| #pad(left: 1em)[```typ | ||||
| #import "@preview/chronos:0.1.0" | ||||
| #raw(block:true, lang: "typ", ```typ | ||||
| $import | ||||
| #chronos.diagram({ | ||||
|   import chronos: * | ||||
|   ... | ||||
| }) | ||||
| ```] | ||||
| ```.text.replace("$import", import-stmt)) | ||||
|  | ||||
| = Examples | ||||
|  | ||||
| @@ -121,7 +141,11 @@ chronos.diagram({ | ||||
| == Custom images | ||||
|  | ||||
| #example(``` | ||||
| let load-img(path) = image(path, width: 1.5cm, height: 1.5cm, fit:"contain") | ||||
| let load-img(path) = image( | ||||
|   path, | ||||
|   width: 1.5cm, height: 1.5cm, | ||||
|   fit:"contain" | ||||
| ) | ||||
| let TYPST = load-img("../gallery/typst.png") | ||||
| let FERRIS = load-img("../gallery/ferris.png") | ||||
| let ME = load-img("../gallery/me.jpg") | ||||
| @@ -148,11 +172,11 @@ chronos.diagram({ | ||||
|   read("docs/participants.typ"), | ||||
|   name: "Participants", | ||||
|   require-all-parameters: true, | ||||
|   old-syntax: true, | ||||
|   scope: ( | ||||
|     chronos: chronos, | ||||
|     mod-par: mod-par, | ||||
|     TYPST: TYPST, | ||||
|     doc-ref: doc-ref | ||||
|     TYPST: TYPST | ||||
|   ) | ||||
| ) | ||||
| #tidy.show-module(par-docs, show-outline: false, sort-functions: none) | ||||
| @@ -163,9 +187,9 @@ chronos.diagram({ | ||||
|   read("docs/sequences.typ"), | ||||
|   name: "Sequences", | ||||
|   require-all-parameters: true, | ||||
|   old-syntax: true, | ||||
|   scope: ( | ||||
|     chronos: chronos, | ||||
|     doc-ref: doc-ref, | ||||
|     examples: examples | ||||
|   ) | ||||
| ) | ||||
| @@ -177,9 +201,9 @@ chronos.diagram({ | ||||
|   read("docs/groups.typ"), | ||||
|   name: "Groups", | ||||
|   require-all-parameters: true, | ||||
|   old-syntax: true, | ||||
|   scope: ( | ||||
|     chronos: chronos, | ||||
|     doc-ref: doc-ref, | ||||
|     examples: examples | ||||
|   ) | ||||
| ) | ||||
| @@ -191,9 +215,9 @@ chronos.diagram({ | ||||
|   read("docs/gaps_seps.typ"), | ||||
|   name: "Gaps and separators", | ||||
|   require-all-parameters: true, | ||||
|   old-syntax: true, | ||||
|   scope: ( | ||||
|     chronos: chronos, | ||||
|     doc-ref: doc-ref, | ||||
|     examples: examples | ||||
|   ) | ||||
| ) | ||||
| @@ -205,9 +229,9 @@ chronos.diagram({ | ||||
|   read("docs/notes.typ"), | ||||
|   name: "Notes", | ||||
|   require-all-parameters: true, | ||||
|   old-syntax: true, | ||||
|   scope: ( | ||||
|     chronos: chronos, | ||||
|     doc-ref: doc-ref, | ||||
|     examples: examples | ||||
|   ) | ||||
| ) | ||||
|   | ||||
| @@ -1,4 +1,4 @@ | ||||
| #import "@preview/cetz:0.3.3": draw | ||||
| #import "/src/cetz.typ": draw | ||||
| #import "consts.typ": * | ||||
|  | ||||
| #let _grp(name, desc: none, type: "default", elmts) = { | ||||
|   | ||||
| @@ -1,4 +1,4 @@ | ||||
| #let version = version(0, 2, 0) | ||||
| #let version = version(0, 2, 1) | ||||
| #import "diagram.typ": diagram, from-plantuml, _gap, _evt, _col | ||||
|  | ||||
| #import "sequence.typ": _seq, _ret | ||||
|   | ||||
| @@ -1,4 +1,4 @@ | ||||
| #import "@preview/cetz:0.3.3": draw | ||||
| #import "/src/cetz.typ": draw | ||||
| #import "consts.typ": * | ||||
|  | ||||
| #let SIDES = ( | ||||
|   | ||||
| @@ -1,4 +1,4 @@ | ||||
| #import "@preview/cetz:0.3.3": draw | ||||
| #import "/src/cetz.typ": draw | ||||
| #import "consts.typ": * | ||||
|  | ||||
| #let PAR-SPECIALS = "?[]" | ||||
|   | ||||
| @@ -1,4 +1,4 @@ | ||||
| #import "@preview/cetz:0.3.3": canvas, draw | ||||
| #import "/src/cetz.typ": canvas, draw | ||||
| #import "utils.typ": get-participants-i, get-style, normalize-units | ||||
| #import "group.typ" | ||||
| #import "participant.typ" | ||||
|   | ||||
| @@ -1,4 +1,4 @@ | ||||
| #import "@preview/cetz:0.3.3": draw | ||||
| #import "/src/cetz.typ": draw | ||||
| #import "consts.typ": * | ||||
|  | ||||
| #let _sep(name) = { | ||||
|   | ||||
| @@ -1,4 +1,4 @@ | ||||
| #import "@preview/cetz:0.3.3": draw, vector | ||||
| #import "/src/cetz.typ": draw, vector | ||||
| #import "consts.typ": * | ||||
| #import "participant.typ" | ||||
| #import "note.typ" | ||||
|   | ||||
| @@ -1,7 +1,7 @@ | ||||
| [package] | ||||
| name = "chronos" | ||||
| version = "0.2.1" | ||||
| compiler = "0.13.0" | ||||
| compiler = "0.13.1" | ||||
| repository = "https://git.kb28.ch/HEL/chronos" | ||||
| entrypoint = "src/lib.typ" | ||||
| authors = [ | ||||
|   | ||||
		Reference in New Issue
	
	Block a user