json-schema: PHYスキーマを相対座標モデルとKLE往復の決定に合わせる
cd6a94f(相対座標・回転中心なし)と 1a9a2a0(KLE往復は照合)の反映漏れを直す。 - position を $defs/transform (x, y, rotation) に置き換え、rotationOrigin を削除 - size を width/height から w/h に揃え、親の変換を受けないことを明記 - elements を root / children に改名 - kleCompatibility.originalIndex を削除(KLEは保存時にキーを並べ替える) - 使用例を新しい形に更新し、スキーマで検証が通ることを確認 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
+36
-61
@@ -10,6 +10,8 @@ PHY (物理配置) → IDX (キー識別) → ELC (電気配線) + MAP (キー
|
|||||||
|
|
||||||
## 1. PHYレイヤー JSON Schema
|
## 1. PHYレイヤー JSON Schema
|
||||||
|
|
||||||
|
座標・回転・サイズの意味は `PHYレイヤー.md` を正とする。
|
||||||
|
|
||||||
### 基本構造
|
### 基本構造
|
||||||
|
|
||||||
```json
|
```json
|
||||||
@@ -19,7 +21,7 @@ PHY (物理配置) → IDX (キー識別) → ELC (電気配線) + MAP (キー
|
|||||||
"title": "PHY Layer - Physical Key Layout",
|
"title": "PHY Layer - Physical Key Layout",
|
||||||
"description": "Physical positioning and sizing of keys",
|
"description": "Physical positioning and sizing of keys",
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"required": ["version", "metadata", "profiles", "elements"],
|
"required": ["version", "metadata", "profiles", "root"],
|
||||||
"properties": {
|
"properties": {
|
||||||
"version": {
|
"version": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
@@ -61,7 +63,7 @@ PHY (物理配置) → IDX (キー識別) → ELC (電気配線) + MAP (キー
|
|||||||
"$ref": "#/$defs/profile"
|
"$ref": "#/$defs/profile"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"elements": {
|
"root": {
|
||||||
"type": "array",
|
"type": "array",
|
||||||
"items": {
|
"items": {
|
||||||
"oneOf": [
|
"oneOf": [
|
||||||
@@ -72,6 +74,16 @@ PHY (物理配置) → IDX (キー識別) → ELC (電気配線) + MAP (キー
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"$defs": {
|
"$defs": {
|
||||||
|
"transform": {
|
||||||
|
"type": "object",
|
||||||
|
"description": "Placement relative to the parent: rotate by rotation around the local origin, then translate by (x, y)",
|
||||||
|
"required": ["x", "y", "rotation"],
|
||||||
|
"properties": {
|
||||||
|
"x": { "type": "number" },
|
||||||
|
"y": { "type": "number" },
|
||||||
|
"rotation": { "type": "number", "description": "Degrees" }
|
||||||
|
}
|
||||||
|
},
|
||||||
"profile": {
|
"profile": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"required": ["id", "name", "unitSize"],
|
"required": ["id", "name", "unitSize"],
|
||||||
@@ -98,7 +110,7 @@ PHY (物理配置) → IDX (キー識別) → ELC (電気配線) + MAP (キー
|
|||||||
},
|
},
|
||||||
"key": {
|
"key": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"required": ["type", "id", "profile", "position", "size"],
|
"required": ["type", "id", "profile", "transform", "size"],
|
||||||
"properties": {
|
"properties": {
|
||||||
"type": {
|
"type": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
@@ -112,28 +124,14 @@ PHY (物理配置) → IDX (キー識別) → ELC (電気配線) + MAP (キー
|
|||||||
"type": "string",
|
"type": "string",
|
||||||
"description": "Reference to profile ID"
|
"description": "Reference to profile ID"
|
||||||
},
|
},
|
||||||
"position": {
|
"transform": { "$ref": "#/$defs/transform" },
|
||||||
"type": "object",
|
|
||||||
"required": ["x", "y"],
|
|
||||||
"properties": {
|
|
||||||
"x": { "type": "number" },
|
|
||||||
"y": { "type": "number" },
|
|
||||||
"rotation": { "type": "number" },
|
|
||||||
"rotationOrigin": {
|
|
||||||
"type": "object",
|
|
||||||
"properties": {
|
|
||||||
"x": { "type": "number" },
|
|
||||||
"y": { "type": "number" }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"size": {
|
"size": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"required": ["width", "height"],
|
"description": "Local size. Not affected by the parent transform",
|
||||||
|
"required": ["w", "h"],
|
||||||
"properties": {
|
"properties": {
|
||||||
"width": { "type": "number", "minimum": 0 },
|
"w": { "type": "number", "minimum": 0 },
|
||||||
"height": { "type": "number", "minimum": 0 }
|
"h": { "type": "number", "minimum": 0 }
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"metadata": {
|
"metadata": {
|
||||||
@@ -146,7 +144,6 @@ PHY (物理配置) → IDX (キー識別) → ELC (電気配線) + MAP (キー
|
|||||||
"type": "object",
|
"type": "object",
|
||||||
"description": "Original KLE fields for round-trip compatibility",
|
"description": "Original KLE fields for round-trip compatibility",
|
||||||
"properties": {
|
"properties": {
|
||||||
"originalIndex": { "type": "integer" },
|
|
||||||
"labels": { "type": "array", "items": { "type": "string" } },
|
"labels": { "type": "array", "items": { "type": "string" } },
|
||||||
"textSizes": { "type": "array", "items": { "type": "number" } },
|
"textSizes": { "type": "array", "items": { "type": "number" } },
|
||||||
"decalData": { "type": "object" }
|
"decalData": { "type": "object" }
|
||||||
@@ -158,7 +155,7 @@ PHY (物理配置) → IDX (キー識別) → ELC (電気配線) + MAP (キー
|
|||||||
},
|
},
|
||||||
"cluster": {
|
"cluster": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"required": ["type", "id", "name", "elements"],
|
"required": ["type", "id", "name", "transform", "children"],
|
||||||
"properties": {
|
"properties": {
|
||||||
"type": {
|
"type": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
@@ -166,22 +163,8 @@ PHY (物理配置) → IDX (キー識別) → ELC (電気配線) + MAP (キー
|
|||||||
},
|
},
|
||||||
"id": { "type": "string" },
|
"id": { "type": "string" },
|
||||||
"name": { "type": "string" },
|
"name": { "type": "string" },
|
||||||
"position": {
|
"transform": { "$ref": "#/$defs/transform" },
|
||||||
"type": "object",
|
"children": {
|
||||||
"properties": {
|
|
||||||
"x": { "type": "number" },
|
|
||||||
"y": { "type": "number" },
|
|
||||||
"rotation": { "type": "number" },
|
|
||||||
"rotationOrigin": {
|
|
||||||
"type": "object",
|
|
||||||
"properties": {
|
|
||||||
"x": { "type": "number" },
|
|
||||||
"y": { "type": "number" }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"elements": {
|
|
||||||
"type": "array",
|
"type": "array",
|
||||||
"items": {
|
"items": {
|
||||||
"oneOf": [
|
"oneOf": [
|
||||||
@@ -215,31 +198,27 @@ PHY (物理配置) → IDX (キー識別) → ELC (電気配線) + MAP (キー
|
|||||||
"visualOffset": { "x": 1, "y": 1, "radius": 1 }
|
"visualOffset": { "x": 1, "y": 1, "radius": 1 }
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"elements": [
|
"root": [
|
||||||
{
|
{
|
||||||
"type": "cluster",
|
"type": "cluster",
|
||||||
"id": "left_main",
|
"id": "left_main",
|
||||||
"name": "Left Main Block",
|
"name": "Left Main Block",
|
||||||
"position": {
|
"transform": { "x": 0, "y": 0, "rotation": 0 },
|
||||||
"x": 0, "y": 0,
|
"children": [
|
||||||
"rotation": 0,
|
|
||||||
"rotationOrigin": { "x": 3, "y": 2 }
|
|
||||||
},
|
|
||||||
"elements": [
|
|
||||||
{
|
{
|
||||||
"type": "key",
|
"type": "key",
|
||||||
"id": "k00",
|
"id": "k00",
|
||||||
"profile": "standard",
|
"profile": "standard",
|
||||||
"position": { "x": 0, "y": 0 },
|
"transform": { "x": 0, "y": 0, "rotation": 0 },
|
||||||
"size": { "width": 1, "height": 1 },
|
"size": { "w": 1, "h": 1 },
|
||||||
"metadata": { "label": "Q" }
|
"metadata": { "label": "Q" }
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "key",
|
"type": "key",
|
||||||
"id": "k01",
|
"id": "k01",
|
||||||
"profile": "standard",
|
"profile": "standard",
|
||||||
"position": { "x": 1, "y": 0 },
|
"transform": { "x": 1, "y": 0, "rotation": 0 },
|
||||||
"size": { "width": 1, "height": 1 },
|
"size": { "w": 1, "h": 1 },
|
||||||
"metadata": { "label": "W" }
|
"metadata": { "label": "W" }
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
@@ -248,26 +227,22 @@ PHY (物理配置) → IDX (キー識別) → ELC (電気配線) + MAP (キー
|
|||||||
"type": "cluster",
|
"type": "cluster",
|
||||||
"id": "left_thumb",
|
"id": "left_thumb",
|
||||||
"name": "Left Thumb Cluster",
|
"name": "Left Thumb Cluster",
|
||||||
"position": {
|
"transform": { "x": 2, "y": 3, "rotation": 15 },
|
||||||
"x": 2, "y": 3,
|
"children": [
|
||||||
"rotation": 15,
|
|
||||||
"rotationOrigin": { "x": 1, "y": 0.5 }
|
|
||||||
},
|
|
||||||
"elements": [
|
|
||||||
{
|
{
|
||||||
"type": "key",
|
"type": "key",
|
||||||
"id": "k30",
|
"id": "k30",
|
||||||
"profile": "standard",
|
"profile": "standard",
|
||||||
"position": { "x": 0, "y": 0 },
|
"transform": { "x": 0, "y": 0, "rotation": 0 },
|
||||||
"size": { "width": 1.25, "height": 1 },
|
"size": { "w": 1.25, "h": 1 },
|
||||||
"metadata": { "label": "Space" }
|
"metadata": { "label": "Space" }
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "key",
|
"type": "key",
|
||||||
"id": "k31",
|
"id": "k31",
|
||||||
"profile": "standard",
|
"profile": "standard",
|
||||||
"position": { "x": 1.25, "y": 0 },
|
"transform": { "x": 1.25, "y": 0, "rotation": 0 },
|
||||||
"size": { "width": 1, "height": 1 },
|
"size": { "w": 1, "h": 1 },
|
||||||
"metadata": { "label": "Enter" }
|
"metadata": { "label": "Enter" }
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|||||||
Reference in New Issue
Block a user