From 8aaf46142e9718f72ff2438c7f1ea62333f4d78d Mon Sep 17 00:00:00 2001 From: Waozi Date: Sun, 27 Sep 2026 10:02:00 -0300 Subject: [PATCH] Expose lowercase plot package from src/module.zi --- README.md | 26 ++++++++++++++++++-------- src/Plot/module.zi | 4 ---- src/app.zi | 2 +- src/candle_chart.zi | 4 ++-- src/line_chart.zi | 4 ++-- src/module.zi | 4 ++++ tests/indicator_test.zi | 2 +- ziran.lock | 8 ++++---- ziran.toml | 8 +++++--- 9 files changed, 37 insertions(+), 25 deletions(-) delete mode 100644 src/Plot/module.zi create mode 100644 src/module.zi diff --git a/README.md b/README.md index 0708b8c..fc75555 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Plot -Plot is a Ziran app package that depends on the separate Kryon package. Its candle +`plot` is a Ziran app package that depends on the separate Kryon package. Its candle chart draws OHLC bodies and wicks, volume, SMA 20, SMA 50, and EMA 20 over Kryon's generic `Plot` surface. `ChartMarker` and `CandleMarkers` add dated, clickable markers while leaving each marker's meaning to the caller. It also @@ -12,18 +12,28 @@ Install the Ziran launcher once with `make install-user` in Ziran, then run `ziran fetch` and `make build` here. `make run` opens a small demo on the Cairo backend; `make check` checks the source and runs the nonvisual indicator test. The checked-in `ziran.lock` pins both Ziran and Kryon to exact commits. Plot -exports `Plot/module.zi` for other packages. That module re-exports Plot's +exports `src/module.zi` for other packages. That module re-exports Plot's charts and Kryon's public UI surface; app code can use -`using Charts :: #import "Plot";`. +`using Charts :: #import "plot";`. To add Plot to another Ziran project, run: ```sh -ziran add Plot --git https://github.com/kryonlabs/plot.git +ziran add kryonlabs/plot ``` -The resulting lockfile includes Plot and its Kryon dependency. +Then import its public module: -Other applications can still use `src/candle_chart.zi` and -`src/line_chart.zi` while packaging of reusable chart modules is being -finished. Atr currently links those sources from its `src/` directory. +```zi +using Charts :: #import "plot"; +``` + +The package exports `PriceBar`, `CandleChartProps`, `CandleChart`, +`CandleRangeFor`, `ChartMarker`, `CandleMarkers`, `SMAAt`, `EMAAt`, and +the line chart API. Ziran locks Plot and Kryon to exact commits. No source +links or copied chart files are needed in a consuming package. Run +`ziran update` to refresh every dependency in a project, or +`ziran update kryon` in this package to refresh only Kryon. + +ATR currently uses source links while its older project layout is migrated +to a Ziran package manifest. Other packages can use the dependency directly. diff --git a/src/Plot/module.zi b/src/Plot/module.zi deleted file mode 100644 index 9c4029d..0000000 --- a/src/Plot/module.zi +++ /dev/null @@ -1,4 +0,0 @@ -// Plot's reusable chart API, independent of the demo application's entry. -using UI :: #import "Kryon"; -using Candle :: #import "candle_chart"; -using Line :: #import "line_chart"; diff --git a/src/app.zi b/src/app.zi index 5ea3a22..47fe604 100644 --- a/src/app.zi +++ b/src/app.zi @@ -1,4 +1,4 @@ -using Charts :: #import "Plot"; +using Charts :: #import "module"; #program_export Frame :: (session: Session, viewport: Rectangle) -> s32 { diff --git a/src/candle_chart.zi b/src/candle_chart.zi index b40211f..94d6536 100644 --- a/src/candle_chart.zi +++ b/src/candle_chart.zi @@ -1,5 +1,5 @@ -using UI :: #import "Kryon"; -using PlotWidget :: #import "PlotWidget"; +using UI :: #import "kryon"; +using PlotWidget :: #import "plot_widget"; PriceBar :: struct { timestamp: s64 diff --git a/src/line_chart.zi b/src/line_chart.zi index 0601a43..f0ebe5b 100644 --- a/src/line_chart.zi +++ b/src/line_chart.zi @@ -1,5 +1,5 @@ -using UI :: #import "Kryon"; -using PlotWidget :: #import "PlotWidget"; +using UI :: #import "kryon"; +using PlotWidget :: #import "plot_widget"; ChartRange :: struct { low: float32 diff --git a/src/module.zi b/src/module.zi new file mode 100644 index 0000000..af98014 --- /dev/null +++ b/src/module.zi @@ -0,0 +1,4 @@ +// Reusable chart API, independent of the demo application's entry. +using UI :: #import "kryon"; +using Candle :: #import "candle_chart"; +using Line :: #import "line_chart"; diff --git a/tests/indicator_test.zi b/tests/indicator_test.zi index f464f60..5eb1e53 100644 --- a/tests/indicator_test.zi +++ b/tests/indicator_test.zi @@ -1,5 +1,5 @@ #import "candle_chart" -using UI :: #import "Kryon"; +using UI :: #import "kryon"; #program_export main :: () -> s32 { diff --git a/ziran.lock b/ziran.lock index 030d878..870cf03 100644 --- a/ziran.lock +++ b/ziran.lock @@ -2,9 +2,9 @@ "format": 1, "packages": [ { - "commit": "4235447bbd0fa9bf42dcc276381cb1c3dd55f5a2", + "commit": "938c41faece4b821c76318c45efa051ddb85604f", "dependencies": {}, - "id": "pc63f351f658a1a15", + "id": "pfc84fe5aa8556c7c", "name": "Kryon", "ref": "master", "url": "https://github.com/kryonlabs/kryon.git" @@ -12,9 +12,9 @@ ], "root": { "dependencies": { - "Kryon": "pc63f351f658a1a15" + "kryon": "pfc84fe5aa8556c7c" }, - "name": "Plot" + "name": "plot" }, "toolchain": { "commit": "f3374188260b7c2fc497f0abed1d38fcb822547a", diff --git a/ziran.toml b/ziran.toml index df6d722..92188e0 100644 --- a/ziran.toml +++ b/ziran.toml @@ -1,5 +1,5 @@ [package] -name = "Plot" +name = "plot" entry = "src/app.zi" module_roots = ["src", "tests"] bridge_modules = ["app"] @@ -8,12 +8,14 @@ bridge_modules = ["app"] git = "https://github.com/ziranlang/ziran.git" ref = "master" -[dependencies.Kryon] +[dependencies.kryon] git = "https://github.com/kryonlabs/kryon.git" ref = "master" +module_aliases = { Kryon = "kryon", PlotWidget = "plot_widget" } [exports] -Plot = "src/Plot/module.zi" +plot = "src/module.zi" +Plot = "src/module.zi" [tool.kryon] default_profile = "cairo"