storybook 10.2.0-alpha.13 → 10.2.0-alpha.15

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 (74) hide show
  1. package/dist/_browser-chunks/{chunk-3PJE6VLG.js → chunk-ASKQZAOS.js} +1 -12
  2. package/dist/_browser-chunks/{chunk-BGSDJMFM.js → chunk-NVLTWT3B.js} +18 -6
  3. package/dist/_node-chunks/{builder-manager-YTW4R3NB.js → builder-manager-SOKYB5NF.js} +12 -12
  4. package/dist/_node-chunks/{camelcase-ALOK3DTL.js → camelcase-SXQWF7PW.js} +7 -7
  5. package/dist/_node-chunks/{chunk-QV7LTTOW.js → chunk-274OMYGE.js} +20 -20
  6. package/dist/_node-chunks/{chunk-B3NH4IRY.js → chunk-2BHD5YKF.js} +6 -6
  7. package/dist/_node-chunks/{chunk-FCBELYHM.js → chunk-2FQAOAQ6.js} +12 -12
  8. package/dist/_node-chunks/{chunk-NGFKU3PK.js → chunk-45UIB4YF.js} +7 -7
  9. package/dist/_node-chunks/{chunk-TWCN75ID.js → chunk-4GKVZO2T.js} +9 -9
  10. package/dist/_node-chunks/{chunk-KXFFKIVX.js → chunk-5KEIALUH.js} +6 -6
  11. package/dist/_node-chunks/{chunk-AOMUVL33.js → chunk-6SIUW3HU.js} +12 -12
  12. package/dist/_node-chunks/{chunk-L4JVY7CQ.js → chunk-AIIQJ6UR.js} +7 -7
  13. package/dist/_node-chunks/{chunk-5CARBEGS.js → chunk-BOY3TNPC.js} +9 -9
  14. package/dist/_node-chunks/{chunk-TOLCEUYZ.js → chunk-BRW7NFUP.js} +7 -7
  15. package/dist/_node-chunks/{chunk-ZSUT22UW.js → chunk-E3Y5MHXD.js} +7 -7
  16. package/dist/_node-chunks/{chunk-QMDFRT4S.js → chunk-ENNDE4GC.js} +10 -10
  17. package/dist/_node-chunks/{chunk-NL75DTGM.js → chunk-FKBWQGIF.js} +6 -6
  18. package/dist/_node-chunks/{chunk-NRCGIPSW.js → chunk-HFKM7JHQ.js} +6 -6
  19. package/dist/_node-chunks/{chunk-OOTLIMKW.js → chunk-K4YVLJRS.js} +6 -6
  20. package/dist/_node-chunks/{chunk-WKDY7YZY.js → chunk-KNGN3UEO.js} +7 -7
  21. package/dist/_node-chunks/{chunk-AE6TGTGX.js → chunk-MD52RVZX.js} +7 -7
  22. package/dist/_node-chunks/chunk-MM7Z4SG7.js +23 -0
  23. package/dist/_node-chunks/{chunk-XX6B7MPS.js → chunk-MQZLLJRG.js} +8 -8
  24. package/dist/_node-chunks/{chunk-OWZXELHP.js → chunk-PI7P5HFH.js} +13 -13
  25. package/dist/_node-chunks/{chunk-VOVBTC53.js → chunk-Q6WUEJ4S.js} +6 -6
  26. package/dist/_node-chunks/{chunk-2VHYFREG.js → chunk-QPKBPYOY.js} +7 -7
  27. package/dist/_node-chunks/chunk-RGWB6DD7.js +20 -0
  28. package/dist/_node-chunks/{chunk-BIJENBOW.js → chunk-SZWIX5YC.js} +9 -9
  29. package/dist/_node-chunks/{chunk-X2PNK4N4.js → chunk-T57UCO67.js} +7 -7
  30. package/dist/_node-chunks/{chunk-5E6TIJW7.js → chunk-TN3Q52LO.js} +6 -6
  31. package/dist/_node-chunks/chunk-TYSSQECX.js +61 -0
  32. package/dist/_node-chunks/chunk-YP34ARUD.js +18 -0
  33. package/dist/_node-chunks/{globby-RG2TFVNI.js → globby-LGQ5P2JB.js} +9 -9
  34. package/dist/_node-chunks/{lib-E2AGGQV3.js → lib-5LBLULG3.js} +7 -7
  35. package/dist/_node-chunks/{mdx-N42X6CFJ-SGUMZ4YL.js → mdx-N42X6CFJ-TAPL5IEO.js} +8 -8
  36. package/dist/_node-chunks/{p-limit-J4UZO65T.js → p-limit-GTMOHYQF.js} +7 -7
  37. package/dist/babel/index.js +10 -10
  38. package/dist/bin/core.js +12 -12
  39. package/dist/bin/dispatcher.js +11 -11
  40. package/dist/bin/loader.js +9 -9
  41. package/dist/cli/index.d.ts +176 -176
  42. package/dist/cli/index.js +18 -18
  43. package/dist/common/index.js +19 -19
  44. package/dist/components/index.d.ts +1 -0
  45. package/dist/components/index.js +167 -166
  46. package/dist/core-events/index.d.ts +4 -4
  47. package/dist/core-server/index.d.ts +11 -1
  48. package/dist/core-server/index.js +217 -76
  49. package/dist/core-server/presets/common-manager.js +176 -134
  50. package/dist/core-server/presets/common-override-preset.js +9 -9
  51. package/dist/core-server/presets/common-preset.js +27 -26
  52. package/dist/csf/index.d.ts +8 -6
  53. package/dist/csf/index.js +1 -1
  54. package/dist/csf-tools/index.js +10 -10
  55. package/dist/docs-tools/index.d.ts +2 -2
  56. package/dist/manager/globals-runtime.js +97 -94
  57. package/dist/manager/runtime.js +1755 -985
  58. package/dist/manager-api/index.d.ts +1 -1
  59. package/dist/manager-api/index.js +10 -8
  60. package/dist/mocking-utils/index.js +8 -8
  61. package/dist/node-logger/index.js +9 -9
  62. package/dist/preview/runtime.js +18 -6
  63. package/dist/preview-api/index.js +1 -1
  64. package/dist/server-errors.js +11 -11
  65. package/dist/telemetry/index.js +22 -22
  66. package/dist/types/index.d.ts +12 -6
  67. package/dist/viewport/index.d.ts +5 -3
  68. package/dist/viewport/index.js +12 -3
  69. package/package.json +2 -2
  70. package/dist/_node-chunks/chunk-5U7IR6W2.js +0 -61
  71. package/dist/_node-chunks/chunk-JUCUYWH2.js +0 -23
  72. package/dist/_node-chunks/chunk-KTAHXSER.js +0 -18
  73. package/dist/_node-chunks/chunk-XQU357NR.js +0 -20
  74. package/dist/_node-chunks/dist-I4XBT6AL.js +0 -121
