stac-custom-extensions
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseStac Custom Extensions
Stac 自定义扩展
Overview
概述
Use this skill to add custom widgets/actions that serialize cleanly and register correctly in a Stac app.
使用此技能可添加能在Stac应用中正确序列化和注册的自定义组件/动作。
Workflow
工作流程
- Choose extension type: widget or action.
- Scaffold model and parser files with scripts.
- Add generated files to app codebase and run codegen.
- Verify parser registration in .
main.dart - Validate runtime wiring with a minimal usage example.
- 选择扩展类型:组件(Widget)或动作(Action)。
- 使用脚本搭建模型和解析器文件。
- 将生成的文件添加到应用代码库并运行代码生成工具。
- 在中验证解析器注册。
main.dart - 通过最小化使用示例验证运行时连接。
Required Inputs
必要输入
- PascalCase extension name.
- Runtime type id (or
type).actionType - Output directory for generated files.
- Path to for registration check.
main.dart
- 采用帕斯卡命名法(PascalCase)的扩展名称。
- 运行时类型ID(或
type)。actionType - 生成文件的输出目录。
- 用于注册检查的路径。
main.dart
Output Contract
输出约定
- Produce model + parser pair with consistent type ids.
- Include registration snippet for .
Stac.initialize - Include command when json serialization is used.
build_runner
- 生成具有一致类型ID的模型+解析器对。
- 包含用于的注册代码片段。
Stac.initialize - 当使用JSON序列化时,包含命令。
build_runner
References
参考资料
- Read for widget model/parser flow.
references/custom-widget-checklist.md - Read for action model/parser flow.
references/custom-action-checklist.md - Read for initialization wiring.
references/parser-registration.md - Read for converter usage patterns.
references/converters-guide.md
- 阅读了解组件模型/解析器流程。
references/custom-widget-checklist.md - 阅读了解动作模型/解析器流程。
references/custom-action-checklist.md - 阅读了解初始化连接方式。
references/parser-registration.md - 阅读了解转换器使用模式。
references/converters-guide.md
Scripts
脚本
scripts/scaffold_custom_widget.py --name <Name> --type <widgetType> --out-dir <path>scripts/scaffold_custom_action.py --name <Name> --action-type <actionType> --out-dir <path>scripts/check_parser_registration.py --main-dart <path> --parser-class <ClassName>
scripts/scaffold_custom_widget.py --name <Name> --type <widgetType> --out-dir <path>scripts/scaffold_custom_action.py --name <Name> --action-type <actionType> --out-dir <path>scripts/check_parser_registration.py --main-dart <path> --parser-class <ClassName>
Templates
模板
assets/templates/custom_widget.dart.tmplassets/templates/custom_widget_parser.dart.tmplassets/templates/custom_action.dart.tmplassets/templates/custom_action_parser.dart.tmpl
assets/templates/custom_widget.dart.tmplassets/templates/custom_widget_parser.dart.tmplassets/templates/custom_action.dart.tmplassets/templates/custom_action_parser.dart.tmpl