storybook-addon-dependency-previews 0.1.2 → 0.2.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 (94) hide show
  1. package/README.md +77 -24
  2. package/dist/_virtual/{_rolldown/runtime.cjs → rolldown_runtime.cjs} +7 -11
  3. package/dist/addon/index.cjs +0 -1
  4. package/dist/addon/index.cjs.map +1 -1
  5. package/dist/addon/preset.cjs +0 -1
  6. package/dist/addon/preset.cjs.map +1 -1
  7. package/dist/addon/preset.mjs.map +1 -1
  8. package/dist/addon/vitePlugin.cjs +3 -2
  9. package/dist/addon/vitePlugin.cjs.map +1 -1
  10. package/dist/blocks/DependencyPreviews.cjs +3 -2
  11. package/dist/blocks/DependencyPreviews.cjs.map +1 -1
  12. package/dist/blocks/DependencyPreviews.d.cts +2 -2
  13. package/dist/blocks/DependencyPreviews.d.mts +2 -2
  14. package/dist/cli/sb-deps.cjs +114 -5
  15. package/dist/cli/sb-deps.cjs.map +1 -1
  16. package/dist/cli/sb-deps.mjs +105 -0
  17. package/dist/cli/sb-deps.mjs.map +1 -1
  18. package/dist/cli/scripts/depcruise.config.cjs.map +1 -1
  19. package/dist/cli/scripts/depcruise.config.mjs.map +1 -1
  20. package/dist/cli/scripts/postprocess.cjs +6 -3
  21. package/dist/cli/scripts/postprocess.cjs.map +1 -1
  22. package/dist/cli/scripts/postprocess.mjs.map +1 -1
  23. package/dist/components/ComponentSourceLink.cjs +3 -2
  24. package/dist/components/ComponentSourceLink.cjs.map +1 -1
  25. package/dist/components/CopyButton.cjs +4 -2
  26. package/dist/components/CopyButton.cjs.map +1 -1
  27. package/dist/components/Expandable.cjs +4 -2
  28. package/dist/components/Expandable.cjs.map +1 -1
  29. package/dist/components/FullParityStory.cjs +6 -5
  30. package/dist/components/FullParityStory.cjs.map +1 -1
  31. package/dist/components/PathCopyMolecule.cjs +3 -2
  32. package/dist/components/PathCopyMolecule.cjs.map +1 -1
  33. package/dist/components/PrimaryPreview.cjs +3 -1
  34. package/dist/components/PrimaryPreview.cjs.map +1 -1
  35. package/dist/components/SbHeading.cjs +6 -4
  36. package/dist/components/SbHeading.cjs.map +1 -1
  37. package/dist/components/StoryLink.cjs +6 -4
  38. package/dist/components/StoryLink.cjs.map +1 -1
  39. package/dist/components/TooltipTrigger.cjs +4 -2
  40. package/dist/components/TooltipTrigger.cjs.map +1 -1
  41. package/dist/components/icons/ArrowToRectangleIcon.cjs +2 -1
  42. package/dist/components/icons/ArrowToRectangleIcon.cjs.map +1 -1
  43. package/dist/components/icons/BuildIcon.cjs +2 -1
  44. package/dist/components/icons/BuildIcon.cjs.map +1 -1
  45. package/dist/components/icons/CopyIcon.cjs +2 -1
  46. package/dist/components/icons/CopyIcon.cjs.map +1 -1
  47. package/dist/components/icons/CubeIcon.cjs +2 -1
  48. package/dist/components/icons/CubeIcon.cjs.map +1 -1
  49. package/dist/components/icons/DoubleChevronDown.cjs +2 -1
  50. package/dist/components/icons/DoubleChevronDown.cjs.map +1 -1
  51. package/dist/components/icons/ExternalLinkIcon.cjs +2 -1
  52. package/dist/components/icons/ExternalLinkIcon.cjs.map +1 -1
  53. package/dist/components/icons/EyeOpen.cjs +2 -1
  54. package/dist/components/icons/EyeOpen.cjs.map +1 -1
  55. package/dist/components/icons/LoadingRipples.cjs +2 -1
  56. package/dist/components/icons/LoadingRipples.cjs.map +1 -1
  57. package/dist/components/icons/SquaresPlus.cjs +2 -1
  58. package/dist/components/icons/SquaresPlus.cjs.map +1 -1
  59. package/dist/components/icons/Svg.cjs +3 -2
  60. package/dist/components/icons/Svg.cjs.map +1 -1
  61. package/dist/components/icons/Svg.mjs +1 -1
  62. package/dist/components/icons/Svg.mjs.map +1 -1
  63. package/dist/components/icons/X.cjs +2 -1
  64. package/dist/components/icons/X.cjs.map +1 -1
  65. package/dist/hooks/useDependencyGraph.cjs +3 -1
  66. package/dist/hooks/useDependencyGraph.cjs.map +1 -1
  67. package/dist/hooks/useDependencyGraph.mjs.map +1 -1
  68. package/dist/hooks/useDynamicStory.cjs +2 -1
  69. package/dist/hooks/useDynamicStory.cjs.map +1 -1
  70. package/dist/hooks/useDynamicStory.mjs.map +1 -1
  71. package/dist/hooks/useStoryParams.cjs +4 -3
  72. package/dist/hooks/useStoryParams.cjs.map +1 -1
  73. package/dist/index.cjs +0 -1
  74. package/dist/index.d.cts +2 -0
  75. package/dist/index.d.mts +2 -0
  76. package/dist/manager.cjs +4 -1
  77. package/dist/manager.cjs.map +1 -1
  78. package/dist/panels/DefaultAutoDocsLayout.cjs +10 -8
  79. package/dist/panels/DefaultAutoDocsLayout.cjs.map +1 -1
  80. package/dist/panels/DefaultAutoDocsLayout.d.cts +3 -2
  81. package/dist/panels/DefaultAutoDocsLayout.d.mts +3 -2
  82. package/dist/panels/DefaultAutoDocsLayout.mjs.map +1 -1
  83. package/dist/panels/GraphView.cjs +3 -1
  84. package/dist/panels/GraphView.cjs.map +1 -1
  85. package/dist/panels/GraphView.d.cts +2 -2
  86. package/dist/panels/GraphView.d.mts +2 -2
  87. package/dist/panels/GraphView.mjs.map +1 -1
  88. package/dist/preview.cjs +7 -11
  89. package/dist/preview.cjs.map +1 -1
  90. package/dist/preview.d.cts +2 -3
  91. package/dist/preview.d.mts +2 -3
  92. package/dist/preview.mjs +6 -10
  93. package/dist/preview.mjs.map +1 -1
  94. package/package.json +6 -6
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Storybook Add On - Dependency Previews
2
2
 
