@immense/vue-pom-generator 1.0.120 → 1.0.121

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/README.md CHANGED
@@ -1079,6 +1079,26 @@ const brandCallout: CalloutRenderer = {
1079
1079
  setDefaultCalloutRenderer(brandCallout);
1080
1080
  ```
1081
1081
 
1082
+ To act around what page objects do, such as moving a video camera with the pointer, register action hooks. Every page object, generated or handwritten, calls them around each pointer move, click and text input, and waits for each one before it continues. They are read as each action runs, so a fixture can set them for one test and pass `undefined` to `setActionHooks` afterwards. Move hooks run only while animations are enabled, since nothing moves otherwise; a pointer's first move, with no position yet, places it on its target (`from` equals `to`).
1083
+
1084
+ ```ts
1085
+ import { setActionHooks } from "@immense/vue-pom-generator/playwright/runtime";
1086
+
1087
+ setActionHooks({
1088
+ // Zoom out before the pointer travels, then in on the target once it stops.
1089
+ async beforeMove({ from, to }) { await camera.show(spanning(from, to)); },
1090
+ async afterMove({ box }) { await camera.show(box); },
1091
+ async afterClick() { await camera.hold(); },
1092
+ async beforeInput({ box }) { if (box) await camera.show(box); },
1093
+ });
1094
+ ```
1095
+
1096
+ | Hook | Runs | Gets |
1097
+ | --- | --- | --- |
1098
+ | `beforeMove`, `afterMove` | before the pointer starts moving, after it stops | `page`, `target`, `box`, `from`, `to`, `durationMilliseconds` |
1099
+ | `beforeClick`, `afterClick` | before the click, after it (and after the click instrumentation wait) | `page`, `target`, `box` |
1100
+ | `beforeInput`, `afterInput` | before the text is typed or filled, after it | `page`, `target`, `box`, `text` |
1101
+
1082
1102
  The example below uses the optional floating-ui renderer so the callout can auto-place around nearby UI and point back to the target with an arrow.
1083
1103
 
1084
1104
  Example floating-ui callout sequence captured from the Playwright fixture coverage:
package/RELEASE_NOTES.md CHANGED
@@ -1,41 +1,38 @@
1
- Range confirmed: exactly one commit (#87). Let me check the README additions for accurate option
2
- details.
3
-
4
1
  Highlights
5
2
 
6
- - New opt-in component usage graph: set generation.playwright.componentGraph: true to emit
7
- component-graph.json next to pom-manifest.g.ts
8
- - The manifest describes what each component contains; the graph adds the usage edges so tools can
9
- determine which routes reach a component
10
- - components are keyed by project-relative source file with the generated name and the project
11
- components each template uses; routes list path pattern, name, and rendered source files (parent
12
- route components first, named views included; Nuxt pages list their page file)
13
- - Keys and lists are sorted, so the file diffs cleanly; output is byte-identical when the option is
14
- off
15
- - Generation fails fast if the option is enabled without fixtures, or if an unnamed route's pattern
16
- can't be resolved into the route tree
3
+ - Added process-wide action hooks to the generated POM pointer layer: callbacks can now wrap every
4
+ move, click, and input action, enabling cross-cutting behavior (e.g., logging or instrumentation)
5
+ without touching individual POMs (]8;id=md-1exmtnu;https://github.com/immense/vue-pom-generator/pull/88#88]8;;]8;;).]8;;
6
+ - Hooks are registered through BasePage, so all generated page objects pick them up automatically.
7
+ - New coverage in tests/pointer.test.ts exercises the hook lifecycle around each action type.
17
8
 
18
9
  Changes
19
10
 
20
- - Manifest
21
- - Emit component-graph.json (schema version: 1) when generation.playwright.componentGraph is on
22
- with fixtures enabled, in both dev and build generation paths
23
- - Export the ComponentGraph type from the package
24
- - Shared internals
25
- - Move the tag resolver used by class generation into manifest-generator.ts so both share it;
26
- graph tags resolve with the same toPascalCase normalization as POM generation
27
- - Nuxt route entries list componentFiles only when collectComponentFiles is on, matching the
28
- vue-router branch
29
- - Docs
30
- - README: document the new option and component-graph.json schema with examples for tracing routes
31
- that reach a component
11
+ Pointer / POM runtime
12
+
13
+ - Process-wide action hooks around moves, clicks, and input in the pointer class generation
14
+ (class-generation/pointer.ts).
15
+ - Hook registration wired into BasePage (class-generation/base-page.ts).
16
+
17
+ Documentation
18
+
19
+ - Documented the action-hooks API in README.md.
20
+
21
+ Tooling
22
+
23
+ - Updated the packed build smoke-check script (scripts/packed-smoke-check.mjs).
24
+
25
+ Tests
26
+
27
+ - Expanded tests/pointer.test.ts with tests for the new hooks.
32
28
 
33
29
  Pull Requests Included
34
30
 
35
- - ]8;id=md-1bbrzn7;https://github.com/immense/vue-pom-generator/pull/87#87 — feat(manifest): emit a component usage graph as JSON]8;;]8;; (@dkattan)]8;;
31
+ - ]8;id=md-1exmtnu;https://github.com/immense/vue-pom-generator/pull/88#88 feat(pointer): add process-wide action hooks around moves, clicks and input]8;;]8;; ]8;;
32
+ (@darrenator[bot])
36
33
 
37
34
  Testing
38
35
 
39
- - Added coverage in tests/generate-vue-poms.test.ts and tests/router-introspection.test.ts for
40
- graph emission, tag resolution, and route-tree handling.
36
+ - Adds ~128 lines of new tests for the pointer action hooks in tests/pointer.test.ts; the packed
37
+ smoke check was updated accordingly. No additional test-run results were provided with this release.
41
38
 
@@ -10,6 +10,8 @@ import { Pointer, type AfterPointerClick, type AfterPointerClickInfo, type Point
10
10
  // Part of the public `playwright/runtime` entry, whose source is this file.
11
11
  export { setDefaultCalloutRenderer } from "./callout";
12
12
  export type { CalloutRenderer, CalloutRenderRequest } from "./callout";
13
+ export { setActionHooks } from "./pointer";
14
+ export type { ActionBox, ActionHookContext, ActionHooks, InputHookContext, PointerMoveHookContext } from "./pointer";
13
15
 
14
16
  const POM_ACTIVE_ACTION_REGISTRY = Symbol.for("@immense/vue-pom-generator.active-action-registry");
15
17
  const CHECKABLE_CONTROL_SELECTOR = 'input[type="checkbox"], input[type="radio"]';
@@ -20,8 +20,9 @@ const __PW_POINTER_PNG__ =
20
20
 
21
21
  const __pw_pointer_positions__ = new WeakMap<object, { x: number; y: number }>();
22
22
 
23
- function __pw_get_pointer_pos__(page: PwPage): { x: number; y: number } {
24
- return __pw_pointer_positions__.get(page as object) ?? { x: 0, y: 0 };
23
+ /** Where the page's pointer is; undefined until its first move, so that move places it instead of gliding in. */
24
+ function __pw_get_pointer_pos__(page: PwPage): { x: number; y: number } | undefined {
25
+ return __pw_pointer_positions__.get(page as object);
25
26
  }
26
27
 
27
28
  function __pw_set_pointer_pos__(page: PwPage, x: number, y: number): void {
@@ -133,6 +134,75 @@ export interface AfterPointerClickInfo {
133
134
 
134
135
  export type AfterPointerClick = (info: AfterPointerClickInfo) => void | Promise<void>;
135
136
 
137
+ // ---------------------------------------------------------------------------
138
+ // Action hooks
139
+ // ---------------------------------------------------------------------------
140
+
141
+ /** A box in viewport pixels. */
142
+ export interface ActionBox {
143
+ x: number;
144
+ y: number;
145
+ width: number;
146
+ height: number;
147
+ }
148
+
149
+ /** The element an action is on, and its box once scrolled into view (null when it has none). */
150
+ export interface ActionHookContext {
151
+ page: PwPage;
152
+ target: PwLocator;
153
+ box: ActionBox | null;
154
+ }
155
+
156
+ /**
157
+ * A pointer move to the center of `box`. `from` is where the pointer was; on its first move it has no position yet,
158
+ * so `from` equals `to` and the pointer is placed there instead of gliding.
159
+ */
160
+ export interface PointerMoveHookContext extends ActionHookContext {
161
+ box: ActionBox;
162
+ from: { x: number; y: number };
163
+ to: { x: number; y: number };
164
+ /** How long the glide takes; 0 when the pointer is placed without one. */
165
+ durationMilliseconds: number;
166
+ }
167
+
168
+ /** Text typed or filled into `target`. */
169
+ export interface InputHookContext extends ActionHookContext {
170
+ text: string;
171
+ }
172
+
173
+ /**
174
+ * Called around each pointer move, click and text input a page object performs, and awaited: the action continues once
175
+ * the hook resolves. For example, a video camera can pan to where the pointer is going before it moves and zoom in on
176
+ * the target after it arrives. Move hooks run only while animations are enabled, since nothing moves otherwise.
177
+ */
178
+ export interface ActionHooks {
179
+ beforeMove?: (context: PointerMoveHookContext) => void | Promise<void>;
180
+ afterMove?: (context: PointerMoveHookContext) => void | Promise<void>;
181
+ beforeClick?: (context: ActionHookContext) => void | Promise<void>;
182
+ afterClick?: (context: ActionHookContext) => void | Promise<void>;
183
+ beforeInput?: (context: InputHookContext) => void | Promise<void>;
184
+ afterInput?: (context: InputHookContext) => void | Promise<void>;
185
+ }
186
+
187
+ // Kept on globalThis so the package's runtime entry and the runtime copied next to the
188
+ // generated POMs share one set, whichever copy the setter is imported from.
189
+ const ACTION_HOOKS = Symbol.for("@immense/vue-pom-generator.action-hooks");
190
+
191
+ type ActionHooksGlobal = typeof globalThis & { [ACTION_HOOKS]?: ActionHooks };
192
+
193
+ /**
194
+ * Sets the process-wide action hooks every page object, generated or handwritten, calls around its pointer moves,
195
+ * clicks and text input. They are read as each action runs, so they can change between tests. Pass `undefined` to
196
+ * remove them.
197
+ */
198
+ export function setActionHooks(hooks: ActionHooks | undefined): void {
199
+ (globalThis as ActionHooksGlobal)[ACTION_HOOKS] = hooks;
200
+ }
201
+
202
+ function actionHooks(): ActionHooks | undefined {
203
+ return (globalThis as ActionHooksGlobal)[ACTION_HOOKS];
204
+ }
205
+
136
206
  const __pw_default_pointer_renderer__: PointerRenderer = {
137
207
  overlayIds: [__PW_POINTER_ID__],
138
208
  async ensure(page) {
@@ -142,7 +212,8 @@ const __pw_default_pointer_renderer__: PointerRenderer = {
142
212
  );
143
213
  if (exists) return;
144
214
 
145
- __pw_set_pointer_pos__(page, 0, 0);
215
+ // A new pointer, such as after a page load, has no position until its first move places it.
216
+ __pw_pointer_positions__.delete(page as object);
146
217
 
147
218
  await page.evaluate(
148
219
  ({ id, src }: { id: string; src: string }) => {
@@ -352,6 +423,7 @@ export class Pointer {
352
423
 
353
424
  const opts = animationOptions;
354
425
  const animEnabled = opts.enabled !== false;
426
+ const hooks = actionHooks();
355
427
  if (executeClick) {
356
428
  await this.waitForFiniteAncestorAnimations(locator);
357
429
  }
@@ -368,15 +440,18 @@ export class Pointer {
368
440
  if (extraDelay > 0) await this.page.waitForTimeout(extraDelay);
369
441
 
370
442
  let clickedTestId: string | undefined;
443
+ const click = hooks && executeClick ? await this.hookContext(locator) : undefined;
371
444
  if (executeClick) {
372
445
  if (options?.afterClick) {
373
446
  try { clickedTestId = await this.getTestId(locator); } catch { /* noop */ }
374
447
  }
448
+ if (click) await hooks?.beforeClick?.(click);
375
449
  await locator.first().click();
376
450
  }
377
451
  if (options?.afterClick) {
378
452
  await options.afterClick({ testId: clickedTestId, instrumented: Boolean(clickedTestId) });
379
453
  }
454
+ if (click) await hooks?.afterClick?.(click);
380
455
  return;
381
456
  }
382
457
 
@@ -399,13 +474,23 @@ export class Pointer {
399
474
 
400
475
  // Move the pointer to the target element.
401
476
  const box = await locator.first().boundingBox();
477
+ let move: PointerMoveHookContext | undefined;
402
478
  if (box) {
403
479
  const endX = box.x + box.width / 2;
404
480
  const endY = box.y + box.height / 2;
405
- const { x: startX, y: startY } = __pw_get_pointer_pos__(this.page);
481
+ const { x: startX, y: startY } = __pw_get_pointer_pos__(this.page) ?? { x: endX, y: endY };
406
482
  const distance = Math.sqrt((endX - startX) ** 2 + (endY - startY) ** 2);
407
483
 
408
484
  const shouldAnimate = moveDurationMs > 0 && distance > 0;
485
+ move = {
486
+ page: this.page,
487
+ target: locator,
488
+ box,
489
+ from: { x: startX, y: startY },
490
+ to: { x: endX, y: endY },
491
+ durationMilliseconds: shouldAnimate ? moveDurationMs : 0,
492
+ };
493
+ await hooks?.beforeMove?.(move);
409
494
  await this.renderer.move(this.page, {
410
495
  animate: shouldAnimate,
411
496
  durationMilliseconds: moveDurationMs,
@@ -432,6 +517,7 @@ export class Pointer {
432
517
  }
433
518
 
434
519
  __pw_set_pointer_pos__(this.page, endX, endY);
520
+ await hooks?.afterMove?.(move);
435
521
  }
436
522
  else {
437
523
  await this.callout.hide();
@@ -442,7 +528,9 @@ export class Pointer {
442
528
  if (totalDelay > 0) await this.page.waitForTimeout(totalDelay);
443
529
 
444
530
  let clickedTestId: string | undefined;
531
+ const click = hooks && executeClick ? { page: this.page, target: locator, box } : undefined;
445
532
  if (executeClick) {
533
+ if (click) await hooks?.beforeClick?.(click);
446
534
  // Brief scale-down "press" animation on the pointer image.
447
535
  if (moveDurationMs > 0) {
448
536
  const pressDur = Math.max(80, Math.round(moveDurationMs / 3));
@@ -458,6 +546,11 @@ export class Pointer {
458
546
  if (options?.afterClick) {
459
547
  await options.afterClick({ testId: clickedTestId, instrumented: Boolean(clickedTestId) });
460
548
  }
549
+ if (click) await hooks?.afterClick?.(click);
550
+ }
551
+
552
+ private async hookContext(locator: PwLocator): Promise<ActionHookContext> {
553
+ return { page: this.page, target: locator, box: await locator.first().boundingBox() };
461
554
  }
462
555
 
463
556
  public async animateCursorToElementAndClickAndFill(
@@ -476,6 +569,9 @@ export class Pointer {
476
569
  const locator = this.toLocator(target);
477
570
  const editableLocator = await this.resolveEditableLocator(locator);
478
571
  const typeDelayMs = animationOptions.keyboard?.typeDelayMilliseconds ?? 100;
572
+ const hooks = actionHooks();
573
+ const input = hooks ? { ...(await this.hookContext(editableLocator)), text } : undefined;
574
+ if (input) await hooks?.beforeInput?.(input);
479
575
 
480
576
  if (animationOptions.enabled !== false && typeDelayMs > 0) {
481
577
  // Clear existing content, then type character-by-character so keystrokes are visible.
@@ -485,5 +581,6 @@ export class Pointer {
485
581
  else {
486
582
  await editableLocator.fill(text);
487
583
  }
584
+ if (input) await hooks?.afterInput?.(input);
488
585
  }
489
586
  }
@@ -4,6 +4,8 @@ import type { CalloutRenderer } from "./callout";
4
4
  import { type AfterPointerClick, type PointerRenderer } from "./pointer";
5
5
  export { setDefaultCalloutRenderer } from "./callout";
6
6
  export type { CalloutRenderer, CalloutRenderRequest } from "./callout";
7
+ export { setActionHooks } from "./pointer";
8
+ export type { ActionBox, ActionHookContext, ActionHooks, InputHookContext, PointerMoveHookContext } from "./pointer";
7
9
  /**
8
10
  * A chainable, thenable wrapper around a page object.
9
11
  *
@@ -1 +1 @@
1
- {"version":3,"file":"base-page.d.ts","sourceRoot":"","sources":["../../class-generation/base-page.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAChD,OAAO,KAAK,EAAE,yBAAyB,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAKvF,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AACjD,OAAO,EAAW,KAAK,iBAAiB,EAA8B,KAAK,eAAe,EAAE,MAAM,WAAW,CAAC;AAG9G,OAAO,EAAE,yBAAyB,EAAE,MAAM,W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AK/F;;;;OAIG;cACa,YAAY,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAIzE;;;;OAIG;cACa,iBAAiB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAInE;;;;OAIG;cACa,eAAe,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;IAIvE;;;;;;OAMG;cACa,aAAa,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE;QAAE,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAI5F;;;OAGG;cACa,aAAa,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAM5D;;;;OAIG;cACa,cAAc,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAG7E"}
@@ -1,5 +1,5 @@
1
1
  import { Callout, type ElementTarget } from "./callout";
2
- import type { PwPage } from "./playwright-types";
2
+ import type { PwLocator, PwPage } from "./playwright-types";
3
3
  export interface PointerMoveRequest {
4
4
  animate: boolean;
5
5
  durationMilliseconds: number;
@@ -68,6 +68,59 @@ export interface AfterPointerClickInfo {
68
68
  instrumented: boolean;
69
69
  }
70
70
  export type AfterPointerClick = (info: AfterPointerClickInfo) => void | Promise<void>;
71
+ /** A box in viewport pixels. */
72
+ export interface ActionBox {
73
+ x: number;
74
+ y: number;
75
+ width: number;
76
+ height: number;
77
+ }
78
+ /** The element an action is on, and its box once scrolled into view (null when it has none). */
79
+ export interface ActionHookContext {
80
+ page: PwPage;
81
+ target: PwLocator;
82
+ box: ActionBox | null;
83
+ }
84
+ /**
85
+ * A pointer move to the center of `box`. `from` is where the pointer was; on its first move it has no position yet,
86
+ * so `from` equals `to` and the pointer is placed there instead of gliding.
87
+ */
88
+ export interface PointerMoveHookContext extends ActionHookContext {
89
+ box: ActionBox;
90
+ from: {
91
+ x: number;
92
+ y: number;
93
+ };
94
+ to: {
95
+ x: number;
96
+ y: number;
97
+ };
98
+ /** How long the glide takes; 0 when the pointer is placed without one. */
99
+ durationMilliseconds: number;
100
+ }
101
+ /** Text typed or filled into `target`. */
102
+ export interface InputHookContext extends ActionHookContext {
103
+ text: string;
104
+ }
105
+ /**
106
+ * Called around each pointer move, click and text input a page object performs, and awaited: the action continues once
107
+ * the hook resolves. For example, a video camera can pan to where the pointer is going before it moves and zoom in on
108
+ * the target after it arrives. Move hooks run only while animations are enabled, since nothing moves otherwise.
109
+ */
110
+ export interface ActionHooks {
111
+ beforeMove?: (context: PointerMoveHookContext) => void | Promise<void>;
112
+ afterMove?: (context: PointerMoveHookContext) => void | Promise<void>;
113
+ beforeClick?: (context: ActionHookContext) => void | Promise<void>;
114
+ afterClick?: (context: ActionHookContext) => void | Promise<void>;
115
+ beforeInput?: (context: InputHookContext) => void | Promise<void>;
116
+ afterInput?: (context: InputHookContext) => void | Promise<void>;
117
+ }
118
+ /**
119
+ * Sets the process-wide action hooks every page object, generated or handwritten, calls around its pointer moves,
120
+ * clicks and text input. They are read as each action runs, so they can change between tests. Pass `undefined` to
121
+ * remove them.
122
+ */
123
+ export declare function setActionHooks(hooks: ActionHooks | undefined): void;
71
124
  export declare class Pointer {
72
125
  private readonly page;
73
126
  private readonly testIdAttribute;
@@ -90,6 +143,7 @@ export declare class Pointer {
90
143
  animateCursorToElement(target: ElementTarget, executeClick?: boolean, delayMs?: number, annotationText?: string, options?: {
91
144
  afterClick?: AfterPointerClick;
92
145
  }): Promise<void>;
146
+ private hookContext;
93
147
  animateCursorToElementAndClickAndFill(target: ElementTarget, text: string, executeClick?: boolean, delayMs?: number, annotationText?: string, options?: {
94
148
  afterClick?: AfterPointerClick;
95
149
  }): Promise<void>;
@@ -1 +1 @@
1
- {"version":3,"file":"pointer.d.ts","sourceRoot":"","sources":["../../class-generation/pointer.ts"],"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,CAAC,EAAE;QACT,UAAU,CAAC,EAAE,iBAAiB,CAAC;KAC/B,GACC,OAAO,CAAC,IAAI,CAAC;YAoIF,WAAW;IAIZ,qCAAqC,CACjD,MAAM,EAAE,aAAa,EACrB,IAAI,EAAE,MAAM,EACZ,YAAY,GAAE,OAAc,EAC5B,OAAO,GAAE,MAAa,EACtB,cAAc,GAAE,MAAW,EAC3B,OAAO,CAAC,EAAE;QACT,UAAU,CAAC,EAAE,iBAAiB,CAAC;KAC/B,GACC,OAAO,CAAC,IAAI,CAAC;CAqBhB"}
@@ -297,12 +297,16 @@ const __PW_POINTER_ID__ = "__pw_pointer__";
297
297
  const __PW_EDITABLE_DESCENDANT_SELECTOR__ = "input, textarea, select, [contenteditable=''], [contenteditable='true'], [contenteditable]:not([contenteditable='false'])";
298
298
  const __PW_POINTER_PNG__ = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAeCAQAAACGG/bgAAAAAmJLR0QA/4ePzL8AAAAJcEhZcwAAHsYAAB7GAZEt8iwAAAAHdElNRQfgAwgMIwdxU/i7AAABZklEQVQ4y43TsU4UURSH8W+XmYwkS2I09CRKpKGhsvIJjG9giQmliHFZlkUIGnEF7KTiCagpsYHWhoTQaiUUxLixYZb5KAAZZhbunu7O/PKfe+fcA+/pqwb4DuximEqXhT4iI8dMpBWEsWsuGYdpZFttiLSSgTvhZ1W/SvfO1CvYdV1kPghV68a30zzUWZH5pBqEui7dnqlFmLoq0gxC1XfGZdoLal2kea8ahLoqKXNAJQBT2yJzwUTVt0bS6ANqy1gaVCEq/oVTtjji4hQVhhnlYBH4WIJV9vlkXLm+10R8oJb79Jl1j9UdazJRGpkrmNkSF9SOz2T71s7MSIfD2lmmfjGSRz3hK8l4w1P+bah/HJLN0sys2JSMZQB+jKo6KSc8vLlLn5ikzF4268Wg2+pPOWW6ONcpr3PrXy9VfS473M/D7H+TLmrqsXtOGctvxvMv2oVNP+Av0uHbzbxyJaywyUjx8TlnPY2YxqkDdAAAAABJRU5ErkJggg==";
299
299
  const __pw_pointer_positions__ = /* @__PURE__ */ new WeakMap();
300
- function __pw_set_pointer_pos__(page, x, y) {
301
- __pw_pointer_positions__.set(page, { x, y });
302
- }
303
300
  let animationOptions = {
304
301
  extraDelayMs: 0
305
302
  };
303
+ const ACTION_HOOKS = /* @__PURE__ */ Symbol.for("@immense/vue-pom-generator.action-hooks");
304
+ function setActionHooks(hooks) {
305
+ globalThis[ACTION_HOOKS] = hooks;
306
+ }
307
+ function actionHooks() {
308
+ return globalThis[ACTION_HOOKS];
309
+ }
306
310
  const __pw_default_pointer_renderer__ = {
307
311
  overlayIds: [__PW_POINTER_ID__],
308
312
  async ensure(page) {
@@ -311,7 +315,7 @@ const __pw_default_pointer_renderer__ = {
311
315
  { pointerId: __PW_POINTER_ID__ }
312
316
  );
313
317
  if (exists) return;
314
- __pw_set_pointer_pos__(page, 0, 0);
318
+ __pw_pointer_positions__.delete(page);
315
319
  await page.evaluate(
316
320
  ({ id, src }) => {
317
321
  const img = document.createElement("img");
@@ -475,6 +479,7 @@ class Pointer {
475
479
  const locator = this.toLocator(target);
476
480
  const trimmedAnnotationText = annotationText.trim();
477
481
  const opts = animationOptions;
482
+ const hooks = actionHooks();
478
483
  if (executeClick) {
479
484
  await this.waitForFiniteAncestorAnimations(locator);
480
485
  }
@@ -485,6 +490,7 @@ class Pointer {
485
490
  const extraDelay = Math.max(0, opts.extraDelayMs);
486
491
  if (extraDelay > 0) await this.page.waitForTimeout(extraDelay);
487
492
  let clickedTestId2;
493
+ const click2 = hooks && executeClick ? await this.hookContext(locator) : void 0;
488
494
  if (executeClick) {
489
495
  if (options?.afterClick) {
490
496
  try {
@@ -492,21 +498,30 @@ class Pointer {
492
498
  } catch {
493
499
  }
494
500
  }
501
+ if (click2) await hooks?.beforeClick?.(click2);
495
502
  await locator.first().click();
496
503
  }
497
504
  if (options?.afterClick) {
498
505
  await options.afterClick({ testId: clickedTestId2, instrumented: Boolean(clickedTestId2) });
499
506
  }
507
+ if (click2) await hooks?.afterClick?.(click2);
500
508
  return;
501
509
  }
502
510
  }
511
+ async hookContext(locator) {
512
+ return { page: this.page, target: locator, box: await locator.first().boundingBox() };
513
+ }
503
514
  async animateCursorToElementAndClickAndFill(target, text, executeClick = true, delayMs = 1e3, annotationText = "", options) {
504
515
  await this.animateCursorToElement(target, executeClick, delayMs, annotationText, options);
505
516
  const locator = this.toLocator(target);
506
517
  const editableLocator = await this.resolveEditableLocator(locator);
518
+ const hooks = actionHooks();
519
+ const input = hooks ? { ...await this.hookContext(editableLocator), text } : void 0;
520
+ if (input) await hooks?.beforeInput?.(input);
507
521
  {
508
522
  await editableLocator.fill(text);
509
523
  }
524
+ if (input) await hooks?.afterInput?.(input);
510
525
  }
511
526
  }
512
527
  const POM_ACTIVE_ACTION_REGISTRY = /* @__PURE__ */ Symbol.for("@immense/vue-pom-generator.active-action-registry");
@@ -971,5 +986,6 @@ class BasePage {
971
986
  }
972
987
  exports.BasePage = BasePage;
973
988
  exports.ObjectId = ObjectId;
989
+ exports.setActionHooks = setActionHooks;
974
990
  exports.setDefaultCalloutRenderer = setDefaultCalloutRenderer;
975
991
  //# sourceMappingURL=runtime.cjs.map