@itcase/storybook-config 1.3.17 → 1.3.18

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.
@@ -1,12 +1,10 @@
1
- import { centeredViewportManagerHead } from '../manager/centeredViewportManagerHead.js';
2
1
  declare const MAIN_CONFIG_NEXTJS_VITE: {
3
2
  env: (config: any) => any;
3
+ managerHead: (head: string | undefined) => string;
4
4
  viteFinal: (config: any) => Promise<Record<string, any>>;
5
5
  core: {
6
6
  disableTelemetry: boolean;
7
7
  disableWhatsNewNotifications: boolean;
8
8
  };
9
- managerHead: typeof centeredViewportManagerHead;
10
- tags: string[];
11
9
  };
12
10
  export { MAIN_CONFIG_NEXTJS_VITE };
@@ -1,5 +1,4 @@
1
1
  import svgr from 'vite-plugin-svgr';
2
- import { centeredViewportManagerHead } from '../manager/centeredViewportManagerHead.js';
3
2
  import { getMediaProxyServerConfig } from '../vite/getMediaProxyServerConfig.js';
4
3
  const MAIN_CONFIG_NEXTJS_VITE = {
5
4
  env: (config) => ({
@@ -7,6 +6,16 @@ const MAIN_CONFIG_NEXTJS_VITE = {
7
6
  REST_BASE_URL: process.env.REST_BASE_URL,
8
7
  STORYBOOK_MODE: process.env.STORYBOOK_MODE || '',
9
8
  }),
9
+ // Storybook pins the viewport frame to the top-left of a 100% canvas.
10
+ // `safe center` keeps the start reachable when the frame is taller than the window.
11
+ managerHead: (head) => `${head ?? ''}
12
+ <style>
13
+ #storybook-preview-wrapper > div {
14
+ align-items: safe center;
15
+ justify-content: safe center;
16
+ }
17
+ </style>
18
+ `,
10
19
  viteFinal: async (config) => {
11
20
  const { mergeConfig } = await import('vite');
12
21
  return mergeConfig(config, {
@@ -34,7 +43,5 @@ const MAIN_CONFIG_NEXTJS_VITE = {
34
43
  disableTelemetry: true,
35
44
  disableWhatsNewNotifications: true,
36
45
  },
37
- managerHead: centeredViewportManagerHead,
38
- tags: ['autodocs'],
39
46
  };
40
47
  export { MAIN_CONFIG_NEXTJS_VITE };
@@ -4,6 +4,5 @@ declare const MAIN_CONFIG_REACT_NATIVE: {
4
4
  disableTelemetry: boolean;
5
5
  disableWhatsNewNotifications: boolean;
6
6
  };
7
- tags: string[];
8
7
  };
9
8
  export { MAIN_CONFIG_REACT_NATIVE };
@@ -19,6 +19,5 @@ const MAIN_CONFIG_REACT_NATIVE = {
19
19
  disableTelemetry: true,
20
20
  disableWhatsNewNotifications: true,
21
21
  },
22
- tags: ['autodocs'],
23
22
  };
24
23
  export { MAIN_CONFIG_REACT_NATIVE };
@@ -1,5 +1,5 @@
1
- import { centeredViewportManagerHead } from '../manager/centeredViewportManagerHead.js';
2
1
  declare const MAIN_CONFIG_REACT_NATIVE_WEB: {
2
+ managerHead: (head: string | undefined) => string;
3
3
  viteFinal: (viteConfig: any) => Promise<Record<string, any>>;
4
4
  addons: (string | {
5
5
  name: string;
@@ -22,7 +22,6 @@ declare const MAIN_CONFIG_REACT_NATIVE_WEB: {
22
22
  framework: {
23
23
  name: string;
24
24
  };
25
- managerHead: typeof centeredViewportManagerHead;
26
25
  stories: string[];
27
26
  typescript: {
28
27
  reactDocgen: string;
@@ -1,7 +1,6 @@
1
1
  import { mergeConfig } from 'vite';
2
2
  import svgr from 'vite-plugin-svgr';
3
3
  import { ADDONS_REACT_NATIVE_WEB } from '../addons/addonsReactNativeWeb.js';
4
- import { centeredViewportManagerHead } from '../manager/centeredViewportManagerHead.js';
5
4
  import { reactNativeWebAliasPlugin } from '../vite/reactNativeWebAliasPlugin.js';
6
5
  const REACT_NATIVE_WEB_EXTENSIONS = [
7
6
  '.web.tsx',
@@ -14,6 +13,16 @@ const REACT_NATIVE_WEB_EXTENSIONS = [
14
13
  '.js',
15
14
  ];
16
15
  const MAIN_CONFIG_REACT_NATIVE_WEB = {
16
+ // Storybook pins the viewport frame to the top-left of a 100% canvas.
17
+ // `safe center` keeps the start reachable when the frame is taller than the window.
18
+ managerHead: (head) => `${head ?? ''}
19
+ <style>
20
+ #storybook-preview-wrapper > div {
21
+ align-items: safe center;
22
+ justify-content: safe center;
23
+ }
24
+ </style>
25
+ `,
17
26
  viteFinal: async (viteConfig) => {
18
27
  // @storybook/react-native-web-vite still injects vite-tsconfig-paths;
19
28
  // Vite 8 supports this natively and warns if the plugin is present.
@@ -63,7 +72,6 @@ const MAIN_CONFIG_REACT_NATIVE_WEB = {
63
72
  framework: {
64
73
  name: '@storybook/react-native-web-vite',
65
74
  },
66
- managerHead: centeredViewportManagerHead,
67
75
  stories: ['../stories/react-native/**/*.stories.?(ts|tsx|js|jsx)'],
68
76
  typescript: {
69
77
  reactDocgen: 'react-docgen-typescript',
@@ -1,11 +1,9 @@
1
- import { centeredViewportManagerHead } from '../manager/centeredViewportManagerHead.js';
2
1
  declare const MAIN_CONFIG_VITE: {
2
+ managerHead: (head: string | undefined) => string;
3
3
  viteFinal: (config: any) => Promise<Record<string, any>>;
4
4
  core: {
5
5
  disableTelemetry: boolean;
6
6
  disableWhatsNewNotifications: boolean;
7
7
  };
8
- managerHead: typeof centeredViewportManagerHead;
9
- tags: string[];
10
8
  };
11
9
  export { MAIN_CONFIG_VITE };
@@ -1,6 +1,5 @@
1
1
  import path from 'node:path';
2
2
  import svgr from 'vite-plugin-svgr';
3
- import { centeredViewportManagerHead } from '../manager/centeredViewportManagerHead.js';
4
3
  import { getMediaProxyServerConfig } from '../vite/getMediaProxyServerConfig.js';
5
4
  const WS_OPTION_KEYS = [
6
5
  'protocol',
@@ -26,6 +25,16 @@ function splitHmrAndWsOptions(hmr) {
26
25
  return { hmrRest, wsFromHmr };
27
26
  }
28
27
  const MAIN_CONFIG_VITE = {
28
+ // Storybook pins the viewport frame to the top-left of a 100% canvas.
29
+ // `safe center` keeps the start reachable when the frame is taller than the window.
30
+ managerHead: (head) => `${head ?? ''}
31
+ <style>
32
+ #storybook-preview-wrapper > div {
33
+ align-items: safe center;
34
+ justify-content: safe center;
35
+ }
36
+ </style>
37
+ `,
29
38
  viteFinal: async function (config) {
30
39
  const { mergeConfig } = await import('vite');
31
40
  const existingWatch = config.server?.watch;
@@ -107,7 +116,5 @@ const MAIN_CONFIG_VITE = {
107
116
  disableTelemetry: true,
108
117
  disableWhatsNewNotifications: true,
109
118
  },
110
- managerHead: centeredViewportManagerHead,
111
- tags: ['autodocs'],
112
119
  };
113
120
  export { MAIN_CONFIG_VITE };
@@ -1,11 +1,9 @@
1
- import { centeredViewportManagerHead } from '../manager/centeredViewportManagerHead.js';
2
1
  declare const MAIN_CONFIG_WEBPACK: {
2
+ managerHead: (head: string | undefined) => string;
3
3
  webpackFinal: (config: any) => Promise<any>;
4
4
  core: {
5
5
  disableTelemetry: boolean;
6
6
  disableWhatsNewNotifications: boolean;
7
7
  };
8
- managerHead: typeof centeredViewportManagerHead;
9
- tags: string[];
10
8
  };
11
9
  export { MAIN_CONFIG_WEBPACK };
@@ -1,5 +1,4 @@
1
1
  import chalk from 'chalk';
2
- import { centeredViewportManagerHead } from '../manager/centeredViewportManagerHead.js';
3
2
  const STORYBOOK_PUBLIC_PATH = null;
4
3
  const WEBPACK_ALIAS = {
5
4
  src: `${process.cwd()}/src`,
@@ -7,6 +6,16 @@ const WEBPACK_ALIAS = {
7
6
  '@itcase/ui-web': `${process.cwd()}/node_modules/@itcase/ui-web/dist`,
8
7
  };
9
8
  const MAIN_CONFIG_WEBPACK = {
9
+ // Storybook pins the viewport frame to the top-left of a 100% canvas.
10
+ // `safe center` keeps the start reachable when the frame is taller than the window.
11
+ managerHead: (head) => `${head ?? ''}
12
+ <style>
13
+ #storybook-preview-wrapper > div {
14
+ align-items: safe center;
15
+ justify-content: safe center;
16
+ }
17
+ </style>
18
+ `,
10
19
  webpackFinal: async (config) => {
11
20
  console.log(chalk.green('info =>', chalk.white('Using default "publicPath" set "STORYBOOK_PUBLIC_PATH" variable to use another one')));
12
21
  if (STORYBOOK_PUBLIC_PATH) {
@@ -37,7 +46,5 @@ const MAIN_CONFIG_WEBPACK = {
37
46
  disableTelemetry: true,
38
47
  disableWhatsNewNotifications: true,
39
48
  },
40
- managerHead: centeredViewportManagerHead,
41
- tags: ['autodocs'],
42
49
  };
43
50
  export { MAIN_CONFIG_WEBPACK };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@itcase/storybook-config",
3
- "version": "1.3.17",
3
+ "version": "1.3.18",
4
4
  "author": "ITCase",
5
5
  "description": "Storybook configuration package",
6
6
  "engines": {
@@ -1,2 +0,0 @@
1
- declare function centeredViewportManagerHead(head: string): string;
2
- export { centeredViewportManagerHead };
@@ -1,12 +0,0 @@
1
- // Storybook pins the viewport frame to the top-left of a 100% canvas.
2
- // `safe center` keeps the start reachable when the frame is taller than the window.
3
- const CENTERED_VIEWPORT_STYLE = `<style>
4
- #storybook-preview-wrapper > div {
5
- align-items: safe center;
6
- justify-content: safe center;
7
- }
8
- </style>`;
9
- function centeredViewportManagerHead(head) {
10
- return `${head ?? ''}\n${CENTERED_VIEWPORT_STYLE}\n`;
11
- }
12
- export { centeredViewportManagerHead };