@buaa_smat/hometrans 26.0.5 → 26.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +249 -279
- package/agents/code-reviewer.md +1 -1
- package/dist/cli/editors.json +20 -0
- package/dist/platform/registry.js +1 -0
- package/dist/platform/validate.js +2 -1
- package/i18n/agents/code-reviewer.md +1 -1
- package/i18n/platforms/atomcode/skills/a2h-app-migrate/SKILL.unique.md +3 -0
- package/i18n/platforms/claude-code/skills/a2h-app-migrate/SKILL.unique.md +3 -0
- package/i18n/platforms/codebuddy/skills/a2h-app-migrate/SKILL.unique.md +8 -0
- package/i18n/platforms/codex/skills/a2h-app-migrate/SKILL.unique.md +3 -0
- package/i18n/platforms/cursor/skills/a2h-app-migrate/SKILL.unique.md +3 -0
- package/i18n/platforms/deveco/skills/a2h-app-migrate/SKILL.unique.md +3 -0
- package/i18n/platforms/opencode/skills/a2h-app-migrate/SKILL.unique.md +10 -0
- package/i18n/platforms/qoder/skills/a2h-app-migrate/SKILL.unique.md +3 -0
- package/i18n/platforms/qoder-cn/skills/a2h-app-migrate/SKILL.unique.md +8 -0
- package/i18n/platforms/trae/skills/a2h-app-migrate/SKILL.unique.md +3 -0
- package/i18n/platforms/trae-cn/skills/a2h-app-migrate/SKILL.unique.md +3 -0
- package/i18n/skills/a2h-app-migrate/SKILL.md +32 -15
- package/i18n/skills/a2h-app-migrate/references/stage-map.md +4 -2
- package/i18n/skills/a2h-app-migrate/references/workflow.yaml +148 -89
- package/i18n/skills/a2h-app-migrate/scripts/env_preflight.mjs +1 -1
- package/i18n/skills/a2h-app-migrate/scripts/validate_workflow.mjs +51 -2
- package/i18n/skills/a2h-app-migrate/test/test_build_fixer_contract.mjs +1 -1
- package/i18n/skills/a2h-app-migrate/test/test_interaction.mjs +0 -2
- package/i18n/skills/a2h-app-migrate/test/test_resume_plan.mjs +1 -1
- package/i18n/skills/a2h-app-migrate/test/test_skill_doc.mjs +1 -1
- package/i18n/skills/a2h-app-migrate/test/test_specs_json_preflight.mjs +1 -1
- package/i18n/skills/a2h-app-migrate/test/test_utg_static_done.mjs +9 -3
- package/i18n/skills/a2h-app-migrate/test/test_validate_workflow_bilingual.mjs +4 -2
- package/i18n/skills/a2h-arkts-logic-coder/SKILL.md +8 -7
- package/i18n/skills/a2h-arkts-logic-coder/references/ISSUES.md +2 -2
- package/i18n/skills/a2h-arkts-logic-coder/references/code-generation.md +33 -12
- package/i18n/skills/a2h-batch-ui-align/SKILL.md +14 -12
- package/i18n/skills/a2h-batch-ui-align/references/cards/alignment.md +1 -0
- package/i18n/skills/a2h-batch-ui-align/references/cards/canvas.md +1 -0
- package/i18n/skills/a2h-batch-ui-align/references/cards/dynamics.md +32 -1
- package/i18n/skills/a2h-batch-ui-align/references/cards/geometry.md +3 -2
- package/i18n/skills/a2h-batch-ui-align/references/cards/interaction.md +4 -0
- package/i18n/skills/a2h-batch-ui-align/references/cards/resources.md +19 -1
- package/i18n/skills/a2h-batch-ui-align/references/cards/widgets.md +13 -1
- package/i18n/skills/a2h-batch-ui-align/references/cards/window.md +2 -2
- package/i18n/skills/a2h-batch-ui-align/references/checker-rules.md +205 -7
- package/i18n/skills/a2h-batch-ui-align/references/conversion-procedure.md +10 -17
- package/i18n/skills/a2h-batch-ui-align/references/incremental-scope.md +3 -4
- package/i18n/skills/a2h-batch-ui-align/references/lottie-integration.md +47 -2
- package/i18n/skills/a2h-batch-ui-align/references/mappings/android-to-harmonyOS-ui-atomic-component-mapping-reference.md +52 -328
- package/i18n/skills/a2h-batch-ui-align/references/mappings/android-to-harmonyOS-ui-interaction-mapping-reference.md +1 -138
- package/i18n/skills/a2h-batch-ui-align/references/mappings/android-to-harmonyOS-ui-layout-mapping-reference.md +2 -11
- package/i18n/skills/a2h-batch-ui-align/references/state-mgmt/_paradigm-selection.md +1 -1
- package/i18n/skills/a2h-batch-ui-align/references/step3-capture.md +8 -23
- package/i18n/skills/a2h-batch-ui-align/references/step4-prepare.md +2 -1
- package/i18n/skills/a2h-batch-ui-align/references/step5-convert.md +17 -9
- package/i18n/skills/a2h-batch-ui-align/scripts/build_conversion_set.mjs +239 -16
- package/i18n/skills/a2h-batch-ui-align/scripts/group_pack.mjs +6 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/icon_coverage.mjs +6 -3
- package/i18n/skills/a2h-batch-ui-align/scripts/measure_pack.ts +170 -10
- package/i18n/skills/a2h-batch-ui-align/scripts/phase5_check.mjs +42 -1
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/main.ts +20 -1
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/attr_chain.ts +81 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/click_handler.ts +140 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/collapsing_toolbar.ts +124 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/compose_semantics.ts +287 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/flowitem_width.ts +78 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/hit_test.ts +194 -8
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/inset_stacked.ts +138 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/int_division.ts +181 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/layout_placement.ts +62 -2
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/lottie_path.ts +77 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/lottie_ready.ts +109 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/media_tint.ts +88 -18
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/relative_container_cycle.ts +140 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/relative_container_height.ts +2 -2
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/see_through_overlay.ts +149 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/sheet_builder.ts +139 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/sheet_show_close.ts +53 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/space_between_optional.ts +115 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/theme_color.ts +7 -1
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/width_fill.ts +160 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_inset_stacked.test.mjs +155 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_layout_placement.test.mjs +60 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/tests/build_conversion_set.test.mjs +38 -0
- package/i18n/skills/a2h-module-semantic-docs/SKILL.md +3 -2
- package/i18n/skills/a2h-page-specgen/SKILL.md +36 -5
- package/i18n/skills/a2h-page-specgen/references/behavior-ledger.md +89 -21
- package/i18n/skills/a2h-page-specgen/references/gates.md +33 -7
- package/i18n/skills/a2h-page-specgen/references/scenario-authoring.md +67 -13
- package/i18n/skills/a2h-page-specgen/references/spec-example.md +166 -32
- package/i18n/skills/a2h-page-specgen/references/spec-template.md +8 -5
- package/i18n/skills/a2h-page-specgen/scripts/behavior-audit.mjs +37 -1
- package/i18n/skills/a2h-page-specgen/scripts/behavior-discovery.mjs +241 -22
- package/i18n/skills/a2h-page-specgen/scripts/behavior-model.mjs +29 -2
- package/i18n/skills/a2h-page-specgen/scripts/behavior-reconcile.mjs +32 -0
- package/i18n/skills/a2h-page-specgen/scripts/contract-calls.mjs +715 -0
- package/i18n/skills/a2h-page-specgen/scripts/footprint.mjs +129 -2
- package/i18n/skills/a2h-page-specgen/scripts/gate.mjs +19 -10
- package/i18n/skills/a2h-page-specgen/scripts/lib/contracts.mjs +62 -3
- package/i18n/skills/a2h-page-specgen/scripts/lib/graph-evidence.mjs +27 -0
- package/i18n/skills/a2h-page-specgen/scripts/lib/hg.mjs +116 -6
- package/i18n/skills/a2h-page-specgen/scripts/operation-evidence.mjs +270 -29
- package/i18n/skills/a2h-page-specgen/scripts/prepare.mjs +26 -14
- package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/PlainDisplayPage.prompt.md +118 -25
- package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/PlainDisplayPage.worker.md +104 -19
- package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/SilentFailurePage.prompt.md +118 -25
- package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/SilentFailurePage.worker.md +104 -19
- package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/UniAppSourcePage.discovery.json +216 -216
- package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/UniAppSourcePage.json +1 -1
- package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/UniAppSourcePage.post-review.json +2 -2
- package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/UniAppSourcePage.prompt.md +118 -25
- package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/UniAppSourcePage.worker.md +100 -15
- package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/ValidatedSearchPage.prompt.md +118 -25
- package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/ValidatedSearchPage.worker.md +104 -19
- package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/run.mjs +155 -3
- package/i18n/skills/a2h-page-specgen/scripts/test/android-operation-evidence.test.mjs +529 -1
- package/i18n/skills/a2h-page-specgen/scripts/test/behavior-audit-pre.test.mjs +27 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/behavior-discovery.test.mjs +158 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/behavior-fixtures.mjs +11 -13
- package/i18n/skills/a2h-page-specgen/scripts/test/behavior-reconcile.test.mjs +97 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/contract-calls.test.mjs +737 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/contracts.test.mjs +75 -3
- package/i18n/skills/a2h-page-specgen/scripts/test/finalize.test.mjs +24 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/fixtures/hg.mkdb.mjs +124 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/footprint-resolve.test.mjs +6 -2
- package/i18n/skills/a2h-page-specgen/scripts/test/gate.test.mjs +106 -1
- package/i18n/skills/a2h-page-specgen/scripts/test/graph-evidence.test.mjs +32 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/hg.test.mjs +12 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/operation-reviews.test.mjs +6 -1
- package/i18n/skills/a2h-page-specgen/scripts/test/prompt-tpl.test.mjs +11 -3
- package/i18n/skills/a2h-page-specgen/scripts/test/protocol-docs.test.mjs +1 -1
- package/i18n/skills/a2h-page-specgen/scripts/test/recovery-e2e.test.mjs +1 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/submit.test.mjs +159 -27
- package/i18n/skills/a2h-resource-convert/SKILL.md +1 -1
- package/i18n/skills/a2h-resource-convert/references/lottie-conversion-rules.md +2 -2
- package/i18n/skills/a2h-resource-convert/scripts/a2h_resource_convert.ts +124 -8
- package/i18n/skills/a2h-resource-convert/scripts/sync-framework-strings.mjs +147 -0
- package/i18n/skills/a2h-resource-convert/scripts/tests/framework_strings.test.mjs +131 -0
- package/i18n/skills/a2h-spec-design-pipeline/SKILL.md +15 -12
- package/i18n/skills/a2h-spec-design-pipeline/references/coding-loop.md +38 -10
- package/i18n/skills/a2h-spec-design-pipeline/references/initialization.md +2 -2
- package/i18n/skills/a2h-spec-design-pipeline/references/post-loop.md +2 -2
- package/i18n/skills/a2h-spec-design-pipeline/references/reply-recovery.md +172 -0
- package/i18n/skills/a2h-spec-design-pipeline/references/review-loop.md +2 -2
- package/i18n/skills/a2h-spec-design-pipeline/references/scripts.md +5 -3
- package/i18n/skills/a2h-spec-design-pipeline/references/state-and-resume.md +7 -1
- package/i18n/skills/a2h-spec-design-pipeline/scripts/plan_groups.ts +1 -1
- package/i18n/skills/a2h-spec-design-pipeline/scripts/test_plan_groups.ts +2 -0
- package/i18n/skills/a2h-spec-generate/references/input-formats.md +1 -1
- package/i18n/skills/a2h-utg-explorer/SKILL.md +11 -5
- package/i18n/skills/a2h-utg-explorer/references/architecture.md +37 -19
- package/i18n/skills/a2h-utg-explorer/scripts/compile_tasks.mjs +48 -3
- package/i18n/skills/a2h-utg-explorer/scripts/final_utg.mjs +21 -0
- package/i18n/skills/a2h-utg-explorer/scripts/recover_d.mjs +67 -8
- package/i18n/skills/a2h-utg-explorer/scripts/tests/diagnostics.test.mjs +32 -0
- package/i18n/skills/a2h-utg-explorer/scripts/tests/dialog_own_layout.test.mjs +40 -0
- package/i18n/skills/a2h-utg-explorer/scripts/utg_explorer/semantics.mjs +63 -2
- package/i18n/skills/a2h-utg-explorer/scripts/utg_explorer/task_runner.mjs +143 -14
- package/i18n/skills/a2h-utg-static/SKILL.md +3 -3
- package/i18n/skills/a2h-utg-static/references/ui-elements-static-utg-schema.md +4 -3
- package/i18n/skills/a2h-utg-static/scripts/click_paths.mjs +1 -1
- package/i18n/skills/a2h-utg-static/scripts/tests/test_compose_res_text.mjs +25 -0
- package/i18n/skills/a2h-utg-static/tools/convert_static_utg_to_ui_elements.ts +1 -0
- package/package.json +2 -1
- package/platforms/atomcode/skills/a2h-app-migrate/SKILL.unique.md +3 -0
- package/platforms/claude-code/skills/a2h-app-migrate/SKILL.unique.md +3 -0
- package/platforms/codebuddy/agents/build-fixer.frontmatter.md +5 -0
- package/platforms/codebuddy/agents/code-reviewer.frontmatter.md +5 -0
- package/platforms/codebuddy/agents/model-render-worker.frontmatter.md +5 -0
- package/platforms/codebuddy/agents/model-worker.frontmatter.md +5 -0
- package/platforms/codebuddy/agents/specgen-worker.frontmatter.md +5 -0
- package/platforms/codebuddy/skills/a2h-app-migrate/SKILL.unique.md +8 -0
- package/platforms/codex/skills/a2h-app-migrate/SKILL.unique.md +3 -0
- package/platforms/cursor/skills/a2h-app-migrate/SKILL.unique.md +3 -0
- package/platforms/deveco/agents/build-fixer.frontmatter.md +2 -0
- package/platforms/deveco/agents/code-reviewer.frontmatter.md +2 -0
- package/platforms/deveco/agents/model-render-worker.frontmatter.md +2 -0
- package/platforms/deveco/agents/model-worker.frontmatter.md +2 -0
- package/platforms/deveco/agents/specgen-worker.frontmatter.md +2 -0
- package/platforms/deveco/skills/a2h-app-migrate/SKILL.unique.md +3 -0
- package/platforms/opencode/agents/build-fixer.frontmatter.md +2 -0
- package/platforms/opencode/agents/code-reviewer.frontmatter.md +2 -0
- package/platforms/opencode/agents/model-render-worker.frontmatter.md +2 -0
- package/platforms/opencode/agents/model-worker.frontmatter.md +2 -0
- package/platforms/opencode/agents/specgen-worker.frontmatter.md +2 -0
- package/platforms/opencode/skills/a2h-app-migrate/SKILL.unique.md +10 -0
- package/platforms/qoder/skills/a2h-app-migrate/SKILL.unique.md +3 -0
- package/platforms/qoder-cn/skills/a2h-app-migrate/SKILL.unique.md +8 -0
- package/platforms/trae/skills/a2h-app-migrate/SKILL.unique.md +3 -0
- package/platforms/trae-cn/skills/a2h-app-migrate/SKILL.unique.md +3 -0
- package/skills/a2h-app-migrate/SKILL.md +31 -14
- package/skills/a2h-app-migrate/references/stage-map.md +4 -2
- package/skills/a2h-app-migrate/references/workflow.yaml +152 -89
- package/skills/a2h-app-migrate/scripts/assert_dag_complete.mjs +1 -1
- package/skills/a2h-app-migrate/scripts/check_ui_batch_done.mjs +28 -11
- package/skills/a2h-app-migrate/scripts/dag_action_catalog.mjs +76 -0
- package/skills/a2h-app-migrate/scripts/dag_production_executor.mjs +60 -5
- package/skills/a2h-app-migrate/scripts/dag_runner.mjs +184 -4
- package/skills/a2h-app-migrate/scripts/env_preflight.mjs +1 -1
- package/skills/a2h-app-migrate/scripts/ledger.mjs +2 -2
- package/skills/a2h-app-migrate/scripts/resume_plan.mjs +3 -3
- package/skills/a2h-app-migrate/scripts/validate_workflow.mjs +51 -2
- package/skills/a2h-app-migrate/test/test_dag_blocked_guard.mjs +291 -0
- package/skills/a2h-app-migrate/test/test_dag_production.mjs +40 -0
- package/skills/a2h-app-migrate/test/test_dag_runner.mjs +4 -3
- package/skills/a2h-app-migrate/test/test_i18n_engine_mirror.mjs +1 -1
- package/skills/a2h-app-migrate/test/test_interaction.mjs +0 -2
- package/skills/a2h-app-migrate/test/test_resume_plan.mjs +1 -1
- package/skills/a2h-app-migrate/test/test_skill_doc.mjs +1 -1
- package/skills/a2h-app-migrate/test/test_spec_engine_contract.mjs +1 -1
- package/skills/a2h-app-migrate/test/test_specs_json_preflight.mjs +1 -1
- package/skills/a2h-app-migrate/test/test_ui_batch_done.mjs +36 -0
- package/skills/a2h-app-migrate/test/test_utg_static_done.mjs +19 -6
- package/skills/a2h-app-migrate/test/test_validate_workflow_bilingual.mjs +4 -2
- package/skills/a2h-arkts-logic-coder/SKILL.md +8 -7
- package/skills/a2h-arkts-logic-coder/references/ISSUES.md +2 -2
- package/skills/a2h-arkts-logic-coder/references/code-generation.md +33 -12
- package/skills/a2h-batch-ui-align/SKILL.md +14 -12
- package/skills/a2h-batch-ui-align/references/cards/alignment.md +1 -0
- package/skills/a2h-batch-ui-align/references/cards/canvas.md +1 -0
- package/skills/a2h-batch-ui-align/references/cards/dynamics.md +32 -1
- package/skills/a2h-batch-ui-align/references/cards/geometry.md +3 -2
- package/skills/a2h-batch-ui-align/references/cards/interaction.md +4 -0
- package/skills/a2h-batch-ui-align/references/cards/resources.md +19 -1
- package/skills/a2h-batch-ui-align/references/cards/widgets.md +13 -1
- package/skills/a2h-batch-ui-align/references/cards/window.md +2 -2
- package/skills/a2h-batch-ui-align/references/checker-rules.md +205 -7
- package/skills/a2h-batch-ui-align/references/conversion-procedure.md +10 -17
- package/skills/a2h-batch-ui-align/references/incremental-scope.md +3 -4
- package/skills/a2h-batch-ui-align/references/lottie-integration.md +47 -2
- package/skills/a2h-batch-ui-align/references/mappings/android-to-harmonyOS-ui-atomic-component-mapping-reference.md +52 -328
- package/skills/a2h-batch-ui-align/references/mappings/android-to-harmonyOS-ui-interaction-mapping-reference.md +1 -138
- package/skills/a2h-batch-ui-align/references/mappings/android-to-harmonyOS-ui-layout-mapping-reference.md +2 -11
- package/skills/a2h-batch-ui-align/references/state-mgmt/_/350/214/203/345/274/217/351/200/211/346/213/251/350/257/264/346/230/216.md +1 -1
- package/skills/a2h-batch-ui-align/references/step3-capture.md +8 -23
- package/skills/a2h-batch-ui-align/references/step4-prepare.md +2 -1
- package/skills/a2h-batch-ui-align/references/step5-convert.md +17 -9
- package/skills/a2h-batch-ui-align/scripts/build_conversion_set.mjs +239 -16
- package/skills/a2h-batch-ui-align/scripts/group_commit.mjs +6 -1
- package/skills/a2h-batch-ui-align/scripts/group_pack.mjs +6 -0
- package/skills/a2h-batch-ui-align/scripts/group_pass.mjs +270 -0
- package/skills/a2h-batch-ui-align/scripts/group_queue.mjs +134 -16
- package/skills/a2h-batch-ui-align/scripts/group_watch.mjs +39 -8
- package/skills/a2h-batch-ui-align/scripts/icon_coverage.mjs +6 -3
- package/skills/a2h-batch-ui-align/scripts/measure_pack.ts +170 -10
- package/skills/a2h-batch-ui-align/scripts/module_placement.mjs +189 -0
- package/skills/a2h-batch-ui-align/scripts/overlay_effects.mjs +205 -0
- package/skills/a2h-batch-ui-align/scripts/phase5_check.mjs +42 -1
- package/skills/a2h-batch-ui-align/scripts/static_check/main.ts +20 -1
- package/skills/a2h-batch-ui-align/scripts/static_check/registry.ts +28 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/attr_chain.ts +81 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/click_handler.ts +140 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/collapsing_toolbar.ts +124 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/compose_semantics.ts +287 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/flowitem_width.ts +78 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/hit_test.ts +194 -8
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/inset_stacked.ts +138 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/int_division.ts +181 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/layout_placement.ts +62 -2
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/lottie_path.ts +77 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/lottie_ready.ts +109 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/media_tint.ts +88 -18
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/relative_container_cycle.ts +140 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/relative_container_height.ts +2 -2
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/see_through_overlay.ts +149 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/sheet_builder.ts +139 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/sheet_show_close.ts +53 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/space_between_optional.ts +115 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/theme_color.ts +7 -1
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/width_fill.ts +160 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/scan_file.ts +28 -0
- package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_chrome_defaults.test.mjs +328 -0
- package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_click_handler.test.mjs +127 -0
- package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_compose_semantics.test.mjs +150 -0
- package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_hit_test.test.mjs +117 -0
- package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_inset_stacked.test.mjs +155 -0
- package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_layout_placement.test.mjs +60 -0
- package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_rule_smoke.test.mjs +413 -0
- package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_runtime_api.test.mjs +159 -0
- package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_sheet_builder.test.mjs +192 -0
- package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_theme.test.mjs +4 -2
- package/skills/a2h-batch-ui-align/scripts/tests/build_conversion_set.test.mjs +38 -0
- package/skills/a2h-batch-ui-align/scripts/tests/build_conversion_set_compose.test.mjs +106 -0
- package/skills/a2h-batch-ui-align/scripts/tests/group_commit.test.mjs +15 -0
- package/skills/a2h-batch-ui-align/scripts/tests/group_pass.test.mjs +150 -0
- package/skills/a2h-batch-ui-align/scripts/tests/group_queue.test.mjs +125 -0
- package/skills/a2h-batch-ui-align/scripts/tests/group_watch.test.mjs +56 -0
- package/skills/a2h-batch-ui-align/scripts/tests/measure_pack_icon_leaf.test.mjs +143 -0
- package/skills/a2h-batch-ui-align/scripts/tests/module_placement.test.mjs +248 -0
- package/skills/a2h-batch-ui-align/scripts/tests/overlay_effects.test.mjs +214 -0
- package/skills/a2h-fix-build-errors/references/known-patterns.md +5 -5
- package/skills/a2h-module-semantic-docs/SKILL.md +3 -2
- package/skills/a2h-module-semantic-docs/scripts/commit_module_state.mjs +10 -0
- package/skills/a2h-module-semantic-docs/scripts/design_baseline.mjs +158 -0
- package/skills/a2h-module-semantic-docs/test/test_design_baseline.mjs +128 -0
- package/skills/a2h-page-specgen/SKILL.md +36 -5
- package/skills/a2h-page-specgen/references/behavior-ledger.md +88 -21
- package/skills/a2h-page-specgen/references/evidence.md +2 -1
- package/skills/a2h-page-specgen/references/execution-model.md +13 -5
- package/skills/a2h-page-specgen/references/gates.md +33 -7
- package/skills/a2h-page-specgen/references/scenario-authoring.md +67 -13
- package/skills/a2h-page-specgen/references/spec-example.md +166 -32
- package/skills/a2h-page-specgen/references/spec-template.md +8 -5
- package/skills/a2h-page-specgen/scripts/behavior-audit.mjs +40 -2
- package/skills/a2h-page-specgen/scripts/behavior-discovery.mjs +241 -22
- package/skills/a2h-page-specgen/scripts/behavior-model.mjs +29 -2
- package/skills/a2h-page-specgen/scripts/behavior-reconcile.mjs +35 -2
- package/skills/a2h-page-specgen/scripts/contract-calls.mjs +715 -0
- package/skills/a2h-page-specgen/scripts/finalize.mjs +55 -2
- package/skills/a2h-page-specgen/scripts/footprint.mjs +129 -2
- package/skills/a2h-page-specgen/scripts/gate.mjs +20 -11
- package/skills/a2h-page-specgen/scripts/lib/contracts.mjs +56 -3
- package/skills/a2h-page-specgen/scripts/lib/graph-evidence.mjs +27 -0
- package/skills/a2h-page-specgen/scripts/lib/hg.mjs +114 -5
- package/skills/a2h-page-specgen/scripts/lib/ledger.mjs +20 -3
- package/skills/a2h-page-specgen/scripts/operation-evidence.mjs +270 -29
- package/skills/a2h-page-specgen/scripts/prepare.mjs +25 -14
- package/skills/a2h-page-specgen/scripts/report.mjs +26 -5
- package/skills/a2h-page-specgen/scripts/submission.mjs +69 -2
- package/skills/a2h-page-specgen/scripts/submit.mjs +105 -4
- package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/PlainDisplayPage.prompt.md +110 -18
- package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/PlainDisplayPage.worker.md +97 -12
- package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/SilentFailurePage.prompt.md +110 -18
- package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/SilentFailurePage.worker.md +97 -12
- package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/UniAppSourcePage.discovery.json +224 -224
- package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/UniAppSourcePage.json +1 -1
- package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/UniAppSourcePage.post-review.json +2 -2
- package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/UniAppSourcePage.prompt.md +110 -18
- package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/UniAppSourcePage.worker.md +97 -12
- package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/ValidatedSearchPage.prompt.md +110 -18
- package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/ValidatedSearchPage.worker.md +97 -12
- package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/run.mjs +153 -3
- package/skills/a2h-page-specgen/scripts/test/android-operation-evidence.test.mjs +529 -1
- package/skills/a2h-page-specgen/scripts/test/behavior-audit-pre.test.mjs +27 -0
- package/skills/a2h-page-specgen/scripts/test/behavior-discovery.test.mjs +158 -0
- package/skills/a2h-page-specgen/scripts/test/behavior-fixtures.mjs +11 -13
- package/skills/a2h-page-specgen/scripts/test/behavior-reconcile.test.mjs +97 -0
- package/skills/a2h-page-specgen/scripts/test/contract-calls.test.mjs +737 -0
- package/skills/a2h-page-specgen/scripts/test/contracts.test.mjs +82 -3
- package/skills/a2h-page-specgen/scripts/test/finalize.test.mjs +24 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/hg.mkdb.mjs +11 -0
- package/skills/a2h-page-specgen/scripts/test/footprint-resolve.test.mjs +6 -2
- package/skills/a2h-page-specgen/scripts/test/gate.test.mjs +94 -1
- package/skills/a2h-page-specgen/scripts/test/graph-evidence.test.mjs +32 -0
- package/skills/a2h-page-specgen/scripts/test/hg.test.mjs +14 -0
- package/skills/a2h-page-specgen/scripts/test/ledger.test.mjs +49 -1
- package/skills/a2h-page-specgen/scripts/test/operation-reviews.test.mjs +6 -1
- package/skills/a2h-page-specgen/scripts/test/prompt-tpl.test.mjs +12 -4
- package/skills/a2h-page-specgen/scripts/test/protocol-docs.test.mjs +1 -1
- package/skills/a2h-page-specgen/scripts/test/recovery-e2e.test.mjs +1 -0
- package/skills/a2h-page-specgen/scripts/test/report.test.mjs +80 -1
- package/skills/a2h-page-specgen/scripts/test/submit.test.mjs +159 -27
- package/skills/a2h-page-specgen/scripts/test/waker-process.test.mjs +23 -0
- package/skills/a2h-page-specgen/scripts/waker.mjs +8 -1
- package/skills/a2h-resource-convert/SKILL.md +1 -1
- package/skills/a2h-resource-convert/data/framework-strings/NOTICE +10 -0
- package/skills/a2h-resource-convert/data/framework-strings/manifest.json +90 -0
- package/skills/a2h-resource-convert/data/framework-strings/strings.json +382 -0
- package/skills/a2h-resource-convert/references/conversion-rules.md +7 -1
- package/skills/a2h-resource-convert/references/lottie-conversion-rules.md +2 -2
- package/skills/a2h-resource-convert/references/step5-reference-resolution.md +16 -0
- package/skills/a2h-resource-convert/scripts/a2h_resource_convert.ts +124 -8
- package/skills/a2h-resource-convert/scripts/sync-framework-strings.mjs +147 -0
- package/skills/a2h-resource-convert/scripts/tests/framework_strings.test.mjs +131 -0
- package/skills/a2h-spec-design-pipeline/SKILL.md +14 -11
- package/skills/a2h-spec-design-pipeline/references/coding-loop.md +38 -10
- package/skills/a2h-spec-design-pipeline/references/execution-model.md +3 -0
- package/skills/a2h-spec-design-pipeline/references/final-report-template.md +6 -3
- package/skills/a2h-spec-design-pipeline/references/initialization.md +2 -2
- package/skills/a2h-spec-design-pipeline/references/post-loop.md +2 -2
- package/skills/a2h-spec-design-pipeline/references/reply-recovery.md +172 -0
- package/skills/a2h-spec-design-pipeline/references/review-loop.md +2 -2
- package/skills/a2h-spec-design-pipeline/references/scripts.md +4 -3
- package/skills/a2h-spec-design-pipeline/references/shared-layer.md +24 -19
- package/skills/a2h-spec-design-pipeline/references/state-and-resume.md +7 -1
- package/skills/a2h-spec-design-pipeline/references/static-defect-gate.md +12 -5
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/config/ruleMeta.json +5 -0
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/config/ruleSet.json +4 -0
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/data/README.md +27 -3
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/data/api-param-contract.json +46 -1
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/data/api-permission-map.json +2511 -295
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/document/checker/hometrans/api-permission-declared-cn.md +27 -72
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/document/checker/hometrans/api-permission-declared-en.md +39 -83
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/document/checker/hometrans/arkui-runtime-pitfall-cn.md +132 -101
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/document/checker/hometrans/arkui-runtime-pitfall-en.md +158 -115
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/document/checker/hometrans/platform-api-contract-cn.md +60 -93
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/document/checker/hometrans/platform-api-contract-en.md +73 -100
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/document/checker/hometrans/route-page-side-effect-import-cn.md +52 -0
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/document/checker/hometrans/route-page-side-effect-import-en.md +59 -0
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/lib/checker/ApiPermissionDeclaredCheck.js +57 -8
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/lib/checker/ArkUIRuntimePitfallCheck.js +475 -18
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/lib/checker/PlatformApiContractCheck.js +472 -4
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/lib/checker/RoutePageSideEffectImportCheck.js +570 -0
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/lib/checker/arkui/RouteParamCarrierSubCheck.js +1053 -0
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/lib/checker/sql/SqlIdentifierAnalysis.js +427 -0
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/lib/index.js +7 -1
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/package.json +1 -1
- package/skills/a2h-spec-design-pipeline/scripts/plan_groups.ts +1 -1
- package/skills/a2h-spec-design-pipeline/scripts/settle.ts +785 -0
- package/skills/a2h-spec-design-pipeline/scripts/test_api_permission_declared.ts +286 -0
- package/skills/a2h-spec-design-pipeline/scripts/test_arkui_runtime_pitfall.ts +166 -2
- package/skills/a2h-spec-design-pipeline/scripts/test_docs_refresh_contract.ts +40 -0
- package/skills/a2h-spec-design-pipeline/scripts/test_plan_groups.ts +2 -0
- package/skills/a2h-spec-design-pipeline/scripts/test_platform_api_contract.ts +350 -7
- package/skills/a2h-spec-design-pipeline/scripts/test_route_page_side_effect_import.ts +185 -0
- package/skills/a2h-spec-design-pipeline/scripts/test_route_param_carrier.ts +341 -0
- package/skills/a2h-spec-design-pipeline/scripts/test_settle.ts +593 -0
- package/skills/a2h-spec-design-pipeline/scripts/test_shared_layer_docs.ts +92 -1
- package/skills/a2h-spec-design-pipeline/scripts/test_sql_identifier_analysis.ts +137 -0
- package/skills/a2h-spec-generate/references/input-formats.md +1 -1
- package/skills/a2h-utg-explorer/SKILL.md +11 -5
- package/skills/a2h-utg-explorer/references/architecture.md +37 -19
- package/skills/a2h-utg-explorer/scripts/audit.mjs +6 -2
- package/skills/a2h-utg-explorer/scripts/close_phases.mjs +8 -5
- package/skills/a2h-utg-explorer/scripts/compile_tasks.mjs +95 -19
- package/skills/a2h-utg-explorer/scripts/d_prereqs.mjs +192 -4
- package/skills/a2h-utg-explorer/scripts/final_utg.mjs +21 -0
- package/skills/a2h-utg-explorer/scripts/panel_routes.mjs +1 -1
- package/skills/a2h-utg-explorer/scripts/plan.mjs +16 -1
- package/skills/a2h-utg-explorer/scripts/predicates.mjs +270 -0
- package/skills/a2h-utg-explorer/scripts/promote_dynamic.mjs +2 -0
- package/skills/a2h-utg-explorer/scripts/recover.mjs +4 -3
- package/skills/a2h-utg-explorer/scripts/recover_d.mjs +67 -8
- package/skills/a2h-utg-explorer/scripts/rejudge.mjs +4 -3
- package/skills/a2h-utg-explorer/scripts/report.mjs +32 -2
- package/skills/a2h-utg-explorer/scripts/run_cycle.mjs +103 -36
- package/skills/a2h-utg-explorer/scripts/run_device.mjs +3 -8
- package/skills/a2h-utg-explorer/scripts/schedule_states.mjs +189 -0
- package/skills/a2h-utg-explorer/scripts/tests/calendar_round_fixes.test.mjs +9 -0
- package/skills/a2h-utg-explorer/scripts/tests/coverage_rules.test.mjs +11 -0
- package/skills/a2h-utg-explorer/scripts/tests/d_prereqs.test.mjs +31 -2
- package/skills/a2h-utg-explorer/scripts/tests/device_lock_retry.test.mjs +1 -1
- package/skills/a2h-utg-explorer/scripts/tests/diagnostics.test.mjs +32 -0
- package/skills/a2h-utg-explorer/scripts/tests/dialog_own_layout.test.mjs +40 -0
- package/skills/a2h-utg-explorer/scripts/tests/explorer_review_fixes.test.mjs +4 -1
- package/skills/a2h-utg-explorer/scripts/tests/hybrid_route.test.mjs +6 -28
- package/skills/a2h-utg-explorer/scripts/tests/in_route_surface.test.mjs +125 -0
- package/skills/a2h-utg-explorer/scripts/tests/list_probe_target_wait.test.mjs +86 -0
- package/skills/a2h-utg-explorer/scripts/tests/multi_host.test.mjs +167 -0
- package/skills/a2h-utg-explorer/scripts/tests/nested_list.test.mjs +58 -0
- package/skills/a2h-utg-explorer/scripts/tests/overlay_opener.test.mjs +100 -0
- package/skills/a2h-utg-explorer/scripts/tests/pipeline.test.mjs +8 -1
- package/skills/a2h-utg-explorer/scripts/tests/pr169_review_fixes.test.mjs +1 -0
- package/skills/a2h-utg-explorer/scripts/tests/pr191_review_fixes.test.mjs +2 -31
- package/skills/a2h-utg-explorer/scripts/tests/review_fixes.test.mjs +1 -1
- package/skills/a2h-utg-explorer/scripts/tests/run_cycle.test.mjs +56 -7
- package/skills/a2h-utg-explorer/scripts/tests/snapshot_integrity.test.mjs +117 -6
- package/skills/a2h-utg-explorer/scripts/tests/state_inventory.test.mjs +414 -0
- package/skills/a2h-utg-explorer/scripts/tests/tree_unreliable.test.mjs +197 -0
- package/skills/a2h-utg-explorer/scripts/utg_explorer/adapters.mjs +196 -30
- package/skills/a2h-utg-explorer/scripts/utg_explorer/hosts.mjs +146 -0
- package/skills/a2h-utg-explorer/scripts/utg_explorer/semantics.mjs +63 -2
- package/skills/a2h-utg-explorer/scripts/utg_explorer/states.mjs +286 -0
- package/skills/a2h-utg-explorer/scripts/utg_explorer/task_runner.mjs +197 -19
- package/skills/a2h-utg-static/SKILL.md +3 -3
- package/skills/a2h-utg-static/references/extractors.md +7 -0
- package/skills/a2h-utg-static/references/ui-elements-static-utg-schema.md +4 -3
- package/skills/a2h-utg-static/scripts/click_paths.mjs +1 -1
- package/skills/a2h-utg-static/scripts/compose_overlay.mjs +642 -22
- package/skills/a2h-utg-static/scripts/tests/test_compose_res_text.mjs +25 -0
- package/skills/a2h-utg-static/scripts/tests/test_in_route_surface.mjs +123 -0
- package/skills/a2h-utg-static/scripts/tests/test_overlay_host_effects.mjs +239 -0
- package/skills/a2h-utg-static/scripts/tests/test_shared_host_depths.mjs +48 -0
- package/skills/a2h-utg-static/scripts/utg_html.mjs +2 -0
- package/skills/a2h-utg-static/tools/convert_static_utg_to_ui_elements.ts +1 -0
- package/i18n/skills/a2h-app-migrate/references/specs.example.json +0 -19
- package/i18n/skills/a2h-batch-ui-align/scripts/databinding_analyzer_design.md +0 -79
- package/i18n/skills/a2h-utg-explorer/scripts/utg_explorer/state_phase.mjs +0 -47
- package/resource/convert_pipeline_process.svg +0 -114
- package/resource/project_architecture.svg +0 -120
- package/resource/set_environment.png +0 -0
- package/resource/set_multimodel.png +0 -0
- package/skills/a2h-app-migrate/references/specs.example.json +0 -19
- package/skills/a2h-batch-ui-align/scripts/databinding_analyzer_design.md +0 -79
- package/skills/a2h-utg-explorer/scripts/utg_explorer/state_phase.mjs +0 -47
|
@@ -29,8 +29,8 @@ export const meta: RuleMeta[] = [
|
|
|
29
29
|
invariant: "geometry",
|
|
30
30
|
card: "alignment",
|
|
31
31
|
needs: [],
|
|
32
|
-
summary: "a `Stack` has no alignContent, and a child relies on its own `.align()` to pin to the bottom/edge while wrapping its content on that axis.",
|
|
33
|
-
fix: "
|
|
32
|
+
summary: "a `Stack` has no alignContent (default Center), and a child relies on its own `.align()` to pin to the bottom/edge while wrapping its content on that axis; or the `Stack` sets an **explicit non-Center** alignContent and a child's `.align(Y)` **conflicts** with it (the child is still placed at the Stack's alignContent, not at Y).",
|
|
33
|
+
fix: "`.align()` only arranges the child's own content and does not decide its position in the Stack: every child is placed at the Stack's alignContent. To pin a child to an edge, set the Stack's alignContent to that direction (wrap the other children that rely on the current alignment in a full-size container), or first make the child `'100%'` on that axis and then arrange its content with `.align`.",
|
|
34
34
|
escape: null,
|
|
35
35
|
cases: [
|
|
36
36
|
"[where2study3] In the settings page's `Stack()` (default alignContent=Center), the nav's outer Column writes `.align(Alignment.Bottom)`; `.align` only arranges the Column's own content and does not decide its position in the Stack — the bottom nav floats in the middle of the screen",
|
|
@@ -372,6 +372,66 @@ export function checkLayoutPlacement(code: string, rel: string, rawLines: string
|
|
|
372
372
|
// The overlay / child-align-noop rules below hold for it equally; the bar rule only targets Box's default TopStart translated into a bare Stack(),
|
|
373
373
|
// and an explicit Center is intentional centering, not reported.
|
|
374
374
|
const explicitCenter: boolean = hasAlign && alignM !== null && alignM[1] === 'Alignment.Center';
|
|
375
|
+
|
|
376
|
+
// ---- GATE/CAND stack-child-align-noop for a Stack WITH an explicit (non-Center) alignContent
|
|
377
|
+
//
|
|
378
|
+
// The child is placed by the Stack's alignContent, never by its own .align(); flag a child whose .align(Y) asks
|
|
379
|
+
// for a different edge than the Stack's alignContent, so it does not end up where .align(Y) suggests (CoolMall
|
|
380
|
+
// goods-detail bottom bar: Stack alignContent TopStart, bar .align(Alignment.Bottom) → ends up top-left).
|
|
381
|
+
// Additive: this only runs for Stacks that the `continue` below would otherwise skip, so it changes no existing finding.
|
|
382
|
+
if (hasAlign && !explicitCenter && alignM !== null) {
|
|
383
|
+
const sv: string = /Top/.test(alignM[1]) ? 'Top' : /Bottom/.test(alignM[1]) ? 'Bottom' : 'Center';
|
|
384
|
+
const sh: string = /Start/.test(alignM[1]) ? 'Start' : /End/.test(alignM[1]) ? 'End' : 'Center';
|
|
385
|
+
// Children inside if / else branches count too (a bottom bar shown only in the SUCCESS state is still mis-anchored).
|
|
386
|
+
const alignKids: UiChild[] = directUiChildren(code, k, bodyClose, undefined, { intoBranches: true })
|
|
387
|
+
.filter((c) => c.control !== true);
|
|
388
|
+
for (const c of alignKids) {
|
|
389
|
+
const a: UiAttr[] = attrsOf(c);
|
|
390
|
+
const al: UiAttr | undefined = a.find((x) => x.name === 'align');
|
|
391
|
+
if (al === undefined || /Alignment\.Center\b/.test(al.args)) { continue; }
|
|
392
|
+
if (['Scroll', 'List', 'Grid', 'WaterFlow'].includes(c.name)) { continue; }
|
|
393
|
+
// Absolute placement (position / markAnchor / alignRules) genuinely places the child, so .align is moot and the child is where it is put — skip.
|
|
394
|
+
// A relative delta (offset / translate) only shifts the child from its alignContent-anchored position, so it does NOT fix the .align no-op; keep it, but as CAND (the delta's magnitude is unknown).
|
|
395
|
+
if (['position', 'markAnchor', 'alignRules'].some((n) => hasAttr(a, n))) { continue; }
|
|
396
|
+
const relDelta: boolean = hasAttr(a, 'offset') || hasAttr(a, 'translate');
|
|
397
|
+
const needV: boolean = /Top|Bottom/.test(al.args);
|
|
398
|
+
const needH: boolean = /Start|End/.test(al.args);
|
|
399
|
+
const childV: string = /Top/.test(al.args) ? 'Top' : /Bottom/.test(al.args) ? 'Bottom' : 'Center';
|
|
400
|
+
const childH: string = /Start/.test(al.args) ? 'Start' : /End/.test(al.args) ? 'End' : 'Center';
|
|
401
|
+
// Only a conflict when the Stack is EXPLICITLY non-Center on that axis: if the Stack's alignContent leaves an
|
|
402
|
+
// axis at Center (e.g. alignContent Bottom sets vertical only), a child's .align() on the other axis is the
|
|
403
|
+
// same ambiguous case the default-Center path already governs, and stays out of scope here.
|
|
404
|
+
const conflictV: boolean = needV && sv !== 'Center' && childV !== sv;
|
|
405
|
+
const conflictH: boolean = needH && sh !== 'Center' && childH !== sh;
|
|
406
|
+
if (!conflictV && !conflictH) { continue; }
|
|
407
|
+
// The axis size from .width()/.height(), or from the matching field of .size({ width, height }).
|
|
408
|
+
const dim = (n: string): string | null => {
|
|
409
|
+
const x: UiAttr | undefined = a.find((y) => y.name === n);
|
|
410
|
+
if (x !== undefined) { return x.args; }
|
|
411
|
+
const sz: UiAttr | undefined = a.find((y) => y.name === 'size');
|
|
412
|
+
const f: RegExpExecArray | null = sz === undefined ? null : new RegExp(`\\b${n}\\s*:\\s*([^,}]+)`).exec(sz.args);
|
|
413
|
+
return f === null ? null : f[1].trim();
|
|
414
|
+
};
|
|
415
|
+
const h: string | null = dim('height');
|
|
416
|
+
const w: string | null = dim('width');
|
|
417
|
+
const wraps: boolean = (conflictV && h === null) || (conflictH && w === null);
|
|
418
|
+
const notFull: boolean = (conflictV && h !== null && !RE_PCT_FULL_ARG.test(h)) ||
|
|
419
|
+
(conflictH && w !== null && !RE_PCT_FULL_ARG.test(w));
|
|
420
|
+
const msg: string = `Stack alignContent is ${alignM[1]}, and child ${c.name} sets .align(${al.args.trim()}) — ` +
|
|
421
|
+
'.align() only arranges that child\'s own content and does not decide its position in the Stack, so the child is placed at the Stack\'s alignContent, not where .align() asks. ' +
|
|
422
|
+
(relDelta ? 'A .offset()/.translate() on it only shifts it from that anchored position (it does not re-anchor to the edge). ' : '') +
|
|
423
|
+
`To hug ${al.args.trim()}: set the Stack's alignContent to it (wrap other children that rely on the current alignment in a full-size container), or first make the child fill that axis ('100%') and then arrange its content with .align`;
|
|
424
|
+
// A custom component's size comes from its own build() root, so "no size at the call site" does not prove it wraps: CAND.
|
|
425
|
+
const custom: boolean = !c.isBuilderCall && /^[A-Z]/.test(c.name) && !BUILTIN_KINDS.has(c.name);
|
|
426
|
+
if (wraps && !relDelta && !custom) {
|
|
427
|
+
report('GATE', 'stack-child-align-noop', rel, lineOfIndex(code, c.at), msg);
|
|
428
|
+
} else if (wraps || notFull) {
|
|
429
|
+
report('CAND', 'stack-child-align-noop', rel, lineOfIndex(code, c.at),
|
|
430
|
+
custom && wraps ? `${msg} (${c.name} is a custom component: its size comes from its build() root, check whether it fills that axis)` : msg);
|
|
431
|
+
}
|
|
432
|
+
}
|
|
433
|
+
}
|
|
434
|
+
|
|
375
435
|
if (hasAlign && !explicitCenter) { continue; }
|
|
376
436
|
const centerWhy: string = explicitCenter ? 'Stack alignment is Center' : 'Stack has no alignContent (default Center)';
|
|
377
437
|
// ---- collect for GATE stack-custom-child-default-center (decided across files in checkStackCustomKids)
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
// static_check/rules/lottie_path.ts — GATE lottie-path-not-ets.
|
|
2
|
+
//
|
|
3
|
+
// @ohos/lottie's `path` option is read with context2D.getJsonData(path) (DataManager.js loadAsset), which only resolves
|
|
4
|
+
// files under the module's ets/ directory (README: the path parameter only supports relative paths under entry/src/main/ets). The
|
|
5
|
+
// resource converter puts Lottie JSON in rawfile/lottie/, so `path: 'lottie/x.json'` reads nothing: the library fires
|
|
6
|
+
// data_failed and logs "Lottie: the path has no data", the canvas stays blank, and build + smoke still pass. Rawfile JSON
|
|
7
|
+
// must be read with resourceManager.getRawFileContentSync and passed as `animationData`.
|
|
8
|
+
|
|
9
|
+
import * as fs from 'fs';
|
|
10
|
+
import * as path from 'path';
|
|
11
|
+
import { report } from '../core/findings.ts';
|
|
12
|
+
import { lineOfIndex, markedAbove, matchBracket, splitTopLevel } from '../core/parse.ts';
|
|
13
|
+
import type { FileCtx } from '../core/scan.ts';
|
|
14
|
+
import type { RuleMeta } from '../core/meta.ts';
|
|
15
|
+
|
|
16
|
+
/** Rule metadata (rendered by scripts/gen_rule_docs.mjs). */
|
|
17
|
+
export const meta: RuleMeta[] = [
|
|
18
|
+
{
|
|
19
|
+
id: "lottie-path-not-ets",
|
|
20
|
+
levels: ["GATE", "CAND"],
|
|
21
|
+
invariant: "resources",
|
|
22
|
+
card: "resources",
|
|
23
|
+
needs: [],
|
|
24
|
+
summary: "The options of `@ohos/lottie`'s `loadAnimation({ … })` set `path`, and it is not a string literal naming a file that exists under this module's `ets/` — `path` reads only the `ets/` directory, the parent skill puts the animation JSON in `rawfile/lottie/`, and with no data the library only fires `data_failed`, so the animation is blank.",
|
|
25
|
+
fix: "Follow `references/lottie-integration.md` 4.5.2: read the bytes with `this.getUIContext().getHostContext()!.resourceManager.getRawFileContentSync('lottie/<name>.json')`, decode with `new util.TextDecoder('utf-8', { ignoreBOM: true }).decodeToString(bytes)`, `JSON.parse` it and pass it as `animationData`; drop `path`. When the JSON really is under `ets/` and the path comes from a variable, write `// LOTTIE-PATH: <basis>` above the line to downgrade to CAND.",
|
|
26
|
+
escape: "// LOTTIE-PATH:",
|
|
27
|
+
cases: [
|
|
28
|
+
"Measured (e-commerce app bottom navigation): the JSON of the four tab Lottie animations was in `rawfile/lottie/`, the code wrote `path: destination.lottiePath` ('lottie/home.json'), and all four icons were blank; the Main page had no reference screenshot, and build, GATE and smoke all passed.",
|
|
29
|
+
],
|
|
30
|
+
},
|
|
31
|
+
];
|
|
32
|
+
|
|
33
|
+
/** The module's ets/ root for a file under `<module>/src/main/ets/…`, or '' when the file is not under such a root. */
|
|
34
|
+
function etsRootOf(file: string): string {
|
|
35
|
+
const norm: string = file.replace(/\\/g, '/');
|
|
36
|
+
const at: number = norm.lastIndexOf('/src/main/ets/');
|
|
37
|
+
return at < 0 ? '' : norm.slice(0, at + '/src/main/ets'.length);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* GATE lottie-path-not-ets: a loadAnimation() whose literal options set `path` to anything but a string literal naming a
|
|
42
|
+
* file that exists under this module's ets/ root. A non-literal value (a variable / field) is reported too: the JSON the
|
|
43
|
+
* skill ships lives in rawfile/, which `path` cannot read. `// LOTTIE-PATH: <basis>` above the call downgrades to CAND.
|
|
44
|
+
*/
|
|
45
|
+
export function checkLottiePath(fctx: FileCtx): void {
|
|
46
|
+
const { file, rel, code, rawLines } = fctx;
|
|
47
|
+
if (!/\bloadAnimation\s*\(/.test(code)) { return; }
|
|
48
|
+
const root: string = etsRootOf(file);
|
|
49
|
+
for (const m of code.matchAll(/\bloadAnimation\s*\(/g)) {
|
|
50
|
+
const open: number = (m.index ?? 0) + m[0].length - 1;
|
|
51
|
+
const close: number = matchBracket(code, open);
|
|
52
|
+
if (close < 0) { continue; }
|
|
53
|
+
const opt: string = (splitTopLevel(code.slice(open + 1, close))[0] ?? '').trim();
|
|
54
|
+
if (!opt.startsWith('{') || !opt.endsWith('}')) { continue; }
|
|
55
|
+
let value: string | undefined;
|
|
56
|
+
for (const e of splitTopLevel(opt.slice(1, -1))) {
|
|
57
|
+
const kv: RegExpExecArray | null = /^\s*path\s*:\s*([\s\S]*?)\s*$/.exec(e);
|
|
58
|
+
if (kv !== null) { value = kv[1]; }
|
|
59
|
+
}
|
|
60
|
+
if (value === undefined) { continue; }
|
|
61
|
+
const lit: RegExpExecArray | null = /^(['"])([^'"]*)\1$/.exec(value);
|
|
62
|
+
if (lit !== null && root !== '' && fs.existsSync(path.join(root, lit[2]))) { continue; }
|
|
63
|
+
const line: number = lineOfIndex(code, m.index ?? 0);
|
|
64
|
+
const what: string = lit !== null
|
|
65
|
+
? `path: ${value} does not name a file under this module's ets/ (${lit[2]} not found there)`
|
|
66
|
+
: `path: ${value} is not a literal, and the Lottie JSON the resource step ships lives in rawfile/lottie/`;
|
|
67
|
+
if (markedAbove(rawLines, line, 'LOTTIE-PATH')) {
|
|
68
|
+
report('CAND', 'lottie-path-not-ets', rel, line, `${what}; marked LOTTIE-PATH — confirm the JSON really sits under ets/`);
|
|
69
|
+
continue;
|
|
70
|
+
}
|
|
71
|
+
report('GATE', 'lottie-path-not-ets', rel, line,
|
|
72
|
+
`${what}. @ohos/lottie reads \`path\` only from the module's ets/ directory; a rawfile JSON yields no data, ` +
|
|
73
|
+
'fires data_failed and the animation stays blank. Read it with getHostContext()!.resourceManager.getRawFileContentSync(' +
|
|
74
|
+
"'lottie/<name>.json'), decode with util.TextDecoder, JSON.parse, and pass it as animationData (lottie-integration.md 4.5.2). " +
|
|
75
|
+
'If the JSON really is under ets/ and the path comes from a variable, write // LOTTIE-PATH: <basis> above the call');
|
|
76
|
+
}
|
|
77
|
+
}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
// static_check/rules/lottie_ready.ts — GATE lottie-load-before-canvas-ready.
|
|
2
|
+
//
|
|
3
|
+
// @ohos/lottie draws into a CanvasRenderingContext2D. That context is only attached once the Canvas component is laid
|
|
4
|
+
// out, which the Canvas reports through its .onReady() callback. aboutToAppear() / aboutToBuild() run BEFORE build(),
|
|
5
|
+
// so the Canvas does not exist yet: a loadAnimation() called there paints into an unready context and the animation is
|
|
6
|
+
// blank (CoolMall bottom-nav tab icons: loadAnimation in aboutToAppear → icons never show).
|
|
7
|
+
|
|
8
|
+
import { report } from '../core/findings.ts';
|
|
9
|
+
import { lineOfIndex, markedAbove, maskStrings, matchBracket } from '../core/parse.ts';
|
|
10
|
+
import type { FileCtx } from '../core/scan.ts';
|
|
11
|
+
import type { RuleMeta } from '../core/meta.ts';
|
|
12
|
+
|
|
13
|
+
/** Rule metadata (rendered by scripts/gen_rule_docs.mjs). */
|
|
14
|
+
export const meta: RuleMeta[] = [
|
|
15
|
+
{
|
|
16
|
+
id: "lottie-load-before-canvas-ready",
|
|
17
|
+
levels: ["GATE", "CAND"],
|
|
18
|
+
invariant: "resources",
|
|
19
|
+
card: "resources",
|
|
20
|
+
needs: [],
|
|
21
|
+
summary: "the file has a `Canvas(`, and `@ohos/lottie`'s `loadAnimation(` is written in `aboutToAppear()` / `aboutToBuild()` — these lifecycles run before `build()`, the Canvas rendering context is not ready yet, so the animation paints into an empty context and does not show.",
|
|
22
|
+
fix: "move `lottie.loadAnimation({ container: this.canvasContext, … })` into the `Canvas(this.canvasContext).onReady(() => { … })` callback (onReady fires once the Canvas is laid out and the context is usable); keep destroy in `aboutToDisappear` + `Canvas.onDisAppear`. With a real basis write `// LOTTIE-READY: <basis>` above the line to downgrade it to CAND.",
|
|
23
|
+
escape: "// LOTTIE-READY:",
|
|
24
|
+
cases: [
|
|
25
|
+
"Measured (CoolMall bottom navigation BottomNavigationBar.ets): `TabLottieAnimation.aboutToAppear()` calls `lottie.loadAnimation({ container: this.canvasContext, … })` before the Canvas is ready → all four tab icons are blank; build, GATE and smoke all passed.",
|
|
26
|
+
],
|
|
27
|
+
},
|
|
28
|
+
];
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* The `{ … }` body ranges of `name()` lifecycle methods (aboutToAppear / aboutToBuild) in code, with or without `async`
|
|
32
|
+
* and with any return annotation (`: void`, `: Promise<void>`).
|
|
33
|
+
*/
|
|
34
|
+
function lifecycleBodies(code: string, name: string): [number, number][] {
|
|
35
|
+
const out: [number, number][] = [];
|
|
36
|
+
const re: RegExp = new RegExp(`\\b${name}\\s*\\(\\s*\\)\\s*(?::[^{;]*)?\\{`, 'g');
|
|
37
|
+
let m: RegExpExecArray | null;
|
|
38
|
+
while ((m = re.exec(code)) !== null) {
|
|
39
|
+
const open: number = m.index + m[0].length - 1;
|
|
40
|
+
const close: number = matchBracket(code, open);
|
|
41
|
+
if (close > open) { out.push([open, close]); }
|
|
42
|
+
}
|
|
43
|
+
return out;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Whether the call at `at` runs later than the lifecycle body that contains it (body `{` at `open`): it sits inside call
|
|
48
|
+
* arguments (`setTimeout(() => …)`, `.then(…)`), inside a function body (`() => { … }`, `function () { … }`), or after an
|
|
49
|
+
* expression-bodied arrow in its own statement (`this.load = () => lottie.loadAnimation(…)`). Plain control blocks
|
|
50
|
+
* (if / for / try / else) run in place and do not count. masked: strings and comments neutralised.
|
|
51
|
+
*/
|
|
52
|
+
function deferredIn(masked: string, open: number, at: number): boolean {
|
|
53
|
+
const stack: number[] = [];
|
|
54
|
+
for (let i = open + 1; i < at; i++) {
|
|
55
|
+
const c: string = masked[i];
|
|
56
|
+
if (c === '(' || c === '{' || c === '[') { stack.push(i); } else if (c === ')' || c === '}' || c === ']') { stack.pop(); }
|
|
57
|
+
}
|
|
58
|
+
for (const o of stack) {
|
|
59
|
+
if (masked[o] !== '{') { return true; } // inside a call's arguments / an array
|
|
60
|
+
const before: string = masked.slice(Math.max(open, o - 200), o).trimEnd();
|
|
61
|
+
if (before.endsWith('=>')) { return true; } // arrow function body
|
|
62
|
+
if (before.endsWith(')') && /\bfunction\s*[\w$]*\s*\([^()]*\)$/.test(before)) { return true; }
|
|
63
|
+
}
|
|
64
|
+
// Expression-bodied arrow in the same statement: scan back to the statement start at the call's own depth.
|
|
65
|
+
const from: number = stack.length > 0 ? stack[stack.length - 1] : open;
|
|
66
|
+
let s: number = at - 1;
|
|
67
|
+
let depth: number = 0;
|
|
68
|
+
for (; s > from; s--) {
|
|
69
|
+
const c: string = masked[s];
|
|
70
|
+
if (c === ')' || c === '}' || c === ']') { depth++; } else if (c === '(' || c === '{' || c === '[') { depth--; } else if (c === ';' && depth === 0) { break; }
|
|
71
|
+
}
|
|
72
|
+
return masked.slice(s + 1, at).includes('=>');
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* GATE lottie-load-before-canvas-ready: a loadAnimation() call sits inside aboutToAppear()/aboutToBuild() of a file that
|
|
77
|
+
* draws a Canvas. The call must move into the Canvas's .onReady() callback, which fires after the rendering context is
|
|
78
|
+
* attached. `// LOTTIE-READY: <basis>` above the call downgrades it to CAND.
|
|
79
|
+
*/
|
|
80
|
+
export function checkLottieReady(fctx: FileCtx): void {
|
|
81
|
+
const { rel, code, rawLines } = fctx;
|
|
82
|
+
if (!/\bloadAnimation\s*\(/.test(code) || !/\bCanvas\s*\(/.test(code)) { return; }
|
|
83
|
+
const bodies: [number, number][] = [...lifecycleBodies(code, 'aboutToAppear'), ...lifecycleBodies(code, 'aboutToBuild')];
|
|
84
|
+
if (bodies.length === 0) { return; }
|
|
85
|
+
const masked: string = maskStrings(code);
|
|
86
|
+
for (const m of code.matchAll(/\bloadAnimation\s*\(/g)) {
|
|
87
|
+
const at: number = m.index ?? 0;
|
|
88
|
+
const body: [number, number] | undefined = bodies.find(([o, c]) => at > o && at < c);
|
|
89
|
+
if (body === undefined) { continue; }
|
|
90
|
+
const line: number = lineOfIndex(code, at);
|
|
91
|
+
if (markedAbove(rawLines, line, 'LOTTIE-READY')) {
|
|
92
|
+
report('CAND', 'lottie-load-before-canvas-ready', rel, line,
|
|
93
|
+
'loadAnimation() in aboutToAppear/aboutToBuild; marked LOTTIE-READY — confirm the Canvas context is ready at that point');
|
|
94
|
+
continue;
|
|
95
|
+
}
|
|
96
|
+
if (deferredIn(masked, body[0], at)) {
|
|
97
|
+
report('CAND', 'lottie-load-before-canvas-ready', rel, line,
|
|
98
|
+
'loadAnimation() sits inside a closure / callback within aboutToAppear/aboutToBuild — it runs only when that function is called, ' +
|
|
99
|
+
'so whether the Canvas context is ready then cannot be told statically. Confirm it is called from Canvas.onReady (or after it), ' +
|
|
100
|
+
'otherwise move loadAnimation into Canvas(this.canvasContext).onReady(() => { … })');
|
|
101
|
+
continue;
|
|
102
|
+
}
|
|
103
|
+
report('GATE', 'lottie-load-before-canvas-ready', rel, line,
|
|
104
|
+
'lottie.loadAnimation() is called inside aboutToAppear/aboutToBuild, which run before build(): the Canvas rendering ' +
|
|
105
|
+
'context is not attached yet, so the animation paints into an unready context and shows blank. Move loadAnimation into ' +
|
|
106
|
+
'Canvas(this.canvasContext).onReady(() => { … }) (it fires once the context is ready); keep destroy in aboutToDisappear / Canvas.onDisAppear. ' +
|
|
107
|
+
'If there is a real reason, write // LOTTIE-READY: <basis> above it');
|
|
108
|
+
}
|
|
109
|
+
}
|
|
@@ -42,12 +42,13 @@ export const meta: RuleMeta[] = [
|
|
|
42
42
|
invariant: "resources",
|
|
43
43
|
card: "resources",
|
|
44
44
|
needs: ["--resources"],
|
|
45
|
-
summary: "the referenced media SVG has a fill=\"none\" bounding box covering the viewBox: a path whose
|
|
45
|
+
summary: "the referenced media SVG has a fill=\"none\" bounding box covering the viewBox: a path made only of straight segments whose every subpath runs through the four viewBox corners (`M0 0h24v24H0z`, `H0V0z`, the doubled `…zm0 0h24v24H0V0z` and other spellings all count), or a rect with x/y at 0 and width/height equal to the viewBox.",
|
|
46
46
|
fix: "- The rules that read SVG/resource file content (need `--resources`) correspond to the sub-items of \"Misused Resource References\": `fillcolor-on-stroke-svg`, `fillcolor-on-full-viewport-path`, `media-unresolved-theme-attr` / `media-placeholder-in-use`, `media-duplicate-attribute`. They are exactly the class missed by \"just running `ls media/` to confirm the name exists\".",
|
|
47
47
|
escape: null,
|
|
48
48
|
cases: [
|
|
49
49
|
"The Android `<vector>` source does **not** have this path — measured zero hits across 10 Android repos",
|
|
50
50
|
"Measured: readyou-accounts' ic_rss_feed is returned by iconFor() and tinted in another @Builder, so checking only tinted calls missed it, and it is exactly the most conspicuous black box in the list items.",
|
|
51
|
+
"Measured: a Compose `Icons.Default.CheckCircleOutline` converted by code_vector_icons.ts kept the doubled bounding box `M0 0h24v24H0V0zm0 0h24v24H0V0z`; the old rule knew 4 spellings and reported 0, and `.fillColor('#00FF00')` turned the outlined circle with a tick into a solid green square.",
|
|
51
52
|
],
|
|
52
53
|
},
|
|
53
54
|
{
|
|
@@ -297,20 +298,86 @@ export function checkSvgTintChannel(scans: FileScan[], media: MediaIndex): void
|
|
|
297
298
|
* is exactly the full viewBox rectangle.
|
|
298
299
|
*/
|
|
299
300
|
export function isFullViewportRect(d: string, w: number, h: number): boolean {
|
|
300
|
-
//
|
|
301
|
-
|
|
302
|
-
//
|
|
303
|
-
//
|
|
304
|
-
const
|
|
305
|
-
const
|
|
306
|
-
const
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
301
|
+
// Walk the path instead of matching spellings: Material ships the guard box as `M0 0h24v24H0z`, `M0 0h24v24H0V0z`,
|
|
302
|
+
// `M0 0H24V24H0Z`, and doubled as `M0 0h24v24H0V0zm0 0h24v24H0V0z` (CheckCircleOutline, measured: the old
|
|
303
|
+
// four-spelling list missed it and the green tick rendered as a solid square). Only straight-line commands are
|
|
304
|
+
// followed; a curve or arc means real geometry, so the path is not a guard box.
|
|
305
|
+
const tokens: string[] = d.match(/[MmLlHhVvZz]|[-+]?(?:\d+\.?\d*|\.\d+)(?:[eE][-+]?\d+)?|[^\s,]/g) ?? [];
|
|
306
|
+
const corners: string[] = [`0,0`, `${w},0`, `${w},${h}`, `0,${h}`];
|
|
307
|
+
const isRect = (pts: Set<string>): boolean => pts.size === 4 && corners.every((c) => pts.has(c));
|
|
308
|
+
let x: number = 0;
|
|
309
|
+
let y: number = 0;
|
|
310
|
+
let sx: number = 0;
|
|
311
|
+
let sy: number = 0;
|
|
312
|
+
let cmd: string = '';
|
|
313
|
+
let pts: Set<string> | null = null;
|
|
314
|
+
let subpaths: number = 0;
|
|
315
|
+
const key = (): string => `${+x.toFixed(4)},${+y.toFixed(4)}`;
|
|
316
|
+
const close = (): boolean => {
|
|
317
|
+
if (pts === null) { return true; }
|
|
318
|
+
if (!isRect(pts)) { return false; }
|
|
319
|
+
subpaths += 1;
|
|
320
|
+
pts = null;
|
|
321
|
+
return true;
|
|
322
|
+
};
|
|
323
|
+
let i: number = 0;
|
|
324
|
+
const num = (): number | null => {
|
|
325
|
+
if (i >= tokens.length || !/^[-+.\d]/.test(tokens[i])) { return null; }
|
|
326
|
+
return parseFloat(tokens[i++]);
|
|
327
|
+
};
|
|
328
|
+
while (i < tokens.length) {
|
|
329
|
+
const t: string = tokens[i];
|
|
330
|
+
if (/^[A-Za-z]$/.test(t)) {
|
|
331
|
+
if (!/^[MmLlHhVvZz]$/.test(t)) { return false; }
|
|
332
|
+
cmd = t;
|
|
333
|
+
i += 1;
|
|
334
|
+
if (cmd === 'Z' || cmd === 'z') {
|
|
335
|
+
x = sx; y = sy;
|
|
336
|
+
if (!close()) { return false; }
|
|
337
|
+
continue;
|
|
338
|
+
}
|
|
339
|
+
} else if (!/^[-+.\d]/.test(t) || cmd === '' || cmd === 'Z' || cmd === 'z') {
|
|
340
|
+
return false;
|
|
341
|
+
}
|
|
342
|
+
const rel: boolean = cmd === cmd.toLowerCase();
|
|
343
|
+
switch (cmd.toLowerCase()) {
|
|
344
|
+
case 'm': {
|
|
345
|
+
const a: number | null = num();
|
|
346
|
+
const b: number | null = num();
|
|
347
|
+
if (a === null || b === null || !close()) { return false; }
|
|
348
|
+
x = rel ? x + a : a; y = rel ? y + b : b;
|
|
349
|
+
sx = x; sy = y;
|
|
350
|
+
pts = new Set([key()]);
|
|
351
|
+
cmd = rel ? 'l' : 'L'; // extra coordinate pairs after a moveto are linetos
|
|
352
|
+
break;
|
|
353
|
+
}
|
|
354
|
+
case 'l': {
|
|
355
|
+
const a: number | null = num();
|
|
356
|
+
const b: number | null = num();
|
|
357
|
+
if (a === null || b === null || pts === null) { return false; }
|
|
358
|
+
x = rel ? x + a : a; y = rel ? y + b : b;
|
|
359
|
+
pts.add(key());
|
|
360
|
+
break;
|
|
361
|
+
}
|
|
362
|
+
case 'h': {
|
|
363
|
+
const a: number | null = num();
|
|
364
|
+
if (a === null || pts === null) { return false; }
|
|
365
|
+
x = rel ? x + a : a;
|
|
366
|
+
pts.add(key());
|
|
367
|
+
break;
|
|
368
|
+
}
|
|
369
|
+
case 'v': {
|
|
370
|
+
const a: number | null = num();
|
|
371
|
+
if (a === null || pts === null) { return false; }
|
|
372
|
+
y = rel ? y + a : a;
|
|
373
|
+
pts.add(key());
|
|
374
|
+
break;
|
|
375
|
+
}
|
|
376
|
+
default:
|
|
377
|
+
return false;
|
|
378
|
+
}
|
|
379
|
+
}
|
|
380
|
+
return close() && subpaths > 0;
|
|
314
381
|
}
|
|
315
382
|
|
|
316
383
|
/**
|
|
@@ -396,9 +463,12 @@ export function checkFullViewportTint(scans: FileScan[], media: MediaIndex): voi
|
|
|
396
463
|
'before the <rect> fix did not strip it, so the file is most likely a converter leftover, not hand-written. ' +
|
|
397
464
|
'Fix: delete this <rect> (and the <g> it leaves empty) from the SVG, or re-run ' +
|
|
398
465
|
'a2h-resource-convert/scripts/code_vector_icons.ts for this icon; the rest of the file is fine'
|
|
399
|
-
: 'Root cause: this path is how Material **web SVGs** are written; an Android <vector> source never produces it
|
|
400
|
-
'the file was hand-written from memory
|
|
401
|
-
'
|
|
466
|
+
: 'Root cause: this path is how Material **web SVGs** are written; an Android <vector> source never produces it. ' +
|
|
467
|
+
'Either the file was hand-written from memory, or it is a Compose `Icons.*` icon that ' +
|
|
468
|
+
'a2h-resource-convert/scripts/code_vector_icons.ts copied from the upstream web SVG without stripping this ' +
|
|
469
|
+
'spelling of the guard box (e.g. the doubled `M0 0h24v24H0V0zm0 0h24v24H0V0z`). ' +
|
|
470
|
+
'Fix: delete this element from the SVG (the rest of a converted file is fine); for a hand-written file, convert ' +
|
|
471
|
+
'it again from the <vector> in res/drawable, and when there really is no matching drawable, ' +
|
|
402
472
|
`register it as${SP}${quoteWord("degraded")}${SP}per the Phase 4.3 icon source tiers; do not hand-write it`));
|
|
403
473
|
break;
|
|
404
474
|
}
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
// static_check/rules/relative_container_cycle.ts — GATE relative-container-anchor-cycle.
|
|
2
|
+
|
|
3
|
+
import { report } from '../core/findings.ts';
|
|
4
|
+
import { directUiChildren, exclusiveBranches, lineOfIndex, matchBracket } from '../core/parse.ts';
|
|
5
|
+
import type { UiChild } from '../core/parse.ts';
|
|
6
|
+
import { maskedOf } from '../core/scan.ts';
|
|
7
|
+
import type { FileScan } from '../core/scan.ts';
|
|
8
|
+
import type { RuleMeta } from '../core/meta.ts';
|
|
9
|
+
|
|
10
|
+
/** Rule metadata (rendered by scripts/gen_rule_docs.mjs). */
|
|
11
|
+
export const meta: RuleMeta[] = [
|
|
12
|
+
{
|
|
13
|
+
id: "relative-container-anchor-cycle",
|
|
14
|
+
levels: ["GATE"],
|
|
15
|
+
invariant: "geometry",
|
|
16
|
+
card: "geometry",
|
|
17
|
+
needs: [],
|
|
18
|
+
summary: "Direct children of one `RelativeContainer` whose sibling anchors in `.alignRules()` form a cycle: A anchors B and B anchors A (on any axis), a longer cycle, or a child anchoring itself. Chains are exempt: a pair anchored end to start on one axis (A's right/end on B's Start and B's left/start on A's End; bottom/top likewise vertically) is not a cycle, with or without `.chainMode()`. Only literal `.id('x')` and literal `anchor: 'x'` on child components are read: a cycle through a barrier (`.barrier()`) or a variable such as `.alignRules(this.rules)` is not detected.",
|
|
19
|
+
fix: "RelativeContainer doc: when children depend on each other mutually or in a cycle, none of the container's children are drawn — the card shows only its background / corners (an empty capsule), the view tree has `children: []` for it, and neither the build nor the smoke test reports it. For \"icon vertically centered + two text lines on the right\" use `Row { Image; Column { … } }.alignItems(VerticalAlign.Center)`, and put corner elements on the next row or in a `Stack` + `Alignment`; when RelativeContainer is really needed, keep dependencies one-way: once the text column anchors the icon (horizontally), the icon must not anchor the text column (center it on `__container__` or give a fixed height instead). The one exception is a chain: adjacent components on one axis anchor each other end to start, with `.chainMode(Axis.Horizontal | Axis.Vertical, ChainStyle.*)` on the chain head; the doc allows it and the rule does not flag it.",
|
|
20
|
+
escape: null,
|
|
21
|
+
cases: [
|
|
22
|
+
"Observed (weather home, ds-1125 11-26): in MetricCard / SunCard the icon `center` anchored the text column and the text column `left` anchored the icon, with `.height('auto')`; the 4 metric cards and the sunrise/sunset cards rendered as empty capsules (measured bounds about 18vp high, `children: []`). Static GATE 0, build succeeded, Smoke PASS; the smoke subagent only logged the metric cards as a TODO, and the sun cards were below the first screen until the logic-stage review. Trigger: the relative-container-unsized-in-scroll fix text \"anchor vertically only on siblings\".",
|
|
23
|
+
],
|
|
24
|
+
},
|
|
25
|
+
];
|
|
26
|
+
|
|
27
|
+
const RULE_ENTRY: RegExp = /\b(left|right|start|end|middle|top|bottom|center)\s*:\s*\{([^{}]*)\}/g;
|
|
28
|
+
const ANCHOR: RegExp = /\banchor\s*:\s*(['"])([^'"]+)\1/;
|
|
29
|
+
const ALIGN: RegExp = /\balign\s*:\s*(?:HorizontalAlign|VerticalAlign)\s*\.\s*(\w+)/;
|
|
30
|
+
const ID_LITERAL: RegExp = /^\s*(['"])([^'"]+)\1\s*$/;
|
|
31
|
+
|
|
32
|
+
/** One sibling anchor: edge `key` of the child anchors edge `align` of child `to`. */
|
|
33
|
+
interface Edge { to: string; key: string; align: string; }
|
|
34
|
+
interface Node { id: string; kid: UiChild; edges: Edge[]; deps: Set<string>; }
|
|
35
|
+
|
|
36
|
+
/** Per axis: the trailing / leading edge keys, and the neighbour's edge each must meet in a chain. */
|
|
37
|
+
const CHAIN_AXES: { lead: Set<string>; trail: Set<string>; leadMeets: string; trailMeets: string }[] = [
|
|
38
|
+
{ lead: new Set(['left', 'start']), trail: new Set(['right', 'end']), leadMeets: 'End', trailMeets: 'Start' },
|
|
39
|
+
{ lead: new Set(['top']), trail: new Set(['bottom']), leadMeets: 'Bottom', trailMeets: 'Top' },
|
|
40
|
+
];
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Whether a <-> b is one chain link: on one axis a's trailing edge meets b's leading edge and b's leading edge
|
|
44
|
+
* meets a's trailing edge (or the mirror). The RelativeContainer doc exempts chains from the no-cycle rule.
|
|
45
|
+
* chainMode only styles a chain the anchors already form (default SPREAD), so it is not required here.
|
|
46
|
+
*/
|
|
47
|
+
function chainLink(a: Node, b: Node): boolean {
|
|
48
|
+
const has = (n: Node, to: string, keys: Set<string>, align: string): boolean =>
|
|
49
|
+
n.edges.some((e) => e.to === to && keys.has(e.key) && e.align === align);
|
|
50
|
+
return CHAIN_AXES.some((ax) =>
|
|
51
|
+
(has(a, b.id, ax.trail, ax.trailMeets) && has(b, a.id, ax.lead, ax.leadMeets)) ||
|
|
52
|
+
(has(a, b.id, ax.lead, ax.leadMeets) && has(b, a.id, ax.trail, ax.trailMeets)));
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/** Shortest cycle through the graph found by DFS from each node in source order, as an id path (first id repeated at the end). */
|
|
56
|
+
function findCycle(nodes: Map<string, Node>): string[] | null {
|
|
57
|
+
const state: Map<string, 0 | 1 | 2> = new Map();
|
|
58
|
+
const stack: string[] = [];
|
|
59
|
+
const dfs = (id: string): string[] | null => {
|
|
60
|
+
state.set(id, 1);
|
|
61
|
+
stack.push(id);
|
|
62
|
+
for (const d of nodes.get(id)?.deps ?? []) {
|
|
63
|
+
if (!nodes.has(d)) { continue; }
|
|
64
|
+
const st = state.get(d) ?? 0;
|
|
65
|
+
if (st === 1) { return [...stack.slice(stack.indexOf(d)), d]; }
|
|
66
|
+
if (st === 0) {
|
|
67
|
+
const c = dfs(d);
|
|
68
|
+
if (c !== null) { return c; }
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
stack.pop();
|
|
72
|
+
state.set(id, 2);
|
|
73
|
+
return null;
|
|
74
|
+
};
|
|
75
|
+
for (const id of nodes.keys()) {
|
|
76
|
+
if ((state.get(id) ?? 0) === 0) {
|
|
77
|
+
const c = dfs(id);
|
|
78
|
+
if (c !== null) { return c; }
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
return null;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* GATE relative-container-anchor-cycle: direct children of one RelativeContainer whose sibling anchors form a cycle.
|
|
86
|
+
* Per the RelativeContainer doc, mutual or circular dependencies make the container draw none of its children; the
|
|
87
|
+
* dependency is per component, so A anchoring B vertically while B anchors A horizontally counts too (weather cards).
|
|
88
|
+
* Only literal ids and literal anchors are read; children in exclusive if/else branches never depend on each other,
|
|
89
|
+
* and the two anchors of a chain link (same axis, end-to-start both ways) are exempt, as the doc allows.
|
|
90
|
+
*/
|
|
91
|
+
export function checkRelativeContainerCycle(scans: FileScan[]): void {
|
|
92
|
+
for (const s of scans) {
|
|
93
|
+
const masked: string = maskedOf(s);
|
|
94
|
+
for (const m of masked.matchAll(/\bRelativeContainer\s*\(/g)) {
|
|
95
|
+
const paren: number = (m.index as number) + m[0].length - 1;
|
|
96
|
+
const argsEnd: number = matchBracket(s.code, paren);
|
|
97
|
+
if (argsEnd < 0) { continue; }
|
|
98
|
+
let k: number = argsEnd + 1;
|
|
99
|
+
while (k < s.code.length && /\s/.test(s.code[k])) { k++; }
|
|
100
|
+
if (s.code[k] !== '{') { continue; }
|
|
101
|
+
const close: number = matchBracket(s.code, k);
|
|
102
|
+
if (close < 0) { continue; }
|
|
103
|
+
const kids: UiChild[] = directUiChildren(s.code, k, close, undefined, { intoBranches: true })
|
|
104
|
+
.filter((c) => c.control !== true);
|
|
105
|
+
const nodes: Map<string, Node> = new Map();
|
|
106
|
+
for (const kid of kids) {
|
|
107
|
+
const idAttr = kid.attrs.find((a) => a.name === 'id');
|
|
108
|
+
const idm: RegExpExecArray | null = idAttr === undefined ? null : ID_LITERAL.exec(idAttr.args);
|
|
109
|
+
if (idm === null || nodes.has(idm[2])) { continue; }
|
|
110
|
+
const edges: Edge[] = [];
|
|
111
|
+
for (const a of kid.attrs) {
|
|
112
|
+
if (a.name !== 'alignRules') { continue; }
|
|
113
|
+
for (const em of a.args.matchAll(RULE_ENTRY)) {
|
|
114
|
+
const am: RegExpExecArray | null = ANCHOR.exec(em[2]);
|
|
115
|
+
if (am === null || am[2] === '__container__') { continue; }
|
|
116
|
+
edges.push({ to: am[2], key: em[1], align: ALIGN.exec(em[2])?.[1] ?? '' });
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
nodes.set(idm[2], { id: idm[2], kid, edges, deps: new Set(edges.map((e) => e.to)) });
|
|
120
|
+
}
|
|
121
|
+
// Drop edges between children that are never shown together, and both edges of a chain link.
|
|
122
|
+
// Collect first, then delete: chainLink reads the edges of both ends.
|
|
123
|
+
const drop: [Node, string][] = [];
|
|
124
|
+
for (const n of nodes.values()) {
|
|
125
|
+
for (const d of n.deps) {
|
|
126
|
+
const t: Node | undefined = nodes.get(d);
|
|
127
|
+
if (t === undefined || t === n) { continue; }
|
|
128
|
+
if (exclusiveBranches(n.kid, t.kid) || chainLink(n, t)) { drop.push([n, d]); }
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
for (const [n, d] of drop) { n.deps.delete(d); }
|
|
132
|
+
const cycle: string[] | null = findCycle(nodes);
|
|
133
|
+
if (cycle === null) { continue; }
|
|
134
|
+
report('GATE', 'relative-container-anchor-cycle', s.rel, lineOfIndex(s.code, m.index as number),
|
|
135
|
+
`RelativeContainer children anchor each other in a cycle (${cycle.map((c) => `'${c}'`).join(' -> ')}): ` +
|
|
136
|
+
'with mutual or circular dependencies the container draws none of its children (only its background shows), ' +
|
|
137
|
+
'whichever axes the anchors are on. Use Row { Image; Column { ... } } for icon + text, or make the anchors one-way');
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
}
|
package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/relative_container_height.ts
CHANGED
|
@@ -17,7 +17,7 @@ export const meta: RuleMeta[] = [
|
|
|
17
17
|
card: "geometry",
|
|
18
18
|
needs: [],
|
|
19
19
|
summary: "A `RelativeContainer` inside a vertical Scroll/List/Grid/WaterFlow, with no definite height on any level up to the scroll container, whose own height is unset or `'auto'` / `LayoutPolicy.wrapContent` / `fixAtIdealSize`, and with a child whose `alignRules` anchor top / bottom / center on `'__container__'` (traced across structs to the call site).",
|
|
20
|
-
fix: "RelativeContainer doc: when height is `\"auto\"` (API 11+) or `wrapContent` (API 20+), any child anchored to the container in the vertical direction disables the self-sizing and the height counts as unset (FAQ faqs-arkui-318: the container height and the child layout depend on each other in a cycle). Express an Android `wrap_content` card with `Column`/`Row`/`Stack` (left icon + text column = `Row { Image; Column { … } }`, corner elements with `Stack` + `Alignment`); when two-dimensional constraints are really needed, anchor vertically only on siblings (the first child has no vertical alignRules and sits at the top by default) and write `.height('auto')`, or write the height measured in the reference view tree.",
|
|
20
|
+
fix: "RelativeContainer doc: when height is `\"auto\"` (API 11+) or `wrapContent` (API 20+), any child anchored to the container in the vertical direction disables the self-sizing and the height counts as unset (FAQ faqs-arkui-318: the container height and the child layout depend on each other in a cycle). Express an Android `wrap_content` card with `Column`/`Row`/`Stack` (left icon + text column = `Row { Image; Column { … } }`, corner elements with `Stack` + `Alignment`); when two-dimensional constraints are really needed, anchor vertically only on siblings (the first child has no vertical alignRules and sits at the top by default) and write `.height('auto')`, or write the height measured in the reference view tree; sibling anchors must be one-way, never A anchoring B while B anchors A (on any axis), or no child is drawn (GATE `relative-container-anchor-cycle`); a chain (end-to-start anchors on one axis + `.chainMode()` on the head) is the exception.",
|
|
21
21
|
escape: null,
|
|
22
22
|
cases: [
|
|
23
23
|
"Measured (weather home page, glm53 11-19): the sunrise/sunset card and the 4 info cards, ConstraintLayout `wrap_content`, were translated into RelativeContainers with only `.width('100%')`, and the icon anchored both top and bottom of `__container__`; inside the Scroll the cards were stretched far taller than Android's 59dp. The sub-agent wrote \"RelativeContainer supports wrap?\" in its reasoning and did not check the doc; its basis was the geometry card's \"two-dimensional constraints → RelativeContainer\".",
|
|
@@ -96,7 +96,7 @@ export function checkRelativeContainerInScroll(scans: FileScan[]): void {
|
|
|
96
96
|
`RelativeContainer with no definite height inside a vertical scroller (${[...hits[0]].reverse().join(' > ')}), and a child anchors ` +
|
|
97
97
|
"'__container__' vertically: height 'auto' / wrapContent does not apply on an axis where children anchor the container, so the card " +
|
|
98
98
|
'is not sized to its content. For an Android wrap_content card use Column / Row / Stack; to keep RelativeContainer, anchor ' +
|
|
99
|
-
"vertically to siblings only and set .height('auto'), or set the measured height");
|
|
99
|
+
"vertically to siblings only (one-way: a sibling must not anchor back) and set .height('auto'), or set the measured height");
|
|
100
100
|
}
|
|
101
101
|
}
|
|
102
102
|
}
|