@cappa/plugin-storybook 0.11.2 → 0.12.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/dist/index.cjs.cjs +1 -0
- package/dist/index.cjs.d.cts +17 -1
- package/dist/index.esm.d.mts +17 -1
- package/dist/index.esm.mjs +1 -0
- package/package.json +3 -3
package/dist/index.cjs.cjs
CHANGED
|
@@ -355,6 +355,7 @@ const cappaPluginStorybook = (options) => {
|
|
|
355
355
|
}
|
|
356
356
|
const baseOptions = {
|
|
357
357
|
fullPage: storyParameters?.fullPage,
|
|
358
|
+
crop: storyParameters?.crop ?? options?.crop,
|
|
358
359
|
delay: storyParameters?.delay,
|
|
359
360
|
omitBackground: storyParameters?.omitBackground,
|
|
360
361
|
skip: storyParameters?.skip,
|
package/dist/index.cjs.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DiffOptions, Plugin } from "@cappa/core";
|
|
1
|
+
import { CropSetting, DiffOptions, Plugin } from "@cappa/core";
|
|
2
2
|
//#region src/types.d.ts
|
|
3
3
|
interface StorybookRenderOptions {
|
|
4
4
|
viewMode?: "story" | "docs";
|
|
@@ -11,6 +11,12 @@ interface StorybookRenderOptions {
|
|
|
11
11
|
type DiffOptionsStorybook = DiffOptions;
|
|
12
12
|
interface ScreenshotVariantOverrideStorybook {
|
|
13
13
|
fullPage?: boolean;
|
|
14
|
+
/**
|
|
15
|
+
* Crop the screenshot to what the story renders instead of the whole
|
|
16
|
+
* viewport. `true` crops with 8px of padding; `{ padding }` changes it.
|
|
17
|
+
* Overrides the plugin's and the config's `crop`.
|
|
18
|
+
*/
|
|
19
|
+
crop?: CropSetting;
|
|
14
20
|
delay?: number;
|
|
15
21
|
skip?: boolean;
|
|
16
22
|
mask?: string[];
|
|
@@ -85,6 +91,16 @@ interface StorybookPluginOptions {
|
|
|
85
91
|
waitForSelector?: string;
|
|
86
92
|
waitForTimeout?: number;
|
|
87
93
|
storybook?: StorybookRenderOptions;
|
|
94
|
+
/**
|
|
95
|
+
* Crop every story's screenshot to the content it renders instead of the
|
|
96
|
+
* whole viewport — see `screenshot.crop` in the cappa config, which this
|
|
97
|
+
* overrides for this plugin. A story or variant can override it in turn
|
|
98
|
+
* with its own `crop` parameter.
|
|
99
|
+
*
|
|
100
|
+
* The viewport stays what the story is laid out at, so responsive styles
|
|
101
|
+
* are unaffected; it becomes the most a screenshot can cover.
|
|
102
|
+
*/
|
|
103
|
+
crop?: CropSetting;
|
|
88
104
|
/**
|
|
89
105
|
* Globs, relative to the working directory, that watch mode should watch on
|
|
90
106
|
* top of the project sources it watches anyway.
|
package/dist/index.esm.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DiffOptions, Plugin } from "@cappa/core";
|
|
1
|
+
import { CropSetting, DiffOptions, Plugin } from "@cappa/core";
|
|
2
2
|
//#region src/types.d.ts
|
|
3
3
|
interface StorybookRenderOptions {
|
|
4
4
|
viewMode?: "story" | "docs";
|
|
@@ -11,6 +11,12 @@ interface StorybookRenderOptions {
|
|
|
11
11
|
type DiffOptionsStorybook = DiffOptions;
|
|
12
12
|
interface ScreenshotVariantOverrideStorybook {
|
|
13
13
|
fullPage?: boolean;
|
|
14
|
+
/**
|
|
15
|
+
* Crop the screenshot to what the story renders instead of the whole
|
|
16
|
+
* viewport. `true` crops with 8px of padding; `{ padding }` changes it.
|
|
17
|
+
* Overrides the plugin's and the config's `crop`.
|
|
18
|
+
*/
|
|
19
|
+
crop?: CropSetting;
|
|
14
20
|
delay?: number;
|
|
15
21
|
skip?: boolean;
|
|
16
22
|
mask?: string[];
|
|
@@ -85,6 +91,16 @@ interface StorybookPluginOptions {
|
|
|
85
91
|
waitForSelector?: string;
|
|
86
92
|
waitForTimeout?: number;
|
|
87
93
|
storybook?: StorybookRenderOptions;
|
|
94
|
+
/**
|
|
95
|
+
* Crop every story's screenshot to the content it renders instead of the
|
|
96
|
+
* whole viewport — see `screenshot.crop` in the cappa config, which this
|
|
97
|
+
* overrides for this plugin. A story or variant can override it in turn
|
|
98
|
+
* with its own `crop` parameter.
|
|
99
|
+
*
|
|
100
|
+
* The viewport stays what the story is laid out at, so responsive styles
|
|
101
|
+
* are unaffected; it becomes the most a screenshot can cover.
|
|
102
|
+
*/
|
|
103
|
+
crop?: CropSetting;
|
|
88
104
|
/**
|
|
89
105
|
* Globs, relative to the working directory, that watch mode should watch on
|
|
90
106
|
* top of the project sources it watches anyway.
|
package/dist/index.esm.mjs
CHANGED
|
@@ -355,6 +355,7 @@ const cappaPluginStorybook = (options) => {
|
|
|
355
355
|
}
|
|
356
356
|
const baseOptions = {
|
|
357
357
|
fullPage: storyParameters?.fullPage,
|
|
358
|
+
crop: storyParameters?.crop ?? options?.crop,
|
|
358
359
|
delay: storyParameters?.delay,
|
|
359
360
|
omitBackground: storyParameters?.omitBackground,
|
|
360
361
|
skip: storyParameters?.skip,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cappa/plugin-storybook",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.12.1",
|
|
4
4
|
"description": "Storybook plugin for Cappa - takes screenshots of Storybook stories",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -76,7 +76,7 @@
|
|
|
76
76
|
}
|
|
77
77
|
},
|
|
78
78
|
"dependencies": {
|
|
79
|
-
"@cappa/core": "0.
|
|
79
|
+
"@cappa/core": "0.18.0",
|
|
80
80
|
"@cappa/logger": "0.0.12",
|
|
81
81
|
"@swc/core": "^1.16.2",
|
|
82
82
|
"chalk": "^6.0.0"
|
|
@@ -85,7 +85,7 @@
|
|
|
85
85
|
"@arethetypeswrong/cli": "0.18.5",
|
|
86
86
|
"@types/node": "25.9.3",
|
|
87
87
|
"@vitest/coverage-v8": "5.0.0",
|
|
88
|
-
"@vitest/ui": "5.0.
|
|
88
|
+
"@vitest/ui": "5.0.5",
|
|
89
89
|
"playwright-core": "^1.63.0",
|
|
90
90
|
"storybook": "^10.6.0",
|
|
91
91
|
"tsdown": "0.23.0",
|