@domandigital/craft 0.12.0 → 0.14.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 +26 -0
- package/CHARACTER.md +140 -1
- package/COPY.md +5 -0
- package/dist/{audit-5QWFLZ6L.js → audit-6WHR7ZTV.js} +7 -3
- package/dist/audit.cjs +1267 -165
- package/dist/audit.d.cts +95 -1
- package/dist/audit.d.ts +95 -1
- package/dist/audit.js +1265 -165
- package/dist/{chunk-J3QUROJ5.js → chunk-3OTKMKJQ.js} +66 -91
- package/dist/{chunk-PU5G5DUC.js → chunk-7T5WR74C.js} +27 -14
- package/dist/{chunk-AL6MRG6V.js → chunk-GQVEYTBY.js} +3592 -2173
- package/dist/{chunk-S3NZAVU6.js → chunk-OOZOEWGD.js} +1 -1
- package/dist/{chunk-CDAJUS5U.js → chunk-PBK6SYH5.js} +51 -16
- package/dist/{chunk-ULPI335S.js → chunk-Q7ILL2HV.js} +211 -10
- package/dist/chunk-QYBAVU3P.js +6 -0
- package/dist/{chunk-ZKVJ7K6X.js → chunk-WUACK2HX.js} +2 -1
- package/dist/chunk-XVBR2UPH.js +217 -0
- package/dist/cli-3CGUKXY4.js +19 -0
- package/dist/{cli-ZPJIWVEP.js → cli-O3CDSONO.js} +7 -8
- package/dist/{cli-ZB2VJ7CY.js → cli-WG3UJNUF.js} +15 -16
- package/dist/cli-WSHPSWVU.js +21 -0
- package/dist/{cli-C3JLFXMG.js → cli-Z2IQG3LC.js} +5 -5
- package/dist/cli.js +3 -2
- package/dist/index.cjs +1719 -636
- package/dist/index.d.cts +570 -196
- package/dist/index.d.ts +570 -196
- package/dist/index.js +1684 -636
- package/dist/migrate-VIFAYIBM.js +9 -0
- package/package.json +1 -1
- package/word-lists.json +1 -1
- package/dist/chunk-LHGY43LL.js +0 -462
- package/dist/chunk-PZ4MF2VV.js +0 -117
- package/dist/cli-2DY3V3SF.js +0 -17
- package/dist/cli-QM2AQQMF.js +0 -19
package/dist/audit.d.cts
CHANGED
|
@@ -93,6 +93,57 @@ interface SnapshotSection {
|
|
|
93
93
|
role?: SectionRole;
|
|
94
94
|
/** Version 2. */
|
|
95
95
|
geometry?: SectionGeometry;
|
|
96
|
+
/** Version 2: short pill or label texts in the section ("Most popular", "New"), at most 5. */
|
|
97
|
+
badges?: string[];
|
|
98
|
+
/** Version 2: small round portraits (at most 96px, roughly square, radius 40% or more). */
|
|
99
|
+
avatars?: number;
|
|
100
|
+
/** Version 2: a horizontal scroller, snap track or prev/next control holds the content. */
|
|
101
|
+
carousel?: boolean;
|
|
102
|
+
/** Version 2: large standalone figures ("500+", "98%", "4.9/5") at 24px or more. */
|
|
103
|
+
figures?: number;
|
|
104
|
+
/**
|
|
105
|
+
* Version 2, craft 0.13 and later: the section's visible text, one block per
|
|
106
|
+
* heading, paragraph, list item or quote, each at most 300 characters, at
|
|
107
|
+
* most 40. Navigation, buttons and footers are left out. What the
|
|
108
|
+
* specificity and proof tells read.
|
|
109
|
+
*/
|
|
110
|
+
text?: string[];
|
|
111
|
+
}
|
|
112
|
+
type ImageRole = "photo" | "illustration" | "icon" | "avatar" | "logo";
|
|
113
|
+
/**
|
|
114
|
+
* What the image's own bytes say about where it came from. Only a positive
|
|
115
|
+
* is evidence: most images carry no metadata at all, and a re-encode strips
|
|
116
|
+
* it, so no marker proves nothing.
|
|
117
|
+
*/
|
|
118
|
+
interface ImageProvenance {
|
|
119
|
+
/** The IPTC digital source type found, if any: "trainedAlgorithmicMedia" or "compositeWithTrainedAlgorithmicMedia". */
|
|
120
|
+
digitalSourceType: string | null;
|
|
121
|
+
/** Where the marker sat: an XMP packet, a C2PA manifest, or somewhere else in the file. */
|
|
122
|
+
source: "xmp" | "c2pa" | "other" | null;
|
|
123
|
+
/** The file carries a C2PA manifest (Content Credentials), whatever it says. */
|
|
124
|
+
c2pa: boolean;
|
|
125
|
+
/** Bytes read, from the start of the file. */
|
|
126
|
+
bytes: number;
|
|
127
|
+
}
|
|
128
|
+
/** One image as the visitor sees it: an `img`, or a CSS background large enough to be a picture. */
|
|
129
|
+
interface SnapshotImage {
|
|
130
|
+
/** The URL the browser loaded, unwrapped from an image optimiser (`/_next/image?url=`), or a `data:` URI cut to 64 characters. */
|
|
131
|
+
src: string;
|
|
132
|
+
/** Host of `src`, or null for a `data:` URI. */
|
|
133
|
+
host: string | null;
|
|
134
|
+
width: number;
|
|
135
|
+
height: number;
|
|
136
|
+
top: number;
|
|
137
|
+
role: ImageRole;
|
|
138
|
+
alt: string | null;
|
|
139
|
+
/** Empty alt, `aria-hidden` or `role="presentation"`. */
|
|
140
|
+
decorative: boolean;
|
|
141
|
+
/** Index into `sections`, or null when the image sits outside them. */
|
|
142
|
+
section: number | null;
|
|
143
|
+
/** A CSS `background-image`, not an `img`. */
|
|
144
|
+
background: boolean;
|
|
145
|
+
/** Present when the bytes were read. */
|
|
146
|
+
provenance?: ImageProvenance;
|
|
96
147
|
}
|
|
97
148
|
/**
|
|
98
149
|
* Measures of the rendered pixels, from a full-page screenshot (capped at
|
|
@@ -167,6 +218,18 @@ interface Snapshot {
|
|
|
167
218
|
rhythmVariance?: number | null;
|
|
168
219
|
/** Version 2: absent when the page could not be screenshotted. */
|
|
169
220
|
visual?: SnapshotVisual;
|
|
221
|
+
/**
|
|
222
|
+
* Version 2, craft 0.13 and later: every image on the page, largest first, at
|
|
223
|
+
* most 60. Absent in older snapshots, which the imagery tells never judge.
|
|
224
|
+
*/
|
|
225
|
+
images?: SnapshotImage[];
|
|
226
|
+
/**
|
|
227
|
+
* Version 2, craft 0.13 and later: the text a visitor reads before
|
|
228
|
+
* scrolling, at most 12 blocks. Navigation, a header without the headline,
|
|
229
|
+
* and the words on buttons and links are left out: this is the page's
|
|
230
|
+
* claim, not its menu or its calls to action.
|
|
231
|
+
*/
|
|
232
|
+
firstScreenText?: string[];
|
|
170
233
|
/** Set when a version 1 snapshot was read and upgraded in memory. */
|
|
171
234
|
migratedFrom?: 1;
|
|
172
235
|
/** The design-system measures trawl has collected since v7, kept so it can switch to this. */
|
|
@@ -326,6 +389,21 @@ interface FingerprintSection {
|
|
|
326
389
|
centred: number;
|
|
327
390
|
/** Content width over viewport width, 0 to 1. */
|
|
328
391
|
width: number;
|
|
392
|
+
/** Left-right balance of the content, 0 to 1. Component comparison only. */
|
|
393
|
+
symmetry?: number;
|
|
394
|
+
/** Buttons in the section. */
|
|
395
|
+
controls?: number;
|
|
396
|
+
/** Cards side by side. */
|
|
397
|
+
cards?: number;
|
|
398
|
+
/** The section's own background, or null when it is the page ground. */
|
|
399
|
+
background?: Oklch | null;
|
|
400
|
+
/** Badge texts ("Most popular"), lower-cased. */
|
|
401
|
+
badges?: string[];
|
|
402
|
+
/** Small round portraits. */
|
|
403
|
+
avatars?: number;
|
|
404
|
+
carousel?: boolean;
|
|
405
|
+
/** Large standalone figures. */
|
|
406
|
+
figures?: number;
|
|
329
407
|
}
|
|
330
408
|
interface Fingerprint {
|
|
331
409
|
version: 1 | 2;
|
|
@@ -393,6 +471,8 @@ interface SnapshotOptions {
|
|
|
393
471
|
timeoutMs?: number;
|
|
394
472
|
/** Take a screenshot and measure its pixels (`visual`). Default true. */
|
|
395
473
|
visual?: boolean;
|
|
474
|
+
/** Read the first bytes of the page's larger images for AI provenance markers. Default true. */
|
|
475
|
+
provenance?: boolean;
|
|
396
476
|
}
|
|
397
477
|
interface MinimalPage {
|
|
398
478
|
close?(): Promise<void>;
|
|
@@ -413,7 +493,21 @@ interface MinimalPage {
|
|
|
413
493
|
height: number;
|
|
414
494
|
};
|
|
415
495
|
}): Promise<Uint8Array>;
|
|
496
|
+
/** Optional: Playwright's request context, which fetches outside the page's CORS rules. Without it, no image gets `provenance`. */
|
|
497
|
+
request?: {
|
|
498
|
+
get(url: string, options?: {
|
|
499
|
+
headers?: Record<string, string>;
|
|
500
|
+
timeout?: number;
|
|
501
|
+
}): Promise<{
|
|
502
|
+
ok(): boolean;
|
|
503
|
+
body(): Promise<Uint8Array>;
|
|
504
|
+
}>;
|
|
505
|
+
};
|
|
416
506
|
}
|
|
507
|
+
/** At most this many images are read for provenance, largest first. */
|
|
508
|
+
declare const PROVENANCE_MAX_IMAGES = 24;
|
|
509
|
+
/** The most time the reads may take for one page, in ms, so a machine offline waits seconds, not minutes. */
|
|
510
|
+
declare const PROVENANCE_BUDGET_MS = 20000;
|
|
417
511
|
/** The most of a page the screenshot measures read, in CSS px. A long page is judged on its opening. */
|
|
418
512
|
declare const VISUAL_MAX_HEIGHT = 6000;
|
|
419
513
|
interface MinimalBrowser {
|
|
@@ -465,4 +559,4 @@ interface AuditResult {
|
|
|
465
559
|
/** Snapshot a URL, judge it against the rendered tells, and fingerprint it. */
|
|
466
560
|
declare function audit(url: string, options?: SnapshotOptions & CheckOptions): Promise<AuditResult>;
|
|
467
561
|
|
|
468
|
-
export { type AuditResult, type SnapshotOptions, type SnapshotResult, VISUAL_MAX_HEIGHT, audit, collectInPage, loadPlaywright, overlayInPage, snapshotPage, snapshotUrl, snapshotUrls };
|
|
562
|
+
export { type AuditResult, PROVENANCE_BUDGET_MS, PROVENANCE_MAX_IMAGES, type SnapshotOptions, type SnapshotResult, VISUAL_MAX_HEIGHT, audit, collectInPage, loadPlaywright, overlayInPage, snapshotPage, snapshotUrl, snapshotUrls };
|
package/dist/audit.d.ts
CHANGED
|
@@ -93,6 +93,57 @@ interface SnapshotSection {
|
|
|
93
93
|
role?: SectionRole;
|
|
94
94
|
/** Version 2. */
|
|
95
95
|
geometry?: SectionGeometry;
|
|
96
|
+
/** Version 2: short pill or label texts in the section ("Most popular", "New"), at most 5. */
|
|
97
|
+
badges?: string[];
|
|
98
|
+
/** Version 2: small round portraits (at most 96px, roughly square, radius 40% or more). */
|
|
99
|
+
avatars?: number;
|
|
100
|
+
/** Version 2: a horizontal scroller, snap track or prev/next control holds the content. */
|
|
101
|
+
carousel?: boolean;
|
|
102
|
+
/** Version 2: large standalone figures ("500+", "98%", "4.9/5") at 24px or more. */
|
|
103
|
+
figures?: number;
|
|
104
|
+
/**
|
|
105
|
+
* Version 2, craft 0.13 and later: the section's visible text, one block per
|
|
106
|
+
* heading, paragraph, list item or quote, each at most 300 characters, at
|
|
107
|
+
* most 40. Navigation, buttons and footers are left out. What the
|
|
108
|
+
* specificity and proof tells read.
|
|
109
|
+
*/
|
|
110
|
+
text?: string[];
|
|
111
|
+
}
|
|
112
|
+
type ImageRole = "photo" | "illustration" | "icon" | "avatar" | "logo";
|
|
113
|
+
/**
|
|
114
|
+
* What the image's own bytes say about where it came from. Only a positive
|
|
115
|
+
* is evidence: most images carry no metadata at all, and a re-encode strips
|
|
116
|
+
* it, so no marker proves nothing.
|
|
117
|
+
*/
|
|
118
|
+
interface ImageProvenance {
|
|
119
|
+
/** The IPTC digital source type found, if any: "trainedAlgorithmicMedia" or "compositeWithTrainedAlgorithmicMedia". */
|
|
120
|
+
digitalSourceType: string | null;
|
|
121
|
+
/** Where the marker sat: an XMP packet, a C2PA manifest, or somewhere else in the file. */
|
|
122
|
+
source: "xmp" | "c2pa" | "other" | null;
|
|
123
|
+
/** The file carries a C2PA manifest (Content Credentials), whatever it says. */
|
|
124
|
+
c2pa: boolean;
|
|
125
|
+
/** Bytes read, from the start of the file. */
|
|
126
|
+
bytes: number;
|
|
127
|
+
}
|
|
128
|
+
/** One image as the visitor sees it: an `img`, or a CSS background large enough to be a picture. */
|
|
129
|
+
interface SnapshotImage {
|
|
130
|
+
/** The URL the browser loaded, unwrapped from an image optimiser (`/_next/image?url=`), or a `data:` URI cut to 64 characters. */
|
|
131
|
+
src: string;
|
|
132
|
+
/** Host of `src`, or null for a `data:` URI. */
|
|
133
|
+
host: string | null;
|
|
134
|
+
width: number;
|
|
135
|
+
height: number;
|
|
136
|
+
top: number;
|
|
137
|
+
role: ImageRole;
|
|
138
|
+
alt: string | null;
|
|
139
|
+
/** Empty alt, `aria-hidden` or `role="presentation"`. */
|
|
140
|
+
decorative: boolean;
|
|
141
|
+
/** Index into `sections`, or null when the image sits outside them. */
|
|
142
|
+
section: number | null;
|
|
143
|
+
/** A CSS `background-image`, not an `img`. */
|
|
144
|
+
background: boolean;
|
|
145
|
+
/** Present when the bytes were read. */
|
|
146
|
+
provenance?: ImageProvenance;
|
|
96
147
|
}
|
|
97
148
|
/**
|
|
98
149
|
* Measures of the rendered pixels, from a full-page screenshot (capped at
|
|
@@ -167,6 +218,18 @@ interface Snapshot {
|
|
|
167
218
|
rhythmVariance?: number | null;
|
|
168
219
|
/** Version 2: absent when the page could not be screenshotted. */
|
|
169
220
|
visual?: SnapshotVisual;
|
|
221
|
+
/**
|
|
222
|
+
* Version 2, craft 0.13 and later: every image on the page, largest first, at
|
|
223
|
+
* most 60. Absent in older snapshots, which the imagery tells never judge.
|
|
224
|
+
*/
|
|
225
|
+
images?: SnapshotImage[];
|
|
226
|
+
/**
|
|
227
|
+
* Version 2, craft 0.13 and later: the text a visitor reads before
|
|
228
|
+
* scrolling, at most 12 blocks. Navigation, a header without the headline,
|
|
229
|
+
* and the words on buttons and links are left out: this is the page's
|
|
230
|
+
* claim, not its menu or its calls to action.
|
|
231
|
+
*/
|
|
232
|
+
firstScreenText?: string[];
|
|
170
233
|
/** Set when a version 1 snapshot was read and upgraded in memory. */
|
|
171
234
|
migratedFrom?: 1;
|
|
172
235
|
/** The design-system measures trawl has collected since v7, kept so it can switch to this. */
|
|
@@ -326,6 +389,21 @@ interface FingerprintSection {
|
|
|
326
389
|
centred: number;
|
|
327
390
|
/** Content width over viewport width, 0 to 1. */
|
|
328
391
|
width: number;
|
|
392
|
+
/** Left-right balance of the content, 0 to 1. Component comparison only. */
|
|
393
|
+
symmetry?: number;
|
|
394
|
+
/** Buttons in the section. */
|
|
395
|
+
controls?: number;
|
|
396
|
+
/** Cards side by side. */
|
|
397
|
+
cards?: number;
|
|
398
|
+
/** The section's own background, or null when it is the page ground. */
|
|
399
|
+
background?: Oklch | null;
|
|
400
|
+
/** Badge texts ("Most popular"), lower-cased. */
|
|
401
|
+
badges?: string[];
|
|
402
|
+
/** Small round portraits. */
|
|
403
|
+
avatars?: number;
|
|
404
|
+
carousel?: boolean;
|
|
405
|
+
/** Large standalone figures. */
|
|
406
|
+
figures?: number;
|
|
329
407
|
}
|
|
330
408
|
interface Fingerprint {
|
|
331
409
|
version: 1 | 2;
|
|
@@ -393,6 +471,8 @@ interface SnapshotOptions {
|
|
|
393
471
|
timeoutMs?: number;
|
|
394
472
|
/** Take a screenshot and measure its pixels (`visual`). Default true. */
|
|
395
473
|
visual?: boolean;
|
|
474
|
+
/** Read the first bytes of the page's larger images for AI provenance markers. Default true. */
|
|
475
|
+
provenance?: boolean;
|
|
396
476
|
}
|
|
397
477
|
interface MinimalPage {
|
|
398
478
|
close?(): Promise<void>;
|
|
@@ -413,7 +493,21 @@ interface MinimalPage {
|
|
|
413
493
|
height: number;
|
|
414
494
|
};
|
|
415
495
|
}): Promise<Uint8Array>;
|
|
496
|
+
/** Optional: Playwright's request context, which fetches outside the page's CORS rules. Without it, no image gets `provenance`. */
|
|
497
|
+
request?: {
|
|
498
|
+
get(url: string, options?: {
|
|
499
|
+
headers?: Record<string, string>;
|
|
500
|
+
timeout?: number;
|
|
501
|
+
}): Promise<{
|
|
502
|
+
ok(): boolean;
|
|
503
|
+
body(): Promise<Uint8Array>;
|
|
504
|
+
}>;
|
|
505
|
+
};
|
|
416
506
|
}
|
|
507
|
+
/** At most this many images are read for provenance, largest first. */
|
|
508
|
+
declare const PROVENANCE_MAX_IMAGES = 24;
|
|
509
|
+
/** The most time the reads may take for one page, in ms, so a machine offline waits seconds, not minutes. */
|
|
510
|
+
declare const PROVENANCE_BUDGET_MS = 20000;
|
|
417
511
|
/** The most of a page the screenshot measures read, in CSS px. A long page is judged on its opening. */
|
|
418
512
|
declare const VISUAL_MAX_HEIGHT = 6000;
|
|
419
513
|
interface MinimalBrowser {
|
|
@@ -465,4 +559,4 @@ interface AuditResult {
|
|
|
465
559
|
/** Snapshot a URL, judge it against the rendered tells, and fingerprint it. */
|
|
466
560
|
declare function audit(url: string, options?: SnapshotOptions & CheckOptions): Promise<AuditResult>;
|
|
467
561
|
|
|
468
|
-
export { type AuditResult, type SnapshotOptions, type SnapshotResult, VISUAL_MAX_HEIGHT, audit, collectInPage, loadPlaywright, overlayInPage, snapshotPage, snapshotUrl, snapshotUrls };
|
|
562
|
+
export { type AuditResult, PROVENANCE_BUDGET_MS, PROVENANCE_MAX_IMAGES, type SnapshotOptions, type SnapshotResult, VISUAL_MAX_HEIGHT, audit, collectInPage, loadPlaywright, overlayInPage, snapshotPage, snapshotUrl, snapshotUrls };
|