rebase on master

This commit is contained in:
ppenguin 2025-04-02 21:02:20 +02:00
parent 2a0bd22451
commit 11b0ec79a3
No known key found for this signature in database
GPG key ID: 7E7143B546BB17A7
3 changed files with 68 additions and 0 deletions

View file

@ -24,3 +24,7 @@ race: fmt
.PHONY: js .PHONY: js
js: gen js: gen
cd d2js/js && NPM_VERSION="${NPM_VERSION}" prefix "$@" ./make.sh all cd d2js/js && NPM_VERSION="${NPM_VERSION}" prefix "$@" ./make.sh all
.PHONY: themesdemo
themesdemo:
$(MAKE) -C ./testdata/examples/

14
testdata/examples/Makefile vendored Normal file
View file

@ -0,0 +1,14 @@
D2 := ../../d2
SVGS = $(shell $(D2) themes | gawk -F':' '/^-/{ printf "out/themex-%03d.svg ",$$2 }' || :)
.PHONY:
all: $(D2) $(SVGS)
$(D2):
cd $(dir $@) && go build
$(MAKE) $(SVGS)
# D2 as dependency to expire results if recompiled
out/themex-%.svg: themex.d2 $(D2)
$(info Building $@ from $< ...)
$(D2) -t $$(( 10#$* )) $< $@

50
testdata/examples/themex.d2 vendored Normal file
View file

@ -0,0 +1,50 @@
vars: {
d2-config: {
layout-engine: elk
}
}
network: {
cell tower: {
satellites: {
shape: stored_data
style.multiple: true
}
transmitter
satellites -> transmitter: send
satellites -> transmitter: send
satellites -> transmitter: send
}
online portal: {
ui: {shape: hexagon}
}
data processor: {
storage: {
shape: cylinder
style.multiple: true
}
}
cell tower.transmitter -> data processor.storage: phone logs
}
user: {
shape: person
width: 130
}
user -> network.cell tower: make call
user -> network.online portal.ui: access {
style.stroke-dash: 3
}
api server -> network.online portal.ui: display
api server -> logs: persist
logs: {shape: page; style.multiple: true}
network.data processor -> api server