@@ -442,7 +442,7 @@ interface SubAPI$4 {
442
442
  * @param shortcuts The new shortcuts to set.
443
443
  * @returns A promise that resolves to the new shortcuts.
444
444
  */
445
- setShortcuts(shortcuts: API_Shortcuts): Promise<API_Shortcuts>;
445
+ setShortcuts(update: API_Shortcuts | ((shortcuts: API_Shortcuts) => API_Shortcuts)): Promise<API_Shortcuts>;
446
446
  /**
447
447
  * Sets the shortcut for the given action to the given value.
448
448
  *
@@ -1502,22 +1502,24 @@ var init10 = ({ store: store2, fullAPI, provider }) => {
1502
1502
  defaults[actionName] = defaultShortcut;
1503
1503
  }), defaults;
1504
1504
  },
1505
- async setShortcuts(shortcuts) {
1506
- return await store2.setState({ shortcuts }, { persistence: "permanent" }), shortcuts;
1505
+ async setShortcuts(update2) {
1506
+ let { shortcuts } = await store2.setState(
1507
+ (state2) => ({ shortcuts: typeof update2 == "function" ? update2(state2.shortcuts) : update2 }),
1508
+ { persistence: "permanent" }
1509
+ );
1510
+ return shortcuts;
1507
1511
  },
1508
1512
  async restoreAllDefaultShortcuts() {
1509
1513
  return api.setShortcuts(api.getDefaultShortcuts());
1510
1514
  },
1511
1515
  async setShortcut(action, value) {
1512
- let shortcuts = api.getShortcutKeys();
1513
- return await api.setShortcuts({ ...shortcuts, [action]: value }), value;
1516
+ return await api.setShortcuts((shortcuts) => ({ ...shortcuts, [action]: value })), value;
1514
1517
  },
1515
1518
  async setAddonShortcut(addon, shortcut) {
1516
- let shortcuts = api.getShortcutKeys();
1517
- return await api.setShortcuts({
1519
+ return await api.setShortcuts((shortcuts) => ({
1518
1520
  ...shortcuts,
1519
1521
  [`${addon}-${shortcut.actionName}`]: shortcut.defaultShortcut
1520
- }), addonsShortcuts[`${addon}-${shortcut.actionName}`] = shortcut, shortcut;
1522
+ })), addonsShortcuts[`${addon}-${shortcut.actionName}`] = shortcut, shortcut;
1521
1523
  },
1522
1524
  async restoreDefaultShortcut(action) {
1523
1525
  let defaultShortcut = api.getDefaultShortcuts()[action];
@@ -2382,7 +2384,7 @@ import { global as global8 } from "@storybook/global";
2382
2384
  import semver from "semver";
2383
2385
 
2384
2386
  // src/manager-api/version.ts
2385
- var version = "10.2.0-alpha.13";
2387
+ var version = "10.2.0-alpha.15";
2386
2388
 
2387
2389
  // src/manager-api/modules/versions.ts
2388
2390
  var { VERSIONCHECK } = global8, getVersionCheckData = (0, import_memoizerific2.default)(1)(() => {
@@ -1,10 +1,10 @@
1
- import CJS_COMPAT_NODE_URL_xc3mu1pf9x from 'node:url';
2
- import CJS_COMPAT_NODE_PATH_xc3mu1pf9x from 'node:path';
3
- import CJS_COMPAT_NODE_MODULE_xc3mu1pf9x from "node:module";
1
+ import CJS_COMPAT_NODE_URL_ekkdwuux1sk from 'node:url';
2
+ import CJS_COMPAT_NODE_PATH_ekkdwuux1sk from 'node:path';
3
+ import CJS_COMPAT_NODE_MODULE_ekkdwuux1sk from "node:module";
4
4
 
5
- var __filename = CJS_COMPAT_NODE_URL_xc3mu1pf9x.fileURLToPath(import.meta.url);
6
- var __dirname = CJS_COMPAT_NODE_PATH_xc3mu1pf9x.dirname(__filename);
7
- var require = CJS_COMPAT_NODE_MODULE_xc3mu1pf9x.createRequire(import.meta.url);
5
+ var __filename = CJS_COMPAT_NODE_URL_ekkdwuux1sk.fileURLToPath(import.meta.url);
6
+ var __dirname = CJS_COMPAT_NODE_PATH_ekkdwuux1sk.dirname(__filename);
7
+ var require = CJS_COMPAT_NODE_MODULE_ekkdwuux1sk.createRequire(import.meta.url);
8
8
 
9
9
  // ------------------------------------------------------------
10
10
  // end of CJS compatibility banner, injected by Storybook's esbuild configuration
@@ -16,8 +16,8 @@ import {
16
16
  join,
17
17
  normalize,
18
18
  resolve
19
- } from "../_node-chunks/chunk-NL75DTGM.js";
20
- import "../_node-chunks/chunk-KXFFKIVX.js";
19
+ } from "../_node-chunks/chunk-FKBWQGIF.js";
20
+ import "../_node-chunks/chunk-5KEIALUH.js";
21
21
 
22
22
  // ../../node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.mjs
23
23
  var comma = 44, semicolon = 59, chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", intToChar = new Uint8Array(64), charToInt = new Uint8Array(128);
@@ -1,10 +1,10 @@
1
- import CJS_COMPAT_NODE_URL_xc3mu1pf9x from 'node:url';
2
- import CJS_COMPAT_NODE_PATH_xc3mu1pf9x from 'node:path';
3
- import CJS_COMPAT_NODE_MODULE_xc3mu1pf9x from "node:module";
1
+ import CJS_COMPAT_NODE_URL_ekkdwuux1sk from 'node:url';
2
+ import CJS_COMPAT_NODE_PATH_ekkdwuux1sk from 'node:path';
3
+ import CJS_COMPAT_NODE_MODULE_ekkdwuux1sk from "node:module";
4
4
 
5
- var __filename = CJS_COMPAT_NODE_URL_xc3mu1pf9x.fileURLToPath(import.meta.url);
6
- var __dirname = CJS_COMPAT_NODE_PATH_xc3mu1pf9x.dirname(__filename);
7
- var require = CJS_COMPAT_NODE_MODULE_xc3mu1pf9x.createRequire(import.meta.url);
5
+ var __filename = CJS_COMPAT_NODE_URL_ekkdwuux1sk.fileURLToPath(import.meta.url);
6
+ var __dirname = CJS_COMPAT_NODE_PATH_ekkdwuux1sk.dirname(__filename);
7
+ var require = CJS_COMPAT_NODE_MODULE_ekkdwuux1sk.createRequire(import.meta.url);
8
8
 
9
9
  // ------------------------------------------------------------
10
10
  // end of CJS compatibility banner, injected by Storybook's esbuild configuration
@@ -22,9 +22,9 @@ import {
22
22
  once,
23
23
  prompt,
24
24
  protectUrls
25
- } from "../_node-chunks/chunk-XX6B7MPS.js";
26
- import "../_node-chunks/chunk-X2PNK4N4.js";
27
- import "../_node-chunks/chunk-KXFFKIVX.js";
25
+ } from "../_node-chunks/chunk-MQZLLJRG.js";
26
+ import "../_node-chunks/chunk-T57UCO67.js";
27
+ import "../_node-chunks/chunk-5KEIALUH.js";
28
28
  var export_instance = import_npmlog.default;
29
29
  export {
30
30
  CLI_COLORS,
@@ -16443,14 +16443,26 @@ function mountDestructured(playFunction) {
16443
16443
  return playFunction != null && getUsedProps(playFunction).includes("mount");
16444
16444
  }
16445
16445
  function getUsedProps(fn3) {
16446
- let match = fn3.toString().match(/[^(]*\(([^)]*)/);
16447
- if (!match)
16446
+ let [, args, body] = fn3.toString().match(/[^(]*\(([^)]+)\)(?:.*{([^]+)})?/) || [];
16447
+ if (!args)
16448
+ return [];
16449
+ let [firstArg] = splitByComma(args);
16450
+ if (!firstArg)
16448
16451
  return [];
16449
- let args = splitByComma(match[1]);
16450
- if (!args.length)
16452
+ let [, destructuredProps] = firstArg.match(/^{([^]+)}$/) || [];
16453
+ if (destructuredProps)
16454
+ return splitByComma(stripComments(destructuredProps)).map(
16455
+ (prop) => prop.replace(/:.*|=.*/g, "").trim()
16456
+ );
16457
+ if (!firstArg.match(/^[a-z_$][0-9a-z_$]*$/i))
16451
16458
  return [];
