Refactor UI actions to use client action API instead of view methods#630
Merged
Conversation
Migrate samples from the obsolete z2ui5 custom controls (timer, title, lp_title, focus, scrolling) to the built-in frontend events via client->action->gen( cs_event-* ): - 000: lp_title -> SET_TITLE_LAUNCHPAD, scrolling -> SCROLL_TO with s_scroll captured before sub-app navigation - 049, 082: repeating timer -> START_TIMER re-armed on TIMER_FINISHED - 064: conditional timer -> START_TIMER re-armed while loading is active - 073: timer + open_new_tab workaround -> direct OPEN_NEW_TAB action - 118, 307, 316, 320: title -> SET_TITLE - 279: focus -> SET_FOCUS https://claude.ai/code/session_013vV6hf86priocTxjQCFC4v
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR refactors multiple demo apps to use the new
client->action->gen()API for triggering UI actions (timers, focus, title, scroll) instead of calling view builder methods like_z2ui5()->timer(),_z2ui5()->focus(), and_z2ui5()->title(). This aligns with the framework's shift toward a more explicit action-based architecture.Key Changes
z2ui5_cl_demo_app_000: Replaced scroll state management (
mt_scroll,mv_set_scroll) with a structureds_scrollvariable. Removed view-based scrolling setup and replaced withclient->action->gen()call usingcs_event-scroll_to. Replacedlp_title()view method withclient->action->gen()usingcs_event-set_title_launchpad.z2ui5_cl_demo_app_073: Removed timer and URL state attributes (
mv_url,mv_check_timer_active). Replaced view-based timer setup with directclient->action->gen()call usingcs_event-open_new_tabwhen the button is clicked.z2ui5_cl_demo_app_064: Removed view-based timer setup. Added
client->action->gen()call usingcs_event-start_timerin the event handler when the timer completes.z2ui5_cl_demo_app_082: Removed view-based timer setup. Added
client->action->gen()calls usingcs_event-start_timerin both the event handler and view display method.z2ui5_cl_demo_app_049: Removed view-based timer setup. Added
client->action->gen()calls usingcs_event-start_timerin both the event handler and view display method.z2ui5_cl_demo_app_118: Removed
_z2ui5()->title()view method call. Addedclient->action->gen()call usingcs_event-set_titlein the view display method.z2ui5_cl_demo_app_279: Removed
_z2ui5()->focus()view method call. Addedclient->action->gen()call usingcs_event-set_focusin the view display method.z2ui5_cl_demo_app_307: Removed
_z2ui5()->title()view method call. Addedclient->action->gen()call usingcs_event-set_titlein the view display method.z2ui5_cl_demo_app_316: Removed
_z2ui5()->title()view method call. Addedclient->action->gen()call usingcs_event-set_titlein the view display method.z2ui5_cl_demo_app_320: Removed
_z2ui5()->title()view method call. Addedclient->action->gen()call usingcs_event-set_titlein the view display method.Implementation Details
cs_event-start_timerwith event name and delay in milliseconds as arguments.cs_event-set_titleorcs_event-set_title_launchpadwith the title string as an argument.cs_event-set_focuswith the control ID as an argument.cs_event-scroll_towith ID, Y position, and X position as arguments.https://claude.ai/code/session_013vV6hf86priocTxjQCFC4v