storybook-addon-vis 0.19.4 → 1.0.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.
Files changed (41) hide show
  1. package/dist/chunk-O5DYZDLL.js +37 -0
  2. package/dist/chunk-O5DYZDLL.js.map +1 -0
  3. package/dist/index.d.ts +32 -8
  4. package/dist/index.js +15 -33
  5. package/dist/index.js.map +1 -1
  6. package/dist/manager.js +2 -0
  7. package/dist/manager.js.map +1 -0
  8. package/dist/matcher.d.ts +1 -1
  9. package/dist/preset.cjs +1 -1
  10. package/dist/preset.cjs.map +1 -1
  11. package/dist/vitest-plugin.d.ts +5 -21
  12. package/dist/vitest-plugin.js.map +1 -1
  13. package/dist/vitest-setup.d.ts +10 -4
  14. package/dist/vitest-setup.js +16 -2
  15. package/dist/vitest-setup.js.map +1 -1
  16. package/manager.js +1 -0
  17. package/package.json +39 -25
  18. package/readme.md +112 -30
  19. package/src/client/expect/to_match_image_snapshot.ts +4 -3
  20. package/src/client/has_image_snapshot.ts +3 -17
  21. package/src/client/storybook/param.ts +9 -13
  22. package/src/client/storybook/tags.ts +3 -0
  23. package/src/client/vitest_proxy.ts +3 -20
  24. package/src/components/vis_panel.tsx +60 -0
  25. package/src/index.ts +3 -1
  26. package/src/manager.tsx +40 -0
  27. package/src/preset.ts +23 -1
  28. package/src/preview/vis_annotation.ts +2 -2
  29. package/src/server/create_storybook_vis_server.ts +62 -0
  30. package/src/server/vis_options.ts +26 -0
  31. package/src/shared/contants.ts +1 -0
  32. package/src/shared/events.ts +33 -0
  33. package/src/shared/global_matcher_augment.ts +1 -1
  34. package/src/vitest-plugin/storybook_vis.ts +4 -1
  35. package/src/vitest-setup.ts +6 -3
  36. package/dist/chunk-KMYH24SZ.js +0 -21
  37. package/dist/chunk-KMYH24SZ.js.map +0 -1
  38. package/dist/preview.d.ts +0 -15
  39. package/dist/preview.js +0 -2
  40. package/dist/preview.js.map +0 -1
  41. package/src/preview.ts +0 -5
@@ -0,0 +1,37 @@
1
+ import { expect } from '@storybook/test';
2
+ import { success, matchImageSnapshotAction, toTaskId } from 'vitest-plugin-vis/client-api';
3
+
4
+ // src/client/vitest_proxy.ts
5
+ var browserContext;
6
+ var vitestSuite;
7
+ if (globalThis.__vitest_browser__) {
8
+ import('@vitest/browser/context').then((m) => {
9
+ browserContext = m;
10
+ });
11
+ import('vitest/suite').then((m) => {
12
+ vitestSuite = m;
13
+ });
14
+ }
15
+ var commands = new Proxy({}, {
16
+ get(_target, prop) {
17
+ return browserContext?.commands?.[prop];
18
+ }
19
+ });
20
+ var getCurrentTest = () => vitestSuite?.getCurrentTest();
21
+ function toMatchImageSnapshot(subject, options) {
22
+ const test = getCurrentTest();
23
+ if (!test) return Promise.resolve(success);
24
+ return matchImageSnapshotAction(commands, toTaskId(test), subject, options).then(() => success);
25
+ }
26
+
27
+ // src/client/storybook/expect_extend.ts
28
+ expect.extend({ toMatchImageSnapshot });
29
+
30
+ // src/client/storybook/tags.ts
31
+ function isSnapshotEnabled(tags) {
32
+ return tags.lastIndexOf("!snapshot") < tags.lastIndexOf("snapshot");
33
+ }
34
+
35
+ export { commands, getCurrentTest, isSnapshotEnabled };
36
+ //# sourceMappingURL=chunk-O5DYZDLL.js.map
37
+ //# sourceMappingURL=chunk-O5DYZDLL.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/client/vitest_proxy.ts","../src/client/expect/to_match_image_snapshot.ts","../src/client/storybook/expect_extend.ts","../src/client/storybook/tags.ts"],"names":[],"mappings":";;;;AAGA,IAAI,cAAA;AACJ,IAAI,WAAA;AAEJ,IAAK,WAAmB,kBAAoB,EAAA;AAC3C,EAAA,OAAO,yBAAyB,CAAA,CAAE,IAAK,CAAA,CAAC,CAAM,KAAA;AAC7C,IAAiB,cAAA,GAAA,CAAA;AAAA,GACjB,CAAA;AACD,EAAA,OAAO,cAAc,CAAA,CAAE,IAAK,CAAA,CAAC,CAAM,KAAA;AAClC,IAAc,WAAA,GAAA,CAAA;AAAA,GACd,CAAA;AACF;AAEO,IAAM,QAAW,GAAA,IAAI,KAAuB,CAAA,EAAW,EAAA;AAAA,EAC7D,GAAA,CAAI,SAAS,IAAM,EAAA;AAClB,IAAQ,OAAA,cAAA,EAAgB,WAAmB,IAAI,CAAA;AAAA;AAEjD,CAAC;AAEY,IAAA,cAAA,GAAiB,MAC7B,WAAA,EAAa,cAAe;ACZtB,SAAS,oBAAA,CAKf,SACA,OACyB,EAAA;AACzB,EAAA,MAAM,OAAO,cAAe,EAAA;AAG5B,EAAA,IAAI,CAAC,IAAA,EAAa,OAAA,OAAA,CAAQ,QAAQ,OAAO,CAAA;AAGzC,EAAO,OAAA,wBAAA,CAAyB,QAAU,EAAA,QAAA,CAAS,IAAI,CAAA,EAAG,SAAS,OAAO,CAAA,CAAE,IAAK,CAAA,MAAM,OAAO,CAAA;AAC/F;;;ACtBA,MAAO,CAAA,MAAA,CAAO,EAAE,oBAAA,EAAsB,CAAA;;;ACH/B,SAAS,kBAAkB,IAAgB,EAAA;AACjD,EAAA,OAAO,KAAK,WAAY,CAAA,WAAW,CAAI,GAAA,IAAA,CAAK,YAAY,UAAU,CAAA;AACnE","file":"chunk-O5DYZDLL.js","sourcesContent":["import type { BrowserCommands } from '@vitest/browser/context'\nimport type { SnapshotTestMeta } from 'vitest-plugin-vis/client-api'\n\nlet browserContext: Awaited<typeof import('@vitest/browser/context')>\nlet vitestSuite: Awaited<typeof import('vitest/suite')>\n\nif ((globalThis as any).__vitest_browser__) {\n\timport('@vitest/browser/context').then((m) => {\n\t\tbrowserContext = m\n\t})\n\timport('vitest/suite').then((m) => {\n\t\tvitestSuite = m\n\t})\n}\n\nexport const commands = new Proxy<BrowserCommands>({} as any, {\n\tget(_target, prop) {\n\t\treturn (browserContext?.commands as any)?.[prop]\n\t},\n})\n\nexport const getCurrentTest = () =>\n\tvitestSuite?.getCurrentTest() as (ReturnType<typeof vitestSuite.getCurrentTest> & SnapshotTestMeta) | undefined\n","import type { AsyncExpectationResult } from '@vitest/expect'\nimport {\n\ttype ComparisonMethod,\n\ttype ToMatchImageSnapshotOptions,\n\tmatchImageSnapshotAction,\n\tsuccess,\n\ttoTaskId,\n} from 'vitest-plugin-vis/client-api'\nimport { commands, getCurrentTest } from '../vitest_proxy.ts'\n\nexport function toMatchImageSnapshot<M extends ComparisonMethod>(\n\t/**\n\t * The element or locator to take the snapshot of,\n\t * or the base64 value of the image to compare against.\n\t */\n\tsubject: any,\n\toptions?: ToMatchImageSnapshotOptions<M> | undefined,\n): AsyncExpectationResult {\n\tconst test = getCurrentTest()\n\n\t/* v8 ignore start: stub as success when not in a test (e.g. in a story) */\n\tif (!test) return Promise.resolve(success)\n\t/* v8 ignore end */\n\n\treturn matchImageSnapshotAction(commands, toTaskId(test), subject, options).then(() => success)\n}\n","import { expect } from '@storybook/test'\nimport { toMatchImageSnapshot } from '../expect/to_match_image_snapshot.ts'\n\nexpect.extend({ toMatchImageSnapshot })\n","export function isSnapshotEnabled(tags: string[]) {\n\treturn tags.lastIndexOf('!snapshot') < tags.lastIndexOf('snapshot')\n}\n"]}
package/dist/index.d.ts CHANGED
@@ -1,21 +1,45 @@
1
1
  import './matcher.js';
