@riddledc/riddle-proof 0.7.129 → 0.7.130
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/dist/{chunk-TDK6WFH3.js → chunk-ZJNM3YAB.js} +81 -15
- package/dist/cli.cjs +81 -15
- package/dist/cli.js +1 -1
- package/dist/index.cjs +81 -15
- package/dist/index.js +1 -1
- package/dist/profile.cjs +81 -15
- package/dist/profile.d.cts +1 -0
- package/dist/profile.d.ts +1 -0
- package/dist/profile.js +1 -1
- package/dist/proof-run-engine.d.cts +3 -3
- package/dist/proof-run-engine.d.ts +3 -3
- package/package.json +1 -1
|
@@ -607,6 +607,17 @@ function normalizeSetupActionCoordinateMode(value, index) {
|
|
|
607
607
|
if (normalized === "ratio" || normalized === "relative" || normalized === "fraction") return "ratio";
|
|
608
608
|
throw new Error(`target.setup_actions[${index}].coordinate_mode ${String(value)} is not supported. Supported coordinate modes: pixels, ratio.`);
|
|
609
609
|
}
|
|
610
|
+
function normalizeSetupActionPointerType(value, type, index) {
|
|
611
|
+
if (value === void 0 || value === null || value === "") return void 0;
|
|
612
|
+
if (type !== "drag") {
|
|
613
|
+
throw new Error(`target.setup_actions[${index}].pointer_type is only supported for drag actions.`);
|
|
614
|
+
}
|
|
615
|
+
const normalized = String(value).trim().replace(/-/g, "_").toLowerCase();
|
|
616
|
+
if (normalized === "mouse") return "mouse";
|
|
617
|
+
if (normalized === "touch" || normalized === "finger") return "touch";
|
|
618
|
+
if (normalized === "pen" || normalized === "stylus") return "pen";
|
|
619
|
+
throw new Error(`target.setup_actions[${index}].pointer_type ${String(value)} is not supported. Supported pointer types: mouse, touch, pen.`);
|
|
620
|
+
}
|
|
610
621
|
function normalizeSetupAction(input, index) {
|
|
611
622
|
if (!isRecord(input)) throw new Error(`target.setup_actions[${index}] must be an object.`);
|
|
612
623
|
const type = normalizeSetupActionType(stringValue(input.type), index);
|
|
@@ -625,6 +636,7 @@ function normalizeSetupAction(input, index) {
|
|
|
625
636
|
const toX = numberValue(valueFromOwn(input, "to_x", "toX", "end_x", "endX", "x2"));
|
|
626
637
|
const toY = numberValue(valueFromOwn(input, "to_y", "toY", "end_y", "endY", "y2"));
|
|
627
638
|
const coordinateMode = normalizeSetupActionCoordinateMode(valueFromOwn(input, "coordinate_mode", "coordinateMode", "coords", "units"), index);
|
|
639
|
+
const pointerType = normalizeSetupActionPointerType(valueFromOwn(input, "pointer_type", "pointerType", "input_type", "inputType"), type, index);
|
|
628
640
|
if (type === "drag") {
|
|
629
641
|
if (fromX === void 0 || fromY === void 0 || toX === void 0 || toY === void 0) {
|
|
630
642
|
throw new Error(`target.setup_actions[${index}] drag requires from_x, from_y, to_x, and to_y.`);
|
|
@@ -709,6 +721,7 @@ function normalizeSetupAction(input, index) {
|
|
|
709
721
|
force: type === "click" && (input.force === true || input.force_click === true || input.forceClick === true),
|
|
710
722
|
click_count: normalizeSetupActionClickCount(input, type, index),
|
|
711
723
|
coordinate_mode: coordinateMode,
|
|
724
|
+
pointer_type: pointerType,
|
|
712
725
|
from_x: fromX,
|
|
713
726
|
from_y: fromY,
|
|
714
727
|
to_x: toX,
|
|
@@ -4909,23 +4922,75 @@ async function executeSetupAction(action, ordinal, viewport) {
|
|
|
4909
4922
|
const requestedSteps = setupNumber(action.steps, 8);
|
|
4910
4923
|
const steps = Math.min(100, Math.max(1, Math.floor(requestedSteps || 8)));
|
|
4911
4924
|
const durationMs = setupNumber(action.duration_ms ?? action.durationMs, 0);
|
|
4912
|
-
|
|
4913
|
-
|
|
4914
|
-
|
|
4915
|
-
|
|
4916
|
-
|
|
4917
|
-
|
|
4918
|
-
|
|
4919
|
-
|
|
4920
|
-
|
|
4921
|
-
|
|
4922
|
-
|
|
4925
|
+
const pointerType = String(action.pointer_type || action.pointerType || "mouse").trim().toLowerCase();
|
|
4926
|
+
if (pointerType === "touch" || pointerType === "pen") {
|
|
4927
|
+
const localStart = {
|
|
4928
|
+
x: coordinate(fromX, box.width),
|
|
4929
|
+
y: coordinate(fromY, box.height),
|
|
4930
|
+
};
|
|
4931
|
+
const localEnd = {
|
|
4932
|
+
x: coordinate(toX, box.width),
|
|
4933
|
+
y: coordinate(toY, box.height),
|
|
4934
|
+
};
|
|
4935
|
+
await target.evaluate(async (element, payload) => {
|
|
4936
|
+
const wait = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
|
|
4937
|
+
const rect = element.getBoundingClientRect();
|
|
4938
|
+
const pointerId = payload.pointerType === "touch" ? 11 : 12;
|
|
4939
|
+
const point = (progress) => ({
|
|
4940
|
+
clientX: rect.left + payload.start.x + (payload.end.x - payload.start.x) * progress,
|
|
4941
|
+
clientY: rect.top + payload.start.y + (payload.end.y - payload.start.y) * progress,
|
|
4942
|
+
});
|
|
4943
|
+
const dispatch = (type, progress) => {
|
|
4944
|
+
const coords = point(progress);
|
|
4945
|
+
element.dispatchEvent(new PointerEvent(type, {
|
|
4946
|
+
bubbles: true,
|
|
4947
|
+
cancelable: true,
|
|
4948
|
+
composed: true,
|
|
4949
|
+
pointerId,
|
|
4950
|
+
pointerType: payload.pointerType,
|
|
4951
|
+
isPrimary: true,
|
|
4952
|
+
buttons: type === "pointerup" ? 0 : 1,
|
|
4953
|
+
button: type === "pointerup" ? 0 : 0,
|
|
4954
|
+
clientX: coords.clientX,
|
|
4955
|
+
clientY: coords.clientY,
|
|
4956
|
+
}));
|
|
4957
|
+
};
|
|
4958
|
+
dispatch("pointerover", 0);
|
|
4959
|
+
dispatch("pointerenter", 0);
|
|
4960
|
+
dispatch("pointerdown", 0);
|
|
4961
|
+
for (let step = 1; step <= payload.steps; step += 1) {
|
|
4962
|
+
dispatch("pointermove", step / payload.steps);
|
|
4963
|
+
if (payload.durationMs && payload.steps > 1) await wait(payload.durationMs / payload.steps);
|
|
4923
4964
|
}
|
|
4924
|
-
|
|
4925
|
-
|
|
4965
|
+
dispatch("pointerup", 1);
|
|
4966
|
+
dispatch("pointerout", 1);
|
|
4967
|
+
dispatch("pointerleave", 1);
|
|
4968
|
+
}, {
|
|
4969
|
+
pointerType,
|
|
4970
|
+
start: localStart,
|
|
4971
|
+
end: localEnd,
|
|
4972
|
+
steps,
|
|
4973
|
+
durationMs,
|
|
4974
|
+
});
|
|
4975
|
+
} else {
|
|
4976
|
+
await page.mouse.move(start.x, start.y);
|
|
4977
|
+
await page.mouse.down();
|
|
4978
|
+
try {
|
|
4979
|
+
if (durationMs && steps > 1) {
|
|
4980
|
+
for (let step = 1; step <= steps; step += 1) {
|
|
4981
|
+
const progress = step / steps;
|
|
4982
|
+
await page.mouse.move(
|
|
4983
|
+
start.x + (end.x - start.x) * progress,
|
|
4984
|
+
start.y + (end.y - start.y) * progress,
|
|
4985
|
+
);
|
|
4986
|
+
await page.waitForTimeout(durationMs / steps);
|
|
4987
|
+
}
|
|
4988
|
+
} else {
|
|
4989
|
+
await page.mouse.move(end.x, end.y, { steps });
|
|
4990
|
+
}
|
|
4991
|
+
} finally {
|
|
4992
|
+
await page.mouse.up().catch(() => {});
|
|
4926
4993
|
}
|
|
4927
|
-
} finally {
|
|
4928
|
-
await page.mouse.up().catch(() => {});
|
|
4929
4994
|
}
|
|
4930
4995
|
return {
|
|
4931
4996
|
...base,
|
|
@@ -4938,6 +5003,7 @@ async function executeSetupAction(action, ordinal, viewport) {
|
|
|
4938
5003
|
from_y: fromY,
|
|
4939
5004
|
to_x: toX,
|
|
4940
5005
|
to_y: toY,
|
|
5006
|
+
pointer_type: pointerType,
|
|
4941
5007
|
steps,
|
|
4942
5008
|
duration_ms: durationMs || undefined,
|
|
4943
5009
|
};
|
package/dist/cli.cjs
CHANGED
|
@@ -7544,6 +7544,17 @@ function normalizeSetupActionCoordinateMode(value, index) {
|
|
|
7544
7544
|
if (normalized === "ratio" || normalized === "relative" || normalized === "fraction") return "ratio";
|
|
7545
7545
|
throw new Error(`target.setup_actions[${index}].coordinate_mode ${String(value)} is not supported. Supported coordinate modes: pixels, ratio.`);
|
|
7546
7546
|
}
|
|
7547
|
+
function normalizeSetupActionPointerType(value, type, index) {
|
|
7548
|
+
if (value === void 0 || value === null || value === "") return void 0;
|
|
7549
|
+
if (type !== "drag") {
|
|
7550
|
+
throw new Error(`target.setup_actions[${index}].pointer_type is only supported for drag actions.`);
|
|
7551
|
+
}
|
|
7552
|
+
const normalized = String(value).trim().replace(/-/g, "_").toLowerCase();
|
|
7553
|
+
if (normalized === "mouse") return "mouse";
|
|
7554
|
+
if (normalized === "touch" || normalized === "finger") return "touch";
|
|
7555
|
+
if (normalized === "pen" || normalized === "stylus") return "pen";
|
|
7556
|
+
throw new Error(`target.setup_actions[${index}].pointer_type ${String(value)} is not supported. Supported pointer types: mouse, touch, pen.`);
|
|
7557
|
+
}
|
|
7547
7558
|
function normalizeSetupAction(input, index) {
|
|
7548
7559
|
if (!isRecord(input)) throw new Error(`target.setup_actions[${index}] must be an object.`);
|
|
7549
7560
|
const type = normalizeSetupActionType(stringValue2(input.type), index);
|
|
@@ -7562,6 +7573,7 @@ function normalizeSetupAction(input, index) {
|
|
|
7562
7573
|
const toX = numberValue(valueFromOwn(input, "to_x", "toX", "end_x", "endX", "x2"));
|
|
7563
7574
|
const toY = numberValue(valueFromOwn(input, "to_y", "toY", "end_y", "endY", "y2"));
|
|
7564
7575
|
const coordinateMode = normalizeSetupActionCoordinateMode(valueFromOwn(input, "coordinate_mode", "coordinateMode", "coords", "units"), index);
|
|
7576
|
+
const pointerType = normalizeSetupActionPointerType(valueFromOwn(input, "pointer_type", "pointerType", "input_type", "inputType"), type, index);
|
|
7565
7577
|
if (type === "drag") {
|
|
7566
7578
|
if (fromX === void 0 || fromY === void 0 || toX === void 0 || toY === void 0) {
|
|
7567
7579
|
throw new Error(`target.setup_actions[${index}] drag requires from_x, from_y, to_x, and to_y.`);
|
|
@@ -7646,6 +7658,7 @@ function normalizeSetupAction(input, index) {
|
|
|
7646
7658
|
force: type === "click" && (input.force === true || input.force_click === true || input.forceClick === true),
|
|
7647
7659
|
click_count: normalizeSetupActionClickCount(input, type, index),
|
|
7648
7660
|
coordinate_mode: coordinateMode,
|
|
7661
|
+
pointer_type: pointerType,
|
|
7649
7662
|
from_x: fromX,
|
|
7650
7663
|
from_y: fromY,
|
|
7651
7664
|
to_x: toX,
|
|
@@ -11830,23 +11843,75 @@ async function executeSetupAction(action, ordinal, viewport) {
|
|
|
11830
11843
|
const requestedSteps = setupNumber(action.steps, 8);
|
|
11831
11844
|
const steps = Math.min(100, Math.max(1, Math.floor(requestedSteps || 8)));
|
|
11832
11845
|
const durationMs = setupNumber(action.duration_ms ?? action.durationMs, 0);
|
|
11833
|
-
|
|
11834
|
-
|
|
11835
|
-
|
|
11836
|
-
|
|
11837
|
-
|
|
11838
|
-
|
|
11839
|
-
|
|
11840
|
-
|
|
11841
|
-
|
|
11842
|
-
|
|
11843
|
-
|
|
11846
|
+
const pointerType = String(action.pointer_type || action.pointerType || "mouse").trim().toLowerCase();
|
|
11847
|
+
if (pointerType === "touch" || pointerType === "pen") {
|
|
11848
|
+
const localStart = {
|
|
11849
|
+
x: coordinate(fromX, box.width),
|
|
11850
|
+
y: coordinate(fromY, box.height),
|
|
11851
|
+
};
|
|
11852
|
+
const localEnd = {
|
|
11853
|
+
x: coordinate(toX, box.width),
|
|
11854
|
+
y: coordinate(toY, box.height),
|
|
11855
|
+
};
|
|
11856
|
+
await target.evaluate(async (element, payload) => {
|
|
11857
|
+
const wait = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
|
|
11858
|
+
const rect = element.getBoundingClientRect();
|
|
11859
|
+
const pointerId = payload.pointerType === "touch" ? 11 : 12;
|
|
11860
|
+
const point = (progress) => ({
|
|
11861
|
+
clientX: rect.left + payload.start.x + (payload.end.x - payload.start.x) * progress,
|
|
11862
|
+
clientY: rect.top + payload.start.y + (payload.end.y - payload.start.y) * progress,
|
|
11863
|
+
});
|
|
11864
|
+
const dispatch = (type, progress) => {
|
|
11865
|
+
const coords = point(progress);
|
|
11866
|
+
element.dispatchEvent(new PointerEvent(type, {
|
|
11867
|
+
bubbles: true,
|
|
11868
|
+
cancelable: true,
|
|
11869
|
+
composed: true,
|
|
11870
|
+
pointerId,
|
|
11871
|
+
pointerType: payload.pointerType,
|
|
11872
|
+
isPrimary: true,
|
|
11873
|
+
buttons: type === "pointerup" ? 0 : 1,
|
|
11874
|
+
button: type === "pointerup" ? 0 : 0,
|
|
11875
|
+
clientX: coords.clientX,
|
|
11876
|
+
clientY: coords.clientY,
|
|
11877
|
+
}));
|
|
11878
|
+
};
|
|
11879
|
+
dispatch("pointerover", 0);
|
|
11880
|
+
dispatch("pointerenter", 0);
|
|
11881
|
+
dispatch("pointerdown", 0);
|
|
11882
|
+
for (let step = 1; step <= payload.steps; step += 1) {
|
|
11883
|
+
dispatch("pointermove", step / payload.steps);
|
|
11884
|
+
if (payload.durationMs && payload.steps > 1) await wait(payload.durationMs / payload.steps);
|
|
11844
11885
|
}
|
|
11845
|
-
|
|
11846
|
-
|
|
11886
|
+
dispatch("pointerup", 1);
|
|
11887
|
+
dispatch("pointerout", 1);
|
|
11888
|
+
dispatch("pointerleave", 1);
|
|
11889
|
+
}, {
|
|
11890
|
+
pointerType,
|
|
11891
|
+
start: localStart,
|
|
11892
|
+
end: localEnd,
|
|
11893
|
+
steps,
|
|
11894
|
+
durationMs,
|
|
11895
|
+
});
|
|
11896
|
+
} else {
|
|
11897
|
+
await page.mouse.move(start.x, start.y);
|
|
11898
|
+
await page.mouse.down();
|
|
11899
|
+
try {
|
|
11900
|
+
if (durationMs && steps > 1) {
|
|
11901
|
+
for (let step = 1; step <= steps; step += 1) {
|
|
11902
|
+
const progress = step / steps;
|
|
11903
|
+
await page.mouse.move(
|
|
11904
|
+
start.x + (end.x - start.x) * progress,
|
|
11905
|
+
start.y + (end.y - start.y) * progress,
|
|
11906
|
+
);
|
|
11907
|
+
await page.waitForTimeout(durationMs / steps);
|
|
11908
|
+
}
|
|
11909
|
+
} else {
|
|
11910
|
+
await page.mouse.move(end.x, end.y, { steps });
|
|
11911
|
+
}
|
|
11912
|
+
} finally {
|
|
11913
|
+
await page.mouse.up().catch(() => {});
|
|
11847
11914
|
}
|
|
11848
|
-
} finally {
|
|
11849
|
-
await page.mouse.up().catch(() => {});
|
|
11850
11915
|
}
|
|
11851
11916
|
return {
|
|
11852
11917
|
...base,
|
|
@@ -11859,6 +11924,7 @@ async function executeSetupAction(action, ordinal, viewport) {
|
|
|
11859
11924
|
from_y: fromY,
|
|
11860
11925
|
to_x: toX,
|
|
11861
11926
|
to_y: toY,
|
|
11927
|
+
pointer_type: pointerType,
|
|
11862
11928
|
steps,
|
|
11863
11929
|
duration_ms: durationMs || undefined,
|
|
11864
11930
|
};
|
package/dist/cli.js
CHANGED
package/dist/index.cjs
CHANGED
|
@@ -9340,6 +9340,17 @@ function normalizeSetupActionCoordinateMode(value, index) {
|
|
|
9340
9340
|
if (normalized === "ratio" || normalized === "relative" || normalized === "fraction") return "ratio";
|
|
9341
9341
|
throw new Error(`target.setup_actions[${index}].coordinate_mode ${String(value)} is not supported. Supported coordinate modes: pixels, ratio.`);
|
|
9342
9342
|
}
|
|
9343
|
+
function normalizeSetupActionPointerType(value, type, index) {
|
|
9344
|
+
if (value === void 0 || value === null || value === "") return void 0;
|
|
9345
|
+
if (type !== "drag") {
|
|
9346
|
+
throw new Error(`target.setup_actions[${index}].pointer_type is only supported for drag actions.`);
|
|
9347
|
+
}
|
|
9348
|
+
const normalized = String(value).trim().replace(/-/g, "_").toLowerCase();
|
|
9349
|
+
if (normalized === "mouse") return "mouse";
|
|
9350
|
+
if (normalized === "touch" || normalized === "finger") return "touch";
|
|
9351
|
+
if (normalized === "pen" || normalized === "stylus") return "pen";
|
|
9352
|
+
throw new Error(`target.setup_actions[${index}].pointer_type ${String(value)} is not supported. Supported pointer types: mouse, touch, pen.`);
|
|
9353
|
+
}
|
|
9343
9354
|
function normalizeSetupAction(input, index) {
|
|
9344
9355
|
if (!isRecord2(input)) throw new Error(`target.setup_actions[${index}] must be an object.`);
|
|
9345
9356
|
const type = normalizeSetupActionType(stringValue5(input.type), index);
|
|
@@ -9358,6 +9369,7 @@ function normalizeSetupAction(input, index) {
|
|
|
9358
9369
|
const toX = numberValue3(valueFromOwn(input, "to_x", "toX", "end_x", "endX", "x2"));
|
|
9359
9370
|
const toY = numberValue3(valueFromOwn(input, "to_y", "toY", "end_y", "endY", "y2"));
|
|
9360
9371
|
const coordinateMode = normalizeSetupActionCoordinateMode(valueFromOwn(input, "coordinate_mode", "coordinateMode", "coords", "units"), index);
|
|
9372
|
+
const pointerType = normalizeSetupActionPointerType(valueFromOwn(input, "pointer_type", "pointerType", "input_type", "inputType"), type, index);
|
|
9361
9373
|
if (type === "drag") {
|
|
9362
9374
|
if (fromX === void 0 || fromY === void 0 || toX === void 0 || toY === void 0) {
|
|
9363
9375
|
throw new Error(`target.setup_actions[${index}] drag requires from_x, from_y, to_x, and to_y.`);
|
|
@@ -9442,6 +9454,7 @@ function normalizeSetupAction(input, index) {
|
|
|
9442
9454
|
force: type === "click" && (input.force === true || input.force_click === true || input.forceClick === true),
|
|
9443
9455
|
click_count: normalizeSetupActionClickCount(input, type, index),
|
|
9444
9456
|
coordinate_mode: coordinateMode,
|
|
9457
|
+
pointer_type: pointerType,
|
|
9445
9458
|
from_x: fromX,
|
|
9446
9459
|
from_y: fromY,
|
|
9447
9460
|
to_x: toX,
|
|
@@ -13642,23 +13655,75 @@ async function executeSetupAction(action, ordinal, viewport) {
|
|
|
13642
13655
|
const requestedSteps = setupNumber(action.steps, 8);
|
|
13643
13656
|
const steps = Math.min(100, Math.max(1, Math.floor(requestedSteps || 8)));
|
|
13644
13657
|
const durationMs = setupNumber(action.duration_ms ?? action.durationMs, 0);
|
|
13645
|
-
|
|
13646
|
-
|
|
13647
|
-
|
|
13648
|
-
|
|
13649
|
-
|
|
13650
|
-
|
|
13651
|
-
|
|
13652
|
-
|
|
13653
|
-
|
|
13654
|
-
|
|
13655
|
-
|
|
13658
|
+
const pointerType = String(action.pointer_type || action.pointerType || "mouse").trim().toLowerCase();
|
|
13659
|
+
if (pointerType === "touch" || pointerType === "pen") {
|
|
13660
|
+
const localStart = {
|
|
13661
|
+
x: coordinate(fromX, box.width),
|
|
13662
|
+
y: coordinate(fromY, box.height),
|
|
13663
|
+
};
|
|
13664
|
+
const localEnd = {
|
|
13665
|
+
x: coordinate(toX, box.width),
|
|
13666
|
+
y: coordinate(toY, box.height),
|
|
13667
|
+
};
|
|
13668
|
+
await target.evaluate(async (element, payload) => {
|
|
13669
|
+
const wait = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
|
|
13670
|
+
const rect = element.getBoundingClientRect();
|
|
13671
|
+
const pointerId = payload.pointerType === "touch" ? 11 : 12;
|
|
13672
|
+
const point = (progress) => ({
|
|
13673
|
+
clientX: rect.left + payload.start.x + (payload.end.x - payload.start.x) * progress,
|
|
13674
|
+
clientY: rect.top + payload.start.y + (payload.end.y - payload.start.y) * progress,
|
|
13675
|
+
});
|
|
13676
|
+
const dispatch = (type, progress) => {
|
|
13677
|
+
const coords = point(progress);
|
|
13678
|
+
element.dispatchEvent(new PointerEvent(type, {
|
|
13679
|
+
bubbles: true,
|
|
13680
|
+
cancelable: true,
|
|
13681
|
+
composed: true,
|
|
13682
|
+
pointerId,
|
|
13683
|
+
pointerType: payload.pointerType,
|
|
13684
|
+
isPrimary: true,
|
|
13685
|
+
buttons: type === "pointerup" ? 0 : 1,
|
|
13686
|
+
button: type === "pointerup" ? 0 : 0,
|
|
13687
|
+
clientX: coords.clientX,
|
|
13688
|
+
clientY: coords.clientY,
|
|
13689
|
+
}));
|
|
13690
|
+
};
|
|
13691
|
+
dispatch("pointerover", 0);
|
|
13692
|
+
dispatch("pointerenter", 0);
|
|
13693
|
+
dispatch("pointerdown", 0);
|
|
13694
|
+
for (let step = 1; step <= payload.steps; step += 1) {
|
|
13695
|
+
dispatch("pointermove", step / payload.steps);
|
|
13696
|
+
if (payload.durationMs && payload.steps > 1) await wait(payload.durationMs / payload.steps);
|
|
13656
13697
|
}
|
|
13657
|
-
|
|
13658
|
-
|
|
13698
|
+
dispatch("pointerup", 1);
|
|
13699
|
+
dispatch("pointerout", 1);
|
|
13700
|
+
dispatch("pointerleave", 1);
|
|
13701
|
+
}, {
|
|
13702
|
+
pointerType,
|
|
13703
|
+
start: localStart,
|
|
13704
|
+
end: localEnd,
|
|
13705
|
+
steps,
|
|
13706
|
+
durationMs,
|
|
13707
|
+
});
|
|
13708
|
+
} else {
|
|
13709
|
+
await page.mouse.move(start.x, start.y);
|
|
13710
|
+
await page.mouse.down();
|
|
13711
|
+
try {
|
|
13712
|
+
if (durationMs && steps > 1) {
|
|
13713
|
+
for (let step = 1; step <= steps; step += 1) {
|
|
13714
|
+
const progress = step / steps;
|
|
13715
|
+
await page.mouse.move(
|
|
13716
|
+
start.x + (end.x - start.x) * progress,
|
|
13717
|
+
start.y + (end.y - start.y) * progress,
|
|
13718
|
+
);
|
|
13719
|
+
await page.waitForTimeout(durationMs / steps);
|
|
13720
|
+
}
|
|
13721
|
+
} else {
|
|
13722
|
+
await page.mouse.move(end.x, end.y, { steps });
|
|
13723
|
+
}
|
|
13724
|
+
} finally {
|
|
13725
|
+
await page.mouse.up().catch(() => {});
|
|
13659
13726
|
}
|
|
13660
|
-
} finally {
|
|
13661
|
-
await page.mouse.up().catch(() => {});
|
|
13662
13727
|
}
|
|
13663
13728
|
return {
|
|
13664
13729
|
...base,
|
|
@@ -13671,6 +13736,7 @@ async function executeSetupAction(action, ordinal, viewport) {
|
|
|
13671
13736
|
from_y: fromY,
|
|
13672
13737
|
to_x: toX,
|
|
13673
13738
|
to_y: toY,
|
|
13739
|
+
pointer_type: pointerType,
|
|
13674
13740
|
steps,
|
|
13675
13741
|
duration_ms: durationMs || undefined,
|
|
13676
13742
|
};
|
package/dist/index.js
CHANGED
|
@@ -62,7 +62,7 @@ import {
|
|
|
62
62
|
resolveRiddleProofProfileTimeoutSec,
|
|
63
63
|
slugifyRiddleProofProfileName,
|
|
64
64
|
summarizeRiddleProofProfileResult
|
|
65
|
-
} from "./chunk-
|
|
65
|
+
} from "./chunk-ZJNM3YAB.js";
|
|
66
66
|
import {
|
|
67
67
|
DEFAULT_RIDDLE_API_BASE_URL,
|
|
68
68
|
DEFAULT_RIDDLE_API_KEY_FILE,
|
package/dist/profile.cjs
CHANGED
|
@@ -654,6 +654,17 @@ function normalizeSetupActionCoordinateMode(value, index) {
|
|
|
654
654
|
if (normalized === "ratio" || normalized === "relative" || normalized === "fraction") return "ratio";
|
|
655
655
|
throw new Error(`target.setup_actions[${index}].coordinate_mode ${String(value)} is not supported. Supported coordinate modes: pixels, ratio.`);
|
|
656
656
|
}
|
|
657
|
+
function normalizeSetupActionPointerType(value, type, index) {
|
|
658
|
+
if (value === void 0 || value === null || value === "") return void 0;
|
|
659
|
+
if (type !== "drag") {
|
|
660
|
+
throw new Error(`target.setup_actions[${index}].pointer_type is only supported for drag actions.`);
|
|
661
|
+
}
|
|
662
|
+
const normalized = String(value).trim().replace(/-/g, "_").toLowerCase();
|
|
663
|
+
if (normalized === "mouse") return "mouse";
|
|
664
|
+
if (normalized === "touch" || normalized === "finger") return "touch";
|
|
665
|
+
if (normalized === "pen" || normalized === "stylus") return "pen";
|
|
666
|
+
throw new Error(`target.setup_actions[${index}].pointer_type ${String(value)} is not supported. Supported pointer types: mouse, touch, pen.`);
|
|
667
|
+
}
|
|
657
668
|
function normalizeSetupAction(input, index) {
|
|
658
669
|
if (!isRecord(input)) throw new Error(`target.setup_actions[${index}] must be an object.`);
|
|
659
670
|
const type = normalizeSetupActionType(stringValue(input.type), index);
|
|
@@ -672,6 +683,7 @@ function normalizeSetupAction(input, index) {
|
|
|
672
683
|
const toX = numberValue(valueFromOwn(input, "to_x", "toX", "end_x", "endX", "x2"));
|
|
673
684
|
const toY = numberValue(valueFromOwn(input, "to_y", "toY", "end_y", "endY", "y2"));
|
|
674
685
|
const coordinateMode = normalizeSetupActionCoordinateMode(valueFromOwn(input, "coordinate_mode", "coordinateMode", "coords", "units"), index);
|
|
686
|
+
const pointerType = normalizeSetupActionPointerType(valueFromOwn(input, "pointer_type", "pointerType", "input_type", "inputType"), type, index);
|
|
675
687
|
if (type === "drag") {
|
|
676
688
|
if (fromX === void 0 || fromY === void 0 || toX === void 0 || toY === void 0) {
|
|
677
689
|
throw new Error(`target.setup_actions[${index}] drag requires from_x, from_y, to_x, and to_y.`);
|
|
@@ -756,6 +768,7 @@ function normalizeSetupAction(input, index) {
|
|
|
756
768
|
force: type === "click" && (input.force === true || input.force_click === true || input.forceClick === true),
|
|
757
769
|
click_count: normalizeSetupActionClickCount(input, type, index),
|
|
758
770
|
coordinate_mode: coordinateMode,
|
|
771
|
+
pointer_type: pointerType,
|
|
759
772
|
from_x: fromX,
|
|
760
773
|
from_y: fromY,
|
|
761
774
|
to_x: toX,
|
|
@@ -4956,23 +4969,75 @@ async function executeSetupAction(action, ordinal, viewport) {
|
|
|
4956
4969
|
const requestedSteps = setupNumber(action.steps, 8);
|
|
4957
4970
|
const steps = Math.min(100, Math.max(1, Math.floor(requestedSteps || 8)));
|
|
4958
4971
|
const durationMs = setupNumber(action.duration_ms ?? action.durationMs, 0);
|
|
4959
|
-
|
|
4960
|
-
|
|
4961
|
-
|
|
4962
|
-
|
|
4963
|
-
|
|
4964
|
-
|
|
4965
|
-
|
|
4966
|
-
|
|
4967
|
-
|
|
4968
|
-
|
|
4969
|
-
|
|
4972
|
+
const pointerType = String(action.pointer_type || action.pointerType || "mouse").trim().toLowerCase();
|
|
4973
|
+
if (pointerType === "touch" || pointerType === "pen") {
|
|
4974
|
+
const localStart = {
|
|
4975
|
+
x: coordinate(fromX, box.width),
|
|
4976
|
+
y: coordinate(fromY, box.height),
|
|
4977
|
+
};
|
|
4978
|
+
const localEnd = {
|
|
4979
|
+
x: coordinate(toX, box.width),
|
|
4980
|
+
y: coordinate(toY, box.height),
|
|
4981
|
+
};
|
|
4982
|
+
await target.evaluate(async (element, payload) => {
|
|
4983
|
+
const wait = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
|
|
4984
|
+
const rect = element.getBoundingClientRect();
|
|
4985
|
+
const pointerId = payload.pointerType === "touch" ? 11 : 12;
|
|
4986
|
+
const point = (progress) => ({
|
|
4987
|
+
clientX: rect.left + payload.start.x + (payload.end.x - payload.start.x) * progress,
|
|
4988
|
+
clientY: rect.top + payload.start.y + (payload.end.y - payload.start.y) * progress,
|
|
4989
|
+
});
|
|
4990
|
+
const dispatch = (type, progress) => {
|
|
4991
|
+
const coords = point(progress);
|
|
4992
|
+
element.dispatchEvent(new PointerEvent(type, {
|
|
4993
|
+
bubbles: true,
|
|
4994
|
+
cancelable: true,
|
|
4995
|
+
composed: true,
|
|
4996
|
+
pointerId,
|
|
4997
|
+
pointerType: payload.pointerType,
|
|
4998
|
+
isPrimary: true,
|
|
4999
|
+
buttons: type === "pointerup" ? 0 : 1,
|
|
5000
|
+
button: type === "pointerup" ? 0 : 0,
|
|
5001
|
+
clientX: coords.clientX,
|
|
5002
|
+
clientY: coords.clientY,
|
|
5003
|
+
}));
|
|
5004
|
+
};
|
|
5005
|
+
dispatch("pointerover", 0);
|
|
5006
|
+
dispatch("pointerenter", 0);
|
|
5007
|
+
dispatch("pointerdown", 0);
|
|
5008
|
+
for (let step = 1; step <= payload.steps; step += 1) {
|
|
5009
|
+
dispatch("pointermove", step / payload.steps);
|
|
5010
|
+
if (payload.durationMs && payload.steps > 1) await wait(payload.durationMs / payload.steps);
|
|
4970
5011
|
}
|
|
4971
|
-
|
|
4972
|
-
|
|
5012
|
+
dispatch("pointerup", 1);
|
|
5013
|
+
dispatch("pointerout", 1);
|
|
5014
|
+
dispatch("pointerleave", 1);
|
|
5015
|
+
}, {
|
|
5016
|
+
pointerType,
|
|
5017
|
+
start: localStart,
|
|
5018
|
+
end: localEnd,
|
|
5019
|
+
steps,
|
|
5020
|
+
durationMs,
|
|
5021
|
+
});
|
|
5022
|
+
} else {
|
|
5023
|
+
await page.mouse.move(start.x, start.y);
|
|
5024
|
+
await page.mouse.down();
|
|
5025
|
+
try {
|
|
5026
|
+
if (durationMs && steps > 1) {
|
|
5027
|
+
for (let step = 1; step <= steps; step += 1) {
|
|
5028
|
+
const progress = step / steps;
|
|
5029
|
+
await page.mouse.move(
|
|
5030
|
+
start.x + (end.x - start.x) * progress,
|
|
5031
|
+
start.y + (end.y - start.y) * progress,
|
|
5032
|
+
);
|
|
5033
|
+
await page.waitForTimeout(durationMs / steps);
|
|
5034
|
+
}
|
|
5035
|
+
} else {
|
|
5036
|
+
await page.mouse.move(end.x, end.y, { steps });
|
|
5037
|
+
}
|
|
5038
|
+
} finally {
|
|
5039
|
+
await page.mouse.up().catch(() => {});
|
|
4973
5040
|
}
|
|
4974
|
-
} finally {
|
|
4975
|
-
await page.mouse.up().catch(() => {});
|
|
4976
5041
|
}
|
|
4977
5042
|
return {
|
|
4978
5043
|
...base,
|
|
@@ -4985,6 +5050,7 @@ async function executeSetupAction(action, ordinal, viewport) {
|
|
|
4985
5050
|
from_y: fromY,
|
|
4986
5051
|
to_x: toX,
|
|
4987
5052
|
to_y: toY,
|
|
5053
|
+
pointer_type: pointerType,
|
|
4988
5054
|
steps,
|
|
4989
5055
|
duration_ms: durationMs || undefined,
|
|
4990
5056
|
};
|
package/dist/profile.d.cts
CHANGED
package/dist/profile.d.ts
CHANGED
package/dist/profile.js
CHANGED
|
@@ -23,7 +23,7 @@ import {
|
|
|
23
23
|
resolveRiddleProofProfileTimeoutSec,
|
|
24
24
|
slugifyRiddleProofProfileName,
|
|
25
25
|
summarizeRiddleProofProfileResult
|
|
26
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-ZJNM3YAB.js";
|
|
27
27
|
export {
|
|
28
28
|
RIDDLE_PROOF_PROFILE_CHECK_TYPES,
|
|
29
29
|
RIDDLE_PROOF_PROFILE_EVIDENCE_VERSION,
|
|
@@ -292,7 +292,7 @@ declare function executeWorkflow(params: WorkflowParams, pluginConfig: any, reso
|
|
|
292
292
|
blocking?: boolean;
|
|
293
293
|
details?: Record<string, unknown>;
|
|
294
294
|
ok: boolean;
|
|
295
|
-
action: "
|
|
295
|
+
action: "setup" | "recon" | "author" | "implement" | "verify" | "ship" | "run";
|
|
296
296
|
state_path: string;
|
|
297
297
|
stage: any;
|
|
298
298
|
summary: string;
|
|
@@ -382,7 +382,7 @@ declare function executeWorkflow(params: WorkflowParams, pluginConfig: any, reso
|
|
|
382
382
|
continueWithStage?: WorkflowStage | null;
|
|
383
383
|
blocking?: boolean;
|
|
384
384
|
details?: Record<string, unknown>;
|
|
385
|
-
action: "
|
|
385
|
+
action: "setup" | "recon" | "author" | "implement" | "verify" | "ship" | "run";
|
|
386
386
|
state_path: string;
|
|
387
387
|
stage: any;
|
|
388
388
|
checkpoint: string;
|
|
@@ -659,7 +659,7 @@ declare function executeWorkflow(params: WorkflowParams, pluginConfig: any, reso
|
|
|
659
659
|
error?: undefined;
|
|
660
660
|
} | {
|
|
661
661
|
ok: boolean;
|
|
662
|
-
action: "
|
|
662
|
+
action: "setup" | "recon" | "author" | "implement" | "verify" | "ship" | "run";
|
|
663
663
|
state_path: string;
|
|
664
664
|
stage: any;
|
|
665
665
|
summary: string;
|
|
@@ -292,7 +292,7 @@ declare function executeWorkflow(params: WorkflowParams, pluginConfig: any, reso
|
|
|
292
292
|
blocking?: boolean;
|
|
293
293
|
details?: Record<string, unknown>;
|
|
294
294
|
ok: boolean;
|
|
295
|
-
action: "
|
|
295
|
+
action: "setup" | "recon" | "author" | "implement" | "verify" | "ship" | "run";
|
|
296
296
|
state_path: string;
|
|
297
297
|
stage: any;
|
|
298
298
|
summary: string;
|
|
@@ -382,7 +382,7 @@ declare function executeWorkflow(params: WorkflowParams, pluginConfig: any, reso
|
|
|
382
382
|
continueWithStage?: WorkflowStage | null;
|
|
383
383
|
blocking?: boolean;
|
|
384
384
|
details?: Record<string, unknown>;
|
|
385
|
-
action: "
|
|
385
|
+
action: "setup" | "recon" | "author" | "implement" | "verify" | "ship" | "run";
|
|
386
386
|
state_path: string;
|
|
387
387
|
stage: any;
|
|
388
388
|
checkpoint: string;
|
|
@@ -659,7 +659,7 @@ declare function executeWorkflow(params: WorkflowParams, pluginConfig: any, reso
|
|
|
659
659
|
error?: undefined;
|
|
660
660
|
} | {
|
|
661
661
|
ok: boolean;
|
|
662
|
-
action: "
|
|
662
|
+
action: "setup" | "recon" | "author" | "implement" | "verify" | "ship" | "run";
|
|
663
663
|
state_path: string;
|
|
664
664
|
stage: any;
|
|
665
665
|
summary: string;
|