3
- [![Dependency Previews logo](https://github.com/Dan503/storybook-addon-dependency-previews/raw/main/storybook-addon-package/readme-images/dependency-previews-logo.png)](https://dependency-previews-storybook.netlify.app/?path=/docs/04-templates-home-template--docs)
3
+ [![Dependency Previews logo](https://github.com/Dan503/storybook-addon-dependency-previews/raw/main/storybook-addon-package/readme-images/dependency-previews-logo.png)](https://dependency-previews-storybook-react.netlify.app/?path=/docs/04-templates-home-template--docs)
4
4
 
5
5
  ## What is this?
6
6
 
@@ -8,6 +8,8 @@
8
8
 
9
9
  A plugin for [Storybook](https://storybook.js.org/) that shows the full dependency tree in both directions (built with and used by) the components in your application.
10
10
 
11
+ Currently works with **React** and **Svelte**. Angular support is coming soon.
12
+
11
13
  This is what you will see in Storybook after Dependency Previews have been installed and configured:
12
14
 
13
15
  ![Dependency Previews - all closed](https://github.com/Dan503/storybook-addon-dependency-previews/raw/main/storybook-addon-package/readme-images/all-closed.png)
@@ -16,11 +18,19 @@ The below image demonstrates what you will see when you open up some of the depe
16
18
 
17
19
  ![Dependency Previews - all open](https://github.com/Dan503/storybook-addon-dependency-previews/raw/main/storybook-addon-package/readme-images/all-open.png)
18
20
 
19
- See the dependency previews add on in action at the [Storybook addon demo site](https://dependency-previews-storybook.netlify.app/?path=/docs/04-templates-home-template--docs).
21
+ ### Demos
22
+
23
+ #### React demos
20
24
 
21
- You can also [visit the example website](https://dependency-previews-demo-site.netlify.app/) that the Storybook demo is built for.
25
+ - [React Storybook demo site](https://dependency-previews-storybook-react.netlify.app/?path=/docs/04-templates-home-template--docs)
26
+ - [React rendered example website](https://dependency-previews-demo-site-react.netlify.app/)
27
+ - [React demo source code](https://github.com/Dan503/storybook-addon-dependency-previews/tree/main/example-site/react)
22
28
 
23
- Also [visit the npm page](https://www.npmjs.com/package/storybook-addon-dependency-previews) if you are reading this on GitHub
29
+ #### Svelte demos
30
+
31
+ - [Svelte Storybook demo site](https://dependency-previews-storybook-svelte.netlify.app/)
32
+ - [Svelte rendered example website](https://dependency-previews-demo-site-svelte.netlify.app/)
33
+ - [Svelte demo source code](https://github.com/Dan503/storybook-addon-dependency-previews/tree/main/example-site/svelte)
24
34
 
25
35
  <!-- TODO: Provide a video/gif of the addon in action -->
26
36
 
@@ -28,18 +38,18 @@ Also [visit the npm page](https://www.npmjs.com/package/storybook-addon-dependen
28
38
 
29
39
  ### Package download
30
40
 
31
- First you will need to install the plugin via npm
41
+ First you will need to install the plugin via npm as well as [dependency-cruiser](https://www.npmjs.com/package/dependency-cruiser)
32
42
 
33
43
  ```
34
- npm install storybook-addon-dependency-previews
44
+ npm install -D storybook-addon-dependency-previews dependency-cruiser
35
45
  ```
36
46
 
37
47
  <details>
38
48
  <summary>Other package managers</summary>
39
- <p><pre><code>pnpm add storybook-addon-dependency-previews</code></pre></p>
40
- <p><pre><code>yarn add storybook-addon-dependency-previews</code></pre></p>
41
- <p><pre><code>bun add storybook-addon-dependency-previews</code></pre></p>
42
- <p><pre><code>deno add npm:storybook-addon-dependency-previews</code></pre></p>
49
+ <p><pre><code>pnpm add -D storybook-addon-dependency-previews dependency-cruiser</code></pre></p>
50
+ <p><pre><code>yarn add -D storybook-addon-dependency-previews dependency-cruiser</code></pre></p>
51
+ <p><pre><code>bun add -D storybook-addon-dependency-previews dependency-cruiser</code></pre></p>
52
+ <p><pre><code>deno add --dev npm:storybook-addon-dependency-previews npm:dependency-cruiser</code></pre></p>
43
53
  </details>
44
54
 
45
55
  ### Register the add-on
@@ -48,12 +58,13 @@ From your root folder, open your `.storybook/main.ts` file.
48
58
 
49
59
  Edit the `main.ts` to contain the following values or copy/paste the below to replace the full contents of the main.ts file.
50
60
 
61
+ #### Register with React
62
+
51
63
  ```ts
52
- import { StorybookConfig } from '@storybook/react-vite'
64
+ import type { StorybookConfig } from '@storybook/react-vite'
53
65
 
54
66
  const config: StorybookConfig = {
55
- // tells storybook what files to look for when it goes searching for story files
56
- stories: ['../src/**/*.stories.@(ts|tsx|mdx|svelte|vue)'],
67
+ stories: ['../src/**/*.stories.@(ts|tsx|mdx)'],
57
68
  addons: [
58
69
  // autodocs is required for this addon to work
59
70
  '@storybook/addon-docs',
@@ -61,8 +72,6 @@ const config: StorybookConfig = {
61
72
  'storybook-addon-dependency-previews/addon',
62
73
  ],
63
74
  framework: {
64
- // The framework that storybook uses to read story components
65
- // Use @storybook/*-vite for your framework of choice
66
75
  name: '@storybook/react-vite',
67
76
  options: {},
68
77
  },
@@ -71,14 +80,37 @@ const config: StorybookConfig = {
71
80
  export default config
72
81
  ```
73
82
 
83
+ #### Register with Svelte
84
+
85
+ ```ts
86
+ import type { StorybookConfig } from '@storybook/sveltekit'
87
+
88
+ const config: StorybookConfig = {
89
+ stories: ['../src/**/*.mdx', '../src/**/*.stories.@(js|ts|svelte)'],
90
+ addons: [
91
+ // autodocs is required for this addon to work
92
+ '@storybook/addon-docs',
93
+ // required for .stories.svelte CSF format
94
+ '@storybook/addon-svelte-csf',
95
+ // the storybook dependency previews addon registration
96
+ 'storybook-addon-dependency-previews/addon',
97
+ ],
98
+ framework: '@storybook/sveltekit',
99
+ }
100
+
101
+ export default config
102
+ ```
103
+
74
104
  ### Bare minimum storybook story example
75
105
 
76
106
  Get a story ready so you have something to test with.
77
107
 
78
108
  Below is the bare minimum needed to generate a viable story that is compatible with the add-on.
79
109
 
110
+ #### React `.stories.tsx` file example
111
+
80
112
  ```ts
81
- import type { Meta } from '@storybook/react-vite'
113
+ import type { Meta, StoryObj } from '@storybook/react-vite'
82
114
  import { ComponentName } from './ComponentName'
83
115
 
84
116
  const meta: Meta<typeof ComponentName> = {
@@ -104,6 +136,28 @@ export const Primary: Story = {
104
136
  }
105
137
  ```
106
138
 
139
+ #### Svelte `.stories.svelte` file using [Svelte CSF](https://github.com/storybookjs/addon-svelte-csf)
140
+
141
+ ```svelte
142
+ <script module>
143
+ import { defineMeta } from '@storybook/addon-svelte-csf'
144
+ import ComponentName from './ComponentName.svelte'
145
+
146
+ const { Story } = defineMeta({
147
+ title: 'Component Name',
148
+ component: ComponentName,
149
+ // autodocs tag is required
150
+ tags: ['autodocs'],
151
+ // The `__filePath` property must be applied to every story file
152
+ parameters: {
153
+ __filePath: import.meta.url,
154
+ },
155
+ })
156
+ </script>
157
+
158
+ <Story name="Primary" />
159
+ ```
160
+
107
161
  ### package.json scripts
108
162
 
109
163
  You will need the following scripts in your `package.json` file:
@@ -133,18 +187,17 @@ Don't run any of these yet, you are not finished with the installation.
133
187
 
134
188
  `npm run sb:alt-port` (optional) will run storybook in watch mode and run it using a specific port number.
135
189
 
136
- ### Create the preview.tsx file
190
+ ### Create the preview file
137
191
 
138
192
  First run `npm run sb:deps` to generate a fresh `dependency-previews.json` file in the `.storybook` folder.
139
193
 
140
194
  Make sure that the `"resolveJsonModule"` tsConfig.json setting is set to `true` to import this file.
141
195
 
142
- Now create a `preview.tsx` file in the `.storybook` folder with the following content:
196
+ Now create a `.storybook/preview.ts` file (or `preview.tsx` if your framework requires JSX) with the following content:
143
197
 
144
- ```tsx
198
+ ```ts
145
199
  /// <reference types="vite/client" />
146
200
 
147
- import * as React from 'react'
148
201
  import {
149
202
  defaultPreviewParameters,
150
203
  dependencyPreviewDecorators,
@@ -154,7 +207,7 @@ import {
154
207
  // Import the generated dependency-previews.json file
155
208
  import dependenciesJson from './dependency-previews.json'
156
209
 
157
- // Global styles are imported here
210
+ // Global styles are imported here (optional)
158
211
  import '../src/styles.css'
159
212
 
160
213
  const previewConfig: StorybookPreviewConfig = {
@@ -167,10 +220,10 @@ const previewConfig: StorybookPreviewConfig = {
167
220
  '/src/**/*.stories.@(tsx|ts|jsx|js|svelte)',
168
221
  { eager: false },
169
222
  ),
170
- // Replace this with the base url of your git repository
171
- // This enables the addon to link to the source code of the component
223
+ // Replace this with the URL to your src folder in your git repository.
224
+ // This enables the addon to link to the source code of the component.
172
225
  sourceRootUrl:
173
- 'https://github.com/Dan503/storybook-addon-dependency-previews/blob/main/example-site',
226
+ 'https://github.com/your-org/your-repo/blob/main/src',
174
227
  // This allows Source File Path to open the
175
228
  // component file directly in VS Code when
176
229
  // running in a local host environment.
@@ -1,4 +1,4 @@
1
- //#region \0rolldown/runtime.js
1
+ //#region rolldown:runtime
2
2
  var __create = Object.create;
3
3
  var __defProp = Object.defineProperty;
4
4
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -6,16 +6,12 @@ var __getOwnPropNames = Object.getOwnPropertyNames;
6
6
  var __getProtoOf = Object.getPrototypeOf;
7
7
  var __hasOwnProp = Object.prototype.hasOwnProperty;
8
8
  var __copyProps = (to, from, except, desc) => {
9
- if (from && typeof from === "object" || typeof from === "function") {
10
- for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
11
- key = keys[i];
12
- if (!__hasOwnProp.call(to, key) && key !== except) {
13
- __defProp(to, key, {
14
- get: ((k) => from[k]).bind(null, key),
15
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
16
- });
17
- }
18
- }
9
+ if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
10
+ key = keys[i];
11
+ if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
12
+ get: ((k) => from[k]).bind(null, key),
13
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
14
+ });
19
15
  }
20
16
  return to;
21
17
  };
@@ -1,4 +1,3 @@
1
- Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
1
  const require_addon_vitePlugin = require('./vitePlugin.cjs');
3
2
 
4
3
  //#region src/addon/index.ts
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","names":["sbDepsVitePlugin"],"sources":["../../src/addon/index.ts"],"sourcesContent":["import { sbDepsVitePlugin } from './vitePlugin'\n\nexport async function viteFinal(config: any) {\n\tconfig.plugins = [...(config.plugins ?? []), sbDepsVitePlugin()]\n\treturn config\n}\n"],"mappings":";;;;AAEA,eAAsB,UAAU,QAAa;AAC5C,QAAO,UAAU,CAAC,GAAI,OAAO,WAAW,EAAE,EAAGA,2CAAkB,CAAC;AAChE,QAAO"}
1
+ {"version":3,"file":"index.cjs","names":["sbDepsVitePlugin"],"sources":["../../src/addon/index.ts"],"sourcesContent":["import { sbDepsVitePlugin } from './vitePlugin'\n\nexport async function viteFinal(config: any) {\n\tconfig.plugins = [...(config.plugins ?? []), sbDepsVitePlugin()]\n\treturn config\n}\n"],"mappings":";;;AAEA,eAAsB,UAAU,QAAa;AAC5C,QAAO,UAAU,CAAC,GAAI,OAAO,WAAW,EAAE,EAAGA,2CAAkB,CAAC;AAChE,QAAO"}
@@ -1,4 +1,3 @@
1
- Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
1
 
3
2
  //#region src/addon/preset.ts
4
3
  const addons = ["@storybook/addon-docs", "@storybook/addon-links"];
@@ -1 +1 @@
1
- {"version":3,"file":"preset.cjs","names":[],"sources":["../../src/addon/preset.ts"],"sourcesContent":["export const addons: Array<string> = [\n\t'@storybook/addon-docs',\n\t'@storybook/addon-links',\n]\n"],"mappings":";;;AAAA,MAAa,SAAwB,CACpC,yBACA,yBACA"}
1
+ {"version":3,"file":"preset.cjs","names":["addons: Array<string>"],"sources":["../../src/addon/preset.ts"],"sourcesContent":["export const addons: Array<string> = [\n\t'@storybook/addon-docs',\n\t'@storybook/addon-links',\n]\n"],"mappings":";;AAAA,MAAaA,SAAwB,CACpC,yBACA,yBACA"}
@@ -1 +1 @@
1
- {"version":3,"file":"preset.mjs","names":[],"sources":["../../src/addon/preset.ts"],"sourcesContent":["export const addons: Array<string> = [\n\t'@storybook/addon-docs',\n\t'@storybook/addon-links',\n]\n"],"mappings":";AAAA,MAAa,SAAwB,CACpC,yBACA,yBACA"}
1
+ {"version":3,"file":"preset.mjs","names":["addons: Array<string>"],"sources":["../../src/addon/preset.ts"],"sourcesContent":["export const addons: Array<string> = [\n\t'@storybook/addon-docs',\n\t'@storybook/addon-links',\n]\n"],"mappings":";AAAA,MAAaA,SAAwB,CACpC,yBACA,yBACA"}
@@ -1,7 +1,8 @@
1
- Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
1
+ const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
3
2
  let node_fs = require("node:fs");
3
+ node_fs = require_rolldown_runtime.__toESM(node_fs);
4
4
  let node_path = require("node:path");
5
+ node_path = require_rolldown_runtime.__toESM(node_path);
5
6
 
6
7
  //#region src/addon/vitePlugin.ts
7
8
  function sbDepsVitePlugin() {
@@ -1 +1 @@
1
- {"version":3,"file":"vitePlugin.cjs","names":[],"sources":["../../src/addon/vitePlugin.ts"],"sourcesContent":["import { readFileSync, existsSync } from 'node:fs'\nimport { resolve } from 'node:path'\n\nexport function sbDepsVitePlugin() {\n\tconst virtId = 'virtual:dependency-previews-json'\n\tconst resolved = '\\0' + virtId\n\treturn {\n\t\tname: 'sb-deps',\n\t\tresolveId(id: string) {\n\t\t\treturn id === virtId ? resolved : null\n\t\t},\n\t\tload(id: string) {\n\t\t\tif (id !== resolved) return null\n\t\t\tconst jsonPath = resolve(\n\t\t\t\tprocess.cwd(),\n\t\t\t\t'.storybook/dependency-previews.json',\n\t\t\t)\n\t\t\tconst json = existsSync(jsonPath)\n\t\t\t\t? readFileSync(jsonPath, 'utf8')\n\t\t\t\t: '{}'\n\t\t\treturn `export default ${json};`\n\t\t},\n\t}\n}\n"],"mappings":";;;;;;AAGA,SAAgB,mBAAmB;CAClC,MAAM,SAAS;CACf,MAAM,WAAW,OAAO;AACxB,QAAO;EACN,MAAM;EACN,UAAU,IAAY;AACrB,UAAO,OAAO,SAAS,WAAW;;EAEnC,KAAK,IAAY;AAChB,OAAI,OAAO,SAAU,QAAO;GAC5B,MAAM,kCACL,QAAQ,KAAK,EACb,sCACA;GACD,MAAM,+BAAkB,SAAS,6BACjB,UAAU,OAAO,GAC9B;AACH,UAAO,kBAAkB,KAAK;;EAE/B"}
1
+ {"version":3,"file":"vitePlugin.cjs","names":[],"sources":["../../src/addon/vitePlugin.ts"],"sourcesContent":["import { readFileSync, existsSync } from 'node:fs'\nimport { resolve } from 'node:path'\n\nexport function sbDepsVitePlugin() {\n\tconst virtId = 'virtual:dependency-previews-json'\n\tconst resolved = '\\0' + virtId\n\treturn {\n\t\tname: 'sb-deps',\n\t\tresolveId(id: string) {\n\t\t\treturn id === virtId ? resolved : null\n\t\t},\n\t\tload(id: string) {\n\t\t\tif (id !== resolved) return null\n\t\t\tconst jsonPath = resolve(\n\t\t\t\tprocess.cwd(),\n\t\t\t\t'.storybook/dependency-previews.json',\n\t\t\t)\n\t\t\tconst json = existsSync(jsonPath)\n\t\t\t\t? readFileSync(jsonPath, 'utf8')\n\t\t\t\t: '{}'\n\t\t\treturn `export default ${json};`\n\t\t},\n\t}\n}\n"],"mappings":";;;;;;;AAGA,SAAgB,mBAAmB;CAClC,MAAM,SAAS;CACf,MAAM,WAAW,OAAO;AACxB,QAAO;EACN,MAAM;EACN,UAAU,IAAY;AACrB,UAAO,OAAO,SAAS,WAAW;;EAEnC,KAAK,IAAY;AAChB,OAAI,OAAO,SAAU,QAAO;GAC5B,MAAM,kCACL,QAAQ,KAAK,EACb,sCACA;GACD,MAAM,+BAAkB,SAAS,6BACjB,UAAU,OAAO,GAC9B;AACH,UAAO,kBAAkB,KAAK;;EAE/B"}
@@ -1,4 +1,4 @@
1
- const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
1
+ const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
2
2
  const require_PrimaryPreview = require('../components/PrimaryPreview.cjs');
3
3
  const require_StoryLink = require('../components/StoryLink.cjs');
4
4
  const require_useDependencyGraph = require('../hooks/useDependencyGraph.cjs');
@@ -12,8 +12,9 @@ const require_CubeIcon = require('../components/icons/CubeIcon.cjs');
12
12
  const require_PathCopyMolecule = require('../components/PathCopyMolecule.cjs');
13
13
  const require_SbHeading = require('../components/SbHeading.cjs');
14
14
  let react_jsx_runtime = require("react/jsx-runtime");
15
+ react_jsx_runtime = require_rolldown_runtime.__toESM(react_jsx_runtime);
15
16
  let src_blocks_DependencyPreviews_module_css = require("./DependencyPreviews.module.css");
16
- src_blocks_DependencyPreviews_module_css = require_runtime.__toESM(src_blocks_DependencyPreviews_module_css);
17
+ src_blocks_DependencyPreviews_module_css = require_rolldown_runtime.__toESM(src_blocks_DependencyPreviews_module_css);
17
18
 
18
19
  //#region src/blocks/DependencyPreviews.tsx
19
20
  function DependencyPreviews() {
@@ -1 +1 @@
1
- {"version":3,"file":"DependencyPreviews.cjs","names":["DependencyGraphProvider","useDependencyGraph","s","SbHeading","filterOutStoryAndNonComponentFiles","Expandable","EyeOpen","PrimaryPreview","ArrowToRectangle","PathCopyMolecule","ComponentSourceLink","StoryLink","BuildIcon","SquaresPlus","CubeIcon"],"sources":["../../src/blocks/DependencyPreviews.tsx"],"sourcesContent":["import { PrimaryPreview } from '../components/PrimaryPreview'\nimport { StoryLink } from '../components/StoryLink'\nimport {\n\tDependencyGraphProvider,\n\tfilterOutStoryAndNonComponentFiles,\n\tuseDependencyGraph,\n} from '../hooks/useDependencyGraph'\nimport type { StoryInfo } from '../types'\n\nimport { ComponentSourceLink } from '../components/ComponentSourceLink'\nimport { Expandable } from '../components/Expandable'\nimport { BuildIcon } from '../components/icons/BuildIcon'\nimport { EyeOpen } from '../components/icons/EyeOpen'\nimport { SquaresPlus } from '../components/icons/SquaresPlus'\n\nimport { ArrowToRectangle } from '../components/icons/ArrowToRectangleIcon'\nimport { CubeIcon } from '../components/icons/CubeIcon'\nimport { PathCopyMolecule } from '../components/PathCopyMolecule'\nimport { SbHeading } from '../components/SbHeading'\nimport s from './DependencyPreviews.module.css'\n\nexport function DependencyPreviews() {\n\treturn (\n\t\t<DependencyGraphProvider>\n\t\t\t<TopLevelDependencyPreviews />\n\t\t</DependencyGraphProvider>\n\t)\n}\n\nfunction TopLevelDependencyPreviews() {\n\tconst { node } = useDependencyGraph()\n\tif (!node) return <div>No dependency previews for this component.</div>\n\n\treturn (\n\t\t<div className={s.topLevelWrapper}>\n\t\t\t<SbHeading>Dependency previews</SbHeading>\n\t\t\t<DepsPreviewContent storyInfo={node} enablePreview={false} />\n\t\t</div>\n\t)\n}\n\ninterface PropsForDepsPreviewContent {\n\tstoryInfo: StoryInfo\n\tenablePreview?: boolean\n}\nfunction DepsPreviewContent({\n\tstoryInfo,\n\tenablePreview = true,\n}: PropsForDepsPreviewContent) {\n\tconst { graph } = useDependencyGraph()\n\tconst { builtWith, usedIn } = graph![storyInfo.componentPath]\n\tconst filteredBuiltWith = filterOutStoryAndNonComponentFiles(builtWith)\n\tconst filteredUsedIn = filterOutStoryAndNonComponentFiles(usedIn)\n\n\treturn (\n\t\t<div>\n\t\t\t{enablePreview && (\n\t\t\t\t<Expandable\n\t\t\t\t\tHeader={`Preview ${storyInfo.storyTitle} component`}\n\t\t\t\t\tIcon={EyeOpen}\n\t\t\t\t>\n\t\t\t\t\t<PrimaryPreview storyInfo={storyInfo} />\n\t\t\t\t</Expandable>\n\t\t\t)}\n\n\t\t\t<Expandable\n\t\t\t\tHeader={`Paths to ${storyInfo.storyTitle} component`}\n\t\t\t\tIcon={ArrowToRectangle}\n\t\t\t>\n\t\t\t\t<div className={s.pathData}>\n\t\t\t\t\t<PathCopyMolecule\n\t\t\t\t\t\tlabel=\"Source File Path\"\n\t\t\t\t\t\tcopyContent={storyInfo.componentPath}\n\t\t\t\t\t>\n\t\t\t\t\t\t<ComponentSourceLink storyInfo={storyInfo} />\n\t\t\t\t\t</PathCopyMolecule>\n\n\t\t\t\t\t<PathCopyMolecule\n\t\t\t\t\t\tlabel=\"Story Title Path\"\n\t\t\t\t\t\tcopyContent={storyInfo.storyTitlePath!}\n\t\t\t\t\t>\n\t\t\t\t\t\t<StoryLink info={storyInfo}>\n\t\t\t\t\t\t\t<span\n\t\t\t\t\t\t\t\tdangerouslySetInnerHTML={{\n\t\t\t\t\t\t\t\t\t// allow line breaks on slashes\n\t\t\t\t\t\t\t\t\t__html: storyInfo.storyTitlePath!.replaceAll(\n\t\t\t\t\t\t\t\t\t\t'/',\n\t\t\t\t\t\t\t\t\t\t'/<wbr/>',\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</StoryLink>\n\t\t\t\t\t</PathCopyMolecule>\n\n\t\t\t\t\t<PathCopyMolecule\n\t\t\t\t\t\tlabel=\"Story Page ID\"\n\t\t\t\t\t\tcopyContent={storyInfo.storyId!}\n\t\t\t\t\t>\n\t\t\t\t\t\t<StoryLink info={storyInfo}>\n\t\t\t\t\t\t\t{storyInfo.storyId}\n\t\t\t\t\t\t</StoryLink>\n\t\t\t\t\t</PathCopyMolecule>\n\t\t\t\t</div>\n\t\t\t</Expandable>\n\n\t\t\t{filteredBuiltWith.length > 0 && (\n\t\t\t\t<Expandable\n\t\t\t\t\tHeader={`Built with ${\n\t\t\t\t\t\tfilteredBuiltWith.length\n\t\t\t\t\t} component${plural(filteredBuiltWith)}`}\n\t\t\t\t\tIcon={BuildIcon}\n\t\t\t\t>\n\t\t\t\t\t<ul>\n\t\t\t\t\t\t{filterOutStoryAndNonComponentFiles(builtWith).map(\n\t\t\t\t\t\t\t(info) => (\n\t\t\t\t\t\t\t\t<DepsPreviewItem\n\t\t\t\t\t\t\t\t\tstoryInfo={info}\n\t\t\t\t\t\t\t\t\tkey={info.componentPath}\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t)}\n\t\t\t\t\t</ul>\n\t\t\t\t</Expandable>\n\t\t\t)}\n\t\t\t{filteredUsedIn.length > 0 && (\n\t\t\t\t<Expandable\n\t\t\t\t\tHeader={`Used in ${filteredUsedIn.length} component${plural(\n\t\t\t\t\t\tfilteredUsedIn,\n\t\t\t\t\t)}`}\n\t\t\t\t\tIcon={SquaresPlus}\n\t\t\t\t>\n\t\t\t\t\t<ul>\n\t\t\t\t\t\t{filterOutStoryAndNonComponentFiles(usedIn).map(\n\t\t\t\t\t\t\t(info) => (\n\t\t\t\t\t\t\t\t<DepsPreviewItem\n\t\t\t\t\t\t\t\t\tstoryInfo={info}\n\t\t\t\t\t\t\t\t\tkey={info.componentPath}\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t)}\n\t\t\t\t\t</ul>\n\t\t\t\t</Expandable>\n\t\t\t)}\n\t\t</div>\n\t)\n}\n\ninterface PropsForDepsPreviewItem {\n\tstoryInfo: StoryInfo\n}\n\nfunction DepsPreviewItem({ storyInfo }: PropsForDepsPreviewItem) {\n\treturn (\n\t\t<li key={storyInfo.componentPath}>\n\t\t\t{storyInfo.storyId ? (\n\t\t\t\t<Expandable\n\t\t\t\t\tIcon={CubeIcon}\n\t\t\t\t\tHeader={\n\t\t\t\t\t\t<StoryLink info={storyInfo} tooltipPosition=\"right\" />\n\t\t\t\t\t}\n\t\t\t\t>\n\t\t\t\t\t<DepsPreviewContent storyInfo={storyInfo} />\n\t\t\t\t</Expandable>\n\t\t\t) : (\n\t\t\t\t<StoryLink info={storyInfo} />\n\t\t\t)}\n\t\t</li>\n\t)\n}\n\nfunction plural(arr: Array<any>) {\n\treturn arr.length === 1 ? '' : 's'\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAqBA,SAAgB,qBAAqB;AACpC,QACC,2CAACA,gEACA,2CAAC,+BAA6B,GACL;;AAI5B,SAAS,6BAA6B;CACrC,MAAM,EAAE,SAASC,+CAAoB;AACrC,KAAI,CAAC,KAAM,QAAO,2CAAC,mBAAI,+CAAgD;AAEvE,QACC,4CAAC;EAAI,WAAWC,iDAAE;aACjB,2CAACC,yCAAU,wBAA+B,EAC1C,2CAAC;GAAmB,WAAW;GAAM,eAAe;IAAS;GACxD;;AAQR,SAAS,mBAAmB,EAC3B,WACA,gBAAgB,QACc;CAC9B,MAAM,EAAE,UAAUF,+CAAoB;CACtC,MAAM,EAAE,WAAW,WAAW,MAAO,UAAU;CAC/C,MAAM,oBAAoBG,8DAAmC,UAAU;CACvE,MAAM,iBAAiBA,8DAAmC,OAAO;AAEjE,QACC,4CAAC;EACC,iBACA,2CAACC;GACA,QAAQ,WAAW,UAAU,WAAW;GACxC,MAAMC;aAEN,2CAACC,yCAA0B,YAAa;IAC5B;EAGd,2CAACF;GACA,QAAQ,YAAY,UAAU,WAAW;GACzC,MAAMG;aAEN,4CAAC;IAAI,WAAWN,iDAAE;;KACjB,2CAACO;MACA,OAAM;MACN,aAAa,UAAU;gBAEvB,2CAACC,mDAA+B,YAAa;OAC3B;KAEnB,2CAACD;MACA,OAAM;MACN,aAAa,UAAU;gBAEvB,2CAACE;OAAU,MAAM;iBAChB,2CAAC,UACA,yBAAyB,EAExB,QAAQ,UAAU,eAAgB,WACjC,KACA,UACA,EACD,GACA;QACS;OACM;KAEnB,2CAACF;MACA,OAAM;MACN,aAAa,UAAU;gBAEvB,2CAACE;OAAU,MAAM;iBACf,UAAU;QACA;OACM;;KACd;IACM;EAEZ,kBAAkB,SAAS,KAC3B,2CAACN;GACA,QAAQ,cACP,kBAAkB,OAClB,YAAY,OAAO,kBAAkB;GACtC,MAAMO;aAEN,2CAAC,kBACCR,8DAAmC,UAAU,CAAC,KAC7C,SACA,2CAAC,mBACA,WAAW,QACN,KAAK,cACT,CAEH,GACG;IACO;EAEb,eAAe,SAAS,KACxB,2CAACC;GACA,QAAQ,WAAW,eAAe,OAAO,YAAY,OACpD,eACA;GACD,MAAMQ;aAEN,2CAAC,kBACCT,8DAAmC,OAAO,CAAC,KAC1C,SACA,2CAAC,mBACA,WAAW,QACN,KAAK,cACT,CAEH,GACG;IACO;KAET;;AAQR,SAAS,gBAAgB,EAAE,aAAsC;AAChE,QACC,2CAAC,kBACC,UAAU,UACV,2CAACC;EACA,MAAMS;EACN,QACC,2CAACH;GAAU,MAAM;GAAW,iBAAgB;IAAU;YAGvD,2CAAC,sBAA8B,YAAa;GAChC,GAEb,2CAACA,+BAAU,MAAM,YAAa,IAXvB,UAAU,cAad;;AAIP,SAAS,OAAO,KAAiB;AAChC,QAAO,IAAI,WAAW,IAAI,KAAK"}
1
+ {"version":3,"file":"DependencyPreviews.cjs","names":["DependencyGraphProvider","useDependencyGraph","s","SbHeading","filterOutStoryAndNonComponentFiles","Expandable","EyeOpen","PrimaryPreview","ArrowToRectangle","PathCopyMolecule","ComponentSourceLink","StoryLink","BuildIcon","SquaresPlus","CubeIcon"],"sources":["../../src/blocks/DependencyPreviews.tsx"],"sourcesContent":["import { PrimaryPreview } from '../components/PrimaryPreview'\nimport { StoryLink } from '../components/StoryLink'\nimport {\n\tDependencyGraphProvider,\n\tfilterOutStoryAndNonComponentFiles,\n\tuseDependencyGraph,\n} from '../hooks/useDependencyGraph'\nimport type { StoryInfo } from '../types'\n\nimport { ComponentSourceLink } from '../components/ComponentSourceLink'\nimport { Expandable } from '../components/Expandable'\nimport { BuildIcon } from '../components/icons/BuildIcon'\nimport { EyeOpen } from '../components/icons/EyeOpen'\nimport { SquaresPlus } from '../components/icons/SquaresPlus'\n\nimport { ArrowToRectangle } from '../components/icons/ArrowToRectangleIcon'\nimport { CubeIcon } from '../components/icons/CubeIcon'\nimport { PathCopyMolecule } from '../components/PathCopyMolecule'\nimport { SbHeading } from '../components/SbHeading'\nimport s from './DependencyPreviews.module.css'\n\nexport function DependencyPreviews() {\n\treturn (\n\t\t<DependencyGraphProvider>\n\t\t\t<TopLevelDependencyPreviews />\n\t\t</DependencyGraphProvider>\n\t)\n}\n\nfunction TopLevelDependencyPreviews() {\n\tconst { node } = useDependencyGraph()\n\tif (!node) return <div>No dependency previews for this component.</div>\n\n\treturn (\n\t\t<div className={s.topLevelWrapper}>\n\t\t\t<SbHeading>Dependency previews</SbHeading>\n\t\t\t<DepsPreviewContent storyInfo={node} enablePreview={false} />\n\t\t</div>\n\t)\n}\n\ninterface PropsForDepsPreviewContent {\n\tstoryInfo: StoryInfo\n\tenablePreview?: boolean\n}\nfunction DepsPreviewContent({\n\tstoryInfo,\n\tenablePreview = true,\n}: PropsForDepsPreviewContent) {\n\tconst { graph } = useDependencyGraph()\n\tconst { builtWith, usedIn } = graph![storyInfo.componentPath]\n\tconst filteredBuiltWith = filterOutStoryAndNonComponentFiles(builtWith)\n\tconst filteredUsedIn = filterOutStoryAndNonComponentFiles(usedIn)\n\n\treturn (\n\t\t<div>\n\t\t\t{enablePreview && (\n\t\t\t\t<Expandable\n\t\t\t\t\tHeader={`Preview ${storyInfo.storyTitle} component`}\n\t\t\t\t\tIcon={EyeOpen}\n\t\t\t\t>\n\t\t\t\t\t<PrimaryPreview storyInfo={storyInfo} />\n\t\t\t\t</Expandable>\n\t\t\t)}\n\n\t\t\t<Expandable\n\t\t\t\tHeader={`Paths to ${storyInfo.storyTitle} component`}\n\t\t\t\tIcon={ArrowToRectangle}\n\t\t\t>\n\t\t\t\t<div className={s.pathData}>\n\t\t\t\t\t<PathCopyMolecule\n\t\t\t\t\t\tlabel=\"Source File Path\"\n\t\t\t\t\t\tcopyContent={storyInfo.componentPath}\n\t\t\t\t\t>\n\t\t\t\t\t\t<ComponentSourceLink storyInfo={storyInfo} />\n\t\t\t\t\t</PathCopyMolecule>\n\n\t\t\t\t\t<PathCopyMolecule\n\t\t\t\t\t\tlabel=\"Story Title Path\"\n\t\t\t\t\t\tcopyContent={storyInfo.storyTitlePath!}\n\t\t\t\t\t>\n\t\t\t\t\t\t<StoryLink info={storyInfo}>\n\t\t\t\t\t\t\t<span\n\t\t\t\t\t\t\t\tdangerouslySetInnerHTML={{\n\t\t\t\t\t\t\t\t\t// allow line breaks on slashes\n\t\t\t\t\t\t\t\t\t__html: storyInfo.storyTitlePath!.replaceAll(\n\t\t\t\t\t\t\t\t\t\t'/',\n\t\t\t\t\t\t\t\t\t\t'/<wbr/>',\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</StoryLink>\n\t\t\t\t\t</PathCopyMolecule>\n\n\t\t\t\t\t<PathCopyMolecule\n\t\t\t\t\t\tlabel=\"Story Page ID\"\n\t\t\t\t\t\tcopyContent={storyInfo.storyId!}\n\t\t\t\t\t>\n\t\t\t\t\t\t<StoryLink info={storyInfo}>\n\t\t\t\t\t\t\t{storyInfo.storyId}\n\t\t\t\t\t\t</StoryLink>\n\t\t\t\t\t</PathCopyMolecule>\n\t\t\t\t</div>\n\t\t\t</Expandable>\n\n\t\t\t{filteredBuiltWith.length > 0 && (\n\t\t\t\t<Expandable\n\t\t\t\t\tHeader={`Built with ${\n\t\t\t\t\t\tfilteredBuiltWith.length\n\t\t\t\t\t} component${plural(filteredBuiltWith)}`}\n\t\t\t\t\tIcon={BuildIcon}\n\t\t\t\t>\n\t\t\t\t\t<ul>\n\t\t\t\t\t\t{filterOutStoryAndNonComponentFiles(builtWith).map(\n\t\t\t\t\t\t\t(info) => (\n\t\t\t\t\t\t\t\t<DepsPreviewItem\n\t\t\t\t\t\t\t\t\tstoryInfo={info}\n\t\t\t\t\t\t\t\t\tkey={info.componentPath}\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t)}\n\t\t\t\t\t</ul>\n\t\t\t\t</Expandable>\n\t\t\t)}\n\t\t\t{filteredUsedIn.length > 0 && (\n\t\t\t\t<Expandable\n\t\t\t\t\tHeader={`Used in ${filteredUsedIn.length} component${plural(\n\t\t\t\t\t\tfilteredUsedIn,\n\t\t\t\t\t)}`}\n\t\t\t\t\tIcon={SquaresPlus}\n\t\t\t\t>\n\t\t\t\t\t<ul>\n\t\t\t\t\t\t{filterOutStoryAndNonComponentFiles(usedIn).map(\n\t\t\t\t\t\t\t(info) => (\n\t\t\t\t\t\t\t\t<DepsPreviewItem\n\t\t\t\t\t\t\t\t\tstoryInfo={info}\n\t\t\t\t\t\t\t\t\tkey={info.componentPath}\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t)}\n\t\t\t\t\t</ul>\n\t\t\t\t</Expandable>\n\t\t\t)}\n\t\t</div>\n\t)\n}\n\ninterface PropsForDepsPreviewItem {\n\tstoryInfo: StoryInfo\n}\n\nfunction DepsPreviewItem({ storyInfo }: PropsForDepsPreviewItem) {\n\treturn (\n\t\t<li key={storyInfo.componentPath}>\n\t\t\t{storyInfo.storyId ? (\n\t\t\t\t<Expandable\n\t\t\t\t\tIcon={CubeIcon}\n\t\t\t\t\tHeader={\n\t\t\t\t\t\t<StoryLink info={storyInfo} tooltipPosition=\"right\" />\n\t\t\t\t\t}\n\t\t\t\t>\n\t\t\t\t\t<DepsPreviewContent storyInfo={storyInfo} />\n\t\t\t\t</Expandable>\n\t\t\t) : (\n\t\t\t\t<StoryLink info={storyInfo} />\n\t\t\t)}\n\t\t</li>\n\t)\n}\n\nfunction plural(arr: Array<any>) {\n\treturn arr.length === 1 ? '' : 's'\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAqBA,SAAgB,qBAAqB;AACpC,QACC,2CAACA,gEACA,2CAAC,+BAA6B,GACL;;AAI5B,SAAS,6BAA6B;CACrC,MAAM,EAAE,SAASC,+CAAoB;AACrC,KAAI,CAAC,KAAM,QAAO,2CAAC,mBAAI,+CAAgD;AAEvE,QACC,4CAAC;EAAI,WAAWC,iDAAE;aACjB,2CAACC,yCAAU,wBAA+B,EAC1C,2CAAC;GAAmB,WAAW;GAAM,eAAe;IAAS;GACxD;;AAQR,SAAS,mBAAmB,EAC3B,WACA,gBAAgB,QACc;CAC9B,MAAM,EAAE,UAAUF,+CAAoB;CACtC,MAAM,EAAE,WAAW,WAAW,MAAO,UAAU;CAC/C,MAAM,oBAAoBG,8DAAmC,UAAU;CACvE,MAAM,iBAAiBA,8DAAmC,OAAO;AAEjE,QACC,4CAAC;EACC,iBACA,2CAACC;GACA,QAAQ,WAAW,UAAU,WAAW;GACxC,MAAMC;aAEN,2CAACC,yCAA0B,YAAa;IAC5B;EAGd,2CAACF;GACA,QAAQ,YAAY,UAAU,WAAW;GACzC,MAAMG;aAEN,4CAAC;IAAI,WAAWN,iDAAE;;KACjB,2CAACO;MACA,OAAM;MACN,aAAa,UAAU;gBAEvB,2CAACC,mDAA+B,YAAa;OAC3B;KAEnB,2CAACD;MACA,OAAM;MACN,aAAa,UAAU;gBAEvB,2CAACE;OAAU,MAAM;iBAChB,2CAAC,UACA,yBAAyB,EAExB,QAAQ,UAAU,eAAgB,WACjC,KACA,UACA,EACD,GACA;QACS;OACM;KAEnB,2CAACF;MACA,OAAM;MACN,aAAa,UAAU;gBAEvB,2CAACE;OAAU,MAAM;iBACf,UAAU;QACA;OACM;;KACd;IACM;EAEZ,kBAAkB,SAAS,KAC3B,2CAACN;GACA,QAAQ,cACP,kBAAkB,OAClB,YAAY,OAAO,kBAAkB;GACtC,MAAMO;aAEN,2CAAC,kBACCR,8DAAmC,UAAU,CAAC,KAC7C,SACA,2CAAC,mBACA,WAAW,QACN,KAAK,cACT,CAEH,GACG;IACO;EAEb,eAAe,SAAS,KACxB,2CAACC;GACA,QAAQ,WAAW,eAAe,OAAO,YAAY,OACpD,eACA;GACD,MAAMQ;aAEN,2CAAC,kBACCT,8DAAmC,OAAO,CAAC,KAC1C,SACA,2CAAC,mBACA,WAAW,QACN,KAAK,cACT,CAEH,GACG;IACO;KAET;;AAQR,SAAS,gBAAgB,EAAE,aAAsC;AAChE,QACC,2CAAC,kBACC,UAAU,UACV,2CAACC;EACA,MAAMS;EACN,QACC,2CAACH;GAAU,MAAM;GAAW,iBAAgB;IAAU;YAGvD,2CAAC,sBAA8B,YAAa;GAChC,GAEb,2CAACA,+BAAU,MAAM,YAAa,IAXvB,UAAU,cAad;;AAIP,SAAS,OAAO,KAAiB;AAChC,QAAO,IAAI,WAAW,IAAI,KAAK"}
@@ -1,7 +1,7 @@
1
- import * as react_jsx_runtime2 from "react/jsx-runtime";
1
+ import * as react_jsx_runtime0 from "react/jsx-runtime";
2
2
 
3
3
  //#region src/blocks/DependencyPreviews.d.ts
4
- declare function DependencyPreviews(): react_jsx_runtime2.JSX.Element;
4
+ declare function DependencyPreviews(): react_jsx_runtime0.JSX.Element;
5
5
  //#endregion
6
6
  export { DependencyPreviews };
7
7
  //# sourceMappingURL=DependencyPreviews.d.cts.map
@@ -1,7 +1,7 @@
1
- import * as react_jsx_runtime3 from "react/jsx-runtime";
1
+ import * as react_jsx_runtime0 from "react/jsx-runtime";
2
2
 
3
3
  //#region src/blocks/DependencyPreviews.d.ts
4
- declare function DependencyPreviews(): react_jsx_runtime3.JSX.Element;
4
+ declare function DependencyPreviews(): react_jsx_runtime0.JSX.Element;
5
5
  //#endregion
6
6
  export { DependencyPreviews };
7
7
  //# sourceMappingURL=DependencyPreviews.d.mts.map
@@ -1,13 +1,17 @@
1
1
  #!/usr/bin/env node
2
- const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
2
+ const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
3
3
  let node_fs = require("node:fs");
4
+ node_fs = require_rolldown_runtime.__toESM(node_fs);
4
5
  let node_path = require("node:path");
6
+ node_path = require_rolldown_runtime.__toESM(node_path);
5
7
  let node_child_process = require("node:child_process");
8
+ node_child_process = require_rolldown_runtime.__toESM(node_child_process);
6
9
  let node_url = require("node:url");
7
- let _parcel_watcher = require("@parcel/watcher");
8
- _parcel_watcher = require_runtime.__toESM(_parcel_watcher);
10
+ node_url = require_rolldown_runtime.__toESM(node_url);
11
+ let __parcel_watcher = require("@parcel/watcher");
12
+ __parcel_watcher = require_rolldown_runtime.__toESM(__parcel_watcher);
9
13
  let micromatch = require("micromatch");
10
- micromatch = require_runtime.__toESM(micromatch);
14
+ micromatch = require_rolldown_runtime.__toESM(micromatch);
11
15
 
12
16
  //#region cli/sb-deps.ts
13
17
  const argv = process.argv.slice(2);
@@ -87,9 +91,16 @@ function isComponentsTsx(absPath) {
87
91
  const norm = absPath.replace(/\\/g, "/");
88
92
  return /\/src\/components\/.+\.tsx$/i.test(norm) && !/\.stories?\.tsx$/i.test(norm);
89
93
  }
94
+ function isComponentsSvelte(absPath) {
95
+ const norm = absPath.replace(/\\/g, "/");
96
+ return /\/src\/components\/.+\.svelte$/i.test(norm) && !/\.stories?\.svelte$/i.test(norm);
97
+ }
90
98
  function componentBaseFromComponent(absCompPath) {
91
99
  return (0, node_path.basename)(absCompPath, ".tsx");
92
100
  }
101
+ function componentBaseFromSvelteComponent(absCompPath) {
102
+ return (0, node_path.basename)(absCompPath, ".svelte");
103
+ }
93
104
  function detectAtomicTag(absPath) {
94
105
  const adaptedPath = absPath.toLowerCase().replace(/\\/g, "/");
95
106
  const tokens = [
@@ -115,6 +126,11 @@ function storyPathForComponent(absCompPath) {
115
126
  const base = componentBaseFromComponent(absCompPath);
116
127
  return (0, node_path.join)(dir, `${base}.stories.tsx`);
117
128
  }
129
+ function storyPathForSvelteComponent(absCompPath) {
130
+ const dir = (0, node_path.dirname)(absCompPath);
131
+ const base = componentBaseFromSvelteComponent(absCompPath);
132
+ return (0, node_path.join)(dir, `${base}.stories.svelte`);
133
+ }
118
134
  function makeTitleFromComponent(absCompPath) {
119
135
  const srcRoot = (0, node_path.join)(projectRoot, "src") + node_path.sep;
120
136
  const normAbs = absCompPath.replace(/\\/g, "/");
@@ -191,6 +207,85 @@ function ensureStoryForComponent(absCompPath) {
191
207
  if ((0, node_fs.existsSync)(sPath)) return null;
192
208
  return scaffoldStoryForComponent(absCompPath);
193
209
  }
210
+ function scaffoldSvelteComponent(absCompPath) {
211
+ const base = componentBaseFromSvelteComponent(absCompPath);
212
+ const componentName = toPascalCase(base);
213
+ const tpl = `<script lang="ts">
214
+ import type { Snippet } from 'svelte';
215
+
216
+ export interface PropsFor${componentName} {
217
+ children?: Snippet;
218
+ }
219
+
220
+ const { children }: PropsFor${componentName} = $props();
221
+ <\/script>
222
+
223
+ <div class="${componentName}">
224
+ <p>${componentName}</p>
225
+ {@render children?.()}
226
+ </div>
227
+
228
+ <style>
229
+ .${componentName} {
230
+ /* styles go here */
231
+ }
232
+ </style>
233
+ `;
234
+ (0, node_fs.writeFileSync)(absCompPath, tpl, "utf8");
235
+ info(`scaffolded svelte component → ${rel(absCompPath)}`);
236
+ }
237
+ function makeTitleFromSvelteComponent(absCompPath) {
238
+ const srcRoot = (0, node_path.join)(projectRoot, "src") + node_path.sep;
239
+ const normAbs = absCompPath.replace(/\\/g, "/");
240
+ const relFromSrc = normAbs.startsWith(srcRoot.replace(/\\/g, "/")) ? normAbs.slice(srcRoot.length) : absCompPath.replace(projectRoot + node_path.sep, "").replace(/\\/g, "/");
241
+ const dir = node_path.posix.dirname(relFromSrc);
242
+ let segments = dir.split("/").filter(Boolean);
243
+ if (segments[0] && /^components?$/i.test(segments[0])) segments = segments.slice(1);
244
+ const titledFolders = segments.map((s) => toTitleCase(toWords(s)));
245
+ const compName = componentBaseFromSvelteComponent(absCompPath);
246
+ const compTitle = toTitleCase(toWords(compName));
247
+ const fullStoryPath = [...titledFolders, compTitle].filter(Boolean);
248
+ const dedupedStoryPath = [...new Set(fullStoryPath)];
249
+ return dedupedStoryPath.join(" / ");
250
+ }
251
+ function scaffoldStoryForSvelteComponent(absCompPath) {
252
+ const base = componentBaseFromSvelteComponent(absCompPath);
253
+ const componentName = toPascalCase(base);
254
+ const title = makeTitleFromSvelteComponent(absCompPath);
255
+ const atomic = detectAtomicTag(absCompPath);
256
+ const tags = ["autodocs"];
257
+ if (atomic) tags.push(atomic);
258
+ const storyTpl = `<script lang="ts" module>
259
+ import type { StoryParameters } from 'storybook-addon-dependency-previews'
260
+ import ${componentName}, { type PropsFor${componentName} } from './${componentName}.svelte'
261
+ import { defineMeta } from '@storybook/addon-svelte-csf';
262
+
263
+ const { Story } = defineMeta({
264
+ title: '${title}',
265
+ component: ${componentName},
266
+ tags: [${tags.map((t) => `'${t}'`).join(", ")}],
267
+ parameters: {
268
+ layout: 'padded',
269
+ __filePath: import.meta.url,
270
+ } satisfies StoryParameters,
271
+ })
272
+ type Args = Omit<PropsFor${componentName}, 'children'>;
273
+ <\/script>
274
+
275
+ <Story name="Primary" args={{} satisfies Args}>
276
+ <p>${title}</p>
277
+ </Story>
278
+ `;
279
+ const storyPath = storyPathForSvelteComponent(absCompPath);
280
+ (0, node_fs.writeFileSync)(storyPath, storyTpl, "utf8");
281
+ info(`scaffolded svelte story → ${rel(storyPath)}`);
282
+ return storyPath;
283
+ }
284
+ function ensureStoryForSvelteComponent(absCompPath) {
285
+ const sPath = storyPathForSvelteComponent(absCompPath);
286
+ if ((0, node_fs.existsSync)(sPath)) return null;
287
+ return scaffoldStoryForSvelteComponent(absCompPath);
288
+ }
194
289
  function startWatcher() {
195
290
  const root = projectRoot;
196
291
  const includeGlobs = [
@@ -221,7 +316,7 @@ function startWatcher() {
221
316
  pending = false;
222
317
  }, 120);
223
318
  }
224
- return _parcel_watcher.default.subscribe(root, async (err, events) => {
319
+ return __parcel_watcher.default.subscribe(root, async (err, events) => {
225
320
  if (err) {
226
321
  error(`watch error ${err?.message || err}`);
227
322
  return;
@@ -240,6 +335,10 @@ function startWatcher() {
240
335
  await handleComponentCreation(abs, relPath);
241
336
  continue;
242
337
  }
338
+ if (isComponentsSvelte(abs) && ev.type === "create") {
339
+ await handleSvelteComponentCreation(abs, relPath);
340
+ continue;
341
+ }
243
342
  kick(ev.type, abs);
244
343
  }
245
344
  }, { ignore: ignoreGlobs }).then((result) => {
@@ -256,6 +355,16 @@ function startWatcher() {
256
355
  kick("create:story", createdStory);
257
356
  }
258
357
  }
358
+ async function handleSvelteComponentCreation(abs, relPath) {
359
+ if (isEmptyOrWhitespace(abs)) {
360
+ scaffoldSvelteComponent(abs);
361
+ }
362
+ console.log("Svelte component creation detected:", relPath);
363
+ const createdStory = ensureStoryForSvelteComponent(abs);
364
+ if (createdStory) {
365
+ kick("create:story", createdStory);
366
+ }
367
+ }
259
368
  }
260
369
  let sbChild = null;
261
370
  async function startStorybook() {