@gramlot/gramlot-examples

中文文档
0.3.46发布于 2026/11/11Apache-2.0ES Module构建来源已验证近 30 天下载 7115

Gramlot example pages, the gallery page and its catalogue.

原始使用文档
文档目录4 节
  1. Run the gallery locally
  2. Updating
  3. Pages
  4. Gallery

gramlot-examples

The common example pages of Gramlot, the gallery page that presents them, and its catalogue. Published as a package that depends only on the Gramlot core:

pip install gramlot-examples
npm install @gramlot/gramlot-examples

PyPI npm

Current release: 0.3.46.

Clone the examples to keep an editable copy. Install Python 3.11 or newer, Git and Node.js 22 or newer with npm, then run (macOS/Linux):

git clone https://github.com/gramlot-org/gramlot-examples.git
cd gramlot-examples
python3 -m venv .venv
source .venv/bin/activate
npm install --package-lock=false
npm run build
python -m pip install -e . "gramlot-py-server[uvicorn]"
gramlot uvicorn gallery --remote-edit

On Windows, use python -m venv .venv and activate the environment with .venv\Scripts\activate in Command Prompt; the remaining commands are the same.

Open the local address printed by the command. In an example's Code tab, edit the Python source and select Save; the local source file is updated and the preview reloads. --remote-edit also permits saving in the IDE's temporary sample workspace, which is reset when the gallery stops. Use this option only on your own trusted local server; the public gallery is read-only. Without the option, example sources remain read-only.

Database examples may require additional services and configuration.

Documentation and learning sequence include every lesson, its Python and JavaScript source, and the gallery guide. To run the examples, choose the Python server, Node.js/Bun server or serverless exporter.

The repositories of the family are described in The Gramlot family (GC-055).

Updating

Choose packaged or source-checkout updates. A Python gallery installed from source also needs its JavaScript bundles rebuilt; updating Python files alone does not update the footer inspector.

Pages

src/gramlot_examples/pages/ holds five families. Each example is a Python page and its JavaScript equivalent, with a same-name README:

  • html_svg/: thirteen HTML and SVG pages, without binding (e01–e13);

  • binding/: eleven pages whose DOM follows the Data (b01–b11);

  • controllers/: twenty-three pages with formulas, controllers, named logic, events, the end-to-end story, dataRpc calls to the endpoints of the page, remote fragments and dataRemote values (c01–c23). Later lessons introduce topics, authored references, native ask, parent/child messages, plain HTML buttons and delayed Gramlot clicks. The package requires the current core release; each lesson states which features it uses.

  • components/: thirty-four lessons for inputs, labelbox, formlet, group copy, command buttons and field validation (w01–w25), with compact controls.

  • layout/: eight container lessons (l01–l08), with live splitters, drawers, nested layouts, selection and closing events, fourteen tab presentations, a guided drawer tour and a lazy carousel with retained live previews.

Each NN_name.js exports Page, and Logic when the page names client methods; the Python page NN_name.py takes that Logic from the module beside it.

The gallery page lists the families and opens each example beside its README and source. build_gallery (Python) and buildGallery (JavaScript) return its routes and static assets; each environment (gramlot-py-server, gramlot-js-server) serves the gallery with its own server and can add its own catalogue. Guide: GE-010.

npm install --no-package-lock
npm run build
npm test
python -m pytest -q tests

Repository map (GE-005).

版本与发布记录

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

版本发布日期距今
0.3.46latest2026/11/116 天前
0.3.452026/11/116 天前
0.3.442026/11/107 天前
0.3.432026/11/107 天前
0.3.422026/11/088 天前
0.3.412026/11/079 天前

关于 @gramlot/gramlot-examples 的常见问题

@gramlot/gramlot-examples 是什么?

Gramlot example pages, the gallery page and its catalogue.

如何安装 @gramlot/gramlot-examples?

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

@gramlot/gramlot-examples 支持 TypeScript 吗?

该包的 package.json 没有声明类型入口。需要类型提示时,可以在 npm 上查找社区维护的 @types/gramlot__gramlot-examples 是否存在。

@gramlot/gramlot-examples 支持 ESM 还是 CommonJS?

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

@gramlot/gramlot-examples 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js >=22。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

@gramlot/gramlot-examples 可以商用吗?

@gramlot/gramlot-examples 使用 Apache-2.0 许可。宽松许可:允许商业使用、修改和再分发,并附带明确的专利授权;分发时需保留许可与 NOTICE 文件,修改过的文件要注明改动。以上为概括,不构成法律意见,请以许可原文为准。

@gramlot/gramlot-examples 的下载量有多少?

根据 npm 官方下载统计,@gramlot/gramlot-examples 在 2026/10/17 – 2026/11/15 这 30 天内被下载 7,115 次,日均约 237 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@gramlot/gramlot-examples 还在维护吗?

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