Preserve canonical hosted record identity across package boundaries
Describe nominal host types with their defining module and generate widget wire names from the same declaration identity. Match package-qualified records and slices through the shared hosted-value matcher, retaining module and package mismatch rejection. Add a separate package-consumer host regression and negative identity cases. Pin the canonical type producer from Ziran. Local tests: widget host, widget codec, component host, and all six hosted tests pass. Ziran portable records, slices, arrays, capabilities, payloads, web lifecycle and bootstrap checks pass. Broader checks have unrelated shared-checkout failures reported separately. Reported-by: Breeze task codex-breeze-breeze-crash-recovery-ui
This commit is contained in:
1 parent
77184e46c5
commit
9ca2e6731b
10 files changed
+861
-347
No files matched your search
@@ -252,6 +252,17 @@ def source_specs(paths):
|
||||
return specs
|
||||
|
||||
|
||||
class TypeNames(dict):
|
||||
"""Source spellings and defining-module identities for the same types."""
|
||||
def __init__(self):
|
||||
super().__init__()
|
||||
self.wire = {}
|
||||
for _, _, relative, renames in KRYON_PACKAGE_SOURCES:
|
||||
path = KRYON_UI / relative
|
||||
for name in re.findall(r'^([A-Za-z_]\w*)\s*::\s*(?:struct|enum)\b', path.read_text(), re.M):
|
||||
self.wire[renames.get(name, name)] = f'{path.stem}.{name}'
|
||||
|
||||
|
||||
def read_schema(specs):
|
||||
"""Return logical wire schemas and their concrete Ziran type names."""
|
||||
schema = {}
|
||||
@@ -264,7 +275,7 @@ def read_schema(specs):
|
||||
# Package imports may use any local alias. Defaults have an explicit alias;
|
||||
# application sources are learned from their own `Alias :: #import` lines.
|
||||
qualified = {}
|
||||
type_names = {}
|
||||
type_names = TypeNames()
|
||||
for spec in specs:
|
||||
aliases = dict(spec.get('imports', {}))
|
||||
if spec['alias'] is not None:
|
||||
@@ -283,6 +294,7 @@ def read_schema(specs):
|
||||
local[actual] = logical
|
||||
concrete = f"{spec['alias']}.{actual}" if spec['alias'] else actual
|
||||
type_names[logical] = concrete
|
||||
type_names.wire[logical] = f"{spec['path'].stem}.{actual}"
|
||||
|
||||
def logical_kind(kind):
|
||||
def replace(match):
|
||||
@@ -400,7 +412,7 @@ def concrete_kind(kind, type_names):
|
||||
|
||||
def wire_kind(kind, type_names):
|
||||
"""Qualified HostValue spelling that keeps package-local records distinct."""
|
||||
return concrete_kind(kind, type_names)
|
||||
return concrete_kind(kind, type_names.wire)
|
||||
|
||||
|
||||
def scalar_encode(value, kind, type_names):
|
||||
@@ -444,6 +456,8 @@ def generate(schema, needed, provided, header, imports, type_names, methods=None
|
||||
for kind in [*needed, *extra]:
|
||||
fields = schema[kind]
|
||||
if kind not in provided:
|
||||
lines += [f'WidgetType{kind} :: "{wire_kind(kind, type_names)}"',
|
||||
f'WidgetSliceType{kind} :: "[]{wire_kind(kind, type_names)}"', '']
|
||||
if methods is not None and any('Widget' + op + kind not in methods for op in emitters):
|
||||
lines += ['// Widget codec schema: ' + json.dumps([kind, fields], separators=(',', ':'))]
|
||||
lines += [f'Widget{kind}Codec :: struct {{', f' fields: [{len(fields)}]HostField']
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
// missing field keeps its zero value and an unknown one is ignored. The
|
||||
// usual field order is checked first.
|
||||
#import "std/bundle_host"
|
||||
#import "bundle_names"
|
||||
#import "std/byte_text_linux"
|
||||
|
||||
using HostValueKind;
|
||||
@@ -43,10 +44,9 @@ HostFieldAt :: (value: HostValue, position: s32, name: string) -> s32 {
|
||||
return -1
|
||||
}
|
||||
|
||||
// A package body names its own record without an import qualifier while its
|
||||
// host names that record through a package import. Keep those two spellings
|
||||
// compatible, but do not confuse equally named records from two packages.
|
||||
// Container prefixes stay exact.
|
||||
// Nominal names use their defining module. Package builds qualify that module
|
||||
// with a package identity; ordinary module builds use its plain name. Keep
|
||||
// different modules and container shapes distinct.
|
||||
HostTypeSame :: (actual: string, expected: string) -> bool {
|
||||
if actual == expected { return true }
|
||||
actual_at: s64 = 0
|
||||
@@ -83,7 +83,12 @@ HostTypeSame :: (actual: string, expected: string) -> bool {
|
||||
}
|
||||
actual_qualified := actual_leaf != actual_at
|
||||
expected_qualified := expected_leaf != expected_at
|
||||
if actual_qualified && expected_qualified { return false }
|
||||
if actual_qualified && expected_qualified {
|
||||
if actual[actual_leaf:] != expected[expected_leaf:] { return false }
|
||||
actual_module := actual[actual_at:actual_leaf - 1]
|
||||
expected_module := expected[expected_at:expected_leaf - 1]
|
||||
return ModuleName(actual_module, expected_module) || ModuleName(expected_module, actual_module)
|
||||
}
|
||||
if actual[actual_leaf:] == expected[expected_leaf:] { return true }
|
||||
if actual_qualified {
|
||||
return HostTypeFlatSame(actual[actual_at:], expected[expected_at:])
|
||||
|
||||
+752
-308
File diff suppressed because it is too large.
Load diff
@@ -954,7 +954,7 @@ WidgetHostTabBar :: (session: Session, arguments: *HostValue, result: *HostValue
|
||||
return 0
|
||||
}
|
||||
values := arguments[2]
|
||||
if !WidgetHostSliceValid(values, "[]Tab", cast(usize)WIDGET_HOST_TAB_LIMIT) {
|
||||
if !WidgetHostSliceValid(values, WidgetSliceTypeTab, cast(usize)WIDGET_HOST_TAB_LIMIT) {
|
||||
return 0
|
||||
}
|
||||
index: usize = 0
|
||||
@@ -977,7 +977,7 @@ WidgetHostSegmentedControl :: (session: Session, arguments: *HostValue, result:
|
||||
return 0
|
||||
}
|
||||
values := arguments[2]
|
||||
if !WidgetHostSliceValid(values, "[]SegmentOption", cast(usize)WIDGET_HOST_OPTION_LIMIT) {
|
||||
if !WidgetHostSliceValid(values, WidgetSliceTypeSegmentOption, cast(usize)WIDGET_HOST_OPTION_LIMIT) {
|
||||
return 0
|
||||
}
|
||||
index: usize = 0
|
||||
@@ -1002,7 +1002,7 @@ WidgetHostTitleBar :: (session: Session, arguments: *HostValue, result: *HostVal
|
||||
return 0
|
||||
}
|
||||
values := arguments[2]
|
||||
if !WidgetHostSliceValid(values, "[]DropdownOption", cast(usize)WIDGET_HOST_OPTION_LIMIT) {
|
||||
if !WidgetHostSliceValid(values, WidgetSliceTypeDropdownOption, cast(usize)WIDGET_HOST_OPTION_LIMIT) {
|
||||
return 0
|
||||
}
|
||||
props := WidgetDecodeTitleBarProps(arguments[1], *widget_title_bar_codec)
|
||||
@@ -1031,7 +1031,7 @@ WidgetHostDropdown :: (session: Session, arguments: *HostValue, result: *HostVal
|
||||
return 0
|
||||
}
|
||||
values := arguments[2]
|
||||
if !WidgetHostSliceValid(values, "[]DropdownOption", cast(usize)WIDGET_HOST_OPTION_LIMIT) {
|
||||
if !WidgetHostSliceValid(values, WidgetSliceTypeDropdownOption, cast(usize)WIDGET_HOST_OPTION_LIMIT) {
|
||||
return 0
|
||||
}
|
||||
props := WidgetDecodeDropdownProps(arguments[1], *widget_dropdown_codec)
|
||||
@@ -1075,7 +1075,7 @@ WidgetHostActionModal :: (session: Session, arguments: *HostValue, result: *Host
|
||||
return 0
|
||||
}
|
||||
values := arguments[2]
|
||||
if !WidgetHostSliceValid(values, "[]ActionModalAction", cast(usize)16) {
|
||||
if !WidgetHostSliceValid(values, WidgetSliceTypeActionModalAction, cast(usize)16) {
|
||||
return 0
|
||||
}
|
||||
index: usize = 0
|
||||
@@ -1098,7 +1098,7 @@ WidgetHostActionModal :: (session: Session, arguments: *HostValue, result: *Host
|
||||
WidgetHostContextMenu :: (session: Session, arguments: *HostValue, result: *HostValue) -> s32 {
|
||||
if !WidgetValidContextMenuProps(arguments[1]) { return 0 }
|
||||
values := arguments[2]
|
||||
if !WidgetHostSliceValid(values, "[]ContextMenuItem", cast(usize)WIDGET_HOST_OPTION_LIMIT) { return 0 }
|
||||
if !WidgetHostSliceValid(values, WidgetSliceTypeContextMenuItem, cast(usize)WIDGET_HOST_OPTION_LIMIT) { return 0 }
|
||||
index: usize = 0
|
||||
while index < values.length {
|
||||
if !WidgetValidContextMenuItem(values.elements[index]) { return 0 }
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
// tests/ziran_hosted_action_modal_test.sh through Kryon's real widget host.
|
||||
#import "kryon/session"
|
||||
Modal :: #import "kryon/modal";
|
||||
TitleBar :: #import "kryon/title_bar";
|
||||
Dropdown :: #import "kryon/dropdown";
|
||||
|
||||
test_host :: #system_library "host_api";
|
||||
TestSessionHost :: () -> Session #foreign test_host;
|
||||
@@ -9,6 +11,8 @@ TestSessionHost :: () -> Session #foreign test_host;
|
||||
#program_export
|
||||
main :: () -> s32 {
|
||||
session := TestSessionHost()
|
||||
options: [1]Dropdown.Option = .[Dropdown.Option.{.label = "Settings"}]
|
||||
unused TitleBar.Draw(session, TitleBar.Props.{.key = cast(u64)19, .title = "Customize"}, options[:])
|
||||
actions: [2]Modal.ActionModalAction = .[
|
||||
Modal.ActionModalAction.{.key = cast(u64)1, .label = "Keep editing"},
|
||||
Modal.ActionModalAction.{.key = cast(u64)2, .label = "Discard"},
|
||||
|
||||
@@ -24,6 +24,10 @@ session_codec: WidgetSessionCodec;
|
||||
modal_calls: s32;
|
||||
modal_accepted: s32;
|
||||
action_slice_name: string;
|
||||
titlebar_calls: s32;
|
||||
titlebar_accepted: s32;
|
||||
titlebar_record_name: string;
|
||||
titlebar_slice_name: string;
|
||||
|
||||
Allows :: (context: *void, module: string, function: string) -> bool {
|
||||
unused context
|
||||
@@ -42,8 +46,14 @@ Call :: (context: *void, module: *u8, function: *u8,
|
||||
modal_calls += 1
|
||||
action_slice_name = TextFromCString(arguments[2].type_name)
|
||||
}
|
||||
if name == "TitleBarHostedHost" && count == 3 {
|
||||
titlebar_calls += 1
|
||||
titlebar_record_name = TextFromCString(arguments[1].type_name)
|
||||
titlebar_slice_name = TextFromCString(arguments[2].type_name)
|
||||
}
|
||||
accepted := WidgetHostCall(null, module, function, arguments, count, result)
|
||||
if name == "ActionModalHostedHost" && accepted == 1 { modal_accepted += 1 }
|
||||
if name == "TitleBarHostedHost" && accepted == 1 { titlebar_accepted += 1 }
|
||||
return accepted
|
||||
}
|
||||
|
||||
@@ -72,7 +82,7 @@ main :: () -> s32 {
|
||||
WidgetHostEnd()
|
||||
if EndFrame(session) != cast(FrameStatus)FrameOk { return 2 }
|
||||
// The guest sends Kryon's qualified slice type, and the host draws it.
|
||||
if modal_calls != 1 || action_slice_name != "[]Modal.ActionModalAction" {
|
||||
if modal_calls != 1 || !HostTypeSame(action_slice_name, WidgetSliceTypeActionModalAction) {
|
||||
print("action modal calls % with slice %\n", modal_calls, action_slice_name)
|
||||
return 3
|
||||
}
|
||||
@@ -80,6 +90,15 @@ main :: () -> s32 {
|
||||
print("action modal accepted % ran % answer %\n", modal_accepted, ran, answer)
|
||||
return 4
|
||||
}
|
||||
if titlebar_calls != 1 || titlebar_accepted != 1 ||
|
||||
!HostTypeSame(titlebar_record_name, WidgetTypeTitleBarProps) ||
|
||||
!HostTypeSame(titlebar_slice_name, WidgetSliceTypeDropdownOption) {
|
||||
print("titlebar calls % accepted % record % slice %\n", titlebar_calls,
|
||||
titlebar_accepted, titlebar_record_name, titlebar_slice_name)
|
||||
return 5
|
||||
}
|
||||
print("packaged titlebar record % expected % slice % expected %\n",
|
||||
titlebar_record_name, WidgetTypeTitleBarProps, titlebar_slice_name, WidgetSliceTypeDropdownOption)
|
||||
HostedAppClose(*app)
|
||||
return 0
|
||||
}
|
||||
@@ -4,11 +4,24 @@ repo=$(CDPATH= cd -- "$(dirname -- "$0")/.." && pwd)
|
||||
. "$repo/tests/toolchain.sh"
|
||||
unset DISPLAY WAYLAND_DISPLAY XAUTHORITY DBUS_SESSION_BUS_ADDRESS SESSION_MANAGER
|
||||
export YUE_DESKTOP_RECOVERY=0
|
||||
work=$(mktemp -d)
|
||||
mkdir -p "$repo/build/scratch"
|
||||
work=$(mktemp -d "$repo/build/scratch/hosted-action-modal.XXXXXX")
|
||||
trap 'rm -rf "$work"' EXIT HUP INT TERM
|
||||
"$ziran" bundle --root "$repo/tests" $kryon_project_args \
|
||||
# Compile the guest as a separate consumer so its imported modules carry a
|
||||
# package identity, as they do in applications.
|
||||
python3 - "$repo" "$work/project" <<'PYFIXTURE'
|
||||
from pathlib import Path
|
||||
import sys
|
||||
repo, project = map(Path, sys.argv[1:])
|
||||
sys.path.insert(0, str(repo / 'tests'))
|
||||
from toolchain import kryon_test_project
|
||||
kryon_test_project(project)
|
||||
(project / 'src/hosted_action_modal_guest.zi').write_bytes(
|
||||
(repo / 'tests/hosted_action_modal_guest.zi').read_bytes())
|
||||
PYFIXTURE
|
||||
(cd "$work/project" && "$ziran" bundle --root "$work/project/src" --project --offline \
|
||||
--define KRYON_HOSTED_UI --entry hosted_action_modal_guest:main \
|
||||
-o "$work/hosted-action-modal.zx" "$repo/tests/hosted_action_modal_guest.zi"
|
||||
-o "$work/hosted-action-modal.zx" "$work/project/src/hosted_action_modal_guest.zi")
|
||||
"$ziran" build --target=c --no-main --entry hosted_action_modal_host_test:main \
|
||||
--root "$repo/tests" $kryon_project_args -o "$work/c" \
|
||||
"$repo/tests/hosted_action_modal_host_test.zi"
|
||||
|
||||
@@ -201,6 +201,11 @@ Call :: (module: string, function: string, arguments: []HostValue, result: *Host
|
||||
|
||||
#program_export
|
||||
main :: () -> s32 {
|
||||
if HostTypeSame("Text.Props", "Image.Props") ||
|
||||
HostTypeSame("p0123456789abcdef_text_props.Props", WidgetTypeImageProps) ||
|
||||
HostTypeSame("p0123456789abcdef_title_bar_props.Props", "pfedcba9876543210_title_bar_props.Props") {
|
||||
return 120
|
||||
}
|
||||
dimensions := HostedImageDimensions()
|
||||
if dimensions != 0 { return 1000 + dimensions }
|
||||
boundary := HostedPointerBoundary()
|
||||
@@ -404,7 +409,7 @@ main :: () -> s32 {
|
||||
arguments[1] = WidgetEncodePressProps(Press.Props.{.id = 12, .label = "Message",
|
||||
.bounds = Rectangle.{0.0, 100.0, 200.0, 40.0}, .now = 1.0}, *press_codec)
|
||||
if Call("press", "PressHostedHost", arguments[:2], *result) != 1 ||
|
||||
result.kind != cast(s32)HostRecord || TextFromCString(result.type_name) != "Press.PressResult" {
|
||||
result.kind != cast(s32)HostRecord || TextFromCString(result.type_name) != "press_props.PressResult" {
|
||||
return 30
|
||||
}
|
||||
// A spinbox answers with its value, kept within its range.
|
||||
@@ -412,7 +417,7 @@ main :: () -> s32 {
|
||||
.bounds = Rectangle.{0.0, 140.0, 150.0, 38.0}, .min = 5, .max = 35, .step = 1,
|
||||
.value = 16}, *spinbox_codec)
|
||||
if Call("spinbox", "SpinboxHostedHost", arguments[:2], *result) != 1 ||
|
||||
TextFromCString(result.type_name) != "Spinbox.SpinboxStepResult" ||
|
||||
TextFromCString(result.type_name) != "spinbox_props.SpinboxStepResult" ||
|
||||
WidgetDecodeSpinboxStepResult(result, *spinbox_result).value != 16 {
|
||||
return 31
|
||||
}
|
||||
@@ -420,7 +425,7 @@ main :: () -> s32 {
|
||||
arguments[1] = WidgetEncodeTimePickerProps(TimePicker.Props.{.id = 14, .label = "Start",
|
||||
.bounds = Rectangle.{0.0, 180.0, 150.0, 36.0}, .value = 2000, .now = -1}, *time_picker_codec)
|
||||
if Call("timepicker", "TimePickerHostedHost", arguments[:2], *result) != 1 ||
|
||||
TextFromCString(result.type_name) != "TimePicker.TimePickerResult" ||
|
||||
TextFromCString(result.type_name) != "time_picker_props.TimePickerResult" ||
|
||||
WidgetDecodeTimePickerResult(result, *time_picker_result).value != 1439 ||
|
||||
WidgetDecodeTimePickerResult(result, *time_picker_result).changed {
|
||||
return 32
|
||||
@@ -509,7 +514,7 @@ main :: () -> s32 {
|
||||
index += 1
|
||||
}
|
||||
arguments[1] = WidgetEncodeTabBarProps(TabBar.Props.{}, *tab_bar_codec)
|
||||
arguments[2] = HostValue.{.kind = cast(s32)HostSlice, .type_name = HostTextData("[]Tab"),
|
||||
arguments[2] = HostValue.{.kind = cast(s32)HostSlice, .type_name = HostTextData(WidgetSliceTypeTab),
|
||||
.length = cast(usize)33, .elements = *tab_values[0]}
|
||||
if Call("tabs", "TabBarHostedHost", arguments[:], *result) != 0 {
|
||||
return 11
|
||||
@@ -525,7 +530,7 @@ main :: () -> s32 {
|
||||
}
|
||||
arguments[1] = WidgetEncodeDropdownProps(Dropdown.Props.{.key = cast(u64)315,
|
||||
.bounds = Rectangle.{0.0, 0.0, 200.0, 40.0}, .selected_index = 1}, *dropdown_codec)
|
||||
arguments[2] = HostValue.{.kind = cast(s32)HostSlice, .type_name = HostTextData("[]DropdownOption"),
|
||||
arguments[2] = HostValue.{.kind = cast(s32)HostSlice, .type_name = HostTextData(WidgetSliceTypeDropdownOption),
|
||||
.length = cast(usize)2, .elements = *option_values[0]}
|
||||
if Call("dropdown", "DropdownHostedHost", arguments[:], *result) != 1 ||
|
||||
!WidgetValidDropdownResult(result) || WidgetDecodeDropdownResult(result, *dropdown_result).selected_index != 1 {
|
||||
@@ -554,7 +559,7 @@ main :: () -> s32 {
|
||||
arguments[1] = WidgetEncodeSegmentedControlProps(SegmentedControl.Props.{.key = cast(u64)316,
|
||||
.bounds = Rectangle.{0.0, 0.0, 240.0, 40.0}, .height = 40, .selected_index = 1,
|
||||
.has_selection = true}, *segmented_codec)
|
||||
arguments[2] = HostValue.{.kind = cast(s32)HostSlice, .type_name = HostTextData("[]SegmentOption"),
|
||||
arguments[2] = HostValue.{.kind = cast(s32)HostSlice, .type_name = HostTextData(WidgetSliceTypeSegmentOption),
|
||||
.length = cast(usize)2, .elements = *segment_values[0]}
|
||||
if Call("segmented", "SegmentedControlHostedHost", arguments[:], *result) != 1 ||
|
||||
!WidgetValidSegmentedControlResult(result) ||
|
||||
@@ -565,39 +570,49 @@ main :: () -> s32 {
|
||||
if Call("segmented", "SegmentedControlHostedHost", arguments[:], *result) != 0 {
|
||||
return 105
|
||||
}
|
||||
arguments[2].type_name = HostTextData("[]DropdownOption")
|
||||
arguments[2].type_name = HostTextData(WidgetSliceTypeDropdownOption)
|
||||
arguments[2].length = cast(usize)2
|
||||
if Call("segmented", "SegmentedControlHostedHost", arguments[:], *result) != 0 {
|
||||
return 106
|
||||
}
|
||||
// A bundle names its slices through the public package types.
|
||||
arguments[2].type_name = HostTextData("[]SegmentedControl.SegmentOption")
|
||||
arguments[2].type_name = HostTextData("[]p0123456789abcdef_segmented_control_props.SegmentOption")
|
||||
if Call("segmented", "SegmentedControlHostedHost", arguments[:], *result) != 1 { return 107 }
|
||||
arguments[2].type_name = HostTextData("[]SegmentedControl.DropdownOption")
|
||||
if Call("segmented", "SegmentedControlHostedHost", arguments[:], *result) != 0 { return 108 }
|
||||
arguments[1] = WidgetEncodeTabBarProps(TabBar.Props.{}, *tab_bar_codec)
|
||||
arguments[2] = HostValue.{.kind = cast(s32)HostSlice, .type_name = HostTextData("[]TabBar.Tab"),
|
||||
arguments[2] = HostValue.{.kind = cast(s32)HostSlice, .type_name = HostTextData("[]p0123456789abcdef_tab_bar_props.Tab"),
|
||||
.length = cast(usize)2, .elements = *tab_values[0]}
|
||||
if Call("tabs", "TabBarHostedHost", arguments[:], *result) != 1 { return 109 }
|
||||
arguments[2].type_name = HostTextData("[]TabBar.Segment")
|
||||
if Call("tabs", "TabBarHostedHost", arguments[:], *result) != 0 { return 110 }
|
||||
arguments[1] = WidgetEncodeDropdownProps(Dropdown.Props.{.key = cast(u64)315,
|
||||
.bounds = Rectangle.{0.0, 0.0, 200.0, 40.0}, .selected_index = 1}, *dropdown_codec)
|
||||
arguments[2] = HostValue.{.kind = cast(s32)HostSlice, .type_name = HostTextData("[]Dropdown.Option"),
|
||||
arguments[2] = HostValue.{.kind = cast(s32)HostSlice, .type_name = HostTextData("[]dropdown_props.Option"),
|
||||
.length = cast(usize)2, .elements = *option_values[0]}
|
||||
if Call("dropdown", "DropdownHostedHost", arguments[:], *result) != 1 { return 111 }
|
||||
arguments[2].type_name = HostTextData("[]Dropdown.Tab")
|
||||
if Call("dropdown", "DropdownHostedHost", arguments[:], *result) != 0 { return 112 }
|
||||
arguments[1] = WidgetEncodeTitleBarProps(TitleBar.Props.{.key = cast(u64)15, .title = "Lumi",
|
||||
.bounds = Rectangle.{0.0, 0.0, 300.0, 40.0}, .trailing_width = 100}, *title_bar_codec)
|
||||
arguments[2] = HostValue.{.kind = cast(s32)HostSlice, .type_name = HostTextData("[]DropdownOption"),
|
||||
arguments[2] = HostValue.{.kind = cast(s32)HostSlice, .type_name = HostTextData(WidgetSliceTypeDropdownOption),
|
||||
.length = cast(usize)0, .elements = *option_values[0]}
|
||||
if Call("titlebar", "TitleBarHostedHost", arguments[:], *result) != 1 ||
|
||||
TextFromCString(result.type_name) != "TitleBar.TitleBarResult" ||
|
||||
TextFromCString(result.type_name) != "title_bar_props.TitleBarResult" ||
|
||||
WidgetDecodeTitleBarResult(result, *title_bar_result).trailing_bounds.x != 188.0 ||
|
||||
WidgetDecodeTitleBarResult(result, *title_bar_result).trailing_bounds.width != 100.0 {
|
||||
return 33
|
||||
}
|
||||
// A package identity qualifies the defining module, independent of imports.
|
||||
arguments[1].type_name = HostTextData("p9f8ecaca6100c8aa_title_bar_props.Props")
|
||||
if Call("p9f8ecaca6100c8aa_titlebar", "TitleBarHostedHost", arguments[:], *result) != 1 {
|
||||
return 114
|
||||
}
|
||||
arguments[1].type_name = HostTextData("p9f8ecaca6100c8aa_title_bar_props.TitleBarResult")
|
||||
if Call("p9f8ecaca6100c8aa_titlebar", "TitleBarHostedHost", arguments[:], *result) != 0 {
|
||||
return 115
|
||||
}
|
||||
arguments[1].type_name = HostTextData("title_bar_props.Props")
|
||||
arguments[2].length = cast(usize)33
|
||||
if Call("titlebar", "TitleBarHostedHost", arguments[:], *result) != 0 {
|
||||
return 34
|
||||
@@ -614,7 +629,7 @@ main :: () -> s32 {
|
||||
arguments[1] = WidgetEncodeModalFrameProps(Modal.Props.{.key = cast(u64)16,
|
||||
.title = "Share", .width = 200, .height = 120, .has_right_action = true}, *modal_codec)
|
||||
if Call("modal_frame", "ModalFrameHostedHost", arguments[:2], *result) != 1 ||
|
||||
TextFromCString(result.type_name) != "Modal.ModalFrameResult" ||
|
||||
TextFromCString(result.type_name) != "modal_props.ModalFrameResult" ||
|
||||
!WidgetDecodeModalFrameResult(result, *modal_result).opened ||
|
||||
WidgetDecodeModalFrameResult(result, *modal_result).layout.panel.width != 200.0 {
|
||||
return 36
|
||||
@@ -636,7 +651,7 @@ main :: () -> s32 {
|
||||
arguments[1] = WidgetEncodeScrollProps(Scroll.Props.{.key = cast(u64)7,
|
||||
.bounds = Rectangle.{0.0, 100.0, 200.0, 80.0}, .content_height = 400}, *scroll_codec)
|
||||
if Call("scroll", "ScrollHostedHost", arguments[:2], *result) != 1 ||
|
||||
TextFromCString(result.type_name) != "Scroll.ScrollResult" {
|
||||
TextFromCString(result.type_name) != "scroll_props.ScrollResult" {
|
||||
return 13
|
||||
}
|
||||
// Action dialogs validate the entire action list before drawing it.
|
||||
@@ -645,7 +660,7 @@ main :: () -> s32 {
|
||||
action_values: [1]HostValue
|
||||
action_values[0] = WidgetEncodeActionModalAction(Modal.ActionModalAction.{.label = "Keep editing"}, *action_codec)
|
||||
arguments[2] = HostValue.{.kind = cast(s32)HostSlice,
|
||||
.type_name = HostTextData("[]Modal.ActionModalAction"), .length = cast(usize)1,
|
||||
.type_name = HostTextData("[]modal_props.ActionModalAction"), .length = cast(usize)1,
|
||||
.elements = *action_values[0]}
|
||||
if Call("modal", "ActionModalHostedHost", arguments[:], *result) != 1 ||
|
||||
!WidgetValidActionModalResult(result) ||
|
||||
@@ -662,7 +677,7 @@ main :: () -> s32 {
|
||||
if Call("modal", "ActionModalHostedHost", arguments[:], *result) != 0 {
|
||||
return 42
|
||||
}
|
||||
arguments[2].type_name = HostTextData("[]Modal.ActionModalAction")
|
||||
arguments[2].type_name = HostTextData("[]modal_props.ActionModalAction")
|
||||
action_values[0] = HostScalar("s32", 1)
|
||||
if Call("modal", "ActionModalHostedHost", arguments[:], *result) != 0 {
|
||||
return 43
|
||||
@@ -701,7 +716,7 @@ main :: () -> s32 {
|
||||
options[0].image.asset_path = "assets/photo.png"
|
||||
option_values[0] = WidgetEncodeDropdownOption(options[0], *option_codecs[0])
|
||||
arguments[1] = WidgetEncodeTitleBarProps(pictured, *title_bar_codec)
|
||||
arguments[2] = HostValue.{.kind = cast(s32)HostSlice, .type_name = HostTextData("[]DropdownOption"),
|
||||
arguments[2] = HostValue.{.kind = cast(s32)HostSlice, .type_name = HostTextData(WidgetSliceTypeDropdownOption),
|
||||
.length = cast(usize)1, .elements = *option_values[0]}
|
||||
if Call("titlebar", "TitleBarHostedHost", arguments[:], *result) != 1 ||
|
||||
widget_options[0].image.asset_path != "apps/owner-a/assets/photo.png" || resolve_checks != checks + 3 { return 48 }
|
||||
@@ -805,7 +820,7 @@ main :: () -> s32 {
|
||||
menu_values[0] = WidgetEncodeContextMenuItem(ContextMenu.ContextMenuItem.{.id = 1, .label = "Open"}, *menu_item_codecs[0])
|
||||
menu_values[1] = WidgetEncodeContextMenuItem(ContextMenu.ContextMenuItem.{.id = 2, .label = "Disabled", .disabled = true}, *menu_item_codecs[1])
|
||||
menu_values[2] = WidgetEncodeContextMenuItem(ContextMenu.ContextMenuItem.{.id = 3, .label = "Update"}, *menu_item_codecs[2])
|
||||
arguments[2] = HostValue.{.kind = cast(s32)HostSlice, .type_name = HostTextData("[]ContextMenuItem"),
|
||||
arguments[2] = HostValue.{.kind = cast(s32)HostSlice, .type_name = HostTextData(WidgetSliceTypeContextMenuItem),
|
||||
.length = cast(usize)3, .elements = *menu_values[0]}
|
||||
before = PendingPaintCount(session)
|
||||
arguments[2].length = cast(usize)33
|
||||
@@ -1032,7 +1047,7 @@ HostedPointerBoundary :: () -> s32 {
|
||||
tabs[0] = TabBar.Tab.{.key = 10, .label = "First"}
|
||||
tabs[1] = TabBar.Tab.{.key = 11, .label = "Second"}
|
||||
for index: 0..1 { tab_values[index] = WidgetEncodeTab(tabs[index], *tab_codecs[index]) }
|
||||
arguments[2] = HostValue.{.kind = cast(s32)HostSlice, .type_name = HostTextData("[]Tab"),
|
||||
arguments[2] = HostValue.{.kind = cast(s32)HostSlice, .type_name = HostTextData(WidgetSliceTypeTab),
|
||||
.length = cast(usize)2, .elements = *tab_values[0]}
|
||||
props := TabBar.Props.{.key = 80, .bounds = .{0.0, 0.0, 280.0, 44.0}, .selected_index = 1}
|
||||
arguments[1] = WidgetEncodeTabBarProps(props, *tab_bar_codec)
|
||||
|
||||
+2
-2
@@ -142,8 +142,8 @@
|
||||
"name": "kryon"
|
||||
},
|
||||
"toolchain": {
|
||||
"commit": "f9f92b46db88b48cede41a6feb560915972b2ce6",
|
||||
"ref": "f9f92b46db88b48cede41a6feb560915972b2ce6",
|
||||
"commit": "96c23c7de6bc622225a916dfce18bff04486ba2b",
|
||||
"ref": "96c23c7de6bc622225a916dfce18bff04486ba2b",
|
||||
"url": "https://github.com/ziranlang/ziran.git"
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -6,7 +6,7 @@ module_roots = ["src/ui", "src/backend", "src/ui/alert", "src/ui/avatar", "src/u
|
||||
[toolchain]
|
||||
git = "https://github.com/ziranlang/ziran.git"
|
||||
# Ziran v0.5.0
|
||||
ref = "f9f92b46db88b48cede41a6feb560915972b2ce6"
|
||||
ref = "96c23c7de6bc622225a916dfce18bff04486ba2b"
|
||||
|
||||
[dependencies.raylib]
|
||||
git = "https://github.com/raysan5/raylib.git"
|
||||
|
||||
Reference in new issue
Block a user