Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/main' into install_docs
Browse files Browse the repository at this point in the history
  • Loading branch information
tobiasdiez committed Jan 16, 2025
2 parents d358e3c + 23c52c6 commit 734270a
Show file tree
Hide file tree
Showing 45 changed files with 3,516 additions and 3,665 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/ci-examples.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,4 +61,6 @@ jobs:
# exitOnceUploaded: true
projectToken: ${{ matrix.projectToken }}
buildScriptName: ${{ matrix.storybookBuildScript }}
# Fail workflow if changes are found
exitZeroOnChanges: false
debug: true
4 changes: 2 additions & 2 deletions .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,9 @@ jobs:
$packages=Get-ChildItem -Path packages -Recurse -Filter "*.tgz"
echo "$packages"
New-Item -Path ${{ runner.temp }}/example -ItemType Directory
pnpm dlx nuxt init ${{ runner.temp }}/example --packageManager pnpm
pnpm nuxt init ${{ runner.temp }}/example --packageManager pnpm --force --gitInit=false
cd ${{ runner.temp }}/example
pnpm dlx storybook@0.0.0-pr-28607-sha-b9bf7d39 init
pnpm dlx storybook init
pnpm add $packages
- name: Build Storybook
Expand Down
20 changes: 20 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,25 @@
# Changelog

## v8.3.3

