Make visual-parity dom-box-provider node-id attribute configurable (de-figma)#263
Merged
Merged
Conversation
The visual-parity dom-box-provider hardcoded figma's data-figma-* attributes for node enumeration, selector generation, and id/name reads, coupling the otherwise product-neutral tool to a single source format. Make the node-identity attribute configurable via CLI flag (--node-id-attr, --node-name-attr) and env var (HOMEBOY_DOM_BOX_NODE_ID_ATTR, HOMEBOY_DOM_BOX_NODE_NAME_ATTR). The configured attribute drives element enumeration, selector generation, and id reads; node-name attributes are tried in order with aria-label as a generic final fallback. Defaults stay data-figma-node-id / data-figma-node-name,data-figma-name so existing figma callers (figma-fixture-matrix.php and its contract) work unchanged. Cover both the figma default path and the configured generic attribute path (env and flag) in the smoke test. Document the settings in the README. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
First step of the visual-parity centralization: de-figma the
php-transformer/tools/visual-parity/bin/dom-box-provider.mjsso the product-neutral visual-parity tool no longer hardcodes figma DOM attributes.Change
--node-id-attr/--node-name-attrandHOMEBOY_DOM_BOX_NODE_ID_ATTR/HOMEBOY_DOM_BOX_NODE_NAME_ATTR(CLI overrides env; names validated). Selector generation, node enumeration, and id/name reads all key off the configured attribute — no hardcodeddata-figma-*in logic.data-figma-node-id/data-figma-node-name,data-figma-name(+aria-labelname fallback), because the figma runtime supplies the provider command externally viaHOMEBOY_DOM_BOX_CAPTURE_COMMAND; a generic default would have silently broken live figma capture. The default flips to generic when figma repoints during the package extraction (documented).Verification
node --checkall bins;npm test(smoke) green — now asserts both the figma default path and a generic-attr path (via env and CLI).composer test:contractinfigma-transformer→ green (figma consumer unaffected).Follow-up
Staged plan for the remaining extraction (sibling
blocks-engine/visual-paritypackage, Tier-1/Tier-2 split, 4-repo consumer repoints, comparator de-dup) is in the cook report; this PR is the isolated, self-contained down-payment.AI assistance