2
2
  export * from 'vitest-plugin-vis';
3
- import { ComparisonMethod, ToMatchImageSnapshotOptions, AutoSnapshotOptions, ImageSnapshotTimeoutOptions, ImageSnapshotIdOptions, SsimComparisonOptions, PixelComparisonOptions, FailureThresholdOptions } from 'vitest-plugin-vis/client';
4
- export { AutoSnapshotOptions, ComparisonMethod, FailureThresholdOptions, ImageSnapshotCompareOptions, ImageSnapshotIdOptions, ImageSnapshotTimeoutOptions, PixelComparisonOptions, SsimComparisonOptions, ToMatchImageSnapshotOptions } from 'vitest-plugin-vis/client';
3
+ import { ImageSnapshotKeyOptions, ComparisonMethod, ToMatchImageSnapshotOptions, ImageSnapshotSubjectOptions, ImageSnapshotTimeoutOptions, SsimComparisonOptions, PixelComparisonOptions, FailureThresholdOptions } from 'vitest-plugin-vis/client-api';
4
+ export { ComparisonMethod, FailureThresholdOptions, ImageSnapshotCompareOptions, ImageSnapshotKeyOptions, ImageSnapshotSubjectOptions, ImageSnapshotTimeoutOptions, PixelComparisonOptions, SsimComparisonOptions, ToMatchImageSnapshotOptions } from 'vitest-plugin-vis/client-api';
5
+
6
+ /**
7
+ * Check if the snapshot image exists.
8
+ */
9
+ declare function hasImageSnapshot(options?: ImageSnapshotKeyOptions | undefined): false | Promise<boolean>;
5
10
 
6
11
  /**
7
12
  * Define snapshot parameter for auto snapshot.
8
13
  */
