@ingcreators/annot-product-docs 0.4.1 → 0.5.1
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 +23 -0
- package/dist/config.d.ts +1 -1
- package/dist/fixture.d.ts +6 -31
- package/dist/index.d.ts +2 -2
- package/dist/index.js +78 -115
- package/package.json +5 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,28 @@
|
|
|
1
1
|
# @ingcreators/annot-product-docs
|
|
2
2
|
|
|
3
|
+
## 0.5.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies
|
|
8
|
+
- Updated dependencies
|
|
9
|
+
- Updated dependencies
|
|
10
|
+
- @ingcreators/annot-annotator@0.7.0
|
|
11
|
+
- @ingcreators/annot-core@0.4.0
|
|
12
|
+
- @ingcreators/annot-playwright@0.5.0
|
|
13
|
+
|
|
14
|
+
## 0.5.0
|
|
15
|
+
|
|
16
|
+
### Minor Changes
|
|
17
|
+
|
|
18
|
+
- **Breaking:** removed the deprecated Phase-3 back-compat aliases
|
|
19
|
+
(`Screen`, `ScreenCaptureOptions`, `captureScreen`, and the
|
|
20
|
+
`screen` fixture with its `.capture()` method), per the
|
|
21
|
+
deprecation window announced in the 0.3.x rename. Migrate to
|
|
22
|
+
`ProductDocs` / `ProductDocsSyncOptions` / `syncProductDocs` /
|
|
23
|
+
the `productDocs` fixture's `.sync()` — same behaviour, new
|
|
24
|
+
names only.
|
|
25
|
+
|
|
3
26
|
## 0.4.1
|
|
4
27
|
|
|
5
28
|
### Patch Changes
|
package/dist/config.d.ts
CHANGED
|
@@ -36,9 +36,9 @@ export declare const annotDocsConfigSchema: z.ZodObject<{
|
|
|
36
36
|
}, z.core.$strict>>;
|
|
37
37
|
editor: z.ZodOptional<z.ZodObject<{
|
|
38
38
|
embedMode: z.ZodOptional<z.ZodEnum<{
|
|
39
|
+
disabled: "disabled";
|
|
39
40
|
newTab: "newTab";
|
|
40
41
|
inline: "inline";
|
|
41
|
-
disabled: "disabled";
|
|
42
42
|
}>>;
|
|
43
43
|
cloudUrl: z.ZodOptional<z.ZodString>;
|
|
44
44
|
}, z.core.$strict>>;
|
package/dist/fixture.d.ts
CHANGED
|
@@ -18,29 +18,17 @@ export interface ProductDocsSyncOptions {
|
|
|
18
18
|
*/
|
|
19
19
|
attributeWhitelist?: readonly string[];
|
|
20
20
|
}
|
|
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
21
|
export interface ProductDocs {
|
|
30
22
|
sync(opts: ProductDocsSyncOptions): Promise<void>;
|
|
31
23
|
}
|
|
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;
|
|
40
24
|
/**
|
|
41
25
|
* HTML attributes captured into the `annot:attributes` block by
|
|
42
|
-
* default.
|
|
43
|
-
*
|
|
26
|
+
* default. Re-exports the canonical `ELEMENT_TREE_ATTR_WHITELIST`
|
|
27
|
+
* from `@ingcreators/annot-core/element-tree` (metadata-unification
|
|
28
|
+
* Phase 7) so every ElementTree producer — extension walker,
|
|
29
|
+
* Playwright adapter, this fixture — captures the SAME set.
|
|
30
|
+
* Note aria-* attributes are no longer captured here: state lives
|
|
31
|
+
* in `states` tokens, `attributes` carries element shape only.
|
|
44
32
|
*
|
|
45
33
|
* Hosts can override per-call via `opts.attributeWhitelist`.
|
|
46
34
|
*/
|
|
@@ -63,15 +51,11 @@ export declare const DEFAULT_ATTR_WHITELIST: readonly string[];
|
|
|
63
51
|
* });
|
|
64
52
|
* ```
|
|
65
53
|
*
|
|
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).
|
|
69
54
|
*/
|
|
70
55
|
export declare const test: import('@playwright/test').TestType<import('@playwright/test').PlaywrightTestArgs & import('@playwright/test').PlaywrightTestOptions & {
|
|
71
56
|
annotator: import('@ingcreators/annot-playwright').PlaywrightAnnotator;
|
|
72
57
|
} & {
|
|
73
58
|
productDocs: ProductDocs;
|
|
74
|
-
screen: ProductDocs;
|
|
75
59
|
}, import('@playwright/test').PlaywrightWorkerArgs & import('@playwright/test').PlaywrightWorkerOptions>;
|
|
76
60
|
/**
|
|
77
61
|
* Standalone sync helper — same behaviour as
|
|
@@ -86,15 +70,6 @@ export declare const test: import('@playwright/test').TestType<import('@playwrig
|
|
|
86
70
|
* the fixture refuses to touch non-annot MDX.
|
|
87
71
|
*/
|
|
88
72
|
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;
|
|
98
73
|
/**
|
|
99
74
|
* Walk the overlays in a `<Screen>`, resolve each one's `match`
|
|
100
75
|
* against the live page, and emit a YAML block of the form:
|
package/dist/index.d.ts
CHANGED
|
@@ -6,8 +6,8 @@ export type { LegacyOverlayUsage } from './deprecation.js';
|
|
|
6
6
|
export { _resetLegacyOverlayDedupForTests, formatLegacyOverlayWarning, warnLegacyOverlay, } from './deprecation.js';
|
|
7
7
|
export type { DetectDriftOptions, DriftFinding, DriftKind, DriftSeverity, } from './drift.js';
|
|
8
8
|
export { collectMatchKeysFromAnnotation, detectDrift, detectDriftFromElementTree, detectDriftFromYaml, elementTreeToSnapshotEntries, isLintableScreen, lintableScreens, summariseDrift, } from './drift.js';
|
|
9
|
-
export type { ProductDocs, ProductDocsSyncOptions,
|
|
10
|
-
export {
|
|
9
|
+
export type { ProductDocs, ProductDocsSyncOptions, } from './fixture.js';
|
|
10
|
+
export { collectAttributesYaml, DEFAULT_ATTR_WHITELIST, syncProductDocs, test, } from './fixture.js';
|
|
11
11
|
export type { ParseMdxOptions } from './mdx.js';
|
|
12
12
|
export { parseMdx, parseMdxFile, updateCommentBlocks } from './mdx.js';
|
|
13
13
|
export type { BoxedEntry } from './mdx-annotations.js';
|
package/dist/index.js
CHANGED
|
@@ -1,35 +1,36 @@
|
|
|
1
1
|
import { annotSourceResolvers as e, playwrightYamlToElementTree as t, test as n } from "@ingcreators/annot-playwright";
|
|
2
2
|
import { mkdir as r, readFile as i, readdir as a, writeFile as o } from "node:fs/promises";
|
|
3
|
-
import
|
|
4
|
-
import u from "
|
|
5
|
-
import d from "remark-
|
|
6
|
-
import f from "remark-
|
|
7
|
-
import
|
|
8
|
-
import {
|
|
3
|
+
import { ELEMENT_TREE_ATTR_WHITELIST as s } from "@ingcreators/annot-core/element-tree";
|
|
4
|
+
import c, { dump as l, load as u } from "js-yaml";
|
|
5
|
+
import d from "remark-frontmatter";
|
|
6
|
+
import f from "remark-mdx";
|
|
7
|
+
import ee from "remark-parse";
|
|
8
|
+
import { unified as te } from "unified";
|
|
9
|
+
import { visit as ne } from "unist-util-visit";
|
|
9
10
|
import { z as p } from "zod";
|
|
10
|
-
import { basename as
|
|
11
|
+
import { basename as re, dirname as m, isAbsolute as h, join as ie, relative as g, resolve as _ } from "node:path";
|
|
11
12
|
import { bboxAnnotationsToSvg as v } from "@ingcreators/annot-annotator";
|
|
12
|
-
import { findByMatch as
|
|
13
|
+
import { findByMatch as ae, walkTree as oe, writeElementTreePng as se } from "@ingcreators/annot-core";
|
|
13
14
|
//#region src/config.ts
|
|
14
|
-
var
|
|
15
|
+
var ce = p.enum([
|
|
15
16
|
"cover",
|
|
16
17
|
"history",
|
|
17
18
|
"list",
|
|
18
19
|
"screen",
|
|
19
20
|
"reference"
|
|
20
|
-
]),
|
|
21
|
+
]), le = p.object({
|
|
21
22
|
book: p.string().optional(),
|
|
22
23
|
sheet: p.string().optional(),
|
|
23
24
|
sheets: p.record(p.string(), p.string()).optional(),
|
|
24
|
-
role:
|
|
25
|
+
role: ce.optional(),
|
|
25
26
|
order: p.number().optional()
|
|
26
|
-
}).strict().refine((e) => !(e.sheet && e.sheets), "Specify either `xlsx.sheet` (single sheet) or `xlsx.sheets` (multi-sheet), not both."),
|
|
27
|
+
}).strict().refine((e) => !(e.sheet && e.sheets), "Specify either `xlsx.sheet` (single sheet) or `xlsx.sheets` (multi-sheet), not both."), ue = p.record(p.string(), p.unknown()), de = p.object({
|
|
27
28
|
id: p.string().min(1, "`annot.id` is required."),
|
|
28
29
|
title: p.string().optional(),
|
|
29
30
|
purpose: p.string().optional(),
|
|
30
|
-
meta:
|
|
31
|
-
xlsx:
|
|
32
|
-
}).strict(),
|
|
31
|
+
meta: ue.optional(),
|
|
32
|
+
xlsx: le.optional()
|
|
33
|
+
}).strict(), fe = p.object({
|
|
33
34
|
template: p.string().optional(),
|
|
34
35
|
templateSheets: p.object({
|
|
35
36
|
cover: p.string().optional(),
|
|
@@ -38,47 +39,47 @@ var se = p.enum([
|
|
|
38
39
|
screen: p.string().optional(),
|
|
39
40
|
reference: p.string().optional()
|
|
40
41
|
}).strict().optional()
|
|
41
|
-
}).strict(),
|
|
42
|
+
}).strict(), pe = p.object({
|
|
42
43
|
embedMode: p.enum([
|
|
43
44
|
"newTab",
|
|
44
45
|
"inline",
|
|
45
46
|
"disabled"
|
|
46
47
|
]).optional(),
|
|
47
48
|
cloudUrl: p.string().url("editor.cloudUrl must be an absolute URL").optional()
|
|
48
|
-
}).strict(),
|
|
49
|
+
}).strict(), me = p.object({
|
|
49
50
|
meta: p.record(p.string(), p.unknown()).optional(),
|
|
50
51
|
xlsx: p.object({
|
|
51
52
|
defaultBook: p.string().optional(),
|
|
52
|
-
books: p.record(p.string(),
|
|
53
|
+
books: p.record(p.string(), fe).optional()
|
|
53
54
|
}).strict().optional(),
|
|
54
|
-
editor:
|
|
55
|
+
editor: pe.optional()
|
|
55
56
|
}).strict();
|
|
56
|
-
function
|
|
57
|
-
let t =
|
|
57
|
+
function he(e) {
|
|
58
|
+
let t = me.safeParse(e);
|
|
58
59
|
if (!t.success) {
|
|
59
|
-
let e = t.error.issues.map((e) => ` - ${e.path.length ? e.path.join(".")
|
|
60
|
+
let e = t.error.issues.map((e) => ` - ${e.path.length ? `${e.path.join(".")}: ` : ""}${e.message}`).join("\n");
|
|
60
61
|
throw Error(`Invalid \`annot-docs.config.ts\`:\n${e}`);
|
|
61
62
|
}
|
|
62
63
|
return t.data;
|
|
63
64
|
}
|
|
64
|
-
function
|
|
65
|
+
function ge(e) {
|
|
65
66
|
return (e.xlsx?.role ?? "screen") === "screen";
|
|
66
67
|
}
|
|
67
68
|
//#endregion
|
|
68
69
|
//#region src/mdx.ts
|
|
69
|
-
var
|
|
70
|
+
var _e = "annot:snapshot", ve = "/annot:snapshot", ye = "annot:attributes", be = "/annot:attributes", xe = /^\s*\/\*\s*([^\s*]+)\s*([\s\S]*?)\*\/\s*$/;
|
|
70
71
|
async function y(e) {
|
|
71
|
-
return
|
|
72
|
+
return Se(await i(e, "utf8"), { filePath: e });
|
|
72
73
|
}
|
|
73
|
-
function
|
|
74
|
-
let n =
|
|
74
|
+
function Se(e, t = {}) {
|
|
75
|
+
let n = te().use(ee).use(d, ["yaml"]).use(f).parse(e), r = Ce(n, t.filePath);
|
|
75
76
|
if (!r) return null;
|
|
76
77
|
let i = [], a = [], o = [], s = [], c = {};
|
|
77
|
-
return
|
|
78
|
+
return ne(n, (t) => {
|
|
78
79
|
switch (t.type) {
|
|
79
80
|
case "mdxJsxFlowElement":
|
|
80
81
|
case "mdxJsxTextElement":
|
|
81
|
-
|
|
82
|
+
Te(t, e, {
|
|
82
83
|
screens: i,
|
|
83
84
|
transitions: a,
|
|
84
85
|
history: o,
|
|
@@ -87,7 +88,7 @@ function xe(e, t = {}) {
|
|
|
87
88
|
return;
|
|
88
89
|
case "mdxFlowExpression":
|
|
89
90
|
case "mdxTextExpression":
|
|
90
|
-
|
|
91
|
+
Me(t, c);
|
|
91
92
|
return;
|
|
92
93
|
}
|
|
93
94
|
}), {
|
|
@@ -100,49 +101,49 @@ function xe(e, t = {}) {
|
|
|
100
101
|
source: e
|
|
101
102
|
};
|
|
102
103
|
}
|
|
103
|
-
function
|
|
104
|
+
function Ce(e, t) {
|
|
104
105
|
let n = e.children.find((e) => e.type === "yaml");
|
|
105
|
-
if (!n
|
|
106
|
-
let r =
|
|
106
|
+
if (!n?.value) return null;
|
|
107
|
+
let r = c.load(n.value);
|
|
107
108
|
if (!r || typeof r != "object") return null;
|
|
108
109
|
let i = r.annot;
|
|
109
110
|
if (!i || typeof i != "object") return null;
|
|
110
|
-
let a =
|
|
111
|
+
let a = de.safeParse(i);
|
|
111
112
|
if (!a.success) {
|
|
112
113
|
let e = t ? ` in ${t}` : "";
|
|
113
|
-
throw Error(`Invalid \`annot:\` frontmatter${e}:\n${
|
|
114
|
+
throw Error(`Invalid \`annot:\` frontmatter${e}:\n${we(a.error)}`);
|
|
114
115
|
}
|
|
115
116
|
return a.data;
|
|
116
117
|
}
|
|
117
|
-
function
|
|
118
|
-
return e.issues.map((e) => ` - ${e.path.length ? e.path.map(String).join(".")
|
|
118
|
+
function we(e) {
|
|
119
|
+
return e.issues.map((e) => ` - ${e.path.length ? `${e.path.map(String).join(".")}: ` : ""}${e.message}`).join("\n");
|
|
119
120
|
}
|
|
120
|
-
function
|
|
121
|
+
function Te(e, t, n) {
|
|
121
122
|
let r = e;
|
|
122
123
|
switch (r.name) {
|
|
123
124
|
case "Screen":
|
|
124
|
-
n.screens.push(
|
|
125
|
+
n.screens.push(Ee(r, t));
|
|
125
126
|
return;
|
|
126
127
|
case "Transition":
|
|
127
|
-
n.transitions.push(
|
|
128
|
+
n.transitions.push(ke(r, t));
|
|
128
129
|
return;
|
|
129
130
|
case "HistoryEntry":
|
|
130
|
-
n.history.push(
|
|
131
|
+
n.history.push(Ae(r, t));
|
|
131
132
|
return;
|
|
132
133
|
case "ScreenList":
|
|
133
|
-
n.screenLists.push(
|
|
134
|
+
n.screenLists.push(je(r));
|
|
134
135
|
return;
|
|
135
136
|
}
|
|
136
137
|
}
|
|
137
|
-
function
|
|
138
|
+
function Ee(e, t) {
|
|
138
139
|
let n = b(e), r = [], i = [], a = (n) => {
|
|
139
140
|
let o = n;
|
|
140
141
|
if (o.name === "Overlay") {
|
|
141
|
-
r.push(
|
|
142
|
+
r.push(Oe(o, t));
|
|
142
143
|
return;
|
|
143
144
|
}
|
|
144
145
|
if (o.name === "AnnotCallout") {
|
|
145
|
-
i.push(
|
|
146
|
+
i.push(De(o, t));
|
|
146
147
|
return;
|
|
147
148
|
}
|
|
148
149
|
if (!(o.name === "Screen" && o !== e)) for (let e of o.children ?? []) a(e);
|
|
@@ -158,7 +159,7 @@ function Te(e, t) {
|
|
|
158
159
|
};
|
|
159
160
|
return s && (c.annotations = s), c;
|
|
160
161
|
}
|
|
161
|
-
function
|
|
162
|
+
function De(e, t) {
|
|
162
163
|
let n = x(b(e).for);
|
|
163
164
|
if (!n) throw Error("<AnnotCallout> requires a `for=\"<overlay id>\"` prop.");
|
|
164
165
|
return {
|
|
@@ -166,17 +167,17 @@ function Ee(e, t) {
|
|
|
166
167
|
body: C(e, t)
|
|
167
168
|
};
|
|
168
169
|
}
|
|
169
|
-
function
|
|
170
|
+
function Oe(e, t) {
|
|
170
171
|
let n = b(e), r = n.match;
|
|
171
172
|
if (!S(r)) throw Error("<Overlay> requires a `match` prop with at least `{ role, name }`.");
|
|
172
173
|
return {
|
|
173
174
|
match: r,
|
|
174
175
|
intent: x(n.intent),
|
|
175
|
-
number:
|
|
176
|
+
number: Pe(n.number),
|
|
176
177
|
body: C(e, t)
|
|
177
178
|
};
|
|
178
179
|
}
|
|
179
|
-
function
|
|
180
|
+
function ke(e, t) {
|
|
180
181
|
let n = b(e), r = n.trigger;
|
|
181
182
|
if (!S(r)) throw Error("<Transition> requires a `trigger` prop with at least `{ role, name }`.");
|
|
182
183
|
return {
|
|
@@ -186,7 +187,7 @@ function Oe(e, t) {
|
|
|
186
187
|
body: C(e, t)
|
|
187
188
|
};
|
|
188
189
|
}
|
|
189
|
-
function
|
|
190
|
+
function Ae(e, t) {
|
|
190
191
|
let n = b(e), r = x(n.version) ?? "", i = x(n.date) ?? "", a = x(n.author) ?? "";
|
|
191
192
|
if (!r || !i) throw Error("<HistoryEntry> requires `version` and `date` props.");
|
|
192
193
|
return {
|
|
@@ -196,28 +197,28 @@ function ke(e, t) {
|
|
|
196
197
|
body: C(e, t)
|
|
197
198
|
};
|
|
198
199
|
}
|
|
199
|
-
function
|
|
200
|
+
function je(e) {
|
|
200
201
|
let t = b(e);
|
|
201
202
|
return {
|
|
202
203
|
book: x(t.book),
|
|
203
204
|
sort: x(t.sort)
|
|
204
205
|
};
|
|
205
206
|
}
|
|
206
|
-
function
|
|
207
|
+
function Me(e, t) {
|
|
207
208
|
let n = e.value;
|
|
208
209
|
if (typeof n != "string") return;
|
|
209
|
-
let r = n.match(
|
|
210
|
+
let r = n.match(xe);
|
|
210
211
|
if (!r) return;
|
|
211
212
|
let i = (r[1] ?? "").trim(), a = (r[2] ?? "").trim();
|
|
212
213
|
switch (i) {
|
|
213
|
-
case
|
|
214
|
+
case _e:
|
|
214
215
|
t.snapshot = a;
|
|
215
216
|
return;
|
|
216
|
-
case
|
|
217
|
+
case ye:
|
|
217
218
|
t.attributes = a;
|
|
218
219
|
return;
|
|
219
|
-
case
|
|
220
|
-
case
|
|
220
|
+
case ve:
|
|
221
|
+
case be: return;
|
|
221
222
|
}
|
|
222
223
|
}
|
|
223
224
|
function b(e) {
|
|
@@ -234,11 +235,11 @@ function b(e) {
|
|
|
234
235
|
continue;
|
|
235
236
|
}
|
|
236
237
|
let r = e.value;
|
|
237
|
-
r.type === "mdxJsxAttributeValueExpression" && typeof r.value == "string" && (t[e.name] =
|
|
238
|
+
r.type === "mdxJsxAttributeValueExpression" && typeof r.value == "string" && (t[e.name] = Ne(r.value));
|
|
238
239
|
}
|
|
239
240
|
return t;
|
|
240
241
|
}
|
|
241
|
-
function
|
|
242
|
+
function Ne(e) {
|
|
242
243
|
let t = e.trim();
|
|
243
244
|
if (t) {
|
|
244
245
|
if (t === "true") return !0;
|
|
@@ -272,7 +273,7 @@ function Me(e) {
|
|
|
272
273
|
function x(e) {
|
|
273
274
|
return typeof e == "string" ? e : void 0;
|
|
274
275
|
}
|
|
275
|
-
function
|
|
276
|
+
function Pe(e) {
|
|
276
277
|
return typeof e == "number" ? e : void 0;
|
|
277
278
|
}
|
|
278
279
|
function S(e) {
|
|
@@ -290,49 +291,24 @@ function C(e, t) {
|
|
|
290
291
|
}
|
|
291
292
|
function w(e, t) {
|
|
292
293
|
let n = e;
|
|
293
|
-
return t.snapshot !== void 0 && (n = T(n,
|
|
294
|
+
return t.snapshot !== void 0 && (n = T(n, _e, t.snapshot)), t.attributes !== void 0 && (n = T(n, ye, t.attributes)), n;
|
|
294
295
|
}
|
|
295
296
|
function T(e, t, n) {
|
|
296
|
-
let r = new RegExp(String.raw`\{\s*/\*\s*` +
|
|
297
|
+
let r = new RegExp(String.raw`\{\s*/\*\s*` + Ie(t) + String.raw`\s*[\s\S]*?\*/\s*\}`, "m"), i = Fe(t, n);
|
|
297
298
|
return r.test(e) ? e.replace(r, i) : `${e.trimEnd()}\n\n${i}\n`;
|
|
298
299
|
}
|
|
299
|
-
function
|
|
300
|
+
function Fe(e, t) {
|
|
300
301
|
let n = t.trim();
|
|
301
302
|
return n ? `{/* ${e}\n${n}\n*/}` : `{/* ${e} */}`;
|
|
302
303
|
}
|
|
303
|
-
function
|
|
304
|
+
function Ie(e) {
|
|
304
305
|
return e.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
305
306
|
}
|
|
306
307
|
//#endregion
|
|
307
308
|
//#region src/fixture.ts
|
|
308
|
-
var E =
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
"placeholder",
|
|
312
|
-
"maxlength",
|
|
313
|
-
"minlength",
|
|
314
|
-
"pattern",
|
|
315
|
-
"min",
|
|
316
|
-
"max",
|
|
317
|
-
"step",
|
|
318
|
-
"disabled",
|
|
319
|
-
"readonly",
|
|
320
|
-
"checked",
|
|
321
|
-
"aria-required",
|
|
322
|
-
"aria-disabled",
|
|
323
|
-
"aria-readonly"
|
|
324
|
-
], Ie = n.extend({
|
|
325
|
-
productDocs: async ({ page: e }, t) => {
|
|
326
|
-
await t({ sync: (t) => D(e, t) });
|
|
327
|
-
},
|
|
328
|
-
screen: async ({ page: e }, t) => {
|
|
329
|
-
let n = (t) => D(e, t);
|
|
330
|
-
await t({
|
|
331
|
-
sync: n,
|
|
332
|
-
capture: n
|
|
333
|
-
});
|
|
334
|
-
}
|
|
335
|
-
});
|
|
309
|
+
var E = s, Le = n.extend({ productDocs: async ({ page: e }, t) => {
|
|
310
|
+
await t({ sync: (t) => D(e, t) });
|
|
311
|
+
} });
|
|
336
312
|
async function D(e, t) {
|
|
337
313
|
let n = await y(t.mdxPath);
|
|
338
314
|
if (!n) throw Error(`syncProductDocs: ${t.mdxPath} has no \`annot:\` frontmatter — refusing to write.`);
|
|
@@ -347,7 +323,6 @@ async function D(e, t) {
|
|
|
347
323
|
});
|
|
348
324
|
await o(t.mdxPath, s, "utf8");
|
|
349
325
|
}
|
|
350
|
-
var Le = D;
|
|
351
326
|
async function O(e, t, n) {
|
|
352
327
|
let r = [];
|
|
353
328
|
for (let i of t) {
|
|
@@ -396,7 +371,7 @@ function k(e) {
|
|
|
396
371
|
}
|
|
397
372
|
function Re(e) {
|
|
398
373
|
let t = [];
|
|
399
|
-
return
|
|
374
|
+
return oe(e, (e) => {
|
|
400
375
|
e.bbox && e.name && t.push({
|
|
401
376
|
role: e.role,
|
|
402
377
|
name: e.name,
|
|
@@ -736,7 +711,7 @@ var dt = 1, P = [
|
|
|
736
711
|
function ft(e) {
|
|
737
712
|
let t;
|
|
738
713
|
try {
|
|
739
|
-
t =
|
|
714
|
+
t = u(e);
|
|
740
715
|
} catch (t) {
|
|
741
716
|
throw new F(`Failed to parse annotations yaml: ${t.message}`, e);
|
|
742
717
|
}
|
|
@@ -773,7 +748,7 @@ function pt(e) {
|
|
|
773
748
|
version: e.version,
|
|
774
749
|
overlays: e.overlays.map(gt)
|
|
775
750
|
};
|
|
776
|
-
return e.annotations && e.annotations.length > 0 && (t.annotations = e.annotations.map(Ot)), e.meta && Object.keys(e.meta).length > 0 && (t.meta = { ...e.meta }),
|
|
751
|
+
return e.annotations && e.annotations.length > 0 && (t.annotations = e.annotations.map(Ot)), e.meta && Object.keys(e.meta).length > 0 && (t.meta = { ...e.meta }), l(t, {
|
|
777
752
|
lineWidth: -1,
|
|
778
753
|
noRefs: !0,
|
|
779
754
|
sortKeys: !1
|
|
@@ -1434,7 +1409,7 @@ function Ht(e) {
|
|
|
1434
1409
|
}
|
|
1435
1410
|
function Ut(e) {
|
|
1436
1411
|
let t = [];
|
|
1437
|
-
return
|
|
1412
|
+
return oe(e, (e, n) => {
|
|
1438
1413
|
!e.role || !e.name || t.push({
|
|
1439
1414
|
role: e.role,
|
|
1440
1415
|
name: e.name,
|
|
@@ -1623,7 +1598,7 @@ function tn(e) {
|
|
|
1623
1598
|
screenId: e.screenId,
|
|
1624
1599
|
src: e.src
|
|
1625
1600
|
});
|
|
1626
|
-
let t = h(e.src) ? e.src : _(m(e.mdxPath), e.src), n =
|
|
1601
|
+
let t = h(e.src) ? e.src : _(m(e.mdxPath), e.src), n = re(t).replace(/\.(png|jpe?g|webp|gif|svg)$/i, "");
|
|
1627
1602
|
return _(m(t), `${n}.annotations.yaml`);
|
|
1628
1603
|
}
|
|
1629
1604
|
function nn(e, t) {
|
|
@@ -1670,19 +1645,7 @@ function Y(e) {
|
|
|
1670
1645
|
}
|
|
1671
1646
|
//#endregion
|
|
1672
1647
|
//#region src/migrate-to-element-tree.ts
|
|
1673
|
-
var on =
|
|
1674
|
-
"type",
|
|
1675
|
-
"required",
|
|
1676
|
-
"placeholder",
|
|
1677
|
-
"name",
|
|
1678
|
-
"id",
|
|
1679
|
-
"href",
|
|
1680
|
-
"aria-checked",
|
|
1681
|
-
"aria-expanded",
|
|
1682
|
-
"aria-selected",
|
|
1683
|
-
"aria-disabled",
|
|
1684
|
-
"aria-invalid"
|
|
1685
|
-
];
|
|
1648
|
+
var on = s;
|
|
1686
1649
|
async function sn(e, t = {}) {
|
|
1687
1650
|
let n = await y(e);
|
|
1688
1651
|
if (!n) return {
|
|
@@ -1730,7 +1693,7 @@ async function sn(e, t = {}) {
|
|
|
1730
1693
|
});
|
|
1731
1694
|
continue;
|
|
1732
1695
|
}
|
|
1733
|
-
await o(n,
|
|
1696
|
+
await o(n, se(await i(n), l)), s.push({
|
|
1734
1697
|
id: c.id,
|
|
1735
1698
|
pngPath: n,
|
|
1736
1699
|
xmpWritten: !0
|
|
@@ -1759,7 +1722,7 @@ function cn(e) {
|
|
|
1759
1722
|
capturedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
1760
1723
|
}), r = ln(e.attributesYaml, e.whitelist);
|
|
1761
1724
|
for (let e of r) {
|
|
1762
|
-
let t =
|
|
1725
|
+
let t = ae(n, {
|
|
1763
1726
|
role: e.role,
|
|
1764
1727
|
name: e.name
|
|
1765
1728
|
});
|
|
@@ -2113,7 +2076,7 @@ async function Q(e) {
|
|
|
2113
2076
|
throw e;
|
|
2114
2077
|
}
|
|
2115
2078
|
for (let i of r) {
|
|
2116
|
-
let r =
|
|
2079
|
+
let r = ie(e, i.name);
|
|
2117
2080
|
if (i.isDirectory()) {
|
|
2118
2081
|
if (i.name === "node_modules" || i.name.startsWith(".")) continue;
|
|
2119
2082
|
n.push(r);
|
|
@@ -2137,4 +2100,4 @@ function Tn(e) {
|
|
|
2137
2100
|
}
|
|
2138
2101
|
}
|
|
2139
2102
|
//#endregion
|
|
2140
|
-
export { dt as ANNOTATIONS_YAML_VERSION, P as ANNOTATION_KINDS, F as AnnotationsYamlError, E as DEFAULT_ATTR_WHITELIST, Pt as _resetLegacyOverlayDedupForTests,
|
|
2103
|
+
export { dt as ANNOTATIONS_YAML_VERSION, P as ANNOTATION_KINDS, F as AnnotationsYamlError, E as DEFAULT_ATTR_WHITELIST, Pt as _resetLegacyOverlayDedupForTests, me as annotDocsConfigSchema, de as annotFrontmatterSchema, $t as buildAnnotationsFile, ze as buildBadgeAnnotations, Be as buildBadgeAnnotationsFromYaml, We as buildRasterRedactRegionsFromYaml, Ue as buildShapeAnnotationsFromYaml, O as collectAttributesYaml, Zt as collectMatchKeysFromAnnotation, he as defineConfig, K as detectDrift, Wt as detectDriftFromElementTree, Ht as detectDriftFromYaml, Re as elementTreeToBoxedEntries, Ut as elementTreeToSnapshotEntries, st as emptyAnnotationsSvg, $ as filterAnnotMdxFiles, Nt as formatLegacyOverlayWarning, Xt as isLintableScreen, ge as isScreenRole, J as lintableScreens, pn as main, Qt as migrateOverlaysToAnnotationsFile, ft as parseAnnotationsYaml, Se as parseMdx, y as parseMdxFile, G as parseSnapshot, k as parseSnapshotBoxes, Ft as resolveMatch, Ve as resolveMdxAnnotations, It as resolveOverlays, pt as serializeAnnotationsYaml, q as summariseDrift, He as svgFromBadges, ot as svgFromBboxAnnotations, D as syncProductDocs, Le as test, w as updateCommentBlocks, Q as walkMdx, Mt as warnLegacyOverlay };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ingcreators/annot-product-docs",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.1",
|
|
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",
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
"@types/mdast": "^4.0.4",
|
|
57
57
|
"@types/unist": "^3.0.3",
|
|
58
58
|
"typescript": "^6.0.3",
|
|
59
|
-
"vite": "^8.
|
|
59
|
+
"vite": "^8.1.3",
|
|
60
60
|
"vite-plugin-dts": "^5.0.3"
|
|
61
61
|
},
|
|
62
62
|
"dependencies": {
|
|
@@ -69,9 +69,9 @@
|
|
|
69
69
|
"unified": "^11.0.5",
|
|
70
70
|
"unist-util-visit": "^5.0.0",
|
|
71
71
|
"zod": "^4.4.3",
|
|
72
|
-
"@ingcreators/annot-
|
|
73
|
-
"@ingcreators/annot-
|
|
74
|
-
"@ingcreators/annot-playwright": "0.
|
|
72
|
+
"@ingcreators/annot-annotator": "0.7.0",
|
|
73
|
+
"@ingcreators/annot-core": "0.4.0",
|
|
74
|
+
"@ingcreators/annot-playwright": "0.5.0"
|
|
75
75
|
},
|
|
76
76
|
"peerDependencies": {
|
|
77
77
|
"@playwright/test": "^1.40.0"
|