@ingcreators/annot-product-docs 0.2.0 → 0.4.0

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/fixture.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { Locator, Page } from '@playwright/test';
2
2
  import { OverlaySpec } from './types.js';
3
- export interface ScreenCaptureOptions {
3
+ export interface ProductDocsSyncOptions {
4
4
  /** Must match a `<Screen id="...">` JSX block in the MDX file. */
5
5
  id: string;
6
6
  /** Absolute or cwd-relative path to the `.mdx` file. */
@@ -18,9 +18,25 @@ export interface ScreenCaptureOptions {
18
18
  */
19
19
  attributeWhitelist?: readonly string[];
20
20
  }
21
- export interface Screen {
22
- capture(opts: ScreenCaptureOptions): Promise<void>;
21
+ /**
22
+ * @deprecated Renamed to {@link ProductDocsSyncOptions} in Phase 3
23
+ * of `docs/plans/playwright-screenshot-fixture-relayer.md` for
24
+ * naming clarity (the helper synchronizes the MDX comment blocks
25
+ * with the live UI — it does not take a screenshot). The old name
26
+ * keeps working but new code should use `ProductDocsSyncOptions`.
27
+ */
28
+ export type ScreenCaptureOptions = ProductDocsSyncOptions;
29
+ export interface ProductDocs {
30
+ sync(opts: ProductDocsSyncOptions): Promise<void>;
23
31
  }
32
+ /**
33
+ * @deprecated Renamed to {@link ProductDocs} in Phase 3 of
34
+ * `docs/plans/playwright-screenshot-fixture-relayer.md`. The old
35
+ * `Screen` name is ambiguous (collides with `@testing-library/react`'s
36
+ * `screen` + reads like a Playwright built-in). New code should
37
+ * use `ProductDocs`.
38
+ */
39
+ export type Screen = ProductDocs;
24
40
  /**
25
41
  * HTML attributes captured into the `annot:attributes` block by
26
42
  * default. Focused on form-control + accessibility shape — the
@@ -30,41 +46,55 @@ export interface Screen {
30
46
  */
31
47
  export declare const DEFAULT_ATTR_WHITELIST: readonly string[];
32
48
  /**
33
- * `test = annotatorTest.extend({ screen })` — drop-in for
34
- * `@playwright/test`'s `test` plus a `screen` fixture for the
35
- * docs flow. Tour files (`tests/docs/*.spec.ts`) import this
49
+ * `test = annotatorTest.extend({ productDocs })` — drop-in for
50
+ * `@playwright/test`'s `test` plus a `productDocs` fixture for
51
+ * the docs flow. Tour files (`tests/docs/*.spec.ts`) import this
36
52
  * `test` instead of `@playwright/test`:
37
53
  *
38
54
  * ```ts
39
55
  * import { test } from "@ingcreators/annot-product-docs";
40
56
  *
41
- * test("login flow", async ({ page, screen }) => {
57
+ * test("login flow", async ({ page, productDocs }) => {
42
58
  * await page.goto("/login");
43
- * await screen.capture({
59
+ * await productDocs.sync({
44
60
  * id: "login",
45
61
  * mdxPath: "docs/books/screen-spec/screens/SC-001-login.mdx",
46
62
  * });
47
63
  * });
48
64
  * ```
65
+ *
66
+ * For back-compat the same fixture is also exposed as `screen`
67
+ * with a `.capture()` method (deprecated since Phase 3 of the
68
+ * relayer plan; remove after the documented deprecation window).
49
69
  */
50
70
  export declare const test: import('@playwright/test').TestType<import('@playwright/test').PlaywrightTestArgs & import('@playwright/test').PlaywrightTestOptions & {
51
71
  annotator: import('@ingcreators/annot-playwright').PlaywrightAnnotator;
52
72
  } & {
53
- screen: Screen;
73
+ productDocs: ProductDocs;
74
+ screen: ProductDocs;
54
75
  }, import('@playwright/test').PlaywrightWorkerArgs & import('@playwright/test').PlaywrightWorkerOptions>;
55
76
  /**
56
- * Standalone capture helper — same behaviour as
57
- * `screen.capture(...)` but takes the `Page` directly. Exported
58
- * so callers who build their own Playwright fixture (e.g.
59
- * composing additional fixtures on top) can still drive the
60
- * docs-sync flow.
77
+ * Standalone sync helper — same behaviour as
78
+ * `productDocs.sync(...)` but takes the `Page` directly.
79
+ * Exported so callers who build their own Playwright fixture
80
+ * (e.g. composing additional fixtures on top) can still drive
81
+ * the docs-sync flow.
61
82
  *
62
83
  * Idempotent: if `mdxPath` already has `annot:snapshot` /
63
84
  * `annot:attributes` blocks, they're replaced in place; if not,
64
85
  * they're appended. Files without `annot:` frontmatter throw —
65
86
  * the fixture refuses to touch non-annot MDX.
66
87
  */
67
- export declare function captureScreen(page: Page, opts: ScreenCaptureOptions): Promise<void>;
88
+ export declare function syncProductDocs(page: Page, opts: ProductDocsSyncOptions): Promise<void>;
89
+ /**
90
+ * @deprecated Renamed to {@link syncProductDocs} in Phase 3 of
91
+ * `docs/plans/playwright-screenshot-fixture-relayer.md`. The old
92
+ * name reads as if a screenshot is captured; the function
93
+ * actually synchronizes MDX comment blocks. The deprecated alias
94
+ * is a reference-equality re-export of the new implementation so
95
+ * `===` checks across the rename boundary keep working.
96
+ */
97
+ export declare const captureScreen: typeof syncProductDocs;
68
98
  /**
69
99
  * Walk the overlays in a `<Screen>`, resolve each one's `match`
70
100
  * against the live page, and emit a YAML block of the form:
package/dist/index.d.ts CHANGED
@@ -1,12 +1,20 @@
1
+ export type { AnnotationBBox, AnnotationKind, AnnotationPoint, AnnotationSpec, AnnotationStyleFields, AnnotationsFile, ArrowAnnotation, ArrowEndpoint, CalloutAnnotation, CalloutTarget, CircleAnnotation, FocusMaskAnnotation, FocusMaskCutout, FreehandAnnotation, OverlayEntry, RectAnnotation, RedactAnnotation, RedactAnnotationStyle, TextAnchorPosition, TextAnnotation, } from './annotations-yaml.js';
2
+ export { ANNOTATION_KINDS, ANNOTATIONS_YAML_VERSION, AnnotationsYamlError, parseAnnotationsYaml, serializeAnnotationsYaml, } from './annotations-yaml.js';
1
3
  export { filterAnnotMdxFiles, main, walkMdx, } from './cli.js';
2
4
  export { annotDocsConfigSchema, annotFrontmatterSchema, defineConfig, isScreenRole, } from './config.js';
5
+ export type { LegacyOverlayUsage } from './deprecation.js';
6
+ export { _resetLegacyOverlayDedupForTests, formatLegacyOverlayWarning, warnLegacyOverlay, } from './deprecation.js';
3
7
  export type { DetectDriftOptions, DriftFinding, DriftKind, DriftSeverity, } from './drift.js';
4
- export { detectDrift, detectDriftFromYaml, isLintableScreen, lintableScreens, summariseDrift, } from './drift.js';
5
- export type { Screen, ScreenCaptureOptions } from './fixture.js';
6
- export { captureScreen, collectAttributesYaml, DEFAULT_ATTR_WHITELIST, test, } from './fixture.js';
8
+ export { collectMatchKeysFromAnnotation, detectDrift, detectDriftFromElementTree, detectDriftFromYaml, elementTreeToSnapshotEntries, isLintableScreen, lintableScreens, summariseDrift, } from './drift.js';
9
+ export type { ProductDocs, ProductDocsSyncOptions, Screen, ScreenCaptureOptions, } from './fixture.js';
10
+ export { captureScreen, collectAttributesYaml, DEFAULT_ATTR_WHITELIST, syncProductDocs, test, } from './fixture.js';
7
11
  export type { ParseMdxOptions } from './mdx.js';
8
12
  export { parseMdx, parseMdxFile, updateCommentBlocks } from './mdx.js';
13
+ export type { BoxedEntry } from './mdx-annotations.js';
14
+ export { buildBadgeAnnotations, buildBadgeAnnotationsFromYaml, buildRasterRedactRegionsFromYaml, buildShapeAnnotationsFromYaml, elementTreeToBoxedEntries, emptyAnnotationsSvg, parseSnapshotBoxes, resolveMdxAnnotations, svgFromBadges, svgFromBboxAnnotations, } from './mdx-annotations.js';
15
+ export type { MigrateOverlaysOptions, OverlayMigrationFileResult, ScreenOverlayMigrationResult, } from './migrate-overlays-to-annotations.js';
16
+ export { buildAnnotationsFile, migrateOverlaysToAnnotationsFile, } from './migrate-overlays-to-annotations.js';
9
17
  export type { ResolveFailureKind, ResolveResult, SnapshotEntry, } from './resolver.js';
10
18
  export { parseSnapshot, resolveMatch, resolveOverlays, } from './resolver.js';
11
- export type { AnnotCommentBlocks, AnnotFrontmatter, AnnotFrontmatterRole, AnnotMeta, AnnotXlsxConfig, HistoryEntrySpec, MatchKey, OverlayIntent, OverlaySpec, ParsedMdx, ScreenListSpec, ScreenSpec, TransitionSpec, } from './types.js';
12
- export type { AnnotDocsConfig, BookConfig } from './types-config.js';
19
+ export type { AnnotCalloutSpec, AnnotCommentBlocks, AnnotFrontmatter, AnnotFrontmatterRole, AnnotMeta, AnnotXlsxConfig, HistoryEntrySpec, MatchKey, OverlayIntent, OverlaySpec, ParsedMdx, ScreenListSpec, ScreenSpec, TransitionSpec, } from './types.js';
20
+ export type { AnnotDocsConfig, AnnotEditorConfig, BookConfig } from './types-config.js';