From 8448a28a29b2dd92fe40eafa16c26be1aa1fd80b Mon Sep 17 00:00:00 2001 From: Nick Shirokov Date: Sun, 7 Jun 2026 15:46:40 +0300 Subject: [PATCH] =?UTF-8?q?feat(form-decompile,form-compile):=20loadTransp?= =?UTF-8?q?arent=20=D0=BA=D0=B0=D1=80=D1=82=D0=B8=D0=BD=D0=BA=D0=B8=20?= =?UTF-8?q?=D0=BA=D0=BE=D0=BC=D0=B0=D0=BD=D0=B4/=D0=BA=D0=BD=D0=BE=D0=BF?= =?UTF-8?q?=D0=BE=D0=BA/=D0=BF=D0=BE=D0=BF=D0=B0=D0=BF=D0=BE=D0=B2=20(?= =?UTF-8?q?=D0=B7=D0=B0=D1=85=D0=B2=D0=B0=D1=82=20=D1=8F=D0=B2=D0=BD=D0=BE?= =?UTF-8?q?=D0=B3=D0=BE=20false)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Прозрачность картинки () у Command/Button/Popup компилятор хардкодил true, а в корпусе значение смешано (Command true 11410/false 8066; Popup true 3142/false 2828). Явный false терялся. Теперь компилятор эмитит loadTransparent факт. значение (дефолт true — платформа всегда пишет тег внутри Picture; false при явном loadTransparent:false). Декомпилятор фиксирует ТОЛЬКО отклонение false (true опускается — додумывается дефолтом, без шума в DSL). Свойство плоское рядом с picture — консистентно с PictureDecoration(src)/PictureField(valuesPicture). TOTAL diff lines выборки 2.17: 2489 → 2415 (-74). Command/Button/Popup LoadTransparent residual → 0. Остаток (отдельный хвост): PictureField (HeaderPicture/valuesPicture), CheckBoxField-cascade, Table rowsPicture — другие картиночные объекты. Снапшот button-group (popup loadTransparent:false) сертифицирован в 1С (8.3.24). Регресс form-compile 34/34 зелёный на ps + python. decompile v0.42, compile v1.60. Co-Authored-By: Claude Opus 4.8 --- .claude/skills/form-compile/scripts/form-compile.ps1 | 8 ++++---- .claude/skills/form-compile/scripts/form-compile.py | 8 ++++---- .claude/skills/form-decompile/scripts/form-decompile.ps1 | 8 +++++++- docs/form-dsl-spec.md | 2 ++ tests/skills/cases/form-compile/button-group.json | 2 +- .../DataProcessors/ГруппыКнопок/Forms/Форма/Ext/Form.xml | 2 +- 6 files changed, 19 insertions(+), 11 deletions(-) diff --git a/.claude/skills/form-compile/scripts/form-compile.ps1 b/.claude/skills/form-compile/scripts/form-compile.ps1 index 963281fe..9e84e5e1 100644 --- a/.claude/skills/form-compile/scripts/form-compile.ps1 +++ b/.claude/skills/form-compile/scripts/form-compile.ps1 @@ -1,4 +1,4 @@ -# form-compile v1.59 — Compile 1C managed form from JSON or object metadata +# form-compile v1.60 — Compile 1C managed form from JSON or object metadata # Source: https://github.com/Nikolay-Shirokov/cc-1c-skills param( [string]$JsonPath, @@ -3399,7 +3399,7 @@ function Emit-Button { if ($el.picture) { X "$inner" X "$inner`t$($el.picture)" - X "$inner`ttrue" + X "$inner`t$(if ($el.loadTransparent -eq $false){'false'}else{'true'})" X "$inner" } @@ -3598,7 +3598,7 @@ function Emit-Popup { if ($el.picture) { X "$inner" X "$inner`t$($el.picture)" - X "$inner`ttrue" + X "$inner`t$(if ($el.loadTransparent -eq $false){'false'}else{'true'})" X "$inner" } @@ -3852,7 +3852,7 @@ function Emit-Commands { if ($cmd.picture) { X "$inner" X "$inner`t$($cmd.picture)" - X "$inner`ttrue" + X "$inner`t$(if ($cmd.loadTransparent -eq $false){'false'}else{'true'})" X "$inner" } diff --git a/.claude/skills/form-compile/scripts/form-compile.py b/.claude/skills/form-compile/scripts/form-compile.py index 0dfb5b3f..c516a7c8 100644 --- a/.claude/skills/form-compile/scripts/form-compile.py +++ b/.claude/skills/form-compile/scripts/form-compile.py @@ -1,5 +1,5 @@ #!/usr/bin/env python3 -# form-compile v1.59 — Compile 1C managed form from JSON or object metadata +# form-compile v1.60 — Compile 1C managed form from JSON or object metadata # Source: https://github.com/Nikolay-Shirokov/cc-1c-skills import argparse import copy @@ -3097,7 +3097,7 @@ def emit_button(lines, el, name, eid, indent, in_cmd_bar=False): if el.get('picture'): lines.append(f'{inner}') lines.append(f'{inner}\t{el["picture"]}') - lines.append(f'{inner}\ttrue') + lines.append(f'{inner}\t{"false" if el.get("loadTransparent") is False else "true"}') lines.append(f'{inner}') if el.get('representation'): @@ -3251,7 +3251,7 @@ def emit_popup(lines, el, name, eid, indent): if el.get('picture'): lines.append(f'{inner}') lines.append(f'{inner}\t{el["picture"]}') - lines.append(f'{inner}\ttrue') + lines.append(f'{inner}\t{"false" if el.get("loadTransparent") is False else "true"}') lines.append(f'{inner}') if el.get('representation'): @@ -3509,7 +3509,7 @@ def emit_commands(lines, cmds, indent): if cmd.get('picture'): lines.append(f'{inner}') lines.append(f'{inner}\t{cmd["picture"]}') - lines.append(f'{inner}\ttrue') + lines.append(f'{inner}\t{"false" if cmd.get("loadTransparent") is False else "true"}') lines.append(f'{inner}') if cmd.get('representation'): diff --git a/.claude/skills/form-decompile/scripts/form-decompile.ps1 b/.claude/skills/form-decompile/scripts/form-decompile.ps1 index 854c5e7b..425db921 100644 --- a/.claude/skills/form-decompile/scripts/form-decompile.ps1 +++ b/.claude/skills/form-decompile/scripts/form-decompile.ps1 @@ -1,4 +1,4 @@ -# form-decompile v0.41 — Decompile 1C managed Form.xml to JSON DSL (draft) +# form-decompile v0.42 — Decompile 1C managed Form.xml to JSON DSL (draft) # Source: https://github.com/Nikolay-Shirokov/cc-1c-skills # ВНИМАНИЕ: раундтрип не гарантируется. Навык исключён из авто-использования моделью. param( @@ -1194,6 +1194,8 @@ function Decompile-Element { if ($type) { $tmap=@{'CommandBarButton'='commandBar';'UsualButton'='usual';'Hyperlink'='hyperlink';'CommandBarHyperlink'='hyperlink'}; if ($tmap.ContainsKey($type)) { $obj['type']=$tmap[$type] } else { $obj['type']=$type } } if ((Get-Child $node 'DefaultButton') -eq 'true') { $obj['defaultButton'] = $true } $ref = $node.SelectSingleNode("lf:Picture/xr:Ref", $ns); if ($ref) { $obj['picture'] = $ref.InnerText } + # Дефолт у picture кнопки/попапа = true → фиксируем только отклонение false (true опускаем) + $lt = $node.SelectSingleNode("lf:Picture/xr:LoadTransparent", $ns); if ($lt -and $lt.InnerText -eq 'false') { $obj['loadTransparent'] = $false } $rep = Get-Child $node 'Representation'; if ($rep) { $obj['representation'] = $rep } $lic = Get-Child $node 'LocationInCommandBar'; if ($lic) { $obj['locationInCommandBar'] = $lic } } @@ -1217,6 +1219,8 @@ function Decompile-Element { $obj[$key] = $name Add-CommonProps $obj $node $name $ref = $node.SelectSingleNode("lf:Picture/xr:Ref", $ns); if ($ref) { $obj['picture'] = $ref.InnerText } + # Дефолт у picture кнопки/попапа = true → фиксируем только отклонение false (true опускаем) + $lt = $node.SelectSingleNode("lf:Picture/xr:LoadTransparent", $ns); if ($lt -and $lt.InnerText -eq 'false') { $obj['loadTransparent'] = $false } $rep = Get-Child $node 'Representation'; if ($rep) { $obj['representation'] = $rep } $kids = Decompile-Children $node if ($kids) { $obj['children'] = $kids } @@ -1469,6 +1473,8 @@ if ($cmdsNode) { $cru = Get-Child $c 'CurrentRowUse'; if ($cru) { $co['currentRowUse'] = $cru } $sc = Get-Child $c 'Shortcut'; if ($sc) { $co['shortcut'] = $sc } $ref = $c.SelectSingleNode("lf:Picture/xr:Ref", $ns); if ($ref) { $co['picture'] = $ref.InnerText } + # Дефолт у picture команды = true → фиксируем только отклонение false (true опускаем) + $lt = $c.SelectSingleNode("lf:Picture/xr:LoadTransparent", $ns); if ($lt -and $lt.InnerText -eq 'false') { $co['loadTransparent'] = $false } $rep = Get-Child $c 'Representation'; if ($rep) { $co['representation'] = $rep } [void]$cmds.Add($co) } diff --git a/docs/form-dsl-spec.md b/docs/form-dsl-spec.md index 313cf8d6..d5c15dad 100644 --- a/docs/form-dsl-spec.md +++ b/docs/form-dsl-spec.md @@ -500,6 +500,8 @@ Pages поддерживает `pagesRepresentation`: `None`, `TabsOnTop`, `Tabs | `type` | string | `usual`, `hyperlink`, `commandBar` | | `defaultButton` | bool | Кнопка по умолчанию | | `picture` | string | Ссылка на картинку (`StdPicture.Name`) | +| `loadTransparent` | bool | Загружать картинку прозрачной (у `` кнопки/команды/попапа). **Дефолт `true`** (эмитится всегда; `false` — явно). Также у `command` (§7) и `popup` | +| `path` | string | DataPath кнопки общей команды (`Объект.Ref`, `Items.X.CurrentData.Поле`) — привязка к контексту | | `representation` | string | `Auto`, `Picture`, `Text`, `PictureAndText` | | `locationInCommandBar` | string | `InCommandBar`, `InAdditionalSubmenu` | diff --git a/tests/skills/cases/form-compile/button-group.json b/tests/skills/cases/form-compile/button-group.json index 9042f7be..e3b607a2 100644 --- a/tests/skills/cases/form-compile/button-group.json +++ b/tests/skills/cases/form-compile/button-group.json @@ -23,7 +23,7 @@ { "button": "Вниз", "command": "Вниз" } ]}, { "buttonGroup": "ГруппаГлобальныеКоманды", "commandSource": "FormCommandPanelGlobalCommands" }, - { "popup": "ПодменюПечать", "title": "Печать", "picture": "StdPicture.Print", "representation": "PictureAndText", "children": [ + { "popup": "ПодменюПечать", "title": "Печать", "picture": "StdPicture.Print", "loadTransparent": false, "representation": "PictureAndText", "children": [ { "button": "ПечатьСчёта", "command": "Выполнить" } ]} ]} diff --git a/tests/skills/cases/form-compile/snapshots/button-group/DataProcessors/ГруппыКнопок/Forms/Форма/Ext/Form.xml b/tests/skills/cases/form-compile/snapshots/button-group/DataProcessors/ГруппыКнопок/Forms/Форма/Ext/Form.xml index 88bec9d1..2dd3c050 100644 --- a/tests/skills/cases/form-compile/snapshots/button-group/DataProcessors/ГруппыКнопок/Forms/Форма/Ext/Form.xml +++ b/tests/skills/cases/form-compile/snapshots/button-group/DataProcessors/ГруппыКнопок/Forms/Форма/Ext/Form.xml @@ -54,7 +54,7 @@ StdPicture.Print - true + false PictureAndText