Repository navigation
feat: 宿主自定义能力 host.call、Button children、RadioButton;可作为 included build 被宿主 App 吃 - #9
Conversation
…d 被宿主 App 吃 TrendingAI 订阅页触发的第三批框架补齐: - J3 `host.call(name, args)`:宿主经 `HostServices.capabilities` 按名注册,与框架名重合在构造时报错,挂载清单一并列出 - `Button` 的 `text` 改可选、支持 children(按钮内放加载指示);新内置 `RadioButton`,选中态由 JS 持有 - `gradle/composite-substitutions` 声明坐标映射;作为被包含构建时不再 include sample, 嵌套的 quickjs-kmp 替换已在 TrendingAI 里验证生效 Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Sorry @HarlonWang, you've used your own review budget of 250,000 diff characters for the last 7 days.
You can request another review in 2 days and 15 hours by commenting @sourcery-ai review. Upgrade to get a review now.
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Advanced Run ID: Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
审查者指南本 PR 在 J3 协议上增加可由宿主注册的异步 host.call 能力调度时序图sequenceDiagram
participant Page as Page JS
participant Host as PageHost
participant Capability as HostCapability
participant PageAPI as Page JS Promise
Page->>Host: __host_call(name, cbId, argsJson)
Host->>Capability: call(argsJson)
Capability-->>Host: JSON result or HostException
alt capability succeeds
Host->>Page: resolve(cbId, result)
Page->>PageAPI: fulfill Promise
else HostException
Host->>Page: reject(cbId, code, message)
Page->>PageAPI: reject with HostError
else capability unavailable
Host->>Page: reject(cbId, E_UNSUPPORTED, message)
Page->>PageAPI: reject with HostError
end
文件级变更
提示与命令与 Sourcery 交互
自定义你的使用体验访问你的控制面板以:
获取帮助Original review guide in EnglishReviewer's Guide本 PR 在 J3 协议上增加可由宿主注册的异步 Sequence diagram for host.call capability dispatchsequenceDiagram
participant Page as Page JS
participant Host as PageHost
participant Capability as HostCapability
participant PageAPI as Page JS Promise
Page->>Host: __host_call(name, cbId, argsJson)
Host->>Capability: call(argsJson)
Capability-->>Host: JSON result or HostException
alt capability succeeds
Host->>Page: resolve(cbId, result)
Page->>PageAPI: fulfill Promise
else HostException
Host->>Page: reject(cbId, code, message)
Page->>PageAPI: reject with HostError
else capability unavailable
Host->>Page: reject(cbId, E_UNSUPPORTED, message)
Page->>PageAPI: reject with HostError
end
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
CodeSeer 审查
结论:批准
摘要
本次改动为宿主侧新增了 host.call 能力注册与异步回调收口,并将能力清单传入挂载 manifest。同时扩展了 Button children、加入 RadioButton,并调整 Gradle 设置以支持作为 composite build 引入。基于给出的代码,未发现由这些增量明确引入的逻辑、异常处理、资源管理或构建配置问题。
整个 PR 至 021bab5 · gpt-5.6-terra
宿主类型包里 `<ta.Icon>` 要能直接写:生成 `export const ta = { Icon: "ta.Icon" } as const` 与
`declare module "@tiny-ui/core/jsx-runtime"` 的 IntrinsicElements 合并,不再需要手写胶水。
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
背景
TrendingAI 订阅页实战接入(docs/roadmap.md)触发的第三批框架补齐。订阅页需要 JS 调宿主自己的动作(下单、登录、埋点)、按钮内放加载指示、单选档位,并让 TrendingAI 经
local.properties的tinyui.dir以 composite build 吃本仓源码。改动
host.call<T>(name, args);KotlinHostServices(capabilities = mapOf(name to HostCapability { argsJson -> … })),suspend、返回 JSON 文本,HostException走 E3 码。与框架十个名字重合在构造时报错;挂载清单的capabilities列出框架名 + 宿主名。http.request与能力共用同一个settle收口Buttonchildren:text改可选,有 children 时当标签渲染RadioButton:selected(必填)/enabled/onClick,选中态由 JS 持有gradle/composite-substitutions(wang.harlon:tinyui = :compose);gradle.parent != null时不 include sample;compose 的mustRunAfter对不存在的 sample 项目做了防护验证
pnpm build && pnpm test(core 41 / native 4 / cli 22)、pnpm schema:check、pnpm typecheck:compose:testAndroidHostTest(21)、:compose:apiCheck(apiDump 已更新)、:sample:androidApp:assembleDebugdependencyInsight确认wang.harlon:tinyui → project ':tinyui:compose',嵌套的quickjs-kmp → project ':quickjs-kmp:library'同样生效,:shared:compileAndroidMain通过(TrendingAI 侧需把 AGP 升到 9.4.0 与两库对齐,composite 要求一致)🤖 Generated with Claude Code
Sourcery 总结
启用宿主集成功能和订阅页面 UI 原语,同时使 TinyUI 可作为 Gradle 组合构建使用。
新功能:
host.callAPI,用于从页面调用宿主定义的异步功能。Button添加子内容支持,并引入由 JS 控制的RadioButton组件。增强功能:
构建:
文档:
测试:
Original summary in English
Sourcery 总结
支持宿主应用集成和订阅页面 UI 原语,同时允许 TinyUI Compose 从宿主应用的 Gradle 组合构建中使用。
新功能:
host.callAPI,用于从页面调用由宿主异步定义的功能。Button添加子内容支持,并引入由 JS 控制的RadioButton组件。增强:
构建:
文档:
Button子内容渲染以及RadioButton的状态行为。测试:
Original summary in English
Summary by Sourcery
Enable host application integration and subscription-page UI primitives while allowing TinyUI Compose to be consumed from a host application's Gradle composite build.
New Features:
host.callAPI for invoking asynchronous host-defined capabilities from pages.Buttonand introduce the JS-controlledRadioButtoncomponent.Enhancements:
Build:
Documentation:
Tests: