Skip to content

Commit

Permalink
Merge branch 'next' into kasper/disable-upgrade-to-same-version-error
Browse files Browse the repository at this point in the history
  • Loading branch information
valentinpalkovic committed May 22, 2024
2 parents 7bff9d1 + 59bf7a2 commit ff1f2f4
Show file tree
Hide file tree
Showing 13 changed files with 124 additions and 89 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## 8.1.2

- Angular: Fix filtering of workspace config styles - [#27108](https://github.com/storybookjs/storybook/pull/27108), thanks @valentinpalkovic!
- Next.js: Avoid interfering with the svgr loader - [#27198](https://github.com/storybookjs/storybook/pull/27198), thanks @seanparmelee!

## 8.1.1

- Docgen: Only add react-docgen info when a component is defined in the file - [#26967](https://github.com/storybookjs/storybook/pull/26967), thanks @glenjamin!
Expand Down
4 changes: 2 additions & 2 deletions code/addons/a11y/src/a11yRunner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ const defaultParameters = { config: {}, options: {} };
* Handle A11yContext events.
* Because the event are sent without manual check, we split calls
*/
const handleRequest = async (storyId: string, input: A11yParameters = defaultParameters) => {
const handleRequest = async (storyId: string, input: A11yParameters | null) => {
if (!input?.manual) {
await run(storyId, input);
await run(storyId, input ?? defaultParameters);
}
};

Expand Down
48 changes: 33 additions & 15 deletions code/builders/builder-manager/templates/template.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,39 @@
<% } else if (favicon.endsWith('.ico')) { %>
<link rel="icon" type="image/x-icon" href="./<%= favicon %>" />
<% } %>
<link
rel="prefetch"
href="./sb-common-assets/nunito-sans-regular.woff2"
as="font"
type="font/woff2"
crossorigin
/>
<link
rel="prefetch"
href="./sb-common-assets/nunito-sans-bold.woff2"
as="font"
type="font/woff2"
crossorigin
/>
<link rel="stylesheet" href="./sb-common-assets/fonts.css" />
<style>
@font-face {
font-family: 'Nunito Sans';
font-style: normal;
font-weight: 400;
font-display: swap;
src: url('./sb-common-assets/nunito-sans-regular.woff2') format('woff2');
}
@font-face {
font-family: 'Nunito Sans';
font-style: italic;
font-weight: 400;
font-display: swap;
src: url('./sb-common-assets/nunito-sans-italic.woff2') format('woff2');
}
@font-face {
font-family: 'Nunito Sans';
font-style: normal;
font-weight: 700;
font-display: swap;
src: url('./sb-common-assets/nunito-sans-bold.woff2') format('woff2');
}
@font-face {
font-family: 'Nunito Sans';
font-style: italic;
font-weight: 700;
font-display: swap;
src: url('./sb-common-assets/nunito-sans-bold-italic.woff2') format('woff2');
}
</style>

<link href="./sb-manager/runtime.js" rel="modulepreload" />

Expand Down
62 changes: 33 additions & 29 deletions code/builders/builder-vite/input/iframe.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,35 +6,39 @@
<title>Storybook</title>
<meta name="viewport" content="width=device-width, initial-scale=1" />

<link
rel="prefetch"
href="./sb-common-assets/nunito-sans-regular.woff2"
as="font"
type="font/woff2"
crossorigin
/>
<link
rel="prefetch"
href="./sb-common-assets/nunito-sans-italic.woff2"
as="font"
type="font/woff2"
crossorigin
/>
<link
rel="prefetch"
href="./sb-common-assets/nunito-sans-bold.woff2"
as="font"
type="font/woff2"
crossorigin
/>
<link
rel="prefetch"
href="./sb-common-assets/nunito-sans-bold-italic.woff2"
as="font"
type="font/woff2"
crossorigin
/>
<link rel="stylesheet" href="./sb-common-assets/fonts.css" />
<style>
@font-face {
font-family: 'Nunito Sans';
font-style: normal;
font-weight: 400;
font-display: swap;
src: url('./sb-common-assets/nunito-sans-regular.woff2') format('woff2');
}

@font-face {
font-family: 'Nunito Sans';
font-style: italic;
font-weight: 400;
font-display: swap;
src: url('./sb-common-assets/nunito-sans-italic.woff2') format('woff2');
}

@font-face {
font-family: 'Nunito Sans';
font-style: normal;
font-weight: 700;
font-display: swap;
src: url('./sb-common-assets/nunito-sans-bold.woff2') format('woff2');
}

@font-face {
font-family: 'Nunito Sans';
font-style: italic;
font-weight: 700;
font-display: swap;
src: url('./sb-common-assets/nunito-sans-bold-italic.woff2') format('woff2');
}
</style>

<script>
window.CONFIG_TYPE = '[CONFIG_TYPE HERE]';
Expand Down
7 changes: 5 additions & 2 deletions code/builders/builder-vite/src/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,11 @@ export async function build(options: Options) {
outDir: options.outputDir,
emptyOutDir: false, // do not clean before running Vite build - Storybook has already added assets in there!
rollupOptions: {
// Do not try to bundle the storybook runtime, it is copied into the output dir after the build.
external: ['./sb-preview/runtime.js'],
external: [
// Do not try to bundle the Storybook runtime, it is copied into the output dir after the build.
'./sb-preview/runtime.js',
/\.\/sb-common-assets\/.*\.woff2/,
],
},
...(options.test
? {
Expand Down
38 changes: 33 additions & 5 deletions code/builders/builder-webpack5/templates/preview.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,39 @@

<meta name="viewport" content="width=device-width, initial-scale=1" />

<link rel="prefetch" href="./sb-common-assets/nunito-sans-regular.woff2" as="font" type="font/woff2" crossorigin />
<link rel="prefetch" href="./sb-common-assets/nunito-sans-italic.woff2" as="font" type="font/woff2" crossorigin />
<link rel="prefetch" href="./sb-common-assets/nunito-sans-bold.woff2" as="font" type="font/woff2" crossorigin />
<link rel="prefetch" href="./sb-common-assets/nunito-sans-bold-italic.woff2" as="font" type="font/woff2" crossorigin />
<link rel="stylesheet" href="./sb-common-assets/fonts.css" />
<style>
@font-face {
font-family: 'Nunito Sans';
font-style: normal;
font-weight: 400;
font-display: swap;
src: url('./sb-common-assets/nunito-sans-regular.woff2') format('woff2');
}
@font-face {
font-family: 'Nunito Sans';
font-style: italic;
font-weight: 400;
font-display: swap;
src: url('./sb-common-assets/nunito-sans-italic.woff2') format('woff2');
}
@font-face {
font-family: 'Nunito Sans';
font-style: normal;
font-weight: 700;
font-display: swap;
src: url('./sb-common-assets/nunito-sans-bold.woff2') format('woff2');
}
@font-face {
font-family: 'Nunito Sans';
font-style: italic;
font-weight: 700;
font-display: swap;
src: url('./sb-common-assets/nunito-sans-bold-italic.woff2') format('woff2');
}
</style>

<% if (typeof headHtmlSnippet !== 'undefined') { %> <%= headHtmlSnippet %> <% } %> <%
htmlWebpackPlugin.files.css.forEach(file => { %>
Expand Down
2 changes: 1 addition & 1 deletion code/lib/types/src/modules/core-common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -582,4 +582,4 @@ export interface CoreCommon_StorybookInfo {
* const framework: Framework = '@storybook/nextjs'; // valid and will be autocompleted
* const framework: Framework = path.dirname(require.resolve(path.join("@storybook/nextjs", "package.json"))) // valid
*/
export type CompatibleString<T extends string> = T | (string & Record<string, never>);
export type CompatibleString<T extends string> = T | (string & {});
2 changes: 1 addition & 1 deletion code/renderers/svelte/template/components/Pre.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
*/
export let text = '';
const finalText = object ? JSON.stringify(object, null, 2) : text;
$: finalText = object ? JSON.stringify(object, null, 2) : text;
</script>

<pre data-testid="pre" {style}>{finalText}</pre>
3 changes: 3 additions & 0 deletions code/ui/blocks/src/blocks/Story.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,9 @@ export const WithInteractionsAutoplayInParameters: Story = {

export const ForceInitialArgs: Story = {
...StoryComponentStories.ForceInitialArgs,
parameters: {
chromatic: { disableSnapshot: true },
},
args: {
of: ButtonStories.Primary,
storyExport: ButtonStories.Primary,
Expand Down
3 changes: 3 additions & 0 deletions code/ui/blocks/src/components/Story.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,9 @@ export const ForceInitialArgs = {
forceInitialArgs: true,
renderStoryToElement,
},
parameters: {
chromatic: { disableSnapshot: true },
},
// test that it ignores updated args by emitting an arg update and assert that it isn't reflected in the DOM
play: async ({ args, canvasElement, loaded }: PlayFunctionContext<WebRenderer>) => {
const docsContext = loaded.docsContext as DocsContextProps;
Expand Down
6 changes: 4 additions & 2 deletions code/ui/blocks/src/controls/Date.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -74,15 +74,16 @@ export const DateControl: FC<DateProps> = ({ name, value, onChange, onFocus, onB
useEffect(() => {
if (valid !== false) {
if (dateRef && dateRef.current) {
dateRef.current.value = formatDate(value);
dateRef.current.value = value ? formatDate(value) : '';
}
if (timeRef && timeRef.current) {
timeRef.current.value = formatTime(value);
timeRef.current.value = value ? formatTime(value) : '';
}
}
}, [value]);

const onDateChange = (e: ChangeEvent<HTMLInputElement>) => {
if (!e.target.value) return onChange();
const parsed = parseDate(e.target.value);
const result = new Date(value);
result.setFullYear(parsed.getFullYear(), parsed.getMonth(), parsed.getDate());
Expand All @@ -92,6 +93,7 @@ export const DateControl: FC<DateProps> = ({ name, value, onChange, onFocus, onB
};

const onTimeChange = (e: ChangeEvent<HTMLInputElement>) => {
if (!e.target.value) return onChange();
const parsed = parseTime(e.target.value);
const result = new Date(value);
result.setHours(parsed.getHours());
Expand Down
2 changes: 1 addition & 1 deletion code/ui/blocks/src/controls/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export interface ControlProps<T> {
value?: T;
defaultValue?: T;
argType?: ArgType;
onChange: (value: T) => T | void;
onChange: (value?: T) => T | void;
onFocus?: (evt: any) => void;
onBlur?: (evt: any) => void;
}
Expand Down
31 changes: 0 additions & 31 deletions code/ui/manager/static/fonts.css

This file was deleted.

0 comments on commit ff1f2f4

Please sign in to comment.