@n-uf/placement 26.11.18 → 26.11.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +66 -0
- package/README.md +74 -2
- package/dist/{chunk-HQE2DOWA.js → chunk-GCSVZGVX.js} +183 -49
- package/dist/chunk-GCSVZGVX.js.map +1 -0
- package/dist/{model-irGEua8T.d.ts → model-DU7MovDa.d.ts} +1 -1
- package/dist/scene-cases.d.ts +35 -3
- package/dist/scene-cases.js +89 -40
- package/dist/scene-cases.js.map +1 -1
- package/dist/scene.d.ts +3 -3
- package/dist/scene.js +3 -1
- package/dist/stack.d.ts +2 -2
- package/dist/{targets-CZOYu8mG.d.ts → targets-CYJN0Hba.d.ts} +62 -7
- package/package.json +1 -1
- package/dist/chunk-HQE2DOWA.js.map +0 -1
package/dist/scene-cases.js
CHANGED
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
storeScene,
|
|
14
14
|
targets,
|
|
15
15
|
use
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-GCSVZGVX.js";
|
|
17
17
|
import "./chunk-RUITEOZ7.js";
|
|
18
18
|
import {
|
|
19
19
|
rect
|
|
@@ -822,21 +822,21 @@ var RULE_ROWS = [
|
|
|
822
822
|
{
|
|
823
823
|
id: "C29",
|
|
824
824
|
title: "A bar's reserved room",
|
|
825
|
-
expect: "A slot in the title bar opens beside the title and controls, never over them: the controls keep their place and size, and the title
|
|
825
|
+
expect: "A slot in the title bar opens beside the title and controls, never over them: the controls keep their place and size, and the title keeps its start and its natural width. A leading toolbar sits right after the title's natural rect.",
|
|
826
826
|
group: "kinds",
|
|
827
827
|
scene: doc(),
|
|
828
828
|
gestures: [g.press("tools"), g.to(g.gap("titlebar", 1)), g.hold(), g.release()],
|
|
829
|
-
checkpoints: [{ at: 2, layout: { items: { title: { rect: rect(0, 0,
|
|
830
|
-
expectLayout: { items: { title: { rect: rect(0, 0,
|
|
829
|
+
checkpoints: [{ at: 2, layout: { items: { title: { rect: rect(0, 0, 160, 32) }, tools: { edge: "titlebar", rect: rect(160, 0, 200, 32) }, controls: { rect: rect(1116, 0, 84, 32) } }, order: { titlebar: ["title", "tools", "controls"] } }, note: "the slot, right after the title" }],
|
|
830
|
+
expectLayout: { items: { title: { rect: rect(0, 0, 160, 32) }, tools: { edge: "titlebar", rect: rect(160, 0, 200, 32) }, controls: { rect: rect(1116, 0, 84, 32) } }, order: { titlebar: ["title", "tools", "controls"] } }
|
|
831
831
|
},
|
|
832
832
|
{
|
|
833
833
|
id: "C29b",
|
|
834
834
|
title: "Over the title, the gap just after it",
|
|
835
|
-
expect: "Held over the title's text, a group is offered the
|
|
835
|
+
expect: "Held over the title's text (the bar's leading third), a group is offered the leading zone's gap, just after the title; the slot never covers the title's natural rect: the title keeps its natural width, the controls keep theirs.",
|
|
836
836
|
group: "kinds",
|
|
837
837
|
scene: panelsOnly(),
|
|
838
838
|
gestures: [g.press("tools"), g.at(80, 16), g.hold()],
|
|
839
|
-
expectLayout: { items: { tools: { edge: "titlebar", rect: rect(
|
|
839
|
+
expectLayout: { items: { tools: { edge: "titlebar", rect: rect(160, 0, 200, 32) }, title: { rect: rect(0, 0, 160, 32) }, controls: { rect: rect(1116, 0, 84, 32) } }, order: { titlebar: ["title", "tools", "controls"] } },
|
|
840
840
|
expectDom: [{ select: "[data-drag-slot][data-drag-target]", count: 1, attr: { "data-drag-target": "gap:titlebar:start:1" }, note: "the slot just after the title" }]
|
|
841
841
|
},
|
|
842
842
|
// --- revision 4 -------------------------------------------------------------------------------------------------------
|
|
@@ -1296,6 +1296,16 @@ var GESTURE_ROWS = [
|
|
|
1296
1296
|
],
|
|
1297
1297
|
expectLayout: { items: { pages: { rect: rect(12, 0, 300, 394) }, annotations: { rect: rect(12, 406, 300, 394) }, findings: { rect: rect(808, 0, 300, 800) } }, columns: { left: [["pages", "annotations"]], right: [["findings"]] } }
|
|
1298
1298
|
},
|
|
1299
|
+
{
|
|
1300
|
+
id: "P14b-dock-after-a-column-id-is-reused",
|
|
1301
|
+
title: "Dock when a new column took a pruned column's id",
|
|
1302
|
+
expect: "Findings moved into the left column empties its right column, which goes; Pages opened in a new right column gets that column's id again. Dock then gives Findings its own column at the right side's outer end, as at the start, with Pages inside it: never a place beside Pages.",
|
|
1303
|
+
group: "gestures",
|
|
1304
|
+
scene: win(),
|
|
1305
|
+
gestures: [g.moveTo("findings", g.gap("left-0", 2)), g.moveTo("pages", g.column("right", 0)), g.click("findings", "dock")],
|
|
1306
|
+
checkpoints: [{ at: 1, layout: { columns: { left: [["annotations", "findings"]], right: [["pages"]] } }, note: "Pages in a new right column" }],
|
|
1307
|
+
expectLayout: { columns: { left: [["annotations"]], right: [["findings"], ["pages"]] } }
|
|
1308
|
+
},
|
|
1299
1309
|
{
|
|
1300
1310
|
id: "P15-stops-for-the-keyboard",
|
|
1301
1311
|
title: "Move to \u203A stops",
|
|
@@ -1867,7 +1877,8 @@ var gestureWords = (g2, i) => {
|
|
|
1867
1877
|
const bits = [g2.item, g2.place ? JSON.stringify(g2.place) : void 0, g2.point ? `${px(g2.point.x)},${px(g2.point.y)}` : void 0, g2.key, g2.edge, g2.size !== void 0 ? String(g2.size) : void 0].filter((x) => x !== void 0);
|
|
1868
1878
|
return `gesture ${i + 1} (${g2.type}${bits.length ? ` ${bits.join(" ")}` : ""})`;
|
|
1869
1879
|
};
|
|
1870
|
-
|
|
1880
|
+
var words = (e) => e instanceof Error ? e.message : String(e);
|
|
1881
|
+
function* steps(row2, host) {
|
|
1871
1882
|
const failures = [];
|
|
1872
1883
|
const skipped = [];
|
|
1873
1884
|
const n = row2.gestures.length;
|
|
@@ -1888,83 +1899,119 @@ function runCase(row2, host) {
|
|
|
1888
1899
|
}
|
|
1889
1900
|
range("the stops check", row2.expectStops?.at);
|
|
1890
1901
|
if (failures.length > 0) return { ok: false, failures, skipped };
|
|
1891
|
-
|
|
1892
|
-
|
|
1893
|
-
|
|
1894
|
-
|
|
1895
|
-
|
|
1896
|
-
|
|
1897
|
-
|
|
1898
|
-
|
|
1899
|
-
|
|
1902
|
+
function* must(f2) {
|
|
1903
|
+
const r = yield f2;
|
|
1904
|
+
if (!r.ok) throw r.error;
|
|
1905
|
+
return r.value;
|
|
1906
|
+
}
|
|
1907
|
+
function* layoutOf(when) {
|
|
1908
|
+
const r = yield () => host.layout();
|
|
1909
|
+
if (r.ok) return r.value;
|
|
1910
|
+
fail([`the host couldn't give its layout: ${words(r.error)}`], when);
|
|
1911
|
+
return null;
|
|
1912
|
+
}
|
|
1913
|
+
function* dom(index) {
|
|
1900
1914
|
for (const c of row2.expectDom ?? []) {
|
|
1901
1915
|
if ((c.at ?? last) !== index) continue;
|
|
1902
1916
|
const check = aimed(c);
|
|
1903
|
-
const root = host.root ? host.root() : null;
|
|
1917
|
+
const root = host.root ? yield* must(() => host.root()) : null;
|
|
1904
1918
|
if (!root) {
|
|
1905
1919
|
skipped.push(labelOf(check));
|
|
1906
1920
|
continue;
|
|
1907
1921
|
}
|
|
1908
1922
|
fail(domIssues(check, root), ` after gesture ${index + 1} (${labelOf(check)})`);
|
|
1909
1923
|
}
|
|
1910
|
-
}
|
|
1911
|
-
|
|
1924
|
+
}
|
|
1925
|
+
function* stops2(index) {
|
|
1912
1926
|
const s = row2.expectStops;
|
|
1913
1927
|
if (!s || (s.at ?? last) !== index) return;
|
|
1914
1928
|
if (!host.stops) {
|
|
1915
1929
|
skipped.push(`the stops of ${s.item}`);
|
|
1916
1930
|
return;
|
|
1917
1931
|
}
|
|
1918
|
-
const have = host.stops(s.item).map(placeKey);
|
|
1932
|
+
const have = (yield* must(() => host.stops(s.item))).map(placeKey);
|
|
1919
1933
|
const want = s.places.map(placeKey);
|
|
1920
1934
|
if (have.join("\n") !== want.join("\n")) fail([`${s.item}'s stops are
|
|
1921
1935
|
${have.join("\n ")}
|
|
1922
1936
|
expected
|
|
1923
1937
|
${want.join("\n ")}`], "");
|
|
1924
|
-
}
|
|
1925
|
-
|
|
1926
|
-
|
|
1927
|
-
|
|
1928
|
-
fail([`the host couldn't load the scene: ${e instanceof Error ? e.message : String(e)}`], "");
|
|
1938
|
+
}
|
|
1939
|
+
const loaded = yield () => host.load(row2.scene, row2.settings);
|
|
1940
|
+
if (!loaded.ok) {
|
|
1941
|
+
fail([`the host couldn't load the scene: ${words(loaded.error)}`], "");
|
|
1929
1942
|
return { ok: false, failures, skipped };
|
|
1930
1943
|
}
|
|
1931
1944
|
for (let i = 0; i < n; i++) {
|
|
1932
1945
|
const g2 = row2.gestures[i];
|
|
1933
|
-
|
|
1934
|
-
|
|
1935
|
-
|
|
1936
|
-
fail([`${gestureWords(g2, i)} failed: ${e instanceof Error ? e.message : String(e)}`], "");
|
|
1946
|
+
const done = yield () => host.perform(g2);
|
|
1947
|
+
if (!done.ok) {
|
|
1948
|
+
fail([`${gestureWords(g2, i)} failed: ${words(done.error)}`], "");
|
|
1937
1949
|
return { ok: false, failures, skipped };
|
|
1938
1950
|
}
|
|
1939
1951
|
for (const cp of row2.checkpoints ?? []) {
|
|
1940
1952
|
if (cp.at !== i || !cp.layout) continue;
|
|
1941
|
-
const l2 = layoutOf(` after ${gestureWords(g2, i)}`);
|
|
1953
|
+
const l2 = yield* layoutOf(` after ${gestureWords(g2, i)}`);
|
|
1942
1954
|
if (l2) fail(layoutIssues(cp.layout, l2), ` after ${gestureWords(g2, i)}${cp.note ? ` (${cp.note})` : ""}`);
|
|
1943
1955
|
}
|
|
1944
|
-
dom(i);
|
|
1945
|
-
stops2(i);
|
|
1956
|
+
yield* dom(i);
|
|
1957
|
+
yield* stops2(i);
|
|
1946
1958
|
}
|
|
1947
1959
|
if (last < 0) {
|
|
1948
|
-
dom(-1);
|
|
1949
|
-
stops2(-1);
|
|
1960
|
+
yield* dom(-1);
|
|
1961
|
+
yield* stops2(-1);
|
|
1950
1962
|
}
|
|
1951
|
-
const l = layoutOf("");
|
|
1963
|
+
const l = yield* layoutOf("");
|
|
1952
1964
|
if (l) fail(layoutIssues(row2.expectLayout, l), "");
|
|
1953
1965
|
if (row2.expectStored) {
|
|
1954
1966
|
if (!host.stored) skipped.push("the stored form");
|
|
1955
1967
|
else {
|
|
1956
|
-
|
|
1957
|
-
|
|
1958
|
-
|
|
1959
|
-
fail([`the host couldn't give its stored form: ${e instanceof Error ? e.message : String(e)}`], "");
|
|
1960
|
-
}
|
|
1968
|
+
const r = yield () => host.stored();
|
|
1969
|
+
if (r.ok) fail(storedIssues(row2.expectStored, r.value), " (the stored form)");
|
|
1970
|
+
else fail([`the host couldn't give its stored form: ${words(r.error)}`], "");
|
|
1961
1971
|
}
|
|
1962
1972
|
}
|
|
1963
1973
|
return { ok: failures.length === 0, failures, skipped };
|
|
1964
1974
|
}
|
|
1975
|
+
function runCase(row2, host) {
|
|
1976
|
+
const run = steps(row2, host);
|
|
1977
|
+
let r = run.next();
|
|
1978
|
+
while (!r.done) {
|
|
1979
|
+
let out;
|
|
1980
|
+
try {
|
|
1981
|
+
out = { ok: true, value: r.value() };
|
|
1982
|
+
} catch (error) {
|
|
1983
|
+
out = { ok: false, error };
|
|
1984
|
+
}
|
|
1985
|
+
r = run.next(out);
|
|
1986
|
+
}
|
|
1987
|
+
return r.value;
|
|
1988
|
+
}
|
|
1989
|
+
async function runCaseAsync(row2, host) {
|
|
1990
|
+
const run = steps(row2, host);
|
|
1991
|
+
let r = run.next();
|
|
1992
|
+
while (!r.done) {
|
|
1993
|
+
let out;
|
|
1994
|
+
try {
|
|
1995
|
+
out = { ok: true, value: await r.value() };
|
|
1996
|
+
} catch (error) {
|
|
1997
|
+
out = { ok: false, error };
|
|
1998
|
+
}
|
|
1999
|
+
r = run.next(out);
|
|
2000
|
+
}
|
|
2001
|
+
return r.value;
|
|
2002
|
+
}
|
|
1965
2003
|
function runCases(rows, makeHost) {
|
|
1966
2004
|
return rows.map((row2) => ({ id: row2.id, result: runCase(row2, makeHost()) }));
|
|
1967
2005
|
}
|
|
2006
|
+
async function runCasesAsync(rows, makeHost, options = {}) {
|
|
2007
|
+
const out = [];
|
|
2008
|
+
for (const row2 of rows) {
|
|
2009
|
+
const result = await runCaseAsync(row2, await makeHost());
|
|
2010
|
+
options.onResult?.(row2.id, result);
|
|
2011
|
+
out.push({ id: row2.id, result });
|
|
2012
|
+
}
|
|
2013
|
+
return out;
|
|
2014
|
+
}
|
|
1968
2015
|
|
|
1969
2016
|
// src/scene/cases/index.ts
|
|
1970
2017
|
var CASES = [...DOCKING_ROWS, ...BAR_ROWS, ...RULE_ROWS, ...GESTURE_ROWS, ...WINDOW_ROWS];
|
|
@@ -1998,7 +2045,9 @@ export {
|
|
|
1998
2045
|
pickTarget,
|
|
1999
2046
|
resolvePlace,
|
|
2000
2047
|
runCase,
|
|
2048
|
+
runCaseAsync,
|
|
2001
2049
|
runCases,
|
|
2050
|
+
runCasesAsync,
|
|
2002
2051
|
winScene
|
|
2003
2052
|
};
|
|
2004
2053
|
//# sourceMappingURL=scene-cases.js.map
|