[LayerNext 1] Add shared hosting and typed layer authoring contracts
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 5/5
- 预计耗时
- 一周以上
- 新手友好度
- 35/100
- Issue 类型
- 功能
- 描述清晰度
- 基本清楚
- 活跃度
- 活跃
- 技术栈
- react, typescript
调研方向
Start by reading prerequisite #358 and coordinate the constructor typing and React inference work in #360 and #363; inspect the existing Layer, graph registration, useLayer/GraphLayer APIs, declaration checks, and v1-to-v2 migration guide. The issue leaves the public API design open, so first settle the authoring syntax and host/adapter boundaries with maintainers. Done means the acceptance criteria pass for mixed old and new layers, source and packed declarations, current consumers, and migration documentation.
由索引模型根据 Issue 内容生成。
描述
Parent: #373. Status: deferred. Target branch: v2.
Prerequisite: #358. Coordinate constructor typing with #360 and React inference with #363; this task must not block the existing strict track.
Problem
Current layer props combine user data, graph/camera/root dependencies and resource configuration. Authoring a canvas layer requires repeating context types and validating fields that the base layer creates. canvas and graphCanvas can refer to different elements depending on the subclass.
Scope
- Design and introduce
LayerNextalongside the existingLayer, without subclassing the old public API. - Share an internal host/adapter mechanism for registration, scheduling and resources rather than copying the engine.
- Separate user props from runtime dependencies and resource creation options; graph root ownership is internal.
- Define typed canvas-only, HTML-only, combined and resource-free modes. Choose ergonomic syntax before implementation; the public surface should remain centered on
LayerandLayerNextduring transition. - Provide a guaranteed drawing context for canvas mode, checked when created. The new drawing hook should receive a prepared canvas without requiring manual resetTransform or super calls.
- Give own-canvas access a consistent meaning. Use the graph API explicitly for the main graph canvas in the new model.
- Make graph registration and React useLayer/GraphLayer accept both models while preserving exact props, instance and ref types. Omitted props are allowed only when no user prop is required.
Acceptance criteria
- Old and new custom layers can coexist in one graph and continue rendering correctly.
- Required/optional custom props, concrete methods/refs and generic custom classes are checked against source and packed declarations.
- Canvas resources are required only in canvas-capable modes; missing resources and null 2D context have defined behavior.
- Author code does not need a custom context assertion to access its declared resources.
- No graph/camera/root injection details appear in user props; registration retains inference without blanket constructor casts.
- Source/declaration checks and current consumers stay green; transition changes are documented in the v1-to-v2 migration guide.
The detailed API design is future work for this issue, not an already approved implementation spec. Lifecycle/disposal and reactive prop updates are tracked by the following child tasks.
- 主要语言
- TypeScript
- 星标
- 145
- 派生
- 12
- 平均合并
- 1 天 14 小时
- 30 天内合并 PR
- 43
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
gravity-ui/graph 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 82/100
gravity-ui/graph#457 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 77/100
gravity-ui/graph#455 ·
维护者通常 1 天内回复
-
难度 4/5 3-5 天 新手友好度 55/100
gravity-ui/graph#456 ·
维护者通常 1 天内回复
-
难度 4/5 3-5 天 新手友好度 48/100
gravity-ui/graph#431 ·
维护者通常 1 天内回复
-
proposal
难度 5/5 一周以上 新手友好度 25/100
gravity-ui/graph#416 ·
维护者通常 1 天内回复
相似的 Issue
-
clawsweeper:fix-shape-clear clawsweeper:queueable-fix clawsweeper:source-repro impact:ux-friction issue-rating: 🦞 diamond lobster no-stale P2
难度 2/5 1-3 小时 新手友好度 68/100
openclaw/openclaw#199885 · 2 条评论 · 1 个 reaction ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 88/100
-
feature needs-triage
难度 2/5 1-3 小时 新手友好度 78/100
BoardGamesEmpire/board-games-empire-backend#1306 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 80/100
sequant-io/sequant#1689 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 80/100