PHY: レイアウトバリアントを木のノードとして導入し、ELC/IDXの扱いを決める

交換可能なキークラスタ(ISO Enter、スペース周りのキー数など)を、
VariantGroup / Variant の2ノードでPHYの木に表す。全バリアントのキーを
同時に持ち、単一の配置を要求する出力のときだけ1つ選んで畳む。

ELCは選択に関係なくsupersetを配線する。排他キー同士は同じ接続先を共有してよい。
IDXはキー番号の空間を1つに保ち、同じ接続先に配線された排他キーは
`order` の配列要素として同じ番号を共有する。

Journal: journal/2026-09-21-multi-layout.md

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JPCpuPv6hDN76RgNe2PsRR
This commit is contained in:
2026-09-21 09:34:51 +09:00
co-authored by Claude Opus 5
parent 2eb2867c13
commit a175ee3c53
6 changed files with 296 additions and 23 deletions
+123 -11
View File
@@ -61,7 +61,8 @@ ELC・IDX・MAPはどれもPHYを参照する。ELCはIDXを参照せず、MAP
"oneOf": [
{ "$ref": "#/$defs/key" },
{ "$ref": "#/$defs/cluster" },
{ "$ref": "#/$defs/component" }
{ "$ref": "#/$defs/component" },
{ "$ref": "#/$defs/variantGroup" }
]
}
}
@@ -186,6 +187,58 @@ ELC・IDX・MAPはどれもPHYを参照する。ELCはIDXを参照せず、MAP
}
}
},
"variantGroup": {
"type": "object",
"description": "Mutually exclusive layout alternatives. Children are variants only",
"required": ["type", "id", "name", "transform", "default", "children"],
"properties": {
"type": {
"type": "string",
"const": "variantGroup"
},
"id": { "type": "string" },
"name": {
"type": "string",
"description": "Heading shown for the choice in the editor"
},
"transform": { "$ref": "#/$defs/transform" },
"default": {
"type": "string",
"description": "id of the variant used when a single layout must be chosen"
},
"children": {
"type": "array",
"minItems": 2,
"description": "Display order",
"items": { "$ref": "#/$defs/variant" }
}
}
},
"variant": {
"type": "object",
"description": "One alternative. Appears only directly under a variantGroup. Carries no transform",
"required": ["type", "id", "name", "children"],
"properties": {
"type": {
"type": "string",
"const": "variant"
},
"id": { "type": "string" },
"name": { "type": "string" },
"children": {
"type": "array",
"description": "May be empty",
"items": {
"oneOf": [
{ "$ref": "#/$defs/key" },
{ "$ref": "#/$defs/cluster" },
{ "$ref": "#/$defs/component" },
{ "$ref": "#/$defs/variantGroup" }
]
}
}
}
},
"cluster": {
"type": "object",
"required": ["type", "id", "transform", "children"],
@@ -203,7 +256,8 @@ ELC・IDX・MAPはどれもPHYを参照する。ELCはIDXを参照せず、MAP
"oneOf": [
{ "$ref": "#/$defs/key" },
{ "$ref": "#/$defs/cluster" },
{ "$ref": "#/$defs/component" }
{ "$ref": "#/$defs/component" },
{ "$ref": "#/$defs/variantGroup" }
]
}
}
@@ -296,13 +350,60 @@ ELC・IDX・MAPはどれもPHYを参照する。ELCはIDXを参照せず、MAP
]
},
{
"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": "variantGroup",
"id": "vg_enter",
"name": "Enter",
"transform": { "x": 6, "y": 0, "rotation": 0 },
"default": "v_ansi",
"children": [
{
"type": "variant",
"id": "v_ansi",
"name": "ANSI",
"children": [
{
"type": "key",
"id": "k_ansi_bslash",
"profile": "standard",
"transform": { "x": 1, "y": 0, "rotation": 0 },
"size": { "w": 1.5, "h": 1 },
"labels": ["|", "\\"]
},
{
"type": "key",
"id": "k_ansi_enter",
"profile": "standard",
"transform": { "x": 0.25, "y": 1, "rotation": 0 },
"size": { "w": 2.25, "h": 1 },
"labels": ["Enter"]
}
]
},
{
"type": "variant",
"id": "v_iso",
"name": "ISO",
"children": [
{
"type": "key",
"id": "k_iso_enter",
"profile": "standard",
"transform": { "x": 1, "y": 0, "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": "key",
"id": "k_iso_hash",
"profile": "standard",
"transform": { "x": 0.25, "y": 1, "rotation": 0 },
"size": { "w": 1, "h": 1 },
"labels": ["~", "#"]
}
]
}
]
},
{
"type": "component",
@@ -345,8 +446,19 @@ ELC・IDX・MAPはどれもPHYを参照する。ELCはIDXを参照せず、MAP
"type": "array",
"uniqueItems": true,
"items": {
"type": "string",
"description": "Reference to PHY layer key ID"
"oneOf": [
{
"type": "string",
"description": "Reference to PHY layer key ID"
},
{
"type": "array",
"minItems": 2,
"uniqueItems": true,
"items": { "type": "string" },
"description": "Mutually exclusive variant keys sharing this key number. They must be wired to the same terminals in ELC"
}
]
}
}
}