Repository navigation
feat(core): a Lab collection that runs its own reorder mode shares List's reorder parts - #14028
humbertovirtudes wants to merge 1 commit into
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
AI review status for this pull request.
|
PR Analysis Report🔎 Preview ·
|
0793145 to
8aa779b
Compare
There was a problem hiding this comment.
This pull request is reviewed as part of its stack; see the review on #14020.
8aa779b to
9e93eaa
Compare
There was a problem hiding this comment.
This pull request is reviewed as part of its stack; see the review on #14020.
9e93eaa to
b57e894
Compare
There was a problem hiding this comment.
This pull request is reviewed as part of its stack; see the review on #14020.
…st's reorder parts A new internal entry, @astryxdesign/core/internal/reorder-mode, gives Lab the parts of List's reorder: the mode hint, which now offers Up and Down or Left and Right, the strings, the pointer input with a finger's hold, the edge autoscroll, the drop bounds and the preview copy. internal/reorder gains mountReorderStarter, so a reorderable object's start(key) reaches such a collection. List's session uses the same parts, so List does not change. The catalog gains Move left and Move right.
b57e894 to
ebaa99e
Compare
There was a problem hiding this comment.
This pull request is reviewed as part of its stack; see the review on #14020.
Part of #3639. Prerequisite for #3956 and #3958 (drag-and-drop Table columns in Lab).
Stack: #14028 → #14018 → #14019 → #14020
User need
A Lab collection that reorders along the inline axis, such as a Table's columns, needs the same reorder mode hint, strings, pointer input, edge autoscroll, drop bounds and preview copy that a List's rows use. Today those parts are private to Core's reorder engine, so a Lab collection has to copy them, and the copies drift: a column hint without the hint's fade-in, or a move button whose touch band anchors to the hint and lands a tap on Done. A reorderable object's
start(key)also reaches only List sessions, so an app's own "Move column" action cannot start reorder mode for a column (spec:AST-103FR4a).Design
A new internal entry,
@astryxdesign/core/internal/reorder-mode, gives Lab the parts of List's reorder. List's session now uses the same modules, so List does not change.ReorderModeHint(List/ReorderModeHint.tsx): reorder mode's hint, moved out of the engine. It takesaxis: 'block' | 'inline': the block axis offers Move up and Move down, as today; the inline axis offers Move left and Move right. The catalog gains@astryx.list.reorderMoveLeftand@astryx.list.reorderMoveRight.reorderMessagesFrom(t)(List/reorderMessages.ts): the announcement strings, moved out of the engine.attachReorderMouse(container, isCoarsePointer, …)andattachReorderHold(container, isCoarsePointer, …)(List/reorderPointer.ts): the session's pointer input, moved out of the engine with its pointer rule. A mouse, or a pen where the primary pointer is fine, drags from a handle once it moves 4 px; a finger, and a pen where the pointer is coarse, after the touch layer's hold. The caller says only whether the primary pointer is coarse, so List and Lab each make one call. One listener serves a whole collection. Each reports the began, changed, ended and cancelled positions, now with bothxandy.reorderAutoscroll(List/reorderAutoscroll.ts) withautoscrollStep: the drag's edge autoscroll on UIKit's reorder tick, as the engine runs it.watchReorderScroll(List/reorderScrollWatch.ts): the drag's watch of its scroller, moved out of the engine. It skips the drag's own scroll events, and folds a scroll the drag did not cause, such as a wheel's or one around the scroller, into the drag in a later frame in which the drag wrote nothing, so the drag's one read of the offset forces no layout.previewCopyOfandbareCopyOf: List's preview copy, moved from the engine besideinertCloneinmotion/inertClone.ts.previewCopyOfcopies content withinertClone, and content holding a canvas that reads back empty gets its bare box,bareCopyOf: the element without its children, ids, test ids, names, label ties or autofocus. List's engine callspreviewCopyOfas it called its private copy, and a Lab preview calls the same two, so both previews copy and fall back alike.movableRange,paintedBackgroundandgetNodeText(the text a reorder handle is named by, block by block, as Table's resize handle reads it), re-exported as they are.mountReorderStarter(reorderable, {startByKey})in@astryxdesign/core/internal/reorder: lets the object'sstart(key)reach a collection that runs its own reorder mode. The engine keeps one list of starters per object, sostartstill finds the one mounted last.internal/reorderkeeps its rule that it loads no reorder code (its test still passes), which is why the parts get their own entry. Thearchitecture:react-component-runtimeINV12 source boundary check, which keeps the inert clone to the copy mechanism and the reorder's preview, now listsinternal/reorder-mode.tsas the entry Lab's column preview reaches it through.Owner decision
This adds an internal entry and modules another package imports, so it needs an owner API decision (pre-review checklist item a) for each of: the entry
packages/core/src/internal/reorder-mode.ts; the modules it exports,List/ReorderModeHint.tsx(with the inline hint's "Move left" and "Move right" names),List/reorderPointer.ts,List/reorderAutoscroll.ts,List/reorderScrollWatch.tsandList/reorderMessages.ts, withpreviewCopyOfandbareCopyOf(moved besideinertClone) and the re-exportedmovableRange,autoscrollStep,paintedBackgroundandgetNodeText; andmountReorderStarterininternal/reorder.ts.useTableDragAndDropColumns(feat(lab): reorder Table columns by keyboard and by taps #14018, feat(lab): drag Table columns by their reorder handle #14019, feat(lab): a dragged Table column dims and its preview follows the pointer #14020) imports every part.listReorderEngine.tsx.internal/reordermust load no reorder code, so it cannot carry them.The
component:ListOwns bullet records it, so it needs an ENGOWNER approval of the record change, with the INV12 boundary check's new entry. Related: #11226 addsreorderable.attachfor plain elements along the block axis; an inline axis there could later serve Table columns too.Testing
vitest --project ui packages/core/src/internal/reorderShared.test.tsxpreviewCopyOfcopies a cell without its id and hidden, and gives a cell whose canvas cannot be read its bare box with its classes;bareCopyOfcopies no children or id. Also: the hint offers Left, Right and Done on the inline axis and Down on the block axis, and none outside the mode; the strings read as List's, andgetNodeTextreads a two-block header as "Due date"; the autoscroll ticks on a step and stops; a mouse drags past the slop, and neither a finger nor a pen under a coarse pointer drags at once;start(key)reaches a mounted starter until it leaves; the scroll watch skips the drag's own scroll, folds another one frame later, and stops (6/6)vitest --project ui packages/core(every Core suite, the INV12 boundary check included)vitest --project ui packages/core packages/labListReorder*.interaction.browser.spec.tstypecheck;pnpm buildeslint --max-warnings=0(strict), Prettierpnpm check:repo(knowledge, changesets, i18n runtime and catalog, sync),sync-exports --check, changeset coveragecheck:component-import-boundaries --base-ref origin/main;pnpm size:pages --base origin/mainpnpm review:premaincleanWriting rubric results
R1 narration: none; the new Owns bullet states what the entry gives.
R2 research: none.
R3 evidence: no pull request or commit cited;
verified_bygainsinternal/reorderShared.test.tsx.R4 rejected alternatives: none in the record.
R5 change references: none.
R6 open questions: none added.
R7 project status: none.
Scope
Components: List, createReorderable