portograph 0.0.0-stage → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +202 -0
- package/README.md +233 -2
- package/bin/cli.mjs +256 -0
- package/bin/compute.mjs +177 -0
- package/bin/font-check.d.mts +4 -0
- package/bin/font-check.mjs +58 -0
- package/bin/portograph.mjs +23 -0
- package/dist/cli.d.cts +109 -0
- package/dist/cli.d.ts +109 -0
- package/dist/geometry/index.d.cts +14 -0
- package/dist/geometry/index.d.ts +14 -0
- package/dist/geometry/oriented.d.cts +34 -0
- package/dist/geometry/oriented.d.ts +34 -0
- package/dist/geometry/planar.d.cts +69 -0
- package/dist/geometry/planar.d.ts +69 -0
- package/dist/index.cjs +20 -0
- package/dist/index.d.cts +24 -0
- package/dist/index.d.ts +24 -0
- package/dist/index.js +1 -0
- package/dist/internal.d.cts +73 -0
- package/dist/internal.d.ts +73 -0
- package/dist/layout/alignment-targets.d.cts +76 -0
- package/dist/layout/alignment-targets.d.ts +76 -0
- package/dist/layout/approach.d.cts +13 -0
- package/dist/layout/approach.d.ts +13 -0
- package/dist/layout/attempt-counters.d.cts +117 -0
- package/dist/layout/attempt-counters.d.ts +117 -0
- package/dist/layout/attempt-ledger.d.cts +31 -0
- package/dist/layout/attempt-ledger.d.ts +31 -0
- package/dist/layout/attempt-timings.d.cts +41 -0
- package/dist/layout/attempt-timings.d.ts +41 -0
- package/dist/layout/bands.d.cts +348 -0
- package/dist/layout/bands.d.ts +348 -0
- package/dist/layout/bar-width.d.cts +9 -0
- package/dist/layout/bar-width.d.ts +9 -0
- package/dist/layout/bars.d.cts +26 -0
- package/dist/layout/bars.d.ts +26 -0
- package/dist/layout/block-checks.d.cts +5 -0
- package/dist/layout/block-checks.d.ts +5 -0
- package/dist/layout/box-writers.d.cts +53 -0
- package/dist/layout/box-writers.d.ts +53 -0
- package/dist/layout/bundle-channel.d.cts +8 -0
- package/dist/layout/bundle-channel.d.ts +8 -0
- package/dist/layout/bundle-geometry.d.cts +163 -0
- package/dist/layout/bundle-geometry.d.ts +163 -0
- package/dist/layout/bundle-junctions.d.cts +41 -0
- package/dist/layout/bundle-junctions.d.ts +41 -0
- package/dist/layout/bundle-merge.d.cts +4 -0
- package/dist/layout/bundle-merge.d.ts +4 -0
- package/dist/layout/bundle-need.d.cts +23 -0
- package/dist/layout/bundle-need.d.ts +23 -0
- package/dist/layout/bundle-order.d.cts +10 -0
- package/dist/layout/bundle-order.d.ts +10 -0
- package/dist/layout/bundle-paths.d.cts +33 -0
- package/dist/layout/bundle-paths.d.ts +33 -0
- package/dist/layout/bundles.d.cts +5 -0
- package/dist/layout/bundles.d.ts +5 -0
- package/dist/layout/bus-room.d.cts +48 -0
- package/dist/layout/bus-room.d.ts +48 -0
- package/dist/layout/bus.d.cts +100 -0
- package/dist/layout/bus.d.ts +100 -0
- package/dist/layout/centre.d.cts +108 -0
- package/dist/layout/centre.d.ts +108 -0
- package/dist/layout/chord-boxes.d.cts +9 -0
- package/dist/layout/chord-boxes.d.ts +9 -0
- package/dist/layout/chord-clear.d.cts +32 -0
- package/dist/layout/chord-clear.d.ts +32 -0
- package/dist/layout/close-up.d.cts +37 -0
- package/dist/layout/close-up.d.ts +37 -0
- package/dist/layout/column-arrangement.d.cts +37 -0
- package/dist/layout/column-arrangement.d.ts +37 -0
- package/dist/layout/columns.d.cts +240 -0
- package/dist/layout/columns.d.ts +240 -0
- package/dist/layout/constraints/catalogue.d.cts +25 -0
- package/dist/layout/constraints/catalogue.d.ts +25 -0
- package/dist/layout/constraints/evaluate.d.cts +24 -0
- package/dist/layout/constraints/evaluate.d.ts +24 -0
- package/dist/layout/constraints/index.d.cts +8 -0
- package/dist/layout/constraints/index.d.ts +8 -0
- package/dist/layout/constraints/separation.d.cts +33 -0
- package/dist/layout/constraints/separation.d.ts +33 -0
- package/dist/layout/constraints/types.d.cts +65 -0
- package/dist/layout/constraints/types.d.ts +65 -0
- package/dist/layout/corridor-order.d.cts +61 -0
- package/dist/layout/corridor-order.d.ts +61 -0
- package/dist/layout/course-bypass.d.cts +63 -0
- package/dist/layout/course-bypass.d.ts +63 -0
- package/dist/layout/course-gap.d.cts +54 -0
- package/dist/layout/course-gap.d.ts +54 -0
- package/dist/layout/course-lanes.d.cts +79 -0
- package/dist/layout/course-lanes.d.ts +79 -0
- package/dist/layout/course-measure.d.cts +114 -0
- package/dist/layout/course-measure.d.ts +114 -0
- package/dist/layout/course-plan.d.cts +22 -0
- package/dist/layout/course-plan.d.ts +22 -0
- package/dist/layout/course-rows.d.cts +51 -0
- package/dist/layout/course-rows.d.ts +51 -0
- package/dist/layout/courses.d.cts +31 -0
- package/dist/layout/courses.d.ts +31 -0
- package/dist/layout/decide.d.cts +123 -0
- package/dist/layout/decide.d.ts +123 -0
- package/dist/layout/diagonal-text.d.cts +49 -0
- package/dist/layout/diagonal-text.d.ts +49 -0
- package/dist/layout/direct-families.d.cts +91 -0
- package/dist/layout/direct-families.d.ts +91 -0
- package/dist/layout/elk-graph.d.cts +36 -0
- package/dist/layout/elk-graph.d.ts +36 -0
- package/dist/layout/elk-worker.d.cts +34 -0
- package/dist/layout/elk-worker.d.ts +34 -0
- package/dist/layout/end-trim.d.cts +41 -0
- package/dist/layout/end-trim.d.ts +41 -0
- package/dist/layout/face-centre.d.cts +25 -0
- package/dist/layout/face-centre.d.ts +25 -0
- package/dist/layout/fan-admission.d.cts +47 -0
- package/dist/layout/fan-admission.d.ts +47 -0
- package/dist/layout/fan-spread.d.cts +43 -0
- package/dist/layout/fan-spread.d.ts +43 -0
- package/dist/layout/feed-order.d.cts +53 -0
- package/dist/layout/feed-order.d.ts +53 -0
- package/dist/layout/feed-split.d.cts +34 -0
- package/dist/layout/feed-split.d.ts +34 -0
- package/dist/layout/flanks.d.cts +21 -0
- package/dist/layout/flanks.d.ts +21 -0
- package/dist/layout/frame-paths.d.cts +209 -0
- package/dist/layout/frame-paths.d.ts +209 -0
- package/dist/layout/frames.d.cts +112 -0
- package/dist/layout/frames.d.ts +112 -0
- package/dist/layout/gap-band.d.cts +10 -0
- package/dist/layout/gap-band.d.ts +10 -0
- package/dist/layout/gap-plan.d.cts +229 -0
- package/dist/layout/gap-plan.d.ts +229 -0
- package/dist/layout/gap-room.d.cts +71 -0
- package/dist/layout/gap-room.d.ts +71 -0
- package/dist/layout/gap-runs.d.cts +95 -0
- package/dist/layout/gap-runs.d.ts +95 -0
- package/dist/layout/given-back.d.cts +23 -0
- package/dist/layout/given-back.d.ts +23 -0
- package/dist/layout/grid-chains.d.cts +84 -0
- package/dist/layout/grid-chains.d.ts +84 -0
- package/dist/layout/grid.d.cts +314 -0
- package/dist/layout/grid.d.ts +314 -0
- package/dist/layout/group-exit-check.d.cts +36 -0
- package/dist/layout/group-exit-check.d.ts +36 -0
- package/dist/layout/group-exits.d.cts +53 -0
- package/dist/layout/group-exits.d.ts +53 -0
- package/dist/layout/group-padding.d.cts +6 -0
- package/dist/layout/group-padding.d.ts +6 -0
- package/dist/layout/growth-guard.d.cts +25 -0
- package/dist/layout/growth-guard.d.ts +25 -0
- package/dist/layout/joint-order.d.cts +149 -0
- package/dist/layout/joint-order.d.ts +149 -0
- package/dist/layout/label-room-guard.d.cts +8 -0
- package/dist/layout/label-room-guard.d.ts +8 -0
- package/dist/layout/lane-kind.d.cts +11 -0
- package/dist/layout/lane-kind.d.ts +11 -0
- package/dist/layout/lanes.d.cts +278 -0
- package/dist/layout/lanes.d.ts +278 -0
- package/dist/layout/legend.d.cts +88 -0
- package/dist/layout/legend.d.ts +88 -0
- package/dist/layout/lift-judge.d.cts +28 -0
- package/dist/layout/lift-judge.d.ts +28 -0
- package/dist/layout/lift.d.cts +164 -0
- package/dist/layout/lift.d.ts +164 -0
- package/dist/layout/link-label-geometry.d.cts +32 -0
- package/dist/layout/link-label-geometry.d.ts +32 -0
- package/dist/layout/link-labels.d.cts +129 -0
- package/dist/layout/link-labels.d.ts +129 -0
- package/dist/layout/link-layer.d.cts +6 -0
- package/dist/layout/link-layer.d.ts +6 -0
- package/dist/layout/move-reservations.d.cts +49 -0
- package/dist/layout/move-reservations.d.ts +49 -0
- package/dist/layout/mutation.d.cts +32 -0
- package/dist/layout/mutation.d.ts +32 -0
- package/dist/layout/node-geometry.d.cts +3 -0
- package/dist/layout/node-geometry.d.ts +3 -0
- package/dist/layout/objective.d.cts +232 -0
- package/dist/layout/objective.d.ts +232 -0
- package/dist/layout/overlay-nest.d.cts +27 -0
- package/dist/layout/overlay-nest.d.ts +27 -0
- package/dist/layout/overlay-order.d.cts +140 -0
- package/dist/layout/overlay-order.d.ts +140 -0
- package/dist/layout/overlay-paths.d.cts +303 -0
- package/dist/layout/overlay-paths.d.ts +303 -0
- package/dist/layout/overlay-place.d.cts +99 -0
- package/dist/layout/overlay-place.d.ts +99 -0
- package/dist/layout/overlay-tracks.d.cts +93 -0
- package/dist/layout/overlay-tracks.d.ts +93 -0
- package/dist/layout/overlay-window.d.cts +83 -0
- package/dist/layout/overlay-window.d.ts +83 -0
- package/dist/layout/parallel-sets.d.cts +51 -0
- package/dist/layout/parallel-sets.d.ts +51 -0
- package/dist/layout/parent-stand.d.cts +40 -0
- package/dist/layout/parent-stand.d.ts +40 -0
- package/dist/layout/path-end.d.cts +34 -0
- package/dist/layout/path-end.d.ts +34 -0
- package/dist/layout/peers.d.cts +28 -0
- package/dist/layout/peers.d.ts +28 -0
- package/dist/layout/pill-reach.d.cts +14 -0
- package/dist/layout/pill-reach.d.ts +14 -0
- package/dist/layout/placement-attempt.d.cts +58 -0
- package/dist/layout/placement-attempt.d.ts +58 -0
- package/dist/layout/placement-refusal.d.cts +67 -0
- package/dist/layout/placement-refusal.d.ts +67 -0
- package/dist/layout/port-insets.d.cts +15 -0
- package/dist/layout/port-insets.d.ts +15 -0
- package/dist/layout/port-side.d.cts +8 -0
- package/dist/layout/port-side.d.ts +8 -0
- package/dist/layout/postconditions.d.cts +40 -0
- package/dist/layout/postconditions.d.ts +40 -0
- package/dist/layout/rank-cells.d.cts +24 -0
- package/dist/layout/rank-cells.d.ts +24 -0
- package/dist/layout/rank-input.d.cts +8 -0
- package/dist/layout/rank-input.d.ts +8 -0
- package/dist/layout/ranks.d.cts +36 -0
- package/dist/layout/ranks.d.ts +36 -0
- package/dist/layout/read/arrangement.d.cts +3 -0
- package/dist/layout/read/arrangement.d.ts +3 -0
- package/dist/layout/read/canton.d.cts +48 -0
- package/dist/layout/read/canton.d.ts +48 -0
- package/dist/layout/read/chain.d.cts +11 -0
- package/dist/layout/read/chain.d.ts +11 -0
- package/dist/layout/read/courses.d.cts +67 -0
- package/dist/layout/read/courses.d.ts +67 -0
- package/dist/layout/read/crossings.d.cts +79 -0
- package/dist/layout/read/crossings.d.ts +79 -0
- package/dist/layout/read/feeds.d.cts +53 -0
- package/dist/layout/read/feeds.d.ts +53 -0
- package/dist/layout/read/overlay-straight.d.cts +33 -0
- package/dist/layout/read/overlay-straight.d.ts +33 -0
- package/dist/layout/read/parent-spread.d.cts +13 -0
- package/dist/layout/read/parent-spread.d.ts +13 -0
- package/dist/layout/read/tier.d.cts +19 -0
- package/dist/layout/read/tier.d.ts +19 -0
- package/dist/layout/read/title-edge.d.cts +19 -0
- package/dist/layout/read/title-edge.d.ts +19 -0
- package/dist/layout/rectangle-index.d.cts +33 -0
- package/dist/layout/rectangle-index.d.ts +33 -0
- package/dist/layout/region-rebuild.d.cts +9 -0
- package/dist/layout/region-rebuild.d.ts +9 -0
- package/dist/layout/regions.d.cts +37 -0
- package/dist/layout/regions.d.ts +37 -0
- package/dist/layout/reservation-checks.d.cts +16 -0
- package/dist/layout/reservation-checks.d.ts +16 -0
- package/dist/layout/reservations.d.cts +267 -0
- package/dist/layout/reservations.d.ts +267 -0
- package/dist/layout/row-paths.d.cts +62 -0
- package/dist/layout/row-paths.d.ts +62 -0
- package/dist/layout/rows.d.cts +5 -0
- package/dist/layout/rows.d.ts +5 -0
- package/dist/layout/rule-geometry-hook.d.cts +5 -0
- package/dist/layout/rule-geometry-hook.d.ts +5 -0
- package/dist/layout/run-label-box.d.cts +139 -0
- package/dist/layout/run-label-box.d.ts +139 -0
- package/dist/layout/side-chords.d.cts +55 -0
- package/dist/layout/side-chords.d.ts +55 -0
- package/dist/layout/side-hints.d.cts +34 -0
- package/dist/layout/side-hints.d.ts +34 -0
- package/dist/layout/side-judge.d.cts +65 -0
- package/dist/layout/side-judge.d.ts +65 -0
- package/dist/layout/side-lanes.d.cts +27 -0
- package/dist/layout/side-lanes.d.ts +27 -0
- package/dist/layout/side-measure.d.cts +55 -0
- package/dist/layout/side-measure.d.ts +55 -0
- package/dist/layout/sides-one.d.cts +24 -0
- package/dist/layout/sides-one.d.ts +24 -0
- package/dist/layout/sides-two.d.cts +159 -0
- package/dist/layout/sides-two.d.ts +159 -0
- package/dist/layout/size.d.cts +114 -0
- package/dist/layout/size.d.ts +114 -0
- package/dist/layout/skeleton-geometry.d.cts +38 -0
- package/dist/layout/skeleton-geometry.d.ts +38 -0
- package/dist/layout/skeleton-graph.d.cts +33 -0
- package/dist/layout/skeleton-graph.d.ts +33 -0
- package/dist/layout/skeleton.d.cts +21 -0
- package/dist/layout/skeleton.d.ts +21 -0
- package/dist/layout/solid-blocks.d.cts +24 -0
- package/dist/layout/solid-blocks.d.ts +24 -0
- package/dist/layout/span-judge.d.cts +13 -0
- package/dist/layout/span-judge.d.ts +13 -0
- package/dist/layout/span-lanes.d.cts +37 -0
- package/dist/layout/span-lanes.d.ts +37 -0
- package/dist/layout/span-measure.d.cts +35 -0
- package/dist/layout/span-measure.d.ts +35 -0
- package/dist/layout/stagger.d.cts +40 -0
- package/dist/layout/stagger.d.ts +40 -0
- package/dist/layout/title-room.d.cts +50 -0
- package/dist/layout/title-room.d.ts +50 -0
- package/dist/layout/tolerance.d.cts +60 -0
- package/dist/layout/tolerance.d.ts +60 -0
- package/dist/layout/trial-copy.d.cts +9 -0
- package/dist/layout/trial-copy.d.ts +9 -0
- package/dist/layout/trial-findings.d.cts +25 -0
- package/dist/layout/trial-findings.d.ts +25 -0
- package/dist/layout/trunk.d.cts +69 -0
- package/dist/layout/trunk.d.ts +69 -0
- package/dist/layout/turn-measure.d.cts +42 -0
- package/dist/layout/turn-measure.d.ts +42 -0
- package/dist/layout/turn-order.d.cts +83 -0
- package/dist/layout/turn-order.d.ts +83 -0
- package/dist/migrate/index.d.cts +13 -0
- package/dist/migrate/index.d.ts +13 -0
- package/dist/model/classes.d.cts +21 -0
- package/dist/model/classes.d.ts +21 -0
- package/dist/model/document.d.cts +174 -0
- package/dist/model/document.d.ts +174 -0
- package/dist/model/geometry.d.cts +12 -0
- package/dist/model/geometry.d.ts +12 -0
- package/dist/model/index.d.cts +5 -0
- package/dist/model/index.d.ts +5 -0
- package/dist/model/json-equality.d.cts +2 -0
- package/dist/model/json-equality.d.ts +2 -0
- package/dist/model/layout.d.cts +1142 -0
- package/dist/model/layout.d.ts +1142 -0
- package/dist/model/link-ids.d.cts +16 -0
- package/dist/model/link-ids.d.ts +16 -0
- package/dist/model/model.d.cts +26 -0
- package/dist/model/model.d.ts +26 -0
- package/dist/model/read-cache.d.cts +20 -0
- package/dist/model/read-cache.d.ts +20 -0
- package/dist/node.cjs +43 -0
- package/dist/node.d.cts +6 -0
- package/dist/parse/css.d.cts +2 -0
- package/dist/parse/css.d.ts +2 -0
- package/dist/parse/index.d.cts +23 -0
- package/dist/parse/index.d.ts +23 -0
- package/dist/parse/link-order.d.cts +24 -0
- package/dist/parse/link-order.d.ts +24 -0
- package/dist/parse/validation.d.cts +39 -0
- package/dist/parse/validation.d.ts +39 -0
- package/dist/pipeline/budget.d.cts +28 -0
- package/dist/pipeline/budget.d.ts +28 -0
- package/dist/pipeline/deadline.d.cts +1 -0
- package/dist/pipeline/deadline.d.ts +1 -0
- package/dist/pipeline/driver.d.cts +14 -0
- package/dist/pipeline/driver.d.ts +14 -0
- package/dist/pipeline/env.d.cts +54 -0
- package/dist/pipeline/env.d.ts +54 -0
- package/dist/pipeline/index.d.cts +17 -0
- package/dist/pipeline/index.d.ts +17 -0
- package/dist/pipeline/initial.d.cts +3 -0
- package/dist/pipeline/initial.d.ts +3 -0
- package/dist/pipeline/lift-round.d.cts +9 -0
- package/dist/pipeline/lift-round.d.ts +9 -0
- package/dist/pipeline/limits.d.cts +16 -0
- package/dist/pipeline/limits.d.ts +16 -0
- package/dist/pipeline/options.d.cts +85 -0
- package/dist/pipeline/options.d.ts +85 -0
- package/dist/pipeline/place.d.cts +9 -0
- package/dist/pipeline/place.d.ts +9 -0
- package/dist/pipeline/publish.d.cts +4 -0
- package/dist/pipeline/publish.d.ts +4 -0
- package/dist/pipeline/round.d.cts +86 -0
- package/dist/pipeline/round.d.ts +86 -0
- package/dist/pipeline/rounds.d.cts +85 -0
- package/dist/pipeline/rounds.d.ts +85 -0
- package/dist/pipeline/state.d.cts +46 -0
- package/dist/pipeline/state.d.ts +46 -0
- package/dist/pipeline/width-budget.d.cts +6 -0
- package/dist/pipeline/width-budget.d.ts +6 -0
- package/dist/portograph-avoid-worker.mjs +260 -0
- package/dist/portograph.js +43369 -0
- package/dist/portograph.umd.cjs +154 -0
- package/dist/profiles/network/content.d.cts +29 -0
- package/dist/profiles/network/content.d.ts +29 -0
- package/dist/profiles/network/icons.d.cts +27 -0
- package/dist/profiles/network/icons.d.ts +27 -0
- package/dist/profiles/network/snack.d.cts +50 -0
- package/dist/profiles/network/snack.d.ts +50 -0
- package/dist/profiles/network/theme.d.cts +246 -0
- package/dist/profiles/network/theme.d.ts +246 -0
- package/dist/profiles/network/themes.d.cts +60 -0
- package/dist/profiles/network/themes.d.ts +60 -0
- package/dist/profiles/network/tiers.d.cts +8 -0
- package/dist/profiles/network/tiers.d.ts +8 -0
- package/dist/render/anonymous-end.d.cts +8 -0
- package/dist/render/anonymous-end.d.ts +8 -0
- package/dist/render/author-css.d.cts +9 -0
- package/dist/render/author-css.d.ts +9 -0
- package/dist/render/check-options.d.cts +8 -0
- package/dist/render/check-options.d.ts +8 -0
- package/dist/render/drawio.d.cts +35 -0
- package/dist/render/drawio.d.ts +35 -0
- package/dist/render/frame-order.d.cts +36 -0
- package/dist/render/frame-order.d.ts +36 -0
- package/dist/render/index.d.cts +19 -0
- package/dist/render/index.d.ts +19 -0
- package/dist/render/shared.d.cts +137 -0
- package/dist/render/shared.d.ts +137 -0
- package/dist/render/svg.d.cts +22 -0
- package/dist/render/svg.d.ts +22 -0
- package/dist/render/theme.d.cts +81 -0
- package/dist/render/theme.d.ts +81 -0
- package/dist/render/tooltips.d.cts +11 -0
- package/dist/render/tooltips.d.ts +11 -0
- package/dist/resolve/fan-family.d.cts +19 -0
- package/dist/resolve/fan-family.d.ts +19 -0
- package/dist/resolve/index.d.cts +30 -0
- package/dist/resolve/index.d.ts +30 -0
- package/dist/resolve/mesh-bus.d.cts +19 -0
- package/dist/resolve/mesh-bus.d.ts +19 -0
- package/dist/resolve/solid-blocks.d.cts +2 -0
- package/dist/resolve/solid-blocks.d.ts +2 -0
- package/dist/route/containment.d.cts +8 -0
- package/dist/route/containment.d.ts +8 -0
- package/dist/route/index.d.cts +48 -0
- package/dist/route/index.d.ts +48 -0
- package/dist/route/obstacles.d.cts +59 -0
- package/dist/route/obstacles.d.ts +59 -0
- package/dist/route/paths.d.cts +100 -0
- package/dist/route/paths.d.ts +100 -0
- package/dist/route/plan.d.cts +182 -0
- package/dist/route/plan.d.ts +182 -0
- package/dist/route/reservations.d.cts +15 -0
- package/dist/route/reservations.d.ts +15 -0
- package/dist/route/types.d.cts +59 -0
- package/dist/route/types.d.ts +59 -0
- package/dist/route/validate.d.cts +41 -0
- package/dist/route/validate.d.ts +41 -0
- package/dist/route/worker.d.cts +73 -0
- package/dist/route/worker.d.ts +73 -0
- package/dist/score/counts.d.cts +12 -0
- package/dist/score/counts.d.ts +12 -0
- package/dist/score/gates.d.cts +16 -0
- package/dist/score/gates.d.ts +16 -0
- package/dist/score/geometry.d.cts +2 -0
- package/dist/score/geometry.d.ts +2 -0
- package/dist/score/index.d.cts +5 -0
- package/dist/score/index.d.ts +5 -0
- package/dist/score/metrics.d.cts +7 -0
- package/dist/score/metrics.d.ts +7 -0
- package/dist/score/model.d.cts +76 -0
- package/dist/score/model.d.ts +76 -0
- package/dist/score/types.d.cts +135 -0
- package/dist/score/types.d.ts +135 -0
- package/dist/text/font-metrics.d.cts +9 -0
- package/dist/text/font-metrics.d.ts +9 -0
- package/dist/text/index.d.cts +32 -0
- package/dist/text/index.d.ts +32 -0
- package/dist/theme/content.d.cts +33 -0
- package/dist/theme/content.d.ts +33 -0
- package/dist/theme/geometry.d.cts +81 -0
- package/dist/theme/geometry.d.ts +81 -0
- package/dist/theme/legend.d.cts +26 -0
- package/dist/theme/legend.d.ts +26 -0
- package/dist/warm-elk.cjs +43 -0
- package/package.json +109 -4
package/LICENSE
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright 2026 Valeriy Simonov
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
package/README.md
CHANGED
|
@@ -1,3 +1,234 @@
|
|
|
1
|
-
#
|
|
1
|
+
# portograph
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[](https://github.com/simnv/portograph/actions/workflows/ci.yml)
|
|
4
|
+
[](https://www.npmjs.com/package/portograph)
|
|
5
|
+
[](LICENSE)
|
|
6
|
+
|
|
7
|
+
Write nodes, ports and links in YAML, and portograph draws the diagram as SVG or draw.io.
|
|
8
|
+
|
|
9
|
+
Each node has its ports on its sides, and each link attaches to a port. Each node is in a group,
|
|
10
|
+
and each group is on a tier, from top to bottom. A link between two facing ports is a
|
|
11
|
+
straight line when nothing is in its path. Other links turn at right angles in the gaps between
|
|
12
|
+
the tiers. The first target is network diagrams.
|
|
13
|
+
|
|
14
|
+
<img src="docs/assets/example.png" alt="Two ISPs above a core router pair, a server flank to the right, and two access switches below that connect to both core routers" width="640">
|
|
15
|
+
|
|
16
|
+
<details>
|
|
17
|
+
<summary>The YAML for this diagram (<code>docs/assets/example.yaml</code>)</summary>
|
|
18
|
+
|
|
19
|
+
```yaml
|
|
20
|
+
portograph: 2
|
|
21
|
+
groups:
|
|
22
|
+
internet: { tier: 0, label: Internet }
|
|
23
|
+
core: { tier: 1, label: Core }
|
|
24
|
+
servers: { align: right, of: core, label: Servers }
|
|
25
|
+
access: { tier: 2, label: Access }
|
|
26
|
+
nodes:
|
|
27
|
+
isp-a: { group: internet, class: provider, label: ISP A, ports: [wan] }
|
|
28
|
+
isp-b: { group: internet, class: provider, label: ISP B, ports: [wan] }
|
|
29
|
+
core-1:
|
|
30
|
+
group: core
|
|
31
|
+
class: router
|
|
32
|
+
description: 192.0.2.1
|
|
33
|
+
ports: [{ name: wan, class: uplink }, te1, ge1, ge2]
|
|
34
|
+
core-2:
|
|
35
|
+
group: core
|
|
36
|
+
class: router
|
|
37
|
+
description: 192.0.2.2
|
|
38
|
+
ports: [{ name: wan, class: uplink }, te1, te2, ge1, ge2]
|
|
39
|
+
nms: { group: servers, class: Server, icon: server, label: NMS, description: 192.0.2.10, ports: [eth0] }
|
|
40
|
+
acc-1: { group: access, class: Switch, icon: switch, label: Access 1, ports: [up1, up2] }
|
|
41
|
+
acc-2: { group: access, class: Switch, icon: switch, label: Access 2, ports: [up1, up2] }
|
|
42
|
+
links:
|
|
43
|
+
- [isp-a.wan, core-1.wan, { label: 1G }]
|
|
44
|
+
- [isp-b.wan, core-2.wan, { label: 1G }]
|
|
45
|
+
- [core-1.te1, core-2.te1]
|
|
46
|
+
- [core-2.te2, nms.eth0, { class: dashed }]
|
|
47
|
+
- [core-1.ge1, acc-1.up1]
|
|
48
|
+
- [core-1.ge2, acc-2.up1]
|
|
49
|
+
- [core-2.ge1, acc-1.up2]
|
|
50
|
+
- [core-2.ge2, acc-2.up2]
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
</details>
|
|
54
|
+
|
|
55
|
+
## Install
|
|
56
|
+
|
|
57
|
+
portograph needs Node.js 22 or newer.
|
|
58
|
+
|
|
59
|
+
```sh
|
|
60
|
+
npm i -g portograph
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
To run it once without an install, use `npx portograph`.
|
|
64
|
+
|
|
65
|
+
## Quick start
|
|
66
|
+
|
|
67
|
+
Save the YAML above as `site.yaml`, then run:
|
|
68
|
+
|
|
69
|
+
```sh
|
|
70
|
+
portograph render site.yaml --output site.svg
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
This command writes three files: `site.svg`, `site.layout.json` and `site.score.json`. Open the
|
|
74
|
+
SVG in a browser. The layout JSON holds every position and path, and the score JSON holds the
|
|
75
|
+
quality checks.
|
|
76
|
+
|
|
77
|
+
For draw.io, set the format:
|
|
78
|
+
|
|
79
|
+
```sh
|
|
80
|
+
portograph render site.yaml --format drawio --output site.drawio
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
## CLI
|
|
84
|
+
|
|
85
|
+
```text
|
|
86
|
+
portograph <verb> [options] <file>
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
| Verb | Input | Output |
|
|
90
|
+
|---|---|---|
|
|
91
|
+
| `render` | YAML or layout JSON | SVG or draw.io, plus the layout JSON and the score JSON |
|
|
92
|
+
| `layout` | YAML | layout JSON |
|
|
93
|
+
| `score` | layout JSON | the gate results and the score, as JSON |
|
|
94
|
+
| `migrate` | YAML in the older d3-fd `diagram:` format | YAML in the current format (v2) |
|
|
95
|
+
|
|
96
|
+
Each command takes exactly one file. A file name of `-` reads stdin. Options can come before or
|
|
97
|
+
after the file.
|
|
98
|
+
|
|
99
|
+
| Option | Verbs | What it does |
|
|
100
|
+
|---|---|---|
|
|
101
|
+
| `--output <path>` | all | Writes the main output to this path. Without it, the main output goes to stdout. |
|
|
102
|
+
| `--diagnostics text\|json` | all | Sets the format of the messages on stderr. `json` writes one JSON object per line. |
|
|
103
|
+
| `--format svg\|drawio` | `render` | Sets the format of the main output. The default is `svg`. |
|
|
104
|
+
| `--layers routed,overlay` | `render` | Draws only these link families. |
|
|
105
|
+
| `--theme auto\|light\|dark\|print` | `render` | Sets the draw.io palette. The default `auto` puts light and dark in one file. |
|
|
106
|
+
| `--labels on-run\|measured` | `render` | Sets where draw.io puts link labels: on the link (default) or in the box that the layout calculated. |
|
|
107
|
+
| `--icons cisco19\|profile` | `render` | Sets the draw.io glyphs: the Cisco shapes of draw.io (default), or an image embedded in the file. |
|
|
108
|
+
| `--timings` | `layout`, `render`, `score` | Keeps the stage timings in the JSON. Without it, two runs on one input write the same bytes. |
|
|
109
|
+
| `--allow-gate-failures` | `render`, `score` | Reports a failed gate, but exits with 0. |
|
|
110
|
+
| `--force` | all | Lays out a document with more than 1,000 nodes. |
|
|
111
|
+
| `-h`, `--help` | | Shows the help. |
|
|
112
|
+
| `-V`, `--version` | | Shows the version. |
|
|
113
|
+
|
|
114
|
+
More examples:
|
|
115
|
+
|
|
116
|
+
```sh
|
|
117
|
+
cat site.yaml | portograph layout - > site.layout.json
|
|
118
|
+
portograph score site.layout.json
|
|
119
|
+
portograph render site.layout.json --layers routed --output routed.svg
|
|
120
|
+
portograph layout site.yaml --diagnostics json 2> diagnostics.jsonl
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
Each diagnostic gives the file, line and column of the YAML that it is about:
|
|
124
|
+
|
|
125
|
+
```text
|
|
126
|
+
portograph: error: UNKNOWN_KEY at site.yaml:7:5 ($.nodes.a.colour): Unknown key colour
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
Exit codes:
|
|
130
|
+
|
|
131
|
+
| Code | Meaning |
|
|
132
|
+
|---|---|
|
|
133
|
+
| 0 | The command succeeded. |
|
|
134
|
+
| 1 | A hard gate failed. The command still writes all its files. |
|
|
135
|
+
| 2 | An input error: usage, a file it cannot read, invalid YAML or JSON, or the node limit. |
|
|
136
|
+
| 3 | A processing failure: the 120-second command deadline, a missing worker file, or an internal error. |
|
|
137
|
+
|
|
138
|
+
Set `PORTOGRAPH_PROGRESS=1` to see the stage timings on stderr.
|
|
139
|
+
|
|
140
|
+
## Library
|
|
141
|
+
|
|
142
|
+
The package is ESM and CommonJS. It has types.
|
|
143
|
+
|
|
144
|
+
```js
|
|
145
|
+
import { parseWithDiagnostics, layout, score, render } from 'portograph';
|
|
146
|
+
import { createNodeElkFactory, createNodeRouteFactory } from 'portograph/node';
|
|
147
|
+
|
|
148
|
+
const parsed = parseWithDiagnostics(yaml);
|
|
149
|
+
if (!parsed.ok) throw new Error(JSON.stringify(parsed.diagnostics));
|
|
150
|
+
const model = await layout(parsed.document, {
|
|
151
|
+
diagnostics: parsed.diagnostics,
|
|
152
|
+
createElkAttempt: createNodeElkFactory(),
|
|
153
|
+
createRouteAttempt: createNodeRouteFactory(),
|
|
154
|
+
});
|
|
155
|
+
const report = score(model);
|
|
156
|
+
const svg = render(model);
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
The package root exports these functions:
|
|
160
|
+
|
|
161
|
+
| Export | What it does |
|
|
162
|
+
|---|---|
|
|
163
|
+
| `parse(text)` | Parses YAML into a document. It throws `ParseError` on an error. |
|
|
164
|
+
| `parseWithDiagnostics(text)` | Parses YAML and returns `{ ok, document, diagnostics }`. It does not throw. |
|
|
165
|
+
| `layout(document, options)` | Lays out a document and returns the layout model. |
|
|
166
|
+
| `score(model)` | Returns the gate results and the score. |
|
|
167
|
+
| `render(model, options)` | Returns the SVG text. |
|
|
168
|
+
| `drawio(model, options)` | Returns the draw.io document. |
|
|
169
|
+
| `serializeLayoutModel(model)`, `restoreFinalLayout(json)` | Write and read the layout JSON. |
|
|
170
|
+
| `migrate(text)`, `migrateWithDiagnostics(text)` | Convert d3-fd YAML to the current format. |
|
|
171
|
+
| `createBudget(ms)` | Makes one time budget that all the solver calls of a layout share. |
|
|
172
|
+
| `createBrowserElkFactory()`, `createBrowserRouteFactory()` | Make the solver workers in a browser. |
|
|
173
|
+
|
|
174
|
+
The root also exports the error classes `ParseError`, `ResolveError`, `CommandDeadlineError`,
|
|
175
|
+
`ElkDeadlineError` and `RouteDeadlineError`, and the types. `portograph/node` exports
|
|
176
|
+
`createNodeElkFactory` and `createNodeRouteFactory`, which make the solver workers in Node.js.
|
|
177
|
+
|
|
178
|
+
`portograph/internal` exports the stage functions and the tables. It can change in any release.
|
|
179
|
+
|
|
180
|
+
In a browser, the page must serve four files over HTTP. Put `elkjs/lib/elk-worker.min.js` and
|
|
181
|
+
`portograph/dist/portograph-avoid-worker.mjs` beside the page. In the directory of that worker, serve
|
|
182
|
+
`libavoid-js/dist/index.js` as `libavoid.mjs`, and `libavoid-js/dist/libavoid.wasm` as it is. To use other locations, give the URLs to
|
|
183
|
+
`createBrowserElkFactory(url)` and `createBrowserRouteFactory({ workerUrl, moduleUrl, wasmUrl })`.
|
|
184
|
+
A bundler resolves the `elkjs/lib/elk-api.js` import of the ES build. Without a bundler, load
|
|
185
|
+
`elkjs/lib/elk-api.js` with a script tag before the UMD build `portograph/internal`
|
|
186
|
+
(`dist/portograph.umd.cjs`).
|
|
187
|
+
|
|
188
|
+
The library does not read the system fonts, so its output depends on the document only. The
|
|
189
|
+
`FONT_MISSING` check below is in the CLI only.
|
|
190
|
+
|
|
191
|
+
## The YAML format
|
|
192
|
+
|
|
193
|
+
[`docs/design/schema.md`](docs/design/schema.md) gives every key. The words that it uses, for
|
|
194
|
+
example tier, flank and bundle, are defined in [`GLOSSARY.md`](GLOSSARY.md) and
|
|
195
|
+
[`CONTEXT.md`](CONTEXT.md).
|
|
196
|
+
|
|
197
|
+
## Font: install Verdana
|
|
198
|
+
|
|
199
|
+
portograph measures all text with the glyph widths of Verdana, and the SVG and the draw.io file
|
|
200
|
+
ask for Verdana. The font list in the output is `Verdana, DejaVu Sans, sans-serif`. If a viewer
|
|
201
|
+
does not have Verdana, it uses a fallback font. That font has different widths, so the text can
|
|
202
|
+
be too wide for its box.
|
|
203
|
+
|
|
204
|
+
Verdana comes with macOS and Windows. On Linux, install the `ttf-mscorefonts-installer` package,
|
|
205
|
+
or copy the font files into `~/.local/share/fonts`. `portograph render` and `portograph layout`
|
|
206
|
+
write the warning `FONT_MISSING` when they do not find Verdana.
|
|
207
|
+
|
|
208
|
+
## How it works
|
|
209
|
+
|
|
210
|
+
The pipeline has one main rule. If placement can reserve a route, a size or a spacing, it does so
|
|
211
|
+
before the router starts. Placement sizes the lanes, the bars, the bundles and the gaps between
|
|
212
|
+
the tiers, so routing never moves a node to make room. The router draws only the links that the
|
|
213
|
+
region rules do not draw.
|
|
214
|
+
|
|
215
|
+
[ELK](https://github.com/kieler/elkjs) places the skeleton, and
|
|
216
|
+
[libavoid](https://github.com/Aksem/libavoid-js) routes the remaining links. The stages, in order,
|
|
217
|
+
are in [`docs/design/pipeline.md`](docs/design/pipeline.md). The gates and the score are in
|
|
218
|
+
[`docs/design/quality.md`](docs/design/quality.md), and the decisions are in
|
|
219
|
+
[`docs/adr/`](docs/adr/).
|
|
220
|
+
|
|
221
|
+
## Showcase
|
|
222
|
+
|
|
223
|
+
The NTP example sheet from drawthe.net, drawn by portograph:
|
|
224
|
+
|
|
225
|
+

|
|
226
|
+
|
|
227
|
+
## Contributing
|
|
228
|
+
|
|
229
|
+
Read [`CONTRIBUTING.md`](CONTRIBUTING.md) before you open a pull request. To report a security
|
|
230
|
+
problem, read [`SECURITY.md`](SECURITY.md).
|
|
231
|
+
|
|
232
|
+
## License
|
|
233
|
+
|
|
234
|
+
Apache-2.0. See [`LICENSE`](LICENSE).
|