@juxtapose/core 0.8.0 → 0.9.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/agent/handoff.d.ts +16 -0
- package/dist/agent/handoff.js +37 -2
- package/dist/agent/handoff.js.map +1 -1
- package/dist/analysis/affected.d.ts +17 -0
- package/dist/analysis/affected.js +34 -0
- package/dist/analysis/affected.js.map +1 -1
- package/dist/browser/flags.d.ts +14 -0
- package/dist/browser/flags.js +15 -0
- package/dist/browser/flags.js.map +1 -1
- package/dist/browser/page.d.ts +10 -0
- package/dist/browser/page.js +9 -3
- package/dist/browser/page.js.map +1 -1
- package/dist/capture/capture.d.ts +3 -1
- package/dist/capture/capture.js +81 -8
- package/dist/capture/capture.js.map +1 -1
- package/dist/capture/discover.d.ts +28 -0
- package/dist/capture/discover.js +109 -0
- package/dist/capture/discover.js.map +1 -0
- package/dist/capture/pool.d.ts +2 -0
- package/dist/capture/pool.js +1 -0
- package/dist/capture/pool.js.map +1 -1
- package/dist/capture/variants.d.ts +47 -0
- package/dist/capture/variants.js +192 -0
- package/dist/capture/variants.js.map +1 -0
- package/dist/diff/structural/deltas.d.ts +2 -3
- package/dist/diff/structural/deltas.js +3 -3
- package/dist/diff/structural/deltas.js.map +1 -1
- package/dist/index.d.ts +5 -3
- package/dist/index.js +6 -2
- package/dist/index.js.map +1 -1
- package/dist/platform.d.ts +20 -0
- package/dist/platforms/urls.js +5 -1
- package/dist/platforms/urls.js.map +1 -1
- package/dist/report/comment.js +19 -8
- package/dist/report/comment.js.map +1 -1
- package/dist/report/format.d.ts +17 -0
- package/dist/report/format.js +16 -0
- package/dist/report/format.js.map +1 -1
- package/dist/report/html.js +40 -6
- package/dist/report/html.js.map +1 -1
- package/dist/run/run.d.ts +2 -0
- package/dist/run/run.js +15 -0
- package/dist/run/run.js.map +1 -1
- package/dist/types.d.ts +47 -1
- package/package.json +1 -1
package/dist/types.d.ts
CHANGED
|
@@ -27,12 +27,41 @@ export interface StoryParams {
|
|
|
27
27
|
* stories whose play function or delay makes a keystroke-triggered capture
|
|
28
28
|
* cost more than it returns. Default true. */
|
|
29
29
|
liveCapture?: boolean;
|
|
30
|
+
/** Named capture variants of this story: each is captured, judged and
|
|
31
|
+
* approved on its own under the key `${storyId}__${name}`. `false` opts
|
|
32
|
+
* this story out of a project-wide variant of that name. */
|
|
33
|
+
variants?: Record<string, VariantSpec | false>;
|
|
34
|
+
/** Set on a variant's resolved params; a variant-only field. The default
|
|
35
|
+
* capture is always light, so a story's own `colorScheme` is ignored. */
|
|
36
|
+
colorScheme?: ColorScheme;
|
|
37
|
+
}
|
|
38
|
+
export type ColorScheme = 'light' | 'dark';
|
|
39
|
+
/** One named variant: any per-story option, plus a color scheme and the name
|
|
40
|
+
* of another variant to start from. `skip` is not a field; set the variant to
|
|
41
|
+
* `false` to drop it. */
|
|
42
|
+
export interface VariantSpec extends Omit<StoryParams, 'skip' | 'variants' | 'liveCapture'> {
|
|
43
|
+
colorScheme?: ColorScheme;
|
|
44
|
+
/** Another variant (of this story or the project) whose fields this one
|
|
45
|
+
* starts from. Chains resolve; a cycle or unknown name is a config error. */
|
|
46
|
+
extends?: string;
|
|
30
47
|
}
|
|
31
48
|
export type { Viewport } from './browser/types.js';
|
|
32
49
|
/** One capturable story, normalised across platforms. */
|
|
33
50
|
export interface StoryManifest {
|
|
34
|
-
/** Stable, URL-safe.
|
|
51
|
+
/** Stable, URL-safe. The capture key: the platform-native id (Storybook's
|
|
52
|
+
* `id`, Ladle's key) for a default capture, `${baseStoryId}__${variant}`
|
|
53
|
+
* for a variant. Everything keyed by story (manifest, baselines, run
|
|
54
|
+
* images, report.json) uses this. */
|
|
35
55
|
storyId: string;
|
|
56
|
+
/** Set on variant entries: the platform's own id, which every platform call
|
|
57
|
+
* receives. Absent on a default capture, where it equals `storyId`. */
|
|
58
|
+
baseStoryId?: string;
|
|
59
|
+
/** Set on variant entries: the variant's name. */
|
|
60
|
+
variant?: string;
|
|
61
|
+
/** Set on variant entries: the fields the variant and its `extends` chain
|
|
62
|
+
* set, already merged into `params`. Kept apart because live params merge
|
|
63
|
+
* under them — a variant's viewport must beat the story's own. */
|
|
64
|
+
variantParams?: Omit<VariantSpec, 'extends'>;
|
|
36
65
|
/** Group/kind, e.g. "Components/Button". */
|
|
37
66
|
title: string;
|
|
38
67
|
/** Story name within the group, e.g. "Primary". */
|
|
@@ -44,6 +73,9 @@ export interface StoryManifest {
|
|
|
44
73
|
}
|
|
45
74
|
export interface Snapshot {
|
|
46
75
|
storyId: string;
|
|
76
|
+
/** Copied from the StoryManifest: set only on a variant capture. */
|
|
77
|
+
baseStoryId?: string;
|
|
78
|
+
variant?: string;
|
|
47
79
|
/** WebP-encoded. PNG is an intermediate, never stored. */
|
|
48
80
|
image: Buffer;
|
|
49
81
|
viewport: Viewport;
|
|
@@ -222,7 +254,15 @@ export interface StructuralVerdict {
|
|
|
222
254
|
}
|
|
223
255
|
export type DiffStatus = 'pass' | 'fail' | 'new' | 'stale' | 'skip';
|
|
224
256
|
export interface DiffResult {
|
|
257
|
+
/** The capture key. */
|
|
225
258
|
storyId: string;
|
|
259
|
+
/** Set only on a variant capture, so reports can group without parsing keys. */
|
|
260
|
+
baseStoryId?: string;
|
|
261
|
+
variant?: string;
|
|
262
|
+
/** Set only on a variant capture: what the variant sets (its resolved
|
|
263
|
+
* `extends` chain). Recorded for the same reason as `viewport` — a handoff
|
|
264
|
+
* can say the conditions it was captured under without re-enumerating. */
|
|
265
|
+
variantParams?: Omit<VariantSpec, 'extends'>;
|
|
226
266
|
status: DiffStatus;
|
|
227
267
|
mismatchPixels: number;
|
|
228
268
|
mismatchPercent: number;
|
|
@@ -313,6 +353,8 @@ export interface UrlEntry {
|
|
|
313
353
|
/** Absolute, or relative to --origin. */
|
|
314
354
|
url: string;
|
|
315
355
|
params?: StoryParams;
|
|
356
|
+
/** Same as `params.variants`; the two are merged, and these win. */
|
|
357
|
+
variants?: Record<string, VariantSpec | false>;
|
|
316
358
|
}
|
|
317
359
|
/** Project config, from juxtapose.config.{ts,js,json} or package.json#juxtapose. */
|
|
318
360
|
export interface ProjectConfig {
|
|
@@ -335,6 +377,10 @@ export interface ProjectConfig {
|
|
|
335
377
|
viewport?: Viewport;
|
|
336
378
|
threshold?: number;
|
|
337
379
|
minDiffPercent?: number;
|
|
380
|
+
/** Variants every story gets, by name. A story's own variant of the same
|
|
381
|
+
* name wins; a story sets one to `false` to opt out. Applies to every
|
|
382
|
+
* platform, the urls list included. */
|
|
383
|
+
variants?: Record<string, VariantSpec | false>;
|
|
338
384
|
storage?: StorageConfig;
|
|
339
385
|
/** `jux mcp` settings. */
|
|
340
386
|
mcp?: {
|