@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/CHANGELOG.md +453 -0
- package/README.md +37 -2
- package/dist/annotations-yaml.d.ts +291 -0
- package/dist/config.d.ts +23 -141
- package/dist/deprecation.d.ts +58 -0
- package/dist/drift.d.ts +98 -3
- package/dist/fixture.d.ts +45 -15
- package/dist/index.d.ts +13 -5
- package/dist/index.js +1768 -488
- package/dist/mdx-annotations.d.ts +162 -0
- package/dist/migrate-overlays-to-annotations.d.ts +49 -0
- package/dist/migrate-to-element-tree.d.ts +102 -0
- package/dist/playwright-screenshot-hook.d.ts +17 -0
- package/dist/types-config.d.ts +22 -0
- package/dist/types.d.ts +45 -0
- package/package.json +13 -8
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
import { BboxAnnotation, BboxNumberedBadgeAnnotation, BboxRedactRegion } from '@ingcreators/annot-annotator';
|
|
2
|
+
import { ElementTree } from '@ingcreators/annot-core';
|
|
3
|
+
import { AnnotationSpec, OverlayEntry } from './annotations-yaml.js';
|
|
4
|
+
import { OverlaySpec } from './types.js';
|
|
5
|
+
/** A parsed entry of an aria-snapshot YAML line carrying both a
|
|
6
|
+
* `[ref=…]` marker and a `[box=x,y,w,h]` marker. */
|
|
7
|
+
export interface BoxedEntry {
|
|
8
|
+
role: string;
|
|
9
|
+
name: string;
|
|
10
|
+
ref: string;
|
|
11
|
+
box: {
|
|
12
|
+
x: number;
|
|
13
|
+
y: number;
|
|
14
|
+
width: number;
|
|
15
|
+
height: number;
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Parse aria-snapshot YAML for entries that carry both `[ref=…]`
|
|
20
|
+
* and `[box=x,y,w,h]` markers. `box` is the Playwright addition
|
|
21
|
+
* available when `ariaSnapshot({ boxes: true })` was passed.
|
|
22
|
+
*
|
|
23
|
+
* Exposed for unit testing. Returns an empty array if no entries
|
|
24
|
+
* have boxes — callers fall back to a non-annotated render.
|
|
25
|
+
*/
|
|
26
|
+
export declare function parseSnapshotBoxes(yaml: string): BoxedEntry[];
|
|
27
|
+
/**
|
|
28
|
+
* Convert an `ElementTree` (Phase 1a of
|
|
29
|
+
* `docs/plans/living-spec-authoring-roadmap.md`) into the same
|
|
30
|
+
* `BoxedEntry[]` shape `parseSnapshotBoxes` emits, so the Astro
|
|
31
|
+
* Image Service + Playwright screenshot hook can resolve
|
|
32
|
+
* `<Overlay match>` against PNG XMP-stored trees with no
|
|
33
|
+
* additional code path.
|
|
34
|
+
*
|
|
35
|
+
* Only nodes with both `name` and `bbox` populated produce
|
|
36
|
+
* entries — matches the legacy YAML parser's filter (boxed +
|
|
37
|
+
* referenced entries with a name). Decorative containers and
|
|
38
|
+
* synthetic roots are skipped.
|
|
39
|
+
*
|
|
40
|
+
* Phase 1h of the roadmap. Lives alongside `parseSnapshotBoxes`
|
|
41
|
+
* so consumers that prefer one input shape don't need to know
|
|
42
|
+
* about the other.
|
|
43
|
+
*/
|
|
44
|
+
export declare function elementTreeToBoxedEntries(tree: ElementTree): BoxedEntry[];
|
|
45
|
+
/**
|
|
46
|
+
* Resolve a screen's `<Overlay match>` blocks against the parsed
|
|
47
|
+
* `BoxedEntry[]` from its snapshot YAML, emitting typed
|
|
48
|
+
* `BboxNumberedBadgeAnnotation`s ready for
|
|
49
|
+
* `createAnnotator().toPng()` / `.toEditablePng()`.
|
|
50
|
+
*
|
|
51
|
+
* Overlays with no matching boxed entry are skipped silently —
|
|
52
|
+
* the drift detector (`detectDrift`) surfaces those upstream.
|
|
53
|
+
*/
|
|
54
|
+
export declare function buildBadgeAnnotations(overlays: readonly OverlaySpec[], boxed: readonly BoxedEntry[], dims: {
|
|
55
|
+
width: number;
|
|
56
|
+
height: number;
|
|
57
|
+
}): BboxNumberedBadgeAnnotation[];
|
|
58
|
+
/**
|
|
59
|
+
* Sibling of {@link buildBadgeAnnotations} that takes yaml-form
|
|
60
|
+
* {@link OverlayEntry} objects. Phase 2b of
|
|
61
|
+
* `docs/plans/living-spec-authoring-roadmap.md` — the Image Service
|
|
62
|
+
* resolves a `<Screen annotations="…">` block against this entry
|
|
63
|
+
* point instead of the legacy inline `<Overlay>` path.
|
|
64
|
+
*
|
|
65
|
+
* Entries without a matching boxed entry are skipped silently —
|
|
66
|
+
* the drift detector (Phase 2c) surfaces them as findings upstream.
|
|
67
|
+
*/
|
|
68
|
+
export declare function buildBadgeAnnotationsFromYaml(overlays: readonly OverlayEntry[], boxed: readonly BoxedEntry[], dims: {
|
|
69
|
+
width: number;
|
|
70
|
+
height: number;
|
|
71
|
+
}): BboxNumberedBadgeAnnotation[];
|
|
72
|
+
/**
|
|
73
|
+
* Resolve the `<Overlay>` blocks inside `screenId` against the MDX
|
|
74
|
+
* file's stored `annot:snapshot` block and return a typed
|
|
75
|
+
* annotation array ready to feed into
|
|
76
|
+
* `createAnnotator().toEditablePng()`.
|
|
77
|
+
*
|
|
78
|
+
* Used by the Playwright screenshot hook (Tier C) and the Astro
|
|
79
|
+
* Image Service (Tier B-render). Throws the same diagnostics
|
|
80
|
+
* `renderAnnotatedScreen` would (no annot frontmatter / no
|
|
81
|
+
* matching `<Screen id>`).
|
|
82
|
+
*
|
|
83
|
+
* Returns an empty array when no `<Overlay>` matches a bbox marker
|
|
84
|
+
* — e.g. the snapshot was never captured, or `<Overlay match>`
|
|
85
|
+
* targets an element that's no longer in the page.
|
|
86
|
+
*/
|
|
87
|
+
export declare function resolveMdxAnnotations(opts: {
|
|
88
|
+
mdxPath: string;
|
|
89
|
+
screenId: string;
|
|
90
|
+
dims: {
|
|
91
|
+
width: number;
|
|
92
|
+
height: number;
|
|
93
|
+
};
|
|
94
|
+
cwd?: string;
|
|
95
|
+
}): Promise<BboxNumberedBadgeAnnotation[]>;
|
|
96
|
+
/**
|
|
97
|
+
* Wrap a `BboxNumberedBadgeAnnotation[]` (or any compatible badge
|
|
98
|
+
* subset) into a single-root `<svg>` ready for the annotator's
|
|
99
|
+
* `annotationsSvg` input.
|
|
100
|
+
*
|
|
101
|
+
* Mirrors the more general `svgFromBboxAnnotations` below but
|
|
102
|
+
* stays specifically typed to the badge shape so the Astro Image
|
|
103
|
+
* Service's `buildBadgeAnnotations()` output flows in without an
|
|
104
|
+
* extra cast.
|
|
105
|
+
*/
|
|
106
|
+
export declare function svgFromBadges(badges: BboxNumberedBadgeAnnotation[]): string;
|
|
107
|
+
/**
|
|
108
|
+
* Phase 3c of `docs/plans/living-spec-authoring-roadmap.md`.
|
|
109
|
+
* Resolve each Phase 3a `AnnotationSpec` against the page's
|
|
110
|
+
* boxed entries + image dimensions and convert to the
|
|
111
|
+
* `BboxAnnotation` shape `bboxAnnotationsToSvg` consumes.
|
|
112
|
+
*
|
|
113
|
+
* Skips entries whose required `match` (or the matches inside
|
|
114
|
+
* `coversElements` / `from` / `to` / `target` / `cutout`) can't
|
|
115
|
+
* be resolved — the drift detector (Phase 3d) surfaces those
|
|
116
|
+
* upstream. Free-coord entries (`bbox` / `point` / `at` / `path`
|
|
117
|
+
* / `center`) always resolve.
|
|
118
|
+
*/
|
|
119
|
+
export declare function buildShapeAnnotationsFromYaml(annotations: readonly AnnotationSpec[], boxed: readonly BoxedEntry[], dims: {
|
|
120
|
+
width: number;
|
|
121
|
+
height: number;
|
|
122
|
+
}): BboxAnnotation[];
|
|
123
|
+
/**
|
|
124
|
+
* Phase 3g of `docs/plans/living-spec-authoring-roadmap.md`
|
|
125
|
+
* (Phase 3 follow-up). Walk `annotations[]` for `redact` entries
|
|
126
|
+
* whose `style` is a raster transform (`mosaic` / `blur`),
|
|
127
|
+
* resolve each cutout to a bbox, and emit `BboxRedactRegion[]`
|
|
128
|
+
* ready for `burnRedactions` from `@ingcreators/annot-annotator`.
|
|
129
|
+
*
|
|
130
|
+
* Entries with `style: solid` (or undefined / unset) are skipped
|
|
131
|
+
* here — the SVG-fragment path
|
|
132
|
+
* ({@link buildShapeAnnotationsFromYaml}) handles those as
|
|
133
|
+
* filled rects. Match-anchored entries whose `match` doesn't
|
|
134
|
+
* resolve are skipped silently (drift detector surfaces them
|
|
135
|
+
* upstream).
|
|
136
|
+
*
|
|
137
|
+
* Returns the regions in document order; `burnRedactions`
|
|
138
|
+
* applies them in that order with later regions overlaying
|
|
139
|
+
* earlier ones (no alpha-blending), so authors can express
|
|
140
|
+
* "mosaic, then opaque overlay on top" combinations by
|
|
141
|
+
* sequencing entries.
|
|
142
|
+
*/
|
|
143
|
+
export declare function buildRasterRedactRegionsFromYaml(annotations: readonly AnnotationSpec[], boxed: readonly BoxedEntry[]): BboxRedactRegion[];
|
|
144
|
+
/**
|
|
145
|
+
* Wrap a generic `BboxAnnotation[]` (the union DSL accepted by
|
|
146
|
+
* `@ingcreators/annot-annotator`) into a single-root `<svg>` ready
|
|
147
|
+
* for the annotator's `annotationsSvg` input. Mirrors `svgFromBadges`
|
|
148
|
+
* but stays type-permissive — the Playwright fixture's inline
|
|
149
|
+
* overlays can be any `BboxAnnotation` shape, not just numbered
|
|
150
|
+
* badges.
|
|
151
|
+
*
|
|
152
|
+
* Returns the empty wrapper `<svg/>` when `annotations` is empty —
|
|
153
|
+
* lets the editor open the file with no annotations layer rather
|
|
154
|
+
* than throwing.
|
|
155
|
+
*/
|
|
156
|
+
export declare function svgFromBboxAnnotations(annotations: BboxAnnotation[]): string;
|
|
157
|
+
/**
|
|
158
|
+
* Minimal SVG fragment for the "editable wrap, no overlays" case.
|
|
159
|
+
* The editor's import path reads `annotationsSvg` from the XMP and
|
|
160
|
+
* reconstructs an empty annotations layer — fine to be wrapper-only.
|
|
161
|
+
*/
|
|
162
|
+
export declare function emptyAnnotationsSvg(): string;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { AnnotationsFile } from './annotations-yaml.js';
|
|
2
|
+
import { OverlaySpec } from './types.js';
|
|
3
|
+
/** Per-file result. The CLI prints a summary across these. */
|
|
4
|
+
export interface OverlayMigrationFileResult {
|
|
5
|
+
/** Absolute MDX path. */
|
|
6
|
+
mdxPath: string;
|
|
7
|
+
/** Per-screen results, in MDX document order. */
|
|
8
|
+
screens: ScreenOverlayMigrationResult[];
|
|
9
|
+
/** True when the MDX source was rewritten. */
|
|
10
|
+
mdxRewritten: boolean;
|
|
11
|
+
}
|
|
12
|
+
export interface ScreenOverlayMigrationResult {
|
|
13
|
+
/** `<Screen id>` value. */
|
|
14
|
+
id: string;
|
|
15
|
+
/** Absolute path of the yaml file (set even on dry-run). */
|
|
16
|
+
yamlPath?: string;
|
|
17
|
+
/** True when the yaml was written to disk. */
|
|
18
|
+
yamlWritten: boolean;
|
|
19
|
+
/** Number of overlays migrated for this screen. */
|
|
20
|
+
overlayCount: number;
|
|
21
|
+
/** Reason for skipping — `"no-overlays"` when the screen has
|
|
22
|
+
* zero inline `<Overlay>` children, `"already-migrated"` when
|
|
23
|
+
* the `<Screen>` opening tag already carries `annotations`,
|
|
24
|
+
* `"no-src"` when `<Screen src>` is missing. */
|
|
25
|
+
skipReason?: "no-overlays" | "already-migrated" | "no-src";
|
|
26
|
+
}
|
|
27
|
+
export interface MigrateOverlaysOptions {
|
|
28
|
+
/** When true, doesn't write back to disk — just returns what
|
|
29
|
+
* WOULD have been written. Default: false. */
|
|
30
|
+
dryRun?: boolean;
|
|
31
|
+
/** Override the function that picks the yaml path. Defaults to
|
|
32
|
+
* `<dirname(src)>/<basename(src, '.png')>.annotations.yaml`. */
|
|
33
|
+
yamlPathFor?: (args: {
|
|
34
|
+
mdxPath: string;
|
|
35
|
+
screenId: string;
|
|
36
|
+
src: string;
|
|
37
|
+
}) => string;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Migrate one MDX file. See module-level doc for the
|
|
41
|
+
* step-by-step.
|
|
42
|
+
*/
|
|
43
|
+
export declare function migrateOverlaysToAnnotationsFile(mdxPath: string, options?: MigrateOverlaysOptions): Promise<OverlayMigrationFileResult>;
|
|
44
|
+
/**
|
|
45
|
+
* Build the in-memory `AnnotationsFile` for one screen's worth
|
|
46
|
+
* of inline `<Overlay>` blocks. Exported for unit testing. Pure
|
|
47
|
+
* data; no IO.
|
|
48
|
+
*/
|
|
49
|
+
export declare function buildAnnotationsFile(overlays: readonly OverlaySpec[]): AnnotationsFile;
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { ElementTree } from '@ingcreators/annot-core';
|
|
2
|
+
/**
|
|
3
|
+
* Result of migrating one MDX file. Returned per file so the CLI
|
|
4
|
+
* can report a summary; throwers propagate up.
|
|
5
|
+
*/
|
|
6
|
+
export interface MigrationFileResult {
|
|
7
|
+
/** Absolute path of the MDX file. */
|
|
8
|
+
mdxPath: string;
|
|
9
|
+
/** Per-screen results. Same order as `parsed.screens`. */
|
|
10
|
+
screens: ScreenMigrationResult[];
|
|
11
|
+
/** True when the MDX source was rewritten (comment blocks
|
|
12
|
+
* stripped). False when nothing changed. */
|
|
13
|
+
mdxRewritten: boolean;
|
|
14
|
+
}
|
|
15
|
+
export interface ScreenMigrationResult {
|
|
16
|
+
/** `<Screen id>` value. */
|
|
17
|
+
id: string;
|
|
18
|
+
/** Absolute path of the PNG that received the XMP write. */
|
|
19
|
+
pngPath?: string;
|
|
20
|
+
/** True when an `annot:elementTree` chunk was written. */
|
|
21
|
+
xmpWritten: boolean;
|
|
22
|
+
/** Reason for skipping — `"no-snapshot"` when the MDX lacks an
|
|
23
|
+
* `annot:snapshot` block, `"no-src"` when `<Screen src>` is
|
|
24
|
+
* missing or not a local relative path, `"already-migrated"` when
|
|
25
|
+
* the PNG already carried an identical tree. */
|
|
26
|
+
skipReason?: "no-snapshot" | "no-src" | "already-migrated";
|
|
27
|
+
}
|
|
28
|
+
export interface MigrateOptions {
|
|
29
|
+
/** When true, doesn't write back to disk — just returns what
|
|
30
|
+
* WOULD have been written. Useful for `--dry-run` mode in the
|
|
31
|
+
* CLI. Default: false. */
|
|
32
|
+
dryRun?: boolean;
|
|
33
|
+
/** Override for the legacy attribute-collection whitelist.
|
|
34
|
+
* Defaults to the same `DEFAULT_ATTR_WHITELIST` consumed by
|
|
35
|
+
* the productDocs fixture today. */
|
|
36
|
+
attributeWhitelist?: readonly string[];
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Migrate one MDX file. Reads the file, processes every screen,
|
|
40
|
+
* writes the updated MDX + per-screen PNG XMP chunks back to disk
|
|
41
|
+
* (unless `dryRun`). Returns the per-screen result.
|
|
42
|
+
*/
|
|
43
|
+
export declare function migrateMdxFile(mdxPath: string, options?: MigrateOptions): Promise<MigrationFileResult>;
|
|
44
|
+
/**
|
|
45
|
+
* Build an `ElementTree` from the legacy `annot:snapshot` (Playwright
|
|
46
|
+
* YAML) and `annot:attributes` (per-overlay attribute dict) blocks.
|
|
47
|
+
*
|
|
48
|
+
* Exported separately so tests can exercise the pure conversion
|
|
49
|
+
* without touching disk.
|
|
50
|
+
*/
|
|
51
|
+
export declare function buildElementTreeFromLegacyBlocks(args: {
|
|
52
|
+
snapshotYaml: string;
|
|
53
|
+
attributesYaml: string;
|
|
54
|
+
whitelist: readonly string[];
|
|
55
|
+
}): ElementTree;
|
|
56
|
+
interface LegacyAttributeEntry {
|
|
57
|
+
role: string;
|
|
58
|
+
name: string;
|
|
59
|
+
attributes: Record<string, string>;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Parse the legacy `annot:attributes` YAML format:
|
|
63
|
+
*
|
|
64
|
+
* ```yaml
|
|
65
|
+
* button "Sign in":
|
|
66
|
+
* type: submit
|
|
67
|
+
* textbox "Email":
|
|
68
|
+
* type: email
|
|
69
|
+
* required: ""
|
|
70
|
+
* ```
|
|
71
|
+
*
|
|
72
|
+
* Returns one entry per `role "name":` block with the captured
|
|
73
|
+
* key / value pairs filtered through `whitelist`. Exported only
|
|
74
|
+
* for test use.
|
|
75
|
+
*/
|
|
76
|
+
export declare function parseLegacyAttributesYaml(yaml: string, whitelist: readonly string[]): LegacyAttributeEntry[];
|
|
77
|
+
/**
|
|
78
|
+
* Resolve a `<Screen src>` reference against the MDX file's
|
|
79
|
+
* directory. Returns `null` for protocol-prefixed URLs (those
|
|
80
|
+
* can't be a local file the migration can write XMP to).
|
|
81
|
+
*
|
|
82
|
+
* Exported for unit tests.
|
|
83
|
+
*/
|
|
84
|
+
export declare function resolvePngPath(mdxPath: string, src: string): string | null;
|
|
85
|
+
/**
|
|
86
|
+
* Strip the `annot:snapshot` and `annot:attributes` MDX comment
|
|
87
|
+
* blocks from `source`. Returns `source` unchanged when neither
|
|
88
|
+
* block is present.
|
|
89
|
+
*
|
|
90
|
+
* The comment-block format we look for is:
|
|
91
|
+
*
|
|
92
|
+
* ```mdx
|
|
93
|
+
* {/* annot:snapshot
|
|
94
|
+
* - main: ...
|
|
95
|
+
* *\/}
|
|
96
|
+
* ```
|
|
97
|
+
*
|
|
98
|
+
* (with `{/* ... *\/}` being the MDX expression-wrapped JS
|
|
99
|
+
* comment the `mdx.ts` `updateCommentBlocks` writes).
|
|
100
|
+
*/
|
|
101
|
+
export declare function stripLegacyCommentBlocks(source: string): string;
|
|
102
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
declare module "@ingcreators/annot-playwright" {
|
|
2
|
+
interface AnnotScreenshotOptions {
|
|
3
|
+
/**
|
|
4
|
+
* Refresh the MDX `annot:snapshot` block and resolve the
|
|
5
|
+
* `<Screen id>`'s `<Overlay>` blocks into bbox-keyed badge
|
|
6
|
+
* annotations. The MDX file is rewritten in-place with the
|
|
7
|
+
* current page's aria-snapshot before overlays resolve, so a
|
|
8
|
+
* single `page.screenshot({ annot: { mdx } })` call covers the
|
|
9
|
+
* "refresh + capture + bake + write" pipeline.
|
|
10
|
+
*/
|
|
11
|
+
mdx?: {
|
|
12
|
+
id: string;
|
|
13
|
+
path: string;
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
export {};
|
package/dist/types-config.d.ts
CHANGED
|
@@ -9,10 +9,32 @@ export interface BookConfig {
|
|
|
9
9
|
reference?: string;
|
|
10
10
|
};
|
|
11
11
|
}
|
|
12
|
+
/**
|
|
13
|
+
* Project-level defaults for `<AnnotEditButton>` embed mode +
|
|
14
|
+
* cloud URL. Phase 5f of
|
|
15
|
+
* `docs/plans/living-spec-authoring-roadmap.md`. Per-call props
|
|
16
|
+
* on the component override these defaults.
|
|
17
|
+
*/
|
|
18
|
+
export interface AnnotEditorConfig {
|
|
19
|
+
/**
|
|
20
|
+
* Default embed mode for every `<AnnotEditButton>` in the
|
|
21
|
+
* project. Per-call `mode` prop wins when set. Default
|
|
22
|
+
* `"newTab"` (per OQ-09's analysis).
|
|
23
|
+
*/
|
|
24
|
+
embedMode?: "newTab" | "inline" | "disabled";
|
|
25
|
+
/**
|
|
26
|
+
* Default cloud editor origin (e.g. `"https://annot.work"`
|
|
27
|
+
* for the hosted instance, `"https://annot.internal.example.com"`
|
|
28
|
+
* for an on-prem deployment). Per-call `cloudUrl` prop wins
|
|
29
|
+
* when set. Default `"https://annot.work"`.
|
|
30
|
+
*/
|
|
31
|
+
cloudUrl?: string;
|
|
32
|
+
}
|
|
12
33
|
export interface AnnotDocsConfig {
|
|
13
34
|
meta?: Record<string, unknown>;
|
|
14
35
|
xlsx?: {
|
|
15
36
|
defaultBook?: string;
|
|
16
37
|
books?: Record<string, BookConfig>;
|
|
17
38
|
};
|
|
39
|
+
editor?: AnnotEditorConfig;
|
|
18
40
|
}
|
package/dist/types.d.ts
CHANGED
|
@@ -14,6 +14,14 @@ export interface MatchKey {
|
|
|
14
14
|
under?: MatchKey;
|
|
15
15
|
}
|
|
16
16
|
export type OverlayIntent = "info" | "warning" | "error" | "success" | "neutral" | "required" | "action";
|
|
17
|
+
/**
|
|
18
|
+
* @deprecated Phase 2e of
|
|
19
|
+
* `docs/plans/living-spec-authoring-roadmap.md`. The inline
|
|
20
|
+
* `<Overlay match intent number>body</Overlay>` form is being
|
|
21
|
+
* replaced by the Phase 2b yaml + `<AnnotCallout for>` shape.
|
|
22
|
+
* Migrate with `annot docs migrate-overlays-to-annotations`.
|
|
23
|
+
* Slated for removal per OQ-08 (~2-3 release cycles after 2e).
|
|
24
|
+
*/
|
|
17
25
|
export interface OverlaySpec {
|
|
18
26
|
match: MatchKey;
|
|
19
27
|
intent?: OverlayIntent;
|
|
@@ -21,6 +29,21 @@ export interface OverlaySpec {
|
|
|
21
29
|
/** Markdown body between the `<Overlay>` opening and closing tags. */
|
|
22
30
|
body: string;
|
|
23
31
|
}
|
|
32
|
+
/**
|
|
33
|
+
* Phase 2b of `docs/plans/living-spec-authoring-roadmap.md`.
|
|
34
|
+
* A `<AnnotCallout for="id">body</AnnotCallout>` child of a
|
|
35
|
+
* `<Screen annotations="...">` block. The visible / numbered /
|
|
36
|
+
* intent-colored callout is composed onto the annotated PNG by the
|
|
37
|
+
* Image Service using the matching entry in the annotation yaml;
|
|
38
|
+
* this spec carries only what the MDX side contributes: the
|
|
39
|
+
* `for=` reference and the inner markdown body.
|
|
40
|
+
*/
|
|
41
|
+
export interface AnnotCalloutSpec {
|
|
42
|
+
/** References `overlays[].id` in the screen's annotation yaml. */
|
|
43
|
+
for: string;
|
|
44
|
+
/** Markdown body between the opening and closing tags. */
|
|
45
|
+
body: string;
|
|
46
|
+
}
|
|
24
47
|
export interface TransitionSpec {
|
|
25
48
|
trigger: MatchKey;
|
|
26
49
|
on?: string;
|
|
@@ -30,7 +53,29 @@ export interface TransitionSpec {
|
|
|
30
53
|
export interface ScreenSpec {
|
|
31
54
|
id: string;
|
|
32
55
|
src?: string;
|
|
56
|
+
/**
|
|
57
|
+
* Legacy inline overlays — `<Overlay>` JSX children of the
|
|
58
|
+
* `<Screen>` block. Carries match / intent / number / body
|
|
59
|
+
* inline; deprecated in favour of the Phase 2b annotation yaml
|
|
60
|
+
* path. Empty when the author has migrated to the yaml form.
|
|
61
|
+
*/
|
|
33
62
|
overlays: OverlaySpec[];
|
|
63
|
+
/**
|
|
64
|
+
* Phase 2b of `docs/plans/living-spec-authoring-roadmap.md`.
|
|
65
|
+
* Optional path (relative to the MDX file) to an
|
|
66
|
+
* `.annotations.yaml` that describes the screen's overlays —
|
|
67
|
+
* see `@ingcreators/annot-product-docs/annotations-yaml`. When
|
|
68
|
+
* set, the Image Service prefers yaml-driven badge composition
|
|
69
|
+
* over the inline `overlays[]`.
|
|
70
|
+
*/
|
|
71
|
+
annotations?: string;
|
|
72
|
+
/**
|
|
73
|
+
* Phase 2b. `<AnnotCallout for="id">body</AnnotCallout>` JSX
|
|
74
|
+
* children of the screen, paired with yaml overlay entries by
|
|
75
|
+
* `id`. Empty when the screen still uses the legacy
|
|
76
|
+
* `<Overlay>` form.
|
|
77
|
+
*/
|
|
78
|
+
callouts: AnnotCalloutSpec[];
|
|
34
79
|
}
|
|
35
80
|
export interface HistoryEntrySpec {
|
|
36
81
|
version: string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ingcreators/annot-product-docs",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"description": "Living product docs core — parse `.mdx` files with `annot:` frontmatter, resolve `<Overlay match>` keys against live Playwright `aria-snapshot` trees, run drift detection against the rendered UI, and ship a Playwright `screen` fixture that re-captures + re-syncs MDX snapshot blocks. Tier A (Node-only). Phase 1 of docs/plans/living-product-docs.md.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "ingcreators",
|
|
@@ -32,6 +32,10 @@
|
|
|
32
32
|
".": {
|
|
33
33
|
"types": "./dist/index.d.ts",
|
|
34
34
|
"default": "./dist/index.js"
|
|
35
|
+
},
|
|
36
|
+
"./annotations-yaml": {
|
|
37
|
+
"types": "./dist/annotations-yaml.d.ts",
|
|
38
|
+
"default": "./dist/annotations-yaml.js"
|
|
35
39
|
}
|
|
36
40
|
},
|
|
37
41
|
"bin": {
|
|
@@ -47,26 +51,27 @@
|
|
|
47
51
|
"access": "public"
|
|
48
52
|
},
|
|
49
53
|
"devDependencies": {
|
|
50
|
-
"@playwright/test": "^1.
|
|
54
|
+
"@playwright/test": "^1.61.1",
|
|
51
55
|
"@types/js-yaml": "^4.0.9",
|
|
52
56
|
"@types/mdast": "^4.0.4",
|
|
53
57
|
"@types/unist": "^3.0.3",
|
|
54
58
|
"typescript": "^6.0.3",
|
|
55
|
-
"vite": "^8.0.
|
|
56
|
-
"vite-plugin-dts": "^5.0.
|
|
59
|
+
"vite": "^8.0.16",
|
|
60
|
+
"vite-plugin-dts": "^5.0.3"
|
|
57
61
|
},
|
|
58
62
|
"dependencies": {
|
|
59
63
|
"js-yaml": "^4.1.1",
|
|
64
|
+
"playwright-core": "^1.61.1",
|
|
60
65
|
"remark-frontmatter": "^5.0.0",
|
|
61
66
|
"remark-mdx": "^3.1.1",
|
|
62
67
|
"remark-parse": "^11.0.0",
|
|
63
68
|
"remark-stringify": "^11.0.0",
|
|
64
|
-
"playwright-core": "^1.50.0",
|
|
65
69
|
"unified": "^11.0.5",
|
|
66
70
|
"unist-util-visit": "^5.0.0",
|
|
67
|
-
"zod": "^
|
|
68
|
-
"@ingcreators/annot-annotator": "0.
|
|
69
|
-
"@ingcreators/annot-
|
|
71
|
+
"zod": "^4.4.3",
|
|
72
|
+
"@ingcreators/annot-annotator": "0.6.0",
|
|
73
|
+
"@ingcreators/annot-core": "0.3.0",
|
|
74
|
+
"@ingcreators/annot-playwright": "0.4.1"
|
|
70
75
|
},
|
|
71
76
|
"peerDependencies": {
|
|
72
77
|
"@playwright/test": "^1.40.0"
|