9
- declare function defineAutoSnapshotParam<M extends ComparisonMethod>(snapshot: ToMatchImageSnapshotOptions<M> & AutoSnapshotOptions): {
10
- snapshot: ImageSnapshotTimeoutOptions & ImageSnapshotIdOptions & (M extends "ssim" ? SsimComparisonOptions<M> : PixelComparisonOptions<M>) & FailureThresholdOptions & {
14
+ declare function defineAutoSnapshotParam<M extends ComparisonMethod>(snapshot: ToMatchImageSnapshotOptions<M> & ImageSnapshotSubjectOptions): {
15
+ snapshot: ImageSnapshotTimeoutOptions & ImageSnapshotKeyOptions & (M extends "ssim" ? SsimComparisonOptions<M> : PixelComparisonOptions<M>) & FailureThresholdOptions & {
11
16
  expectToFail?: boolean | undefined;
12
- } & AutoSnapshotOptions;
17
+ } & ImageSnapshotSubjectOptions;
13
18
  };
19
+
14
20
  declare function isSnapshotEnabled(tags: string[]): boolean;
15
21
 
16
22
  /**
17
- * Check if the snapshot image exists.
23
+ * Configuration options for visual testing suites in Storybook.
24
+ *
25
+ * @param options.visProjects Array of visual testing project configurations
26
+ * @param options.visProjects[].snapshotRootDir Root directory for storing snapshots. Can be a string path or a function that returns a path based on CI and platform context
27
+ * @param options.visProjects[].snapshotSubpath Optional function to customize the snapshot subdirectory path
28
+ */
29
+ type StorybookVisOptions = {
30
+ visProjects: Array<{
31
+ snapshotRootDir: string | ((context: {
32
+ ci: boolean;
33
+ platform: string;
34
+ }) => string) | undefined;
35
+ snapshotSubpath?: ((options: {
36
+ subpath: string;
37
+ }) => string) | undefined;
38
+ }>;
39
+ };
40
+ /**
41
+ * Define options for Storybook Visual Testing addon.
18
42
  */
19
- declare function hasImageSnapshot(options?: ImageSnapshotIdOptions | undefined): false | Promise<boolean>;
43
+ declare function defineStorybookVisOptions(options: StorybookVisOptions): StorybookVisOptions;
20
44
 
21
- export { defineAutoSnapshotParam, hasImageSnapshot, isSnapshotEnabled };
45
+ export { type StorybookVisOptions, defineAutoSnapshotParam, defineStorybookVisOptions, hasImageSnapshot, isSnapshotEnabled };
package/dist/index.js CHANGED
@@ -1,24 +1,7 @@
1
- import { getCurrentTest, commands } from './chunk-KMYH24SZ.js';
2
- import { expect } from '@storybook/test';
3
- import { success, imageSnapshotMatcher, toTaskId } from 'vitest-plugin-vis/client';
1
+ import { getCurrentTest, commands } from './chunk-O5DYZDLL.js';
2
+ export { isSnapshotEnabled } from './chunk-O5DYZDLL.js';
4
3
  export * from 'vitest-plugin-vis';
5
-
6
- function toMatchImageSnapshot(subject, options) {
7
- const test = getCurrentTest();
8
- if (!test) return Promise.resolve(success);
9
- return imageSnapshotMatcher(commands)(test, subject, options).then(() => success);
10
- }
11
-
12
- // src/client/storybook/expect_extend.ts
13
- expect.extend({ toMatchImageSnapshot });
14
-
15
- // src/client/storybook/param.ts
16
- function defineAutoSnapshotParam(snapshot) {
17
- return { snapshot };
18
- }
19
- function isSnapshotEnabled(tags) {
20
- return tags.lastIndexOf("!snapshot") < tags.lastIndexOf("snapshot");
21
- }
4
+ import { hasImageSnapshotAction, toTaskId } from 'vitest-plugin-vis/client-api';
22
5
 
23
6
  // src/client/ctx.ts
24
7
  var ctx = {
@@ -32,20 +15,19 @@ var ctx = {
32
15
  function hasImageSnapshot(options) {
33
16
  const test = ctx.getCurrentTest();
34
17
  if (!test) return false;
35
- const taskId = toTaskId(test);
36
- const isAutoSnapshot = !!test.meta.vis?.isAutoSnapshot;
37
- if (options?.customizeSnapshotId) {
38
- return commands.imageSnapshotNextIndex(taskId).then(
39
- (index) => commands.hasImageSnapshot(
40
- taskId,
41
- options.customizeSnapshotId({ id: taskId, index, isAutoSnapshot }),
42
- isAutoSnapshot
43
- )
44
- );
45
- }
46
- return commands.hasImageSnapshot(taskId, void 0, isAutoSnapshot);
18
+ return hasImageSnapshotAction(commands, toTaskId(test), options);
19
+ }
20
+
21
+ // src/client/storybook/param.ts
22
+ function defineAutoSnapshotParam(snapshot) {
23
+ return { snapshot };
24
+ }
25
+
26
+ // src/server/vis_options.ts
27
+ function defineStorybookVisOptions(options) {
28
+ return options;
47
29
  }
48
30
 
49
- export { defineAutoSnapshotParam, hasImageSnapshot, isSnapshotEnabled };
31
+ export { defineAutoSnapshotParam, defineStorybookVisOptions, hasImageSnapshot };
50
32
  //# sourceMappingURL=index.js.map
51
33
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/client/expect/to_match_image_snapshot.ts","../src/client/storybook/expect_extend.ts","../src/client/storybook/param.ts","../src/client/ctx.ts","../src/client/has_image_snapshot.ts"],"names":[],"mappings":";;;;;AASO,SAAS,oBAAA,CAKf,SACA,OACyB,EAAA;AACzB,EAAA,MAAM,OAAO,cAAe,EAAA;AAG5B,EAAA,IAAI,CAAC,IAAA,EAAa,OAAA,OAAA,CAAQ,QAAQ,OAAO,CAAA;AAGzC,EAAO,OAAA,oBAAA,CAAqB,QAAQ,CAAE,CAAA,IAAA,EAAM,SAAS,OAAO,CAAA,CAAE,IAAK,CAAA,MAAM,OAAO,CAAA;AACjF;;;ACrBA,MAAO,CAAA,MAAA,CAAO,EAAE,oBAAA,EAAsB,CAAA;;;ACyB/B,SAAS,wBACf,QACC,EAAA;AACD,EAAA,OAAO,EAAE,QAAS,EAAA;AACnB;AAEO,SAAS,kBAAkB,IAAgB,EAAA;AACjD,EAAA,OAAO,KAAK,WAAY,CAAA,WAAW,CAAI,GAAA,IAAA,CAAK,YAAY,UAAU,CAAA;AACnE;;;AClCO,IAAM,GAAM,GAAA;AAAA,EAClB,cAAA;AAAA,EACA,aAAgB,GAAA;AACf,IAAA,GAAA,CAAI,cAAiB,GAAA,cAAA;AAAA;AAEvB,CAAA;;;ACAO,SAAS,iBAAiB,OAA8C,EAAA;AAC9E,EAAM,MAAA,IAAA,GAAO,IAAI,cAAe,EAAA;AAChC,EAAI,IAAA,CAAC,MAAa,OAAA,KAAA;AAElB,EAAM,MAAA,MAAA,GAAS,SAAS,IAAI,CAAA;AAC5B,EAAA,MAAM,cAAiB,GAAA,CAAC,CAAC,IAAA,CAAK,KAAK,GAAK,EAAA,cAAA;AACxC,EAAA,IAAI,SAAS,mBAAqB,EAAA;AACjC,IAAO,OAAA,QAAA,CACL,sBAAuB,CAAA,MAAM,CAC7B,CAAA,IAAA;AAAA,MAAK,CAAC,UACN,QAAS,CAAA,gBAAA;AAAA,QACR,MAAA;AAAA,QACA,QAAQ,mBAAqB,CAAA,EAAE,IAAI,MAAQ,EAAA,KAAA,EAAO,gBAAgB,CAAA;AAAA,QAClE;AAAA;AACD,KACD;AAAA;AAGF,EAAA,OAAO,QAAS,CAAA,gBAAA,CAAiB,MAAQ,EAAA,KAAA,CAAA,EAAW,cAAc,CAAA;AACnE","file":"index.js","sourcesContent":["import type { AsyncExpectationResult } from '@vitest/expect'\nimport {\n\ttype ComparisonMethod,\n\ttype ToMatchImageSnapshotOptions,\n\timageSnapshotMatcher,\n\tsuccess,\n} from 'vitest-plugin-vis/client'\nimport { commands, getCurrentTest } from '../vitest_proxy.ts'\n\nexport function toMatchImageSnapshot<M extends ComparisonMethod>(\n\t/**\n\t * The element or locator to take the snapshot of,\n\t * or the base64 value of the image to compare against.\n\t */\n\tsubject: any,\n\toptions?: ToMatchImageSnapshotOptions<M> | undefined,\n): AsyncExpectationResult {\n\tconst test = getCurrentTest()\n\n\t/* v8 ignore start: stub as success when not in a test (e.g. in a story) */\n\tif (!test) return Promise.resolve(success)\n\t/* v8 ignore end */\n\n\treturn imageSnapshotMatcher(commands)(test, subject, options).then(() => success)\n}\n","import { expect } from '@storybook/test'\nimport { toMatchImageSnapshot } from '../expect/to_match_image_snapshot.ts'\n\nexpect.extend({ toMatchImageSnapshot })\n","import type {\n\tAutoSnapshotOptions,\n\tComparisonMethod,\n\tFailureThresholdOptions,\n\tImageSnapshotCompareOptions,\n\tImageSnapshotIdOptions,\n\tImageSnapshotTimeoutOptions,\n\tPixelComparisonOptions,\n\tSsimComparisonOptions,\n\tToMatchImageSnapshotOptions,\n} from 'vitest-plugin-vis/client'\n\n// This fix the inferred type cannot be named error\nexport type {\n\tAutoSnapshotOptions,\n\tComparisonMethod,\n\tImageSnapshotCompareOptions,\n\tImageSnapshotIdOptions,\n\tImageSnapshotTimeoutOptions,\n\tToMatchImageSnapshotOptions,\n\tSsimComparisonOptions,\n\tPixelComparisonOptions,\n\tFailureThresholdOptions,\n}\n\n/**\n * Define snapshot parameter for auto snapshot.\n */\nexport function defineAutoSnapshotParam<M extends ComparisonMethod>(\n\tsnapshot: ToMatchImageSnapshotOptions<M> & AutoSnapshotOptions,\n) {\n\treturn { snapshot }\n}\n\nexport function isSnapshotEnabled(tags: string[]) {\n\treturn tags.lastIndexOf('!snapshot') < tags.lastIndexOf('snapshot')\n}\n","import { getCurrentTest } from './vitest_proxy.ts'\n\nexport const ctx = {\n\tgetCurrentTest,\n\t__test__reset() {\n\t\tctx.getCurrentTest = getCurrentTest\n\t},\n}\n","import { type ImageSnapshotIdOptions, toTaskId } from 'vitest-plugin-vis/client'\nimport { ctx } from './ctx.ts'\nimport { commands } from './vitest_proxy.ts'\n\n/**\n * Check if the snapshot image exists.\n */\nexport function hasImageSnapshot(options?: ImageSnapshotIdOptions | undefined) {\n\tconst test = ctx.getCurrentTest()\n\tif (!test) return false\n\n\tconst taskId = toTaskId(test)\n\tconst isAutoSnapshot = !!test.meta.vis?.isAutoSnapshot\n\tif (options?.customizeSnapshotId) {\n\t\treturn commands\n\t\t\t.imageSnapshotNextIndex(taskId)\n\t\t\t.then((index) =>\n\t\t\t\tcommands.hasImageSnapshot(\n\t\t\t\t\ttaskId,\n\t\t\t\t\toptions.customizeSnapshotId!({ id: taskId, index, isAutoSnapshot }),\n\t\t\t\t\tisAutoSnapshot,\n\t\t\t\t),\n\t\t\t)\n\t}\n\n\treturn commands.hasImageSnapshot(taskId, undefined, isAutoSnapshot)\n}\n"]}
1
+ {"version":3,"sources":["../src/client/ctx.ts","../src/client/has_image_snapshot.ts","../src/client/storybook/param.ts","../src/server/vis_options.ts"],"names":[],"mappings":";;;;;;AAEO,IAAM,GAAM,GAAA;AAAA,EAClB,cAAA;AAAA,EACA,aAAgB,GAAA;AACf,IAAA,GAAA,CAAI,cAAiB,GAAA,cAAA;AAAA;AAEvB,CAAA;;;ACAO,SAAS,iBAAiB,OAA+C,EAAA;AAC/E,EAAM,MAAA,IAAA,GAAO,IAAI,cAAe,EAAA;AAChC,EAAI,IAAA,CAAC,MAAa,OAAA,KAAA;AAElB,EAAA,OAAO,sBAAuB,CAAA,QAAA,EAAU,QAAS,CAAA,IAAI,GAAG,OAAO,CAAA;AAChE;;;ACgBO,SAAS,wBACf,QACC,EAAA;AACD,EAAA,OAAO,EAAE,QAAS,EAAA;AACnB;;;ACTO,SAAS,0BAA0B,OAA8B,EAAA;AACvE,EAAO,OAAA,OAAA;AACR","file":"index.js","sourcesContent":["import { getCurrentTest } from './vitest_proxy.ts'\n\nexport const ctx = {\n\tgetCurrentTest,\n\t__test__reset() {\n\t\tctx.getCurrentTest = getCurrentTest\n\t},\n}\n","import { hasImageSnapshotAction, toTaskId, type ImageSnapshotKeyOptions } from 'vitest-plugin-vis/client-api'\nimport { ctx } from './ctx.ts'\nimport { commands } from './vitest_proxy.ts'\n\n/**\n * Check if the snapshot image exists.\n */\nexport function hasImageSnapshot(options?: ImageSnapshotKeyOptions | undefined) {\n\tconst test = ctx.getCurrentTest()\n\tif (!test) return false\n\n\treturn hasImageSnapshotAction(commands, toTaskId(test), options)\n}\n","import type {\n\tComparisonMethod,\n\tFailureThresholdOptions,\n\tImageSnapshotCompareOptions,\n\tImageSnapshotKeyOptions,\n\tImageSnapshotSubjectOptions,\n\tImageSnapshotTimeoutOptions,\n\tPixelComparisonOptions,\n\tSsimComparisonOptions,\n\tToMatchImageSnapshotOptions,\n} from 'vitest-plugin-vis/client-api'\n\n// This fix the inferred type cannot be named error\nexport type {\n\tComparisonMethod,\n\tFailureThresholdOptions,\n\tImageSnapshotCompareOptions,\n\tImageSnapshotKeyOptions,\n\tImageSnapshotSubjectOptions,\n\tImageSnapshotTimeoutOptions,\n\tPixelComparisonOptions,\n\tSsimComparisonOptions,\n\tToMatchImageSnapshotOptions,\n}\n\n/**\n * Define snapshot parameter for auto snapshot.\n */\nexport function defineAutoSnapshotParam<M extends ComparisonMethod>(\n\tsnapshot: ToMatchImageSnapshotOptions<M> & ImageSnapshotSubjectOptions,\n) {\n\treturn { snapshot }\n}\n","/**\n * Configuration options for visual testing suites in Storybook.\n *\n * @param options.visProjects Array of visual testing project configurations\n * @param options.visProjects[].snapshotRootDir Root directory for storing snapshots. Can be a string path or a function that returns a path based on CI and platform context\n * @param options.visProjects[].snapshotSubpath Optional function to customize the snapshot subdirectory path\n */\nexport type StorybookVisOptions = {\n\tvisProjects: Array<{\n\t\tsnapshotRootDir:\n\t\t\t| string\n\t\t\t| ((context: {\n\t\t\t\t\tci: boolean\n\t\t\t\t\tplatform: string\n\t\t\t }) => string)\n\t\t\t| undefined\n\t\tsnapshotSubpath?: ((options: { subpath: string }) => string) | undefined\n\t}>\n}\n\n/**\n * Define options for Storybook Visual Testing addon.\n */\nexport function defineStorybookVisOptions(options: StorybookVisOptions) {\n\treturn options\n}\n"]}
@@ -0,0 +1,2 @@
1
+ import {memo,useState,useEffect}from'react';import {addons,types}from'storybook/internal/manager-api';import {AddonPanel,ScrollArea,Placeholder}from'storybook/internal/components';import {styled}from'storybook/internal/theming';import {SNAPSHOT_ROOT_DIR}from'vitest-plugin-vis/client-api';import {jsx,jsxs,Fragment}from'react/jsx-runtime';var g=memo(function({active:a,snapshotResults:r=[]}){let p=r.reduce((t,e)=>{let S=`(${e.snapshotRootDir.slice(SNAPSHOT_ROOT_DIR.length+1)}) ${e.fileName}`;return t[S]=[...t[S]??[],e],t},{});return jsx(AddonPanel,{active:a,children:r.length>0?jsx(ScrollArea,{vertical:true,children:Object.entries(p).map(([t,e])=>jsx("div",{children:e.some(s=>s.type==="diff")?jsxs(Fragment,{children:[jsx(m,{failed:true,children:t}),e.map(s=>jsx("img",{src:`data:image/png;base64,${s.base64}`,alt:s.fileName},s.filePath))]}):jsxs(Fragment,{children:[jsx(m,{children:t}),jsx("img",{src:`data:image/png;base64,${e[0].base64}`,alt:e[0].fileName},e[0].filePath)]})},t))}):jsx(Placeholder,{children:"There is no snapshots for this story"})})}),m=styled.div(({theme:o,failed:a})=>({paddingBlock:"0.5rem",paddingInline:"0.2rem",backgroundColor:a?o.background.negative:o.background.positive,color:o.barTextColor}));var i="storybook-addon-vis",E=`${i}/vis_panel`;var A="IMAGE_SNAPSHOT_RESULTS_REQUEST",h="IMAGE_SNAPSHOT_RESULTS_RESPONSE";function u({name:o,importPath:a}){return {type:A,name:o,importPath:a}}addons.register(i,o=>{addons.add(E,{type:types.PANEL,title:"Vis",match:({tabId:a,viewMode:r})=>!a&&r==="story",render({active:a}){if(!a)return null;let[r,p]=useState([]),t=o.getCurrentStoryData();return useEffect(()=>{let e=o.on(i,s=>{s.name===t.name&&s.importPath===t.importPath&&s.type===h&&p(s.results);});return o.emit(i,u(t)),e},[t]),jsx(g,{active:a,snapshotResults:r})}});});//# sourceMappingURL=manager.js.map
2
+ //# sourceMappingURL=manager.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/components/vis_panel.tsx","../src/shared/contants.ts","../src/shared/events.ts","../src/manager.tsx"],"names":["VisPanel","memo","active","snapshotResults","groupedResults","acc","result","key","SNAPSHOT_ROOT_DIR","jsx","AddonPanel","ScrollArea","results","jsxs","Fragment","SnapshotRow","Placeholder","styled","theme","failed","NAME","VIS_PANEL_ID","IMAGE_SNAPSHOT_RESULTS_REQUEST","IMAGE_SNAPSHOT_RESULTS_RESPONSE","requestImageSnapshotResults","name","importPath","addons","api","types","tabId","viewMode","setSnapshotResults","useState","storyData","useEffect","dispose","event"],"mappings":"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","file":"manager.js","sourcesContent":["import { memo } from 'react'\nimport { AddonPanel, Placeholder, ScrollArea } from 'storybook/internal/components'\nimport { styled } from 'storybook/internal/theming'\nimport { SNAPSHOT_ROOT_DIR } from 'vitest-plugin-vis/client-api'\nimport type { ImageSnapshotResults } from '../shared/events.ts'\n\ninterface PanelProps {\n\tactive: boolean\n\tsnapshotResults: ImageSnapshotResults[]\n}\n\nexport const VisPanel = memo(function VisResultsPanel({ active, snapshotResults = [] }: PanelProps) {\n\tconst groupedResults = snapshotResults.reduce(\n\t\t(acc, result) => {\n\t\t\tconst suiteName = result.snapshotRootDir.slice(SNAPSHOT_ROOT_DIR.length + 1)\n\t\t\tconst key = `(${suiteName}) ${result.fileName}`\n\t\t\tacc[key] = [...(acc[key] ?? []), result]\n\t\t\treturn acc\n\t\t},\n\t\t{} as Record<string, ImageSnapshotResults[]>,\n\t)\n\treturn (\n\t\t<AddonPanel active={active}>\n\t\t\t{snapshotResults.length > 0 ? (\n\t\t\t\t<ScrollArea vertical>\n\t\t\t\t\t{Object.entries(groupedResults).map(([key, results]) => (\n\t\t\t\t\t\t<div key={key}>\n\t\t\t\t\t\t\t{results.some((result) => result.type === 'diff') ? (\n\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t<SnapshotRow failed>{key}</SnapshotRow>\n\t\t\t\t\t\t\t\t\t{results.map((result) => (\n\t\t\t\t\t\t\t\t\t\t<img key={result.filePath} src={`data:image/png;base64,${result.base64}`} alt={result.fileName} />\n\t\t\t\t\t\t\t\t\t))}\n\t\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t<SnapshotRow>{key}</SnapshotRow>\n\t\t\t\t\t\t\t\t\t<img\n\t\t\t\t\t\t\t\t\t\tkey={results[0].filePath}\n\t\t\t\t\t\t\t\t\t\tsrc={`data:image/png;base64,${results[0].base64}`}\n\t\t\t\t\t\t\t\t\t\talt={results[0].fileName}\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t</div>\n\t\t\t\t\t))}\n\t\t\t\t</ScrollArea>\n\t\t\t) : (\n\t\t\t\t<Placeholder>There is no snapshots for this story</Placeholder>\n\t\t\t)}\n\t\t</AddonPanel>\n\t)\n})\n\nconst SnapshotRow = styled.div<{ failed?: boolean }>(({ theme, failed }) => ({\n\tpaddingBlock: '0.5rem',\n\tpaddingInline: '0.2rem',\n\tbackgroundColor: failed ? theme.background.negative : theme.background.positive,\n\tcolor: theme.barTextColor,\n}))\n","export const NAME = 'storybook-addon-vis'\nexport const VIS_PANEL_ID = `${NAME}/vis_panel`\n","export type VisEvent = ImageSnapshotResultsRequest | ImageSnapshotResultsResponse\n\nexport const IMAGE_SNAPSHOT_RESULTS_REQUEST = 'IMAGE_SNAPSHOT_RESULTS_REQUEST'\nexport const IMAGE_SNAPSHOT_RESULTS_RESPONSE = 'IMAGE_SNAPSHOT_RESULTS_RESPONSE'\n\nexport function requestImageSnapshotResults({ name, importPath }: { name: string; importPath: string }) {\n\treturn {\n\t\ttype: IMAGE_SNAPSHOT_RESULTS_REQUEST,\n\t\tname,\n\t\timportPath,\n\t}\n}\n\nexport type ImageSnapshotResultsRequest = {\n\ttype: typeof IMAGE_SNAPSHOT_RESULTS_REQUEST\n\tname: string\n\timportPath: string\n}\n\nexport type ImageSnapshotResultsResponse = {\n\ttype: typeof IMAGE_SNAPSHOT_RESULTS_RESPONSE\n\tname: string\n\timportPath: string\n\tresults: ImageSnapshotResults[]\n}\n\nexport type ImageSnapshotResults = {\n\tfilePath: string\n\tfileName: string\n\tsnapshotRootDir: string\n\ttype: 'baseline' | 'diff' | 'result'\n\tbase64: string\n}\n","import { useEffect, useState } from 'react'\nimport { addons, types } from 'storybook/internal/manager-api'\nimport { VisPanel } from './components/vis_panel.tsx'\nimport { NAME, VIS_PANEL_ID } from './shared/contants.ts'\nimport {\n\tIMAGE_SNAPSHOT_RESULTS_RESPONSE,\n\trequestImageSnapshotResults,\n\ttype ImageSnapshotResults,\n\ttype VisEvent,\n} from './shared/events.ts'\n\n// Register the addon\naddons.register(NAME, (api) => {\n\t// Register the tool\n\taddons.add(VIS_PANEL_ID, {\n\t\ttype: types.PANEL,\n\t\ttitle: 'Vis',\n\t\tmatch: ({ tabId, viewMode }) => !tabId && viewMode === 'story',\n\t\trender({ active }) {\n\t\t\tif (!active) return null\n\t\t\tconst [snapshotResults, setSnapshotResults] = useState<ImageSnapshotResults[]>([])\n\n\t\t\tconst storyData = api.getCurrentStoryData()\n\n\t\t\tuseEffect(() => {\n\t\t\t\tconst dispose = api.on(NAME, (event: VisEvent) => {\n\t\t\t\t\tif (event.name !== storyData.name) return\n\t\t\t\t\tif (event.importPath !== storyData.importPath) return\n\n\t\t\t\t\tif (event.type === IMAGE_SNAPSHOT_RESULTS_RESPONSE) {\n\t\t\t\t\t\tsetSnapshotResults(event.results)\n\t\t\t\t\t}\n\t\t\t\t})\n\t\t\t\tapi.emit(NAME, requestImageSnapshotResults(storyData))\n\t\t\t\treturn dispose\n\t\t\t}, [storyData])\n\t\t\treturn <VisPanel active={active} snapshotResults={snapshotResults} />\n\t\t},\n\t})\n})\n"]}
package/dist/matcher.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { ImageSnapshotMatcher } from 'vitest-plugin-vis/client';
1
+ import { ImageSnapshotMatcher } from 'vitest-plugin-vis/client-api';
2
2
 
3
3
  declare global {
4
4
  namespace jest {
package/dist/preset.cjs CHANGED
@@ -1,2 +1,2 @@
1
- 'use strict';var e={};module.exports=e;//# sourceMappingURL=preset.cjs.map
1
+ 'use strict';var glob=require('glob'),T=require('is-ci'),E=require('memoize'),fs=require('fs'),process=require('process'),pathe=require('pathe'),serverUtils=require('vitest-plugin-vis/server-utils');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var T__default=/*#__PURE__*/_interopDefault(T);var E__default=/*#__PURE__*/_interopDefault(E);function g(o){let r=o.visProjects??[{snapshotRootDir:serverUtils.SNAPSHOT_ROOT_DIR}];return {options:o,async getImageSnapshotResults(n,s){return r.map(t=>{let p=(typeof t.snapshotRootDir=="function"?E__default.default(t.snapshotRootDir)({ci:T__default.default,platform:process.platform}):t.snapshotRootDir)??serverUtils.SNAPSHOT_ROOT_DIR,a=(typeof t.snapshotSubpath=="function"?E__default.default(t.snapshotSubpath):E__default.default(({subpath:i})=>serverUtils.trimCommonFolder(i.startsWith("./")?i.slice(2):i)))({subpath:s});return {snapshotRootDir:p,snapshotSubpath:a}}).flatMap(({snapshotRootDir:t,snapshotSubpath:p})=>{let m=n.replace(/[^a-z0-9]/gi,"-").toLowerCase(),a=`${m}-*.png`,i=pathe.resolve(t,serverUtils.BASELINE_DIR,p,a),h=pathe.resolve(t,serverUtils.DIFF_DIR,p,a),l=new RegExp(`${m}-[^-]*.png$`),I=glob.globSync(i).filter(e=>l.test(e)),b=glob.globSync(h).filter(e=>l.test(e));return [...I.map(e=>c(e,t,"baseline")),...b.map(e=>c(e,t,"diff"))]})}}}function c(o,r,n){return {filePath:o,fileName:pathe.basename(o),snapshotRootDir:r,type:n,base64:fs.readFileSync(o,"base64")}}var S="storybook-addon-vis";var y="IMAGE_SNAPSHOT_RESULTS_REQUEST",u="IMAGE_SNAPSHOT_RESULTS_RESPONSE";var w=async(o,r)=>{let n=g(r);return o.on(S,async s=>{if(s.type===y){let t=await n.getImageSnapshotResults(s.name,s.importPath);o.emit(S,{type:u,name:s.name,importPath:s.importPath,results:t});}}),o};exports.experimental_serverChannel=w;//# sourceMappingURL=preset.cjs.map
2
2
  //# sourceMappingURL=preset.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/preset.ts"],"names":["preset_default"],"mappings":"aAAA,IAAOA,EAAQ","file":"preset.cjs","sourcesContent":["export default {}\n"]}
1
+ {"version":3,"sources":["../src/server/create_storybook_vis_server.ts","../src/shared/contants.ts","../src/shared/events.ts","../src/preset.ts"],"names":["createStorybookVisServer","options","visSuites","SNAPSHOT_ROOT_DIR","name","importPath","suite","snapshotRootDir","memoize","ci","platform","snapshotSubpath","subpath","trimCommonFolder","taskId","taskGlob","baselineGlob","resolve","BASELINE_DIR","diffGlob","DIFF_DIR","taskIdRegex","baselineFiles","globSync","filePath","diffFiles","mapFileToResult","type","basename","readFileSync","NAME","IMAGE_SNAPSHOT_RESULTS_REQUEST","IMAGE_SNAPSHOT_RESULTS_RESPONSE","experimental_serverChannel","channel","server","event","results"],"mappings":"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","file":"preset.cjs","sourcesContent":["import { globSync } from 'glob'\nimport ci from 'is-ci'\nimport memoize from 'memoize'\nimport { readFileSync } from 'node:fs'\nimport { platform } from 'node:process'\nimport { basename, resolve } from 'pathe'\nimport { BASELINE_DIR, DIFF_DIR, SNAPSHOT_ROOT_DIR, trimCommonFolder } from 'vitest-plugin-vis/server-utils'\nimport type { StorybookVisOptions } from './vis_options.ts'\n\nexport function createStorybookVisServer(options: StorybookVisOptions) {\n\tconst visSuites = options.visProjects ?? [{ snapshotRootDir: SNAPSHOT_ROOT_DIR }]\n\treturn {\n\t\toptions,\n\t\tasync getImageSnapshotResults(name: string, importPath: string) {\n\t\t\treturn visSuites\n\t\t\t\t.map((suite) => {\n\t\t\t\t\tconst snapshotRootDir =\n\t\t\t\t\t\t(typeof suite.snapshotRootDir === 'function'\n\t\t\t\t\t\t\t? memoize(suite.snapshotRootDir)({\n\t\t\t\t\t\t\t\t\tci,\n\t\t\t\t\t\t\t\t\tplatform,\n\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t: suite.snapshotRootDir) ?? SNAPSHOT_ROOT_DIR\n\t\t\t\t\tconst snapshotSubpathFn =\n\t\t\t\t\t\ttypeof suite.snapshotSubpath === 'function'\n\t\t\t\t\t\t\t? memoize(suite.snapshotSubpath)\n\t\t\t\t\t\t\t: memoize(({ subpath }: { subpath: string }) =>\n\t\t\t\t\t\t\t\t\ttrimCommonFolder(subpath.startsWith('./') ? subpath.slice(2) : subpath),\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\tconst snapshotSubpath = snapshotSubpathFn({ subpath: importPath })\n\t\t\t\t\treturn {\n\t\t\t\t\t\tsnapshotRootDir,\n\t\t\t\t\t\tsnapshotSubpath,\n\t\t\t\t\t}\n\t\t\t\t})\n\t\t\t\t.flatMap(({ snapshotRootDir, snapshotSubpath }) => {\n\t\t\t\t\tconst taskId = name.replace(/[^a-z0-9]/gi, '-').toLowerCase()\n\t\t\t\t\tconst taskGlob = `${taskId}-*.png`\n\t\t\t\t\tconst baselineGlob = resolve(snapshotRootDir, BASELINE_DIR, snapshotSubpath, taskGlob)\n\t\t\t\t\tconst diffGlob = resolve(snapshotRootDir, DIFF_DIR, snapshotSubpath, taskGlob)\n\n\t\t\t\t\tconst taskIdRegex = new RegExp(`${taskId}-[^-]*.png$`)\n\t\t\t\t\tconst baselineFiles = globSync(baselineGlob).filter((filePath) => taskIdRegex.test(filePath))\n\t\t\t\t\tconst diffFiles = globSync(diffGlob).filter((filePath) => taskIdRegex.test(filePath))\n\t\t\t\t\treturn [\n\t\t\t\t\t\t...baselineFiles.map((filePath) => mapFileToResult(filePath, snapshotRootDir, 'baseline')),\n\t\t\t\t\t\t...diffFiles.map((filePath) => mapFileToResult(filePath, snapshotRootDir, 'diff')),\n\t\t\t\t\t]\n\t\t\t\t})\n\t\t},\n\t}\n}\n\nfunction mapFileToResult(filePath: string, snapshotRootDir: string, type: 'baseline' | 'diff') {\n\treturn {\n\t\tfilePath,\n\t\tfileName: basename(filePath),\n\t\tsnapshotRootDir,\n\t\ttype,\n\t\tbase64: readFileSync(filePath, 'base64'),\n\t}\n}\n","export const NAME = 'storybook-addon-vis'\nexport const VIS_PANEL_ID = `${NAME}/vis_panel`\n","export type VisEvent = ImageSnapshotResultsRequest | ImageSnapshotResultsResponse\n\nexport const IMAGE_SNAPSHOT_RESULTS_REQUEST = 'IMAGE_SNAPSHOT_RESULTS_REQUEST'\nexport const IMAGE_SNAPSHOT_RESULTS_RESPONSE = 'IMAGE_SNAPSHOT_RESULTS_RESPONSE'\n\nexport function requestImageSnapshotResults({ name, importPath }: { name: string; importPath: string }) {\n\treturn {\n\t\ttype: IMAGE_SNAPSHOT_RESULTS_REQUEST,\n\t\tname,\n\t\timportPath,\n\t}\n}\n\nexport type ImageSnapshotResultsRequest = {\n\ttype: typeof IMAGE_SNAPSHOT_RESULTS_REQUEST\n\tname: string\n\timportPath: string\n}\n\nexport type ImageSnapshotResultsResponse = {\n\ttype: typeof IMAGE_SNAPSHOT_RESULTS_RESPONSE\n\tname: string\n\timportPath: string\n\tresults: ImageSnapshotResults[]\n}\n\nexport type ImageSnapshotResults = {\n\tfilePath: string\n\tfileName: string\n\tsnapshotRootDir: string\n\ttype: 'baseline' | 'diff' | 'result'\n\tbase64: string\n}\n","import type { Channel } from 'storybook/internal/channels'\nimport { createStorybookVisServer } from './server/create_storybook_vis_server.ts'\nimport type { StorybookVisOptions } from './server/vis_options.ts'\nimport { NAME } from './shared/contants.ts'\nimport { IMAGE_SNAPSHOT_RESULTS_REQUEST, IMAGE_SNAPSHOT_RESULTS_RESPONSE, type VisEvent } from './shared/events.ts'\n\nexport const experimental_serverChannel = async (channel: Channel, options: StorybookVisOptions) => {\n\tconst server = createStorybookVisServer(options)\n\n\tchannel.on(NAME, async (event: VisEvent) => {\n\t\tif (event.type === IMAGE_SNAPSHOT_RESULTS_REQUEST) {\n\t\t\tconst results = await server.getImageSnapshotResults(event.name, event.importPath)\n\t\t\tchannel.emit(NAME, {\n\t\t\t\ttype: IMAGE_SNAPSHOT_RESULTS_RESPONSE,\n\t\t\t\tname: event.name,\n\t\t\t\timportPath: event.importPath,\n\t\t\t\tresults,\n\t\t\t})\n\t\t}\n\t})\n\n\treturn channel\n}\n"]}
@@ -1,27 +1,11 @@
1
1
  import { ComparisonMethod, VisOptions } from 'vitest-plugin-vis/config';
2
2
  export { trimCommonFolder } from 'vitest-plugin-vis/config';
3
- import * as vitest_plugin_vis_commands from 'vitest-plugin-vis/commands';
4
- import * as vitest_node from 'vitest/node';
5
- import * as vite from 'vite';
6
3
  import { Omit } from 'type-plus';
7
4
 
8
- declare function storybookVis<M extends ComparisonMethod>(options?: Omit<VisOptions<M>, 'preset'> | undefined): {
9
- name: string;
10
- config(this: void, userConfig: vite.UserConfig): {
11
- test: {
12
- browser: {
13
- name: string;
14
- commands: {
15
- setupVisSuite: vitest_node.BrowserCommand<[]>;
16
- imageSnapshotNextIndex: vitest_node.BrowserCommand<[taskId: string]>;
17
- hasImageSnapshot: vitest_node.BrowserCommand<[taskId: string, snapshotId: string | undefined, isAutoSnapshot: boolean]>;
18
- matchImageSnapshot: vitest_node.BrowserCommand<[taskId: string, subject: string, isAutoSnapshot: boolean, options?: vitest_plugin_vis_commands.MatchImageSnapshotOptions | undefined]>;
19
- prepareImageSnapshotComparison: vitest_node.BrowserCommand<[taskId: string, snapshotId: string, isAutoSnapshot: boolean, options?: vitest_plugin_vis_commands.MatchImageSnapshotOptions | undefined]>;
20
- };
21
- };
22
- setupFiles: string[];
23
- };
24
- };
25
- };
5
+ /**
6
+ * Return type is `any` to support different Vitest and Vite versions.
7
+ */
8
+
9
+ declare function storybookVis<M extends ComparisonMethod>(options?: Omit<VisOptions<M>, 'preset'> | undefined): any;
26
10
 
27
11
  export { storybookVis };
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/shared/contants.ts","../src/vitest-plugin/storybook_vis.ts"],"names":[],"mappings":";;;;;;AAAO,IAAM,IAAO,GAAA,qBAAA;;;ACIb,SAAS,aAAyC,OAAqD,EAAA;AAC7G,EAAO,OAAA;AAAA,IACN,GAAG,GAAI,CAAA;AAAA,MACN,GAAG,OAAA;AAAA,MACH,MAAQ,EAAA;AAAA,KACR,CAAA;AAAA,IACD,IAAM,EAAA;AAAA,GACP;AACD","file":"vitest-plugin.js","sourcesContent":["export const NAME = 'storybook-addon-vis'\n","import type { Omit } from 'type-plus'\nimport { type ComparisonMethod, type VisOptions, vis } from 'vitest-plugin-vis/config'\nimport { NAME } from '../shared/contants.ts'\n\nexport function storybookVis<M extends ComparisonMethod>(options?: Omit<VisOptions<M>, 'preset'> | undefined) {\n\treturn {\n\t\t...vis({\n\t\t\t...options,\n\t\t\tpreset: 'none',\n\t\t}),\n\t\tname: NAME,\n\t}\n}\n"]}
1
+ {"version":3,"sources":["../src/shared/contants.ts","../src/vitest-plugin/storybook_vis.ts"],"names":[],"mappings":";;;;;;AAAO,IAAM,IAAO,GAAA,qBAAA;;;ACOb,SAAS,aAAyC,OAA0D,EAAA;AAClH,EAAO,OAAA;AAAA,IACN,GAAG,GAAI,CAAA;AAAA,MACN,GAAG,OAAA;AAAA,MACH,MAAQ,EAAA;AAAA,KACR,CAAA;AAAA,IACD,IAAM,EAAA;AAAA,GACP;AACD","file":"vitest-plugin.js","sourcesContent":["export const NAME = 'storybook-addon-vis'\nexport const VIS_PANEL_ID = `${NAME}/vis_panel`\n","/**\n * Return type is `any` to support different Vitest and Vite versions.\n */\nimport type { Omit } from 'type-plus'\nimport { type ComparisonMethod, type VisOptions, vis } from 'vitest-plugin-vis/config'\nimport { NAME } from '../shared/contants.ts'\n\nexport function storybookVis<M extends ComparisonMethod>(options?: Omit<VisOptions<M>, 'preset'> | undefined): any {\n\treturn {\n\t\t...vis({\n\t\t\t...options,\n\t\t\tpreset: 'none',\n\t\t}),\n\t\tname: NAME,\n\t}\n}\n"]}
@@ -1,9 +1,15 @@
1
1
  import * as vitest_plugin_vis_setup from 'vitest-plugin-vis/setup';
2
- import { SnapshotMeta } from 'vitest-plugin-vis';
3
- export { SnapshotMeta, setAutoSnapshotOptions } from 'vitest-plugin-vis';
2
+ import './matcher.js';
3
+ export { setAutoSnapshotOptions } from 'vitest-plugin-vis';
4
+ import { StoryContext } from 'storybook/internal/types';
5
+ import 'vitest-plugin-vis/client-api';
4
6
 
5
- declare const vis: vitest_plugin_vis_setup.VisClientConfigurator<SnapshotMeta<any> & {
7
+ declare const visAnnotations: {
8
+ beforeEach(ctx: StoryContext): void;
9
+ };
10
+
11
+ declare const vis: vitest_plugin_vis_setup.VisClientConfigurator<{
6
12
  tags: string[];
7
13
  }>;
8
14
 
9
- export { vis };
15
+ export { vis, visAnnotations };
@@ -1,9 +1,23 @@
1
- import { commands } from './chunk-KMYH24SZ.js';
1
+ import { commands, getCurrentTest, isSnapshotEnabled } from './chunk-O5DYZDLL.js';
2
2
  import { createVis } from 'vitest-plugin-vis/setup';
3
+ import { setAutoSnapshotOptions } from 'vitest-plugin-vis';
3
4
  export { setAutoSnapshotOptions } from 'vitest-plugin-vis';
4
5
 
6
+ var visAnnotations = {
7
+ beforeEach(ctx) {
8
+ const test = getCurrentTest();
9
+ setAutoSnapshotOptions({
10
+ enable: isSnapshotEnabled(ctx.tags),
11
+ ...ctx.parameters?.snapshot,
12
+ tags: ctx.tags,
13
+ ...test?.meta.vis
14
+ });
15
+ }
16
+ };
17
+
18
+ // src/vitest-setup.ts
5
19
  var vis = createVis(commands);
6
20
 
7
- export { vis };
21
+ export { vis, visAnnotations };
8
22
  //# sourceMappingURL=vitest-setup.js.map
9
23
  //# sourceMappingURL=vitest-setup.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/vitest-setup.ts"],"names":[],"mappings":";;;;AAKa,IAAA,GAAA,GAAM,UAAkD,QAAQ","file":"vitest-setup.js","sourcesContent":["// `storybook-addon-vis/vitest-setup` provides code needed in `vitest.setup.ts`.\nimport type { SnapshotMeta } from 'vitest-plugin-vis'\nimport { createVis } from 'vitest-plugin-vis/setup'\nimport { commands } from './client/vitest_proxy.ts'\n\nexport const vis = createVis<SnapshotMeta<any> & { tags: string[] }>(commands)\nexport { setAutoSnapshotOptions, type SnapshotMeta } from 'vitest-plugin-vis'\n"]}
1
+ {"version":3,"sources":["../src/preview/vis_annotation.ts","../src/vitest-setup.ts"],"names":[],"mappings":";;;;;AAKO,IAAM,cAAiB,GAAA;AAAA,EAC7B,WAAW,GAAmB,EAAA;AAE7B,IAAA,MAAM,OAAO,cAAe,EAAA;AAC5B,IAAuB,sBAAA,CAAA;AAAA,MACtB,MAAA,EAAQ,iBAAkB,CAAA,GAAA,CAAI,IAAI,CAAA;AAAA,MAClC,GAAG,IAAI,UAAY,EAAA,QAAA;AAAA,MACnB,MAAM,GAAI,CAAA,IAAA;AAAA,MACV,GAAG,MAAM,IAAK,CAAA;AAAA,KACd,CAAA;AAAA;AAEH;;;ACTa,IAAA,GAAA,GAAM,UAA8B,QAAQ","file":"vitest-setup.js","sourcesContent":["import type { ProjectAnnotations, Renderer, StoryContext } from 'storybook/internal/types'\nimport { setAutoSnapshotOptions } from 'vitest-plugin-vis'\nimport { isSnapshotEnabled } from '../client/storybook/tags.ts'\nimport { getCurrentTest } from '../client/vitest_proxy.ts'\n\nexport const visAnnotations = {\n\tbeforeEach(ctx: StoryContext) {\n\t\t// console.debug('storbook-addon-vis.preview.beforeEach starts...')\n\t\tconst test = getCurrentTest()\n\t\tsetAutoSnapshotOptions({\n\t\t\tenable: isSnapshotEnabled(ctx.tags),\n\t\t\t...ctx.parameters?.snapshot,\n\t\t\ttags: ctx.tags,\n\t\t\t...test?.meta.vis,\n\t\t})\n\t},\n} satisfies ProjectAnnotations<Renderer>\n","// `storybook-addon-vis/vitest-setup` provides code needed in `vitest.setup.ts`.\nimport './client/storybook/expect_extend.ts'\nimport './shared/global_matcher_augment.ts'\n\nimport { createVis } from 'vitest-plugin-vis/setup'\nimport { commands } from './client/vitest_proxy.ts'\n\nexport const vis = createVis<{ tags: string[] }>(commands)\nexport { setAutoSnapshotOptions } from 'vitest-plugin-vis'\nexport { visAnnotations } from './preview/vis_annotation.ts'\n"]}
package/manager.js ADDED
@@ -0,0 +1 @@
1
+ import './dist/manager.js'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "storybook-addon-vis",
3
- "version": "0.19.4",
3
+ "version": "1.0.0",
4
4
  "description": "Storybook Vitest visual testing addon",
5
5
  "keywords": [
6
6
  "image-snapshot",
@@ -13,7 +13,7 @@
13
13
  ],
14
14
  "repository": {
15
15
  "type": "git",
16
- "url": "https://github.com/repobuddy/storybook-image-snapshot",
16
+ "url": "https://github.com/repobuddy/visual-testing",
17
17
  "directory": "packages/storybook-addon-vis"
18
18
  },
19
19
  "license": "MIT",
@@ -23,12 +23,16 @@
23
23
  "url": "https://github.com/unional"
24
24
  },
25
25
  "type": "module",
26
+ "imports": {
27
+ "#storybook-addon-vis/vitest-plugin": "./src/vitest-plugin.ts"
28
+ },
26
29
  "exports": {
27
30
  ".": {
28
31
  "types": "./dist/index.d.ts",
29
32
  "import": "./dist/index.js",
30
33
  "require": "./dist/index.cjs"
31
34
  },
35
+ "./manager": "./dist/manager.js",
32
36
  "./matcher": {
33
37
  "types": "./dist/matcher.d.ts",
34
38
  "import": "./dist/matcher.js"
@@ -48,9 +52,6 @@
48
52
  },
49
53
  "./package.json": "./package.json"
50
54
  },
51
- "imports": {
52
- "#storybook-addon-vis/vitest-plugin": "./src/vitest-plugin.ts"
53
- },
54
55
  "types": "./dist/index.d.ts",
55
56
  "files": [
56
57
  "dist",
@@ -60,37 +61,48 @@
60
61
  "!**/*.{spec,test,unit,accept,integrate,system,perf,stress,stories,study}.*"
61
62
  ],
62
63
  "dependencies": {
64
+ "glob": "^11.0.2",
65
+ "is-ci": "^4.1.0",
66
+ "memoize": "^10.1.0",
67
+ "pathe": "^2.0.3",
63
68
  "type-plus": "8.0.0-beta.7",
64
- "vitest-plugin-vis": "2.4.4"
69
+ "vitest-plugin-vis": "^3.0.0"
65
70
  },
66
71
  "devDependencies": {
67
- "@storybook/addon-essentials": "^8.6.3",
68
- "@storybook/addon-links": "^8.6.3",
69
- "@storybook/blocks": "^8.6.3",
70
- "@storybook/experimental-addon-test": "^8.6.3",
71
- "@storybook/react": "^8.6.3",
72
- "@storybook/react-vite": "^8.6.3",
73
- "@storybook/test": "^8.6.3",
72
+ "@repobuddy/storybook": "^0.12.0",
73
+ "@storybook/addon-essentials": "^8.6.14",
74
+ "@storybook/addon-links": "^8.6.14",
75
+ "@storybook/addon-storysource": "^8.6.14",
76
+ "@storybook/blocks": "^8.6.14",
77
+ "@storybook/experimental-addon-test": "^8.6.14",
78
+ "@storybook/react": "^8.6.14",
79
+ "@storybook/react-vite": "^8.6.14",
80
+ "@storybook/test": "^8.6.14",
81
+ "@tailwindcss/cli": "^4.1.7",
82
+ "@tailwindcss/vite": "^4.1.7",
74
83
  "@testing-library/react": "^16.0.1",
75
84
  "@types/react": "^18.2.65",
76
85
  "@types/react-dom": "^18.2.21",
77
86
  "@vitejs/plugin-react": "^4.2.1",
78
- "@vitest/browser": "^3.0.8",
79
- "@vitest/coverage-istanbul": "^3.0.8",
80
- "@vitest/expect": "^3.0.8",
87
+ "@vitest/browser": "^3.0.9",
88
+ "@vitest/coverage-istanbul": "^3.0.9",
89
+ "@vitest/expect": "^3.0.9",
81
90
  "boxen": "^8.0.1",
82
91
  "cross-env": "^7.0.3",
83
92
  "dedent": "^1.5.1",
84
- "npm-run-all2": "^7.0.2",
93
+ "npm-run-all2": "^8.0.0",
85
94
  "playwright": "latest",
86
95
  "react": "^18.2.0",
87
96
  "react-dom": "^18.2.0",
88
- "storybook": "^8.6.3",
97
+ "storybook": "^8.6.14",
98
+ "storybook-addon-tag-badges": "^1.4.0",
99
+ "storybook-dark-mode": "^4.0.2",
100
+ "tailwindcss": "^4.1.7",
89
101
  "tsup": "^8.3.5",
90
102
  "typescript": "^5.7.2",
91
- "vite": "^6.0.9",
92
- "vitest": "^3.0.8",
93
- "vitest-browser-react": "^0.1.0",
103
+ "vite": "^6.2.3",
104
+ "vitest": "^3.0.9",
105
+ "vitest-browser-react": "^0.1.1",
94
106
  "webdriverio": "latest",
95
107
  "zx": "^8.0.0"
96
108
  },
@@ -109,8 +121,8 @@
109
121
  "src/matcher.ts",
110
122
  "src/vitest-setup.ts"
111
123
  ],
112
- "previewEntries": [
113
- "src/preview.ts"
124
+ "managerEntries": [
125
+ "src/manager.tsx"
114
126
  ],
115
127
  "nodeEntries": [
116
128
  "./src/preset.ts"
@@ -132,9 +144,9 @@
132
144
  "icon": "https://github.com/organizations/repobuddy/settings/profile"
133
145
  },
134
146
  "scripts": {
135
- "build": "tsup",
147
+ "build": "tsup --tsconfig tsconfig.tsup.json",
136
148
  "build:sb": "storybook build",
137
- "clean": "rimraf coverage dist esm *.tsbuildinfo vitest.*.timestamp*",
149
+ "clean": "rimraf coverage dist esm --glob *.tsbuildinfo vitest.*.timestamp*",
138
150
  "clean:vis:local": "rimraf __vis__/local",
139
151
  "cov": "vitest run --coverage",
140
152
  "coverage": "vitest run --coverage",
@@ -145,6 +157,8 @@
145
157
  "t:n": "vitest run -c vitest.config.node.ts",
146
158
  "t:wb": "cross-env BROWSER=firefox BROWSERPROVIDER=webdriverio vitest run",
147
159
  "test": "vitest run",
160
+ "test:node": "vitest run -c vitest.config.node.ts",
161
+ "test:pw": "vitest run -c vitest.config.playwright.ts",
148
162
  "test:type": "tsc --noEmit",
149
163
  "v": "run-p build cov",
150
164
  "w": "vitest",