[compare changes](https://github.com/nuxt-modules/storybook/compare/v8.3.2...v8.3.3)

### 🩹 Fixes

- Use storybook vitest config as base ([#740](https://github.com/nuxt-modules/storybook/pull/740))
- Readd vue-tempate-compilation plugin ([#831](https://github.com/nuxt-modules/storybook/pull/831))
- Nuxt App created only when story vue app rendered first time, ([#830](https://github.com/nuxt-modules/storybook/pull/830))

### 🏡 Chore

- Add test for using decorators in stories ([#823](https://github.com/nuxt-modules/storybook/pull/823))

### ❤️ Contributors

- Chakir QATAB ([@chakAs3](http://github.com/chakAs3))
- Tobias Diez <code@tobiasdiez.de>
- Ryan Leckey ([@mehcode](http://github.com/mehcode))

## v8.3.2

[compare changes](https://github.com/nuxt-modules/storybook/compare/v8.3.1...v8.3.2)
Expand Down
20 changes: 10 additions & 10 deletions docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,18 @@
"typecheck": "nuxt typecheck"
},
"dependencies": {
"@iconify-json/heroicons": "1.2.0",
"@iconify-json/simple-icons": "1.2.5",
"@nuxt/content": "2.13.2",
"@nuxt/fonts": "0.9.2",
"@nuxt/ui-pro": "1.4.3",
"nuxt": "3.13.2",
"@iconify-json/heroicons": "1.2.1",
"@iconify-json/simple-icons": "1.2.14",
"@nuxt/content": "2.13.4",
"@nuxt/fonts": "0.10.3",
"@nuxt/ui-pro": "1.5.0",
"nuxt": "3.14.1592",
"nuxt-og-image": "4.0.0"
},
"devDependencies": {
"@nuxt/eslint": "0.5.7",
"@nuxthq/studio": "2.1.1",
"eslint": "9.11.1",
"vue-tsc": "2.1.6"
"@nuxt/eslint": "0.7.2",
"@nuxthq/studio": "2.2.1",
"eslint": "9.16.0",
"vue-tsc": "2.1.10"
}
}
36 changes: 36 additions & 0 deletions examples/showcase/components/MyI18n.stories.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import type { Meta, StoryObj } from '@storybook/vue3'

import MyComponent from './MyI18n.vue'

// More on how to set up stories at: https://storybook.js.org/docs/vue/writing-stories/introduction

const meta = {
title: 'Modules/I18n',
component: MyComponent,
argTypes: {
lang: { control: 'select', options: ['en', 'fr', 'ar'] },
},

// This component will have an automatically generated docsPage entry: https://storybook.js.org/docs/vue/writing-docs/autodocs
tags: ['autodocs'],
} satisfies Meta<typeof MyComponent>

export default meta
type Story = StoryObj<typeof meta>
/*
*👇 Render functions are a framework specific feature to allow you control on how the component renders.
* See https://storybook.js.org/docs/vue/api/csf
* to learn how to use render functions.
*/

export const FrenchStory: Story = {
args: { lang: 'fr' },
}

export const EnglishStory: Story = {
args: { lang: 'en' },
}

export const ArabicStory: Story = {
args: { lang: 'ar' },
}
47 changes: 47 additions & 0 deletions examples/showcase/components/MyI18n.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<script lang="ts" setup>
import '../assets/button.css'
const props = defineProps<{
lang: string
message?: string
}>()
const { t, locale } = useI18n()
const rtl = computed(() => props.lang === 'ar')
locale.value = props.lang
watch(
() => props.lang,
(lang: unknown) => {
locale.value = lang
},
)
</script>

<template>
<div class="storybook lang-selector">
<button
class="storybook-button storybook-button--small"
@click="locale = 'en'"
>
en
</button>
<button
class="storybook-button storybook-button--small"
@click="locale = 'fr'"
>
fr
</button>
<button
class="storybook-button storybook-button--small"
@click="locale = 'ar'"
>
ar
</button>
</div>
<div class="storybook welcome" :style="{ direction: rtl ? 'rtl' : 'ltr' }">
<div>{{ t('welcome', { name: 'Storybook' }) }}</div>
<div>{{ t('welcome', { name: 'Nuxt' }) }}</div>
<div>{{ t('welcome', { name: 'I18n' }) }}</div>
</div>

<p>language : {{ lang }}</p>
</template>
Original file line number Diff line number Diff line change
@@ -1,22 +1,19 @@
import type { Meta, StoryObj } from '@storybook/vue3'

import MyNuxtWelcome from './MyWelcome.vue'

// More on how to set up stories at: https://storybook.js.org/docs/vue/writing-stories/introduction

const meta = {
title: 'Example/NuxtWelcome',
component: MyNuxtWelcome,
// This component will have an automatically generated docsPage entry: https://storybook.js.org/docs/vue/writing-docs/autodocs
tags: ['autodocs'],
}
} satisfies Meta<typeof MyNuxtWelcome>

export default meta
type Story = StoryObj<typeof meta>

/*
*👇 Render functions are a framework specific feature
to allow you control on how the component renders.
* See https://storybook.js.org/docs/vue/api/csf
* to learn how to use render functions.
*/

export const NuxtWelcomeStory = {
export const NuxtWelcomeStory: Story = {
args: {},
}
40 changes: 40 additions & 0 deletions examples/showcase/components/MyWelcome.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<template>
<h1>Welcome Nuxt to Storybook</h1>
<NuxtWelcome />
</template>

<style>
.readmore {
-webkit-text-size-adjust: 100%;
tab-size: 4;
box-sizing: border-box;
border-width: 0;
border-style: solid;
border-color: #e0e0e0;
--tw-ring-inset: var(--tw-empty,);
--tw-ring-offset-width: 0px;
--tw-ring-offset-color: #fff;
--tw-ring-color: rgba(14, 165, 233, 0.5);
--tw-ring-offset-shadow: 0 0 #0000;
--tw-ring-shadow: 0 0 #0000;
--tw-shadow: 0 0 #0000;
font-family:
'Nunito Sans',
-apple-system,
'.SFNSText-Regular',
'San Francisco',
BlinkMacSystemFont,
'Segoe UI',
'Helvetica Neue',
Helvetica,
Arial,
sans-serif;
margin: 0;
-webkit-font-smoothing: antialiased;
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
line-height: 24px;
color: #029cfd;
text-decoration: none;
font-size: 14px;
}
</style>
17 changes: 17 additions & 0 deletions examples/showcase/components/SimpleButton.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<template>
<button @click="handleClick">Click me!</button>
</template>

<script setup lang="ts">
function handleClick() {
alert('Button clicked!')
}
</script>

<style scoped>
button {
padding: 10px 20px;
font-size: 16px;
cursor: pointer;
}
</style>
23 changes: 23 additions & 0 deletions examples/showcase/components/UseDecorators.stories.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import type { Meta, StoryObj } from '@storybook/vue3'

import SimpleButton from './SimpleButton.vue'

/**
* Shows how to use a decorator to wrap the story with extra markup.
* https://storybook.js.org/docs/writing-stories/decorators
*/
const meta = {
title: 'Storybook Feature/Use Decorators',
component: SimpleButton,
tags: ['autodocs'],
decorators: [
() => ({ template: '<div style="margin: 3em;"><story/></div>' }),
],
} satisfies Meta<typeof SimpleButton>

export default meta
type Story = StoryObj<typeof meta>

export const UseDecoratorsStory: Story = {
args: {},
}
16 changes: 16 additions & 0 deletions examples/showcase/i18n.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
export default defineI18nConfig(() => ({
legacy: false,
locale: 'en',
defaultLocale: 'en',
messages: {
en: {
welcome: 'Welcome to Storybook ❤️ {name} ',
},
fr: {
welcome: 'Bienvenue a Storybook ❤️ {name} ',
},
ar: {
welcome: ' ناكست ❤️ {name} ❤️ مرحبا بكم في ستوري بوك ',
},
},
}))
11 changes: 6 additions & 5 deletions examples/showcase/nuxt.config.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
// https://nuxt.com/docs/api/configuration/nuxt-config
export default defineNuxtConfig({
devtools: { enabled: true },
modules: ['@nuxtjs/storybook', '@nuxt/image', '@pinia/nuxt'],
modules: ['@nuxtjs/storybook', '@nuxt/image', '@pinia/nuxt', '@nuxtjs/i18n'],

pinia: {
autoImports: ['defineStore', 'acceptHMRUpdate'],
},

i18n: {
locales: ['en', 'fr', 'ar'],
defaultLocale: 'en',
},

imports: {
dirs: ['./stores'],
},
Expand All @@ -22,9 +27,5 @@ export default defineNuxtConfig({
},
},

vue: {
runtimeCompiler: true,
},

compatibilityDate: '2024-08-03',
})
22 changes: 12 additions & 10 deletions examples/showcase/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,21 @@
"build-storybook": "storybook build"
},
"dependencies": {
"@pinia/nuxt": "0.5.5",
"@nuxt/image": "1.8.1",
"nuxt": "3.13.2",
"vue": "3.5.11",
"vue-router": "4.4.5"
"@pinia/nuxt": "0.9.0",
"nuxt": "3.14.1592",
"pinia": "2.3.0",
"vue": "3.5.13",
"vue-router": "4.5.0",
"@nuxtjs/i18n": "8.3.1"
},
"devDependencies": {
"@chromatic-com/storybook": "3.1.0",
"@chromatic-com/storybook": "3.2.3",
"@nuxtjs/storybook": "latest",
"@storybook/addon-essentials": "8.3.0",
"@storybook/addon-links": "8.3.0",
"@storybook/blocks": "8.3.0",
"@storybook/test": "8.3.0",
"storybook": "8.3.0"
"@storybook/addon-essentials": "8.4.7",
"@storybook/addon-links": "8.4.7",
"@storybook/blocks": "8.4.7",
"@storybook/test": "8.4.7",
"storybook": "8.4.7"
}
}
2 changes: 1 addition & 1 deletion examples/starter/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@ logs
.env.*
!.env.example

*storybook.log
*storybook.log
Original file line number Diff line number Diff line change
@@ -1,20 +1,18 @@
/** @type { import('storybook-vue').StorybookConfig } */
const config = {
import type { StorybookConfig } from '@storybook-vue/nuxt'

const config: StorybookConfig = {
stories: [
'../components/**/*.mdx',
'../components/**/*.stories.@(js|jsx|ts|tsx|mdx)',
],
addons: [
'@storybook/addon-links',
'@storybook/addon-essentials',
'@chromatic-com/storybook',
'@storybook/addon-interactions',
],
framework: {
name: '@storybook-vue/nuxt',
options: {},
},
docs: {
autodocs: 'tag',
},
}
export default config
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
const preview = {
import type { Preview } from '@storybook/vue3'

const preview: Preview = {
parameters: {
controls: {
matchers: {
Expand Down
Loading

0 comments on commit 734270a

Please sign in to comment.