16452
- let first = args[0];
16453
- return first.startsWith("{") && first.endsWith("}") ? splitByComma(first.slice(1, -1).replace(/\s/g, "")).map((prop) => prop.replace(/:.*|=.*/g, "")) : [];
16459
+ let escapedArg = firstArg.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), [, destructuredArg] = body?.trim()?.match(new RegExp(`^(?:const|let|var)\\s*{([^}]+)}\\s*=\\s*${escapedArg};`)) || [];
16460
+ return destructuredArg ? splitByComma(stripComments(destructuredArg)).map(
16461
+ (prop) => prop.replace(/:.*|=.*/g, "").trim()
16462
+ ) : [];
16463
+ }
16464
+ function stripComments(s3) {
16465
+ return s3 = s3.replace(/\/\/.*$/gm, ""), s3 = s3.replace(/\/\*[\s\S]*?\*\//g, ""), s3;
16454
16466
  }
16455
16467
  function splitByComma(s3) {
16456
16468
  let result = [], stack = [], start = 0;
@@ -48,7 +48,7 @@ import {
48
48
  useStoryContext,
49
49
  userOrAutoTitle,
50
50
  userOrAutoTitleFromSpecifier
51
- } from "../_browser-chunks/chunk-BGSDJMFM.js";
51
+ } from "../_browser-chunks/chunk-NVLTWT3B.js";
52
52
  import {
53
53
  pauseAnimations,
54
54
  waitForAnimations
@@ -1,10 +1,10 @@
1
- import CJS_COMPAT_NODE_URL_xc3mu1pf9x from 'node:url';
2
- import CJS_COMPAT_NODE_PATH_xc3mu1pf9x from 'node:path';
3
- import CJS_COMPAT_NODE_MODULE_xc3mu1pf9x from "node:module";
1
+ import CJS_COMPAT_NODE_URL_ekkdwuux1sk from 'node:url';
2
+ import CJS_COMPAT_NODE_PATH_ekkdwuux1sk from 'node:path';
3
+ import CJS_COMPAT_NODE_MODULE_ekkdwuux1sk from "node:module";
4
4
 
5
- var __filename = CJS_COMPAT_NODE_URL_xc3mu1pf9x.fileURLToPath(import.meta.url);
6
- var __dirname = CJS_COMPAT_NODE_PATH_xc3mu1pf9x.dirname(__filename);
7
- var require = CJS_COMPAT_NODE_MODULE_xc3mu1pf9x.createRequire(import.meta.url);
5
+ var __filename = CJS_COMPAT_NODE_URL_ekkdwuux1sk.fileURLToPath(import.meta.url);
6
+ var __dirname = CJS_COMPAT_NODE_PATH_ekkdwuux1sk.dirname(__filename);
7
+ var require = CJS_COMPAT_NODE_MODULE_ekkdwuux1sk.createRequire(import.meta.url);
8
8
 
9
9
  // ------------------------------------------------------------
10
10
  // end of CJS compatibility banner, injected by Storybook's esbuild configuration
@@ -46,13 +46,13 @@ import {
46
46
  WebpackCompilationError,
47
47
  WebpackInvocationError,
48
48
  WebpackMissingStatsError
49
- } from "./_node-chunks/chunk-QMDFRT4S.js";
49
+ } from "./_node-chunks/chunk-ENNDE4GC.js";
50
50
  import {
51
51
  StorybookError
52
- } from "./_node-chunks/chunk-5E6TIJW7.js";
53
- import "./_node-chunks/chunk-2VHYFREG.js";
54
- import "./_node-chunks/chunk-X2PNK4N4.js";
55
- import "./_node-chunks/chunk-KXFFKIVX.js";
52
+ } from "./_node-chunks/chunk-TN3Q52LO.js";
53
+ import "./_node-chunks/chunk-QPKBPYOY.js";
54
+ import "./_node-chunks/chunk-T57UCO67.js";
55
+ import "./_node-chunks/chunk-5KEIALUH.js";
56
56
  export {
57
57
  AddonVitestPostinstallConfigUpdateError,
58
58
  AddonVitestPostinstallError,
@@ -1,10 +1,10 @@
1
- import CJS_COMPAT_NODE_URL_xc3mu1pf9x from 'node:url';
2
- import CJS_COMPAT_NODE_PATH_xc3mu1pf9x from 'node:path';
3
- import CJS_COMPAT_NODE_MODULE_xc3mu1pf9x from "node:module";
1
+ import CJS_COMPAT_NODE_URL_ekkdwuux1sk from 'node:url';
2
+ import CJS_COMPAT_NODE_PATH_ekkdwuux1sk from 'node:path';
3
+ import CJS_COMPAT_NODE_MODULE_ekkdwuux1sk from "node:module";
4
4
 
5
- var __filename = CJS_COMPAT_NODE_URL_xc3mu1pf9x.fileURLToPath(import.meta.url);
6
- var __dirname = CJS_COMPAT_NODE_PATH_xc3mu1pf9x.dirname(__filename);
7
- var require = CJS_COMPAT_NODE_MODULE_xc3mu1pf9x.createRequire(import.meta.url);
5
+ var __filename = CJS_COMPAT_NODE_URL_ekkdwuux1sk.fileURLToPath(import.meta.url);
6
+ var __dirname = CJS_COMPAT_NODE_PATH_ekkdwuux1sk.dirname(__filename);
7
+ var require = CJS_COMPAT_NODE_MODULE_ekkdwuux1sk.createRequire(import.meta.url);
8
8
 
9
9
  // ------------------------------------------------------------
10
10
  // end of CJS compatibility banner, injected by Storybook's esbuild configuration
@@ -25,22 +25,22 @@ import {
25
25
  sanitizeAddonName,
26
26
  sanitizeError,
27
27
  telemetry
28
- } from "../_node-chunks/chunk-AOMUVL33.js";
29
- import "../_node-chunks/chunk-KTAHXSER.js";
30
- import "../_node-chunks/chunk-QV7LTTOW.js";
31
- import "../_node-chunks/chunk-5U7IR6W2.js";
32
- import "../_node-chunks/chunk-L4JVY7CQ.js";
33
- import "../_node-chunks/chunk-XX6B7MPS.js";
34
- import "../_node-chunks/chunk-TWCN75ID.js";
35
- import "../_node-chunks/chunk-VOVBTC53.js";
36
- import "../_node-chunks/chunk-NRCGIPSW.js";
37
- import "../_node-chunks/chunk-ZSUT22UW.js";
38
- import "../_node-chunks/chunk-NL75DTGM.js";
39
- import "../_node-chunks/chunk-AE6TGTGX.js";
40
- import "../_node-chunks/chunk-XQU357NR.js";
41
- import "../_node-chunks/chunk-2VHYFREG.js";
42
- import "../_node-chunks/chunk-X2PNK4N4.js";
43
- import "../_node-chunks/chunk-KXFFKIVX.js";
28
+ } from "../_node-chunks/chunk-6SIUW3HU.js";
29
+ import "../_node-chunks/chunk-YP34ARUD.js";
30
+ import "../_node-chunks/chunk-274OMYGE.js";
31
+ import "../_node-chunks/chunk-TYSSQECX.js";
32
+ import "../_node-chunks/chunk-AIIQJ6UR.js";
33
+ import "../_node-chunks/chunk-MQZLLJRG.js";
34
+ import "../_node-chunks/chunk-4GKVZO2T.js";
35
+ import "../_node-chunks/chunk-Q6WUEJ4S.js";
36
+ import "../_node-chunks/chunk-HFKM7JHQ.js";
37
+ import "../_node-chunks/chunk-E3Y5MHXD.js";
38
+ import "../_node-chunks/chunk-FKBWQGIF.js";
39
+ import "../_node-chunks/chunk-MD52RVZX.js";
40
+ import "../_node-chunks/chunk-RGWB6DD7.js";
41
+ import "../_node-chunks/chunk-QPKBPYOY.js";
42
+ import "../_node-chunks/chunk-T57UCO67.js";
43
+ import "../_node-chunks/chunk-5KEIALUH.js";
44
44
  export {
45
45
  ErrorCollector,
46
46
  addToGlobalContext,
@@ -2468,14 +2468,14 @@ interface ComponentManifest {
2468
2468
  id: string;
2469
2469
  path: string;
2470
2470
  name: string;
2471
- description?: string;
2472
- import?: string;
2473
- summary?: string;
2471
+ description?: string | undefined;
2472
+ import?: string | undefined;
2473
+ summary?: string | undefined;
2474
2474
  stories: {
2475
2475
  name: string;
2476
- snippet?: string;
2477
- description?: string;
2478
- summary?: string;
2476
+ snippet?: string | undefined;
2477
+ description?: string | undefined;
2478
+ summary?: string | undefined;
2479
2479
  error?: {
2480
2480
  name: string;
2481
2481
  message: string;
@@ -2562,6 +2562,12 @@ interface StorybookConfigRaw {
2562
2562
  * @default true
2563
2563
  */
2564
2564
  actions?: boolean;
2565
+ /**
2566
+ * Enable the onboarding checklist sidebar widget
2567
+ *
2568
+ * @default true
2569
+ */
2570
+ sidebarOnboardingChecklist?: boolean;
2565
2571
  /**
2566
2572
  * @temporary This feature flag is a migration assistant, and is scheduled to be removed.
2567
2573
  *
@@ -6,8 +6,9 @@ declare const TOOL_ID = "storybook/viewport/tool";
6
6
  interface Viewport {
7
7
  name: string;
8
8
  styles: ViewportStyles;
9
- type?: 'desktop' | 'mobile' | 'tablet' | 'other';
9
+ type?: ViewportType;
10
10
  }
11
+ type ViewportType = 'desktop' | 'mobile' | 'tablet' | 'watch' | 'other';
11
12
  interface ViewportStyles {
12
13
  height: string;
13
14
  width: string;
@@ -16,7 +17,8 @@ type ViewportMap = Record<string, Viewport>;
16
17
  type GlobalState = {
17
18
  /**
18
19
  * When set, the viewport is applied and cannot be changed using the toolbar. Must match the key
19
- * of one of the available viewports.
20
+ * of one of the available viewports or follow the format '{width}-{height}', e.g. '320-480' which
21
+ * may include a unit (e.g. '100vw' or '100pct').
20
22
  */
21
23
  value: string | undefined;
22
24
  /**
@@ -325,4 +327,4 @@ declare const MINIMAL_VIEWPORTS: {
325
327
 
326
328
  declare const responsiveViewport: Viewport;
327
329
 
328
- export { ADDON_ID, DEFAULT_VIEWPORT, type GlobalState, type GlobalStateUpdate, INITIAL_VIEWPORTS, type InitialViewportKeys, MINIMAL_VIEWPORTS, PANEL_ID, PARAM_KEY, TOOL_ID, type Viewport, type ViewportGlobals, type ViewportMap, type ViewportParameters, type ViewportStyles, type ViewportTypes, responsiveViewport };
330
+ export { ADDON_ID, DEFAULT_VIEWPORT, type GlobalState, type GlobalStateUpdate, INITIAL_VIEWPORTS, type InitialViewportKeys, MINIMAL_VIEWPORTS, PANEL_ID, PARAM_KEY, TOOL_ID, type Viewport, type ViewportGlobals, type ViewportMap, type ViewportParameters, type ViewportStyles, type ViewportType, type ViewportTypes, responsiveViewport };
@@ -1,9 +1,8 @@
1
1
  import {
2
2
  DEFAULT_VIEWPORT,
3
3
  INITIAL_VIEWPORTS,
4
- MINIMAL_VIEWPORTS,
5
- responsiveViewport
6
- } from "../_browser-chunks/chunk-3PJE6VLG.js";
4
+ MINIMAL_VIEWPORTS
5
+ } from "../_browser-chunks/chunk-ASKQZAOS.js";
7
6
  import {
8
7
  ADDON_ID,
9
8
  PANEL_ID,
@@ -11,6 +10,16 @@ import {
11
10
  TOOL_ID
12
11
  } from "../_browser-chunks/chunk-SL75JR6Y.js";
13
12
  import "../_browser-chunks/chunk-A242L54C.js";
13
+
14
+ // src/viewport/responsiveViewport.tsx
15
+ var responsiveViewport = {
16
+ name: "Reset viewport",
17
+ styles: {
18
+ height: "100%",
19
+ width: "100%"
20
+ },
21
+ type: "desktop"
22
+ };
14
23
  export {
15
24
  ADDON_ID,
16
25
  DEFAULT_VIEWPORT,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "storybook",
3
- "version": "10.2.0-alpha.13",
3
+ "version": "10.2.0-alpha.15",
4
4
  "description": "Storybook: Develop, document, and test UI components in isolation",
5
5
  "keywords": [
6
6
  "storybook",
@@ -236,7 +236,7 @@
236
236
  "@react-stately/tabs": "^3.8.5",
237
237
  "@react-types/shared": "^3.32.0",
238
238
  "@rolldown/pluginutils": "1.0.0-beta.18",
239
- "@storybook/docs-mdx": "4.0.0-next.1",
239
+ "@storybook/docs-mdx": "4.0.0-next.3",
240
240
  "@tanstack/react-virtual": "^3.3.0",
241
241
  "@testing-library/dom": "^10.4.1",
242
242
  "@testing-library/react": "^14.0.0",
@@ -1,61 +0,0 @@
1
- import CJS_COMPAT_NODE_URL_xc3mu1pf9x from 'node:url';
2
- import CJS_COMPAT_NODE_PATH_xc3mu1pf9x from 'node:path';
3
- import CJS_COMPAT_NODE_MODULE_xc3mu1pf9x from "node:module";
4
-
5
- var __filename = CJS_COMPAT_NODE_URL_xc3mu1pf9x.fileURLToPath(import.meta.url);
6
- var __dirname = CJS_COMPAT_NODE_PATH_xc3mu1pf9x.dirname(__filename);
7
- var require = CJS_COMPAT_NODE_MODULE_xc3mu1pf9x.createRequire(import.meta.url);
8
-
9
- // ------------------------------------------------------------
10
- // end of CJS compatibility banner, injected by Storybook's esbuild configuration
11
- // ------------------------------------------------------------
12
-
13
- // src/common/versions.ts
14
- var versions_default = {
15
- "@storybook/addon-a11y": "10.2.0-alpha.13",
16
- "@storybook/addon-docs": "10.2.0-alpha.13",
17
- "@storybook/addon-links": "10.2.0-alpha.13",
18
- "@storybook/addon-onboarding": "10.2.0-alpha.13",
19
- "storybook-addon-pseudo-states": "10.2.0-alpha.13",
20
- "@storybook/addon-themes": "10.2.0-alpha.13",
21
- "@storybook/addon-vitest": "10.2.0-alpha.13",
22
- "@storybook/builder-vite": "10.2.0-alpha.13",
23
- "@storybook/builder-webpack5": "10.2.0-alpha.13",
24
- storybook: "10.2.0-alpha.13",
25
- "@storybook/angular": "10.2.0-alpha.13",
26
- "@storybook/ember": "10.2.0-alpha.13",
27
- "@storybook/html-vite": "10.2.0-alpha.13",
28
- "@storybook/nextjs": "10.2.0-alpha.13",
29
- "@storybook/nextjs-vite": "10.2.0-alpha.13",
30
- "@storybook/preact-vite": "10.2.0-alpha.13",
31
- "@storybook/react-native-web-vite": "10.2.0-alpha.13",
32
- "@storybook/react-vite": "10.2.0-alpha.13",
33
- "@storybook/react-webpack5": "10.2.0-alpha.13",
34
- "@storybook/server-webpack5": "10.2.0-alpha.13",
35
- "@storybook/svelte-vite": "10.2.0-alpha.13",
36
- "@storybook/sveltekit": "10.2.0-alpha.13",
37
- "@storybook/vue3-vite": "10.2.0-alpha.13",
38
- "@storybook/web-components-vite": "10.2.0-alpha.13",
39
- sb: "10.2.0-alpha.13",
40
- "@storybook/cli": "10.2.0-alpha.13",
41
- "@storybook/codemod": "10.2.0-alpha.13",
42
- "@storybook/core-webpack": "10.2.0-alpha.13",
43
- "create-storybook": "10.2.0-alpha.13",
44
- "@storybook/csf-plugin": "10.2.0-alpha.13",
45
- "eslint-plugin-storybook": "10.2.0-alpha.13",
46
- "@storybook/react-dom-shim": "10.2.0-alpha.13",
47
- "@storybook/preset-create-react-app": "10.2.0-alpha.13",
48
- "@storybook/preset-react-webpack": "10.2.0-alpha.13",
49
- "@storybook/preset-server-webpack": "10.2.0-alpha.13",
50
- "@storybook/html": "10.2.0-alpha.13",
51
- "@storybook/preact": "10.2.0-alpha.13",
52
- "@storybook/react": "10.2.0-alpha.13",
53
- "@storybook/server": "10.2.0-alpha.13",
54
- "@storybook/svelte": "10.2.0-alpha.13",
55
- "@storybook/vue3": "10.2.0-alpha.13",
56
- "@storybook/web-components": "10.2.0-alpha.13"
57
- };
58
-
59
- export {
60
- versions_default
61
- };
@@ -1,23 +0,0 @@
1
- import CJS_COMPAT_NODE_URL_xc3mu1pf9x from 'node:url';
2
- import CJS_COMPAT_NODE_PATH_xc3mu1pf9x from 'node:path';
3
- import CJS_COMPAT_NODE_MODULE_xc3mu1pf9x from "node:module";
4
-
5
- var __filename = CJS_COMPAT_NODE_URL_xc3mu1pf9x.fileURLToPath(import.meta.url);
6
- var __dirname = CJS_COMPAT_NODE_PATH_xc3mu1pf9x.dirname(__filename);
7
- var require = CJS_COMPAT_NODE_MODULE_xc3mu1pf9x.createRequire(import.meta.url);
8
-
9
- // ------------------------------------------------------------
10
- // end of CJS compatibility banner, injected by Storybook's esbuild configuration
11
- // ------------------------------------------------------------
12
- import {
13
- any
14
- } from "./chunk-VOVBTC53.js";
15
-
16
- // src/cli/detect.ts
17
- async function detectPnp() {
18
- return !!any([".pnp.js", ".pnp.cjs"]);
19
- }
20
-
21
- export {
22
- detectPnp
23
- };
@@ -1,18 +0,0 @@
1
- import CJS_COMPAT_NODE_URL_xc3mu1pf9x from 'node:url';
2
- import CJS_COMPAT_NODE_PATH_xc3mu1pf9x from 'node:path';
3
- import CJS_COMPAT_NODE_MODULE_xc3mu1pf9x from "node:module";
4
-
5
- var __filename = CJS_COMPAT_NODE_URL_xc3mu1pf9x.fileURLToPath(import.meta.url);
6
- var __dirname = CJS_COMPAT_NODE_PATH_xc3mu1pf9x.dirname(__filename);
7
- var require = CJS_COMPAT_NODE_MODULE_xc3mu1pf9x.createRequire(import.meta.url);
8
-
9
- // ------------------------------------------------------------
10
- // end of CJS compatibility banner, injected by Storybook's esbuild configuration
11
- // ------------------------------------------------------------
12
-
13
- // package.json
14
- var version = "10.2.0-alpha.13";
15
-
16
- export {
17
- version
18
- };
@@ -1,20 +0,0 @@
1
- import CJS_COMPAT_NODE_URL_xc3mu1pf9x from 'node:url';
2
- import CJS_COMPAT_NODE_PATH_xc3mu1pf9x from 'node:path';
3
- import CJS_COMPAT_NODE_MODULE_xc3mu1pf9x from "node:module";
4
-
5
- var __filename = CJS_COMPAT_NODE_URL_xc3mu1pf9x.fileURLToPath(import.meta.url);
6
- var __dirname = CJS_COMPAT_NODE_PATH_xc3mu1pf9x.dirname(__filename);
7
- var require = CJS_COMPAT_NODE_MODULE_xc3mu1pf9x.createRequire(import.meta.url);
8
-
9
- // ------------------------------------------------------------
10
- // end of CJS compatibility banner, injected by Storybook's esbuild configuration
11
- // ------------------------------------------------------------
12
-
13
- // ../../node_modules/slash/index.js
14
- function slash(path) {
15
- return path.startsWith("\\\\?\\") ? path : path.replace(/\\/g, "/");
16
- }
17
-
18
- export {
19
- slash
20
- };
@@ -1,121 +0,0 @@
1
- import CJS_COMPAT_NODE_URL_xc3mu1pf9x from 'node:url';
2
- import CJS_COMPAT_NODE_PATH_xc3mu1pf9x from 'node:path';
3
- import CJS_COMPAT_NODE_MODULE_xc3mu1pf9x from "node:module";
4
-
5
- var __filename = CJS_COMPAT_NODE_URL_xc3mu1pf9x.fileURLToPath(import.meta.url);
6
- var __dirname = CJS_COMPAT_NODE_PATH_xc3mu1pf9x.dirname(__filename);
7
- var require = CJS_COMPAT_NODE_MODULE_xc3mu1pf9x.createRequire(import.meta.url);
8
-
9
- // ------------------------------------------------------------
10
- // end of CJS compatibility banner, injected by Storybook's esbuild configuration
11
- // ------------------------------------------------------------
12
- import {
13
- toEstree
14
- } from "./chunk-WKDY7YZY.js";
15
- import "./chunk-KXFFKIVX.js";
16
-
17
- // ../../node_modules/@storybook/docs-mdx/dist/index.js
18
- var getAttr = (elt, what) => elt.attributes.find((n) => n.type === "JSXAttribute" && n.name.name === what), getAttrValue = (elt, what) => getAttr(elt, what)?.value, getAttrLiteral = (elt, what) => {
19
- let attrValue = getAttrValue(elt, what);
20
- if (attrValue) {
21
- if (attrValue.type === "Literal")
22
- return attrValue.value;
23
- throw new Error(`Expected string literal ${what}, received ${attrValue.type}`);
24
- }
25
- }, getOf = (elt, varToImport) => {
26
- let ofAttrValue = getAttrValue(elt, "of");
27
- if (ofAttrValue)
28
- if (ofAttrValue.type === "JSXExpressionContainer") {
29
- let of = ofAttrValue.expression;
30
- if (of?.type === "Identifier") {
31
- let importName = varToImport[of.name];
32
- if (importName)
33
- return importName;
34
- throw new Error(`Unknown identifier ${of.name}`);
35
- } else
36
- throw new Error(`Expected identifier, received ${of.type}`);
37
- } else
38
- throw new Error(`Expected JSX expression, received ${ofAttrValue.type}`);
39
- }, getTags = (elt) => {
40
- let tagsAttr = getAttr(elt, "tags");
41
- if (!tagsAttr)
42
- return;
43
- let tagsContainer = tagsAttr.value;
44
- if (tagsContainer.type === "JSXExpressionContainer") {
45
- let tagsArray = tagsContainer.expression;
46
- if (tagsArray.type === "ArrayExpression")
47
- return tagsArray.elements.map((tag) => {
48
- if (tag.type === "Literal" && typeof tag.value == "string")
49
- return tag.value;
50
- throw new Error(`Expected string literal tag, received ${tag.type}`);
51
- });
52
- throw new Error(`Expected tags array, received ${tagsArray.type}`);
53
- } else
54
- throw new Error(`Expected JSX expression tags, received ${tagsContainer.type}`);
55
- }, getIsTemplate = (elt) => {
56
- let isTemplateAttr = getAttr(elt, "isTemplate");
57
- if (!isTemplateAttr)
58
- return !1;
59
- let isTemplate = isTemplateAttr.value;
60
- if (isTemplate == null)
61
- return !0;
62
- if (isTemplate.type === "JSXExpressionContainer") {
63
- let expression = isTemplate.expression;
64
- if (expression.type === "Literal" && typeof expression.value == "boolean")
65
- return expression.value;
66
- throw new Error(`Expected boolean isTemplate, received ${typeof expression.value}`);
67
- } else
68
- throw new Error(`Expected expression isTemplate, received ${isTemplate.type}`);
69
- }, extractTitle = (root, varToImport) => {
70
- let result = { title: void 0, of: void 0, name: void 0, isTemplate: !1 }, fragments = root.body.filter(
71
- (child) => child.type === "ExpressionStatement" && child.expression.type === "JSXFragment"
72
- );
73
- if (fragments.length > 1)
74
- throw new Error("duplicate contents");
75
- return fragments.length === 0 || fragments[0].expression.children.forEach((child) => {
76
- if (child.type === "JSXElement") {
77
- let { openingElement } = child;
78
- if (openingElement.name.name === "Meta") {
79
- if (result.title || result.name || result.of)
80
- throw new Error("Meta can only be declared once");
81
- result.title = getAttrLiteral(openingElement, "title"), result.name = getAttrLiteral(openingElement, "name"), result.of = getOf(openingElement, varToImport), result.isTemplate = getIsTemplate(openingElement), result.metaTags = getTags(openingElement);
82
- }
83
- } else if (child.type !== "JSXExpressionContainer")
84
- throw new Error(`Unexpected JSX child: ${child.type}`);
85
- }), result;
86
- }, extractImports = (root) => {
87
- let varToImport = {};
88
- return root.body.forEach((child) => {
89
- if (child.type === "ImportDeclaration") {
90
- let { source, specifiers } = child;
91
- if (source.type === "Literal")
92
- specifiers.forEach((s) => {
93
- varToImport[s.local.name] = source.value.toString();
94
- });
95
- else
96
- throw new Error("MDX: unexpected import source");
97
- }
98
- }), varToImport;
99
- }, plugin = (store) => (root) => {
100
- let estree = toEstree(root), varToImport = extractImports(estree), { title, of, name, isTemplate, metaTags } = extractTitle(estree, varToImport);
101
- return store.title = title, store.of = of, store.name = name, store.isTemplate = isTemplate, store.metaTags = metaTags, store.imports = Array.from(new Set(Object.values(varToImport))), root;
102
- }, analyze = async (code) => {
103
- let store = {
104
- title: void 0,
105
- of: void 0,
106
- name: void 0,
107
- isTemplate: !1,
108
- metaTags: void 0,
109
- imports: void 0
110
- }, { compile } = await import("./mdx-N42X6CFJ-SGUMZ4YL.js");
111
- await compile(code, {
112
- rehypePlugins: [[plugin, store]]
113
- });
114
- let { title, of, name, isTemplate, metaTags, imports = [] } = store;
115
- return { title, of, name, isTemplate, metaTags, imports };
116
- };
117
- export {
118
- analyze,
119
- extractImports,
120
- plugin
121
- };