Add utils for converting between Canvas component trees and json-render
>>> [!note] Migrated issue <!-- Drupal.org comment --> <!-- Migrated from issue #3573996. --> Reported by: [wotnak](https://www.drupal.org/user/3558113) Related to !613 >>> <h3 id="overview">Overview</h3> <p>For rendering Canvas pages in a local React codebase (<span class="drupalorg-gitlab-issue-link drupalorg-gitlab-link-wrapper"><a href="https://git.drupalcode.org/project/canvas/-/work_items/3573867" class="drupalorg-gitlab-link">https://git.drupalcode.org/project/canvas/-/work_items/3573867</a></span>) using the json-render library, we will need a method of converting between Canvas component trees and <a href="https://json-render.dev/docs/specs">json-render specs</a>.</p> <h3 id="proposed-resolution">Proposed resolution</h3> <p>Implement two-way conversion between a Canvas component tree and json-render. Add the conversions as functions in the <a href="https://git.drupalcode.org/project/canvas/-/tree/1.x/packages/drupal-canvas?ref_type=heads">drupal-canvas</a> package.</p> <p>Since json-render currently doesn't support using named slots (only the default 'children' one), use the version from <a href="https://github.com/vercel-labs/json-render/pull/105">feat: add support for using named slots#105</a>. </p> > Related issue: [Issue #3575872](https://www.drupal.org/node/3575872)
issue