@immense/vue-pom-generator 1.0.116 → 1.0.118

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
@@ -378,6 +378,45 @@ When `runtime.annotator.ui.enabled` is true, the same browser-only client is inj
378
378
  for both `vite serve` and `vite build`. Disable it for production in your conditional
379
379
  Vite config when the overlay is intended only for development or preview artifacts.
380
380
 
381
+ To send annotations somewhere other than the clipboard, register a submit handler at
382
+ runtime. Annotator options are serialized into the injected client, so a function can't
383
+ go through the Vite config. While a handler is registered, the toolbar shows **Submit**,
384
+ which hands over every queued annotation at once, so feedback that only makes sense
385
+ together is sent together:
386
+
387
+ ```ts
388
+ import type { AnnotatorSubmitHandler } from "@immense/vue-pom-generator";
389
+
390
+ const submit: AnnotatorSubmitHandler = async (annotations, { pageUrl }) => {
391
+ // Each annotation carries `source` (`<file>:<line>:<column>`), its capture-time
392
+ // `pageUrl`, `comment`, `targetLabel`, ...
393
+ await postFeedback(annotations, pageUrl);
394
+ return true; // only an explicit true is a success; anything else retains the queue
395
+ };
396
+
397
+ window.__VUE_POM_GENERATOR_ANNOTATOR_SUBMIT__ = submit;
398
+ window.__VUE_POM_GENERATOR_ANNOTATOR_RUNTIME__?.refresh(); // if the overlay is already mounted
399
+ ```
400
+
401
+ The package types declare both window properties, so no local `declare global` is
402
+ needed. The handler is invoked synchronously from the button click, before the overlay
403
+ awaits anything — open popups (`window.open`) before your handler's first `await`.
404
+ Only an explicit `true` counts as a successful submit; any other return (`false`,
405
+ `undefined`) or a throw retains the queue and shows a **Submit failed** toast.
406
+ Thrown errors are also logged to the console with a `[vue-pom-generator]` prefix
407
+ for diagnostics. On success, exactly the submitted records that are still unchanged
408
+ are cleared — new
409
+ drafts and drafts edited while the submit was pending are kept (records are matched
410
+ by id and submitted content), so a retry hands over the same records with the same
411
+ ids. The Submit button is disabled while a submit is in flight.
412
+ Remove the handler and call `refresh()` again to hide the button.
413
+
414
+ The handler owns authentication, transport, and retry policy. Return `true` only
415
+ after the destination confirms acceptance. A timeout or a closed popup does not
416
+ prove that a remote write failed: retain the queue and reuse the same submission
417
+ identifier until the destination confirms a receipt. The annotator itself makes no
418
+ network requests and does not store destination credentials.
419
+
381
420
  ## Basic Nuxt setup
382
421
 
