docs/slate-browser/next-api-candidates-matrix.md
Specialist testing/proof doc. For current queue and roadmap truth, see master-roadmap.md.
Proposed API research only. This file does not define the current shipped
slate-browsersurface.
This is the deeper follow-up to next-api-candidates.md.
It answers:
Across Slate’s current Playwright example suite in /Users/zbeyens/git/slate-v2/playwright/integration/examples:
page.goto(...): 23getByRole('textbox'): 41selectText(): 7document.createRange / window.getSelection() / addRange(...): 5boundingBox() assertions: 2This matters because the best next APIs should erase repeated high-noise setup, not just add another cute helper name.
Ship an API only if it:
ready ContractStatus:
ship nowCandidate:
const editor = await openExample(page, "custom-placeholder", {
ready: {
editor: "visible",
text: /Hello/,
placeholder: "visible",
selection: "settled",
selector: "#document-outline",
},
});
Primary evidence:
initialize(...):
index.mjsCurrent pain it removes:
page.goto(...)Why it is strong:
Risk:
Rule:
editor.selection.select(...)Status:
ship nowCandidate:
await editor.selection.select({
anchor: { path: [0, 0], offset: 0 },
focus: { path: [0, 0], offset: 5 },
});
Companions:
await editor.selection.collapse({ path: [0, 0], offset: 0 });
await editor.selection.selectBlock([1]);
Primary evidence:
Current pain it removes:
Why it is strong:
Risk:
Rule:
editor.get.blockTexts() / editor.assert.blockTexts(...)Status:
ship nowCandidate:
expect(await editor.get.blockTexts()).toEqual(["alpha", "beta"]);
await editor.assert.blockTexts(["alpha", "beta"]);
Companions:
expect(await editor.get.selectedText()).toBe("alpha");
expect(await editor.get.textAt([1])).toBe("beta");
Primary evidence:
getText(...) and getSeletedText(...):
edix.tsCurrent pain it removes:
get.text()Why it is strong:
Risk:
Rule:
editor.snapshot()Status:
ship nowCandidate:
const snapshot = await editor.snapshot();
Likely payload:
Primary evidence:
use-editable getState():
useEditable.tsCurrent pain it removes:
Why it is strong:
Risk:
Rule:
Status:
ship after tranche 1Candidate:
await editor.assert.selection({
anchor: { path: [0, 0], offset: [0, 1] },
focus: { path: [0, 0], offset: [0, 1] },
});
Primary evidence:
Current pain it removes:
Why it is not tranche 1:
Rule:
Status:
ship after tranche 1Candidate:
await editor.assert.htmlEquals(expected, {
ignoreClasses: true,
ignoreInlineStyles: true,
ignoreDir: true,
});
Primary evidence:
assertHTML(...) options:
index.mjsCurrent pain it removes:
Why it is not tranche 1:
editor.get.selectedText()Status:
strong maybeCandidate:
expect(await editor.get.selectedText()).toBe("wise quote");
Primary evidence:
getSeletedText(...):
edix.tsCurrent pain it removes:
Why it matters:
Why it is not higher:
blockTexts and full snapshot() cover more surface firstStatus:
strong maybeCandidate:
expect(await editor.clipboard.readText()).toContain("Hello");
expect(await editor.clipboard.readHtml()).toContain("<p");
Primary evidence:
readClipboard(...):
utils.tsCurrent pain it removes:
Why it matters:
Why it is not higher:
Status:
laterProblem:
getByRole('textbox')Candidate directions:
const editor = await openExample(page, "iframe", {
surface: "iframe",
});
or:
const editor = await openExample(page, 'shadow-dom', {
resolveRoot: page => ...,
})
Current evidence:
Why it matters:
Why it is later:
Status:
laterCandidate:
await editor.path([1]).click({ clickCount: 3 });
await editor.textNode([0, 0]).click();
Current pain it removes:
.nth(...)Primary evidence:
Why it matters:
Why it is later:
selection.select(...) buys more value firstStatus:
low priorityCandidate:
await editor.assert.placeholderText("Type something");
Current evidence:
Why it matters:
Why it is low priority:
ready, selection.select, and blockTexts buy much moreopenFixture(...)Reject.
Why:
editor.driver()Reject.
Why:
Reject.
Why:
Reject.
Why:
Ship:
ready contracteditor.selection.select(...)editor.get.blockTexts() / assert.blockTexts(...)editor.snapshot()Ship:
editor.get.selectedText()Evaluate:
After the deeper pass, the next tranche is still the same.
That is a good sign.
The absolute-best next APIs are:
Everything else is either follow-on work or bait.