@andersundsehr/storybook-typo3 0.1.9 → 0.1.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,9 +1,9 @@
1
1
  # `EXT:storybook`
2
- <img alt="TYPO3" src="./Documentation/assets/TYPO3-Logo-rgb.svg" height="40" /> &nbsp;&nbsp;&nbsp;&nbsp;
3
- <img alt="Love" src="./Documentation/assets/heart.svg" height="40" /> &nbsp;&nbsp;&nbsp;&nbsp;
2
+ <img alt="TYPO3" src="./Documentation/assets/TYPO3-Logo-rgb.svg" height="40" />
3
+ <img alt="Love" src="./Documentation/assets/heart.svg" height="40" />
4
4
  <img alt="Storybook" src="./Documentation/assets/logo-storybook-default.svg" height="40" />
5
5
 
6
- [Getting Started](https://docs.typo3.org/p/andersundsehr/storybook)
6
+ [Getting Started](https://docs.typo3.org/permalink/andersundsehr-storybook:start) - [TYPO3 Slack](https://typo3.slack.com/archives/C098AQPGXLM)
7
7
 
8
8
  The TYPO3 extension `storybook` integrates Storybook into TYPO3 projects.
9
9
  With the open-source tool Storybook, developers can develop and test UI components in isolation.
@@ -46,7 +46,7 @@ After that you can run storybook with:
46
46
  npx http-server ./storybook-static
47
47
  ```
48
48
 
49
- > Also See [full installation steps](https://docs.typo3.org/p/andersundsehr/storybook/latest/en-us/Installation/Index.html) in the Getting Started Guide.
49
+ > Also See [full installation steps](https://docs.typo3.org/permalink/andersundsehr-storybook:installation) in the Getting Started Guide.
50
50
 
51
51
  ## Configuration:
52
52
 
@@ -154,7 +154,7 @@ You can Select the site and the language in the top right corner of the Storyboo
154
154
 
155
155
  ## Documentation: Where to find more information? (Links, references, tutorials)
156
156
 
157
- https://docs.typo3.org/p/andersundsehr/storybook
157
+ https://docs.typo3.org/permalink/andersundsehr-storybook:start
158
158
 
159
159
  - docs TODO link to hosted Storybook instance
160
160
  - docs TODO link to playwright report?
@@ -211,15 +211,3 @@ This extension is licensed under the [GPL-2.0-or-later](https://spdx.org/license
211
211
 
212
212
  > We are always looking for great people to join our team!
213
213
  > https://www.andersundsehr.com/karriere/
214
-
215
-
216
- # TODOs
217
- - [ ] add storybook:transform ViewHelper to code generation?
218
- - [ ] add storybook:toDateTime ViewHelper to code generation!
219
-
220
- - [ ] document transformers
221
- - [ ] document .transformers.php
222
- - [ ] document how/when to use the transformers
223
- - [ ] document storybook:transform ViewHelper
224
- - [ ] document storybook:toDateTime ViewHelper
225
- - [ ] document that enums and dates are automatically handled by the extension
@@ -1,6 +1,6 @@
1
1
  import { SourceType } from 'storybook/internal/docs-tools';
2
2
  import { type FluidRenderer } from '@andersundsehr/storybook-typo3';
3
- import { DecoratorFunction } from 'storybook/internal/types';
3
+ import { type DecoratorFunction } from 'storybook/internal/types';
4
4
  export declare const tags: string[];
5
5
  export declare const decorators: DecoratorFunction<FluidRenderer>[];
6
6
  export declare const parameters: {
@@ -1,8 +1,35 @@
1
+ /*
2
+ We want to make it obvious for the user what he has to do.
3
+
4
+ We have 2 different usecases:
5
+ - background fetches (componentMeta & preview)
6
+ - html Fetches
7
+
8
+ most of the time the user has to do something in there IDE to fix the problem.
9
+ So we want to show a message that tells the user what he has to do.
10
+
11
+ In the case of a background fetch, we want to show the full error in the console.
12
+ And give the user a alert with the error message and a retry button.
13
+
14
+ In the case of a html fetch, we want to show the error as html response?
15
+ - yes: because the user can see the error in the browser and can fix it
16
+ - no: because storybook dose not understand that it is an error
17
+
18
+ In any case we should get the error in json so we can handle it in the frontend as we like.
19
+ Some times it can still be text/html so we need to handle that as well.
20
+ */
1
21
  export async function fetchWithUserRetry(url, options, message, result = 'json') {
2
22
  options = { ...options }; // Clone options to avoid mutating the original
3
23
  options.signal = options.signal || AbortSignal.timeout(5000);
4
24
  try {
5
25
  const response = await fetch(url, options);
26
+ if (!response.ok) {
27
+ // let responseBody = await response.text();
28
+ // if (responseBody) {
29
+ // responseBody += '\n';
30
+ // }
31
+ // throw new Error(`${responseBody}HTTP ${response.status}\nURL: ${url}\nError while fetching ${message}`);
32
+ }
6
33
  if (result === 'text') {
7
34
  return await response.text();
8
35
  }
@@ -10,12 +37,14 @@ export async function fetchWithUserRetry(url, options, message, result = 'json')
10
37
  }
11
38
  catch (error) {
12
39
  console.error('Fetch failed:', { error });
13
- const retry = confirm('Error while fetching ' + message + '. \n\n'
14
- + 'fetch: ' + url + '\n'
15
- + 'ERROR: ' + String(error) + '\n\n'
40
+ const retry = confirm(''
41
+ + 'ERROR: ' + String(error) + '\n\n\n'
42
+ + 'Error while fetching ' + message + '. \n\n'
43
+ + 'fetch: ' + url + '\n\n'
16
44
  + 'look at the console for more details.\n\n'
17
45
  + 'Do you want to retry?');
18
46
  if (retry) {
47
+ options.signal = undefined; // Reset the signal to avoid reusing the same AbortSignal
19
48
  return fetchWithUserRetry(url, options, message);
20
49
  }
21
50
  throw error; // Re-throw the error if the user does not want to retry
package/dist/preset.d.ts CHANGED
@@ -1,5 +1,11 @@
1
1
  import type { PresetProperty } from 'storybook/internal/types';
2
+ import type { ViteFinal } from '@storybook/builder-vite';
2
3
  export declare const addons: string[];
4
+ /**
5
+ * We want storybook to not use your local vite config.
6
+ * As that is not really needed, and can cause issues or break storybook.
7
+ */
8
+ export declare const viteFinal: ViteFinal;
3
9
  export declare const core: PresetProperty<'core'>;
4
10
  export declare const previewAnnotations: PresetProperty<'previewAnnotations'>;
5
11
  export declare const tags: string[];
package/dist/preset.js CHANGED
@@ -8,6 +8,13 @@ export const addons = [
8
8
  '@storybook/addon-docs',
9
9
  '@storybook/addon-a11y',
10
10
  ];
11
+ /**
12
+ * We want storybook to not use your local vite config.
13
+ * As that is not really needed, and can cause issues or break storybook.
14
+ */
15
+ export const viteFinal = (config, options) => {
16
+ return config;
17
+ };
11
18
  export const core = {
12
19
  builder: getAbsolutePath('@storybook/builder-vite'),
13
20
  renderer: getAbsolutePath('@storybook/server'),
@@ -1,5 +1,5 @@
1
1
  import type { Args, StrictArgs } from '@storybook/server';
2
- import { AnnotatedStoryFn, CompatibleString, ComponentAnnotations, DecoratorFunction, LoaderFunction, ProjectAnnotations, StoryAnnotations, StorybookConfig as StorybookConfigBase, StoryContext as StoryContext$1, WebRenderer } from 'storybook/internal/types';
2
+ import type { AnnotatedStoryFn, CompatibleString, ComponentAnnotations, DecoratorFunction, LoaderFunction, ProjectAnnotations, StoryAnnotations, StorybookConfig as StorybookConfigBase, StoryContext as StoryContext$1, WebRenderer } from 'storybook/internal/types';
3
3
  import type { BuilderOptions, StorybookConfigVite } from '@storybook/builder-vite';
4
4
  type FrameworkName = CompatibleString<'@andersundsehr/storybook-typo3'>;
5
5
  type BuilderName = CompatibleString<'@storybook/builder-vite'>;
@@ -54,4 +54,4 @@ type Decorator<TArgs = StrictArgs> = DecoratorFunction<FluidRenderer, TArgs>;
54
54
  type Loader<TArgs = StrictArgs> = LoaderFunction<FluidRenderer, TArgs>;
55
55
  type StoryContext<TArgs = StrictArgs> = StoryContext$1<FluidRenderer, TArgs>;
56
56
  type Preview = ProjectAnnotations<FluidRenderer>;
57
- export { Decorator, Loader, Meta, Preview, FluidRenderer, StoryContext, StoryFn, StoryObj };
57
+ export type { Decorator, Loader, Meta, Preview, FluidRenderer, StoryContext, StoryFn, StoryObj };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@andersundsehr/storybook-typo3",
3
- "description": "The one and only Storybook Renderer for TYPO3 Fluid",
3
+ "description": "The one and only Storybook Renderer for TYPO3 Fluid Components",
4
4
  "keywords": [
5
5
  "storybook",
6
6
  "TYPO3",
@@ -49,5 +49,5 @@
49
49
  "dist",
50
50
  "README.md"
51
51
  ],
52
- "version": "0.1.9"
52
+ "version": "0.1.11"
53
53
  }