383
422
  ```ts
@@ -976,7 +1015,29 @@ Current caveats:
976
1015
  - generic wrapper-only component fallbacks whose best standalone name is just their wrapper class are skipped so parent views/components keep the more meaningful handler-derived API
977
1016
  - an override class still needs a `new (page)`-compatible constructor because that is what fixtures call
978
1017
 
979
- By default the runtime uses a simple red fallback bubble. 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.
1018
+ By default the runtime uses a simple red fallback bubble. Generated page objects are constructed without renderer options, so to restyle every callout in the process, register a default renderer once (for example in the module that builds your shared `test`). It applies to generated and handwritten page objects alike. A per-instance `renderers.callout` still wins, and `setDefaultCalloutRenderer(undefined)` restores the built-in bubble.
1019
+
1020
+ ```ts
1021
+ // tests/playwright/test-base.ts
1022
+ import { setDefaultCalloutRenderer, type CalloutRenderer } from "@immense/vue-pom-generator/playwright/runtime";
1023
+
1024
+ const brandCallout: CalloutRenderer = {
1025
+ async show(page, { targetBox, text }) {
1026
+ await page.evaluate(({ box, label }) => {
1027
+ const el = document.getElementById("my-callout") ?? document.body.appendChild(Object.assign(document.createElement("div"), { id: "my-callout" }));
1028
+ el.textContent = label;
1029
+ el.setAttribute("style", `position:fixed;z-index:2147483647;pointer-events:none;left:${box.x}px;top:${box.y + box.height + 8}px;padding:8px 12px;background:#1d4ed8;color:#fff;border-radius:6px;`);
1030
+ }, { box: targetBox, label: text });
1031
+ },
1032
+ async hide(page) {
1033
+ await page.evaluate(() => document.getElementById("my-callout")?.remove());
1034
+ },
1035
+ };
1036
+
1037
+ setDefaultCalloutRenderer(brandCallout);
1038
+ ```
1039
+
1040
+ 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.
980
1041
 
981
1042
  Example floating-ui callout sequence captured from the Playwright fixture coverage:
982
1043
 
package/RELEASE_NOTES.md CHANGED
@@ -1,34 +1,39 @@
1
- v1.0.116
2
-
3
1
  Highlights
4
2
 
5
- - Wrapper targeting fixed: a component's own fallthrough target is now matched by element, not by
6
- offset in the wrapper contract (#83) — wrappers no longer bind to the wrong node when sibling
7
- structure shifts.
8
- - Corrected the corresponding logic in transform.ts so generated wrappers stay consistent with the
9
- new element-based matching.
10
- - Added regression coverage in tests/transform.test.ts and trimmed the offset-based assumptions in
11
- tests/wrapper-contract.test.ts.
3
+ - Process-wide default callout renderer — callout class generation now supports a single default
4
+ renderer registered for the whole process, so apps no longer wire a renderer into each generated
5
+ callout (#85)
6
+ - BasePage class generation updated to consume the new default renderer
7
+ - README documents the new behavior; new test coverage added
12
8
 
13
9
  Changes
14
10
 
15
- Fixed
11
+ Callouts
12
+
13
+ - Added process-wide default callout renderer support to callout class generation
14
+ (class-generation/callout.ts)
15
+ - Base-page class generation now applies the default renderer when emitting callout accessors
16
+ (class-generation/base-page.ts)
16
17
 
17
- - wrapper-contract: match a component's own fallthrough target by element rather than by positional
18
- offset (#83).
19
- - transform: updated transform behavior to align with element-based fallthrough matching.
18
+ Docs & tooling
19
+
20
+ - README updated with usage and behavior of the default callout renderer
21
+ - scripts/packed-smoke-check.mjs updated for the packed-package check
20
22
 
21
23
  Tests
22
24
 
23
- - tests/transform.test.ts: new cases covering element-based fallthrough target matching.
24
- - tests/wrapper-contract.test.ts: updated expectations for the corrected matching behavior.
25
+ - Added base-page tests covering default-renderer resolution in generated pages
26
+ (tests/base-page.test.ts)
25
27
 
26
28
  Pull Requests Included
27
29
 
28
- - #83 — fix(wrappers): match a component's own fallthrough target by element, not offset —
29
- ]8;id=md-1cfqef3;https://github.com/immense/vue-pom-generator/pull/83@darrenator[bot]]8;;
30
+ - ]8;id=md-1bvr715;https://github.com/immense/vue-pom-generator/pull/85#85]8;;]8;; — feat(callout): add process-wide default callout renderer (@dkattan)]8;;
31
+
32
+ Only #85 falls within the v1.0.117..HEAD compare range (5 files, +109/−4); other PRs in the merge
33
+ window were already shipped in prior releases.
30
34
 
31
35
  Testing
32
36
 
33
- - Unit tests added/updated for transform and wrapper-contract matching behavior.
37
+ - New base-page.test.ts cases cover the default callout renderer; packed smoke check adjusted
38
+ accordingly. No other test changes in this release.
34
39
 
@@ -7,6 +7,10 @@ import { Callout } from "./callout";
7
7
  import type { CalloutRenderer } from "./callout";
8
8
  import { Pointer, type AfterPointerClick, type AfterPointerClickInfo, type PointerRenderer } from "./pointer";
9
9
 
10
+ // Part of the public `playwright/runtime` entry, whose source is this file.
11
+ export { setDefaultCalloutRenderer } from "./callout";
12
+ export type { CalloutRenderer, CalloutRenderRequest } from "./callout";
13
+
10
14
  const POM_ACTIVE_ACTION_REGISTRY = Symbol.for("@immense/vue-pom-generator.active-action-registry");
11
15
  const CHECKABLE_CONTROL_SELECTOR = 'input[type="checkbox"], input[type="radio"]';
12
16
 
@@ -312,6 +312,22 @@ const __pw_default_callout_renderer__: CalloutRenderer = {
312
312
 
313
313
  export const simpleCalloutRenderer = __pw_default_callout_renderer__;
314
314
 
315
+ // Kept on globalThis so the package's runtime entry and the runtime copied next to the
316
+ // generated POMs share one default, whichever copy the setter is imported from.
317
+ const DEFAULT_CALLOUT_RENDERER = Symbol.for("@immense/vue-pom-generator.default-callout-renderer");
318
+
319
+ type DefaultCalloutRendererGlobal = typeof globalThis & { [DEFAULT_CALLOUT_RENDERER]?: CalloutRenderer };
320
+
321
+ /**
322
+ * Sets the process-wide callout renderer used by every `Callout` (and therefore every
323
+ * `BasePage`, generated or handwritten) constructed without a per-instance `renderer`.
324
+ * Call it before page objects are created, e.g. at module load of the project's shared
325
+ * `test` module. Pass `undefined` to restore the built-in callout.
326
+ */
327
+ export function setDefaultCalloutRenderer(renderer: CalloutRenderer | undefined): void {
328
+ (globalThis as DefaultCalloutRendererGlobal)[DEFAULT_CALLOUT_RENDERER] = renderer;
329
+ }
330
+
315
331
  export class Callout {
316
332
  private readonly page: PwPage;
317
333
  private readonly extraOverlayIds: string[];
@@ -320,7 +336,9 @@ export class Callout {
320
336
  public constructor(page: PwPage, options?: CalloutOptions) {
321
337
  this.page = page;
322
338
  this.extraOverlayIds = options?.extraOverlayIds ?? [];
323
- this.renderer = options?.renderer ?? __pw_default_callout_renderer__;
339
+ this.renderer = options?.renderer
340
+ ?? (globalThis as DefaultCalloutRendererGlobal)[DEFAULT_CALLOUT_RENDERER]
341
+ ?? __pw_default_callout_renderer__;
324
342
  }
325
343
 
326
344
  private toLocator(target: ElementTarget): PwLocator {
@@ -2,6 +2,8 @@ import type { Locator, Page } from "playwright";
2
2
  import type { BasePageScreenshotOptions, PwLocator, PwPage } from "./playwright-types";
3
3
  import type { CalloutRenderer } from "./callout";
4
4
  import { type AfterPointerClick, type PointerRenderer } from "./pointer";
5
+ export { setDefaultCalloutRenderer } from "./callout";
6
+ export type { CalloutRenderer, CalloutRenderRequest } from "./callout";
5
7
  /**
6
8
  * A chainable, thenable wrapper around a page object.
7
9
  *
@@ -192,5 +194,4 @@ export declare class BasePage {
192
194
  */
193
195
  protected selectByTestId(testId: string, value: string): Promise<void>;
194
196
  }
195
- export {};
196
197
  //# sourceMappingURL=base-page.d.ts.map
@@ -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;AAiC9G;;;;;;;;GAQG;AACH;;;GAGG;AACH,KAAK,UAAU,CAAC,CAAC,EAAE,KAAK,SAAS,MAAM,IAA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AAM,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"}
@@ -51,6 +51,13 @@ export declare function measureCalloutBubble(text: string): {
51
51
  bubbleWidth: number;
52
52
  };
53
53
  export declare const simpleCalloutRenderer: CalloutRenderer;
54
+ /**
55
+ * Sets the process-wide callout renderer used by every `Callout` (and therefore every
56
+ * `BasePage`, generated or handwritten) constructed without a per-instance `renderer`.
57
+ * Call it before page objects are created, e.g. at module load of the project's shared
58
+ * `test` module. Pass `undefined` to restore the built-in callout.
59
+ */
60
+ export declare function setDefaultCalloutRenderer(renderer: CalloutRenderer | undefined): void;
54
61
  export declare class Callout {
55
62
  private readonly page;
56
63
  private readonly extraOverlayIds;
@@ -1 +1 @@
1
- {"version":3,"file":"callout.d.ts","sourceRoot":"","sources":["../../class-generation/callout.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAE5D,eAAO,MAAM,mBAAmB;;;;CAItB,CAAC;AAEX,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;CAexB,CAAC;AAEX,MAAM,MAAM,aAAa,GAAG,MAAM,GAAG,SAAS,CAAC;AAE/C,MAAM,WAAW,gBAAgB;IAChC,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,kBAAkB;IAClC,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,SAAS,CAAC,EAAE,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,GAAG,SAAS,GAAG,IAAI,CAErF;AAED,qBAAa,OAAO;IACnB,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAS;IAC9B,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAW;IAC3C,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAkB;gBAExB,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,cAAc;IAQzD,OAAO,CAAC,SAAS;IAIJ,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAIrB,cAAc,CAC1B,MAAM,EAAE,aAAa,EACrB,cAAc,EAAE,MAAM,EACtB,OAAO,CAAC,EAAE,kBAAkB,GAC1B,OAAO,CAAC,IAAI,CAAC;CAuChB"}
package/dist/index.cjs CHANGED
@@ -12388,11 +12388,13 @@ const SETTINGS_STORAGE_KEY = "vpg-annotator-settings";
12388
12388
  const ANNOTATIONS_STORAGE_KEY = "vpg-annotator-annotations";
12389
12389
  const TOOLBAR_POSITION_STORAGE_KEY = "vpg-annotator-toolbar-position";
12390
12390
  const RUNTIME_GUARD = "__VUE_POM_GENERATOR_ANNOTATOR_RUNTIME__";
12391
+ const SUBMIT_HOOK = "__VUE_POM_GENERATOR_ANNOTATOR_SUBMIT__";
12391
12392
  const TOOLBAR_ICON_MARKUP = {
12392
12393
  drag: '<svg viewBox="0 0 16 16"><path d="M5 3h1v1H5zM10 3h1v1h-1zM5 7h1v1H5zM10 7h1v1h-1zM5 11h1v1H5zM10 11h1v1h-1z" fill="currentColor" stroke="none" /></svg>',
12393
12394
  inspect: '<svg viewBox="0 0 16 16"><circle cx="8" cy="8" r="4.5"/><path d="M8 1v2.5M8 12.5v2.5M1 8h2.5M12.5 8h2.5"/><circle cx="8" cy="8" r="0.9" fill="currentColor" stroke="none"/></svg>',
12394
12395
  preview: '<svg viewBox="0 0 16 16"><path d="M1.5 8s2.4-4 6.5-4 6.5 4 6.5 4-2.4 4-6.5 4-6.5-4-6.5-4Z"/><circle cx="8" cy="8" r="1.8"/></svg>',
12395
12396
  copy: '<svg viewBox="0 0 16 16"><path d="M6 2.5h6.5v9H6z"/><path d="M3.5 5.5H5v6.5h5.5v1.5h-7z"/></svg>',
12397
+ submit: '<svg viewBox="0 0 16 16"><path d="M14 2 2 7.5l5 1.5 1.5 5z"/><path d="M14 2 7 9"/></svg>',
12396
12398
  clear: '<svg viewBox="0 0 16 16"><path d="M2.5 4.5h11"/><path d="M6 2.5h4"/><path d="M5 4.5v8"/><path d="M8 4.5v8"/><path d="M11 4.5v8"/><path d="M4 4.5h8l-.6 9H4.6z"/></svg>',
12397
12399
  settings: '<svg viewBox="0 0 16 16"><path d="M8 2.2l1 .6 1.2-.2.8 1 .9.7-.3 1.2.5 1-.5 1 .3 1.2-.9.7-.8 1-1.2-.2-1 .6-1-.6-1.2.2-.8-1-.9-.7.3-1.2-.5-1 .5-1-.3-1.2.9-.7.8-1 1.2.2z"/><circle cx="8" cy="8" r="2.2"/></svg>'
12398
12400
  };
@@ -12525,6 +12527,9 @@ async function copyTextToClipboard(text) {
12525
12527
  throw new Error("Clipboard copy failed.");
12526
12528
  }
12527
12529
  }
12530
+ function annotationMatchesSubmitted(submitted, current) {
12531
+ return submitted.comment === current.comment && submitted.targetLabel === current.targetLabel && submitted.source === current.source && submitted.component === current.component && submitted.uiText === current.uiText && submitted.locator === current.locator && submitted.domHint === current.domHint && submitted.pageUrl === current.pageUrl;
12532
+ }
12528
12533
  class AnnotatorRuntime {
12529
12534
  options;
12530
12535
  settings;
@@ -12546,6 +12551,7 @@ class AnnotatorRuntime {
12546
12551
  currentPanelEl = null;
12547
12552
  toastTimer = null;
12548
12553
  toolbarPosition = null;
12554
+ submitting = false;
12549
12555
  constructor(options) {
12550
12556
  this.options = options;
12551
12557
  this.settings = this.loadSettings();
@@ -12611,12 +12617,15 @@ class AnnotatorRuntime {
12611
12617
  const copyButton = createIconButton("Copy annotations", "copy", () => this.copyAnnotations(), {
12612
12618
  disabled: this.annotations.length === 0
12613
12619
  });
12620
+ const submitButton = typeof window[SUBMIT_HOOK] === "function" ? createIconButton("Submit annotations", "submit", () => void this.submitAnnotations(), {
12621
+ disabled: this.submitting || this.annotations.length === 0
12622
+ }) : null;
12614
12623
  const clearButton = createIconButton("Clear annotations", "clear", () => this.clearAnnotations(), {
12615
12624
  disabled: this.annotations.length === 0
12616
12625
  });
12617
12626
  const settingsButton = createIconButton("Annotator settings", "settings", () => this.openSettings());
12618
12627
  this.settingsButton = settingsButton;
12619
- this.toolbarEl.append(handle, selectButton, previewButton, copyButton, clearButton, settingsButton, count);
12628
+ this.toolbarEl.append(handle, selectButton, previewButton, copyButton, ...submitButton ? [submitButton] : [], clearButton, settingsButton, count);
12620
12629
  this.applyToolbarPosition();
12621
12630
  }
12622
12631
  renderMarkers() {
@@ -12846,6 +12855,7 @@ class AnnotatorRuntime {
12846
12855
  uiText: getNearbyText(element),
12847
12856
  locator: getNearbyLocator(element),
12848
12857
  domHint: getElementPath(element),
12858
+ pageUrl: window.location.href,
12849
12859
  pageX: rect.left + rect.width / 2,
12850
12860
  pageY: rect.top + window.scrollY
12851
12861
  };
@@ -13075,6 +13085,43 @@ class AnnotatorRuntime {
13075
13085
  this.showToast("Copy failed");
13076
13086
  }
13077
13087
  }
13088
+ /** Re-renders the toolbar, for example after an app registers or removes a submit handler. */
13089
+ refresh() {
13090
+ this.renderToolbar();
13091
+ }
13092
+ async submitAnnotations() {
13093
+ if (this.submitting || !this.annotations.length) {
13094
+ return;
13095
+ }
13096
+ const handler = window[SUBMIT_HOOK];
13097
+ if (typeof handler !== "function") {
13098
+ return;
13099
+ }
13100
+ this.submitting = true;
13101
+ this.renderToolbar();
13102
+ const batch = [...this.annotations];
13103
+ const submitted = new Map(batch.map((annotation) => [annotation.id, { ...annotation }]));
13104
+ try {
13105
+ const accepted = await handler(batch, { pageUrl: window.location.href });
13106
+ if (accepted !== true) {
13107
+ this.showToast("Submit failed");
13108
+ return;
13109
+ }
13110
+ this.annotations = this.annotations.filter((annotation) => {
13111
+ const snapshot = submitted.get(annotation.id);
13112
+ return snapshot === void 0 || !annotationMatchesSubmitted(snapshot, annotation);
13113
+ });
13114
+ this.saveAnnotations();
13115
+ this.closePanel();
13116
+ this.showToast("Submitted");
13117
+ } catch (error) {
13118
+ console.error("[vue-pom-generator] Annotator submit handler failed", error);
13119
+ this.showToast("Submit failed");
13120
+ } finally {
13121
+ this.submitting = false;
13122
+ this.renderToolbar();
13123
+ }
13124
+ }
13078
13125
  showToast(message) {
13079
13126
  this.toastEl?.remove();
13080
13127
  if (this.toastTimer !== null) {
@@ -13096,13 +13143,12 @@ class AnnotatorRuntime {
13096
13143
  }
13097
13144
  }
13098
13145
  function mountAnnotatorClient(options) {
13099
- const runtimeWindow = window;
13100
- if (runtimeWindow[RUNTIME_GUARD]) {
13101
- return runtimeWindow[RUNTIME_GUARD];
13146
+ if (window[RUNTIME_GUARD]) {
13147
+ return window[RUNTIME_GUARD];
13102
13148
  }
13103
13149
  const runtime = new AnnotatorRuntime(options);
13104
13150
  runtime.mount();
13105
- runtimeWindow[RUNTIME_GUARD] = runtime;
13151
+ window[RUNTIME_GUARD] = runtime;
13106
13152
  return runtime;
13107
13153
  }
13108
13154
  let generating = false;