schema: PHYスキーマをPHYレイヤー.mdに追従させる
size に x2〜h2、key に switchOffset / partGroup / orientation / perKeyLED / decal / ghost / labels を追加し、部品ノードを component として定義して root と cluster.children に加えた。 key.metadata は廃止し、labels をトップレベルへ移した。残る見た目の 属性は保持する先の層が決まっていない(P-6)ため、構造化せず kleCompatibility に不透明なまま置く。 PHYレイヤー.md 側の「スキーマが追従していない」注記を削除。 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
@@ -153,8 +153,6 @@ Transform は回転と平行移動だけを持つ剛体変換であり、合成
|
||||
各ノードは親から見た変換を持つ。キー・クラスター・部品ノードを混在させた木構造として保持する。
|
||||
各ノードはIDを持つ。木の中のノードを一意に指すために持ち、キーのIDは他レイヤーからの参照にも使う。
|
||||
|
||||
`phase1-json-schema.md` のPHYスキーマは、この節の Key 型(x2〜h2, decal, ghost, labels, switchOffset, partGroup, orientation, perKeyLED)と Component 型にまだ追従していない。
|
||||
|
||||
```ts
|
||||
type Transform = {
|
||||
x: number, // 親座標系での位置
|
||||
|
||||
+92
-21
@@ -10,7 +10,7 @@ PHY (物理配置) → IDX (キー識別) → ELC (電気配線) + MAP (キー
|
||||
|
||||
## 1. PHYレイヤー JSON Schema
|
||||
|
||||
座標・回転・サイズの意味は `PHYレイヤー.md` を正とする。
|
||||
各フィールドの意味は `PHYレイヤー.md` を正とする。
|
||||
|
||||
### 基本構造
|
||||
|
||||
@@ -68,7 +68,8 @@ PHY (物理配置) → IDX (キー識別) → ELC (電気配線) + MAP (キー
|
||||
"items": {
|
||||
"oneOf": [
|
||||
{ "$ref": "#/$defs/key" },
|
||||
{ "$ref": "#/$defs/cluster" }
|
||||
{ "$ref": "#/$defs/cluster" },
|
||||
{ "$ref": "#/$defs/component" }
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -131,25 +132,65 @@ PHY (物理配置) → IDX (キー識別) → ELC (電気配線) + MAP (キー
|
||||
"required": ["w", "h"],
|
||||
"properties": {
|
||||
"w": { "type": "number", "minimum": 0 },
|
||||
"h": { "type": "number", "minimum": 0 }
|
||||
"h": { "type": "number", "minimum": 0 },
|
||||
"x2": { "type": "number", "description": "Second rectangle for non-rectangular keys, relative to the local origin" },
|
||||
"y2": { "type": "number" },
|
||||
"w2": { "type": "number", "minimum": 0 },
|
||||
"h2": { "type": "number", "minimum": 0 }
|
||||
}
|
||||
},
|
||||
"metadata": {
|
||||
"switchOffset": {
|
||||
"type": "object",
|
||||
"description": "Switch position, offset from the center of the (w, h) rectangle. Key local coordinates, unit U. Defaults to 0",
|
||||
"required": ["x", "y"],
|
||||
"properties": {
|
||||
"label": { "type": "string" },
|
||||
"color": { "type": "string" },
|
||||
"textColor": { "type": "string" },
|
||||
"kleCompatibility": {
|
||||
"type": "object",
|
||||
"description": "Original KLE fields for round-trip compatibility",
|
||||
"properties": {
|
||||
"labels": { "type": "array", "items": { "type": "string" } },
|
||||
"textSizes": { "type": "array", "items": { "type": "number" } },
|
||||
"decalData": { "type": "object" }
|
||||
}
|
||||
}
|
||||
"x": { "type": "number" },
|
||||
"y": { "type": "number" }
|
||||
}
|
||||
},
|
||||
"partGroup": {
|
||||
"type": "string",
|
||||
"description": "Label grouping keys that use the same part. Not interpreted by Beyond KLE"
|
||||
},
|
||||
"orientation": {
|
||||
"type": "integer",
|
||||
"enum": [0, 90, 180, 270],
|
||||
"default": 0,
|
||||
"description": "Switch orientation in the key local coordinates"
|
||||
},
|
||||
"perKeyLED": {
|
||||
"type": "boolean",
|
||||
"default": false,
|
||||
"description": "Whether a per-key LED is mounted"
|
||||
},
|
||||
"decal": { "type": "boolean", "default": false },
|
||||
"ghost": { "type": "boolean", "default": false },
|
||||
"labels": {
|
||||
"type": "array",
|
||||
"items": { "type": "string" },
|
||||
"description": "Reference information. Used for matching on KLE JSON import"
|
||||
},
|
||||
"kleCompatibility": {
|
||||
"type": "object",
|
||||
"description": "Opaque KLE fields kept for round-trip output (c, t, p, a, f, f2, fa, l, n, sm, sb, st). The owning layer is undecided; see P-6 in PHYレイヤー.md",
|
||||
"additionalProperties": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"component": {
|
||||
"type": "object",
|
||||
"description": "Non-key part placed by the designer (LED, OLED, encoder, screw hole, ...)",
|
||||
"required": ["type", "id", "transform"],
|
||||
"properties": {
|
||||
"type": {
|
||||
"type": "string",
|
||||
"const": "component"
|
||||
},
|
||||
"id": { "type": "string" },
|
||||
"transform": { "$ref": "#/$defs/transform" },
|
||||
"partGroup": {
|
||||
"type": "string",
|
||||
"description": "Names starting with @ are reserved for editor rendering"
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -169,7 +210,8 @@ PHY (物理配置) → IDX (キー識別) → ELC (電気配線) + MAP (キー
|
||||
"items": {
|
||||
"oneOf": [
|
||||
{ "$ref": "#/$defs/key" },
|
||||
{ "$ref": "#/$defs/cluster" }
|
||||
{ "$ref": "#/$defs/cluster" },
|
||||
{ "$ref": "#/$defs/component" }
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -211,7 +253,9 @@ PHY (物理配置) → IDX (キー識別) → ELC (電気配線) + MAP (キー
|
||||
"profile": "standard",
|
||||
"transform": { "x": 0, "y": 0, "rotation": 0 },
|
||||
"size": { "w": 1, "h": 1 },
|
||||
"metadata": { "label": "Q" }
|
||||
"partGroup": "main",
|
||||
"perKeyLED": true,
|
||||
"labels": ["Q"]
|
||||
},
|
||||
{
|
||||
"type": "key",
|
||||
@@ -219,7 +263,9 @@ PHY (物理配置) → IDX (キー識別) → ELC (電気配線) + MAP (キー
|
||||
"profile": "standard",
|
||||
"transform": { "x": 1, "y": 0, "rotation": 0 },
|
||||
"size": { "w": 1, "h": 1 },
|
||||
"metadata": { "label": "W" }
|
||||
"partGroup": "main",
|
||||
"perKeyLED": true,
|
||||
"labels": ["W"]
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -235,7 +281,9 @@ PHY (物理配置) → IDX (キー識別) → ELC (電気配線) + MAP (キー
|
||||
"profile": "standard",
|
||||
"transform": { "x": 0, "y": 0, "rotation": 0 },
|
||||
"size": { "w": 1.25, "h": 1 },
|
||||
"metadata": { "label": "Space" }
|
||||
"partGroup": "thumb",
|
||||
"orientation": 180,
|
||||
"labels": ["Space"]
|
||||
},
|
||||
{
|
||||
"type": "key",
|
||||
@@ -243,9 +291,32 @@ PHY (物理配置) → IDX (キー識別) → ELC (電気配線) + MAP (キー
|
||||
"profile": "standard",
|
||||
"transform": { "x": 1.25, "y": 0, "rotation": 0 },
|
||||
"size": { "w": 1, "h": 1 },
|
||||
"metadata": { "label": "Enter" }
|
||||
"partGroup": "thumb",
|
||||
"orientation": 180,
|
||||
"labels": ["Enter"]
|
||||
},
|
||||
{
|
||||
"type": "component",
|
||||
"id": "enc0",
|
||||
"transform": { "x": 2.25, "y": 0.5, "rotation": 0 },
|
||||
"partGroup": "encoder"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "key",
|
||||
"id": "k_iso_enter",
|
||||
"profile": "standard",
|
||||
"transform": { "x": 6, "y": 1, "rotation": 0 },
|
||||
"size": { "w": 1.5, "h": 1, "x2": 0.25, "y2": 1, "w2": 1.25, "h2": 1 },
|
||||
"switchOffset": { "x": 0, "y": 0.5 },
|
||||
"labels": ["Enter"]
|
||||
},
|
||||
{
|
||||
"type": "component",
|
||||
"id": "screw0",
|
||||
"transform": { "x": 0, "y": 4.5, "rotation": 0 },
|
||||
"partGroup": "screw-m2"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user