Export optional Kryon modules for Ziran packages
This commit is contained in:
1 parent
923e2c092d
commit
987f5843f9
11 files changed
+39
-1
No files matched your search
@@ -214,6 +214,9 @@ public-surface-check: $(BUILD_DIR)/ziran-toolchain.stamp
|
||||
-o $(BUILD_DIR)/public/widgets tests/public_widgets.zi
|
||||
$(ZI2ZIR_BIN) --root tests --module-path src/plot --module-path src/ui $(ZIRAN_STD_PATH) \
|
||||
-o $(BUILD_DIR)/public/plot tests/public_plot.zi
|
||||
$(ZI2ZIR_BIN) --root tests --module-path src/plot --module-path src/data_views \
|
||||
--module-path src/kss --module-path src/syntax --module-path src/ui $(ZIRAN_STD_PATH) \
|
||||
-o $(BUILD_DIR)/public/optional tests/public_optional.zi
|
||||
|
||||
check: all plot data-views kss syntax ziran-test header-check project-test public-surface-check
|
||||
.PHONY: typeface-source-test
|
||||
|
||||
@@ -9,6 +9,8 @@ Ziran package apps import `Kryon` for geometry, drawing values, sessions,
|
||||
Text, and Button, or `Widgets` for the full core widget catalog. The optional
|
||||
`PlotWidget` module is a separate import. These names are exported by
|
||||
[`ziran.toml`](../ziran.toml).
|
||||
The same package also exports optional `TableView`, `TreeView`, `Kss`, and
|
||||
`Syntax` modules. Applications import only the packages they use.
|
||||
|
||||
## Use a checked module
|
||||
|
||||
|
||||
+2
-1
@@ -37,7 +37,8 @@ module with `using UI :: #import "Kryon";` and exports
|
||||
profile needs SDL2 and Cairo development libraries. Project builds can use
|
||||
`--locked` and `--offline` for exact, cached dependencies. Import `Widgets`
|
||||
for the complete core widget catalog and `PlotWidget` for the optional chart
|
||||
widget. Plot is the first app using this route and exports its own `Plot`
|
||||
widget. `TableView`, `TreeView`, `Kss`, and `Syntax` are separate optional
|
||||
imports. Plot is the first app using this route and exports its own `Plot`
|
||||
module; the names do not collide.
|
||||
|
||||
The compiler resolves short imports inside the importing package and its
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
using TableViewPropsModule :: #import "table_view_props";
|
||||
using TableViewModule :: #import "table_view";
|
||||
@@ -0,0 +1,2 @@
|
||||
using TreeViewPropsModule :: #import "tree_view_props";
|
||||
using TreeViewModule :: #import "tree_view";
|
||||
@@ -0,0 +1,3 @@
|
||||
using ParserModule :: #import "kss_parser";
|
||||
using FormatterModule :: #import "kss_formatter";
|
||||
using StyleParseModule :: #import "style_parse";
|
||||
@@ -1,3 +1,4 @@
|
||||
// Optional chart widget surface. Apps import this only when they use charts.
|
||||
using PlotPropsModule :: #import "plot_props";
|
||||
using PlotModule :: #import "plot";
|
||||
using PlotWidgetModule :: #import "plot_widget";
|
||||
@@ -0,0 +1 @@
|
||||
using SyntaxModule :: #import "syntax";
|
||||
@@ -0,0 +1,17 @@
|
||||
using UI :: #import "Widgets";
|
||||
using Charts :: #import "PlotWidget";
|
||||
using Tables :: #import "TableView";
|
||||
using Trees :: #import "TreeView";
|
||||
using Styles :: #import "Kss";
|
||||
using Coloring :: #import "Syntax";
|
||||
|
||||
PublicOptional :: () -> s32 {
|
||||
environment: KssEnvironment = KssDefaultEnvironment()
|
||||
if environment.theme != 0 { return 1 }
|
||||
if !SyntaxDarkBackground(cast(u32)0x101010ff) { return 2 }
|
||||
range: PlotRange = PlotRangeFor(0.0, 10.0, 2.0, 8.0)
|
||||
if range.min_value != 0.0 || range.max_value != 10.0 { return 3 }
|
||||
if TableViewSelectedRowFor(8, 3) != 2 { return 4 }
|
||||
if TreeViewContentHeight(2, 20) != 40 { return 5 }
|
||||
return 42
|
||||
}
|
||||
@@ -3,5 +3,7 @@ using Charts :: #import "PlotWidget";
|
||||
|
||||
PublicPlot :: (session: Session, props: PlotProps,
|
||||
values: []float32) -> s32 {
|
||||
range: PlotRange = PlotRangeFor(0.0, 10.0, 2.0, 8.0)
|
||||
if range.min_value != 0.0 { return -1 }
|
||||
return Plot(session, props, values)
|
||||
}
|
||||
@@ -8,6 +8,10 @@ Widgets = "src/ui/Widgets/module.zi"
|
||||
geometry = "src/ui/geometry.zi"
|
||||
drawing_props = "src/ui/drawing_props.zi"
|
||||
PlotWidget = "src/plot/PlotWidget/module.zi"
|
||||
TableView = "src/data_views/TableView/module.zi"
|
||||
TreeView = "src/data_views/TreeView/module.zi"
|
||||
Kss = "src/kss/Kss/module.zi"
|
||||
Syntax = "src/syntax/Syntax/module.zi"
|
||||
|
||||
[tool]
|
||||
project = "build/bin/kryon"
|
||||
Reference in new issue
Block a user