From 9ebe302691216b178375f04c4460af76b9e287a9 Mon Sep 17 00:00:00 2001 From: EwdErna Date: Fri, 18 Sep 2026 22:17:36 +0900 Subject: [PATCH] =?UTF-8?q?json-schema:=20PHY=E3=82=B9=E3=82=AD=E3=83=BC?= =?UTF-8?q?=E3=83=9E=E3=82=92=E7=9B=B8=E5=AF=BE=E5=BA=A7=E6=A8=99=E3=83=A2?= =?UTF-8?q?=E3=83=87=E3=83=AB=E3=81=A8KLE=E5=BE=80=E5=BE=A9=E3=81=AE?= =?UTF-8?q?=E6=B1=BA=E5=AE=9A=E3=81=AB=E5=90=88=E3=82=8F=E3=81=9B=E3=82=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- phase1-json-schema.md | 97 ++++++++++++++++--------------------------- 1 file changed, 36 insertions(+), 61 deletions(-) diff --git a/phase1-json-schema.md b/phase1-json-schema.md index 980e385..87364bf 100644 --- a/phase1-json-schema.md +++ b/phase1-json-schema.md @@ -10,6 +10,8 @@ PHY (物理配置) → IDX (キー識別) → ELC (電気配線) + MAP (キー ## 1. PHYレイヤー JSON Schema +座標・回転・サイズの意味は `PHYレイヤー.md` を正とする。 + ### 基本構造 ```json @@ -19,7 +21,7 @@ PHY (物理配置) → IDX (キー識別) → ELC (電気配線) + MAP (キー "title": "PHY Layer - Physical Key Layout", "description": "Physical positioning and sizing of keys", "type": "object", - "required": ["version", "metadata", "profiles", "elements"], + "required": ["version", "metadata", "profiles", "root"], "properties": { "version": { "type": "string", @@ -61,7 +63,7 @@ PHY (物理配置) → IDX (キー識別) → ELC (電気配線) + MAP (キー "$ref": "#/$defs/profile" } }, - "elements": { + "root": { "type": "array", "items": { "oneOf": [ @@ -72,6 +74,16 @@ PHY (物理配置) → IDX (キー識別) → ELC (電気配線) + MAP (キー } }, "$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": { "type": "object", "required": ["id", "name", "unitSize"], @@ -98,7 +110,7 @@ PHY (物理配置) → IDX (キー識別) → ELC (電気配線) + MAP (キー }, "key": { "type": "object", - "required": ["type", "id", "profile", "position", "size"], + "required": ["type", "id", "profile", "transform", "size"], "properties": { "type": { "type": "string", @@ -112,28 +124,14 @@ PHY (物理配置) → IDX (キー識別) → ELC (電気配線) + MAP (キー "type": "string", "description": "Reference to profile ID" }, - "position": { - "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" } - } - } - } - }, + "transform": { "$ref": "#/$defs/transform" }, "size": { "type": "object", - "required": ["width", "height"], + "description": "Local size. Not affected by the parent transform", + "required": ["w", "h"], "properties": { - "width": { "type": "number", "minimum": 0 }, - "height": { "type": "number", "minimum": 0 } + "w": { "type": "number", "minimum": 0 }, + "h": { "type": "number", "minimum": 0 } } }, "metadata": { @@ -146,7 +144,6 @@ PHY (物理配置) → IDX (キー識別) → ELC (電気配線) + MAP (キー "type": "object", "description": "Original KLE fields for round-trip compatibility", "properties": { - "originalIndex": { "type": "integer" }, "labels": { "type": "array", "items": { "type": "string" } }, "textSizes": { "type": "array", "items": { "type": "number" } }, "decalData": { "type": "object" } @@ -158,7 +155,7 @@ PHY (物理配置) → IDX (キー識別) → ELC (電気配線) + MAP (キー }, "cluster": { "type": "object", - "required": ["type", "id", "name", "elements"], + "required": ["type", "id", "name", "transform", "children"], "properties": { "type": { "type": "string", @@ -166,22 +163,8 @@ PHY (物理配置) → IDX (キー識別) → ELC (電気配線) + MAP (キー }, "id": { "type": "string" }, "name": { "type": "string" }, - "position": { - "type": "object", - "properties": { - "x": { "type": "number" }, - "y": { "type": "number" }, - "rotation": { "type": "number" }, - "rotationOrigin": { - "type": "object", - "properties": { - "x": { "type": "number" }, - "y": { "type": "number" } - } - } - } - }, - "elements": { + "transform": { "$ref": "#/$defs/transform" }, + "children": { "type": "array", "items": { "oneOf": [ @@ -215,31 +198,27 @@ PHY (物理配置) → IDX (キー識別) → ELC (電気配線) + MAP (キー "visualOffset": { "x": 1, "y": 1, "radius": 1 } } ], - "elements": [ + "root": [ { "type": "cluster", "id": "left_main", "name": "Left Main Block", - "position": { - "x": 0, "y": 0, - "rotation": 0, - "rotationOrigin": { "x": 3, "y": 2 } - }, - "elements": [ + "transform": { "x": 0, "y": 0, "rotation": 0 }, + "children": [ { "type": "key", "id": "k00", "profile": "standard", - "position": { "x": 0, "y": 0 }, - "size": { "width": 1, "height": 1 }, + "transform": { "x": 0, "y": 0, "rotation": 0 }, + "size": { "w": 1, "h": 1 }, "metadata": { "label": "Q" } }, { "type": "key", "id": "k01", "profile": "standard", - "position": { "x": 1, "y": 0 }, - "size": { "width": 1, "height": 1 }, + "transform": { "x": 1, "y": 0, "rotation": 0 }, + "size": { "w": 1, "h": 1 }, "metadata": { "label": "W" } } ] @@ -248,26 +227,22 @@ PHY (物理配置) → IDX (キー識別) → ELC (電気配線) + MAP (キー "type": "cluster", "id": "left_thumb", "name": "Left Thumb Cluster", - "position": { - "x": 2, "y": 3, - "rotation": 15, - "rotationOrigin": { "x": 1, "y": 0.5 } - }, - "elements": [ + "transform": { "x": 2, "y": 3, "rotation": 15 }, + "children": [ { "type": "key", "id": "k30", "profile": "standard", - "position": { "x": 0, "y": 0 }, - "size": { "width": 1.25, "height": 1 }, + "transform": { "x": 0, "y": 0, "rotation": 0 }, + "size": { "w": 1.25, "h": 1 }, "metadata": { "label": "Space" } }, { "type": "key", "id": "k31", "profile": "standard", - "position": { "x": 1.25, "y": 0 }, - "size": { "width": 1, "height": 1 }, + "transform": { "x": 1.25, "y": 0, "rotation": 0 }, + "size": { "w": 1, "h": 1 }, "metadata": { "label": "Enter" } } ]