Repository navigation
BlocksUI: ops reach lanes and rounds, children keyed by id, app figure and poster hooks, fold colour, openBeside and pending acts (#295) - #316
Merged
Conversation
…e and poster hooks, fold colour, openBeside and pending acts (#295)
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.
Closes #295
For humans
For apps:
replacenow carries the same child asinsert(a block, lane, round or table row; a block payload decodes as before), andmerge,replaceandremovereach lanes and rounds in Rust, web and Swift. A row'stitleis optional (SwiftRow.titleisString?, TStitle?), so a figure-only row decodes. A card takescolor(l,p,c,g,a) for its folded line. Swift:AppBlocks(_, figure:, poster:)(figure now draws row figures too; poster draws in the card header and readscard.posterfor who posted),BlocksView(openBeside:, pending:). Nothing to do for apps that don't opt in; Rust code that buildsOp::Replacewraps its block inChild::Block.What changed
patch.rsfinds a lane, round or table row by id for merge, replace and remove (spot/drop_partreplace the table-row-onlyrow/take_row); a replace with the wrong kind of child is aShapeerror. Webapply.tswalkslanes; SwiftApply.swiftwalks a scene's lanes and a row's rounds.Op::Replace.blockis aChildnow: it has to be, because a lane or a round is noBlock. This is additive on the wire (an old block payload still decodes), so the schema version stays the same.BlockStack, card buttons, rounds and stage lanes are keyed by id, and by position only when there is no id or the id repeats (ChildKey).ListBlockwas keyed by id already.AppBlocks.figuredraws row figures too, from the figure's JSON (state,tool, …).Row.titleis#[serde(default)], so a figure-only row decodes. Two fixture tests used a title-less row as their bad example; they use"title": 3now, so they still cover the shape fault.Card.color(a string, the same as a scene repo'scolor) mapsl/p/c/g/ato lead, purple, cyan, green and amber for the folded line.AppBlocks(poster:)draws in the card header after the kind label. When it is set, the plugin's· namesuffix is left off.BlocksView(openBeside:, pending:):ActButtonalready senttap.opento anopenBesidein the environment, but nothing set it. A pending action'sActButtonand the fold's main button are disabled, and the button is dimmed to 0.5.Decided:
pendingis aSet<String>of action names, because that is whatActButtonsends. I didn't touch the Debug-build stack depth ofBlockdecoding the issue mentions ("worth a look"); it is out of this diff.Not done here: web rounds have no
data-id, so the web view patcher redraws nothing for a round op (the model applies). Adding it changes the Rust site HTML fixtures, which is outside this issue.src/ net +101 (budget: none stated). Most of it is the Swift hooks and the Rust lane and round lookup. Cap after merging staging: 42984 / 44000.
Tests (all at 229f086)
just fmtjust clippyjust test(incl. newcrates/blocks/tests/parts.rs)just web(incl. new lane/round apply test inweb/test/patch.test.ts)BLOCKS_STRICT=1 swift test+node web/lint.mjs swift/Sources/BlocksUI(just swift)just archjust capjust guardNew Swift tests, one per AC:
ApplyTests.testMergeReplaceAndRemoveReachALaneAndARoundLiveTests.testATypedFieldKeepsItsTextAndFocusWhenABlockIsInsertedAboveIt: a hosted window. I type into the field and insert a block above it. It fails on position keys (checked: "" ≠ "Ada", focus lost).AppFixtureTests.testAnAppDrawsARowsFigureFromItsStateAndToolAndAFigureOnlyRowDecodesandtestAnAppDrawsACardsPosterInItsHeader: pixels, through public API only.RenderTests.testAFoldedCardDrawsItsLineInItsFleetColour: amber pixels withcolor: "a", none with an unknown code.LiveTests.testATapOpenGoesBesideWhenTheAppSetsItAndAPendingActionsButtonIsDisabled: real mouse clicks at each block's drawn frame.tap.opengoes toopenBesideandtap.sheettoopen; the pendingapprovesends nothing andrejectsends. Without the pending disable it fails (checked: ["approve", "reject"]).The tag (AC 7) has to be cut on the merged commit after
drover merge; a lane can't do that.