datasette-apps 0.2a0 发布
英文标题:datasette-apps 0.2a0
datasette-apps 0.2a0 为通过 Datasette Agent 创建和编辑 Datasette Apps 的流程带来改进。新版新增 `app_debug()` 工具,允许 Agent 在不可见的 iframe 中运行 JavaScript,对应用进行冒烟测试并测量页面元素尺寸。新增的 `app_list()` 工具则可列出用户有编辑权限的应用,帮助 Agent 定位可编辑目标。这些能力依赖 datasette-agent 0.4a0 引入的 `context.browser_task()` 机制。
中文
改进通过 Datasette Agent 创建和编辑 Datasette Apps 的体验:
app_debug() 工具相当巧妙:它会在一个设置了 opacity: 0 和 pointer-events: none 的 iframe 中显示应用(因此应用既不可见,也无法被交互),随后在这个沙箱化 iframe 内执行由 Agent 提供的 JavaScript。这样一来,Agent 可以对应用是否正常运行进行冒烟测试,甚至还能测量不同元素的尺寸等信息。
这一功能使用了 datasette-agent 0.4a0 中新增的 context.browser_task() 机制。
English / 原文
Changes that improve Datasette Apps when created and edited using Datasette Agent:
The app_debug() tool is pretty neat: it works by displaying the app in a opacity: 0 iframe with pointer-events: none (so it can't be seen or interacted with) and then executing agent-provided JavaScript inside that sandboxed iframe. This means the agent can smoke test that the app is working and even do things like measure the dimensions of different elements.
This uses the new context.browser_task() mechanism added in datasette-agent 0.4a0.