Feature/texta selection - #53
Merged
Merged
Conversation
Co-authored-by: Copilot <copilot@github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Adds selection-geometry support for custom blocks so the GUI text-selection system can work with texta() blocks (in addition to regular text()), and provides a demo/debug page plus a regression test.
Changes:
- Extend the custom block registry API with
getSelectionGeometryand wire it into the GUICharacterBoundsAdapter. - Implement
getSelectionGeometryfortexta()by computing per-unit character bounds as part of texta layout. - Add a Texta selection debug demo page, update navigation/docs, and add a Vitest regression test.
Reviewed changes
Copilot reviewed 13 out of 13 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/texta/test/vitrine-selection.test.ts | Adds a regression test asserting selection bounds work for both text() and texta() blocks. |
| packages/texta/src/vitrine.ts | Implements Texta selection geometry and refactors layout to include per-unit bounds. |
| packages/gui/src/selection/character-bounds-adapter.ts | Adapts selection bounds extraction to include custom blocks via the block registry. |
| packages/core/src/core/block-registry.ts | Adds CustomBlockSelectionApi / CustomBlockSelectionGeometry and getSelectionGeometry handler hook. |
| packages/core/src/index.ts | Re-exports the new selection-related registry types. |
| packages/demo/vite.config.ts | Registers a new demo entrypoint for Texta selection debugging. |
| packages/demo/text-selection-debug.html | Updates navigation to link to the new Texta debug page. |
| packages/demo/text-selection-debug-texta.html | New Texta selection debug page. |
| packages/demo/text-selection-debug-texta.css | Styling for the new Texta selection debug page. |
| packages/demo/text-selection-debug-texta-setup.js | Mounts the debug component and logs hit-test/selection info. |
| packages/demo/text-selection-debug-texta-scene.js | Builds a scene of varied texta() blocks to stress selection/hit-testing. |
| packages/demo/component-demo.html | Clarifies the existing text selection debug link label. |
| docs/TEXT_SELECTION_REGULAR_TEXT.md | Updates scope docs to include custom-block selection geometry (including Texta). |
Comments suppressed due to low confidence (1)
packages/texta/src/vitrine.ts:9
measureTextandcalculateTextOffsetare imported fromvitrinebut no longer used in this module. WithnoUnusedLocals/linting enabled this will fail CI; please remove the unused imports (or switch back to using them).
import {
customBlock,
registerBlockType,
measureText,
calculateTextOffset,
SF_TEXT_ADVANCE_APPROX_DEFAULT
} from 'vitrine';
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.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.
Description
Brief description of changes.
Type of Change
Validation
pnpm buildpassespnpm build:examplespassesChecklist