@iyulab/lowline-form

中文文档
0.11.0发布于 2026/11/01MITTypeScriptES Module构建来源已验证

The Lowline form element: a formdown form whose decided fields are suggested from the records people confirmed, talking to a Lowline host's routes.

原始使用文档

<lowline-form>

A formdown form whose decided fields are suggested from the records people confirmed, talking to a Lowline host's routes — the contract at the end of this page, which a host implements over the engine (the .NET reference host is samples/aspnet).

<lowline-form src="/lowline" form="intake" record="r-17"></lowline-form>
<script type="module">
  const form = document.querySelector('lowline-form')
  form.content = '@customer: [text]\n@owner: [select options="kim,lee"]'
  // later: await form.save()  ·  await form.fill('customer Beta, owner lee')
</script>
Property
srcWhere the host's routes are (/lowline).
formThe form, by the name the host defined it under.
recordThe record being written; a record opened again keeps its id, so it is not evidence for itself.
contentThe form's formdown text.
dataThe record's values when it was opened.
rateHow often a field's answer is held back to check it, from 0 to 1 (one in twenty by default).
stringsThe words the form shows, in the host's language.
settled-byWho is writing, as an opaque id the host gives — one person, one id, never a name. Sent with the save when set.
batchThe batch the record is written in, when several come at once from one source. Sent with the save when set.

save() sends the values with the account of what was shown, taken and turned down, and fires lowline-saved; a host that stores the record through its own API calls settle() after its save instead, which sends only the account and has the host's engine learn the record as stored (Saved in .NET); fill(text) offers the host model's values in their fields. A field the records cannot answer yet is judged by the host's model when it has one (judge): asked once for the values it reads, shown in the field while the person writes on, never put in on its own. When the routes do not answer, lowline-unavailable fires and the form is filled in by hand. Nothing is counted in the browser: the host's engine counts what it is sent.

A host that draws its own form imports Draft, Session and LowlineClient from @iyulab/lowline-form/headless, which brings in neither Lit nor formdown and registers no element (the package root carries them too, with the element).

The package is @iyulab/lowline-form, with Lit and formdown as dependencies. A page with no build step takes the one file in it that carries both: dist/bundle/lowline-form.bundle.js.

npm ci
npm test
npm run bundle   # one file with Lit and formdown inside, in dist/bundle

The routes a host serves

Under the prefix the host mounted them at (src):

RouteTakesAnswers
POST {form}/propose{ "id", "values" } — the record so farper open decided field: the suggestion, what it rests on, its promise, or why there is none
POST {form}/settle{ "id", "saved", "draft" } — no saved with Saved{ "id", "settledAt" }; 400 for a value the form cannot hold, and nothing is learned
GET {form}/report—per decided field: the thresholds chosen, how many records they were chosen on (chosenOn), and what the replay of the records saw at them
POST {form}/fill{ "values", "text", "attachments" } — attachments, optional: what the person showed, each { "mediaType", "data" (base64), "name" }; text may be empty when something is shownthe model's values as suggestions; 400 for data that is not base64; 404 saying so without a model
POST {form}/judge{ "id", "values" }the model's judgements for the fields the records could not answer; 404 saying so without a model

A form not defined is 404. Each request's memory space and allowed choices come from the host, never from the request body. The shapes are the engine's own wire shapes: in .NET, LowlineJson serializes them.

版本与发布记录

@iyulab/lowline-form 共发布 12 个版本,首次发布于 2026/10/23;过去 12 个月发布了 12 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
0.11.0latest2026/11/012 天前
0.10.02026/10/276 天前
0.9.02026/10/276 天前
0.8.02026/10/277 天前
0.7.02026/10/249 天前
0.6.02026/10/2410 天前

关于 @iyulab/lowline-form 的常见问题

@iyulab/lowline-form 是什么?

Lowline表单元素:一个formdown表单,它的决定字段是从人们确认的记录中建议的,与Lowline主机的路由对话。

如何安装 @iyulab/lowline-form?

在项目目录运行 npm install @iyulab/lowline-form,或使用 pnpm add / yarn add / bun add。

@iyulab/lowline-form 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@iyulab/lowline-form 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@iyulab/lowline-form 可以商用吗?

@iyulab/lowline-form 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@iyulab/lowline-form 还在维护吗?

最新版本 0.11.0 发布于 2026/11/01(2 天前);至今共发布 12 个版本,其中过去 12 个月发布了 12 个;首次发布于 2026/10/23。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。