diff --git a/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 4d7e7109..00000000 --- a/.eslintrc.js +++ /dev/null @@ -1,97 +0,0 @@ -module.exports = { - root: true, - env: { - browser: true, - }, - extends: [ - 'plugin:vue/vue3-recommended', - '@vue/standard', - '@vue/typescript/recommended', - ], - parser: 'vue-eslint-parser', - parserOptions: { - ecmaVersion: 2020, - }, - globals: { - name: 'off', - defineExpose: false, - __HISTOIRE_DEV__: false, - }, - rules: { - 'vue/html-closing-bracket-newline': [ - 'error', - { - singleline: 'never', - multiline: 'always', - }, - ], - 'no-var': ['error'], - '@typescript-eslint/member-delimiter-style': [ - 'error', - { - multiline: { - delimiter: 'none', - }, - singleline: { - delimiter: 'comma', - }, - }, - ], - '@typescript-eslint/ban-ts-comment': 'warn', - '@typescript-eslint/no-use-before-define': 'off', - 'comma-dangle': ['error', 'always-multiline'], - 'vue/no-multiple-template-root': 'off', - indent: 'off', - '@typescript-eslint/indent': ['error', 2], - 'no-use-before-define': 'off', - quotes: ['error', 'single', { allowTemplateLiterals: true }], - 'vue/multi-word-component-names': 'warn', - '@typescript-eslint/type-annotation-spacing': ['error'], - 'func-call-spacing': 'off', - '@typescript-eslint/func-call-spacing': ['error'], - '@typescript-eslint/no-empty-interface': 'off', - }, - overrides: [ - { - files: ['*.vue'], - rules: { - 'import/first': 'off', - }, - globals: { - defineProps: false, - defineEmits: false, - }, - }, - { - files: ['**/cypress/**'], - extends: [ - 'plugin:cypress/recommended', - ], - rules: { - 'cypress/unsafe-to-chain-command': 'off', - }, - }, - { - files: ['packages/histoire-vendors/*.d.ts'], - rules: { - 'import/export': 'off', - }, - }, - { - files: ['packages/histoire-vendors/src/**/*.ts'], - rules: { - 'import/no-named-default': 'off', - }, - }, - ], - ignorePatterns: [ - 'node_modules/', - 'dist/', - 'histoire-dist/', - 'generated/', - '!.*', - '.nuxt/', - '.output/', - 'examples/sveltekit', - ], -} diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml index 4babd320..07968d7c 100644 --- a/.github/ISSUE_TEMPLATE/config.yml +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -5,4 +5,4 @@ contact_links: about: Use GitHub discussions for message-board style questions and discussions. - name: Discord Chat url: https://discord.gg/KpCnT72rJk - about: Ask questions and discuss with other Histoire users in real time. \ No newline at end of file + about: Ask questions and discuss with other Histoire users in real time. diff --git a/.github/workflows/pr-title.yml b/.github/workflows/pr-title.yml index 4efa9e79..e8d7ba56 100644 --- a/.github/workflows/pr-title.yml +++ b/.github/workflows/pr-title.yml @@ -1,4 +1,4 @@ -name: "Check PR title" +name: Check PR title on: pull_request_target: diff --git a/.github/workflows/release-notes.yml b/.github/workflows/release-notes.yml index 13aa2f52..a965d944 100644 --- a/.github/workflows/release-notes.yml +++ b/.github/workflows/release-notes.yml @@ -3,7 +3,7 @@ name: Create release on: push: tags: - - "v*" # Push events to matching v*, i.e. v1.0, v20.15.10 + - 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10 workflow_dispatch: jobs: diff --git a/.github/workflows/test-nuxt3.yml b/.github/workflows/test-nuxt3.yml index 847bb01d..141000ac 100644 --- a/.github/workflows/test-nuxt3.yml +++ b/.github/workflows/test-nuxt3.yml @@ -62,7 +62,7 @@ jobs: - name: Run tests working-directory: ${{env.dir}} run: pnpm run ci - + - uses: actions/upload-artifact@v2 if: failure() with: diff --git a/.github/workflows/test-svelte4.yml b/.github/workflows/test-svelte4.yml index a726d67b..c06732e8 100644 --- a/.github/workflows/test-svelte4.yml +++ b/.github/workflows/test-svelte4.yml @@ -62,7 +62,7 @@ jobs: - name: Run tests working-directory: ${{env.dir}} run: pnpm run ci - + - uses: actions/upload-artifact@v2 if: failure() with: diff --git a/.github/workflows/test-vue3.yml b/.github/workflows/test-vue3.yml index 8a857e33..d947433a 100644 --- a/.github/workflows/test-vue3.yml +++ b/.github/workflows/test-vue3.yml @@ -67,7 +67,6 @@ jobs: # ./packages/*/dist # retention-days: 1 - test: runs-on: ubuntu-latest name: Test @@ -128,7 +127,7 @@ jobs: # the number of containers in the job matrix TOTAL_RUNNERS: 5 THIS_RUNNER: ${{ matrix.containers }} - + - uses: actions/upload-artifact@v2 if: failure() with: diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 8de609f4..a2dc6490 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -29,7 +29,7 @@ jobs: uses: pnpm/action-setup@v2.2.4 with: version: 8.10.5 - + - name: Get pnpm store directory id: pnpm-cache run: | diff --git a/.stackblitz/codeflow.json b/.stackblitz/codeflow.json index 629d282f..7e7ff5a1 100644 --- a/.stackblitz/codeflow.json +++ b/.stackblitz/codeflow.json @@ -10,4 +10,4 @@ "@histoire/plugin-screenshot": "./packages/historie-plugin-screenshot" } } -} \ No newline at end of file +} diff --git a/.vscode/settings.json b/.vscode/settings.json index 6bde09ed..5dc87280 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -2,6 +2,35 @@ "tailwindCSS.experimental.configFile": { "tailwind.config.cjs": "docs/**", "packages/histoire-app/tailwind.config.cjs": "packages/histoire-app/**", - "packages/histoire-controls/tailwind.config.cjs": "packages/histoire-controls/**", - } -} \ No newline at end of file + "packages/histoire-controls/tailwind.config.cjs": "packages/histoire-controls/**" + }, + + // Enable the ESlint flat config support + "eslint.experimental.useFlatConfig": true, + + // Disable the default formatter, use eslint instead + "editor.formatOnSave": false, + + // Auto fix + "editor.codeActionsOnSave": { + "source.fixAll.eslint": "explicit", + "source.organizeImports": "never" + }, + + // Enable eslint for all supported languages + "eslint.validate": [ + "javascript", + "javascriptreact", + "typescript", + "typescriptreact", + "vue", + "html", + "markdown", + "json", + "jsonc", + "yaml", + "toml", + "gql", + "graphql" + ] +} diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md index 9094add0..b8b53426 100644 --- a/CODE_OF_CONDUCT.md +++ b/CODE_OF_CONDUCT.md @@ -1,4 +1,3 @@ - # Contributor Covenant Code of Conduct ## Our Pledge diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 00247b15..ef8cd473 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -150,7 +150,6 @@ pnpm run test:dev - Make sure tests pass! - - Commit messages must follow the [commit message convention](./.github/commit-convention.md) so that changelogs can be automatically generated.<!-- Commit messages are automatically validated before commit (by invoking [Git Hooks](https://git-scm.com/docs/githooks) via [yorkie](https://github.com/yyx990803/yorkie)). --> <!-- diff --git a/README.md b/README.md index 45c287ae..c629fc0d 100644 --- a/README.md +++ b/README.md @@ -16,11 +16,11 @@ [Read the Documentation](https://histoire.dev) | [Discord server](https://discord.gg/KpCnT72rJk) | [Discussions board](https://github.com/histoire-dev/histoire/discussions) -⚡️ Lightning fast development and instant HMR thanks to [Vite](http://vitejs.dev) -👓 Build and visually test your components in isolation -📚 Document your components with stories and variants -📝 Generate source code examples automatically -🎨 Beautiful and customizable interface +⚡️ Lightning fast development and instant HMR thanks to [Vite](http://vitejs.dev) +👓 Build and visually test your components in isolation +📚 Document your components with stories and variants +📝 Generate source code examples automatically +🎨 Beautiful and customizable interface ![screenshot](./screenshot.png) diff --git a/docs/.vitepress/theme/index.js b/docs/.vitepress/theme/index.js index 613634ec..0be920ca 100644 --- a/docs/.vitepress/theme/index.js +++ b/docs/.vitepress/theme/index.js @@ -11,7 +11,7 @@ import DemoLinks from './DemoLinks.vue' export default { ...DefaultTheme, - enhanceApp ({ app }) { + enhanceApp({ app }) { app.use(FloatingVue, { themes: { dropdown: { diff --git a/docs/examples/visual-regression-testing/lost-pixel.md b/docs/examples/visual-regression-testing/lost-pixel.md index 73fc4579..88a94d31 100644 --- a/docs/examples/visual-regression-testing/lost-pixel.md +++ b/docs/examples/visual-regression-testing/lost-pixel.md @@ -6,7 +6,7 @@ Lost Pixel is a [modern open-source visual regression testing tool](https://gith Lost Pixel has first-class Histoire support meaning that you don't need to do much to add visual tests to your app if you have your Histoire book ready! -Start with installing lost-pixel by `npm install lost-pixel` and creating a `lostpixel.config.js|ts` file with following contents. +Start with installing lost-pixel by `npm install lost-pixel` and creating a `lostpixel.config.js|ts` file with following contents. ```javascript import { CustomProjectConfig } from 'lost-pixel'; @@ -44,7 +44,7 @@ jobs: uses: actions/setup-node@v3 with: node-version: 18.x - cache: 'npm' + cache: npm - name: Install dependencies run: npm install diff --git a/docs/examples/visual-regression-testing/percy.md b/docs/examples/visual-regression-testing/percy.md index c1ce9990..4f24878f 100644 --- a/docs/examples/visual-regression-testing/percy.md +++ b/docs/examples/visual-regression-testing/percy.md @@ -2,7 +2,6 @@ You need the [Percy CLI](https://docs.percy.io/docs/cli-overview) installed to be able to send snapshots to Percy. - ```bash pnpm add -D @histoire/plugin-percy ``` diff --git a/docs/examples/vue3/controlled-stories.md b/docs/examples/vue3/controlled-stories.md index 26a49f37..fc336387 100644 --- a/docs/examples/vue3/controlled-stories.md +++ b/docs/examples/vue3/controlled-stories.md @@ -12,7 +12,7 @@ import { reactive } from 'vue' import MyComponent from './MyComponent.vue' const state = reactive({ - text: "Hello world" + text: 'Hello world' }) </script> @@ -36,7 +36,7 @@ import { reactive } from 'vue' import MyComponent from './MyComponent.vue' const state = reactive({ - text: "Hello world" + text: 'Hello world' }) </script> @@ -65,7 +65,7 @@ import { reactive } from 'vue' import MyComponent from './MyComponent.vue' const state = reactive({ - text: "Hello world" + text: 'Hello world' }) </script> @@ -92,16 +92,16 @@ This will isolate each variant so that you control only one variant at a time. <script lang="ts" setup> import MyComponent from './MyComponent.vue' -function initState () { +function initState() { return { - text: "Hello world" + text: 'Hello world' } } </script> <template> <Story title="MyStory"> - <Variant + <Variant title="MyVariant Red" :init-state="initState" > diff --git a/docs/examples/vue3/single-stories.md b/docs/examples/vue3/single-stories.md index c74e8911..6e481ce1 100644 --- a/docs/examples/vue3/single-stories.md +++ b/docs/examples/vue3/single-stories.md @@ -36,4 +36,3 @@ import MyComponent from './MyComponent.vue' </Story> </template> ``` - diff --git a/docs/examples/vue3/variant-stories.md b/docs/examples/vue3/variant-stories.md index 719b926e..a109a696 100644 --- a/docs/examples/vue3/variant-stories.md +++ b/docs/examples/vue3/variant-stories.md @@ -55,7 +55,7 @@ When you have a lot of variant to test, it can be easier to auto generated them <script lang="ts" setup> import MyComponent from './MyComponent.vue' -const arguments = ["hello", "world", "etc", "..."]; +const args = ['hello', 'world', 'etc', '...'] </script> <template> @@ -64,9 +64,9 @@ const arguments = ["hello", "world", "etc", "..."]; :layout="{ type: 'grid', width: '200px' }" > <Variant - v-for="(argument, key) of arguments" + v-for="(argument, key) of args" :key="key" - :title="'MyVariant ' + key" + :title="`MyVariant ${key}`" > <MyComponent :argument="argument" /> </Variant> @@ -83,10 +83,10 @@ When your variants have a lot of arguments, you can use this pattern. import MyComponent from './MyComponent.vue' const propsVariants = [ - { argument: "hello", color: "red", count:4 }, - { argument: "world", color: "blue", count:5 }, - { argument: "etc", color: "violet", count:6 }, -]; + { argument: 'hello', color: 'red', count: 4 }, + { argument: 'world', color: 'blue', count: 5 }, + { argument: 'etc', color: 'violet', count: 6 }, +] </script> <template> @@ -97,7 +97,7 @@ const propsVariants = [ <Variant v-for="(props, key) of propsVariants" :key="key" - :title="'MyVariant ' + key" + :title="`MyVariant ${key}`" > <MyComponent v-bind="props" /> </Variant> diff --git a/docs/guide/config.md b/docs/guide/config.md index bbcc3775..74cc9f95 100644 --- a/docs/guide/config.md +++ b/docs/guide/config.md @@ -124,7 +124,7 @@ Your components may be using globally defined CSS (like CSS frameworks) or JS (l ```ts // histoire.config.ts -export default defineConfig({ +export default defineConfig({ setupFile: '/src/histoire.setup.ts' }) ``` @@ -169,7 +169,7 @@ Histoire can be white-labeled to match your brand guidelines. Here are the avail ```ts // histoire.config.ts -export default defineConfig({ +export default defineConfig({ theme: { title: 'Acme Inc.', logo: { @@ -185,7 +185,6 @@ export default defineConfig({ ### Colors - To better match your colors guidelines, you can customize every colors used in the app. Note that Histoire uses Tailwind for its UI, so the colors pattern must match the Tailwind pattern. #### Builtin colors @@ -197,7 +196,7 @@ Histoire provides some builtin patterns to easily change the color of the app. import { defaultColors } from 'histoire' -export default defineConfig({ +export default defineConfig({ theme: { colors: { gray: defaultColors.zinc, @@ -238,7 +237,7 @@ You can also define your own colors. ```ts // histoire.config.ts -export default defineConfig({ +export default defineConfig({ theme: { colors: { gray: { @@ -272,4 +271,3 @@ export default defineConfig({ } }) ``` - diff --git a/docs/guide/index.md b/docs/guide/index.md index 591fe602..de84355c 100644 --- a/docs/guide/index.md +++ b/docs/guide/index.md @@ -80,7 +80,7 @@ Here are some highlights of our favorite features: ### :zap: Dynamic source -The copyable source code is an important part of the documentation purpose of stories. +The copyable source code is an important part of the documentation purpose of stories. For supported frameworks, Histoire can generate the template/JSX/source code that you can one-click-copy and paste in your project. ### :bento: Variant grids @@ -93,7 +93,7 @@ Add documentation to your stories with (extendable) Markdown with code snippets ### :moon: Dark theme -Rest your eyes with the alternative darker theme for your book. +Rest your eyes with the alternative darker theme for your book. Change the story background (with an optional checkerboard) to test your design in different situations. ### :iphone: Responsive testing @@ -136,4 +136,4 @@ A real search index is built in your book! Search for your stories or even text <a href="https://www.netlify.com"> <img src="https://www.netlify.com/img/global/badges/netlify-color-accent.svg" alt="Deploys by Netlify" /> </a> -</div> \ No newline at end of file +</div> diff --git a/docs/guide/plugins/development.md b/docs/guide/plugins/development.md index 4b1a0231..00810a0d 100644 --- a/docs/guide/plugins/development.md +++ b/docs/guide/plugins/development.md @@ -39,12 +39,12 @@ Create a new npm package. Example `package.json`: "defu": "^6.0.0" }, "devDependencies": { - "histoire": "^0.3.3", + "histoire": "latest", "rimraf": "^3.0.0", - "typescript": "^4.9.5" + "typescript": "^5.4.4" }, "peerDependencies": { - "histoire": "^0.3.3" + "histoire": "latest" } } ``` @@ -80,7 +80,7 @@ Example `tsconfig.json`: "noImplicitThis": true, "alwaysStrict": true, "strictBindCallApply": true, - "strictFunctionTypes": true, + "strictFunctionTypes": true }, "include": [ "src" @@ -107,7 +107,7 @@ const defaultOptions: MyPluginOptions = { // Default values here } -export function MyHistoirePlugin (options: MyPluginOptions = {}): Plugin { +export function MyHistoirePlugin(options: MyPluginOptions = {}): Plugin { const finalOptions: MyPluginOptions = defu(options, defaultOptions) return { name: 'my-histoire-plugin', diff --git a/docs/guide/svelte3/hierarchy.md b/docs/guide/svelte3/hierarchy.md index 0753efd8..a6503d48 100644 --- a/docs/guide/svelte3/hierarchy.md +++ b/docs/guide/svelte3/hierarchy.md @@ -19,7 +19,7 @@ If you want to use the real path of your story files, you can change that in you ```ts{5} // histoire.config.ts -export default defineConfig({ +export default defineConfig({ tree: { file: 'path', }, @@ -33,7 +33,7 @@ If you want a custom hierarchy, you can define your own function that takes an o ```ts{5} // histoire.config.ts -export default defineConfig({ +export default defineConfig({ tree: { file: ({ title, path }) => title.split('/'), // equivalent to default behavior }, @@ -47,7 +47,7 @@ By default, files and stories are sorted by ascending order. But you might want ```ts{5} // histoire.config.ts -export default defineConfig({ +export default defineConfig({ tree: { order: (a, b) => a.localeCompare(b), // equivalent to default behavior }, @@ -84,7 +84,7 @@ Example: ```ts // histoire.config.ts -export default defineConfig({ +export default defineConfig({ tree: { groups: [ { diff --git a/docs/guide/svelte3/stories.md b/docs/guide/svelte3/stories.md index 7d6b1a8d..e6e5654a 100644 --- a/docs/guide/svelte3/stories.md +++ b/docs/guide/svelte3/stories.md @@ -87,7 +87,7 @@ You can change the layout of the variant by using the `layout` prop with an obje ### Single layout -This is the default layout, displaying one variant at a time. The default behavior is to isolate the story with an iframe. +This is the default layout, displaying one variant at a time. The default behavior is to isolate the story with an iframe. Additional `layout` properties: - `iframe`: (default: `true`) enables the iframe, useful when your CSS has media queries for responsive design. diff --git a/docs/guide/vue2/app-setup.md b/docs/guide/vue2/app-setup.md index c33270c1..558554b8 100644 --- a/docs/guide/vue2/app-setup.md +++ b/docs/guide/vue2/app-setup.md @@ -13,7 +13,7 @@ import Vuei18n from 'vue-i18n' import { store } from './store' import { router } from './router' -export const setupVue2 = defineSetupVue2(({story, variant }) => { +export const setupVue2 = defineSetupVue2(({ story, variant }) => { // Vue plugin Vue.use(Vuei18n) @@ -131,4 +131,4 @@ function setupApp ({ app, story, variant }) { <pre>{{ $store.state }}</pre> </Story> </template> -``` \ No newline at end of file +``` diff --git a/docs/guide/vue2/controls.md b/docs/guide/vue2/controls.md index b0c4c1b0..8c9ce47a 100644 --- a/docs/guide/vue2/controls.md +++ b/docs/guide/vue2/controls.md @@ -89,7 +89,7 @@ Example with Composition API (Script Setup): ```vue <script lang="ts" setup> -import { reactive, count } from 'vue' +import { count, reactive } from 'vue' import MyButton from './MyButton.vue' const state = reactive({ diff --git a/docs/guide/vue2/hierarchy.md b/docs/guide/vue2/hierarchy.md index 6564f4e7..6819c673 100644 --- a/docs/guide/vue2/hierarchy.md +++ b/docs/guide/vue2/hierarchy.md @@ -21,7 +21,7 @@ If you want to use the real path of your story files, you can change that in you ```ts{5} // histoire.config.ts -export default defineConfig({ +export default defineConfig({ tree: { file: 'path', }, @@ -35,7 +35,7 @@ If you want a custom hierarchy, you can define your own function that takes an o ```ts{5} // histoire.config.ts -export default defineConfig({ +export default defineConfig({ tree: { file: ({ title, path }) => title.split('/'), // equivalent to default behavior }, @@ -49,7 +49,7 @@ By default, files and stories are sorted by ascending order. But you might want ```ts{5} // histoire.config.ts -export default defineConfig({ +export default defineConfig({ tree: { order: (a, b) => a.localeCompare(b), // equivalent to default behavior }, @@ -86,7 +86,7 @@ Example: ```ts // histoire.config.ts -export default defineConfig({ +export default defineConfig({ tree: { groups: [ { diff --git a/docs/guide/vue2/stories.md b/docs/guide/vue2/stories.md index 8ac88da0..237575bc 100644 --- a/docs/guide/vue2/stories.md +++ b/docs/guide/vue2/stories.md @@ -33,7 +33,7 @@ import Meow from './Meow.vue' <template> <Story> - <Meow/> + <Meow /> </Story> </template> ``` @@ -64,7 +64,7 @@ You can change the layout of the variant by using the `layout` prop with an obje ### Single layout -This is the default layout, displaying one variant at a time. The default behavior is to isolate the story with an iframe. +This is the default layout, displaying one variant at a time. The default behavior is to isolate the story with an iframe. Additional `layout` properties: - `iframe`: (default: `true`) enables the iframe, useful when your CSS has media queries for responsive design. diff --git a/docs/guide/vue2/wrapper.md b/docs/guide/vue2/wrapper.md index a14ddcc2..a9514e7b 100644 --- a/docs/guide/vue2/wrapper.md +++ b/docs/guide/vue2/wrapper.md @@ -26,9 +26,9 @@ const props = defineProps<{ variant?: Variant }>() -function hasWrapper () { - return props.story.meta?.wrapper !== false && - props.variant?.meta?.wrapper !== false +function hasWrapper() { + return props.story.meta?.wrapper !== false + && props.variant?.meta?.wrapper !== false } </script> diff --git a/docs/guide/vue3/app-setup.md b/docs/guide/vue3/app-setup.md index d65479e2..f91cbe07 100644 --- a/docs/guide/vue3/app-setup.md +++ b/docs/guide/vue3/app-setup.md @@ -18,7 +18,7 @@ export const setupVue3 = defineSetupVue3(({ app, story, variant }) => { app.component('GlobalComponent', MyGlobalComponent) // Global property - app.config.globalProperties.$t = (key) => translate(key) + app.config.globalProperties.$t = key => translate(key) // Provide app.provide('key', 'meow') @@ -157,4 +157,4 @@ function setupApp ({ app, story, variant }) { <pre>{{ $store.state }}</pre> </Story> </template> -``` \ No newline at end of file +``` diff --git a/docs/guide/vue3/hierarchy.md b/docs/guide/vue3/hierarchy.md index 6564f4e7..6819c673 100644 --- a/docs/guide/vue3/hierarchy.md +++ b/docs/guide/vue3/hierarchy.md @@ -21,7 +21,7 @@ If you want to use the real path of your story files, you can change that in you ```ts{5} // histoire.config.ts -export default defineConfig({ +export default defineConfig({ tree: { file: 'path', }, @@ -35,7 +35,7 @@ If you want a custom hierarchy, you can define your own function that takes an o ```ts{5} // histoire.config.ts -export default defineConfig({ +export default defineConfig({ tree: { file: ({ title, path }) => title.split('/'), // equivalent to default behavior }, @@ -49,7 +49,7 @@ By default, files and stories are sorted by ascending order. But you might want ```ts{5} // histoire.config.ts -export default defineConfig({ +export default defineConfig({ tree: { order: (a, b) => a.localeCompare(b), // equivalent to default behavior }, @@ -86,7 +86,7 @@ Example: ```ts // histoire.config.ts -export default defineConfig({ +export default defineConfig({ tree: { groups: [ { diff --git a/docs/guide/vue3/stories.md b/docs/guide/vue3/stories.md index 8ac88da0..237575bc 100644 --- a/docs/guide/vue3/stories.md +++ b/docs/guide/vue3/stories.md @@ -33,7 +33,7 @@ import Meow from './Meow.vue' <template> <Story> - <Meow/> + <Meow /> </Story> </template> ``` @@ -64,7 +64,7 @@ You can change the layout of the variant by using the `layout` prop with an obje ### Single layout -This is the default layout, displaying one variant at a time. The default behavior is to isolate the story with an iframe. +This is the default layout, displaying one variant at a time. The default behavior is to isolate the story with an iframe. Additional `layout` properties: - `iframe`: (default: `true`) enables the iframe, useful when your CSS has media queries for responsive design. diff --git a/docs/guide/vue3/wrapper.md b/docs/guide/vue3/wrapper.md index cba112ba..c7d75d19 100644 --- a/docs/guide/vue3/wrapper.md +++ b/docs/guide/vue3/wrapper.md @@ -26,9 +26,9 @@ const props = defineProps<{ variant?: Variant }>() -function hasWrapper () { - return props.story.meta?.wrapper !== false && - props.variant?.meta?.wrapper !== false +function hasWrapper() { + return props.story.meta?.wrapper !== false + && props.variant?.meta?.wrapper !== false } </script> diff --git a/docs/package.json b/docs/package.json index c5286969..cbb4435a 100644 --- a/docs/package.json +++ b/docs/package.json @@ -5,4 +5,4 @@ "devDependencies": { "vue": "^3.3.8" } -} \ No newline at end of file +} diff --git a/docs/reference/config.md b/docs/reference/config.md index 01b5e349..e456f946 100644 --- a/docs/reference/config.md +++ b/docs/reference/config.md @@ -57,7 +57,6 @@ export default defineConfig({ Use `src/**/*.story.vue` to prevent search errors in binary files (e.g., in iOS or Android folders) when using Ionic Capacitor. - ## `storyIgnored` `string[]` - Default: `[ '**/node_modules/**', '**/dist/**' ]` diff --git a/docs/reference/plugin-api.md b/docs/reference/plugin-api.md index 862dfafa..0230f753 100644 --- a/docs/reference/plugin-api.md +++ b/docs/reference/plugin-api.md @@ -3,4 +3,3 @@ ::: warning This doc and the Plugin API are work-in-progress. Expect changes. ::: - diff --git a/docs/reference/vue3/story.md b/docs/reference/vue3/story.md index eaa08510..6f3fb27b 100644 --- a/docs/reference/vue3/story.md +++ b/docs/reference/vue3/story.md @@ -43,10 +43,10 @@ Function that returns the intial state. Will be used as default value for varian ```vue <script setup> -function initState () { +function initState() { return { disabled: false, - content: "Hello world" + content: 'Hello world' } } </script> @@ -76,7 +76,7 @@ It receives a payload object as parameter with the following properties: ```vue <script setup> -function mySetupApp ({ app, story, variant }) { +function mySetupApp({ app, story, variant }) { app.provide('demo', 'meow') } </script> @@ -150,7 +150,6 @@ This is a demo book using Vue 3. Learn more about Histoire [here](https://histoire.dev/). </docs> - ``` ## `source` @@ -211,6 +210,7 @@ Props: <Story> <template #controls="{ state }"> <!-- Interact with state here --> + {{ state }} </template> <Variant> diff --git a/docs/reference/vue3/variant.md b/docs/reference/vue3/variant.md index c057607a..fe28442e 100644 --- a/docs/reference/vue3/variant.md +++ b/docs/reference/vue3/variant.md @@ -48,10 +48,10 @@ Function that returns the intial state. ```vue <script setup> -function initState () { +function initState() { return { disabled: false, - content: "Hello world" + content: 'Hello world' } } </script> @@ -83,7 +83,7 @@ It receives a payload object as parameter with the following properties: ```vue <script setup> -function mySetupApp ({ app, story, variant }) { +function mySetupApp({ app, story, variant }) { app.provide('demo', 'meow') } </script> @@ -212,6 +212,7 @@ Props: <Variant> <template #controls="{ state }"> <!-- Interact with state here --> + {{ state }} </template> </Variant> </Story> diff --git a/eslint.config.mjs b/eslint.config.mjs new file mode 100644 index 00000000..f1e998ae --- /dev/null +++ b/eslint.config.mjs @@ -0,0 +1,25 @@ +import antfu from '@antfu/eslint-config' + +export default antfu({ + ignores: [ + '**/histoire-dist/', + '**/generated/', + '**/public/', + '**/.svelte-kit/', + ], +}, { + rules: { + 'curly': ['error', 'multi-line', 'consistent'], + 'antfu/if-newline': 'off', + 'antfu/no-import-dist': 'off', + 'node/prefer-global/process': 'off', + 'no-console': 'warn', + 'ts/no-use-before-define': 'warn', + 'vue/define-macros-order': 'off', // Bugged + }, +}, { + files: ['**/*.vue'], + rules: { + 'import/first': 'off', + }, +}) diff --git a/examples/nuxt3/components/AutoImport.story.vue b/examples/nuxt3/components/AutoImport.story.vue index 063980a3..f1874d95 100644 --- a/examples/nuxt3/components/AutoImport.story.vue +++ b/examples/nuxt3/components/AutoImport.story.vue @@ -1,5 +1,4 @@ <script setup> -/* eslint-disable no-undef */ console.log('useNuxtApp', useNuxtApp()) console.log('useNuxtApp().$config', useNuxtApp().$config) const config = useRuntimeConfig() diff --git a/examples/nuxt3/components/BaseButton.story.vue b/examples/nuxt3/components/BaseButton.story.vue index 44953727..a1e3d8b9 100644 --- a/examples/nuxt3/components/BaseButton.story.vue +++ b/examples/nuxt3/components/BaseButton.story.vue @@ -1,7 +1,7 @@ <script lang="ts" setup> import BaseButton from './BaseButton.vue' -function initState () { +function initState() { return { disabled: false, } diff --git a/examples/nuxt3/components/BaseButtonLink.vue b/examples/nuxt3/components/BaseButtonLink.vue index 0bc3fd4c..085df48e 100644 --- a/examples/nuxt3/components/BaseButtonLink.vue +++ b/examples/nuxt3/components/BaseButtonLink.vue @@ -1,3 +1,15 @@ +<script setup lang="ts"> +const props = defineProps<{ + to?: string + variant: 'primary' | 'secondary' +}>() + +const computedClasses = computed(() => ({ + 'btn-base': true, + 'btn-primary': props.variant === 'primary', +})) +</script> + <template> <NuxtLink v-if="to" @@ -14,19 +26,6 @@ </button> </template> -<script setup lang="ts"> -const props = defineProps<{ - to?: string - variant: 'primary' | 'secondary' -}>() - -// eslint-disable-next-line no-undef -const computedClasses = computed(() => ({ - 'btn-base': true, - 'btn-primary': props.variant === 'primary', -})) -</script> - <style scoped> .btn-base { padding: 7px 14px; diff --git a/examples/nuxt3/cypress.config.mjs b/examples/nuxt3/cypress.config.mjs index b7703073..46dfa3e2 100644 --- a/examples/nuxt3/cypress.config.mjs +++ b/examples/nuxt3/cypress.config.mjs @@ -12,7 +12,7 @@ export default defineConfig({ e2e: { baseUrl: 'http://localhost:4567', - setupNodeEvents (on, config) { + setupNodeEvents(_on, _config) { // implement node event listeners here }, }, diff --git a/examples/nuxt3/package.json b/examples/nuxt3/package.json index a9e4cd10..526f743c 100644 --- a/examples/nuxt3/package.json +++ b/examples/nuxt3/package.json @@ -1,5 +1,6 @@ { "name": "histoire-example-nuxt3", + "type": "module", "version": "0.0.1", "private": true, "scripts": { @@ -11,7 +12,6 @@ "test:dev": "cypress open --config baseUrl=http://localhost:6006", "test:examples": "pnpm run story:build && pnpm run ci" }, - "type": "module", "devDependencies": { "@histoire/plugin-nuxt": "workspace:*", "@histoire/plugin-vue": "workspace:*", diff --git a/examples/svelte4/cypress.config.mjs b/examples/svelte4/cypress.config.mjs index b7703073..46dfa3e2 100644 --- a/examples/svelte4/cypress.config.mjs +++ b/examples/svelte4/cypress.config.mjs @@ -12,7 +12,7 @@ export default defineConfig({ e2e: { baseUrl: 'http://localhost:4567', - setupNodeEvents (on, config) { + setupNodeEvents(_on, _config) { // implement node event listeners here }, }, diff --git a/examples/svelte4/package.json b/examples/svelte4/package.json index 4810f260..7d740ccf 100644 --- a/examples/svelte4/package.json +++ b/examples/svelte4/package.json @@ -1,5 +1,6 @@ { "name": "histoire-example-svelte4", + "type": "module", "version": "0.0.1", "private": true, "scripts": { @@ -11,7 +12,6 @@ "test:dev": "cypress open --config baseUrl=http://localhost:6006", "test:examples": "pnpm run story:build && pnpm run ci" }, - "type": "module", "dependencies": { "svelte": "^4.2.7" }, diff --git a/examples/svelte4/tsconfig.json b/examples/svelte4/tsconfig.json index 4d5aaf76..0c9ee357 100644 --- a/examples/svelte4/tsconfig.json +++ b/examples/svelte4/tsconfig.json @@ -1,34 +1,34 @@ { "compilerOptions": { "target": "ESNext", + // Volar + "jsx": "preserve", + "lib": [ + "ESNext", + "DOM" + ], + "baseUrl": ".", + "rootDir": "src", "module": "ESNext", "moduleResolution": "node", - "outDir": "dist", - "rootDir": "src", - "baseUrl": ".", - "allowSyntheticDefaultImports": true, - "esModuleInterop": true, - "removeComments": false, "resolveJsonModule": true, - "skipLibCheck": true, "types": [ "node" ], - "lib": [ - "ESNext", - "DOM" - ], - "sourceMap": false, - "preserveWatchOutput": true, - "declaration": false, + "strictBindCallApply": true, + "strictFunctionTypes": true, + "alwaysStrict": true, // Strict "noImplicitAny": false, "noImplicitThis": true, - "alwaysStrict": true, - "strictBindCallApply": true, - "strictFunctionTypes": true, - // Volar - "jsx": "preserve", + "declaration": false, + "outDir": "dist", + "removeComments": false, + "sourceMap": false, + "allowSyntheticDefaultImports": true, + "esModuleInterop": true, + "skipLibCheck": true, + "preserveWatchOutput": true }, "include": [ "src" diff --git a/examples/sveltekit/package.json b/examples/sveltekit/package.json index 185b6750..f4720c87 100644 --- a/examples/sveltekit/package.json +++ b/examples/sveltekit/package.json @@ -1,5 +1,6 @@ { "name": "sveltekit", + "type": "module", "version": "0.0.1", "private": true, "scripts": { @@ -13,7 +14,6 @@ "story:build": "histoire build", "story:preview": "histoire preview --port 4567" }, - "type": "module", "dependencies": { "@fontsource/fira-mono": "^4.5.10", "cookie": "^0.4.2" @@ -28,7 +28,7 @@ "svelte-check": "^2.10.3", "svelte-preprocess": "^4.10.7", "tslib": "^2.6.2", - "typescript": "^4.9.5", + "typescript": "^5.4.4", "vite": "^5.0.11" } } diff --git a/examples/sveltekit/src/app.d.ts b/examples/sveltekit/src/app.d.ts index d22f2a7d..66b47980 100644 --- a/examples/sveltekit/src/app.d.ts +++ b/examples/sveltekit/src/app.d.ts @@ -2,13 +2,13 @@ // for information about these interfaces // and what to do when importing types declare namespace App { - interface Locals { - userid: string; - } + interface Locals { + userid: string + } - // interface Platform {} + // interface Platform {} - // interface PrivateEnv {} + // interface PrivateEnv {} - // interface PublicEnv {} + // interface PublicEnv {} } diff --git a/examples/sveltekit/src/hooks.server.ts b/examples/sveltekit/src/hooks.server.ts index 0cfe0a12..97aaef3f 100644 --- a/examples/sveltekit/src/hooks.server.ts +++ b/examples/sveltekit/src/hooks.server.ts @@ -1,23 +1,23 @@ -import type { Handle } from '@sveltejs/kit'; -import * as cookie from 'cookie'; +import type { Handle } from '@sveltejs/kit' +import * as cookie from 'cookie' export const handle: Handle = async ({ event, resolve }) => { - const cookies = cookie.parse(event.request.headers.get('cookie') || ''); - event.locals.userid = cookies['userid'] || crypto.randomUUID(); + const cookies = cookie.parse(event.request.headers.get('cookie') || '') + event.locals.userid = cookies.userid || crypto.randomUUID() - const response = await resolve(event); + const response = await resolve(event) - if (!cookies['userid']) { - // if this is the first time the user has visited this app, - // set a cookie so that we recognise them when they return - response.headers.set( - 'set-cookie', - cookie.serialize('userid', event.locals.userid, { - path: '/', - httpOnly: true - }) - ); - } + if (!cookies.userid) { + // if this is the first time the user has visited this app, + // set a cookie so that we recognise them when they return + response.headers.set( + 'set-cookie', + cookie.serialize('userid', event.locals.userid, { + path: '/', + httpOnly: true, + }), + ) + } - return response; -}; + return response +} diff --git a/examples/sveltekit/src/lib/form.ts b/examples/sveltekit/src/lib/form.ts index 8e9db46a..bd19a14c 100644 --- a/examples/sveltekit/src/lib/form.ts +++ b/examples/sveltekit/src/lib/form.ts @@ -1,84 +1,88 @@ -import { invalidate } from '$app/navigation'; +import { invalidate } from '$app/navigation' // this action (https://svelte.dev/tutorial/actions) allows us to // progressively enhance a <form> that already works without JS export function enhance( - form: HTMLFormElement, - { - pending, - error, - result - }: { - pending?: ({ data, form }: { data: FormData; form: HTMLFormElement }) => void; - error?: ({ - data, - form, - response, - error - }: { - data: FormData; - form: HTMLFormElement; - response: Response | null; - error: Error | null; - }) => void; - result?: ({ - data, - form, - response - }: { - data: FormData; - response: Response; - form: HTMLFormElement; - }) => void; - } = {} + form: HTMLFormElement, + { + pending, + error, + result, + }: { + pending?: ({ data, form }: { data: FormData, form: HTMLFormElement }) => void + error?: ({ + data, + form, + response, + error, + }: { + data: FormData + form: HTMLFormElement + response: Response | null + error: Error | null + }) => void + result?: ({ + data, + form, + response, + }: { + data: FormData + response: Response + form: HTMLFormElement + }) => void + } = {}, ) { - let current_token: unknown; + let current_token: unknown - async function handle_submit(event: SubmitEvent) { - const token = (current_token = {}); + async function handle_submit(event: SubmitEvent) { + const token = (current_token = {}) - event.preventDefault(); + event.preventDefault() - const data = new FormData(form); + const data = new FormData(form) - if (pending) pending({ data, form }); + if (pending) pending({ data, form }) - try { - const response = await fetch(form.action, { - method: form.method, - headers: { - accept: 'application/json' - }, - body: data - }); + try { + const response = await fetch(form.action, { + method: form.method, + headers: { + accept: 'application/json', + }, + body: data, + }) - if (token !== current_token) return; + if (token !== current_token) return - if (response.ok) { - if (result) result({ data, form, response }); + if (response.ok) { + if (result) result({ data, form, response }) - const url = new URL(form.action); - url.search = url.hash = ''; - invalidate(url.href); - } else if (error) { - error({ data, form, error: null, response }); - } else { - console.error(await response.text()); - } - } catch (err: unknown) { - if (error && err instanceof Error) { - error({ data, form, error: err, response: null }); - } else { - throw err; - } - } - } + const url = new URL(form.action) + url.search = url.hash = '' + invalidate(url.href) + } + else if (error) { + error({ data, form, error: null, response }) + } + else { + console.error(await response.text()) + } + } + catch (err: unknown) { + if (error && err instanceof Error) { + error({ data, form, error: err, response: null }) + } + else { + throw err + } + } + } - form.addEventListener('submit', handle_submit); + form.addEventListener('submit', handle_submit) - return { - destroy() { - form.removeEventListener('submit', handle_submit); - } - }; + return { + destroy() { + form.removeEventListener('submit', handle_submit) + }, + } } diff --git a/examples/sveltekit/src/routes/+page.ts b/examples/sveltekit/src/routes/+page.ts index 189f71e2..176ae642 100644 --- a/examples/sveltekit/src/routes/+page.ts +++ b/examples/sveltekit/src/routes/+page.ts @@ -1 +1 @@ -export const prerender = true; +export const prerender = true diff --git a/examples/sveltekit/src/routes/about/+page.ts b/examples/sveltekit/src/routes/about/+page.ts index 3e094ec8..1a2fbe95 100644 --- a/examples/sveltekit/src/routes/about/+page.ts +++ b/examples/sveltekit/src/routes/about/+page.ts @@ -1,13 +1,13 @@ -import { browser, dev } from '$app/env'; +import { browser, dev } from '$app/env' // we don't need any JS on this page, though we'll load // it in dev so that we get hot module replacement... -export const hydrate = dev; +export const hydrate = dev // ...but if the client-side router is already loaded // (i.e. we came here from elsewhere in the app), use it -export const router = browser; +export const router = browser // since there's no dynamic data here, we can prerender // it so that it gets served as a static asset in prod -export const prerender = true; +export const prerender = true diff --git a/examples/sveltekit/src/routes/todos/+page.server.ts b/examples/sveltekit/src/routes/todos/+page.server.ts index 52670c7b..eb507e4b 100644 --- a/examples/sveltekit/src/routes/todos/+page.server.ts +++ b/examples/sveltekit/src/routes/todos/+page.server.ts @@ -1,55 +1,55 @@ -import { error } from '@sveltejs/kit'; -import { api } from './api'; -import type { PageServerLoad, Action } from './$types'; - -type Todo = { - uid: string; - created_at: Date; - text: string; - done: boolean; - pending_delete: boolean; -}; +import { error } from '@sveltejs/kit' +import { api } from './api' +import type { Action, PageServerLoad } from './$types' + +interface Todo { + uid: string + created_at: Date + text: string + done: boolean + pending_delete: boolean +} export const load: PageServerLoad = async ({ locals }) => { - // locals.userid comes from src/hooks.js - const response = await api('GET', `todos/${locals.userid}`); - - if (response.status === 404) { - // user hasn't created a todo list. - // start with an empty array - return { - todos: [] as Todo[] - }; - } - - if (response.status === 200) { - return { - todos: (await response.json()) as Todo[] - }; - } - - throw error(response.status); -}; + // locals.userid comes from src/hooks.js + const response = await api('GET', `todos/${locals.userid}`) + + if (response.status === 404) { + // user hasn't created a todo list. + // start with an empty array + return { + todos: [] as Todo[], + } + } + + if (response.status === 200) { + return { + todos: (await response.json()) as Todo[], + } + } + + throw error(response.status) +} export const POST: Action = async ({ request, locals }) => { - const form = await request.formData(); + const form = await request.formData() - await api('POST', `todos/${locals.userid}`, { - text: form.get('text') - }); -}; + await api('POST', `todos/${locals.userid}`, { + text: form.get('text'), + }) +} export const PATCH: Action = async ({ request, locals }) => { - const form = await request.formData(); + const form = await request.formData() - await api('PATCH', `todos/${locals.userid}/${form.get('uid')}`, { - text: form.has('text') ? form.get('text') : undefined, - done: form.has('done') ? !!form.get('done') : undefined - }); -}; + await api('PATCH', `todos/${locals.userid}/${form.get('uid')}`, { + text: form.has('text') ? form.get('text') : undefined, + done: form.has('done') ? !!form.get('done') : undefined, + }) +} export const DELETE: Action = async ({ request, locals }) => { - const form = await request.formData(); + const form = await request.formData() - await api('DELETE', `todos/${locals.userid}/${form.get('uid')}`); -}; + await api('DELETE', `todos/${locals.userid}/${form.get('uid')}`) +} diff --git a/examples/sveltekit/src/routes/todos/api.ts b/examples/sveltekit/src/routes/todos/api.ts index 8344488a..eb4d03b9 100644 --- a/examples/sveltekit/src/routes/todos/api.ts +++ b/examples/sveltekit/src/routes/todos/api.ts @@ -1,20 +1,20 @@ /* - This module is used by the /todos endpoint to - make calls to api.svelte.dev, which stores todos - for each user. + This module is used by the /todos endpoint to + make calls to api.svelte.dev, which stores todos + for each user. - (The data on the todo app will expire periodically; no - guarantees are made. Don't use it to organise your life.) + (The data on the todo app will expire periodically; no + guarantees are made. Don't use it to organise your life.) */ -const base = 'https://api.svelte.dev'; +const base = 'https://api.svelte.dev' export function api(method: string, resource: string, data?: Record<string, unknown>) { - return fetch(`${base}/${resource}`, { - method, - headers: { - 'content-type': 'application/json' - }, - body: data && JSON.stringify(data) - }); + return fetch(`${base}/${resource}`, { + method, + headers: { + 'content-type': 'application/json', + }, + body: data && JSON.stringify(data), + }) } diff --git a/examples/sveltekit/svelte.config.js b/examples/sveltekit/svelte.config.js index 80034679..f98e9e13 100644 --- a/examples/sveltekit/svelte.config.js +++ b/examples/sveltekit/svelte.config.js @@ -1,15 +1,15 @@ -import adapter from '@sveltejs/adapter-auto'; -import preprocess from 'svelte-preprocess'; +import adapter from '@sveltejs/adapter-auto' +import preprocess from 'svelte-preprocess' /** @type {import('@sveltejs/kit').Config} */ const config = { - // Consult https://github.com/sveltejs/svelte-preprocess - // for more information about preprocessors - preprocess: preprocess(), + // Consult https://github.com/sveltejs/svelte-preprocess + // for more information about preprocessors + preprocess: preprocess(), - kit: { - adapter: adapter(), - } -}; + kit: { + adapter: adapter(), + }, +} -export default config; +export default config diff --git a/examples/sveltekit/tsconfig.json b/examples/sveltekit/tsconfig.json index 6ae0c8c4..c8e4dae2 100644 --- a/examples/sveltekit/tsconfig.json +++ b/examples/sveltekit/tsconfig.json @@ -1,17 +1,17 @@ { - "extends": "./.svelte-kit/tsconfig.json", - "compilerOptions": { - "allowJs": true, - "checkJs": true, - "esModuleInterop": true, - "forceConsistentCasingInFileNames": true, - "resolveJsonModule": true, - "skipLibCheck": true, - "sourceMap": true, - "strict": true - } - // Path aliases are handled by https://kit.svelte.dev/docs/configuration#alias - // - // If you want to overwrite includes/excludes, make sure to copy over the relevant includes/excludes - // from the referenced tsconfig.json - TypeScript does not merge them in + "extends": "./.svelte-kit/tsconfig.json", + "compilerOptions": { + "resolveJsonModule": true, + "allowJs": true, + "checkJs": true, + "strict": true, + "sourceMap": true, + "esModuleInterop": true, + "forceConsistentCasingInFileNames": true, + "skipLibCheck": true + } + // Path aliases are handled by https://kit.svelte.dev/docs/configuration#alias + // + // If you want to overwrite includes/excludes, make sure to copy over the relevant includes/excludes + // from the referenced tsconfig.json - TypeScript does not merge them in } diff --git a/examples/sveltekit/vite.config.ts b/examples/sveltekit/vite.config.ts index 8f5bfef9..375d00e5 100644 --- a/examples/sveltekit/vite.config.ts +++ b/examples/sveltekit/vite.config.ts @@ -1,7 +1,6 @@ /// <reference types="histoire" /> import { defineConfig } from 'vite' -// @ts-ignore import { sveltekit } from '@sveltejs/kit/vite' import { HstSvelte } from '@histoire/plugin-svelte' diff --git a/examples/vue2/src/BaseButton.story.vue b/examples/vue2/src/BaseButton.story.vue index 631b6a2b..d09e9840 100644 --- a/examples/vue2/src/BaseButton.story.vue +++ b/examples/vue2/src/BaseButton.story.vue @@ -126,5 +126,4 @@ Ratione vero beatae corrupti quia. Tenetur temporibus ipsa qui qui tempora. Quae 3. Purr [Go home](/) - </docs> diff --git a/examples/vue2/src/CodeGen.story.vue b/examples/vue2/src/CodeGen.story.vue index 8c84cd87..7bf3ee3b 100644 --- a/examples/vue2/src/CodeGen.story.vue +++ b/examples/vue2/src/CodeGen.story.vue @@ -1,22 +1,14 @@ -<script lang="ts"> -import { defineComponent } from 'vue' - -export default defineComponent({ - directives: { - tooltip: { - bind: (el, { value }) => { - el.setAttribute('title', value) - }, - }, - }, -}) -</script> - <script lang="ts" setup> import ModalWithSlots from './ModalWithSlots.vue' import SlotWithProps from './SlotWithProps.vue' -function initState () { +const vTooltip = { + bind: (el, { value }) => { + el.setAttribute('title', value) + }, +} + +function initState() { return { count: 0, text: 'Foo', @@ -24,7 +16,7 @@ function initState () { } } -function onClick (event) { +function onClick(event, _arg = '') { console.log(event) } </script> @@ -56,9 +48,8 @@ function onClick (event) { A button </button> <button - class="btn btn-primary" + class="btn btn-primary btn-danger" :class="[ - { 'btn-danger': true }, { 'btn-success': false }, ]" style="color: red; font-weight: bold;" diff --git a/examples/vue3-percy/package.json b/examples/vue3-percy/package.json index 8576cd09..c97a03e7 100644 --- a/examples/vue3-percy/package.json +++ b/examples/vue3-percy/package.json @@ -1,8 +1,8 @@ { "name": "histoire-example-vue3-percy", + "type": "module", "version": "0.0.1", "private": true, - "type": "module", "scripts": { "story:dev": "histoire dev", "story:build": "histoire build", @@ -18,4 +18,4 @@ "histoire": "workspace:*", "vite": "^5.0.11" } -} \ No newline at end of file +} diff --git a/examples/vue3-screenshot/package.json b/examples/vue3-screenshot/package.json index bb42102b..3ab838c9 100644 --- a/examples/vue3-screenshot/package.json +++ b/examples/vue3-screenshot/package.json @@ -1,8 +1,8 @@ { "name": "histoire-example-vue3-screenshot", + "type": "module", "version": "0.0.1", "private": true, - "type": "module", "scripts": { "story:dev": "histoire dev", "story:build": "histoire build", @@ -18,4 +18,4 @@ "histoire": "workspace:*", "vite": "^5.0.11" } -} \ No newline at end of file +} diff --git a/examples/vue3-themed/package.json b/examples/vue3-themed/package.json index 7f2ede9b..4ddb2f6b 100644 --- a/examples/vue3-themed/package.json +++ b/examples/vue3-themed/package.json @@ -1,8 +1,8 @@ { "name": "histoire-example-vue3-themed", + "type": "module", "version": "0.0.1", "private": true, - "type": "module", "scripts": { "story:dev": "histoire dev", "story:build": "histoire build", diff --git a/examples/vue3-themed/src/BaseButton.story.vue b/examples/vue3-themed/src/BaseButton.story.vue index 5976e36d..9d1f8944 100644 --- a/examples/vue3-themed/src/BaseButton.story.vue +++ b/examples/vue3-themed/src/BaseButton.story.vue @@ -1,7 +1,7 @@ <script lang="ts" setup> import BaseButton from './BaseButton.vue' -function initState () { +function initState() { return { disabled: false, } diff --git a/examples/vue3-themed/src/Serialize.story.vue b/examples/vue3-themed/src/Serialize.story.vue index 52154607..62324b7d 100644 --- a/examples/vue3-themed/src/Serialize.story.vue +++ b/examples/vue3-themed/src/Serialize.story.vue @@ -6,7 +6,7 @@ title="array" > <div - :list="['a', 2, { foo: 'bar' } ]" + :list="['a', 2, { foo: 'bar' }]" > Array </div> diff --git a/examples/vue3-vuetify/package.json b/examples/vue3-vuetify/package.json index e94be541..29bcd2fa 100644 --- a/examples/vue3-vuetify/package.json +++ b/examples/vue3-vuetify/package.json @@ -1,8 +1,8 @@ { "name": "histoire-example-vue3-vuetify", + "type": "module", "version": "0.0.1", "private": true, - "type": "module", "scripts": { "story:dev": "histoire dev", "story:build": "histoire build", @@ -20,4 +20,4 @@ "vite": "^5.0.11", "vite-plugin-vuetify": "1.0.2" } -} \ No newline at end of file +} diff --git a/examples/vue3/cypress-parallel.mjs b/examples/vue3/cypress-parallel.mjs index d4ec341c..52419cf7 100644 --- a/examples/vue3/cypress-parallel.mjs +++ b/examples/vue3/cypress-parallel.mjs @@ -1,12 +1,12 @@ // @TODO move to playwright -import fs from 'fs/promises' +import fs from 'node:fs/promises' +import { exec } from 'node:child_process' import { globby } from 'globby' import minimatch from 'minimatch' -import { exec } from 'child_process' -const totalRunners = parseInt(process.env.TOTAL_RUNNERS) -const thisRunner = parseInt(process.env.THIS_RUNNER) +const totalRunners = Number.parseInt(process.env.TOTAL_RUNNERS) +const thisRunner = Number.parseInt(process.env.THIS_RUNNER) // These are the same properties that are set in cypress.config. // In practice, it's better to export these from another file, and @@ -20,14 +20,14 @@ const specPatterns = { // used to roughly determine how many tests are in a file const testPattern = /(^|\s)(it|test)\(/g -async function getTestCount (filePath) { +async function getTestCount(filePath) { const content = await fs.readFile(filePath, 'utf8') return content.match(testPattern)?.length || 0 } // adapated from: // https://github.com/bahmutov/find-cypress-specs/blob/main/src/index.js -async function getSpecFilePaths () { +async function getSpecFilePaths() { const options = specPatterns const files = await globby(options.specPattern, { @@ -56,7 +56,7 @@ async function getSpecFilePaths () { return filtered } -async function sortSpecFilesByTestCount (specPathsOriginal) { +async function sortSpecFilesByTestCount(specPathsOriginal) { const specPaths = [...specPathsOriginal] const testPerSpec = {} @@ -72,11 +72,11 @@ async function sortSpecFilesByTestCount (specPathsOriginal) { // but better than just splitting them randomly. And this will create a // consistent file list/ordering so that file division is deterministic. .sort((a, b) => b[1] - a[1]) - .map((x) => x[0]) + .map(x => x[0]) ) } -export function splitSpecs (specs, totalRunners, thisRunner) { +export function splitSpecs(specs, totalRunners, thisRunner) { return specs.filter((_, index) => index % totalRunners === thisRunner) } @@ -85,7 +85,7 @@ export function splitSpecs (specs, totalRunners, thisRunner) { const specFilePaths = await sortSpecFilesByTestCount(await getSpecFilePaths()) if (!specFilePaths.length) { - throw Error('No spec files found.') + throw new Error('No spec files found.') } const specsToRun = splitSpecs(specFilePaths, totalRunners, thisRunner) @@ -109,7 +109,8 @@ export function splitSpecs (specs, totalRunners, thisRunner) { commandProcess.on('exit', (code) => { process.exit(code || 0) }) - } catch (err) { + } + catch (err) { console.error(err) process.exit(1) } diff --git a/examples/vue3/cypress.config.mjs b/examples/vue3/cypress.config.mjs index b7703073..46dfa3e2 100644 --- a/examples/vue3/cypress.config.mjs +++ b/examples/vue3/cypress.config.mjs @@ -12,7 +12,7 @@ export default defineConfig({ e2e: { baseUrl: 'http://localhost:4567', - setupNodeEvents (on, config) { + setupNodeEvents(_on, _config) { // implement node event listeners here }, }, diff --git a/examples/vue3/cypress/plugins/index.js b/examples/vue3/cypress/plugins/index.js index 59b2bab6..b02ebb08 100644 --- a/examples/vue3/cypress/plugins/index.js +++ b/examples/vue3/cypress/plugins/index.js @@ -15,8 +15,8 @@ /** * @type {Cypress.PluginConfig} */ -// eslint-disable-next-line no-unused-vars -module.exports = (on, config) => { + +module.exports = (_on, _config) => { // `on` is used to hook into various events Cypress emits // `config` is the resolved Cypress config } diff --git a/examples/vue3/package.json b/examples/vue3/package.json index ec0ca4ff..17f6c873 100644 --- a/examples/vue3/package.json +++ b/examples/vue3/package.json @@ -1,8 +1,8 @@ { "name": "histoire-example-vue3", + "type": "module", "version": "0.0.1", "private": true, - "type": "module", "scripts": { "dev:hst": "nodemon --watch ../../packages/histoire/dist --watch ../../packages/histoire-plugin-vue/dist --exec \"rm -rf ./node_modules/.hst* && HISTOIRE_DEV=true histoire dev\"", "story:dev": "histoire dev", @@ -34,4 +34,4 @@ "start-server-and-test": "^1.15.4", "vite": "^5.0.11" } -} \ No newline at end of file +} diff --git a/examples/vue3/postcss.config.cjs b/examples/vue3/postcss.config.cjs index 66f145c5..6c8fab2f 100644 --- a/examples/vue3/postcss.config.cjs +++ b/examples/vue3/postcss.config.cjs @@ -1,12 +1,12 @@ module.exports = process.env.HISTOIRE_DEV ? { - plugins: [ - require('postcss-import'), - require('tailwindcss/nesting'), - require('tailwindcss')('./tailwind.config.cjs'), - require('autoprefixer'), - ], - } + plugins: [ + require('postcss-import'), + require('tailwindcss/nesting'), + require('tailwindcss')('./tailwind.config.cjs'), + require('autoprefixer'), + ], + } : { - plugins: [], - } + plugins: [], + } diff --git a/examples/vue3/src/LongFile1.story.md b/examples/vue3/src/LongFile1.story.md index 8ac88da0..237575bc 100644 --- a/examples/vue3/src/LongFile1.story.md +++ b/examples/vue3/src/LongFile1.story.md @@ -33,7 +33,7 @@ import Meow from './Meow.vue' <template> <Story> - <Meow/> + <Meow /> </Story> </template> ``` @@ -64,7 +64,7 @@ You can change the layout of the variant by using the `layout` prop with an obje ### Single layout -This is the default layout, displaying one variant at a time. The default behavior is to isolate the story with an iframe. +This is the default layout, displaying one variant at a time. The default behavior is to isolate the story with an iframe. Additional `layout` properties: - `iframe`: (default: `true`) enables the iframe, useful when your CSS has media queries for responsive design. diff --git a/examples/vue3/src/LongFile2.story.md b/examples/vue3/src/LongFile2.story.md index 6564f4e7..6819c673 100644 --- a/examples/vue3/src/LongFile2.story.md +++ b/examples/vue3/src/LongFile2.story.md @@ -21,7 +21,7 @@ If you want to use the real path of your story files, you can change that in you ```ts{5} // histoire.config.ts -export default defineConfig({ +export default defineConfig({ tree: { file: 'path', }, @@ -35,7 +35,7 @@ If you want a custom hierarchy, you can define your own function that takes an o ```ts{5} // histoire.config.ts -export default defineConfig({ +export default defineConfig({ tree: { file: ({ title, path }) => title.split('/'), // equivalent to default behavior }, @@ -49,7 +49,7 @@ By default, files and stories are sorted by ascending order. But you might want ```ts{5} // histoire.config.ts -export default defineConfig({ +export default defineConfig({ tree: { order: (a, b) => a.localeCompare(b), // equivalent to default behavior }, @@ -86,7 +86,7 @@ Example: ```ts // histoire.config.ts -export default defineConfig({ +export default defineConfig({ tree: { groups: [ { diff --git a/examples/vue3/src/components/AutoStateProps.story.vue b/examples/vue3/src/components/AutoStateProps.story.vue index 28b695c4..f8cbde52 100644 --- a/examples/vue3/src/components/AutoStateProps.story.vue +++ b/examples/vue3/src/components/AutoStateProps.story.vue @@ -1,7 +1,7 @@ <script lang="ts" setup> import AutoStateProps from './AutoStateProps.vue' -function initState () { +function initState() { return { name: 'Fry', } diff --git a/examples/vue3/src/components/BaseButton.story.vue b/examples/vue3/src/components/BaseButton.story.vue index 0a1650fc..04407bab 100644 --- a/examples/vue3/src/components/BaseButton.story.vue +++ b/examples/vue3/src/components/BaseButton.story.vue @@ -1,7 +1,7 @@ <script lang="ts" setup> import BaseButton from './BaseButton.vue' -function initState () { +function initState() { return { disabled: false, color: undefined, diff --git a/examples/vue3/src/components/CodeGen.story.vue b/examples/vue3/src/components/CodeGen.story.vue index ec1c62e4..0493114a 100644 --- a/examples/vue3/src/components/CodeGen.story.vue +++ b/examples/vue3/src/components/CodeGen.story.vue @@ -1,30 +1,23 @@ -<script lang="ts"> -import { defineComponent, ref } from 'vue' - -export default defineComponent({ - directives: { - tooltip: { - mounted: (el, { value }) => { - el.setAttribute('title', value) - }, - }, - }, -}) -</script> - <script lang="ts" setup> +import { ref } from 'vue' import ModalWithSlots from './ModalWithSlots.vue' import SlotWithProps from './SlotWithProps.vue' import BaseButton from './BaseButton.vue' -function initState () { +const vTooltip = { + mounted: (el, { value }) => { + el.setAttribute('title', value) + }, +} + +function initState() { return { count: 0, text: 'Foo', } } -function onClick (event) { +function onClick(event) { console.log(event) } diff --git a/examples/vue3/src/components/ColorButton.story.vue b/examples/vue3/src/components/ColorButton.story.vue index 59a513e4..ec1c1481 100644 --- a/examples/vue3/src/components/ColorButton.story.vue +++ b/examples/vue3/src/components/ColorButton.story.vue @@ -1,7 +1,7 @@ <script lang="ts" setup> import ColorButton from './ColorButton.vue' -function initState () { +function initState() { return { bgcolorselect: '#000000', txtcolorselect: '#ffffff', diff --git a/examples/vue3/src/components/ComplexParameter.story.vue b/examples/vue3/src/components/ComplexParameter.story.vue index f85c659b..60770560 100644 --- a/examples/vue3/src/components/ComplexParameter.story.vue +++ b/examples/vue3/src/components/ComplexParameter.story.vue @@ -15,7 +15,7 @@ const myParameter = [ <template> <Story title="ComplexParameter" - :layout="{type: 'single', iframe: false}" + :layout="{ type: 'single', iframe: false }" > <ComplexParameter :complex-parameter="myParameter" diff --git a/examples/vue3/src/components/ComplexParameter.vue b/examples/vue3/src/components/ComplexParameter.vue index 0cd3c961..5644c769 100644 --- a/examples/vue3/src/components/ComplexParameter.vue +++ b/examples/vue3/src/components/ComplexParameter.vue @@ -1,7 +1,7 @@ <script setup lang="ts"> -const props = defineProps<{ - complexParameter: Array<{action: () => void}> - recursiveParameter: {name: string} & Record<string, unknown> +defineProps<{ + complexParameter: Array<{ action: () => void }> + recursiveParameter: { name: string } & Record<string, unknown> }>() </script> diff --git a/examples/vue3/src/components/Controls.story.vue b/examples/vue3/src/components/Controls.story.vue index 4432854d..0a2044c6 100644 --- a/examples/vue3/src/components/Controls.story.vue +++ b/examples/vue3/src/components/Controls.story.vue @@ -11,7 +11,7 @@ const radioOptions = { 'elden-ring': 'Elden Ring', } -function initState () { +function initState() { return { text: 'Hello', checkbox: false, diff --git a/examples/vue3/src/components/Docs.story.vue b/examples/vue3/src/components/Docs.story.vue index 500b1156..a49628fd 100644 --- a/examples/vue3/src/components/Docs.story.vue +++ b/examples/vue3/src/components/Docs.story.vue @@ -45,5 +45,4 @@ Ratione vero beatae corrupti quia. Tenetur temporibus ipsa qui qui tempora. Quae 3. Purr [Go home](/) - </docs> diff --git a/examples/vue3/src/components/EventButton.story.vue b/examples/vue3/src/components/EventButton.story.vue index c4f77abf..348cf774 100644 --- a/examples/vue3/src/components/EventButton.story.vue +++ b/examples/vue3/src/components/EventButton.story.vue @@ -1,13 +1,13 @@ <script lang="ts" setup> -import EventButton from './EventButton.vue' import { logEvent } from 'histoire/client' +import EventButton from './EventButton.vue' </script> <template> <Story title="events/EventButton" > - <EventButton @myEvent="logEvent('My event', $event)" /><br> + <EventButton @my-event="logEvent('My event', $event)" /><br> <button @click="logEvent('Click', $event)"> Click </button> diff --git a/examples/vue3/src/components/EventButton.vue b/examples/vue3/src/components/EventButton.vue index 481b7743..ce10d800 100644 --- a/examples/vue3/src/components/EventButton.vue +++ b/examples/vue3/src/components/EventButton.vue @@ -8,7 +8,7 @@ const emit = defineEmits<{ const value1 = ref('Hello') const value2 = ref('World') -function sendEvent () { +function sendEvent() { emit('myEvent', { a: value1.value, b: value2.value }) } </script> diff --git a/examples/vue3/src/components/EventButtonGrid.story.vue b/examples/vue3/src/components/EventButtonGrid.story.vue index df4ed271..fb5aecd1 100644 --- a/examples/vue3/src/components/EventButtonGrid.story.vue +++ b/examples/vue3/src/components/EventButtonGrid.story.vue @@ -1,6 +1,6 @@ <script lang="ts" setup> -import EventButton from './EventButton.vue' import { logEvent } from 'histoire/client' +import EventButton from './EventButton.vue' </script> <template> @@ -13,7 +13,7 @@ import { logEvent } from 'histoire/client' :key="n" :title="`Variant ${n}`" > - <EventButton @myEvent="logEvent('My event', $event)" /><br> + <EventButton @my-event="logEvent('My event', $event)" /><br> <button @click="logEvent('Click', $event)"> Click </button> diff --git a/examples/vue3/src/components/HandWrittenSource.story.vue b/examples/vue3/src/components/HandWrittenSource.story.vue index 4db445c1..6df43ccf 100644 --- a/examples/vue3/src/components/HandWrittenSource.story.vue +++ b/examples/vue3/src/components/HandWrittenSource.story.vue @@ -1,5 +1,5 @@ <script lang="ts" setup> -function initState () { +function initState() { return { count: 0, } diff --git a/examples/vue3/src/components/LottieAnimation.story.vue b/examples/vue3/src/components/LottieAnimation.story.vue index 1073daea..bd3c1172 100644 --- a/examples/vue3/src/components/LottieAnimation.story.vue +++ b/examples/vue3/src/components/LottieAnimation.story.vue @@ -1,6 +1,7 @@ <script lang="ts" setup> import { isCollecting } from 'histoire/client' import { onMounted, ref } from 'vue' + const el = ref(null) onMounted(async () => { if (isCollecting() || !el.value) return diff --git a/examples/vue3/src/components/Serialize.story.vue b/examples/vue3/src/components/Serialize.story.vue index 52154607..62324b7d 100644 --- a/examples/vue3/src/components/Serialize.story.vue +++ b/examples/vue3/src/components/Serialize.story.vue @@ -6,7 +6,7 @@ title="array" > <div - :list="['a', 2, { foo: 'bar' } ]" + :list="['a', 2, { foo: 'bar' }]" > Array </div> diff --git a/examples/vue3/src/components/State.story.vue b/examples/vue3/src/components/State.story.vue index c34cdda3..320cf0a1 100644 --- a/examples/vue3/src/components/State.story.vue +++ b/examples/vue3/src/components/State.story.vue @@ -1,12 +1,12 @@ <script lang="ts" setup> -function initState () { +function initState() { return { count: 0, text: '', } } -function initState2 () { +function initState2() { return { meow: { foo: 'bar', diff --git a/examples/vue3/src/components/StateOption.story.vue b/examples/vue3/src/components/StateOption.story.vue index 9fa88eee..4722c40d 100644 --- a/examples/vue3/src/components/StateOption.story.vue +++ b/examples/vue3/src/components/StateOption.story.vue @@ -1,6 +1,6 @@ <script> export default { - data () { + data() { return { optionApiData: 'OPTION API', } diff --git a/examples/vue3/src/components/StateSetup2.story.vue b/examples/vue3/src/components/StateSetup2.story.vue index c614e590..4699cc7f 100644 --- a/examples/vue3/src/components/StateSetup2.story.vue +++ b/examples/vue3/src/components/StateSetup2.story.vue @@ -2,7 +2,7 @@ import { reactive, ref } from 'vue' export default { - setup () { + setup() { const state = reactive({ count: 0, text: 'Meow', diff --git a/examples/vue3/src/components/WrapperGlobal.vue b/examples/vue3/src/components/WrapperGlobal.vue index 74edb04f..43c176bd 100644 --- a/examples/vue3/src/components/WrapperGlobal.vue +++ b/examples/vue3/src/components/WrapperGlobal.vue @@ -1,14 +1,14 @@ <script lang="ts" setup> -import { Story, Variant } from 'histoire' +import type { Story, Variant } from 'histoire' const props = defineProps<{ story: Story variant?: Variant }>() -function hasWrapper () { - return props.story.meta?.wrapper !== false && - props.variant?.meta?.wrapper !== false +function hasWrapper() { + return props.story.meta?.wrapper !== false + && props.variant?.meta?.wrapper !== false } </script> diff --git a/examples/vue3/tailwind.config.cjs b/examples/vue3/tailwind.config.cjs index d841c284..937f399f 100644 --- a/examples/vue3/tailwind.config.cjs +++ b/examples/vue3/tailwind.config.cjs @@ -1,2 +1,3 @@ const config = require('@histoire/app/tailwind.config.cjs') + module.exports = config diff --git a/examples/vue3/tsconfig.json b/examples/vue3/tsconfig.json index 4d5aaf76..0c9ee357 100644 --- a/examples/vue3/tsconfig.json +++ b/examples/vue3/tsconfig.json @@ -1,34 +1,34 @@ { "compilerOptions": { "target": "ESNext", + // Volar + "jsx": "preserve", + "lib": [ + "ESNext", + "DOM" + ], + "baseUrl": ".", + "rootDir": "src", "module": "ESNext", "moduleResolution": "node", - "outDir": "dist", - "rootDir": "src", - "baseUrl": ".", - "allowSyntheticDefaultImports": true, - "esModuleInterop": true, - "removeComments": false, "resolveJsonModule": true, - "skipLibCheck": true, "types": [ "node" ], - "lib": [ - "ESNext", - "DOM" - ], - "sourceMap": false, - "preserveWatchOutput": true, - "declaration": false, + "strictBindCallApply": true, + "strictFunctionTypes": true, + "alwaysStrict": true, // Strict "noImplicitAny": false, "noImplicitThis": true, - "alwaysStrict": true, - "strictBindCallApply": true, - "strictFunctionTypes": true, - // Volar - "jsx": "preserve", + "declaration": false, + "outDir": "dist", + "removeComments": false, + "sourceMap": false, + "allowSyntheticDefaultImports": true, + "esModuleInterop": true, + "skipLibCheck": true, + "preserveWatchOutput": true }, "include": [ "src" diff --git a/examples/vue3/vite.config.ts b/examples/vue3/vite.config.ts index c716a9f5..8c5ef964 100644 --- a/examples/vue3/vite.config.ts +++ b/examples/vue3/vite.config.ts @@ -1,8 +1,8 @@ /// <reference types="histoire" /> +import path from 'node:path' import { defineConfig } from 'vite' import vue from '@vitejs/plugin-vue' -import path from 'path' export default defineConfig({ // Example build config for a component library @@ -10,7 +10,7 @@ export default defineConfig({ lib: { entry: path.resolve(__dirname, './src/main.ts'), name: 'histoire-kit', - fileName: (format) => `histoire-kit.${format}.js`, + fileName: format => `histoire-kit.${format}.js`, }, rollupOptions: { @@ -44,7 +44,7 @@ export default defineConfig({ plugins: [ { name: 'test', - config () { + config() { return { theme: { logoHref: 'http://histoire.dev', diff --git a/netlify.toml b/netlify.toml index e7bf3dc0..b38e22bd 100644 --- a/netlify.toml +++ b/netlify.toml @@ -1,8 +1,8 @@ [build.environment] - NODE_VERSION = "16" - NPM_FLAGS = "--version" # prevent Netlify npm install +NODE_VERSION = "16" +NPM_FLAGS = "--version" # prevent Netlify npm install [[redirects]] - from = "/*" - to = "/index.html" - status = 200 +from = "/*" +to = "/index.html" +status = 200 diff --git a/package.json b/package.json index 2024fce8..a93b5add 100644 --- a/package.json +++ b/package.json @@ -2,12 +2,16 @@ "name": "histoire-monorepo", "version": "0.17.16", "private": true, + "packageManager": "pnpm@8.6.2", "repository": { "url": "https://github.com/Akryum/histoire.git", "type": "git" }, + "engines": { + "node": ">14.5.0" + }, "scripts": { - "lint": "eslint . --ext js,vue,ts --cache", + "lint": "eslint . --cache", "build": "pnpm run -r build", "watch": "pnpm run build && pnpm run -r --parallel --filter \"./packages/**\" watch", "test": "pnpm run -r --parallel --filter \"./packages/**\" test", @@ -18,30 +22,19 @@ "docs:build": "vitepress build docs", "docs:serve": "vitepress serve docs" }, - "engines": { - "node": ">14.5.0" - }, "devDependencies": { "@akryum/sheep": "^0.5.0", + "@antfu/eslint-config": "^2.13.0", "@histoire/vendors": "workspace:*", "@iconify/vue": "^3.2.1", - "@typescript-eslint/eslint-plugin": "^5.62.0", - "@typescript-eslint/parser": "^5.62.0", - "@vue/eslint-config-standard": "^6.1.0", - "@vue/eslint-config-typescript": "^10.0.0", "@vueuse/core": "^9.13.0", "autoprefixer": "^10.4.16", - "eslint": "^8.54.0", - "eslint-plugin-cypress": "^2.15.1", - "eslint-plugin-import": "^2.29.0", - "eslint-plugin-node": "^11.1.0", - "eslint-plugin-promise": "^6.1.1", - "eslint-plugin-vue": "^9.18.1", + "eslint": "^9.0.0", "floating-vue": "2.0.0-beta.19", "postcss": "^8.4.31", "rimraf": "^3.0.2", "tailwindcss": "^3.3.5", - "typescript": "^4.9.5", + "typescript": "^5.4.4", "vitepress": "1.0.0-alpha.10", "vue-eslint-parser": "^9.3.2" }, @@ -65,6 +58,5 @@ "vue": "*" } } - }, - "packageManager": "pnpm@8.6.2" + } } diff --git a/packages/histoire-app/package.json b/packages/histoire-app/package.json index 2b3d20f9..49b15fbd 100644 --- a/packages/histoire-app/package.json +++ b/packages/histoire-app/package.json @@ -1,11 +1,12 @@ { "name": "@histoire/app", + "type": "module", "version": "0.17.16", "description": "Pre-bundled UI for Histoire", - "license": "MIT", "author": { "name": "Guillaume Chau" }, + "license": "MIT", "repository": { "url": "https://github.com/Akryum/histoire.git", "type": "git", @@ -14,7 +15,6 @@ "publishConfig": { "access": "public" }, - "type": "module", "exports": { ".": { "types": "./dist/index.d.ts", @@ -50,7 +50,7 @@ "postcss": "^8.4.31", "postcss-import": "^14.1.0", "tailwindcss": "^3.3.5", - "typescript": "^4.9.5", + "typescript": "^5.4.4", "vite": "^5.0.11", "vue": "^3.3.8" } diff --git a/packages/histoire-app/scripts/copy.mjs b/packages/histoire-app/scripts/copy.mjs index 169fceed..b9091c34 100644 --- a/packages/histoire-app/scripts/copy.mjs +++ b/packages/histoire-app/scripts/copy.mjs @@ -2,7 +2,7 @@ import fs from 'fs-extra' import { globbySync } from 'globby' import { normalizePath } from 'vite' -function toDist (file) { +function toDist(file) { return normalizePath(file).replace(/^src\//, 'dist/') } diff --git a/packages/histoire-app/scripts/watchAndCopy.mjs b/packages/histoire-app/scripts/watchAndCopy.mjs index 61c86e37..1fd21972 100644 --- a/packages/histoire-app/scripts/watchAndCopy.mjs +++ b/packages/histoire-app/scripts/watchAndCopy.mjs @@ -2,7 +2,7 @@ import chokidar from 'chokidar' import fs from 'fs-extra' import { normalizePath } from 'vite' -function toDist (file) { +function toDist(file) { return normalizePath(file).replace(/^src\//, 'dist/') } @@ -10,6 +10,6 @@ function toDist (file) { // they change. chokidar .watch('src/**/!(*.ts|*.vue|tsconfig.json)') - .on('change', (file) => fs.copy(file, toDist(file))) - .on('add', (file) => fs.copy(file, toDist(file))) - .on('unlink', (file) => fs.remove(toDist(file))) + .on('change', file => fs.copy(file, toDist(file))) + .on('add', file => fs.copy(file, toDist(file))) + .on('unlink', file => fs.remove(toDist(file))) diff --git a/packages/histoire-app/src/app/App.vue b/packages/histoire-app/src/app/App.vue index 5bbc78cd..7d33c256 100644 --- a/packages/histoire-app/src/app/App.vue +++ b/packages/histoire-app/src/app/App.vue @@ -5,15 +5,15 @@ export default { </script> <script lang="ts" setup> -import { files as rawFiles, tree as rawTree, onUpdate } from 'virtual:$histoire-stories' +import { onUpdate, files as rawFiles, tree as rawTree } from 'virtual:$histoire-stories' +import { computed, onMounted, ref, watch } from 'vue' +import { useTitle } from '@vueuse/core' import StoryList from './components/tree/StoryList.vue' import BaseSplitPane from './components/base/BaseSplitPane.vue' -import { computed, onMounted, ref, watch } from 'vue' import AppHeader from './components/app/AppHeader.vue' import type { StoryFile, Tree } from './types' import { useStoryStore } from './stores/story' import { mapFile } from './util/mapping' -import { useTitle } from '@vueuse/core' import { histoireConfig } from './util/config' import { onKeyboardShortcut } from './util/keyboard' import { isMobile } from './util/responsive' @@ -29,7 +29,7 @@ const tree = ref<Tree>(rawTree) onUpdate((newFiles: StoryFile[], newTree: Tree) => { loading.value = false - files.value = newFiles.map(file => { + files.value = newFiles.map((file) => { const existingFile = files.value.find(f => f.id === file.id) return mapFile(file, existingFile) }) @@ -44,7 +44,7 @@ const stories = computed(() => files.value.reduce((acc, file) => { // Store const storyStore = useStoryStore() -watch(stories, value => { +watch(stories, (value) => { storyStore.setStories(value) }, { immediate: true, @@ -66,7 +66,7 @@ useTitle(computed(() => { const loadSearch = ref(false) const isSearchOpen = ref(false) -watch(isSearchOpen, value => { +watch(isSearchOpen, (value) => { if (value) { loadSearch.value = true } diff --git a/packages/histoire-app/src/app/api.ts b/packages/histoire-app/src/app/api.ts index bbfe7a51..26f53125 100644 --- a/packages/histoire-app/src/app/api.ts +++ b/packages/histoire-app/src/app/api.ts @@ -4,6 +4,6 @@ export { logEvent } from './util/events.js' export { toggleDark } from './util/dark.js' -export function isDark () { +export function isDark() { return _isDark.value } diff --git a/packages/histoire-app/src/app/components/HomeView.vue b/packages/histoire-app/src/app/components/HomeView.vue index 88af4426..21f25f1f 100644 --- a/packages/histoire-app/src/app/components/HomeView.vue +++ b/packages/histoire-app/src/app/components/HomeView.vue @@ -1,6 +1,6 @@ <script lang="ts" setup> import { computed } from 'vue' -import { histoireConfig, customLogos } from '../util/config' +import { customLogos, histoireConfig } from '../util/config' import HistoireLogo from '../assets/histoire.svg' import { useStoryStore } from '../stores/story' import HomeCounter from './app/HomeCounter.vue' @@ -13,10 +13,11 @@ const stats = computed(() => { let variantCount = 0 let docsCount = 0; - (storyStore.stories || []).forEach(story => { + (storyStore.stories || []).forEach((story) => { if (story.docsOnly) { docsCount++ - } else { + } + else { storyCount++ if (story.variants) { variantCount += story.variants.length diff --git a/packages/histoire-app/src/app/components/app/AppHeader.vue b/packages/histoire-app/src/app/components/app/AppHeader.vue index 984d2643..672e9dd5 100644 --- a/packages/histoire-app/src/app/components/app/AppHeader.vue +++ b/packages/histoire-app/src/app/components/app/AppHeader.vue @@ -1,11 +1,11 @@ <script setup lang="ts"> import { Icon } from '@iconify/vue' import { computed } from 'vue' -import AppLogo from './AppLogo.vue' import { isDark, toggleDark } from '../../util/dark' import { onKeyboardShortcut } from '../../util/keyboard' import { makeTooltip } from '../../util/tooltip' import { histoireConfig } from '../../util/config' +import AppLogo from './AppLogo.vue' defineEmits({ search: () => true, diff --git a/packages/histoire-app/src/app/components/app/AppLogo.vue b/packages/histoire-app/src/app/components/app/AppLogo.vue index 231b67ac..546745c0 100644 --- a/packages/histoire-app/src/app/components/app/AppLogo.vue +++ b/packages/histoire-app/src/app/components/app/AppLogo.vue @@ -1,7 +1,7 @@ <script lang="ts" setup> -import { isDark } from '../../util/dark' import { computed } from 'vue' -import { histoireConfig, customLogos } from '../../util/config' +import { isDark } from '../../util/dark' +import { customLogos, histoireConfig } from '../../util/config' import HistoireLogoDark from '../../assets/histoire-text-dark.svg' import HistoireLogoLight from '../../assets/histoire-text.svg' @@ -13,7 +13,7 @@ const logoUrl = computed(() => { return histoireConfig.theme.logo?.light ? customLogos.light : HistoireLogoLight }) -const altText = computed(() => histoireConfig.theme.title + ' logo') +const altText = computed(() => `${histoireConfig.theme.title} logo`) </script> <template> diff --git a/packages/histoire-app/src/app/components/app/Breadcrumb.vue b/packages/histoire-app/src/app/components/app/Breadcrumb.vue index 7a2d1f89..b4546b12 100644 --- a/packages/histoire-app/src/app/components/app/Breadcrumb.vue +++ b/packages/histoire-app/src/app/components/app/Breadcrumb.vue @@ -2,9 +2,9 @@ import { computed, ref, watch } from 'vue' import { Icon } from '@iconify/vue' import { useStoryStore } from '../../stores/story' -import { Story, Tree } from '../../types' -import MobileOverlay from './MobileOverlay.vue' +import type { Story, Tree } from '../../types' import StoryList from '../tree/StoryList.vue' +import MobileOverlay from './MobileOverlay.vue' defineProps<{ tree: Tree @@ -21,11 +21,11 @@ const folders = computed(() => { const isMenuOpened = ref(false) -function openMenu () { +function openMenu() { isMenuOpened.value = true } -function closeMenu () { +function closeMenu() { isMenuOpened.value = false } diff --git a/packages/histoire-app/src/app/components/app/MobileOverlay.vue b/packages/histoire-app/src/app/components/app/MobileOverlay.vue index c5e70816..05c425bc 100644 --- a/packages/histoire-app/src/app/components/app/MobileOverlay.vue +++ b/packages/histoire-app/src/app/components/app/MobileOverlay.vue @@ -6,7 +6,7 @@ defineProps<{ opened: boolean }>() -const emit = defineEmits<{(e: 'close'): void}>() +const emit = defineEmits<{ (e: 'close'): void }>() </script> <template> diff --git a/packages/histoire-app/src/app/components/base/BaseCheckbox.vue b/packages/histoire-app/src/app/components/base/BaseCheckbox.vue index bf037950..b52fb476 100644 --- a/packages/histoire-app/src/app/components/base/BaseCheckbox.vue +++ b/packages/histoire-app/src/app/components/base/BaseCheckbox.vue @@ -9,11 +9,10 @@ const props = defineProps({ }) const emit = defineEmits({ - // eslint-disable-next-line @typescript-eslint/no-unused-vars - 'update:modelValue': (newValue: boolean) => true, + 'update:modelValue': (_newValue: boolean) => true, }) -function toggle () { +function toggle() { emit('update:modelValue', !props.modelValue) animationEnabled.value = true } diff --git a/packages/histoire-app/src/app/components/base/BaseIcon.vue b/packages/histoire-app/src/app/components/base/BaseIcon.vue index 1c781b09..20a2de9b 100644 --- a/packages/histoire-app/src/app/components/base/BaseIcon.vue +++ b/packages/histoire-app/src/app/components/base/BaseIcon.vue @@ -6,8 +6,8 @@ const props = defineProps<{ icon: string }>() -const isUrl = computed(() => props.icon.startsWith('http') || props.icon.startsWith('data:image') || - props.icon.startsWith('.') || props.icon.startsWith('/')) +const isUrl = computed(() => props.icon.startsWith('http') || props.icon.startsWith('data:image') + || props.icon.startsWith('.') || props.icon.startsWith('/')) </script> <template> diff --git a/packages/histoire-app/src/app/components/base/BaseKeyboardShortcut.vue b/packages/histoire-app/src/app/components/base/BaseKeyboardShortcut.vue index e7eaafc0..156f934e 100644 --- a/packages/histoire-app/src/app/components/base/BaseKeyboardShortcut.vue +++ b/packages/histoire-app/src/app/components/base/BaseKeyboardShortcut.vue @@ -1,6 +1,6 @@ <script lang="ts" setup> -import { formatKey } from '../../util/keyboard.js' import { computed } from 'vue' +import { formatKey } from '../../util/keyboard.js' const props = defineProps<{ shortcut: string diff --git a/packages/histoire-app/src/app/components/base/BaseListItem.vue b/packages/histoire-app/src/app/components/base/BaseListItem.vue index a989f8cb..0ef27fa1 100644 --- a/packages/histoire-app/src/app/components/base/BaseListItem.vue +++ b/packages/histoire-app/src/app/components/base/BaseListItem.vue @@ -7,7 +7,7 @@ const emit = defineEmits<{ (e: 'navigate'): void }>() -function handleNavigate () { +function handleNavigate() { emit('navigate') } </script> @@ -19,7 +19,7 @@ function handleNavigate () { $attrs.class, isActive ? 'active htw-bg-primary-500 hover:htw-bg-primary-600 htw-text-white dark:htw-text-black' - : 'hover:htw-bg-primary-100 dark:hover:htw-bg-primary-900' + : 'hover:htw-bg-primary-100 dark:hover:htw-bg-primary-900', ]" @click="handleNavigate()" @keyup.enter="handleNavigate()" diff --git a/packages/histoire-app/src/app/components/base/BaseListItemLink.vue b/packages/histoire-app/src/app/components/base/BaseListItemLink.vue index 38e98de4..155c8b01 100644 --- a/packages/histoire-app/src/app/components/base/BaseListItemLink.vue +++ b/packages/histoire-app/src/app/components/base/BaseListItemLink.vue @@ -15,8 +15,8 @@ export default defineComponent({ navigate: () => true, }, - setup (props, { emit }) { - function handleNavigate (event, navigate: (event) => unknown) { + setup(props, { emit }) { + function handleNavigate(event, navigate: (event) => unknown) { emit('navigate') navigate(event) } @@ -42,7 +42,7 @@ export default defineComponent({ $attrs.class, (isActive != null ? isActive : linkIsActive) ? 'active htw-bg-primary-500 hover:htw-bg-primary-600 htw-text-white dark:htw-text-black' - : 'hover:htw-bg-primary-100 dark:hover:htw-bg-primary-900' + : 'hover:htw-bg-primary-100 dark:hover:htw-bg-primary-900', ]" @click="handleNavigate($event, navigate)" @keyup.enter="handleNavigate($event, navigate)" diff --git a/packages/histoire-app/src/app/components/base/BaseOverflowMenu.vue b/packages/histoire-app/src/app/components/base/BaseOverflowMenu.vue index 1ea91b63..960fc602 100644 --- a/packages/histoire-app/src/app/components/base/BaseOverflowMenu.vue +++ b/packages/histoire-app/src/app/components/base/BaseOverflowMenu.vue @@ -1,5 +1,5 @@ <script lang="ts" setup> -import { ref, h, onBeforeUnmount, reactive, computed } from 'vue' +import { computed, h, onBeforeUnmount, reactive, ref } from 'vue' import { useResizeObserver } from '@vueuse/core' import { Icon } from '@iconify/vue' @@ -43,7 +43,7 @@ const visibleChildrenCount = computed(() => { const ChildWrapper = { name: 'ChildWrapper', props: ['index'], - setup (props, { slots }) { + setup(props, { slots }) { const el = ref<HTMLDivElement>() const state = reactive({ width: 0, index: props.index }) @@ -69,7 +69,7 @@ const ChildWrapper = { /** * Wraps each child with a <ChildWrapper> */ -const ChildrenRender = (props, { slots }) => { +function ChildrenRender(props, { slots }) { const [fragment] = slots.default() return fragment.children.map((vnode, index) => h(ChildWrapper, { index }, () => [vnode])) } @@ -77,7 +77,7 @@ const ChildrenRender = (props, { slots }) => { /** * Only renders a part of a children list */ -const ChildrenSlice = (props, { slots }) => { +function ChildrenSlice(props, { slots }) { const [fragment] = slots.default() return fragment.children.slice(props.start, props.end) } diff --git a/packages/histoire-app/src/app/components/base/BaseSelect.vue b/packages/histoire-app/src/app/components/base/BaseSelect.vue index fd51a202..ba8d15ef 100644 --- a/packages/histoire-app/src/app/components/base/BaseSelect.vue +++ b/packages/histoire-app/src/app/components/base/BaseSelect.vue @@ -1,6 +1,7 @@ <script lang="ts" setup> import { Dropdown as VDropdown } from 'floating-vue' -import { computed, ComputedRef } from 'vue' +import type { ComputedRef } from 'vue' +import { computed } from 'vue' import { Icon } from '@iconify/vue' const props = defineProps<{ @@ -15,14 +16,14 @@ const emit = defineEmits<{ const formattedOptions: ComputedRef<Record<string, string>> = computed(() => { if (Array.isArray(props.options)) { - return Object.fromEntries(props.options.map((value) => [value, value])) + return Object.fromEntries(props.options.map(value => [value, value])) } return props.options }) const selectedLabel = computed(() => formattedOptions.value[props.modelValue]) -function selectValue (value: string, hide: () => void) { +function selectValue(value: string, hide: () => void) { emit('update:modelValue', value) emit('select', value) hide() @@ -51,7 +52,7 @@ function selectValue (value: string, hide: () => void) { <template #popper="{ hide }"> <div class="htw-flex htw-flex-col htw-bg-gray-50 dark:htw-bg-gray-700"> <div - v-for="( label, value ) in formattedOptions" + v-for="(label, value) in formattedOptions" v-bind="{ ...$attrs, class: null, style: null }" :key="label" class="htw-px-2 htw-py-1 htw-cursor-pointer hover:htw-bg-primary-100 dark:hover:htw-bg-primary-700" diff --git a/packages/histoire-app/src/app/components/base/BaseSplitPane.vue b/packages/histoire-app/src/app/components/base/BaseSplitPane.vue index c3ef5bfa..4b6ac2ea 100644 --- a/packages/histoire-app/src/app/components/base/BaseSplitPane.vue +++ b/packages/histoire-app/src/app/components/base/BaseSplitPane.vue @@ -1,5 +1,5 @@ <script lang="ts" setup> -import { ref, computed, watch, onUnmounted } from 'vue' +import { computed, onUnmounted, ref, watch } from 'vue' const SAVE_PREFIX = '__histoire' @@ -48,8 +48,7 @@ const props = defineProps({ }) const emit = defineEmits({ - // eslint-disable-next-line @typescript-eslint/no-unused-vars - 'update:split': (value: number) => true, + 'update:split': (_value: number) => true, }) const currentSplit = ref(props.defaultSplit) @@ -70,7 +69,8 @@ if (props.saveId) { let parsedValue try { parsedValue = JSON.parse(savedValue) - } catch (e) { + } + catch (e) { console.error(e) } @@ -79,11 +79,11 @@ if (props.saveId) { } } - watch(currentSplit, value => { + watch(currentSplit, (value) => { localStorage.setItem(storageKey, JSON.stringify(value)) }) - watch(currentSplit, value => { + watch(currentSplit, (value) => { if (value !== props.split) { emit('update:split', value) } @@ -95,9 +95,11 @@ if (props.saveId) { const boundSplit = computed(() => { if (currentSplit.value < props.min) { return props.min - } else if (currentSplit.value > props.max) { + } + else if (currentSplit.value > props.max) { return props.max - } else { + } + else { return currentSplit.value } }) @@ -115,7 +117,7 @@ let startPosition = 0 let startSplit = 0 const el = ref(null) -function dragStart (e) { +function dragStart(e) { dragging.value = true startPosition = props.orientation === 'landscape' ? e.pageX : e.pageY startSplit = boundSplit.value @@ -123,32 +125,34 @@ function dragStart (e) { window.addEventListener('mouseup', dragEnd) } -function dragMove (e) { +function dragMove(e) { if (dragging.value) { let position let totalSize if (props.orientation === 'landscape') { position = e.pageX totalSize = el.value.offsetWidth - } else { + } + else { position = e.pageY totalSize = el.value.offsetHeight } const dPosition = position - startPosition if (props.fixed) { currentSplit.value = startSplit + dPosition - } else { + } + else { currentSplit.value = startSplit + ~~(dPosition / totalSize * 200) / 2 } } } -function dragEnd () { +function dragEnd() { dragging.value = false removeDragListeners() } -function removeDragListeners () { +function removeDragListeners() { window.removeEventListener('mousemove', dragMove) window.removeEventListener('mouseup', dragEnd) } @@ -166,7 +170,7 @@ onUnmounted(() => { 'htw-flex-col': orientation === 'portrait', 'htw-cursor-ew-resize': dragging && orientation === 'landscape', 'htw-cursor-ns-resize': dragging && orientation === 'portrait', - [orientation]: true + [orientation]: true, }" > <div diff --git a/packages/histoire-app/src/app/components/command/CommandPrompts.vue b/packages/histoire-app/src/app/components/command/CommandPrompts.vue index 8f39aebe..6ef4bdf3 100644 --- a/packages/histoire-app/src/app/components/command/CommandPrompts.vue +++ b/packages/histoire-app/src/app/components/command/CommandPrompts.vue @@ -1,7 +1,7 @@ <script lang="ts" setup> -import { reactive, ref, nextTick, onMounted } from 'vue' +import { nextTick, onMounted, reactive, ref } from 'vue' import type { ClientCommand } from '@histoire/shared' -import { getCommandContext, executeCommand } from '../../util/commands.js' +import { executeCommand, getCommandContext } from '../../util/commands.js' import BaseButton from '../base/BaseButton.vue' import BaseKeyboardShortcut from '../base/BaseKeyboardShortcut.vue' import PromptText from './PromptText.vue' @@ -27,13 +27,14 @@ for (const prompt of props.command.prompts) { let defaultValue if (typeof prompt.defaultValue === 'function') { defaultValue = prompt.defaultValue(answers) - } else { + } + else { defaultValue = prompt.defaultValue } answers[prompt.field] = defaultValue } -function submit () { +function submit() { const params = props.command.getParams ? props.command.getParams({ ...getCommandContext(), @@ -48,7 +49,7 @@ function submit () { const promptComps = ref<any[]>([]) -function focusPrompt (index: number) { +function focusPrompt(index: number) { nextTick(() => { promptComps.value[index]?.focus?.() }) diff --git a/packages/histoire-app/src/app/components/command/CommandPromptsModal.vue b/packages/histoire-app/src/app/components/command/CommandPromptsModal.vue index 438fbd90..988ca97d 100644 --- a/packages/histoire-app/src/app/components/command/CommandPromptsModal.vue +++ b/packages/histoire-app/src/app/components/command/CommandPromptsModal.vue @@ -1,6 +1,7 @@ <script lang="ts" setup> import { defineAsyncComponent } from 'vue' import { useCommandStore } from '../../stores/command.js' + const CommandPrompts = defineAsyncComponent(() => import('./CommandPrompts.vue')) defineProps({ @@ -14,7 +15,7 @@ const emit = defineEmits({ close: () => true, }) -function close () { +function close() { emit('close') } diff --git a/packages/histoire-app/src/app/components/command/PromptSelect.vue b/packages/histoire-app/src/app/components/command/PromptSelect.vue index ee2e3d88..fba21fca 100644 --- a/packages/histoire-app/src/app/components/command/PromptSelect.vue +++ b/packages/histoire-app/src/app/components/command/PromptSelect.vue @@ -26,7 +26,7 @@ const model = computed({ const input = ref<HTMLInputElement>() -function focus () { +function focus() { input.value?.focus() input.value?.select() } @@ -47,7 +47,8 @@ watchEffect(async () => { if (rId === requestId) { options.value = result } - } else { + } + else { options.value = props.prompt.options } }) @@ -59,7 +60,8 @@ const formattedOptions = computed(() => { value: option, label: option, } - } else { + } + else { return option } }) @@ -73,7 +75,7 @@ const { selectPrevious, } = useSelection(formattedOptions) -function selectIndex (index: number) { +function selectIndex(index: number) { const result = formattedOptions.value[index].value if (result) { model.value = result diff --git a/packages/histoire-app/src/app/components/command/PromptText.vue b/packages/histoire-app/src/app/components/command/PromptText.vue index 12862a89..580ca047 100644 --- a/packages/histoire-app/src/app/components/command/PromptText.vue +++ b/packages/histoire-app/src/app/components/command/PromptText.vue @@ -14,12 +14,12 @@ const emit = defineEmits<{ const model = computed({ get: () => props.modelValue, - set: (value) => emit('update:modelValue', value), + set: value => emit('update:modelValue', value), }) const input = ref<HTMLInputElement>() -function focus () { +function focus() { input.value?.focus() input.value?.select() } @@ -33,7 +33,8 @@ defineExpose({ const defaultValue = computed(() => { if (typeof props.prompt.defaultValue === 'function') { return props.prompt.defaultValue(props.answers) - } else { + } + else { return props.prompt.defaultValue } }) diff --git a/packages/histoire-app/src/app/components/panel/ControlsComponentPropItem.vue b/packages/histoire-app/src/app/components/panel/ControlsComponentPropItem.vue index 8053b9f3..d2cf9c21 100644 --- a/packages/histoire-app/src/app/components/panel/ControlsComponentPropItem.vue +++ b/packages/histoire-app/src/app/components/panel/ControlsComponentPropItem.vue @@ -39,7 +39,7 @@ const model = computed({ }, }) -function reset () { +function reset() { if (props.variant.state._hPropState[props.component.index]) { // eslint-disable-next-line vue/no-mutating-props delete props.variant.state._hPropState[props.component.index][props.definition.name] diff --git a/packages/histoire-app/src/app/components/panel/ControlsComponentProps.vue b/packages/histoire-app/src/app/components/panel/ControlsComponentProps.vue index de26f6de..be39e365 100644 --- a/packages/histoire-app/src/app/components/panel/ControlsComponentProps.vue +++ b/packages/histoire-app/src/app/components/panel/ControlsComponentProps.vue @@ -1,7 +1,7 @@ <script lang="ts" setup> import type { AutoPropComponentDefinition } from '@histoire/shared' -import type { Variant } from '../../types' import { Icon } from '@iconify/vue' +import type { Variant } from '../../types' import ControlsComponentPropItem from './ControlsComponentPropItem.vue' defineProps<{ diff --git a/packages/histoire-app/src/app/components/panel/ControlsComponentState.vue b/packages/histoire-app/src/app/components/panel/ControlsComponentState.vue index aaa7e32f..eeaec255 100644 --- a/packages/histoire-app/src/app/components/panel/ControlsComponentState.vue +++ b/packages/histoire-app/src/app/components/panel/ControlsComponentState.vue @@ -9,7 +9,7 @@ const props = defineProps<{ }>() const stateKeys = computed(() => Object.keys(props.variant.state || {}) - .filter((key) => !key.startsWith('_h'))) + .filter(key => !key.startsWith('_h'))) </script> <template> diff --git a/packages/histoire-app/src/app/components/panel/PaneTabs.vue b/packages/histoire-app/src/app/components/panel/PaneTabs.vue index 297c2ec2..837b892c 100644 --- a/packages/histoire-app/src/app/components/panel/PaneTabs.vue +++ b/packages/histoire-app/src/app/components/panel/PaneTabs.vue @@ -5,8 +5,8 @@ import { useEventsStore } from '../../stores/events' import type { Story, Variant } from '../../types' import BaseOverflowMenu from '../base/BaseOverflowMenu.vue' import BaseOverflowTab from '../base/BaseOverflowTab.vue' -import { useStoryDoc } from './StoryDocs.vue' import BaseTag from '../base/BaseTag.vue' +import { useStoryDoc } from './StoryDocs.vue' const props = defineProps<{ story: Story diff --git a/packages/histoire-app/src/app/components/panel/StatePresets.vue b/packages/histoire-app/src/app/components/panel/StatePresets.vue index d8ff7b0e..f4dc09be 100644 --- a/packages/histoire-app/src/app/components/panel/StatePresets.vue +++ b/packages/histoire-app/src/app/components/panel/StatePresets.vue @@ -1,7 +1,7 @@ <script lang="ts" setup> -import { ref, computed, nextTick, onMounted } from 'vue' +import { computed, nextTick, onMounted, ref } from 'vue' import { Icon } from '@iconify/vue' -import { useStorage, onClickOutside, useTimeoutFn } from '@vueuse/core' +import { onClickOutside, useStorage, useTimeoutFn } from '@vueuse/core' import { applyState, clone, omit } from '@histoire/shared' import BaseSelect from '../base/BaseSelect.vue' import { toRawDeep } from '../../util/state' @@ -38,15 +38,16 @@ const presetsOptions = computed(() => { return options }) -function resetState () { +function resetState() { selectedOption.value = DEFAULT_ID applyState(props.variant.state, clone(defaultState)) } -function applyPreset (id) { +function applyPreset(id) { if (id === DEFAULT_ID) { resetState() - } else if (presetStates.value.has(id)) { + } + else if (presetStates.value.has(id)) { applyState(props.variant.state, clone(toRawDeep(presetStates.value.get(id).state))) } } @@ -62,7 +63,7 @@ const select = ref<HTMLInputElement>() const canEdit = computed(() => selectedOption.value !== DEFAULT_ID) const isEditing = ref(false) -async function createPreset () { +async function createPreset() { const id = (new Date()).getTime().toString() presetStates.value.set(id, { state: clone(omit(toRawDeep(props.variant.state), omitKeys)), label: 'New preset' }) @@ -77,7 +78,7 @@ const savedTimeout = useTimeoutFn(() => { savedNotif.value = false }, 1000) -async function savePreset () { +async function savePreset() { if (!canEdit.value) return const preset = presetStates.value.get(selectedOption.value) @@ -86,7 +87,9 @@ async function savePreset () { savedTimeout.start() } -function deletePreset (id) { +function deletePreset(id) { + // @TODO custom confirm modal UI + // eslint-disable-next-line no-alert if (!confirm('Are you sure you want to delete this preset?')) { return } @@ -97,7 +100,7 @@ function deletePreset (id) { presetStates.value.delete(id) } -async function startEditing () { +async function startEditing() { if (!canEdit.value) { return } @@ -107,7 +110,7 @@ async function startEditing () { input.value.select() } -function stopEditing () { +function stopEditing() { isEditing.value = false } diff --git a/packages/histoire-app/src/app/components/panel/StoryControls.vue b/packages/histoire-app/src/app/components/panel/StoryControls.vue index dc175c27..ea683880 100644 --- a/packages/histoire-app/src/app/components/panel/StoryControls.vue +++ b/packages/histoire-app/src/app/components/panel/StoryControls.vue @@ -1,5 +1,6 @@ <script lang="ts" setup> -import { computed, PropType, ref, watch } from 'vue' +import type { PropType } from 'vue' +import { computed, ref, watch } from 'vue' import { Icon } from '@iconify/vue' import GenericRenderStory from '../story/GenericRenderStory.vue' import type { Story, Variant } from '../../types' @@ -33,7 +34,6 @@ const hasInitState = computed(() => Object .entries(props.variant.state || {}) .filter(([key]) => !key.startsWith('_h')) .length > 0) - </script> <template> diff --git a/packages/histoire-app/src/app/components/panel/StoryDocs.vue b/packages/histoire-app/src/app/components/panel/StoryDocs.vue index 010e52a8..06d37b31 100644 --- a/packages/histoire-app/src/app/components/panel/StoryDocs.vue +++ b/packages/histoire-app/src/app/components/panel/StoryDocs.vue @@ -1,11 +1,15 @@ <script lang="ts"> -import { nextTick, PropType, Ref, ref, toRefs, watch, watchEffect, computed } from 'vue' -import type { Story } from '../../types' +import type { PropType, Ref } from 'vue' +import { computed, nextTick, ref, toRefs, watch, watchEffect } from 'vue' import { markdownFiles } from 'virtual:$histoire-markdown-files' +import { Icon } from '@iconify/vue' +import { useRoute, useRouter } from 'vue-router' +import type { Story } from '../../types' import { histoireConfig } from '../../util/config.js' import DevOnlyToolbarOpenInEditor from '../toolbar/DevOnlyToolbarOpenInEditor.vue' +import BaseEmpty from '../base/BaseEmpty.vue' -export function useStoryDoc (story: Ref<Story>) { +export function useStoryDoc(story: Ref<Story>) { const renderedDoc = ref('') watchEffect(async () => { @@ -23,12 +27,15 @@ export function useStoryDoc (story: Ref<Story>) { if (comp) { if (comp.__asyncResolved) { comp = comp.__asyncResolved - } else if (comp.__asyncLoader) { + } + else if (comp.__asyncLoader) { comp = await comp.__asyncLoader() - } else if (typeof comp === 'function') { + } + else if (typeof comp === 'function') { try { comp = await comp() - } catch (e) { + } + catch (e) { // Noop // Could be a class that requires `new com()` } @@ -47,10 +54,6 @@ export function useStoryDoc (story: Ref<Story>) { </script> <script lang="ts" setup> -import { Icon } from '@iconify/vue' -import { useRoute, useRouter } from 'vue-router' -import BaseEmpty from '../base/BaseEmpty.vue' - const props = defineProps({ story: { type: Object as PropType<Story>, @@ -64,7 +67,7 @@ const props = defineProps({ }) const emit = defineEmits<{ - (e: 'scroll-top'): void + (e: 'scrollTop'): void }>() const { story } = toRefs(props) @@ -78,16 +81,16 @@ const router = useRouter() // matter and is only passed to support same-host hrefs. const fakeHost = `http://a.com` -function onClick (e: MouseEvent) { +function onClick(e: MouseEvent) { const link = (e.target as Element).closest('a') if ( - link && - link.getAttribute('data-route') && - !e.ctrlKey && - !e.shiftKey && - !e.altKey && - !e.metaKey && - link.target !== `_blank` + link + && link.getAttribute('data-route') + && !e.ctrlKey + && !e.shiftKey + && !e.altKey + && !e.metaKey + && link.target !== `_blank` ) { e.preventDefault() const url = new URL(link.href, fakeHost) @@ -98,20 +101,21 @@ function onClick (e: MouseEvent) { // Handle URL anchor -function getHash () { +function getHash() { const hash = location.hash if (histoireConfig.routerMode === 'hash') { const index = hash.indexOf('#', 1) if (index !== -1) { return hash.slice(index) - } else { + } + else { return undefined } } return hash } -async function scrollToAnchor () { +async function scrollToAnchor() { await nextTick() const hash = getHash() if (hash) { @@ -121,7 +125,7 @@ async function scrollToAnchor () { return } } - emit('scroll-top') + emit('scrollTop') } watch(renderedDoc, () => { @@ -135,7 +139,7 @@ watch(renderedDoc, () => { const renderedEl = ref<HTMLElement>() const route = useRoute() -async function patchAnchorLinks () { +async function patchAnchorLinks() { await nextTick() if (histoireConfig.routerMode === 'hash' && renderedEl.value) { const links = renderedEl.value.querySelectorAll('a.header-anchor') diff --git a/packages/histoire-app/src/app/components/panel/StoryEvent.vue b/packages/histoire-app/src/app/components/panel/StoryEvent.vue index 98eb0874..8e0668e3 100644 --- a/packages/histoire-app/src/app/components/panel/StoryEvent.vue +++ b/packages/histoire-app/src/app/components/panel/StoryEvent.vue @@ -1,6 +1,6 @@ <script lang="ts" setup> import { computed } from 'vue' -import { HstEvent } from '../../stores/events' +import type { HstEvent } from '../../stores/events' const props = defineProps<{ event: HstEvent @@ -11,7 +11,7 @@ const formattedArgument = computed(() => { case 'string': return `"${props.event.argument}"` case 'object': - return `{ ${Object.keys(props.event.argument).map((key) => `${key}: ${props.event.argument[key]}`).join(', ')} }` + return `{ ${Object.keys(props.event.argument).map(key => `${key}: ${props.event.argument[key]}`).join(', ')} }` default: return props.event.argument } diff --git a/packages/histoire-app/src/app/components/panel/StoryEvents.vue b/packages/histoire-app/src/app/components/panel/StoryEvents.vue index 9dc35261..6c2e8fbb 100644 --- a/packages/histoire-app/src/app/components/panel/StoryEvents.vue +++ b/packages/histoire-app/src/app/components/panel/StoryEvents.vue @@ -1,5 +1,5 @@ <script lang="ts" setup> -import { ref, computed, watch, onMounted, nextTick } from 'vue' +import { computed, nextTick, onMounted, ref, watch } from 'vue' import { Icon } from '@iconify/vue' import BaseEmpty from '../base/BaseEmpty.vue' import { useEventsStore } from '../../stores/events' @@ -12,7 +12,7 @@ const hasEvents = computed(() => eventsStore.events.length) onMounted(resetUnseen) watch(() => eventsStore.unseen, resetUnseen) -async function resetUnseen () { +async function resetUnseen() { if (eventsStore.unseen > 0) { eventsStore.unseen = 0 } diff --git a/packages/histoire-app/src/app/components/panel/StorySourceCode.vue b/packages/histoire-app/src/app/components/panel/StorySourceCode.vue index b3787264..6d54db3a 100644 --- a/packages/histoire-app/src/app/components/panel/StorySourceCode.vue +++ b/packages/histoire-app/src/app/components/panel/StorySourceCode.vue @@ -1,11 +1,12 @@ <script lang="ts" setup> import { computed, markRaw, nextTick, onMounted, ref, shallowRef, watch, watchEffect } from 'vue' import { Icon } from '@iconify/vue' -import { getHighlighter, Highlighter } from 'shiki-es' +import type { Highlighter } from 'shiki-es' +import { getHighlighter } from 'shiki-es' import { HstCopyIcon } from '@histoire/controls' import { unindent } from '@histoire/shared' import { clientSupportPlugins } from 'virtual:$histoire-support-plugins-client' -import type { Variant, Story } from '../../types' +import type { Story, Variant } from '../../types' import { isDark } from '../../util/dark' import BaseEmpty from '../base/BaseEmpty.vue' @@ -36,15 +37,18 @@ watch(() => [props.variant, generateSourceCodeFn.value], async () => { try { if (props.variant.source) { dynamicSourceCode.value = props.variant.source - } else if (props.variant.slots?.().source) { + } + else if (props.variant.slots?.().source) { const source = props.variant.slots?.().source()[0].children if (source) { dynamicSourceCode.value = await unindent(source) } - } else { + } + else { dynamicSourceCode.value = await generateSourceCodeFn.value(props.variant) } - } catch (e) { + } + catch (e) { console.error(e) error.value = e.message } @@ -113,7 +117,7 @@ watch(() => props.variant, () => { const scroller = ref<HTMLElement>() -function onScroll (event) { +function onScroll(event) { if (sourceHtml.value) { lastScroll = event.target.scrollTop } diff --git a/packages/histoire-app/src/app/components/search/SearchItem.vue b/packages/histoire-app/src/app/components/search/SearchItem.vue index 9d1b750b..29f21e82 100644 --- a/packages/histoire-app/src/app/components/search/SearchItem.vue +++ b/packages/histoire-app/src/app/components/search/SearchItem.vue @@ -1,7 +1,8 @@ <script lang="ts" setup> -import { PropType, ref, toRefs } from 'vue' +import type { PropType } from 'vue' +import { ref, toRefs } from 'vue' import { useRouter } from 'vue-router' -import { SearchResult } from '../../types' +import type { SearchResult } from '../../types' import { onKeyboardShortcut } from '../../util/keyboard' import { useScrollOnActive } from '../../util/scroll' import BaseListItemLink from '../base/BaseListItemLink.vue' @@ -36,7 +37,7 @@ onKeyboardShortcut(['enter'], () => { action() }) -function action (fromClick = false) { +function action(fromClick = false) { if ('route' in props.result && !fromClick) { router.push(props.result.route) } diff --git a/packages/histoire-app/src/app/components/search/SearchItemContent.vue b/packages/histoire-app/src/app/components/search/SearchItemContent.vue index edf81ce9..8c1ca23d 100644 --- a/packages/histoire-app/src/app/components/search/SearchItemContent.vue +++ b/packages/histoire-app/src/app/components/search/SearchItemContent.vue @@ -27,15 +27,15 @@ const kindLabels = { :class="[ !selected ? [ result.iconColor - ?'bind-icon-color' + ? 'bind-icon-color' : { 'htw-text-primary-500': result.kind === 'story', 'htw-text-gray-500': result.kind === 'variant', - } + }, ] : [], { 'colorize-black': selected, - } + }, ]" /> <div class="htw-flex-1"> diff --git a/packages/histoire-app/src/app/components/search/SearchModal.vue b/packages/histoire-app/src/app/components/search/SearchModal.vue index c21a2d24..c30de307 100644 --- a/packages/histoire-app/src/app/components/search/SearchModal.vue +++ b/packages/histoire-app/src/app/components/search/SearchModal.vue @@ -1,6 +1,7 @@ <script lang="ts" setup> import { defineAsyncComponent } from 'vue' import SearchLoading from './SearchLoading.vue' + const SearchPane = defineAsyncComponent({ loader: () => import('./SearchPane.vue'), loadingComponent: SearchLoading, @@ -18,7 +19,7 @@ const emit = defineEmits({ close: () => true, }) -function close () { +function close() { emit('close') } </script> diff --git a/packages/histoire-app/src/app/components/search/SearchPane.vue b/packages/histoire-app/src/app/components/search/SearchPane.vue index 07e60408..3d0336b1 100644 --- a/packages/histoire-app/src/app/components/search/SearchPane.vue +++ b/packages/histoire-app/src/app/components/search/SearchPane.vue @@ -1,5 +1,5 @@ <script lang="ts" setup> -import { useFocus, useDebounce } from '@vueuse/core' +import { useDebounce, useFocus } from '@vueuse/core' import { computed, ref, watch } from 'vue' import { Icon } from '@iconify/vue' import * as flexsearch from 'flexsearch' @@ -10,12 +10,12 @@ import { registeredCommands } from 'virtual:$histoire-commands' import { useStoryStore } from '../../stores/story' import BaseEmpty from '../base/BaseEmpty.vue' import type { SearchResult, SearchResultType, Story, Variant } from '../../types' -import SearchItem from './SearchItem.vue' -import { searchData, onUpdate } from './search-title-data' -import type { SearchData } from './types' import { builtinCommands, getCommandContext } from '../../util/commands.js' import { useCommandStore } from '../../stores/command.js' import { useSelection } from '../../util/select.js' +import SearchItem from './SearchItem.vue' +import { onUpdate, searchData } from './search-title-data' +import type { SearchData } from './types' const DocSearchData = () => import('./search-docs-data') @@ -30,7 +30,7 @@ const emit = defineEmits({ close: () => true, }) -function close () { +function close() { emit('close') } @@ -41,7 +41,7 @@ const { focused } = useFocus(input, { initialValue: true, }) -watch(() => props.shown, value => { +watch(() => props.shown, (value) => { if (value) { requestAnimationFrame(() => { focused.value = true @@ -60,7 +60,7 @@ const storyStore = useStoryStore() let titleSearchIndex: flexsearch.Document<any, any> let titleIdMap: SearchData['idMap'] -function createIndex () { +function createIndex() { return new flexsearch.Document({ preset: 'match', document: { @@ -76,7 +76,7 @@ function createIndex () { }) } -async function loadSearchIndex (data: SearchData) { +async function loadSearchIndex(data: SearchData) { titleSearchIndex = createIndex() for (const key of Object.keys(data.index)) { @@ -88,15 +88,15 @@ async function loadSearchIndex (data: SearchData) { loadSearchIndex(searchData) // Handle HMR -onUpdate(searchData => { +onUpdate((searchData) => { loadSearchIndex(searchData) }) let docSearchIndex: flexsearch.Document<any, any> let docIdMap: SearchData['idMap'] -async function loadDocSearchIndex () { - async function load (data: SearchData) { +async function loadDocSearchIndex() { + async function load(data: SearchData) { docSearchIndex = createIndex() for (const key of Object.keys(data.index)) { @@ -114,7 +114,7 @@ async function loadDocSearchIndex () { load(searchDataModule.searchData) // Handle HMR - searchDataModule.onUpdate(searchData => { + searchDataModule.onUpdate((searchData) => { load(searchData) }) } @@ -125,7 +125,7 @@ loadDocSearchIndex() const titleResults = ref<SearchResult[]>([]) -watch(rateLimitedSearch, async value => { +watch(rateLimitedSearch, async (value) => { const list: SearchResult[] = [] const raw = await titleSearchIndex.search(value) let rank = 0 @@ -155,7 +155,7 @@ watch(rateLimitedSearch, async value => { const docsResults = ref<SearchResult[]>([]) -async function searchOnDocField (query: string) { +async function searchOnDocField(query: string) { if (docSearchIndex) { const list: SearchResult[] = [] const raw = await docSearchIndex.search(query) @@ -179,7 +179,7 @@ async function searchOnDocField (query: string) { watch(rateLimitedSearch, searchOnDocField) -function storyResultFactory (story: Story, rank: number, type: SearchResultType = 'title'): SearchResult { +function storyResultFactory(story: Story, rank: number, type: SearchResultType = 'title'): SearchResult { return { kind: 'story', rank, @@ -202,7 +202,7 @@ function storyResultFactory (story: Story, rank: number, type: SearchResultType } } -function variantResultFactory (story: Story, variant: Variant, rank: number, type: SearchResultType = 'title'): SearchResult { +function variantResultFactory(story: Story, variant: Variant, rank: number, type: SearchResultType = 'title'): SearchResult { return { kind: 'variant', rank, @@ -240,14 +240,14 @@ const commandResults = computed(() => { return allCommands .filter(command => !command.showIf || command.showIf(commandCtx)) .filter(command => command.label.toLowerCase().includes(searchText) || command.searchText?.toLowerCase().includes(searchText)) - .map((command) => commandResultFactory(command, 0)) + .map(command => commandResultFactory(command, 0)) } return [] }) const commandStore = useCommandStore() -function commandResultFactory (command: ClientCommand, rank: number): SearchResult { +function commandResultFactory(command: ClientCommand, rank: number): SearchResult { return { kind: 'command', rank, diff --git a/packages/histoire-app/src/app/components/search/search-docs-data.ts b/packages/histoire-app/src/app/components/search/search-docs-data.ts index 45e6ab14..6d2e1a4e 100644 --- a/packages/histoire-app/src/app/components/search/search-docs-data.ts +++ b/packages/histoire-app/src/app/components/search/search-docs-data.ts @@ -1,9 +1,9 @@ import { markRaw } from 'vue' -import { searchData as _searchData, onUpdate as _onUpdate } from 'virtual:$histoire-search-docs-data' +import { onUpdate as _onUpdate, searchData as _searchData } from 'virtual:$histoire-search-docs-data' import type { SearchData } from './types.js' export const searchData: SearchData = markRaw(_searchData) -export function onUpdate (cb: (data: SearchData) => unknown) { +export function onUpdate(cb: (data: SearchData) => unknown) { _onUpdate(cb) } diff --git a/packages/histoire-app/src/app/components/search/search-title-data.ts b/packages/histoire-app/src/app/components/search/search-title-data.ts index d72a482e..0a24d1d3 100644 --- a/packages/histoire-app/src/app/components/search/search-title-data.ts +++ b/packages/histoire-app/src/app/components/search/search-title-data.ts @@ -1,9 +1,9 @@ import { markRaw } from 'vue' -import { searchData as _searchData, onUpdate as _onUpdate } from 'virtual:$histoire-search-title-data' +import { onUpdate as _onUpdate, searchData as _searchData } from 'virtual:$histoire-search-title-data' import type { SearchData } from './types.js' export const searchData: SearchData = markRaw(_searchData) -export function onUpdate (cb: (data: SearchData) => unknown) { +export function onUpdate(cb: (data: SearchData) => unknown) { _onUpdate(cb) } diff --git a/packages/histoire-app/src/app/components/story/GenericMountStory.vue b/packages/histoire-app/src/app/components/story/GenericMountStory.vue index fee7be2b..bccd2eea 100644 --- a/packages/histoire-app/src/app/components/story/GenericMountStory.vue +++ b/packages/histoire-app/src/app/components/story/GenericMountStory.vue @@ -6,7 +6,7 @@ export default { <script lang="ts" setup> import { clientSupportPlugins } from 'virtual:$histoire-support-plugins-client' -import { ref, watchEffect, markRaw } from 'vue' +import { markRaw, ref, watchEffect } from 'vue' import type { Story } from '../../types' const props = defineProps<{ diff --git a/packages/histoire-app/src/app/components/story/GenericRenderStory.vue b/packages/histoire-app/src/app/components/story/GenericRenderStory.vue index 8945d7c7..a0ff7428 100644 --- a/packages/histoire-app/src/app/components/story/GenericRenderStory.vue +++ b/packages/histoire-app/src/app/components/story/GenericRenderStory.vue @@ -6,7 +6,7 @@ export default { <script lang="ts" setup> import { clientSupportPlugins } from 'virtual:$histoire-support-plugins-client' -import { ref, watchEffect, markRaw } from 'vue' +import { markRaw, ref, watchEffect } from 'vue' import type { Story } from '../../types' const props = defineProps<{ @@ -21,7 +21,8 @@ watchEffect(async () => { try { const pluginModule = await clientPlugin() mountComponent.value = markRaw(pluginModule.RenderStory) - } catch (e) { + } + catch (e) { console.error(e) throw e } diff --git a/packages/histoire-app/src/app/components/story/StoryResponsivePreview.vue b/packages/histoire-app/src/app/components/story/StoryResponsivePreview.vue index f90a5d83..ec2e09d2 100644 --- a/packages/histoire-app/src/app/components/story/StoryResponsivePreview.vue +++ b/packages/histoire-app/src/app/components/story/StoryResponsivePreview.vue @@ -1,12 +1,13 @@ <script lang="ts" setup> -import { computed, onUnmounted, Ref, ref } from 'vue' +import type { Ref } from 'vue' +import { computed, onUnmounted, ref } from 'vue' import { useEventListener } from '@vueuse/core' import { Icon } from '@iconify/vue' +import { VTooltip as vTooltip } from 'floating-vue' import HatchedPattern from '../misc/HatchedPattern.vue' import CheckerboardPattern from '../misc/CheckerboardPattern.vue' import { usePreviewSettingsStore } from '../../stores/preview-settings' -import { Variant } from '../../types' -import { VTooltip as vTooltip } from 'floating-vue' +import type { Variant } from '../../types' const props = defineProps<{ variant: Variant @@ -23,7 +24,7 @@ onUnmounted(() => { onUnmountedCleanupFns.forEach(fn => fn()) }) -function addWindowListener (event: string, listener: (event: any) => unknown) { +function addWindowListener(event: string, listener: (event: any) => unknown) { window.addEventListener(event, listener) const removeListener = () => window.removeEventListener(event, listener) onUnmountedCleanupFns.push(removeListener) @@ -33,8 +34,8 @@ function addWindowListener (event: string, listener: (event: any) => unknown) { } } -function useDragger (el: Ref<HTMLDivElement>, value: Ref<number>, min: number, max: number, axis: 'x' | 'y') { - function onMouseDown (event: MouseEvent) { +function useDragger(el: Ref<HTMLDivElement>, value: Ref<number>, min: number, max: number, axis: 'x' | 'y') { + function onMouseDown(event: MouseEvent) { event.preventDefault() event.stopPropagation() const start = axis === 'x' ? event.clientX : event.clientY @@ -46,7 +47,7 @@ function useDragger (el: Ref<HTMLDivElement>, value: Ref<number>, min: number, m addWindowListener('mouseup', onMouseUp), ] - function onMouseMove (event: MouseEvent) { + function onMouseMove(event: MouseEvent) { const snapTarget = (axis === 'x' ? previewWrapper.value.clientWidth : previewWrapper.value.clientHeight) const delta = (axis === 'x' ? event.clientX : event.clientY) - start value.value = Math.max(min, Math.min(max, startValue + delta)) @@ -56,14 +57,14 @@ function useDragger (el: Ref<HTMLDivElement>, value: Ref<number>, min: number, m } } - function onMouseUp () { + function onMouseUp() { removeListeners.forEach(fn => fn()) resizing.value = false } } useEventListener(el, 'mousedown', onMouseDown) - function onTouchStart (event: TouchEvent) { + function onTouchStart(event: TouchEvent) { event.preventDefault() event.stopPropagation() const start = axis === 'x' ? event.touches[0].clientX : event.touches[0].clientY @@ -76,12 +77,12 @@ function useDragger (el: Ref<HTMLDivElement>, value: Ref<number>, min: number, m addWindowListener('touchcancel', onTouchEnd), ] - function onTouchMove (event: TouchEvent) { + function onTouchMove(event: TouchEvent) { const delta = (axis === 'x' ? event.touches[0].clientX : event.touches[0].clientY) - start value.value = Math.max(min, Math.min(max, startValue + delta)) } - function onTouchEnd () { + function onTouchEnd() { removeListeners.forEach(fn => fn()) resizing.value = false } @@ -117,7 +118,7 @@ const finalHeight = computed(() => settings.rotate ? settings.responsiveWidth : const isResponsiveEnabled = computed(() => !props.variant.responsiveDisabled) -const sizeTooltip = computed(() => (responsiveWidth.value ?? 'Auto') + ' × ' + (responsiveHeight.value ?? 'Auto')) +const sizeTooltip = computed(() => `${responsiveWidth.value ?? 'Auto'} × ${responsiveHeight.value ?? 'Auto'}`) </script> <template> @@ -140,7 +141,7 @@ const sizeTooltip = computed(() => (responsiveWidth.value ?? 'Auto') + ' × ' + :class="isResponsiveEnabled ? { 'htw-w-fit': !!finalWidth, 'htw-h-fit': !!finalHeight, - 'htw-h-full': !finalHeight + 'htw-h-full': !finalHeight, } : 'htw-h-full'" > <div diff --git a/packages/histoire-app/src/app/components/story/StoryVariantGrid.vue b/packages/histoire-app/src/app/components/story/StoryVariantGrid.vue index d015fdc7..3312c1f3 100644 --- a/packages/histoire-app/src/app/components/story/StoryVariantGrid.vue +++ b/packages/histoire-app/src/app/components/story/StoryVariantGrid.vue @@ -3,10 +3,10 @@ import { useResizeObserver } from '@vueuse/core' import { computed, onMounted, ref, watch } from 'vue' import { useStoryStore } from '../../stores/story' import { isMobile } from '../../util/responsive' -import StoryVariantGridItem from './StoryVariantGridItem.vue' import ToolbarBackground from '../toolbar/ToolbarBackground.vue' import ToolbarTextDirection from '../toolbar/ToolbarTextDirection.vue' import DevOnlyToolbarOpenInEditor from '../toolbar/DevOnlyToolbarOpenInEditor.vue' +import StoryVariantGridItem from './StoryVariantGridItem.vue' const storyStore = useStoryStore() @@ -22,7 +22,7 @@ const gridTemplateWidth = computed(() => { } if (typeof layoutWidth === 'number') { - return layoutWidth + 'px' + return `${layoutWidth}px` } return layoutWidth @@ -44,7 +44,7 @@ useResizeObserver(el, () => { updateSize() }) -function updateMaxCount () { +function updateMaxCount() { if (!maxItemHeight.value) return const width = el.value!.clientWidth - margin * 2 @@ -74,7 +74,7 @@ function updateMaxCount () { } } -function onItemResize (w: number, h: number) { +function onItemResize(w: number, h: number) { itemWidth.value = w if (maxItemHeight.value < h) { maxItemHeight.value = h @@ -93,16 +93,17 @@ const gridEl = ref<HTMLDivElement>(null) const gridColumnWidth = ref(1) const viewWidth = ref(1) -function updateSize () { +function updateSize() { if (!el.value) return viewWidth.value = el.value.clientWidth if (!gridEl.value) return if (gridTemplateWidth.value.endsWith('%')) { - gridColumnWidth.value = viewWidth.value * parseInt(gridTemplateWidth.value) / 100 - gap - } else { - gridColumnWidth.value = parseInt(gridTemplateWidth.value) + gridColumnWidth.value = viewWidth.value * Number.parseInt(gridTemplateWidth.value) / 100 - gap + } + else { + gridColumnWidth.value = Number.parseInt(gridTemplateWidth.value) } } diff --git a/packages/histoire-app/src/app/components/story/StoryVariantGridItem.vue b/packages/histoire-app/src/app/components/story/StoryVariantGridItem.vue index 8302c306..70e32879 100644 --- a/packages/histoire-app/src/app/components/story/StoryVariantGridItem.vue +++ b/packages/histoire-app/src/app/components/story/StoryVariantGridItem.vue @@ -1,5 +1,6 @@ <script lang="ts" setup> -import { computed, PropType, ref, toRefs } from 'vue' +import type { PropType } from 'vue' +import { computed, ref, toRefs } from 'vue' import { Icon } from '@iconify/vue' import { useRouter } from 'vue-router' import { useResizeObserver } from '@vueuse/core' @@ -12,9 +13,9 @@ import { getContrastColor } from '../../util/preview-settings' import { histoireConfig } from '../../util/config' import { isDark } from '../../util/dark' import { getSourceCode } from '../../util/docs' -import GenericRenderStory from './GenericRenderStory.vue' import ToolbarNewTab from '../toolbar/ToolbarNewTab.vue' import CheckerboardPattern from '../misc/CheckerboardPattern.vue' +import GenericRenderStory from './GenericRenderStory.vue' const props = defineProps({ variant: { @@ -29,8 +30,7 @@ const props = defineProps({ }) const emit = defineEmits({ - // eslint-disable-next-line @typescript-eslint/no-unused-vars - resize: (width: number, height: number) => true, + resize: (_width: number, _height: number) => true, }) const { variant } = toRefs(props) @@ -39,7 +39,7 @@ const { isActive, targetRoute } = useCurrentVariantRoute(variant) Object.assign(props.variant, { previewReady: false, }) -function onReady () { +function onReady() { Object.assign(props.variant, { previewReady: true, }) @@ -47,7 +47,7 @@ function onReady () { const router = useRouter() -function selectVariant () { +function selectVariant() { router.push(targetRoute.value) } @@ -134,7 +134,7 @@ const autoApplyContrastColor = computed(() => !!histoireConfig.autoApplyContrast class="htw-relative htw-h-full" :style="{ '--histoire-contrast-color': contrastColor, - color: autoApplyContrastColor ? contrastColor : undefined, + 'color': autoApplyContrastColor ? contrastColor : undefined, }" > <GenericRenderStory diff --git a/packages/histoire-app/src/app/components/story/StoryVariantListItem.vue b/packages/histoire-app/src/app/components/story/StoryVariantListItem.vue index a8fcd903..1436df7e 100644 --- a/packages/histoire-app/src/app/components/story/StoryVariantListItem.vue +++ b/packages/histoire-app/src/app/components/story/StoryVariantListItem.vue @@ -1,9 +1,10 @@ <script lang="ts" setup> -import { PropType, ref, toRefs } from 'vue' +import type { PropType } from 'vue' +import { ref, toRefs } from 'vue' +import { Icon } from '@iconify/vue' import { useCurrentVariantRoute } from '../../util/variant' import type { Variant } from '../../types' import BaseListItemLink from '../base/BaseListItemLink.vue' -import { Icon } from '@iconify/vue' import { useScrollOnActive } from '../../util/scroll' const props = defineProps({ diff --git a/packages/histoire-app/src/app/components/story/StoryVariantSingle.vue b/packages/histoire-app/src/app/components/story/StoryVariantSingle.vue index 9b58a16e..32e6056a 100644 --- a/packages/histoire-app/src/app/components/story/StoryVariantSingle.vue +++ b/packages/histoire-app/src/app/components/story/StoryVariantSingle.vue @@ -1,14 +1,14 @@ <script lang="ts" setup> import { computed } from 'vue' -import { useStoryStore } from '../../stores/story' import { Icon } from '@iconify/vue' +import { useStoryStore } from '../../stores/story' import { isMobile } from '../../util/responsive' import BaseSplitPane from '../base/BaseSplitPane.vue' import StoryVariantListItem from './StoryVariantListItem.vue' import StoryVariantSingleView from './StoryVariantSingleView.vue' defineEmits({ - 'open-variant-menu': () => true, + openVariantMenu: () => true, }) const storyStore = useStoryStore() @@ -35,7 +35,7 @@ const variant = computed(() => storyStore.currentVariant) > <a class="htw-px-6 htw-h-12 hover:htw-text-primary-500 dark:hover:htw-text-primary-400 htw-cursor-pointer htw-flex htw-gap-2 htw-flex-wrap htw-w-full htw-items-center htw-flex-none" - @click="$emit('open-variant-menu')" + @click="$emit('openVariantMenu')" > <template v-if="variant"> <Icon diff --git a/packages/histoire-app/src/app/components/story/StoryVariantSinglePreviewNative.vue b/packages/histoire-app/src/app/components/story/StoryVariantSinglePreviewNative.vue index 445324f0..8d4c425c 100644 --- a/packages/histoire-app/src/app/components/story/StoryVariantSinglePreviewNative.vue +++ b/packages/histoire-app/src/app/components/story/StoryVariantSinglePreviewNative.vue @@ -17,7 +17,7 @@ Object.assign(props.variant, { previewReady: false, }) -function onReady () { +function onReady() { Object.assign(props.variant, { previewReady: true, }) @@ -43,7 +43,7 @@ const autoApplyContrastColor = computed(() => !!histoireConfig.autoApplyContrast } : { width: '100%', height: '100%' }, { '--histoire-contrast-color': contrastColor, - color: autoApplyContrastColor ? contrastColor : undefined, + 'color': autoApplyContrastColor ? contrastColor : undefined, }, ]" class="htw-relative" diff --git a/packages/histoire-app/src/app/components/story/StoryVariantSinglePreviewRemote.vue b/packages/histoire-app/src/app/components/story/StoryVariantSinglePreviewRemote.vue index 4d48ffd7..d487fdf4 100644 --- a/packages/histoire-app/src/app/components/story/StoryVariantSinglePreviewRemote.vue +++ b/packages/histoire-app/src/app/components/story/StoryVariantSinglePreviewRemote.vue @@ -2,13 +2,14 @@ import { computed, ref, toRaw, watch } from 'vue' import { useEventListener } from '@vueuse/core' import { applyState } from '@histoire/shared' -import { STATE_SYNC, PREVIEW_SETTINGS_SYNC, SANDBOX_READY, EVENT_SEND } from '../../util/const' +import { EVENT_SEND, PREVIEW_SETTINGS_SYNC, SANDBOX_READY, STATE_SYNC } from '../../util/const' import type { Story, Variant } from '../../types' import { getSandboxUrl } from '../../util/sandbox' import { usePreviewSettingsStore } from '../../stores/preview-settings' -import { HstEvent, useEventsStore } from '../../stores/events' -import StoryResponsivePreview from './StoryResponsivePreview.vue' +import type { HstEvent } from '../../stores/events' +import { useEventsStore } from '../../stores/events' import { toRawDeep } from '../../util/state' +import StoryResponsivePreview from './StoryResponsivePreview.vue' const props = defineProps<{ story: Story @@ -21,7 +22,7 @@ const settings = usePreviewSettingsStore().currentSettings const iframe = ref<HTMLIFrameElement>() -function syncState () { +function syncState() { if (iframe.value && props.variant.previewReady) { iframe.value.contentWindow.postMessage({ type: STATE_SYNC, @@ -61,17 +62,17 @@ useEventListener(window, 'message', (event) => { } }) -function updateVariantState (state: any) { +function updateVariantState(state: any) { synced = true applyState(props.variant.state, state) } -function logEvent (event: HstEvent) { +function logEvent(event: HstEvent) { const eventsStore = useEventsStore() eventsStore.addEvent(event) } -function setPreviewReady () { +function setPreviewReady() { Object.assign(props.variant, { previewReady: true, }) @@ -92,7 +93,7 @@ watch(sandboxUrl, () => { // Settings -function syncSettings () { +function syncSettings() { if (iframe.value) { iframe.value.contentWindow.postMessage({ type: PREVIEW_SETTINGS_SYNC, @@ -110,12 +111,11 @@ watch(() => settings, () => { // Iframe load -function onIframeLoad () { +function onIframeLoad() { isIframeLoaded.value = true syncState() syncSettings() } - </script> <template> diff --git a/packages/histoire-app/src/app/components/story/StoryView.vue b/packages/histoire-app/src/app/components/story/StoryView.vue index 63c3cb7b..ad3ed315 100644 --- a/packages/histoire-app/src/app/components/story/StoryView.vue +++ b/packages/histoire-app/src/app/components/story/StoryView.vue @@ -7,9 +7,9 @@ import { useStoryStore } from '../../stores/story' import BaseSplitPane from '../base/BaseSplitPane.vue' import BaseEmpty from '../base/BaseEmpty.vue' import { isMobile } from '../../util/responsive' -import StoryViewer from './StoryViewer.vue' import StorySidePanel from '../panel/StorySidePanel.vue' import StoryDocs from '../panel/StoryDocs.vue' +import StoryViewer from './StoryViewer.vue' const storyStore = useStoryStore() @@ -18,7 +18,7 @@ const route = useRoute() // Restore variant selection -watch(() => storyStore.currentVariant, value => { +watch(() => storyStore.currentVariant, (value) => { if (value) { storyStore.currentStory.lastSelectedVariant = value } @@ -41,7 +41,7 @@ watch(() => [storyStore.currentStory, storyStore.currentVariant], () => { immediate: true, }) -function setVariant (variantId: string) { +function setVariant(variantId: string) { router.replace({ ...route, query: { @@ -55,7 +55,7 @@ function setVariant (variantId: string) { const docsOnlyScroller = ref<HTMLElement>(null) -function scrollDocsToTop () { +function scrollDocsToTop() { docsOnlyScroller.value?.scrollTo(0, 0) } </script> diff --git a/packages/histoire-app/src/app/components/story/StoryViewer.vue b/packages/histoire-app/src/app/components/story/StoryViewer.vue index cf4df1b0..c969525e 100644 --- a/packages/histoire-app/src/app/components/story/StoryViewer.vue +++ b/packages/histoire-app/src/app/components/story/StoryViewer.vue @@ -1,8 +1,8 @@ <script lang="ts" setup> import { computed, ref, watch } from 'vue' import { useStoryStore } from '../../stores/story' -import StoryVariantListItem from './StoryVariantListItem.vue' import MobileOverlay from '../app/MobileOverlay.vue' +import StoryVariantListItem from './StoryVariantListItem.vue' import StoryVariantGrid from './StoryVariantGrid.vue' import StoryVariantSingle from './StoryVariantSingle.vue' @@ -12,14 +12,13 @@ const variant = computed(() => storyStore.currentVariant) const isMenuOpened = ref(false) -function closeMenu () { +function closeMenu() { isMenuOpened.value = false } watch(variant, () => { isMenuOpened.value = false }) - </script> <template> diff --git a/packages/histoire-app/src/app/components/toolbar/ToolbarNewTab.vue b/packages/histoire-app/src/app/components/toolbar/ToolbarNewTab.vue index fb5bba4f..862240d9 100644 --- a/packages/histoire-app/src/app/components/toolbar/ToolbarNewTab.vue +++ b/packages/histoire-app/src/app/components/toolbar/ToolbarNewTab.vue @@ -1,7 +1,7 @@ <script lang="ts" setup> import { Icon } from '@iconify/vue' -import type { Story, Variant } from '../../types' import { computed } from 'vue' +import type { Story, Variant } from '../../types' import { getSandboxUrl } from '../../util/sandbox' const props = defineProps<{ diff --git a/packages/histoire-app/src/app/components/tree/StoryGroup.vue b/packages/histoire-app/src/app/components/tree/StoryGroup.vue index f61b3d46..8f2a012a 100644 --- a/packages/histoire-app/src/app/components/tree/StoryGroup.vue +++ b/packages/histoire-app/src/app/components/tree/StoryGroup.vue @@ -1,10 +1,10 @@ <script lang="ts" setup> -import type { Story, TreeGroup } from '../../types' -import StoryListItem from './StoryListItem.vue' -import StoryListFolder from './StoryListFolder.vue' import { Icon } from '@iconify/vue' import { computed, withDefaults } from 'vue' +import type { Story, TreeGroup } from '../../types' import { useFolderStore } from '../../stores/folder' +import StoryListItem from './StoryListItem.vue' +import StoryListFolder from './StoryListFolder.vue' const props = withDefaults(defineProps<{ path?: Array<string> @@ -19,7 +19,7 @@ const folderStore = useFolderStore() const folderPath = computed(() => [...props.path, props.group.title]) const isFolderOpen = computed(() => folderStore.isFolderOpened(folderPath.value, true)) -function toggleOpen () { +function toggleOpen() { folderStore.toggleFolder(folderPath.value, false) } </script> diff --git a/packages/histoire-app/src/app/components/tree/StoryList.vue b/packages/histoire-app/src/app/components/tree/StoryList.vue index aeac2cb7..0524a6f9 100644 --- a/packages/histoire-app/src/app/components/tree/StoryList.vue +++ b/packages/histoire-app/src/app/components/tree/StoryList.vue @@ -1,5 +1,5 @@ <script lang="ts" setup> -import type { Story, Tree, TreeGroup, TreeFolder, TreeLeaf } from '../../types' +import type { Story, Tree, TreeFolder, TreeGroup, TreeLeaf } from '../../types' import StoryListItem from './StoryListItem.vue' import StoryListFolder from './StoryListFolder.vue' import StoryGroup from './StoryGroup.vue' diff --git a/packages/histoire-app/src/app/components/tree/StoryListFolder.vue b/packages/histoire-app/src/app/components/tree/StoryListFolder.vue index d91e1c35..5b746ec2 100644 --- a/packages/histoire-app/src/app/components/tree/StoryListFolder.vue +++ b/packages/histoire-app/src/app/components/tree/StoryListFolder.vue @@ -1,9 +1,9 @@ <script lang="ts" setup> -import type { Story, TreeFolder, TreeLeaf } from '../../types' -import StoryListItem from './StoryListItem.vue' import { Icon } from '@iconify/vue' import { computed, withDefaults } from 'vue' +import type { Story, TreeFolder, TreeLeaf } from '../../types' import { useFolderStore } from '../../stores/folder' +import StoryListItem from './StoryListItem.vue' const props = withDefaults(defineProps<{ path?: Array<string> @@ -20,12 +20,12 @@ const folderStore = useFolderStore() const folderPath = computed(() => [...props.path, props.folder.title]) const isFolderOpen = computed(() => folderStore.isFolderOpened(folderPath.value)) -function toggleOpen () { +function toggleOpen() { folderStore.toggleFolder(folderPath.value) } const folderPadding = computed(() => { - return (props.depth * 12) + 'px' + return `${props.depth * 12}px` }) </script> diff --git a/packages/histoire-app/src/app/components/tree/StoryListItem.vue b/packages/histoire-app/src/app/components/tree/StoryListItem.vue index f3c2f809..63a7c256 100644 --- a/packages/histoire-app/src/app/components/tree/StoryListItem.vue +++ b/packages/histoire-app/src/app/components/tree/StoryListItem.vue @@ -1,9 +1,9 @@ <script lang="ts" setup> -import type { Story } from '../../types' -import BaseListItemLink from '../base/BaseListItemLink.vue' import { Icon } from '@iconify/vue' import { computed, ref, withDefaults } from 'vue' import { useRoute } from 'vue-router' +import BaseListItemLink from '../base/BaseListItemLink.vue' +import type { Story } from '../../types' import { useScrollOnActive } from '../../util/scroll' const props = withDefaults(defineProps<{ @@ -14,7 +14,7 @@ const props = withDefaults(defineProps<{ }) const filePadding = computed(() => { - return (props.depth * 12) + 'px' + return `${props.depth * 12}px` }) const route = useRoute() diff --git a/packages/histoire-app/src/app/index.ts b/packages/histoire-app/src/app/index.ts index 8c940196..6187e68f 100644 --- a/packages/histoire-app/src/app/index.ts +++ b/packages/histoire-app/src/app/index.ts @@ -6,7 +6,7 @@ import App from './App.vue' import { router } from './router' import { setupPluginApi } from './plugin.js' -export async function mountMainApp () { +export async function mountMainApp() { const app = createApp(App) app.use(createPinia()) app.use(FloatingVue, { @@ -28,7 +28,6 @@ export async function mountMainApp () { if (import.meta.hot) { import.meta.hot.send('histoire:mount', {}) - // eslint-disable-next-line spaced-comment - /*#__PURE__*/ setupPluginApi() + /* #__PURE__ */ setupPluginApi() } } diff --git a/packages/histoire-app/src/app/plugin.ts b/packages/histoire-app/src/app/plugin.ts index 7549d0b4..7578d6b6 100644 --- a/packages/histoire-app/src/app/plugin.ts +++ b/packages/histoire-app/src/app/plugin.ts @@ -1,6 +1,6 @@ import { router } from './router.js' -export function setupPluginApi () { +export function setupPluginApi() { if (!import.meta.hot) return const listeners: Record<string, Set<(result: any) => unknown>> = {} @@ -14,7 +14,7 @@ export function setupPluginApi () { } }) - function addDevEventListener (event: string, listener: (result: any) => unknown) { + function addDevEventListener(event: string, listener: (result: any) => unknown) { let set = listeners[event] if (!set) { set = new Set() @@ -42,7 +42,8 @@ export function setupPluginApi () { }) if (event.startsWith('on')) { resolve(undefined) - } else { + } + else { const off = addDevEventListener(event, (result: any) => { off() resolve(result) diff --git a/packages/histoire-app/src/app/router.ts b/packages/histoire-app/src/app/router.ts index 0a76b541..286a567c 100644 --- a/packages/histoire-app/src/app/router.ts +++ b/packages/histoire-app/src/app/router.ts @@ -1,9 +1,9 @@ -import { createRouter, createWebHistory, createWebHashHistory } from 'vue-router' +import { createRouter, createWebHashHistory, createWebHistory } from 'vue-router' import { histoireConfig } from './util/config' export const base = import.meta.env.BASE_URL as string -function createRouterHistory () { +function createRouterHistory() { switch (histoireConfig.routerMode) { case 'hash': return createWebHashHistory(base) case 'history': diff --git a/packages/histoire-app/src/app/sandbox.ts b/packages/histoire-app/src/app/sandbox.ts index 363bfe83..2c8e1752 100644 --- a/packages/histoire-app/src/app/sandbox.ts +++ b/packages/histoire-app/src/app/sandbox.ts @@ -2,12 +2,12 @@ import { parseQuery } from 'vue-router' import { computed, createApp, h, onMounted, ref, watch } from 'vue' import { createPinia } from 'pinia' import { applyState } from '@histoire/shared' +import { files } from 'virtual:$histoire-stories' import GenericMountStory from './components/story/GenericMountStory.vue' import GenericRenderStory from './components/story/GenericRenderStory.vue' import type { StoryFile } from './types' import { mapFile } from './util/mapping' -import { files } from 'virtual:$histoire-stories' -import { PREVIEW_SETTINGS_SYNC, STATE_SYNC, SANDBOX_READY } from './util/const.js' +import { PREVIEW_SETTINGS_SYNC, SANDBOX_READY, STATE_SYNC } from './util/const.js' import { applyPreviewSettings } from './util/preview-settings.js' import { isDark } from './util/dark.js' import { histoireConfig } from './util/config.js' @@ -20,25 +20,26 @@ const file = ref<StoryFile>(mapFile(files.find(f => f.id === query.storyId))) const app = createApp({ name: 'SandboxApp', - setup () { + setup() { const story = computed(() => file.value.story) const variant = computed(() => story.value?.variants.find(v => v.id === query.variantId)) let synced = false let mounted = false - window.addEventListener('message', event => { + window.addEventListener('message', (event) => { // console.log('[sandbox] received message', event.data) if (event.data?.type === STATE_SYNC) { if (!mounted) return synced = true applyState(variant.value.state, event.data.state) - } else if (event.data?.type === PREVIEW_SETTINGS_SYNC) { + } + else if (event.data?.type === PREVIEW_SETTINGS_SYNC) { applyPreviewSettings(event.data.settings) } }) - watch(() => variant.value.state, value => { + watch(() => variant.value.state, (value) => { if (synced && mounted) { synced = false return @@ -61,7 +62,7 @@ const app = createApp({ } }, - render () { + render() { return [ h('div', { class: 'htw-sandbox-hidden' }, [ h(GenericMountStory, { @@ -86,11 +87,12 @@ const app = createApp({ app.use(createPinia()) app.mount('#app') -watch(isDark, value => { +watch(isDark, (value) => { if (value) { document.documentElement.classList.add(histoireConfig.sandboxDarkClass) // @TODO remove document.documentElement.classList.add(histoireConfig.theme.darkClass) - } else { + } + else { document.documentElement.classList.remove(histoireConfig.sandboxDarkClass) // @TODO remove document.documentElement.classList.remove(histoireConfig.theme.darkClass) } @@ -99,6 +101,5 @@ watch(isDark, value => { }) if (import.meta.hot) { - // eslint-disable-next-line spaced-comment - /*#__PURE__*/ setupPluginApi() + /* #__PURE__ */ setupPluginApi() } diff --git a/packages/histoire-app/src/app/stores/command.ts b/packages/histoire-app/src/app/stores/command.ts index e56e2e89..ce938cdc 100644 --- a/packages/histoire-app/src/app/stores/command.ts +++ b/packages/histoire-app/src/app/stores/command.ts @@ -1,4 +1,4 @@ -import { ClientCommand } from '@histoire/shared' +import type { ClientCommand } from '@histoire/shared' import { defineStore } from 'pinia' import { ref } from 'vue' import { executeCommand, getCommandContext } from '../util/commands.js' @@ -7,11 +7,12 @@ export const useCommandStore = defineStore('command', () => { const selectedCommand = ref<ClientCommand | null>(null) const showPromptsModal = ref(false) - function activateCommand (command: ClientCommand) { + function activateCommand(command: ClientCommand) { selectedCommand.value = command if (command.prompts?.length) { showPromptsModal.value = true - } else { + } + else { const params = command.getParams?.(getCommandContext()) ?? {} executeCommand(command, params) } diff --git a/packages/histoire-app/src/app/stores/events.ts b/packages/histoire-app/src/app/stores/events.ts index 6a52b3f8..f6eaaca3 100644 --- a/packages/histoire-app/src/app/stores/events.ts +++ b/packages/histoire-app/src/app/stores/events.ts @@ -1,8 +1,8 @@ import { defineStore } from 'pinia' -import { ref, reactive, watch } from 'vue' +import { reactive, ref, watch } from 'vue' import { useStoryStore } from './story.js' -export type HstEvent = { +export interface HstEvent { name: string argument: unknown } @@ -13,12 +13,12 @@ export const useEventsStore = defineStore('events', () => { const events = reactive<Array<HstEvent>>([]) const unseen = ref(0) - function addEvent (event: HstEvent) { + function addEvent(event: HstEvent) { events.push(event) unseen.value++ } - function reset () { + function reset() { events.length = 0 unseen.value = 0 } diff --git a/packages/histoire-app/src/app/stores/folder.ts b/packages/histoire-app/src/app/stores/folder.ts index 136546c0..93194354 100644 --- a/packages/histoire-app/src/app/stores/folder.ts +++ b/packages/histoire-app/src/app/stores/folder.ts @@ -9,30 +9,32 @@ export const useFolderStore = defineStore('folder', () => { new Map(), ) - function getStringPath (path: Array<string>) { + function getStringPath(path: Array<string>) { return path.join('␜') } - function toggleFolder (path: Array<string>, defaultToggleValue = true) { + function toggleFolder(path: Array<string>, defaultToggleValue = true) { const stringPath = getStringPath(path) const currentValue = openedFolders.value.get(stringPath) if (currentValue == null) { setFolderOpen(stringPath, defaultToggleValue) - } else if (currentValue) { + } + else if (currentValue) { setFolderOpen(stringPath, false) - } else { + } + else { setFolderOpen(stringPath, true) } } - function setFolderOpen (path: Array<string> | string, value: boolean) { + function setFolderOpen(path: Array<string> | string, value: boolean) { const stringPath = typeof path === 'string' ? path : getStringPath(path) openedFolders.value.set(stringPath, value) } - function isFolderOpened (path: Array<string>, defaultValue = false) { + function isFolderOpened(path: Array<string>, defaultValue = false) { const value = openedFolders.value.get(getStringPath(path)) if (value == null) { return defaultValue @@ -40,7 +42,7 @@ export const useFolderStore = defineStore('folder', () => { return value } - function openFileFolders (path: Array<string>) { + function openFileFolders(path: Array<string>) { for (let pathLength = 1; pathLength < path.length; pathLength++) { setFolderOpen(path.slice(0, pathLength), true) } diff --git a/packages/histoire-app/src/app/stores/story.ts b/packages/histoire-app/src/app/stores/story.ts index 46d2a4bc..e4e9d484 100644 --- a/packages/histoire-app/src/app/stores/story.ts +++ b/packages/histoire-app/src/app/stores/story.ts @@ -1,11 +1,11 @@ import { defineStore } from 'pinia' import { computed, ref } from 'vue' import { router } from '../router' -import { Story, Variant } from '../types' +import type { Story, Variant } from '../types' export const useStoryStore = defineStore('story', () => { const stories = ref<Story[]>([]) - function setStories (value: Story[]) { + function setStories(value: Story[]) { stories.value = value } @@ -28,11 +28,11 @@ export const useStoryStore = defineStore('story', () => { } }) - function getStoryById (id: string) { + function getStoryById(id: string) { return maps.value.stories.get(id) } - function getVariantById (idWithStoryId: string) { + function getVariantById(idWithStoryId: string) { return maps.value.variants.get(idWithStoryId) } diff --git a/packages/histoire-app/src/app/types.ts b/packages/histoire-app/src/app/types.ts index ebb8cc87..ac8c8b55 100644 --- a/packages/histoire-app/src/app/types.ts +++ b/packages/histoire-app/src/app/types.ts @@ -7,12 +7,12 @@ export type { Variant, } from '@histoire/shared' -export type TreeLeaf = { +export interface TreeLeaf { title: string index: number } -export type TreeFolder = { +export interface TreeFolder { title: string children: (TreeFolder | TreeLeaf)[] } diff --git a/packages/histoire-app/src/app/util/commands.ts b/packages/histoire-app/src/app/util/commands.ts index dd324a01..eb2f6860 100644 --- a/packages/histoire-app/src/app/util/commands.ts +++ b/packages/histoire-app/src/app/util/commands.ts @@ -1,7 +1,7 @@ import type { ClientCommand, ClientCommandContext } from '@histoire/shared' import { router } from '../router.js' -import { openInEditor } from './open-in-editor.js' import { useStoryStore } from '../stores/story.js' +import { openInEditor } from './open-in-editor.js' export const builtinCommands: ClientCommand[] = [ { @@ -14,7 +14,8 @@ export const builtinCommands: ClientCommand[] = [ let file: string if (story.docsOnly) { file = story.file?.docsFilePath ?? story.file?.filePath - } else { + } + else { file = story.file?.filePath } return { @@ -35,7 +36,7 @@ export const builtinCommands: ClientCommand[] = [ }, ] -export function executeCommand (command: ClientCommand, params: Record<string, any>) { +export function executeCommand(command: ClientCommand, params: Record<string, any>) { if (import.meta.hot) { import.meta.hot.send('histoire:dev-command', { id: command.id, @@ -46,7 +47,7 @@ export function executeCommand (command: ClientCommand, params: Record<string, a } } -export function getCommandContext (): ClientCommandContext { +export function getCommandContext(): ClientCommandContext { const storyStore = useStoryStore() return { route: router.currentRoute.value, diff --git a/packages/histoire-app/src/app/util/dark.ts b/packages/histoire-app/src/app/util/dark.ts index 6cdd4ef4..252e3663 100644 --- a/packages/histoire-app/src/app/util/dark.ts +++ b/packages/histoire-app/src/app/util/dark.ts @@ -10,8 +10,8 @@ export const isDark = useDark({ }) export const toggleDark = useToggle(isDark) -function applyDarkToControls () { - window.__hst_controls_dark?.forEach(ref => { +function applyDarkToControls() { + window.__hst_controls_dark?.forEach((ref) => { ref.value = isDark.value }) } diff --git a/packages/histoire-app/src/app/util/docs.ts b/packages/histoire-app/src/app/util/docs.ts index fe1d3a72..1171d76b 100644 --- a/packages/histoire-app/src/app/util/docs.ts +++ b/packages/histoire-app/src/app/util/docs.ts @@ -1,16 +1,18 @@ import { unindent } from '@histoire/shared' import { clientSupportPlugins } from 'virtual:$histoire-support-plugins-client' -import type { Variant, Story } from '../types' +import type { Story, Variant } from '../types' -export async function getSourceCode (story: Story, variant: Variant) { +export async function getSourceCode(story: Story, variant: Variant) { if (variant.source) { return variant.source - } else if (variant.slots?.().source) { + } + else if (variant.slots?.().source) { const source = variant.slots?.().source()[0].children if (source) { return unindent(source) } - } else { + } + else { const clientPlugin = clientSupportPlugins[story.file?.supportPluginId] if (clientPlugin) { const pluginModule = await clientPlugin() diff --git a/packages/histoire-app/src/app/util/events.ts b/packages/histoire-app/src/app/util/events.ts index 49022165..c63d726f 100644 --- a/packages/histoire-app/src/app/util/events.ts +++ b/packages/histoire-app/src/app/util/events.ts @@ -1,6 +1,6 @@ import { EVENT_SEND } from './const' -export async function logEvent (name: string, argument) { +export async function logEvent(name: string, argument) { console.log('[histoire] Event fired', { name, argument }) const event = { name, @@ -11,13 +11,14 @@ export async function logEvent (name: string, argument) { type: EVENT_SEND, event, }) - } else { + } + else { const { useEventsStore } = await import('../stores/events.js') useEventsStore().addEvent(event) } } -function stringifyEvent (e) { +function stringifyEvent(e) { const obj = {} for (const k in e) { obj[k] = e[k] diff --git a/packages/histoire-app/src/app/util/keyboard.ts b/packages/histoire-app/src/app/util/keyboard.ts index 36f8b9ce..d050b2dd 100644 --- a/packages/histoire-app/src/app/util/keyboard.ts +++ b/packages/histoire-app/src/app/util/keyboard.ts @@ -1,5 +1,6 @@ import { useEventListener } from '@vueuse/core' -import { isRef, Ref } from 'vue' +import type { Ref } from 'vue' +import { isRef } from 'vue' import { isMac } from './env.js' export type KeyboardShortcut = string[] @@ -10,8 +11,8 @@ export interface KeyboardShortcutOptions { event?: 'keyup' | 'keydown' | 'keypress' } -export function onKeyboardShortcut (shortcut: KeyboardShortcut | Ref<KeyboardShortcut>, handler: KeyboardHandler, options: KeyboardShortcutOptions = {}) { - useEventListener(options.event ?? 'keydown', event => { +export function onKeyboardShortcut(shortcut: KeyboardShortcut | Ref<KeyboardShortcut>, handler: KeyboardHandler, options: KeyboardShortcutOptions = {}) { + useEventListener(options.event ?? 'keydown', (event) => { if (isMatchingShortcut(isRef(shortcut) ? shortcut.value : shortcut)) { handler(event) } @@ -27,7 +28,7 @@ const modifiers: { [i: string]: { key: string, pressed: boolean } } = { const pressedKeys = new Set<string>() -window.addEventListener('keydown', event => { +window.addEventListener('keydown', (event) => { for (const i in modifiers) { const mod = modifiers[i] if (mod.key === event.key) { @@ -38,7 +39,7 @@ window.addEventListener('keydown', event => { pressedKeys.add(event.key.toLocaleLowerCase()) }) -window.addEventListener('keyup', event => { +window.addEventListener('keyup', (event) => { requestAnimationFrame(() => { pressedKeys.clear() for (const i in modifiers) { @@ -59,7 +60,7 @@ window.addEventListener('blur', () => { } }) -function isMatchingShortcut (shortcut: KeyboardShortcut): boolean { +function isMatchingShortcut(shortcut: KeyboardShortcut): boolean { for (const combination of shortcut) { if (isMatchingCombination(combination.toLowerCase())) { return true @@ -68,7 +69,7 @@ function isMatchingShortcut (shortcut: KeyboardShortcut): boolean { return false } -function isMatchingCombination (combination: string): boolean { +function isMatchingCombination(combination: string): boolean { const splitted = combination.split('+').map(key => key.trim()) const targetKey = splitted.pop() for (const mod in modifiers) { @@ -81,7 +82,7 @@ function isMatchingCombination (combination: string): boolean { return pressedKeys.has(targetKey) } -export function formatKey (key: string) { +export function formatKey(key: string) { key = key.toLowerCase() if (key === 'ctrl') { return isMac ? '^' : 'Ctrl' diff --git a/packages/histoire-app/src/app/util/mapping.ts b/packages/histoire-app/src/app/util/mapping.ts index cf497208..9f2fd047 100644 --- a/packages/histoire-app/src/app/util/mapping.ts +++ b/packages/histoire-app/src/app/util/mapping.ts @@ -12,7 +12,7 @@ const copiedFromExistingVariant = [ 'previewReady', ] -export function mapFile (file: StoryFile, existingFile?: StoryFile): StoryFile { +export function mapFile(file: StoryFile, existingFile?: StoryFile): StoryFile { let result: StoryFile if (existingFile) { @@ -26,11 +26,13 @@ export function mapFile (file: StoryFile, existingFile?: StoryFile): StoryFile { file: markRaw(result), variants: file.story.variants.map(v => mapVariant(v, existingFile.story.variants.find(item => item.id === v.id))), } - } else if (key !== 'component') { + } + else if (key !== 'component') { result[key] = file[key] } } - } else { + } + else { // Create result = { ...file, @@ -48,7 +50,7 @@ export function mapFile (file: StoryFile, existingFile?: StoryFile): StoryFile { return result } -export function mapVariant (variant: Variant, existingVariant?: Variant): Variant { +export function mapVariant(variant: Variant, existingVariant?: Variant): Variant { let result: Variant if (existingVariant) { @@ -59,7 +61,8 @@ export function mapVariant (variant: Variant, existingVariant?: Variant): Varian result[key] = variant[key] } } - } else { + } + else { // Create result = { ...variant, diff --git a/packages/histoire-app/src/app/util/open-in-editor.ts b/packages/histoire-app/src/app/util/open-in-editor.ts index 5fccbb2b..e75ff993 100644 --- a/packages/histoire-app/src/app/util/open-in-editor.ts +++ b/packages/histoire-app/src/app/util/open-in-editor.ts @@ -1,3 +1,3 @@ -export function openInEditor (file: string) { +export function openInEditor(file: string) { return fetch(`${import.meta.env.BASE_URL}__open-in-editor?file=${encodeURIComponent(file)}`) } diff --git a/packages/histoire-app/src/app/util/preview-settings.ts b/packages/histoire-app/src/app/util/preview-settings.ts index 3db573d3..0719bb5a 100644 --- a/packages/histoire-app/src/app/util/preview-settings.ts +++ b/packages/histoire-app/src/app/util/preview-settings.ts @@ -1,10 +1,10 @@ import { reactive } from 'vue' -import { histoireConfig } from './config' import type { PreviewSettings } from '../types' +import { histoireConfig } from './config' export const receivedSettings = reactive<PreviewSettings>({} as PreviewSettings) -export function applyPreviewSettings (settings: PreviewSettings) { +export function applyPreviewSettings(settings: PreviewSettings) { Object.assign(receivedSettings, settings) // Text direction @@ -18,6 +18,6 @@ export function applyPreviewSettings (settings: PreviewSettings) { } } -export function getContrastColor (setting: PreviewSettings) { +export function getContrastColor(setting: PreviewSettings) { return histoireConfig.backgroundPresets.find(preset => preset.color === setting.backgroundColor)?.contrastColor ?? 'unset' } diff --git a/packages/histoire-app/src/app/util/sandbox.ts b/packages/histoire-app/src/app/util/sandbox.ts index 20455108..572ed271 100644 --- a/packages/histoire-app/src/app/util/sandbox.ts +++ b/packages/histoire-app/src/app/util/sandbox.ts @@ -1,8 +1,7 @@ - import { base } from '../router' -import { Story, Variant } from '../types' +import type { Story, Variant } from '../types' -export function getSandboxUrl (story: Story, variant: Variant) { +export function getSandboxUrl(story: Story, variant: Variant) { const url = new URLSearchParams() url.append('storyId', story.id) url.append('variantId', variant.id) diff --git a/packages/histoire-app/src/app/util/scroll.ts b/packages/histoire-app/src/app/util/scroll.ts index 8a0b1072..447e4de0 100644 --- a/packages/histoire-app/src/app/util/scroll.ts +++ b/packages/histoire-app/src/app/util/scroll.ts @@ -1,14 +1,15 @@ -import { watch, onMounted, Ref } from 'vue' +import type { Ref } from 'vue' +import { onMounted, watch } from 'vue' import scrollIntoView from 'scroll-into-view-if-needed' -export function useScrollOnActive (active: Ref<boolean>, el: Ref<HTMLElement>) { - watch(active, value => { +export function useScrollOnActive(active: Ref<boolean>, el: Ref<HTMLElement>) { + watch(active, (value) => { if (value) { autoScroll() } }) - function autoScroll () { + function autoScroll() { if (el.value) { scrollIntoView(el.value, { scrollMode: 'if-needed', diff --git a/packages/histoire-app/src/app/util/select.ts b/packages/histoire-app/src/app/util/select.ts index 2878fe54..d2ac948c 100644 --- a/packages/histoire-app/src/app/util/select.ts +++ b/packages/histoire-app/src/app/util/select.ts @@ -1,20 +1,21 @@ -import { Ref, ref, watch, computed } from 'vue' +import type { Ref } from 'vue' +import { computed, ref, watch } from 'vue' -export function useSelection (list: Ref<any[]>) { +export function useSelection(list: Ref<any[]>) { const selectedIndex = ref(0) watch(list, () => { selectedIndex.value = 0 }) - function selectNext () { + function selectNext() { selectedIndex.value++ if (selectedIndex.value > list.value.length - 1) { selectedIndex.value = 0 } } - function selectPrevious () { + function selectPrevious() { selectedIndex.value-- if (selectedIndex.value < 0) { selectedIndex.value = list.value.length - 1 diff --git a/packages/histoire-app/src/app/util/state.ts b/packages/histoire-app/src/app/util/state.ts index 08312a85..92e5cb97 100644 --- a/packages/histoire-app/src/app/util/state.ts +++ b/packages/histoire-app/src/app/util/state.ts @@ -1,8 +1,8 @@ -import { unref, isRef } from 'vue' +import { isRef, unref } from 'vue' -const isObject = (val) => val !== null && typeof val === 'object' +const isObject = val => val !== null && typeof val === 'object' -export function toRawDeep (val, clean = false, seen = new WeakMap()) { +export function toRawDeep(val, clean = false, seen = new WeakMap()) { const unwrappedValue = isRef(val) ? unref(val) : val if (typeof unwrappedValue === 'symbol') { @@ -26,7 +26,8 @@ export function toRawDeep (val, clean = false, seen = new WeakMap()) { } result.push(...list) return result - } else { + } + else { const result = {} seen.set(unwrappedValue, result) toRawObject(unwrappedValue, result, clean, seen) @@ -34,7 +35,7 @@ export function toRawDeep (val, clean = false, seen = new WeakMap()) { } } -const toRawObject = (obj: Record<any, any>, target: Record<any, any>, clean = false, seen = new WeakMap()) => { +function toRawObject(obj: Record<any, any>, target: Record<any, any>, clean = false, seen = new WeakMap()) { Object.keys(obj).forEach((key) => { if (clean && typeof obj[key] === 'function') { return diff --git a/packages/histoire-app/src/app/util/tooltip.ts b/packages/histoire-app/src/app/util/tooltip.ts index 583f96c7..abb3a65b 100644 --- a/packages/histoire-app/src/app/util/tooltip.ts +++ b/packages/histoire-app/src/app/util/tooltip.ts @@ -1,13 +1,13 @@ import { isMac } from './env.js' import { formatKey } from './keyboard.js' -export function makeTooltip (descriptionHtml: string, keyboardShortcut: (options: { isMac: boolean }) => string) { +export function makeTooltip(descriptionHtml: string, keyboardShortcut: (options: { isMac: boolean }) => string) { return { content: `<div>${descriptionHtml}</div><div class="htw-flex htw-items-center htw-gap-1 htw-mt-2 htw-text-sm">${genKeyboardShortcutHtml(keyboardShortcut({ isMac }))}</div>`, html: true, } } -function genKeyboardShortcutHtml (shortcut: string) { +function genKeyboardShortcutHtml(shortcut: string) { return `<span class="htw-border htw-border-gray-600 htw-px-1 htw-rounded-sm htw-text-gray-400">${shortcut.split('+').map(k => formatKey(k.trim())).join(' ')}</span>` } diff --git a/packages/histoire-app/src/app/util/variant.ts b/packages/histoire-app/src/app/util/variant.ts index ba9a4f8e..aa9ab003 100644 --- a/packages/histoire-app/src/app/util/variant.ts +++ b/packages/histoire-app/src/app/util/variant.ts @@ -1,8 +1,9 @@ -import { computed, Ref } from 'vue' +import type { Ref } from 'vue' +import { computed } from 'vue' import { useRoute } from 'vue-router' import type { Variant } from '../types' -export function useCurrentVariantRoute (variant: Ref<Variant>) { +export function useCurrentVariantRoute(variant: Ref<Variant>) { const route = useRoute() const isActive = computed(() => route.query.variantId === variant.value.id) const targetRoute = computed(() => ({ diff --git a/packages/histoire-app/src/shim.d.ts b/packages/histoire-app/src/shim.d.ts index fd6f79dd..1dba6c01 100644 --- a/packages/histoire-app/src/shim.d.ts +++ b/packages/histoire-app/src/shim.d.ts @@ -2,12 +2,6 @@ import type { Ref } from '@histoire/vendors/vue' -declare module '*.vue' { - import { ComponentOptions } from 'vue' - const comp: ComponentOptions - export default comp -} - global { interface Window { __hst_controls_dark: Ref<boolean>[] diff --git a/packages/histoire-app/src/virtual.d.ts b/packages/histoire-app/src/virtual.d.ts index 2012f6c4..52f4c6e5 100644 --- a/packages/histoire-app/src/virtual.d.ts +++ b/packages/histoire-app/src/virtual.d.ts @@ -1,5 +1,6 @@ declare module 'virtual:$histoire-commands' { import type { ClientCommand } from '@histoire/shared' + export const registeredCommands: ClientCommand[] } diff --git a/packages/histoire-app/tailwind.config.cjs b/packages/histoire-app/tailwind.config.cjs index 8b22993e..a7dbd7c7 100644 --- a/packages/histoire-app/tailwind.config.cjs +++ b/packages/histoire-app/tailwind.config.cjs @@ -1,11 +1,10 @@ - -const inheritedConfig = require('../../tailwind.config.cjs') const defaultColors = require('tailwindcss/colors') const path = require('pathe') +const inheritedConfig = require('../../tailwind.config.cjs') // Colors -function withOpacityValue (variable) { +function withOpacityValue(variable) { return ({ opacityValue }) => { if (opacityValue === undefined) { return `rgb(var(${variable}))` @@ -73,12 +72,12 @@ module.exports.theme.colors = colors module.exports.plugins.push(require('@tailwindcss/typography')) // prose-a:htw-text-primary-500 prose-headings:htw-mb-2 prose-headings:htw-mt-4 first:prose-headings:htw-mt-0 prose-blockquote:htw-ml-0 -module.exports.theme.extend.typography = (theme) => ({ +module.exports.theme.extend.typography = theme => ({ DEFAULT: { css: { - a: { - color: theme('colors.primary-500'), - textDecoration: 'none', + 'a': { + 'color': theme('colors.primary-500'), + 'textDecoration': 'none', '&:hover': { textDecoration: 'underline', @@ -86,7 +85,7 @@ module.exports.theme.extend.typography = (theme) => ({ }, 'h1, h2, h3, h4, th': { - marginBottom: '0.75rem', + 'marginBottom': '0.75rem', '&:not(:first-child)': { marginTop: '1.25rem', @@ -96,11 +95,11 @@ module.exports.theme.extend.typography = (theme) => ({ '--tw-prose-invert-quote-borders': theme('colors.gray-800'), '--tw-prose-invert-hr': theme('colors.gray-800'), - blockquote: { - marginLeft: 0, - marginRight: 0, - backgroundColor: theme('colors.gray-100'), - padding: '.25rem .375rem', + 'blockquote': { + 'marginLeft': 0, + 'marginRight': 0, + 'backgroundColor': theme('colors.gray-100'), + 'padding': '.25rem .375rem', '& p:first-child': { marginTop: 0, @@ -117,17 +116,17 @@ module.exports.theme.extend.typography = (theme) => ({ '--tw-prose-invert-bullets': theme('colors.gray-500'), - li: { + 'li': { marginTop: '0.1rem', marginBottom: '0.1rem', }, - code: { - backgroundColor: theme('colors.gray-500 / 20%'), - fontWeight: 'normal', - padding: '0.05rem 0.5rem', - borderRadius: '0.25rem', - fontSize: '0.8rem', + 'code': { + 'backgroundColor': theme('colors.gray-500 / 20%'), + 'fontWeight': 'normal', + 'padding': '0.05rem 0.5rem', + 'borderRadius': '0.25rem', + 'fontSize': '0.8rem', '&::before, &::after': { display: 'none', diff --git a/packages/histoire-app/tsconfig.json b/packages/histoire-app/tsconfig.json index 401a2452..77712a13 100644 --- a/packages/histoire-app/tsconfig.json +++ b/packages/histoire-app/tsconfig.json @@ -1,35 +1,17 @@ { "compilerOptions": { "target": "ESNext", - "module": "ESNext", - "moduleResolution": "node", - "outDir": "dist", - "rootDir": "src", - "baseUrl": ".", - "allowSyntheticDefaultImports": true, - "esModuleInterop": true, - "removeComments": false, - "resolveJsonModule": true, - "skipLibCheck": true, - "types": [ - "node" - ], + // Volar + "jsx": "preserve", "lib": [ "ESNext", "DOM", - "DOM.Iterable", + "DOM.Iterable" ], - "sourceMap": false, - "preserveWatchOutput": true, - "declaration": false, - // Strict - "noImplicitAny": false, - "noImplicitThis": true, - "alwaysStrict": true, - "strictBindCallApply": true, - "strictFunctionTypes": true, - // Volar - "jsx": "preserve", + "baseUrl": ".", + "rootDir": "src", + "module": "ESNext", + "moduleResolution": "node", // Alias "paths": { "floating-vue": ["node_modules/@histoire/vendors/floating-vue"], @@ -39,7 +21,25 @@ "vue-router": ["node_modules/@histoire/vendors/vue-router"], "@vueuse/core": ["node_modules/@histoire/vendors/vue-use"], "vue": ["node_modules/@histoire/vendors/vue"] - } + }, + "resolveJsonModule": true, + "types": [ + "node" + ], + "strictBindCallApply": true, + "strictFunctionTypes": true, + "alwaysStrict": true, + // Strict + "noImplicitAny": false, + "noImplicitThis": true, + "declaration": false, + "outDir": "dist", + "removeComments": false, + "sourceMap": false, + "allowSyntheticDefaultImports": true, + "esModuleInterop": true, + "skipLibCheck": true, + "preserveWatchOutput": true }, "include": [ "src" diff --git a/packages/histoire-app/vite.config.ts b/packages/histoire-app/vite.config.ts index 2edb025a..6de10402 100644 --- a/packages/histoire-app/vite.config.ts +++ b/packages/histoire-app/vite.config.ts @@ -9,14 +9,14 @@ export default defineConfig({ { name: 'histoire:preserve:import.meta', enforce: 'pre', - transform (code) { + transform(code) { if (code.includes('import.meta')) { return { code: code.replace(/import\.meta/g, 'import__meta'), } } }, - closeBundle () { + closeBundle() { try { const files = globbySync('./dist/bundled/**/*.js') for (const file of files) { @@ -25,7 +25,8 @@ export default defineConfig({ fs.writeFileSync(file, content.replace(/import__meta/g, 'import.meta'), 'utf-8') } } - } catch (e) { + } + catch (e) { console.error(e) } }, @@ -36,11 +37,11 @@ export default defineConfig({ alias: { 'floating-vue': '@histoire/vendors/floating-vue', '@iconify/vue': '@histoire/vendors/iconify', - pinia: '@histoire/vendors/pinia', + 'pinia': '@histoire/vendors/pinia', 'scroll-into-view-if-needed': '@histoire/vendors/scroll', 'vue-router': '@histoire/vendors/vue-router', '@vueuse/core': '@histoire/vendors/vue-use', - vue: '@histoire/vendors/vue', + 'vue': '@histoire/vendors/vue', }, }, @@ -55,7 +56,7 @@ export default defineConfig({ external: [ /\$histoire/, /@histoire/, - // eslint-disable-next-line @typescript-eslint/no-var-requires + // eslint-disable-next-line ts/no-var-requires, ts/no-require-imports ...Object.keys(require('./package.json').dependencies), ], diff --git a/packages/histoire-controls-stories/package.json b/packages/histoire-controls-stories/package.json index eef356bc..b52636c7 100644 --- a/packages/histoire-controls-stories/package.json +++ b/packages/histoire-controls-stories/package.json @@ -1,18 +1,18 @@ { "name": "@histoire/controls-stories", + "type": "module", "version": "0.8.4", "private": true, "description": "Stories for the prebuilt controls components", - "license": "MIT", "author": { "name": "Guillaume Chau" }, + "license": "MIT", "repository": { "url": "https://github.com/Akryum/histoire.git", "type": "git", "directory": "packages/histoire-controls-stories" }, - "type": "module", "scripts": { "story:dev": "histoire dev", "story:build": "histoire build", diff --git a/packages/histoire-controls/package.json b/packages/histoire-controls/package.json index 1f02317e..1ed27929 100644 --- a/packages/histoire-controls/package.json +++ b/packages/histoire-controls/package.json @@ -1,11 +1,12 @@ { "name": "@histoire/controls", + "type": "module", "version": "0.17.16", "description": "Prebuilt controls components", - "license": "MIT", "author": { "name": "Guillaume Chau" }, + "license": "MIT", "repository": { "url": "https://github.com/Akryum/histoire.git", "type": "git", @@ -14,7 +15,11 @@ "publishConfig": { "access": "public" }, - "type": "module", + "sideEffects": [ + "*.css", + "*.postcss", + "*.vue" + ], "exports": { ".": { "types": "./dist/index.d.ts", @@ -25,11 +30,6 @@ "main": "./dist/index.es.js", "module": "./dist/index.es.js", "types": "./dist/index.d.ts", - "sideEffects": [ - "*.css", - "*.postcss", - "*.vue" - ], "scripts": { "build": "rimraf dist && pnpm run build:css && vite build && pnpm run build:types", "build:css": "tailwindcss -i src/style/main.css -o ./dist/style-standalone.css -c tailwind.config.cjs --postcss postcss.config.cjs", @@ -63,10 +63,10 @@ "postcss": "^8.4.31", "postcss-import": "^14.1.0", "tailwindcss": "^3.3.5", - "typescript": "^4.9.5", + "typescript": "^5.4.4", "vite": "^5.0.11", "vitest": "^0.34.6", "vue": "^3.3.8", - "vue-tsc": "^1.8.22" + "vue-tsc": "^2.0.11" } } diff --git a/packages/histoire-controls/src/components/HstCopyIcon.vue b/packages/histoire-controls/src/components/HstCopyIcon.vue index 1fad8286..108cae53 100644 --- a/packages/histoire-controls/src/components/HstCopyIcon.vue +++ b/packages/histoire-controls/src/components/HstCopyIcon.vue @@ -16,7 +16,7 @@ const props = defineProps<{ const { copy, copied } = useClipboard() -const action = async () => { +async function action() { const content = typeof props.content === 'function' ? await props.content() : props.content copy(content) } diff --git a/packages/histoire-controls/src/components/HstWrapper.vue b/packages/histoire-controls/src/components/HstWrapper.vue index 67b32904..07aee5cc 100644 --- a/packages/histoire-controls/src/components/HstWrapper.vue +++ b/packages/histoire-controls/src/components/HstWrapper.vue @@ -15,7 +15,6 @@ withDefaults(defineProps<{ title: undefined, tag: 'label', }) - </script> <template> diff --git a/packages/histoire-controls/src/components/button/HstButton.story.vue b/packages/histoire-controls/src/components/button/HstButton.story.vue index ad316ab9..4f2885fe 100644 --- a/packages/histoire-controls/src/components/button/HstButton.story.vue +++ b/packages/histoire-controls/src/components/button/HstButton.story.vue @@ -1,7 +1,7 @@ <script lang="ts" setup> import HstButton from './HstButton.vue' -const variants: Array<{name: string, bind?: unknown}> = [ +const variants: Array<{ name: string, bind?: unknown }> = [ { name: 'Default' }, { name: 'Primary', bind: { color: 'primary' } }, { name: 'Flat', bind: { color: 'flat' } }, diff --git a/packages/histoire-controls/src/components/button/HstButtonGroup.story.vue b/packages/histoire-controls/src/components/button/HstButtonGroup.story.vue index 10cbc258..1f7d1104 100644 --- a/packages/histoire-controls/src/components/button/HstButtonGroup.story.vue +++ b/packages/histoire-controls/src/components/button/HstButtonGroup.story.vue @@ -15,7 +15,7 @@ const objectOptions = Object.keys(options).map(key => ({ value: key, })) -function initState () { +function initState() { return { speed: flatOptions[0], } @@ -72,7 +72,7 @@ const count = ref('0') <pre>{{ { count } }}</pre> <HstButtonGroup v-model="count" - :options="[{label: 'Low', value: '-25'},{label: 'Regular', value: '0'},{label: 'High', value: '200'}]" + :options="[{ label: 'Low', value: '-25' }, { label: 'Regular', value: '0' }, { label: 'High', value: '200' }]" /> </Variant> </Story> diff --git a/packages/histoire-controls/src/components/button/HstButtonGroup.vue b/packages/histoire-controls/src/components/button/HstButtonGroup.vue index a217e756..a8e1bfa0 100644 --- a/packages/histoire-controls/src/components/button/HstButtonGroup.vue +++ b/packages/histoire-controls/src/components/button/HstButtonGroup.vue @@ -5,9 +5,10 @@ export default { </script> <script setup lang="ts"> -import { computed, ComputedRef } from 'vue' +import type { ComputedRef } from 'vue' +import { computed } from 'vue' import HstWrapper from '../HstWrapper.vue' -import { HstControlOption } from '../../types' +import type { HstControlOption } from '../../types' import HstButton from './HstButton.vue' const props = defineProps<{ @@ -21,11 +22,13 @@ const formattedOptions: ComputedRef<HstControlOption[]> = computed(() => { return props.options.map((value: string | number | HstControlOption) => { if (typeof value === 'string' || typeof value === 'number') { return { value, label: String(value) } - } else { + } + else { return value } }) - } else { + } + else { return Object.keys(props.options).map((value: string) => ({ value, label: props.options[value], @@ -37,7 +40,7 @@ const emit = defineEmits<{ (e: 'update:modelValue', value: string): void }>() -function selectOption (value: string) { +function selectOption(value: string) { emit('update:modelValue', value) } </script> diff --git a/packages/histoire-controls/src/components/checkbox/HstCheckbox.spec.ts b/packages/histoire-controls/src/components/checkbox/HstCheckbox.spec.ts index 26e4fcd1..3cecbb8b 100644 --- a/packages/histoire-controls/src/components/checkbox/HstCheckbox.spec.ts +++ b/packages/histoire-controls/src/components/checkbox/HstCheckbox.spec.ts @@ -1,8 +1,8 @@ import { mount } from '@vue/test-utils' import HstCheckbox from './HstCheckbox.vue' -describe('HstCheckbox', () => { - test('toggle to checked', async () => { +describe('hstCheckbox', () => { + it('toggle to checked', async () => { const wrapper = mount(HstCheckbox, { props: { modelValue: false, @@ -14,7 +14,7 @@ describe('HstCheckbox', () => { expect(wrapper.html()).toMatchSnapshot() }) - test('toggle to unchecked', async () => { + it('toggle to unchecked', async () => { const wrapper = mount(HstCheckbox, { props: { modelValue: true, diff --git a/packages/histoire-controls/src/components/checkbox/HstCheckbox.story.vue b/packages/histoire-controls/src/components/checkbox/HstCheckbox.story.vue index 84eeb662..f4352e1b 100644 --- a/packages/histoire-controls/src/components/checkbox/HstCheckbox.story.vue +++ b/packages/histoire-controls/src/components/checkbox/HstCheckbox.story.vue @@ -1,7 +1,7 @@ <script lang="ts" setup> import HstCheckbox from './HstCheckbox.vue' -function initState () { +function initState() { return { booleanChecked: false, stringChecked: 'false', diff --git a/packages/histoire-controls/src/components/checkbox/HstCheckbox.vue b/packages/histoire-controls/src/components/checkbox/HstCheckbox.vue index dbff082f..a248bd8b 100644 --- a/packages/histoire-controls/src/components/checkbox/HstCheckbox.vue +++ b/packages/histoire-controls/src/components/checkbox/HstCheckbox.vue @@ -5,9 +5,9 @@ export default { </script> <script lang="ts" setup> +import { computed } from 'vue' import HstWrapper from '../HstWrapper.vue' import HstSimpleCheckbox from './HstSimpleCheckbox.vue' -import { computed } from 'vue' type Booleanish = boolean | 'true' | 'false' @@ -20,7 +20,7 @@ const emit = defineEmits({ 'update:modelValue': (newValue: Booleanish) => true, }) -function toggle () { +function toggle() { if (typeof props.modelValue === 'string') { emit('update:modelValue', props.modelValue === 'false' ? 'true' : 'false') return diff --git a/packages/histoire-controls/src/components/checkbox/HstCheckboxList.story.vue b/packages/histoire-controls/src/components/checkbox/HstCheckboxList.story.vue index 3da230a6..fcb49f9d 100644 --- a/packages/histoire-controls/src/components/checkbox/HstCheckboxList.story.vue +++ b/packages/histoire-controls/src/components/checkbox/HstCheckboxList.story.vue @@ -12,7 +12,7 @@ const objectOptions = Object.keys(options).map(key => ({ value: key, })) -function initState () { +function initState() { return { characters: [], } diff --git a/packages/histoire-controls/src/components/checkbox/HstCheckboxList.vue b/packages/histoire-controls/src/components/checkbox/HstCheckboxList.vue index fbc2ef7b..b1655ecb 100644 --- a/packages/histoire-controls/src/components/checkbox/HstCheckboxList.vue +++ b/packages/histoire-controls/src/components/checkbox/HstCheckboxList.vue @@ -5,9 +5,10 @@ export default { </script> <script lang="ts" setup> -import { computed, ComputedRef } from 'vue' +import type { ComputedRef } from 'vue' +import { computed } from 'vue' import HstWrapper from '../HstWrapper.vue' -import { HstControlOption } from '../../types' +import type { HstControlOption } from '../../types' import HstSimpleCheckbox from './HstSimpleCheckbox.vue' const props = defineProps<{ @@ -21,7 +22,8 @@ const formattedOptions: ComputedRef<Record<string, string>> = computed(() => { return Object.fromEntries(props.options.map((value: string | HstControlOption) => { if (typeof value === 'string') { return [value, value] - } else { + } + else { return [value.value, value.label] } })) @@ -33,10 +35,11 @@ const emit = defineEmits<{ (e: 'update:modelValue', value: Array<string>): void }>() -function toggleOption (value: string) { +function toggleOption(value: string) { if (props.modelValue.includes(value)) { emit('update:modelValue', props.modelValue.filter(element => element !== value)) - } else { + } + else { emit('update:modelValue', [...props.modelValue, value]) } } @@ -52,7 +55,7 @@ function toggleOption (value: string) { > <div class="-htw-my-1"> <template - v-for="( label, value ) in formattedOptions" + v-for="(label, value) in formattedOptions" :key="value" > <label diff --git a/packages/histoire-controls/src/components/checkbox/HstSimpleCheckbox.story.vue b/packages/histoire-controls/src/components/checkbox/HstSimpleCheckbox.story.vue index 25b89676..91888e57 100644 --- a/packages/histoire-controls/src/components/checkbox/HstSimpleCheckbox.story.vue +++ b/packages/histoire-controls/src/components/checkbox/HstSimpleCheckbox.story.vue @@ -1,7 +1,7 @@ <script lang="ts" setup> import HstSimpleCheckbox from './HstSimpleCheckbox.vue' -function initState () { +function initState() { return { checked: true, } diff --git a/packages/histoire-controls/src/components/checkbox/HstSimpleCheckbox.vue b/packages/histoire-controls/src/components/checkbox/HstSimpleCheckbox.vue index 6df87b7b..ed350a8b 100644 --- a/packages/histoire-controls/src/components/checkbox/HstSimpleCheckbox.vue +++ b/packages/histoire-controls/src/components/checkbox/HstSimpleCheckbox.vue @@ -16,7 +16,7 @@ const emit = defineEmits({ 'update:modelValue': (newValue: boolean) => true, }) -function toggle () { +function toggle() { if (!props.withToggle) { return } @@ -46,7 +46,7 @@ watch(path, () => { <template> <div class="histoire-simple-checkbox htw-group htw-text-white htw-w-[16px] htw-h-[16px] htw-relative" - :class="{'htw-cursor-pointer': withToggle}" + :class="{ 'htw-cursor-pointer': withToggle }" @click="toggle" > <div diff --git a/packages/histoire-controls/src/components/checkbox/__snapshots__/HstCheckbox.spec.ts.snap b/packages/histoire-controls/src/components/checkbox/__snapshots__/HstCheckbox.spec.ts.snap index 334902e3..36f06e8e 100644 --- a/packages/histoire-controls/src/components/checkbox/__snapshots__/HstCheckbox.spec.ts.snap +++ b/packages/histoire-controls/src/components/checkbox/__snapshots__/HstCheckbox.spec.ts.snap @@ -3,3 +3,7 @@ exports[`HstCheckbox > toggle to checked 1`] = `"<label class=\\"histoire-wrapper htw-p-2 hover:htw-bg-primary-100 dark:hover:htw-bg-primary-800 htw-flex htw-gap-2 htw-flex-wrap histoire-checkbox htw-cursor-pointer htw-items-center\\" role=\\"checkbox\\" tabindex=\\"0\\"><span class=\\"htw-w-28 htw-whitespace-nowrap htw-text-ellipsis htw-overflow-hidden htw-shrink-0 v-popper--has-tooltip\\">Label</span><span class=\\"htw-grow htw-max-w-full htw-flex htw-items-center htw-gap-1\\"><span class=\\"htw-block htw-grow htw-max-w-full\\"><div class=\\"histoire-simple-checkbox htw-group htw-text-white htw-w-[16px] htw-h-[16px] htw-relative\\"><div class=\\"htw-border htw-border-solid group-active:htw-bg-gray-500/20 htw-rounded-sm htw-box-border htw-absolute htw-inset-0 htw-transition-border htw-duration-150 htw-ease-out group-hover:htw-border-primary-500 group-hover:dark:htw-border-primary-500 htw-border-black/25 dark:htw-border-white/25 htw-delay-150\\"></div><svg width=\\"16\\" height=\\"16\\" viewBox=\\"0 0 24 24\\" class=\\"htw-relative htw-z-10\\"><path d=\\"m 4 12 l 5 5 l 10 -10\\" fill=\\"none\\" class=\\"htw-stroke-white htw-stroke-2 htw-duration-200 htw-ease-in-out htw-transition-none\\" stroke-dasharray=\\"21.21\\" stroke-dashoffset=\\"21.21\\"></path></svg></div></span></span></label>"`; exports[`HstCheckbox > toggle to unchecked 1`] = `"<label class=\\"histoire-wrapper htw-p-2 hover:htw-bg-primary-100 dark:hover:htw-bg-primary-800 htw-flex htw-gap-2 htw-flex-wrap histoire-checkbox htw-cursor-pointer htw-items-center\\" role=\\"checkbox\\" tabindex=\\"0\\"><span class=\\"htw-w-28 htw-whitespace-nowrap htw-text-ellipsis htw-overflow-hidden htw-shrink-0 v-popper--has-tooltip\\">Label</span><span class=\\"htw-grow htw-max-w-full htw-flex htw-items-center htw-gap-1\\"><span class=\\"htw-block htw-grow htw-max-w-full\\"><div class=\\"histoire-simple-checkbox htw-group htw-text-white htw-w-[16px] htw-h-[16px] htw-relative\\"><div class=\\"htw-border htw-border-solid group-active:htw-bg-gray-500/20 htw-rounded-sm htw-box-border htw-absolute htw-inset-0 htw-transition-border htw-duration-150 htw-ease-out group-hover:htw-border-primary-500 group-hover:dark:htw-border-primary-500 htw-border-primary-500 htw-border-8\\"></div><svg width=\\"16\\" height=\\"16\\" viewBox=\\"0 0 24 24\\" class=\\"htw-relative htw-z-10\\"><path d=\\"m 4 12 l 5 5 l 10 -10\\" fill=\\"none\\" class=\\"htw-stroke-white htw-stroke-2 htw-duration-200 htw-ease-in-out htw-transition-none htw-delay-150\\" stroke-dasharray=\\"21.21\\" stroke-dashoffset=\\"0\\"></path></svg></div></span></span></label>"`; + +exports[`hstCheckbox > toggle to checked 1`] = `"<label class=\\"histoire-wrapper htw-p-2 hover:htw-bg-primary-100 dark:hover:htw-bg-primary-800 htw-flex htw-gap-2 htw-flex-wrap histoire-checkbox htw-cursor-pointer htw-items-center\\" role=\\"checkbox\\" tabindex=\\"0\\"><span class=\\"htw-w-28 htw-whitespace-nowrap htw-text-ellipsis htw-overflow-hidden htw-shrink-0 v-popper--has-tooltip\\">Label</span><span class=\\"htw-grow htw-max-w-full htw-flex htw-items-center htw-gap-1\\"><span class=\\"htw-block htw-grow htw-max-w-full\\"><div class=\\"histoire-simple-checkbox htw-group htw-text-white htw-w-[16px] htw-h-[16px] htw-relative\\"><div class=\\"htw-border htw-border-solid group-active:htw-bg-gray-500/20 htw-rounded-sm htw-box-border htw-absolute htw-inset-0 htw-transition-border htw-duration-150 htw-ease-out group-hover:htw-border-primary-500 group-hover:dark:htw-border-primary-500 htw-border-black/25 dark:htw-border-white/25 htw-delay-150\\"></div><svg width=\\"16\\" height=\\"16\\" viewBox=\\"0 0 24 24\\" class=\\"htw-relative htw-z-10\\"><path d=\\"m 4 12 l 5 5 l 10 -10\\" fill=\\"none\\" class=\\"htw-stroke-white htw-stroke-2 htw-duration-200 htw-ease-in-out htw-transition-none\\" stroke-dasharray=\\"21.21\\" stroke-dashoffset=\\"21.21\\"></path></svg></div></span></span></label>"`; + +exports[`hstCheckbox > toggle to unchecked 1`] = `"<label class=\\"histoire-wrapper htw-p-2 hover:htw-bg-primary-100 dark:hover:htw-bg-primary-800 htw-flex htw-gap-2 htw-flex-wrap histoire-checkbox htw-cursor-pointer htw-items-center\\" role=\\"checkbox\\" tabindex=\\"0\\"><span class=\\"htw-w-28 htw-whitespace-nowrap htw-text-ellipsis htw-overflow-hidden htw-shrink-0 v-popper--has-tooltip\\">Label</span><span class=\\"htw-grow htw-max-w-full htw-flex htw-items-center htw-gap-1\\"><span class=\\"htw-block htw-grow htw-max-w-full\\"><div class=\\"histoire-simple-checkbox htw-group htw-text-white htw-w-[16px] htw-h-[16px] htw-relative\\"><div class=\\"htw-border htw-border-solid group-active:htw-bg-gray-500/20 htw-rounded-sm htw-box-border htw-absolute htw-inset-0 htw-transition-border htw-duration-150 htw-ease-out group-hover:htw-border-primary-500 group-hover:dark:htw-border-primary-500 htw-border-primary-500 htw-border-8\\"></div><svg width=\\"16\\" height=\\"16\\" viewBox=\\"0 0 24 24\\" class=\\"htw-relative htw-z-10\\"><path d=\\"m 4 12 l 5 5 l 10 -10\\" fill=\\"none\\" class=\\"htw-stroke-white htw-stroke-2 htw-duration-200 htw-ease-in-out htw-transition-none htw-delay-150\\" stroke-dasharray=\\"21.21\\" stroke-dashoffset=\\"0\\"></path></svg></div></span></span></label>"`; diff --git a/packages/histoire-controls/src/components/colorselect/HstColorSelect.vue b/packages/histoire-controls/src/components/colorselect/HstColorSelect.vue index dd231e9a..655f7b0d 100644 --- a/packages/histoire-controls/src/components/colorselect/HstColorSelect.vue +++ b/packages/histoire-controls/src/components/colorselect/HstColorSelect.vue @@ -6,7 +6,7 @@ export default { </script> <script lang="ts" setup> -import { computed, ref } from 'vue' +import { computed } from 'vue' import HstWrapper from '../HstWrapper.vue' const props = defineProps<{ @@ -18,8 +18,6 @@ const emit = defineEmits({ 'update:modelValue': (newValue: string) => true, }) -const input = ref<HTMLInputElement>(null) - const stringModel = computed({ get: () => props.modelValue, set: value => { @@ -72,7 +70,6 @@ function processChange(inp) { > <div class="htw-flex htw-flex-row htw-gap-1"> <input - ref="input" v-bind="{ ...$attrs, class: null, style: null }" v-model="stringModel" type="text" diff --git a/packages/histoire-controls/src/components/design-tokens/HstColorShades.story.vue b/packages/histoire-controls/src/components/design-tokens/HstColorShades.story.vue index 1a0b571f..d2a64cf2 100644 --- a/packages/histoire-controls/src/components/design-tokens/HstColorShades.story.vue +++ b/packages/histoire-controls/src/components/design-tokens/HstColorShades.story.vue @@ -1,6 +1,6 @@ <script lang="ts" setup> -import HstColorShades from './HstColorShades.vue' import type { CSSProperties } from 'vue' +import HstColorShades from './HstColorShades.vue' const colors = { slate: { @@ -329,7 +329,7 @@ const colors = { <div class="htw-rounded htw-h-[100px] htw-text-5xl htw-flex htw-items-end" :style="{ - color: color, + color, } as CSSProperties" > Aa diff --git a/packages/histoire-controls/src/components/design-tokens/HstColorShades.vue b/packages/histoire-controls/src/components/design-tokens/HstColorShades.vue index 86d1a705..08243845 100644 --- a/packages/histoire-controls/src/components/design-tokens/HstColorShades.vue +++ b/packages/histoire-controls/src/components/design-tokens/HstColorShades.vue @@ -7,8 +7,8 @@ export default { <script lang="ts" setup> import { computed, ref } from 'vue' import { VTooltip as vTooltip } from 'floating-vue' -import HstCopyIcon from '../HstCopyIcon.vue' import type { CSSProperties } from 'vue' +import HstCopyIcon from '../HstCopyIcon.vue' const props = defineProps<{ shades: Record<string, any> @@ -16,7 +16,7 @@ const props = defineProps<{ search?: string }>() -const flattenShades = (shades: Record<string, any>, path = ''): Record<string, string> => { +function flattenShades(shades: Record<string, any>, path = ''): Record<string, string> { return Object.entries(shades).reduce((acc, [key, color]) => { const nextPath = path ? key === 'DEFAULT' ? path : `${path}-${key}` : key const obj = typeof color === 'object' ? flattenShades(color, nextPath) : { [nextPath]: color } diff --git a/packages/histoire-controls/src/components/design-tokens/HstTokenGrid.story.vue b/packages/histoire-controls/src/components/design-tokens/HstTokenGrid.story.vue index 194036c5..65c614dd 100644 --- a/packages/histoire-controls/src/components/design-tokens/HstTokenGrid.story.vue +++ b/packages/histoire-controls/src/components/design-tokens/HstTokenGrid.story.vue @@ -2,13 +2,13 @@ import HstTokenGrid from './HstTokenGrid.vue' const tokens = { - sm: 'filter: drop-shadow(0 1px 1px rgb(0 0 0 / 0.05))', - DEFAULT: 'filter: drop-shadow(0 1px 2px rgb(0 0 0 / 0.1)) drop-shadow(0 1px 1px rgb(0 0 0 / 0.06))', - md: 'filter: drop-shadow(0 4px 3px rgb(0 0 0 / 0.07)) drop-shadow(0 2px 2px rgb(0 0 0 / 0.06))', - lg: 'filter: drop-shadow(0 10px 8px rgb(0 0 0 / 0.04)) drop-shadow(0 4px 3px rgb(0 0 0 / 0.1))', - xl: 'filter: drop-shadow(0 20px 13px rgb(0 0 0 / 0.03)) drop-shadow(0 8px 5px rgb(0 0 0 / 0.08))', + 'sm': 'filter: drop-shadow(0 1px 1px rgb(0 0 0 / 0.05))', + 'DEFAULT': 'filter: drop-shadow(0 1px 2px rgb(0 0 0 / 0.1)) drop-shadow(0 1px 1px rgb(0 0 0 / 0.06))', + 'md': 'filter: drop-shadow(0 4px 3px rgb(0 0 0 / 0.07)) drop-shadow(0 2px 2px rgb(0 0 0 / 0.06))', + 'lg': 'filter: drop-shadow(0 10px 8px rgb(0 0 0 / 0.04)) drop-shadow(0 4px 3px rgb(0 0 0 / 0.1))', + 'xl': 'filter: drop-shadow(0 20px 13px rgb(0 0 0 / 0.03)) drop-shadow(0 8px 5px rgb(0 0 0 / 0.08))', '2xl': 'filter: drop-shadow(0 25px 25px rgb(0 0 0 / 0.15))', - none: 'filter: drop-shadow(0 0 #0000)', + 'none': 'filter: drop-shadow(0 0 #0000)', } </script> diff --git a/packages/histoire-controls/src/components/design-tokens/HstTokenList.story.vue b/packages/histoire-controls/src/components/design-tokens/HstTokenList.story.vue index d6b6adbb..42113d2b 100644 --- a/packages/histoire-controls/src/components/design-tokens/HstTokenList.story.vue +++ b/packages/histoire-controls/src/components/design-tokens/HstTokenList.story.vue @@ -1,29 +1,29 @@ <script lang="ts" setup> -import HstTokenList from './HstTokenList.vue' import type { CSSProperties } from 'vue' +import HstTokenList from './HstTokenList.vue' const tokens = { - 0: 0, - 1: '0.25rem', - 2: '0.5rem', - 3: '0.75rem', - 4: '1rem', - 5: '1.25rem', - 6: '1.5rem', - 8: '2rem', - 10: '2.5rem', - 12: '3rem', - 16: '4rem', - 20: '5rem', - 24: '6rem', - 32: '8rem', - 40: '10rem', - 48: '12rem', - 56: '14rem', - 64: '16rem', - auto: 'auto', - px: '1px', - screen: '100vw', + '0': 0, + '1': '0.25rem', + '2': '0.5rem', + '3': '0.75rem', + '4': '1rem', + '5': '1.25rem', + '6': '1.5rem', + '8': '2rem', + '10': '2.5rem', + '12': '3rem', + '16': '4rem', + '20': '5rem', + '24': '6rem', + '32': '8rem', + '40': '10rem', + '48': '12rem', + '56': '14rem', + '64': '16rem', + 'auto': 'auto', + 'px': '1px', + 'screen': '100vw', '1/2': '50%', '1/3': '33.333333%', '2/3': '66.666667%', @@ -50,7 +50,7 @@ const tokens = { '9/12': '75%', '10/12': '83.333333%', '11/12': '91.666667%', - full: '100%', + 'full': '100%', } </script> diff --git a/packages/histoire-controls/src/components/json/HstJson.story.vue b/packages/histoire-controls/src/components/json/HstJson.story.vue index 4083bf0b..109eae3a 100644 --- a/packages/histoire-controls/src/components/json/HstJson.story.vue +++ b/packages/histoire-controls/src/components/json/HstJson.story.vue @@ -1,7 +1,7 @@ <script lang="ts" setup> import HstJson from './HstJson.vue' -function initState () { +function initState() { return { film: { year: 2017, diff --git a/packages/histoire-controls/src/components/json/HstJson.vue b/packages/histoire-controls/src/components/json/HstJson.vue index d3b32c29..e794d5d6 100644 --- a/packages/histoire-controls/src/components/json/HstJson.vue +++ b/packages/histoire-controls/src/components/json/HstJson.vue @@ -6,31 +6,33 @@ export default { </script> <script lang="ts" setup> -import { ref, onMounted, watch, watchEffect } from 'vue' +import { onMounted, ref, watch, watchEffect } from 'vue' import { Icon } from '@iconify/vue' -import HstWrapper from '../HstWrapper.vue' import { VTooltip as vTooltip } from 'floating-vue' import { Compartment } from '@codemirror/state' +import type { + ViewUpdate, +} from '@codemirror/view' import { EditorView, - keymap, - highlightActiveLineGutter, highlightActiveLine, + highlightActiveLineGutter, highlightSpecialChars, - ViewUpdate, + keymap, } from '@codemirror/view' import { defaultKeymap } from '@codemirror/commands' import { json } from '@codemirror/lang-json' import { - defaultHighlightStyle, - syntaxHighlighting, - indentOnInput, bracketMatching, + defaultHighlightStyle, foldGutter, foldKeymap, + indentOnInput, + syntaxHighlighting, } from '@codemirror/language' import { lintKeymap } from '@codemirror/lint' -import { oneDarkTheme, oneDarkHighlightStyle } from '@codemirror/theme-one-dark' +import { oneDarkHighlightStyle, oneDarkTheme } from '@codemirror/theme-one-dark' +import HstWrapper from '../HstWrapper.vue' import { isDark } from '../../utils' const props = defineProps<{ @@ -94,7 +96,8 @@ watch(() => props.modelValue, () => { try { sameDocument = (JSON.stringify(JSON.parse(internalValue.value)) === JSON.stringify(props.modelValue)) - } catch (e) { + } + catch (e) { sameDocument = false } @@ -107,11 +110,11 @@ watch(() => internalValue.value, () => { invalidValue.value = false try { emit('update:modelValue', JSON.parse(internalValue.value)) - } catch (e) { + } + catch (e) { invalidValue.value = true } }) - </script> <template> diff --git a/packages/histoire-controls/src/components/number/HstNumber.story.vue b/packages/histoire-controls/src/components/number/HstNumber.story.vue index 93d6a4f6..f69c28ed 100644 --- a/packages/histoire-controls/src/components/number/HstNumber.story.vue +++ b/packages/histoire-controls/src/components/number/HstNumber.story.vue @@ -1,7 +1,7 @@ <script lang="ts" setup> import HstNumber from './HstNumber.vue' -function initState () { +function initState() { return { count: 20, step: 1, diff --git a/packages/histoire-controls/src/components/number/HstNumber.vue b/packages/histoire-controls/src/components/number/HstNumber.vue index 52e9f06f..de186a43 100644 --- a/packages/histoire-controls/src/components/number/HstNumber.vue +++ b/packages/histoire-controls/src/components/number/HstNumber.vue @@ -6,7 +6,7 @@ export default { </script> <script lang="ts" setup> -import { computed, ref, onUnmounted } from 'vue' +import { computed, onUnmounted, ref } from 'vue' import HstWrapper from '../HstWrapper.vue' const props = defineProps<{ @@ -20,14 +20,14 @@ const emit = defineEmits({ const numberModel = computed({ get: () => props.modelValue, - set: value => { + set: (value) => { emit('update:modelValue', value) }, }) const input = ref<HTMLInputElement>() -function focusAndSelect () { +function focusAndSelect() { input.value.focus() input.value.select() } @@ -38,7 +38,7 @@ const isDragging = ref(false) let startX: number let startValue: number -function onMouseDown (event: MouseEvent) { +function onMouseDown(event: MouseEvent) { isDragging.value = true startX = event.clientX startValue = numberModel.value @@ -46,15 +46,15 @@ function onMouseDown (event: MouseEvent) { window.addEventListener('mouseup', stopDragging) } -function onMouseMove (event: MouseEvent) { - let step = parseFloat(input.value.step) - if (isNaN(step)) { +function onMouseMove(event: MouseEvent) { + let step = Number.parseFloat(input.value.step) + if (Number.isNaN(step)) { step = 1 } numberModel.value = startValue + Math.round((event.clientX - startX) / 10 / step) * step } -function stopDragging () { +function stopDragging() { isDragging.value = false window.removeEventListener('mousemove', onMouseMove) window.removeEventListener('mouseup', stopDragging) diff --git a/packages/histoire-controls/src/components/radio/HstRadio.story.vue b/packages/histoire-controls/src/components/radio/HstRadio.story.vue index ad3ddd7b..66f1e18e 100644 --- a/packages/histoire-controls/src/components/radio/HstRadio.story.vue +++ b/packages/histoire-controls/src/components/radio/HstRadio.story.vue @@ -14,7 +14,7 @@ const objectOptions = Object.keys(options).map(key => ({ value: key, })) -function initState () { +function initState() { return { character: flatOptions[0], } diff --git a/packages/histoire-controls/src/components/radio/HstRadio.vue b/packages/histoire-controls/src/components/radio/HstRadio.vue index 5c89e3ab..aed72347 100644 --- a/packages/histoire-controls/src/components/radio/HstRadio.vue +++ b/packages/histoire-controls/src/components/radio/HstRadio.vue @@ -5,9 +5,10 @@ export default { </script> <script lang="ts" setup> -import { computed, ComputedRef, ref } from 'vue' +import type { ComputedRef } from 'vue' +import { computed, ref } from 'vue' import HstWrapper from '../HstWrapper.vue' -import { HstControlOption } from '../../types' +import type { HstControlOption } from '../../types' const props = defineProps<{ title?: string @@ -20,7 +21,8 @@ const formattedOptions: ComputedRef<Record<string, string>> = computed(() => { return Object.fromEntries(props.options.map((value: string | HstControlOption) => { if (typeof value === 'string') { return [value, value] - } else { + } + else { return [value.value, value.label] } })) @@ -32,7 +34,7 @@ const emit = defineEmits<{ (e: 'update:modelValue', value: string): void }>() -function selectOption (value: string) { +function selectOption(value: string) { emit('update:modelValue', value) animationEnabled.value = true } @@ -51,7 +53,7 @@ const animationEnabled = ref(false) > <div class="-htw-my-1"> <template - v-for="( label, value ) in formattedOptions" + v-for="(label, value) in formattedOptions" :key="value" > <input diff --git a/packages/histoire-controls/src/components/select/CustomSelect.vue b/packages/histoire-controls/src/components/select/CustomSelect.vue index 20bb1d80..01f7bb83 100644 --- a/packages/histoire-controls/src/components/select/CustomSelect.vue +++ b/packages/histoire-controls/src/components/select/CustomSelect.vue @@ -6,9 +6,10 @@ export default { <script lang="ts" setup> import { Dropdown as VDropdown } from 'floating-vue' -import { computed, ComputedRef } from 'vue' +import type { ComputedRef } from 'vue' +import { computed } from 'vue' import { Icon } from '@iconify/vue' -import { HstControlOption } from '../../types' +import type { HstControlOption } from '../../types' const props = defineProps<{ modelValue: string @@ -21,21 +22,23 @@ const emit = defineEmits<{ const formattedOptions: ComputedRef<[any, string][]> = computed(() => { if (Array.isArray(props.options)) { - return props.options.map(option => { + return props.options.map((option) => { if (typeof option === 'string' || typeof option === 'number') { return [option, String(option)] as [any, string] - } else { + } + else { return [option.value, option.label] as [any, string] } }) - } else { + } + else { return Object.entries(props.options) } }) const selectedLabel = computed(() => formattedOptions.value.find(([value]) => value === props.modelValue)?.[1]) -function selectValue (value: any, hide: () => void) { +function selectValue(value: any, hide: () => void) { emit('update:modelValue', value) hide() } @@ -113,5 +116,4 @@ function selectValue (value: any, hide: () => void) { .v-popper__popper:focus-visible { outline: none; } - </style> diff --git a/packages/histoire-controls/src/components/select/HstSelect.story.vue b/packages/histoire-controls/src/components/select/HstSelect.story.vue index f946a8af..dac2a3fe 100644 --- a/packages/histoire-controls/src/components/select/HstSelect.story.vue +++ b/packages/histoire-controls/src/components/select/HstSelect.story.vue @@ -16,7 +16,7 @@ const objectOptions = Object.keys(options).map(key => ({ const numberOptions = [0, 1, 2, 3, 4, 5] -function initState () { +function initState() { return { label: 'My really long label', select: 'crash-bandicoot', diff --git a/packages/histoire-controls/src/components/select/HstSelect.vue b/packages/histoire-controls/src/components/select/HstSelect.vue index 806d854a..32c806dc 100644 --- a/packages/histoire-controls/src/components/select/HstSelect.vue +++ b/packages/histoire-controls/src/components/select/HstSelect.vue @@ -6,8 +6,8 @@ export default { <script lang="ts" setup> import HstWrapper from '../HstWrapper.vue' +import type { HstControlOption } from '../../types' import CustomSelect from './CustomSelect.vue' -import { HstControlOption } from '../../types' defineProps<{ title?: string diff --git a/packages/histoire-controls/src/components/slider/HstSlider.vue b/packages/histoire-controls/src/components/slider/HstSlider.vue index 5e3b9d34..8ce1f496 100644 --- a/packages/histoire-controls/src/components/slider/HstSlider.vue +++ b/packages/histoire-controls/src/components/slider/HstSlider.vue @@ -8,8 +8,8 @@ export default { <script lang="ts" setup> import { computed, ref } from 'vue' import type { CSSProperties } from 'vue' -import HstWrapper from '../HstWrapper.vue' import { VTooltip as vTooltip } from 'floating-vue' +import HstWrapper from '../HstWrapper.vue' const props = defineProps<{ title?: string @@ -27,7 +27,7 @@ const input = ref<HTMLInputElement>(null) const numberModel = computed({ get: () => props.modelValue, - set: value => { + set: (value) => { emit('update:modelValue', value) }, }) @@ -41,7 +41,7 @@ const tooltipStyle = computed<CSSProperties>(() => { if (input.value) { const position = gap + ((input.value.clientWidth - 2 * gap) * percentage.value) return { - left: position + 'px', + left: `${position}px`, } } return {} diff --git a/packages/histoire-controls/src/components/text/HstText.story.vue b/packages/histoire-controls/src/components/text/HstText.story.vue index acc5b862..be258b3d 100644 --- a/packages/histoire-controls/src/components/text/HstText.story.vue +++ b/packages/histoire-controls/src/components/text/HstText.story.vue @@ -1,7 +1,7 @@ <script lang="ts" setup> import HstText from './HstText.vue' -function initState () { +function initState() { return { label: 'My really long label', text: '', diff --git a/packages/histoire-controls/src/components/textarea/HstTextarea.story.vue b/packages/histoire-controls/src/components/textarea/HstTextarea.story.vue index cc7260ae..8389b690 100644 --- a/packages/histoire-controls/src/components/textarea/HstTextarea.story.vue +++ b/packages/histoire-controls/src/components/textarea/HstTextarea.story.vue @@ -1,7 +1,7 @@ <script lang="ts" setup> import HstTextarea from './HstTextarea.vue' -function initState () { +function initState() { return { text: '', } diff --git a/packages/histoire-controls/tailwind.config.cjs b/packages/histoire-controls/tailwind.config.cjs index d023fbed..242c58cc 100644 --- a/packages/histoire-controls/tailwind.config.cjs +++ b/packages/histoire-controls/tailwind.config.cjs @@ -1,4 +1,4 @@ -const path = require('path') +const path = require('node:path') const inheritedConfig = require('../../tailwind.config.cjs') module.exports = { diff --git a/packages/histoire-controls/tsconfig.json b/packages/histoire-controls/tsconfig.json index 95eff691..c928f849 100644 --- a/packages/histoire-controls/tsconfig.json +++ b/packages/histoire-controls/tsconfig.json @@ -1,34 +1,16 @@ { "compilerOptions": { "target": "ESNext", - "module": "ESNext", - "moduleResolution": "node", - "outDir": "dist", - "rootDir": "src", - "baseUrl": ".", - "allowSyntheticDefaultImports": true, - "esModuleInterop": true, - "removeComments": false, - "resolveJsonModule": true, - "skipLibCheck": true, - "types": [ - "node" - ], + // Volar + "jsx": "preserve", "lib": [ "ESNext", "DOM" ], - "sourceMap": false, - "preserveWatchOutput": true, - "preserveSymlinks": true, - // Strict - "noImplicitAny": false, - "noImplicitThis": true, - "alwaysStrict": true, - "strictBindCallApply": true, - "strictFunctionTypes": true, - // Volar - "jsx": "preserve", + "baseUrl": ".", + "rootDir": "src", + "module": "ESNext", + "moduleResolution": "node", // Alias "paths": { "floating-vue": ["./node_modules/@histoire/vendors/floating-vue"], @@ -38,7 +20,25 @@ "vue-router": ["./node_modules/@histoire/vendors/vue-router"], "@vueuse/core": ["./node_modules/@histoire/vendors/vue-use"], "vue": ["./node_modules/@histoire/vendors/vue"] - } + }, + "resolveJsonModule": true, + "types": [ + "node" + ], + "strictBindCallApply": true, + "strictFunctionTypes": true, + "alwaysStrict": true, + // Strict + "noImplicitAny": false, + "noImplicitThis": true, + "outDir": "dist", + "removeComments": false, + "sourceMap": false, + "allowSyntheticDefaultImports": true, + "esModuleInterop": true, + "preserveSymlinks": true, + "skipLibCheck": true, + "preserveWatchOutput": true }, "include": [ "src" diff --git a/packages/histoire-controls/vite.config.ts b/packages/histoire-controls/vite.config.ts index e174a987..b4a599ad 100644 --- a/packages/histoire-controls/vite.config.ts +++ b/packages/histoire-controls/vite.config.ts @@ -11,14 +11,14 @@ export default defineConfig({ alias: process.env.VITEST ? {} : { - 'floating-vue': '@histoire/vendors/floating-vue', - '@iconify/vue': '@histoire/vendors/iconify', - pinia: '@histoire/vendors/pinia', - 'scroll-into-view-if-needed': '@histoire/vendors/scroll', - 'vue-router': '@histoire/vendors/vue-router', - '@vueuse/core': '@histoire/vendors/vue-use', - vue: '@histoire/vendors/vue', - }, + 'floating-vue': '@histoire/vendors/floating-vue', + '@iconify/vue': '@histoire/vendors/iconify', + 'pinia': '@histoire/vendors/pinia', + 'scroll-into-view-if-needed': '@histoire/vendors/scroll', + 'vue-router': '@histoire/vendors/vue-router', + '@vueuse/core': '@histoire/vendors/vue-use', + 'vue': '@histoire/vendors/vue', + }, }, build: { diff --git a/packages/histoire-plugin-nuxt/package.json b/packages/histoire-plugin-nuxt/package.json index 544684a2..4696ced2 100644 --- a/packages/histoire-plugin-nuxt/package.json +++ b/packages/histoire-plugin-nuxt/package.json @@ -1,11 +1,12 @@ { "name": "@histoire/plugin-nuxt", + "type": "module", "version": "0.17.16", "description": "Histoire plugin to integrate with Nuxt 3", - "license": "MIT", "author": { "name": "Guillaume Chau" }, + "license": "MIT", "repository": { "url": "https://github.com/Akryum/histoire.git", "type": "git", @@ -14,7 +15,6 @@ "publishConfig": { "access": "public" }, - "type": "module", "exports": { ".": "./dist/index.js", "./*": "./*" @@ -26,6 +26,11 @@ "build": "rimraf dist && tsc -d", "watch": "tsc -d -w --sourceMap" }, + "peerDependencies": { + "@histoire/plugin-vue": "workspace:^", + "histoire": "workspace:^", + "nuxt": "^3.0.0-rc.11" + }, "dependencies": { "@nuxt/kit": "^3.8.2", "@rollup/plugin-replace": "^5.0.5", @@ -37,12 +42,7 @@ "@nuxt/schema": "^3.8.2", "@types/node": "^18.11.9", "histoire": "workspace:*", - "typescript": "^4.9.5", + "typescript": "^5.4.4", "vite": "^5.0.11" - }, - "peerDependencies": { - "@histoire/plugin-vue": "workspace:^", - "histoire": "workspace:^", - "nuxt": "^3.0.0-rc.11" } } diff --git a/packages/histoire-plugin-nuxt/runtime/app-component.mjs b/packages/histoire-plugin-nuxt/runtime/app-component.mjs index 1df85568..06b8116b 100644 --- a/packages/histoire-plugin-nuxt/runtime/app-component.mjs +++ b/packages/histoire-plugin-nuxt/runtime/app-component.mjs @@ -1,3 +1,3 @@ -export default function render () { +export default function render() { return null } diff --git a/packages/histoire-plugin-nuxt/runtime/components.mjs b/packages/histoire-plugin-nuxt/runtime/components.mjs index af43c650..4de7aa45 100644 --- a/packages/histoire-plugin-nuxt/runtime/components.mjs +++ b/packages/histoire-plugin-nuxt/runtime/components.mjs @@ -5,7 +5,7 @@ export const NuxtLink = defineComponent({ props: { to: [String, Object], }, - setup (props, ctx) { + setup(props, ctx) { return () => h('a', { href: typeof props.to === 'string' ? props.to : '#', ...ctx.attrs, diff --git a/packages/histoire-plugin-nuxt/runtime/composables.mjs b/packages/histoire-plugin-nuxt/runtime/composables.mjs index 991e03d7..9b9a4d8d 100644 --- a/packages/histoire-plugin-nuxt/runtime/composables.mjs +++ b/packages/histoire-plugin-nuxt/runtime/composables.mjs @@ -1 +1 @@ -export const useNuxtApp = () => ({ runWithContext: async (fn) => await fn() }) +export const useNuxtApp = () => ({ runWithContext: async fn => await fn() }) diff --git a/packages/histoire-plugin-nuxt/src/index.ts b/packages/histoire-plugin-nuxt/src/index.ts index 4c375cfb..b284eeaf 100644 --- a/packages/histoire-plugin-nuxt/src/index.ts +++ b/packages/histoire-plugin-nuxt/src/index.ts @@ -14,12 +14,12 @@ const ignorePlugins = [ 'nuxt:import-protection', ] -export function HstNuxt (): Plugin { +export function HstNuxt(): Plugin { let nuxt: Nuxt return { name: '@histoire/plugin-nuxt', - async defaultConfig () { + async defaultConfig() { const nuxtViteConfig = await useNuxtViteConfig() const { viteConfig } = nuxtViteConfig @@ -93,23 +93,23 @@ export async function setupVue3 () { } }, - onDev (api, onCleanup) { + onDev(api, onCleanup) { onCleanup(async () => { nuxt?.close() }) }, - onBuild () { + onBuild() { nuxt?.close() }, - onPreview () { + onPreview() { nuxt?.close() }, } } -async function useNuxtViteConfig () { +async function useNuxtViteConfig() { const { loadNuxt, buildNuxt } = await import('@nuxt/kit') const nuxt = await loadNuxt({ // cwd: process.cwd(), @@ -139,12 +139,12 @@ async function useNuxtViteConfig () { { src: join(runtimeDir, 'components.mjs'), filename: 'histoire/components.mjs' }, ) - nuxt.hook('app:templates', app => { + nuxt.hook('app:templates', (app) => { app.templates = app.templates.filter(template => template.filename !== 'app-component.mjs') app.templates.push({ src: join(runtimeDir, 'app-component.mjs'), filename: 'app-component.mjs' }) }) - nuxt.hook('imports:sources', presets => { + nuxt.hook('imports:sources', (presets) => { const stubbedComposables = ['useNuxtApp'] for (const appPreset of presets.filter(p => p.from?.startsWith('#app'))) { appPreset.imports = appPreset.imports.filter(i => typeof i !== 'string' || !stubbedComposables.includes(i)) @@ -175,7 +175,7 @@ async function useNuxtViteConfig () { }) nuxt.ready() .then(() => buildNuxt(nuxt)) - .catch(err => { + .catch((err) => { if (!err.toString().includes('_stop_')) { reject(err) } diff --git a/packages/histoire-plugin-nuxt/src/runtime/app-setup.ts b/packages/histoire-plugin-nuxt/src/runtime/app-setup.ts index 167f6f20..09100641 100644 --- a/packages/histoire-plugin-nuxt/src/runtime/app-setup.ts +++ b/packages/histoire-plugin-nuxt/src/runtime/app-setup.ts @@ -1,9 +1,9 @@ -import { PublicRuntimeConfig } from '@nuxt/schema' +import type { PublicRuntimeConfig } from '@nuxt/schema' import type { App } from 'h3' import { createApp } from 'h3' import { createFetch } from 'ofetch' -export async function setupNuxtApp (publicConfig: PublicRuntimeConfig) { +export async function setupNuxtApp(publicConfig: PublicRuntimeConfig) { const win = window as unknown as Window & { __app: App __registry: Set<string> @@ -29,10 +29,10 @@ export async function setupNuxtApp (publicConfig: PublicRuntimeConfig) { app.id = 'nuxt-test' win.document.body.appendChild(app) - win.IntersectionObserver = - win.IntersectionObserver || - class IntersectionObserver { - observe () { + win.IntersectionObserver + = win.IntersectionObserver + || class IntersectionObserver { + observe() { // noop } } @@ -55,7 +55,7 @@ export async function setupNuxtApp (publicConfig: PublicRuntimeConfig) { win.fetch = (init: string, options?: any) => { if (typeof init === 'string' && registry.has(init)) { - init = '/_' + init + init = `/_${init}` } return localFetch(init, options) } @@ -66,7 +66,7 @@ export async function setupNuxtApp (publicConfig: PublicRuntimeConfig) { win.__registry = registry win.__app = h3App - // @ts-ignore + // @ts-expect-error no types const result = await import('#app/entry') await result.default() } diff --git a/packages/histoire-plugin-nuxt/tsconfig.json b/packages/histoire-plugin-nuxt/tsconfig.json index d2eaabe6..7bc11641 100644 --- a/packages/histoire-plugin-nuxt/tsconfig.json +++ b/packages/histoire-plugin-nuxt/tsconfig.json @@ -1,32 +1,32 @@ { "compilerOptions": { "target": "ESNext", + // Volar + "jsx": "preserve", + "lib": [ + "ESNext", + "DOM" + ], + "rootDir": "src", "module": "ESNext", "moduleResolution": "node", - "outDir": "dist", - "rootDir": "src", - "allowSyntheticDefaultImports": true, - "esModuleInterop": true, - "removeComments": false, "resolveJsonModule": true, - "skipLibCheck": true, "types": [ "node" ], - "lib": [ - "ESNext", - "DOM" - ], - "sourceMap": false, - "preserveWatchOutput": true, + "strictBindCallApply": true, + "strictFunctionTypes": true, + "alwaysStrict": true, // Strict "noImplicitAny": false, "noImplicitThis": true, - "alwaysStrict": true, - "strictBindCallApply": true, - "strictFunctionTypes": true, - // Volar - "jsx": "preserve", + "outDir": "dist", + "removeComments": false, + "sourceMap": false, + "allowSyntheticDefaultImports": true, + "esModuleInterop": true, + "skipLibCheck": true, + "preserveWatchOutput": true }, "include": [ "src" diff --git a/packages/histoire-plugin-percy/README.md b/packages/histoire-plugin-percy/README.md index c1ce9990..4f24878f 100644 --- a/packages/histoire-plugin-percy/README.md +++ b/packages/histoire-plugin-percy/README.md @@ -2,7 +2,6 @@ You need the [Percy CLI](https://docs.percy.io/docs/cli-overview) installed to be able to send snapshots to Percy. - ```bash pnpm add -D @histoire/plugin-percy ``` diff --git a/packages/histoire-plugin-percy/package.json b/packages/histoire-plugin-percy/package.json index 468cf74d..112d94ae 100644 --- a/packages/histoire-plugin-percy/package.json +++ b/packages/histoire-plugin-percy/package.json @@ -1,11 +1,12 @@ { "name": "@histoire/plugin-percy", + "type": "module", "version": "0.17.16", "description": "Histoire plugin to take screenshots with Percy for visual regression testing", - "license": "MIT", "author": { "name": "Guillaume Chau" }, + "license": "MIT", "repository": { "url": "https://github.com/Akryum/histoire.git", "type": "git", @@ -14,7 +15,6 @@ "publishConfig": { "access": "public" }, - "type": "module", "exports": { ".": "./dist/index.js", "./*": "./*" @@ -26,6 +26,9 @@ "build": "rimraf dist && tsc -d", "watch": "tsc -d -w --sourceMap" }, + "peerDependencies": { + "histoire": "workspace:^" + }, "dependencies": { "@percy/sdk-utils": "^1.27.4", "defu": "^6.1.3", @@ -36,9 +39,6 @@ "devDependencies": { "@types/node": "^18.11.9", "histoire": "workspace:*", - "typescript": "^4.9.5" - }, - "peerDependencies": { - "histoire": "workspace:^" + "typescript": "^5.4.4" } } diff --git a/packages/histoire-plugin-percy/src/index.ts b/packages/histoire-plugin-percy/src/index.ts index 78fa658b..dd22c32e 100644 --- a/packages/histoire-plugin-percy/src/index.ts +++ b/packages/histoire-plugin-percy/src/index.ts @@ -1,9 +1,9 @@ +import { fileURLToPath } from 'node:url' +import { createRequire } from 'node:module' import type { Plugin } from 'histoire' import { defu } from 'defu' import path from 'pathe' -import { fileURLToPath } from 'node:url' -import { createRequire } from 'node:module' -import { isPercyEnabled, fetchPercyDOM, postSnapshot } from '@percy/sdk-utils' +import { fetchPercyDOM, isPercyEnabled, postSnapshot } from '@percy/sdk-utils' import type { JSONObject, Page, WaitForOptions } from 'puppeteer' const __dirname = path.dirname(fileURLToPath(import.meta.url)) @@ -32,15 +32,15 @@ export interface PercySnapshotOptions { }> } -export type PagePayload = { +export interface PagePayload { file: string story: { title: string } variant: { id: string, title: string } -}; +} type ContructorOption<T extends object | number> = | T - | ((payload: PagePayload) => T); + | ((payload: PagePayload) => T) export interface PercyPluginOptions { /** @@ -61,9 +61,9 @@ export interface PercyPluginOptions { * Navigation Parameter */ pptrOptions?: ContructorOption< - WaitForOptions & { - referer?: string - } + WaitForOptions & { + referer?: string + } > /** @@ -85,14 +85,14 @@ const defaultOptions: PercyPluginOptions = { pptrOptions: {}, } -function resolveOptions<T extends object | number> ( +function resolveOptions<T extends object | number>( option: ContructorOption<T>, payload: PagePayload, ): T { return typeof option === 'function' ? option(payload) : option } -export function HstPercy (options: PercyPluginOptions = {}): Plugin { +export function HstPercy(options: PercyPluginOptions = {}): Plugin { const finalOptions: PercyPluginOptions = defu(options, defaultOptions) return { name: '@histoire/plugin-percy', @@ -134,7 +134,7 @@ export function HstPercy (options: PercyPluginOptions = {}): Plugin { const page = await browser.newPage() await page.goto(url, pptrOptions) - await new Promise((resolve) => setTimeout(resolve, pptrWait)) + await new Promise(resolve => setTimeout(resolve, pptrWait)) if (finalOptions.beforeSnapshot) { const result = await finalOptions.beforeSnapshot(page, payload) diff --git a/packages/histoire-plugin-percy/tsconfig.json b/packages/histoire-plugin-percy/tsconfig.json index d2eaabe6..7bc11641 100644 --- a/packages/histoire-plugin-percy/tsconfig.json +++ b/packages/histoire-plugin-percy/tsconfig.json @@ -1,32 +1,32 @@ { "compilerOptions": { "target": "ESNext", + // Volar + "jsx": "preserve", + "lib": [ + "ESNext", + "DOM" + ], + "rootDir": "src", "module": "ESNext", "moduleResolution": "node", - "outDir": "dist", - "rootDir": "src", - "allowSyntheticDefaultImports": true, - "esModuleInterop": true, - "removeComments": false, "resolveJsonModule": true, - "skipLibCheck": true, "types": [ "node" ], - "lib": [ - "ESNext", - "DOM" - ], - "sourceMap": false, - "preserveWatchOutput": true, + "strictBindCallApply": true, + "strictFunctionTypes": true, + "alwaysStrict": true, // Strict "noImplicitAny": false, "noImplicitThis": true, - "alwaysStrict": true, - "strictBindCallApply": true, - "strictFunctionTypes": true, - // Volar - "jsx": "preserve", + "outDir": "dist", + "removeComments": false, + "sourceMap": false, + "allowSyntheticDefaultImports": true, + "esModuleInterop": true, + "skipLibCheck": true, + "preserveWatchOutput": true }, "include": [ "src" diff --git a/packages/histoire-plugin-screenshot/README.md b/packages/histoire-plugin-screenshot/README.md index 3fdeee40..a11c0e5a 100644 --- a/packages/histoire-plugin-screenshot/README.md +++ b/packages/histoire-plugin-screenshot/README.md @@ -24,7 +24,6 @@ export default defineConfig({ If you get an error like No usable sandbox! or Running as root without --no-sandbox is not supported, you need to properly set up sandboxing on your Linux instance. Alternatively, if you completely trust the content, you can disable sandboxing (strongly discouraged): - ref. https://github.com/sindresorhus/capture-website#faq ``` @@ -39,4 +38,3 @@ export default defineConfig({ ], }) ``` - diff --git a/packages/histoire-plugin-screenshot/package.json b/packages/histoire-plugin-screenshot/package.json index ab713af6..d897e588 100644 --- a/packages/histoire-plugin-screenshot/package.json +++ b/packages/histoire-plugin-screenshot/package.json @@ -1,11 +1,12 @@ { "name": "@histoire/plugin-screenshot", + "type": "module", "version": "0.17.16", "description": "Histoire plugin to take screenshots for visual regression testing", - "license": "MIT", "author": { "name": "Guillaume Chau" }, + "license": "MIT", "repository": { "url": "https://github.com/Akryum/histoire.git", "type": "git", @@ -14,7 +15,6 @@ "publishConfig": { "access": "public" }, - "type": "module", "exports": { ".": "./dist/index.js", "./*": "./*" @@ -26,6 +26,9 @@ "build": "rimraf dist && tsc -d", "watch": "tsc -d -w --sourceMap" }, + "peerDependencies": { + "histoire": "workspace:^" + }, "dependencies": { "capture-website": "^2.4.1", "defu": "^6.1.3", @@ -35,9 +38,6 @@ "devDependencies": { "@types/node": "^18.11.9", "histoire": "workspace:*", - "typescript": "^4.9.5" - }, - "peerDependencies": { - "histoire": "workspace:^" + "typescript": "^5.4.4" } } diff --git a/packages/histoire-plugin-screenshot/src/index.ts b/packages/histoire-plugin-screenshot/src/index.ts index 86cc2664..aa2308d6 100644 --- a/packages/histoire-plugin-screenshot/src/index.ts +++ b/packages/histoire-plugin-screenshot/src/index.ts @@ -39,7 +39,7 @@ const defaultOptions: ScreenshotPluginOptions = { presets: [], } -export function HstScreenshot (options: ScreenshotPluginOptions = {}): Plugin { +export function HstScreenshot(options: ScreenshotPluginOptions = {}): Plugin { const finalOptions: ScreenshotPluginOptions = defu(options, defaultOptions) if (!finalOptions.presets.length) { finalOptions.presets.push({ @@ -50,7 +50,7 @@ export function HstScreenshot (options: ScreenshotPluginOptions = {}): Plugin { return { name: '@histoire/plugin-screenshot', - onBuild: async api => { + onBuild: async (api) => { const { default: captureWebsite } = await import('capture-website') await fs.ensureDir(finalOptions.saveFolder) @@ -71,8 +71,8 @@ export function HstScreenshot (options: ScreenshotPluginOptions = {}): Plugin { for (const preset of finalOptions.presets) { const launchOptions = finalOptions.launchOptionsArgs ? { - args: finalOptions.launchOptionsArgs, - } + args: finalOptions.launchOptionsArgs, + } : {} const captureWebsiteFileOptions: FileOptions = { overwrite: true, diff --git a/packages/histoire-plugin-screenshot/tsconfig.json b/packages/histoire-plugin-screenshot/tsconfig.json index d2eaabe6..7bc11641 100644 --- a/packages/histoire-plugin-screenshot/tsconfig.json +++ b/packages/histoire-plugin-screenshot/tsconfig.json @@ -1,32 +1,32 @@ { "compilerOptions": { "target": "ESNext", + // Volar + "jsx": "preserve", + "lib": [ + "ESNext", + "DOM" + ], + "rootDir": "src", "module": "ESNext", "moduleResolution": "node", - "outDir": "dist", - "rootDir": "src", - "allowSyntheticDefaultImports": true, - "esModuleInterop": true, - "removeComments": false, "resolveJsonModule": true, - "skipLibCheck": true, "types": [ "node" ], - "lib": [ - "ESNext", - "DOM" - ], - "sourceMap": false, - "preserveWatchOutput": true, + "strictBindCallApply": true, + "strictFunctionTypes": true, + "alwaysStrict": true, // Strict "noImplicitAny": false, "noImplicitThis": true, - "alwaysStrict": true, - "strictBindCallApply": true, - "strictFunctionTypes": true, - // Volar - "jsx": "preserve", + "outDir": "dist", + "removeComments": false, + "sourceMap": false, + "allowSyntheticDefaultImports": true, + "esModuleInterop": true, + "skipLibCheck": true, + "preserveWatchOutput": true }, "include": [ "src" diff --git a/packages/histoire-plugin-svelte/package.json b/packages/histoire-plugin-svelte/package.json index b5bfe1cb..0d81de12 100644 --- a/packages/histoire-plugin-svelte/package.json +++ b/packages/histoire-plugin-svelte/package.json @@ -1,11 +1,12 @@ { "name": "@histoire/plugin-svelte", + "type": "module", "version": "0.17.16", "description": "Histoire plugin for Svelte support", - "license": "MIT", "author": { "name": "Guillaume Chau" }, + "license": "MIT", "repository": { "url": "https://github.com/Akryum/histoire.git", "type": "git", @@ -14,7 +15,6 @@ "publishConfig": { "access": "public" }, - "type": "module", "exports": { "./client": { "types": "./dist/client/index.d.ts", @@ -38,6 +38,10 @@ "build:types": "tsc --declaration --emitDeclarationOnly", "watch": "concurrently \"vite build --watch\" \"tsc -d -P tsconfig.build.json --watch\" \"pnpm run build:types --watch\"" }, + "peerDependencies": { + "histoire": "workspace:^", + "svelte": "^3.0.0 || ^4.0.0" + }, "dependencies": { "@histoire/controls": "workspace:^", "@histoire/shared": "workspace:^", @@ -48,19 +52,15 @@ "pathe": "^1.1.1" }, "devDependencies": { - "@sveltejs/vite-plugin-svelte": "^1.4.0", + "@sveltejs/vite-plugin-svelte": "^3.0.2", "@types/node": "^18.11.9", "concurrently": "^7.6.0", "fs-extra": "^10.1.0", "globby": "^13.1.1", "histoire": "workspace:*", - "svelte": "^4.2.7", - "svelte-preprocess": "^4.10.7", - "typescript": "^4.9.5", + "svelte": "^4.2.12", + "svelte-preprocess": "^5.1.3", + "typescript": "^5.4.4", "vite": "^5.0.11" - }, - "peerDependencies": { - "histoire": "workspace:^", - "svelte": "^3.0.0 || ^4.0.0" } } diff --git a/packages/histoire-plugin-svelte/src/client/index.ts b/packages/histoire-plugin-svelte/src/client/index.ts index 64238010..a807c5f6 100644 --- a/packages/histoire-plugin-svelte/src/client/index.ts +++ b/packages/histoire-plugin-svelte/src/client/index.ts @@ -7,6 +7,6 @@ declare module '@histoire/shared' { } } -export function generateSourceCode () { +export function generateSourceCode() { // noop } diff --git a/packages/histoire-plugin-svelte/src/client/mount.ts b/packages/histoire-plugin-svelte/src/client/mount.ts index 095a6687..25b17721 100644 --- a/packages/histoire-plugin-svelte/src/client/mount.ts +++ b/packages/histoire-plugin-svelte/src/client/mount.ts @@ -1,14 +1,14 @@ -/* eslint-disable vue/one-component-per-file */ - -import { SvelteComponent } from 'svelte' +import type { SvelteComponent } from 'svelte' +import type { + PropType as _PropType, +} from '@histoire/vendors/vue' import { defineComponent as _defineComponent, - PropType as _PropType, + h as _h, onMounted as _onMounted, onUnmounted as _onUnmounted, ref as _ref, watch as _watch, - h as _h, } from '@histoire/vendors/vue' import type { Story } from '@histoire/shared' import { components } from '@histoire/controls' @@ -16,10 +16,10 @@ import { components } from '@histoire/controls' import * as setup from 'virtual:$histoire-setup' // @ts-expect-error virtual module id import * as generatedSetup from 'virtual:$histoire-generated-global-setup' +import type { SvelteStorySetupApi } from '../helpers.js' import MountStorySvelte from './MountStory.svelte' import MountVariantSvelte from './MountVariant.svelte' import StubComponent from './Stub.svelte' -import type { SvelteStorySetupApi } from '../helpers.js' export default _defineComponent({ name: 'MountStory', @@ -31,12 +31,12 @@ export default _defineComponent({ }, }, - setup (props) { + setup(props) { const el = _ref<HTMLDivElement>() let app: SvelteComponent let target: HTMLDivElement - async function mountStory () { + async function mountStory() { target = document.createElement('div') el.value.appendChild(target) @@ -45,9 +45,7 @@ export default _defineComponent({ target, props: { Hst: { - // @ts-ignore Story: MountStorySvelte, - // @ts-ignore Variant: MountVariantSvelte, ...getControls(), }, @@ -82,7 +80,7 @@ export default _defineComponent({ } } - function unmountStory () { + function unmountStory() { app?.$destroy() if (target) { target.parentNode?.removeChild(target) @@ -108,14 +106,14 @@ export default _defineComponent({ } }, - render () { + render() { return _h('div', { ref: 'el', }) }, }) -function getControls () { +function getControls() { const result: Record<string, any> = {} for (const key in components) { result[key.substring(3)] = StubComponent diff --git a/packages/histoire-plugin-svelte/src/client/render.ts b/packages/histoire-plugin-svelte/src/client/render.ts index 5a07f9d8..bd036603 100644 --- a/packages/histoire-plugin-svelte/src/client/render.ts +++ b/packages/histoire-plugin-svelte/src/client/render.ts @@ -1,14 +1,14 @@ -/* eslint-disable vue/one-component-per-file */ - -import { SvelteComponent } from 'svelte' +import type { SvelteComponent } from 'svelte' +import type { + PropType as _PropType, +} from '@histoire/vendors/vue' import { defineComponent as _defineComponent, - PropType as _PropType, + h as _h, onMounted as _onMounted, onUnmounted as _onUnmounted, ref as _ref, watch as _watch, - h as _h, } from '@histoire/vendors/vue' import type { Story, Variant } from '@histoire/shared' import { components } from '@histoire/controls' @@ -16,11 +16,11 @@ import { components } from '@histoire/controls' import * as setup from 'virtual:$histoire-setup' // @ts-expect-error virtual module id import * as generatedSetup from 'virtual:$histoire-generated-global-setup' +import type { SvelteStorySetupApi } from '../helpers.js' import RenderStorySvelte from './RenderStory.svelte' import RenderVariantSvelte from './RenderVariant.svelte' import Wrap from './Wrap.svelte' import { syncState } from './util' -import type { SvelteStorySetupApi } from '../helpers.js' export default _defineComponent({ name: 'RenderStory', @@ -42,14 +42,14 @@ export default _defineComponent({ }, }, - setup (props, { emit }) { + setup(props, { emit }) { const el = _ref<HTMLDivElement>() let app: SvelteComponent let target: HTMLDivElement let tearDownHandlers: (() => void)[] = [] - function documentOn (event, cb) { + function documentOn(event, cb) { document.addEventListener(event, cb) const off = () => document.removeEventListener(event, cb) tearDownHandlers.push(off) @@ -58,12 +58,12 @@ export default _defineComponent({ } } - async function mountStory () { + async function mountStory() { target = document.createElement('div') el.value.appendChild(target) let components = [] - const { off: registerComponentOff } = documentOn('SvelteRegisterComponent', e => { + const { off: registerComponentOff } = documentOn('SvelteRegisterComponent', (e) => { const { component } = e.detail components.push(component) }) @@ -73,9 +73,7 @@ export default _defineComponent({ target, props: { Hst: { - // @ts-ignore Story: RenderStorySvelte, - // @ts-ignore Variant: RenderVariantSvelte, ...getControls(), }, @@ -92,7 +90,7 @@ export default _defineComponent({ components = [] // Svelte on_hrm callbacks are buggy so we patch the hmr replace instead - function patchReplace () { + function patchReplace() { const origReplace = appComponent.$replace if (!origReplace) return appComponent.$replace = (...args) => { @@ -110,7 +108,7 @@ export default _defineComponent({ }) tearDownHandlers.push(stop) - function watchState () { + function watchState() { appComponent.$$.after_update.push(() => { apply(appComponent.$capture_state()) }) @@ -149,7 +147,7 @@ export default _defineComponent({ emit('ready') } - function unmountStory () { + function unmountStory() { app?.$destroy() if (target) { target.parentNode?.removeChild(target) @@ -177,14 +175,14 @@ export default _defineComponent({ } }, - render () { + render() { return _h('div', { ref: 'el', }) }, }) -function getControls () { +function getControls() { const result: Record<string, any> = {} for (const key in components) { result[key.substring(3)] = wrapComponent(components[key]) @@ -192,8 +190,8 @@ function getControls () { return result } -function wrapComponent (controlComponent) { - function ProxyWrap (options) { +function wrapComponent(controlComponent) { + function ProxyWrap(options) { return new Wrap({ ...options, props: { diff --git a/packages/histoire-plugin-svelte/src/client/util.ts b/packages/histoire-plugin-svelte/src/client/util.ts index 42f8e680..b09a39c4 100644 --- a/packages/histoire-plugin-svelte/src/client/util.ts +++ b/packages/histoire-plugin-svelte/src/client/util.ts @@ -1,7 +1,7 @@ import { watch as _watch } from '@histoire/vendors/vue' import { applyState, clone } from '@histoire/shared' -function cleanupState (state: Record<string, any>): Record<string, any> { +function cleanupState(state: Record<string, any>): Record<string, any> { const result = {} for (const key in state) { if (key === 'Hst') continue @@ -15,15 +15,16 @@ function cleanupState (state: Record<string, any>): Record<string, any> { return result } -export function syncState (variantState, onChange: (state) => unknown) { +export function syncState(variantState, onChange: (state) => unknown) { let syncing = false - const _stop = _watch(() => variantState, value => { + const _stop = _watch(() => variantState, (value) => { if (value == null) return if (!syncing) { syncing = true onChange(cleanupState(value)) - } else { + } + else { syncing = false } }, { @@ -31,19 +32,20 @@ export function syncState (variantState, onChange: (state) => unknown) { immediate: true, }) - function apply (value) { + function apply(value) { if (value == null) return if (!syncing) { syncing = true applyState(variantState, clone(cleanupState(value))) - } else { + } + else { syncing = false } } return { apply, - stop () { + stop() { _stop() }, } diff --git a/packages/histoire-plugin-svelte/src/collect/index.ts b/packages/histoire-plugin-svelte/src/collect/index.ts index 8853e7c1..8f56e0a2 100644 --- a/packages/histoire-plugin-svelte/src/collect/index.ts +++ b/packages/histoire-plugin-svelte/src/collect/index.ts @@ -3,26 +3,25 @@ import type { ServerRunPayload } from '@histoire/shared' import * as setup from 'virtual:$histoire-setup' // @ts-expect-error virtual module id import * as generatedSetup from 'virtual:$histoire-generated-global-setup' -import { tick, SvelteComponent } from 'svelte' +import type { SvelteComponent } from 'svelte' +import { tick } from 'svelte' +import type { SvelteStorySetupApi } from '../helpers.js' import Story from './Story.svelte' import Variant from './Variant.svelte' -import type { SvelteStorySetupApi } from '../helpers.js' -export async function run ({ file, el, storyData }: ServerRunPayload) { +export async function run({ file, el, storyData }: ServerRunPayload) { const { default: Comp } = await import(/* @vite-ignore */ file.moduleId) const app: SvelteComponent = new Comp({ target: el, props: { Hst: { - // @ts-ignore Story, - // @ts-ignore Variant, }, }, context: new Map(Object.entries({ - __hstAddStory (data) { + __hstAddStory(data) { storyData.push(data) }, __hstStoryFile: file, diff --git a/packages/histoire-plugin-svelte/src/commands/generate-story.client.ts b/packages/histoire-plugin-svelte/src/commands/generate-story.client.ts index 034dab1d..bdf1d0f3 100644 --- a/packages/histoire-plugin-svelte/src/commands/generate-story.client.ts +++ b/packages/histoire-plugin-svelte/src/commands/generate-story.client.ts @@ -1,5 +1,5 @@ import type { ClientCommandOptions } from 'histoire' -import { sendEvent, openStory } from 'histoire/plugin' +import { openStory, sendEvent } from 'histoire/plugin' import { paramCase } from 'change-case' export default { @@ -8,7 +8,7 @@ export default { field: 'component', label: 'Choose a component', type: 'select', - options: async (search) => sendEvent('listSvelteComponents', { search }), + options: async search => sendEvent('listSvelteComponents', { search }), required: true, }, { @@ -16,7 +16,7 @@ export default { label: 'File name', type: 'text', required: true, - defaultValue: (answers) => answers.component?.replace(/.+\/(.+?)\.svelte$/, '$1.story.svelte'), + defaultValue: answers => answers.component?.replace(/.+\/(.+?)\.svelte$/, '$1.story.svelte'), }, ], clientAction: (params) => { diff --git a/packages/histoire-plugin-svelte/src/commands/generate-story.server.ts b/packages/histoire-plugin-svelte/src/commands/generate-story.server.ts index f2904e87..ac0e06e8 100644 --- a/packages/histoire-plugin-svelte/src/commands/generate-story.server.ts +++ b/packages/histoire-plugin-svelte/src/commands/generate-story.server.ts @@ -1,5 +1,5 @@ -import type { PluginCommand } from 'histoire' import fs from 'node:fs' +import type { PluginCommand } from 'histoire' import path from 'pathe' import launchEditor from 'launch-editor' @@ -8,7 +8,7 @@ export default { label: 'Generate Svelte 3 story from component', icon: 'https://svelte.dev/favicon.png', searchText: 'generate create', - async serverAction (params) { + async serverAction(params) { const targetFile = path.join(path.dirname(params.component), params.fileName) if (fs.existsSync(targetFile)) { @@ -44,12 +44,12 @@ export default { clientSetupFile: '@histoire/plugin-svelte/dist/commands/generate-story.client.js', } as PluginCommand -async function isComponentTs (component: string) { +async function isComponentTs(component: string) { const componentContent = await fs.promises.readFile(component, 'utf-8') return componentContent.includes('lang="ts"') } -async function getComponentInfo (file: string) { +async function getComponentInfo(file: string) { const component = path.basename(file) const componentName = component.replace(path.extname(component), '') const isTs = await isComponentTs(file) diff --git a/packages/histoire-plugin-svelte/src/helpers.ts b/packages/histoire-plugin-svelte/src/helpers.ts index 460d1f5b..ad9559c0 100644 --- a/packages/histoire-plugin-svelte/src/helpers.ts +++ b/packages/histoire-plugin-svelte/src/helpers.ts @@ -1,4 +1,4 @@ -import type { StoryProps, Story, Variant, VariantProps } from '@histoire/shared' +import type { Story, StoryProps, Variant, VariantProps } from '@histoire/shared' import type { HstControlOption } from '@histoire/controls' import type { SvelteComponentTyped } from 'svelte' @@ -10,7 +10,7 @@ export interface SvelteStorySetupApi { export type SvelteStorySetupHandler = (api: SvelteStorySetupApi) => Promise<void> | void -export function defineSetupSvelte (handler: SvelteStorySetupHandler): SvelteStorySetupHandler { +export function defineSetupSvelte(handler: SvelteStorySetupHandler): SvelteStorySetupHandler { return handler } diff --git a/packages/histoire-plugin-svelte/src/index.node.ts b/packages/histoire-plugin-svelte/src/index.node.ts index 2d4b2a0d..453e0234 100644 --- a/packages/histoire-plugin-svelte/src/index.node.ts +++ b/packages/histoire-plugin-svelte/src/index.node.ts @@ -3,11 +3,11 @@ import type { Plugin } from 'histoire' import generateStoryCommand from './commands/generate-story.server.js' import { listComponentFiles } from './util/list-components.js' -export function HstSvelte (): Plugin { +export function HstSvelte(): Plugin { return { name: '@histoire/plugin-svelte', - defaultConfig () { + defaultConfig() { return { supportMatch: [ { @@ -43,7 +43,7 @@ export function HstSvelte (): Plugin { generateStoryCommand, ], - async onDevEvent (api) { + async onDevEvent(api) { switch (api.event) { case 'listSvelteComponents': { return listComponentFiles(api.payload.search, api.getConfig().storyMatch) diff --git a/packages/histoire-plugin-svelte/src/util/list-components.ts b/packages/histoire-plugin-svelte/src/util/list-components.ts index 4f317085..2e02a426 100644 --- a/packages/histoire-plugin-svelte/src/util/list-components.ts +++ b/packages/histoire-plugin-svelte/src/util/list-components.ts @@ -1,6 +1,6 @@ import { globby } from 'globby' -export async function listComponentFiles (search = '', ignore: string[] = [], limit = 10) { +export async function listComponentFiles(search = '', ignore: string[] = [], limit = 10) { let files = await globby('**/*.svelte', { gitignore: true, ignore: [ diff --git a/packages/histoire-plugin-svelte/tsconfig.build.json b/packages/histoire-plugin-svelte/tsconfig.build.json index 859e4902..2d3bad51 100644 --- a/packages/histoire-plugin-svelte/tsconfig.build.json +++ b/packages/histoire-plugin-svelte/tsconfig.build.json @@ -2,6 +2,6 @@ "extends": "./tsconfig.json", "exclude": [ "src/client", - "src/collect", - ], -} \ No newline at end of file + "src/collect" + ] +} diff --git a/packages/histoire-plugin-svelte/tsconfig.json b/packages/histoire-plugin-svelte/tsconfig.json index 6cd986eb..7bc11641 100644 --- a/packages/histoire-plugin-svelte/tsconfig.json +++ b/packages/histoire-plugin-svelte/tsconfig.json @@ -1,32 +1,32 @@ { "compilerOptions": { "target": "ESNext", + // Volar + "jsx": "preserve", + "lib": [ + "ESNext", + "DOM" + ], + "rootDir": "src", "module": "ESNext", "moduleResolution": "node", - "outDir": "dist", - "rootDir": "src", - "allowSyntheticDefaultImports": true, - "esModuleInterop": true, - "removeComments": false, "resolveJsonModule": true, - "skipLibCheck": true, "types": [ "node" ], - "lib": [ - "ESNext", - "DOM" - ], - "sourceMap": false, - "preserveWatchOutput": true, + "strictBindCallApply": true, + "strictFunctionTypes": true, + "alwaysStrict": true, // Strict "noImplicitAny": false, "noImplicitThis": true, - "alwaysStrict": true, - "strictBindCallApply": true, - "strictFunctionTypes": true, - // Volar - "jsx": "preserve" + "outDir": "dist", + "removeComments": false, + "sourceMap": false, + "allowSyntheticDefaultImports": true, + "esModuleInterop": true, + "skipLibCheck": true, + "preserveWatchOutput": true }, "include": [ "src" diff --git a/packages/histoire-plugin-svelte/vite.config.ts b/packages/histoire-plugin-svelte/vite.config.ts index 4fcc676a..816e67df 100644 --- a/packages/histoire-plugin-svelte/vite.config.ts +++ b/packages/histoire-plugin-svelte/vite.config.ts @@ -10,14 +10,14 @@ export default defineConfig({ { name: 'histoire:preserve:import.dynamic', enforce: 'pre', - transform (code) { + transform(code) { if (code.includes('import(')) { return { code: code.replace(/import\(/g, 'import__dyn('), } } }, - closeBundle () { + closeBundle() { try { const files = globbySync('./dist/**/*.js') for (const file of files) { @@ -26,7 +26,8 @@ export default defineConfig({ fs.writeFileSync(file, content.replace(/import__dyn\(/g, 'import(/* @vite-ignore */'), 'utf-8') } } - } catch (e) { + } + catch (e) { console.error(e) } }, diff --git a/packages/histoire-plugin-vue/client.d.ts b/packages/histoire-plugin-vue/client.d.ts index c73888c6..29e00bdf 100644 --- a/packages/histoire-plugin-vue/client.d.ts +++ b/packages/histoire-plugin-vue/client.d.ts @@ -1,3 +1,2 @@ - // https://github.com/microsoft/TypeScript/issues/33079 export * from './dist/client/client' diff --git a/packages/histoire-plugin-vue/collect.d.ts b/packages/histoire-plugin-vue/collect.d.ts index 24079c12..5a50ad80 100644 --- a/packages/histoire-plugin-vue/collect.d.ts +++ b/packages/histoire-plugin-vue/collect.d.ts @@ -1,3 +1,2 @@ - // https://github.com/microsoft/TypeScript/issues/33079 export * from './dist/client/server' diff --git a/packages/histoire-plugin-vue/package.json b/packages/histoire-plugin-vue/package.json index 0998a36c..2a42f474 100644 --- a/packages/histoire-plugin-vue/package.json +++ b/packages/histoire-plugin-vue/package.json @@ -1,11 +1,12 @@ { "name": "@histoire/plugin-vue", + "type": "module", "version": "0.17.16", "description": "Histoire plugin for Vue.js support", - "license": "MIT", "author": { "name": "Guillaume Chau" }, + "license": "MIT", "repository": { "url": "https://github.com/Akryum/histoire.git", "type": "git", @@ -14,7 +15,6 @@ "publishConfig": { "access": "public" }, - "type": "module", "exports": { "./client": { "types": "./dist/client/client.d.ts", @@ -44,6 +44,10 @@ "build:types": "tsc --declaration --emitDeclarationOnly", "watch": "concurrently \"vite build --watch\" \"tsc -d -P tsconfig.build.json --watch\" \"pnpm run build:types --watch\"" }, + "peerDependencies": { + "histoire": "workspace:^", + "vue": "^3.2.47" + }, "dependencies": { "@histoire/controls": "workspace:^", "@histoire/shared": "workspace:^", @@ -57,12 +61,8 @@ "@types/node": "^18.11.9", "concurrently": "^7.6.0", "histoire": "workspace:*", - "typescript": "^4.9.5", + "typescript": "^5.4.4", "vite": "^5.0.11", "vue": "^3.3.8" - }, - "peerDependencies": { - "histoire": "workspace:^", - "vue": "^3.2.47" } } diff --git a/packages/histoire-plugin-vue/src/client/app/MountStory.ts b/packages/histoire-plugin-vue/src/client/app/MountStory.ts index 4aca1b6a..bd9dc7a8 100644 --- a/packages/histoire-plugin-vue/src/client/app/MountStory.ts +++ b/packages/histoire-plugin-vue/src/client/app/MountStory.ts @@ -1,23 +1,24 @@ -/* eslint-disable vue/one-component-per-file */ - -import { App, createApp, h, Suspense, Component, VNode } from 'vue' +import type { App, Component, VNode } from 'vue' +import { Suspense, createApp, h } from 'vue' +import type { + PropType as _PropType, +} from '@histoire/vendors/vue' import { defineComponent as _defineComponent, - PropType as _PropType, + h as _h, onMounted as _onMounted, onUnmounted as _onUnmounted, ref as _ref, watch as _watch, - h as _h, } from '@histoire/vendors/vue' import type { Story } from '@histoire/shared' // @ts-expect-error virtual module id import * as setup from 'virtual:$histoire-setup' // @ts-expect-error virtual module id import * as generatedSetup from 'virtual:$histoire-generated-global-setup' +import type { Vue3StorySetupApi, Vue3StorySetupHandler } from '../../helpers.js' import { registerGlobalComponents } from './global-components.js' import { RouterLinkStub } from './RouterLinkStub' -import type { Vue3StorySetupHandler, Vue3StorySetupApi } from '../../helpers.js' export default _defineComponent({ name: 'MountStory', @@ -29,11 +30,11 @@ export default _defineComponent({ }, }, - setup (props) { + setup(props) { const el = _ref<HTMLDivElement>() let app: App - async function mountStory () { + async function mountStory() { const wrappers: Component[] = [] app = createApp({ @@ -52,14 +53,11 @@ export default _defineComponent({ h(wrapper, { story: props.story, variant: null, - }, - () => children[index]), + }, () => children[index]), ) } - return h(Suspense, undefined, - children.at(-1), - ) + return h(Suspense, undefined, children.at(-1)) }, }) @@ -101,7 +99,7 @@ export default _defineComponent({ app.mount(target) } - function unmountStory () { + function unmountStory() { app?.unmount() } @@ -123,7 +121,7 @@ export default _defineComponent({ } }, - render () { + render() { return _h('div', { ref: 'el', }) diff --git a/packages/histoire-plugin-vue/src/client/app/RenderStory.ts b/packages/histoire-plugin-vue/src/client/app/RenderStory.ts index 9956c74b..07bda239 100644 --- a/packages/histoire-plugin-vue/src/client/app/RenderStory.ts +++ b/packages/histoire-plugin-vue/src/client/app/RenderStory.ts @@ -1,26 +1,27 @@ -/* eslint-disable vue/one-component-per-file */ - -import { App, createApp, onMounted, reactive, Component, h, VNode, Suspense } from 'vue' +import type { App, Component, VNode } from 'vue' +import { Suspense, createApp, h, onMounted, reactive } from 'vue' +import type { + PropType as _PropType, +} from '@histoire/vendors/vue' import { defineComponent as _defineComponent, + h as _h, onBeforeUnmount as _onBeforeUnmount, onMounted as _onMounted, - PropType as _PropType, ref as _ref, watch as _watch, - h as _h, } from '@histoire/vendors/vue' import { applyState } from '@histoire/shared' -import type { Story, Variant, PropDefinition, AutoPropComponentDefinition } from '@histoire/shared' -import { getTagName } from '../codegen' -import { registerGlobalComponents } from './global-components.js' -import { RouterLinkStub } from './RouterLinkStub' +import type { AutoPropComponentDefinition, PropDefinition, Story, Variant } from '@histoire/shared' // @ts-expect-error virtual module id import * as setup from 'virtual:$histoire-setup' // @ts-expect-error virtual module id import * as generatedSetup from 'virtual:$histoire-generated-global-setup' -import { syncStateBundledAndExternal } from './util.js' +import { getTagName } from '../codegen' import type { Vue3StorySetupApi, Vue3StorySetupHandler } from '../../helpers.js' +import { registerGlobalComponents } from './global-components.js' +import { RouterLinkStub } from './RouterLinkStub' +import { syncStateBundledAndExternal } from './util.js' export default _defineComponent({ name: 'RenderStory', @@ -46,7 +47,7 @@ export default _defineComponent({ ready: () => true, }, - setup (props, { emit }) { + setup(props, { emit }) { const sandbox = _ref<HTMLDivElement>() let app: App let mounting = false @@ -55,14 +56,14 @@ export default _defineComponent({ syncStateBundledAndExternal(props.variant.state, externalState) - function unmountVariant () { + function unmountVariant() { if (app) { app.unmount() app = null } } - async function mountVariant () { + async function mountVariant() { if (mounting) return mounting = true @@ -75,7 +76,7 @@ export default _defineComponent({ app = createApp({ name: 'RenderStorySubApp', - setup () { + setup() { onMounted(() => { mounting = false }) @@ -165,7 +166,7 @@ export default _defineComponent({ emit('ready') } - function scanForAutoProps (vnodes: any[]) { + function scanForAutoProps(vnodes: any[]) { const result: AutoPropComponentDefinition[] = [] let index = 0 for (const vnode of vnodes) { @@ -177,7 +178,7 @@ export default _defineComponent({ let defaultValue if (prop) { const rawTypes = Array.isArray(prop.type) ? prop.type : typeof prop === 'function' ? [prop] : [prop.type] - types = rawTypes.map(t => { + types = rawTypes.map((t) => { switch (t) { case String: return 'string' @@ -238,11 +239,12 @@ export default _defineComponent({ } }) - _watch(() => props.variant, async value => { + _watch(() => props.variant, async (value) => { if (value.configReady && !mounting) { if (!app) { await mountVariant() - } else { + } + else { app._instance.proxy.$forceUpdate() } } @@ -259,7 +261,7 @@ export default _defineComponent({ } }, - render () { + render() { return _h('div', { ref: 'sandbox', }) diff --git a/packages/histoire-plugin-vue/src/client/app/RouterLinkStub.ts b/packages/histoire-plugin-vue/src/client/app/RouterLinkStub.ts index ceb02675..e5ee2ff3 100644 --- a/packages/histoire-plugin-vue/src/client/app/RouterLinkStub.ts +++ b/packages/histoire-plugin-vue/src/client/app/RouterLinkStub.ts @@ -1,6 +1,6 @@ // From: https://github.com/vuejs/test-utils/blob/main/src/components/RouterLinkStub.ts -import { defineComponent, h, computed } from 'vue' +import { computed, defineComponent, h } from 'vue' // match return type of router.resolve: RouteLocation & { href: string } const defaultRoute = { @@ -33,7 +33,7 @@ export const RouterLinkStub = defineComponent({ }, }, - render () { + render() { const route = computed(() => defaultRoute) // mock reasonable return values to mimic vue-router's useLink const children = this.$slots?.default?.({ @@ -41,7 +41,6 @@ export const RouterLinkStub = defineComponent({ href: computed(() => route.value.href), isActive: computed(() => false), isExactActive: computed(() => false), - // eslint-disable-next-line @typescript-eslint/no-empty-function navigate: async () => {}, }) return this.custom ? children : h('a', undefined, children) diff --git a/packages/histoire-plugin-vue/src/client/app/Story.ts b/packages/histoire-plugin-vue/src/client/app/Story.ts index 73dcbc0b..a8a5b2e7 100644 --- a/packages/histoire-plugin-vue/src/client/app/Story.ts +++ b/packages/histoire-plugin-vue/src/client/app/Story.ts @@ -1,9 +1,11 @@ -import { computed, defineComponent, provide, useAttrs, VNode, h, PropType, getCurrentInstance, reactive, cloneVNode } from 'vue' -import { Story, omitInheritStoryProps } from '@histoire/shared' +import type { PropType, VNode } from 'vue' +import { cloneVNode, computed, defineComponent, getCurrentInstance, h, provide, reactive, useAttrs } from 'vue' +import type { Story } from '@histoire/shared' +import { omitInheritStoryProps } from '@histoire/shared' import Variant from './Variant' export default defineComponent({ - // eslint-disable-next-line vue/multi-word-component-names + name: 'Story', __histoireType: 'story', @@ -21,7 +23,7 @@ export default defineComponent({ }, }, - setup (props) { + setup(props) { const vm = getCurrentInstance() const attrs = useAttrs() as { @@ -36,7 +38,7 @@ export default defineComponent({ const implicitState = { $data: storyComponent.data, } - function addImplicitState (key, value) { + function addImplicitState(key, value) { if (typeof value === 'function' || (value?.__file) || typeof value?.render === 'function' || typeof value?.setup === 'function') { return } @@ -54,7 +56,7 @@ export default defineComponent({ // Wrap with reactive to unwrap refs provide('implicitState', () => reactive({ ...implicitState })) - function updateStory () { + function updateStory() { Object.assign(attrs.story, { meta: props.meta, slots: () => vm.proxy.$slots, @@ -67,7 +69,7 @@ export default defineComponent({ } }, - render () { + render() { this.updateStory() const [firstVariant] = this.story.variants @@ -105,7 +107,8 @@ export default defineComponent({ } index++ result.push(cloneVNode(vnode, props)) - } else { + } + else { if (vnode.children?.length) { vnode.children = applyAttrs(vnode.children as VNode[]) } diff --git a/packages/histoire-plugin-vue/src/client/app/Variant.ts b/packages/histoire-plugin-vue/src/client/app/Variant.ts index fea8f183..55fd6338 100644 --- a/packages/histoire-plugin-vue/src/client/app/Variant.ts +++ b/packages/histoire-plugin-vue/src/client/app/Variant.ts @@ -1,4 +1,5 @@ -import { defineComponent, getCurrentInstance, inject, PropType, useAttrs } from 'vue' +import type { PropType } from 'vue' +import { defineComponent, getCurrentInstance, inject, useAttrs } from 'vue' import type { Variant } from '@histoire/shared' import { applyState } from '@histoire/shared' import { syncStateBundledAndExternal, toRawDeep } from './util.js' @@ -6,7 +7,7 @@ import { syncStateBundledAndExternal, toRawDeep } from './util.js' // const logLocation = location.href.includes('__sandbox') ? '[Sandbox]' : '[Host]' export default defineComponent({ - // eslint-disable-next-line vue/multi-word-component-names + name: 'Variant', __histoireType: 'variant', @@ -42,7 +43,7 @@ export default defineComponent({ }, }, - async setup (props) { + async setup(props) { const attrs = useAttrs() as { variant: Variant } @@ -58,7 +59,7 @@ export default defineComponent({ syncStateBundledAndExternal(attrs.variant.state, implicitState()) - function updateVariant () { + function updateVariant() { Object.assign(attrs.variant, { slots: () => vm.proxy.$slots, source: props.source, @@ -76,7 +77,7 @@ export default defineComponent({ } }, - render () { + render() { // Trigger variant updates to (re-)render slots this.updateVariant() return null diff --git a/packages/histoire-plugin-vue/src/client/app/global-components.ts b/packages/histoire-plugin-vue/src/client/app/global-components.ts index a1549601..36eb10de 100644 --- a/packages/histoire-plugin-vue/src/client/app/global-components.ts +++ b/packages/histoire-plugin-vue/src/client/app/global-components.ts @@ -1,29 +1,30 @@ -/* eslint-disable vue/one-component-per-file */ - -import { +import type { App, +} from 'vue' +import { defineComponent, - ref, h, - onMounted, - onBeforeUpdate, onBeforeUnmount, + onBeforeUpdate, + onMounted, onUpdated, + ref, } from 'vue' +import type { + App as _App, +} from '@histoire/vendors/vue' import { createApp as _createApp, h as _h, - App as _App, reactive as _reactive, } from '@histoire/vendors/vue' import { components } from '@histoire/controls' import Story from './Story' import Variant from './Variant' -export function registerGlobalComponents (app: App) { - // eslint-disable-next-line vue/multi-word-component-names +export function registerGlobalComponents(app: App) { app.component('Story', Story) - // eslint-disable-next-line vue/multi-word-component-names + app.component('Variant', Variant) for (const key in components) { @@ -31,11 +32,11 @@ export function registerGlobalComponents (app: App) { } } -function wrapControlComponent (controlComponent) { +function wrapControlComponent(controlComponent) { return defineComponent({ name: controlComponent.name, inheritAttrs: false, - setup (props, { attrs }) { + setup(props, { attrs }) { const el = ref<HTMLDivElement>() const slotEl = ref<HTMLDivElement>() @@ -43,7 +44,7 @@ function wrapControlComponent (controlComponent) { const state = _reactive({}) - function applyState (data) { + function applyState(data) { Object.assign(state, data) } @@ -57,7 +58,7 @@ function wrapControlComponent (controlComponent) { let newSlotCalls = [] const slotCalls = ref([]) - function moveSlotContent () { + function moveSlotContent() { slotCalls.value.forEach((props, index) => { const renderedEl = slotEl.value.querySelector(`[renderslotid="${index}"]`) if (!renderedEl) return @@ -75,20 +76,20 @@ function wrapControlComponent (controlComponent) { onMounted(() => { app = _createApp({ - mounted () { + mounted() { slotCalls.value = newSlotCalls newSlotCalls = [] }, - updated () { + updated() { slotCalls.value = newSlotCalls newSlotCalls = [] }, - render () { + render() { return _h(controlComponent, { ...state, key: 'component', }, { - default: props => { + default: (props) => { newSlotCalls.push(props) return _h('div', { slotId: newSlotCalls.length - 1, @@ -114,7 +115,7 @@ function wrapControlComponent (controlComponent) { slotCalls, } }, - render () { + render() { return [ h('div', { ref: 'el', diff --git a/packages/histoire-plugin-vue/src/client/app/util.ts b/packages/histoire-plugin-vue/src/client/app/util.ts index bb0f5c4c..d1995ae2 100644 --- a/packages/histoire-plugin-vue/src/client/app/util.ts +++ b/packages/histoire-plugin-vue/src/client/app/util.ts @@ -1,17 +1,17 @@ -import { unref, isRef, watch } from 'vue' +import { isRef, unref, watch } from 'vue' import { - unref as _unref, isRef as _isRef, + unref as _unref, watch as _watch, } from '@histoire/vendors/vue' import { applyState } from '@histoire/shared' -const isObject = (val) => val !== null && typeof val === 'object' +const isObject = val => val !== null && typeof val === 'object' /** * Using external/user Vue */ -export function toRawDeep (val, seen = new WeakMap()) { +export function toRawDeep(val, seen = new WeakMap()) { const unwrappedValue = isRef(val) ? unref(val) : val if (typeof unwrappedValue === 'symbol') { @@ -31,7 +31,8 @@ export function toRawDeep (val, seen = new WeakMap()) { seen.set(unwrappedValue, result) result.push(...unwrappedValue.map(value => toRawDeep(value, seen))) return result - } else { + } + else { const result = {} seen.set(unwrappedValue, result) toRawObject(unwrappedValue, result, seen) @@ -39,7 +40,7 @@ export function toRawDeep (val, seen = new WeakMap()) { } } -const toRawObject = (obj: Record<any, any>, target: Record<any, any>, seen = new WeakMap()) => { +function toRawObject(obj: Record<any, any>, target: Record<any, any>, seen = new WeakMap()) { Object.keys(obj).forEach((key) => { target[key] = toRawDeep(obj[key], seen) }) @@ -48,7 +49,7 @@ const toRawObject = (obj: Record<any, any>, target: Record<any, any>, seen = new /** * Using bundled Vue */ -export function _toRawDeep (val, seen = new WeakMap()) { +export function _toRawDeep(val, seen = new WeakMap()) { const unwrappedValue = _isRef(val) ? _unref(val) : val if (typeof unwrappedValue === 'symbol') { @@ -68,7 +69,8 @@ export function _toRawDeep (val, seen = new WeakMap()) { seen.set(unwrappedValue, result) result.push(...unwrappedValue.map(value => _toRawDeep(value, seen))) return result - } else { + } + else { const result = {} seen.set(unwrappedValue, result) _toRawObject(unwrappedValue, result, seen) @@ -76,7 +78,7 @@ export function _toRawDeep (val, seen = new WeakMap()) { } } -const _toRawObject = (obj: Record<any, any>, target: Record<any, any>, seen = new WeakMap()) => { +function _toRawObject(obj: Record<any, any>, target: Record<any, any>, seen = new WeakMap()) { Object.keys(obj).forEach((key) => { target[key] = toRawDeep(obj[key], seen) }) @@ -87,15 +89,16 @@ const _toRawObject = (obj: Record<any, any>, target: Record<any, any>, seen = ne * @param bundledState Reactive state created with the bundled Vue * @param externalState Reactive state created with the external/user Vue */ -export function syncStateBundledAndExternal (bundledState, externalState) { +export function syncStateBundledAndExternal(bundledState, externalState) { let syncing = false - const _stop = _watch(() => bundledState, value => { + const _stop = _watch(() => bundledState, (value) => { if (value == null) return if (!syncing) { syncing = true applyState(externalState, _toRawDeep(value)) - } else { + } + else { syncing = false } }, { @@ -103,12 +106,13 @@ export function syncStateBundledAndExternal (bundledState, externalState) { immediate: true, }) - const stop = watch(() => externalState, value => { + const stop = watch(() => externalState, (value) => { if (value == null) return if (!syncing) { syncing = true applyState(bundledState, toRawDeep(value)) - } else { + } + else { syncing = false } }, { @@ -117,7 +121,7 @@ export function syncStateBundledAndExternal (bundledState, externalState) { }) return { - stop () { + stop() { _stop() stop() }, diff --git a/packages/histoire-plugin-vue/src/client/codegen.ts b/packages/histoire-plugin-vue/src/client/codegen.ts index 246b4fed..dd7d2eb1 100644 --- a/packages/histoire-plugin-vue/src/client/codegen.ts +++ b/packages/histoire-plugin-vue/src/client/codegen.ts @@ -1,11 +1,12 @@ // @TODO remove @ts-ignore -import { VNode, vModelText, vModelCheckbox, vModelSelect, vModelRadio, vModelDynamic, Text } from 'vue' -import { pascalCase, camelCase } from 'change-case' +import type { VNode } from 'vue' +import { Text, vModelCheckbox, vModelDynamic, vModelRadio, vModelSelect, vModelText } from 'vue' +import { camelCase, pascalCase } from 'change-case' import { createAutoBuildingObject, indent, serializeJs, voidElements } from '@histoire/shared' import type { Variant } from '@histoire/shared' -export async function generateSourceCode (variant: Variant) { +export async function generateSourceCode(variant: Variant) { const vnode = variant.slots().default?.({ state: variant.state ?? {} }) ?? [] const list = Array.isArray(vnode) ? vnode : [vnode] const lines: string[] = [] @@ -16,10 +17,10 @@ export async function generateSourceCode (variant: Variant) { return lines.join('\n') } -async function printVNode (vnode: VNode, propsOverrides: Record<string, any> = null): Promise<{ lines: string[], isText?: boolean }> { +async function printVNode(vnode: VNode, propsOverrides: Record<string, any> = null): Promise<{ lines: string[], isText?: boolean }> { if (vnode.type === Text) { return { - // @ts-ignore + // @ts-expect-error TODO lines: [vnode.children], isText: true, } @@ -29,9 +30,9 @@ async function printVNode (vnode: VNode, propsOverrides: Record<string, any> = n if (typeof vnode.type === 'object' || typeof vnode.type === 'string') { // Wait for async component - // @ts-ignore + // @ts-expect-error TODO if (vnode.type?.__asyncLoader && !vnode.type.__asyncResolved) { - // @ts-ignore + // @ts-expect-error TODO await vnode.type.__asyncLoader() } @@ -42,7 +43,7 @@ async function printVNode (vnode: VNode, propsOverrides: Record<string, any> = n ] // Directives - function genDirective (dirName: string, dir, valueCode: string = null) { + function genDirective(dirName: string, dir, valueCode: string = null) { let modifiers = '' for (const key in dir.modifiers) { if (dir.modifiers[key]) { @@ -65,7 +66,8 @@ async function printVNode (vnode: VNode, propsOverrides: Record<string, any> = n attr.push(...valueLines.slice(1, valueLines.length - 1)) attr.push(`${valueLines[valueLines.length - 1]}"`) multilineAttrs = true - } else { + } + else { attr.push(`${dirAttr}${valueLines[0] ?? ''}"`) } attrs.push(attr) @@ -87,9 +89,10 @@ async function printVNode (vnode: VNode, propsOverrides: Record<string, any> = n } } genDirective('model', dir, valueCode) - // @ts-ignore - } else if (dir.instance._ || dir.instance.$) { - // @ts-ignore + } + // @ts-expect-error TODO + else if (dir.instance._ || dir.instance.$) { + // @ts-expect-error TODO const target = dir.instance.$ ?? dir.instance._ let dirName: string for (const directives of [target.directives, target.appContext.directives]) { @@ -118,8 +121,8 @@ async function printVNode (vnode: VNode, propsOverrides: Record<string, any> = n } // Attributes - function addAttr (prop: string, value: any) { - // @ts-ignore + function addAttr(prop: string, value: any) { + // @ts-expect-error TODO if (typeof value !== 'string' || vnode.dynamicProps?.includes(prop)) { let directive = ':' if (prop.startsWith('on')) { @@ -129,7 +132,7 @@ async function printVNode (vnode: VNode, propsOverrides: Record<string, any> = n // v-model on component const vmodelListeners = [`onUpdate:${prop}`, `onUpdate:${camelCase(prop)}`] - // @ts-ignore + // @ts-expect-error TODO const vmodelListener = vmodelListeners.find(key => vnode.dynamicProps?.includes(key) || (vnode.props && key in vnode.props)) if (directive === ':' && vmodelListener) { // Listener @@ -164,20 +167,23 @@ async function printVNode (vnode: VNode, propsOverrides: Record<string, any> = n if (typeof value === 'string' && value.startsWith('{{') && value.endsWith('}}')) { // It was formatted from auto building object (slot props) serialized = cleanupExpression(value.substring(2, value.length - 2).trim()).split('\n') - } else if (typeof value === 'function') { + } + else if (typeof value === 'function') { let code = cleanupExpression(value.toString().replace(/'/g, '\\\'').replace(/"/g, '\'')) const testResult = /function ([^\s]+)\(/.exec(code) if (testResult) { // Function name only serialized = [testResult[1]] - } else { + } + else { if (code.startsWith('($event) => ')) { // Remove unnecessary `($event) => ` code = code.substring('($event) => '.length) } serialized = code.split('\n') } - } else { + } + else { serialized = serializeAndCleanJs(value) } if (serialized.length > 1) { @@ -186,13 +192,16 @@ async function printVNode (vnode: VNode, propsOverrides: Record<string, any> = n indented.push(...serialized.slice(1, serialized.length - 1)) indented.push(`${serialized[serialized.length - 1]}"`) attrs.push(indented) - } else { + } + else { attrs.push([`${directive}${arg}="${serialized[0]}"`]) } - // @ts-ignore - } else if (vnode.type?.props?.[prop]?.type === Boolean) { + } + // @ts-expect-error TODO + else if (vnode.type?.props?.[prop]?.type === Boolean) { attrs.push([prop]) - } else { + } + else { attrs.push([`${prop}="${value}"`]) } } @@ -224,14 +233,16 @@ async function printVNode (vnode: VNode, propsOverrides: Record<string, any> = n if (typeof vnode.children === 'string') { if (tagName === 'pre') { childLines.push(vnode.children) - } else { + } + else { childLines.push(...vnode.children.split('\n')) } isChildText = true - } else if (Array.isArray(vnode.children)) { + } + else if (Array.isArray(vnode.children)) { let isAllChildText for (const child of vnode.children) { - // @ts-ignore + // @ts-expect-error TODO const result = await printVNode(child) if (result.isText) { if (isAllChildText === undefined) { @@ -240,10 +251,12 @@ async function printVNode (vnode: VNode, propsOverrides: Record<string, any> = n const text = result.lines[0] if (!childLines.length || /^\s/.test(text)) { childLines.push(text.trim()) - } else { + } + else { childLines[childLines.length - 1] += text } - } else { + } + else { if (isAllChildText === undefined) { isAllChildText = false } @@ -265,7 +278,7 @@ async function printVNode (vnode: VNode, propsOverrides: Record<string, any> = n return () => false } }) - // @ts-ignore + // @ts-expect-error TODO const children = vnode.children[key](autoObject.proxy) const slotLines: string[] = [] for (const child of children) { @@ -276,9 +289,11 @@ async function printVNode (vnode: VNode, propsOverrides: Record<string, any> = n childLines.push(`<template #${key}="{ ${slotProps.join(', ')} }">`) childLines.push(...indent(slotLines)) childLines.push('</template>') - } else if (key === 'default') { + } + else if (key === 'default') { childLines.push(...slotLines) - } else { + } + else { childLines.push(`<template #${key}>`) childLines.push(...indent(slotLines)) childLines.push(`</template>`) @@ -296,7 +311,8 @@ async function printVNode (vnode: VNode, propsOverrides: Record<string, any> = n if (childLines.length > 0) { tag.push('>') } - } else { + } + else { if (attrs.length === 1) { tag[0] += ` ${attrs[0]}` } @@ -310,19 +326,23 @@ async function printVNode (vnode: VNode, propsOverrides: Record<string, any> = n if (childLines.length > 0) { if (childLines.length === 1 && tag.length === 1 && !attrs.length && isChildText) { lines.push(`${tag[0]}${childLines[0]}</${tagName}>`) - } else { + } + else { lines.push(...tag) lines.push(...indent(childLines)) lines.push(`</${tagName}>`) } - } else if (tag.length > 1) { + } + else if (tag.length > 1) { lines.push(...tag) lines.push(isVoid ? '>' : '/>') - } else { + } + else { lines.push(`${tag[0]}${isVoid ? '' : ' /'}>`) } - } else if (vnode?.shapeFlag & 1 << 4) { - // @ts-ignore + } + else if (vnode?.shapeFlag & 1 << 4) { + // @ts-expect-error TODO for (const child of vnode.children) { lines.push(...(await printVNode(child)).lines) } @@ -333,27 +353,30 @@ async function printVNode (vnode: VNode, propsOverrides: Record<string, any> = n } } -export function getTagName (vnode: VNode) { +export function getTagName(vnode: VNode) { if (typeof vnode.type === 'string') { return vnode.type - // @ts-ignore - } else if (vnode.type?.__asyncResolved) { - // @ts-ignore + } + // @ts-expect-error TODO + else if (vnode.type?.__asyncResolved) { + // @ts-expect-error TODO const asyncComp = vnode.type?.__asyncResolved return asyncComp.name ?? getNameFromFile(asyncComp.__file) - // @ts-ignore - } else if (vnode.type?.name) { - // @ts-ignore + } + // @ts-expect-error TODO + else if (vnode.type?.name) { + // @ts-expect-error TODO return vnode.type.name - // @ts-ignore - } else if (vnode.type?.__file) { - // @ts-ignore + } + // @ts-expect-error TODO + else if (vnode.type?.__file) { + // @ts-expect-error TODO return getNameFromFile(vnode.type.__file) } return 'Anonymous' } -function getNameFromFile (file: string) { +function getNameFromFile(file: string) { const parts = /([^/]+)\.vue$/.exec(file) if (parts) { return pascalCase(parts[1]) @@ -361,17 +384,18 @@ function getNameFromFile (file: string) { return 'Anonymous' } -function serializeAndCleanJs (value: any) { +function serializeAndCleanJs(value: any) { const isAutoBuildingObject = !!value?.__autoBuildingObject const result = serializeJs(value) if (isAutoBuildingObject) { - // @ts-ignore + // @ts-expect-error TODO return [cleanupExpression(result.__autoBuildingObjectGetKey)] - } else { + } + else { return cleanupExpression(result).split('\n') } } -function cleanupExpression (expr: string) { +function cleanupExpression(expr: string) { return expr.replace(/\$setup\./g, '') } diff --git a/packages/histoire-plugin-vue/src/client/server/Story.ts b/packages/histoire-plugin-vue/src/client/server/Story.ts index 6e3ab90e..185f1c09 100644 --- a/packages/histoire-plugin-vue/src/client/server/Story.ts +++ b/packages/histoire-plugin-vue/src/client/server/Story.ts @@ -1,5 +1,6 @@ -import { defineComponent, inject, onMounted, PropType, provide, useAttrs } from 'vue' -import type { ServerStoryFile, ServerStory, ServerVariant } from '@histoire/shared' +import type { PropType } from 'vue' +import { defineComponent, inject, onMounted, provide, useAttrs } from 'vue' +import type { ServerStory, ServerStoryFile, ServerVariant } from '@histoire/shared' import { autoStubComponents } from './stub' export default defineComponent({ @@ -49,7 +50,7 @@ export default defineComponent({ }, }, - setup (props) { + setup(props) { const attrs = useAttrs() as { data: ServerStoryFile } @@ -92,11 +93,11 @@ export default defineComponent({ } }, - render () { + render() { let suppressError = false try { const vnodes = this.$slots.default?.({ - get state () { + get state() { // No variant tags suppressError = true return {} @@ -109,7 +110,8 @@ export default defineComponent({ } return vnodes - } catch (e) { + } + catch (e) { if (!suppressError) { console.error(e) } diff --git a/packages/histoire-plugin-vue/src/client/server/Variant.ts b/packages/histoire-plugin-vue/src/client/server/Variant.ts index c48b5de2..5ba3d58d 100644 --- a/packages/histoire-plugin-vue/src/client/server/Variant.ts +++ b/packages/histoire-plugin-vue/src/client/server/Variant.ts @@ -1,4 +1,4 @@ -import { defineComponent, inject, type PropType } from 'vue' +import { type PropType, defineComponent, inject } from 'vue' import type { ServerStory, ServerVariant } from '@histoire/shared' export default defineComponent({ @@ -31,10 +31,10 @@ export default defineComponent({ }, }, - setup (props) { + setup(props) { const story = inject<ServerStory>('story') - function generateId () { + function generateId() { return `${story.id}-${story.variants.length}` } @@ -50,7 +50,7 @@ export default defineComponent({ addVariant(variant) }, - render () { + render() { return null }, }) diff --git a/packages/histoire-plugin-vue/src/client/server/run.ts b/packages/histoire-plugin-vue/src/client/server/run.ts index d2348147..4a56a7e2 100644 --- a/packages/histoire-plugin-vue/src/client/server/run.ts +++ b/packages/histoire-plugin-vue/src/client/server/run.ts @@ -4,20 +4,20 @@ import type { ServerRunPayload } from '@histoire/shared' import * as setup from 'virtual:$histoire-setup' // @ts-expect-error virtual module id import * as generatedSetup from 'virtual:$histoire-generated-global-setup' +import type { Vue3StorySetupApi, Vue3StorySetupHandler } from '../../helpers.js' import Story from './Story' import Variant from './Variant' -import type { Vue3StorySetupApi, Vue3StorySetupHandler } from '../../helpers.js' -export async function run ({ file, storyData, el }: ServerRunPayload) { +export async function run({ file, storyData, el }: ServerRunPayload) { const { default: Comp } = await import(/* @vite-ignore */ file.moduleId) const app = createApp({ provide: { - addStory (data) { + addStory(data) { storyData.push(data) }, }, - render () { + render() { return h(Comp, { ref: 'comp', data: file, @@ -25,9 +25,8 @@ export async function run ({ file, storyData, el }: ServerRunPayload) { }, }) - // eslint-disable-next-line vue/multi-word-component-names app.component('Story', Story) - // eslint-disable-next-line vue/multi-word-component-names + app.component('Variant', Variant) // Call app setups to resolve global assets such as components @@ -55,7 +54,7 @@ export async function run ({ file, storyData, el }: ServerRunPayload) { const el = document.createElement('div') el.innerHTML = Comp.doc const text = el.textContent - storyData.forEach(s => { + storyData.forEach((s) => { s.docsText = text }) } diff --git a/packages/histoire-plugin-vue/src/client/server/stub.ts b/packages/histoire-plugin-vue/src/client/server/stub.ts index 35582e40..caa805e3 100644 --- a/packages/histoire-plugin-vue/src/client/server/stub.ts +++ b/packages/histoire-plugin-vue/src/client/server/stub.ts @@ -1,6 +1,6 @@ const stub = { name: 'StubbedComponent', render: () => null } -export function autoStubComponents (vnodes: any[]) { +export function autoStubComponents(vnodes: any[]) { for (const vnode of vnodes) { if (typeof vnode.type === 'object' && (vnode.type as any).name !== 'HistoireVariant') { vnode.type = stub diff --git a/packages/histoire-plugin-vue/src/commands/generate-story.client.ts b/packages/histoire-plugin-vue/src/commands/generate-story.client.ts index 2f9ea45e..7625e217 100644 --- a/packages/histoire-plugin-vue/src/commands/generate-story.client.ts +++ b/packages/histoire-plugin-vue/src/commands/generate-story.client.ts @@ -1,5 +1,5 @@ import type { ClientCommandOptions } from 'histoire' -import { sendEvent, openStory } from 'histoire/plugin' +import { openStory, sendEvent } from 'histoire/plugin' import { paramCase } from 'change-case' export default { @@ -8,7 +8,7 @@ export default { field: 'component', label: 'Choose a component', type: 'select', - options: async (search) => sendEvent('listVueComponents', { search }), + options: async search => sendEvent('listVueComponents', { search }), required: true, }, { @@ -16,7 +16,7 @@ export default { label: 'File name', type: 'text', required: true, - defaultValue: (answers) => answers.component?.replace(/.+\/(.+?)\.vue$/, '$1.story.vue'), + defaultValue: answers => answers.component?.replace(/.+\/(.+?)\.vue$/, '$1.story.vue'), }, ], clientAction: (params) => { diff --git a/packages/histoire-plugin-vue/src/commands/generate-story.server.ts b/packages/histoire-plugin-vue/src/commands/generate-story.server.ts index 753e492b..d5b4e9a8 100644 --- a/packages/histoire-plugin-vue/src/commands/generate-story.server.ts +++ b/packages/histoire-plugin-vue/src/commands/generate-story.server.ts @@ -1,5 +1,5 @@ -import type { PluginCommand } from 'histoire' import fs from 'node:fs' +import type { PluginCommand } from 'histoire' import path from 'pathe' import launchEditor from 'launch-editor' @@ -8,7 +8,7 @@ export default { label: 'Generate Vue 3 story from component', icon: 'https://vuejs.org/logo.svg', searchText: 'generate create', - async serverAction (params) { + async serverAction(params) { const targetFile = path.join(path.dirname(params.component), params.fileName) if (fs.existsSync(targetFile)) { @@ -37,12 +37,12 @@ import ${componentName} from './${component}' clientSetupFile: '@histoire/plugin-vue/dist/commands/generate-story.client.js', } as PluginCommand -async function isComponentTs (component: string) { +async function isComponentTs(component: string) { const componentContent = await fs.promises.readFile(component, 'utf-8') return componentContent.includes('lang="ts"') } -async function getComponentInfo (file: string) { +async function getComponentInfo(file: string) { const component = path.basename(file) const componentName = component.replace(path.extname(component), '') const isTs = await isComponentTs(file) diff --git a/packages/histoire-plugin-vue/src/helpers.ts b/packages/histoire-plugin-vue/src/helpers.ts index 67d4aee1..eb32ab37 100644 --- a/packages/histoire-plugin-vue/src/helpers.ts +++ b/packages/histoire-plugin-vue/src/helpers.ts @@ -10,6 +10,6 @@ export interface Vue3StorySetupApi { export type Vue3StorySetupHandler = (api: Vue3StorySetupApi) => Promise<void> | void -export function defineSetupVue3 (handler: Vue3StorySetupHandler): Vue3StorySetupHandler { +export function defineSetupVue3(handler: Vue3StorySetupHandler): Vue3StorySetupHandler { return handler } diff --git a/packages/histoire-plugin-vue/src/index.node.ts b/packages/histoire-plugin-vue/src/index.node.ts index cfb57121..a8d7f2ea 100644 --- a/packages/histoire-plugin-vue/src/index.node.ts +++ b/packages/histoire-plugin-vue/src/index.node.ts @@ -2,11 +2,11 @@ import type { Plugin } from 'histoire' import generateStoryCommand from './commands/generate-story.server.js' import { listComponentFiles } from './util/list-components.js' -export function HstVue (): Plugin { +export function HstVue(): Plugin { return { name: '@histoire/plugin-vue', - defaultConfig () { + defaultConfig() { return { supportMatch: [ { @@ -18,14 +18,14 @@ export function HstVue (): Plugin { } }, - config () { + config() { return { vite: { plugins: [ { name: 'histoire-plugin-vue', enforce: 'post', - transform (code, id) { + transform(code, id) { // Remove vue warnings about unknown components if ((this.meta as any).histoire?.isCollecting && id.endsWith('.vue')) { return `const _stubComponent = (name) => ['Story','Variant'].includes(name) ? _resolveComponent(name) : ({ render: () => null });${code?.replaceAll('_resolveComponent(', '_stubComponent(') ?? ''}` @@ -49,7 +49,7 @@ export function HstVue (): Plugin { generateStoryCommand, ], - async onDevEvent (api) { + async onDevEvent(api) { switch (api.event) { case 'listVueComponents': { return listComponentFiles(api.payload.search, api.getConfig().storyMatch) diff --git a/packages/histoire-plugin-vue/src/util/list-components.ts b/packages/histoire-plugin-vue/src/util/list-components.ts index acb29571..7d009128 100644 --- a/packages/histoire-plugin-vue/src/util/list-components.ts +++ b/packages/histoire-plugin-vue/src/util/list-components.ts @@ -1,6 +1,6 @@ import { globby } from 'globby' -export async function listComponentFiles (search = '', ignore: string[] = [], limit = 10) { +export async function listComponentFiles(search = '', ignore: string[] = [], limit = 10) { let files = await globby('**/*.vue', { gitignore: true, ignore: [ diff --git a/packages/histoire-plugin-vue/tsconfig.build.json b/packages/histoire-plugin-vue/tsconfig.build.json index a4dd69bb..7b73cb89 100644 --- a/packages/histoire-plugin-vue/tsconfig.build.json +++ b/packages/histoire-plugin-vue/tsconfig.build.json @@ -3,4 +3,4 @@ "exclude": [ "src/client" ] -} \ No newline at end of file +} diff --git a/packages/histoire-plugin-vue/tsconfig.json b/packages/histoire-plugin-vue/tsconfig.json index 6cd986eb..7bc11641 100644 --- a/packages/histoire-plugin-vue/tsconfig.json +++ b/packages/histoire-plugin-vue/tsconfig.json @@ -1,32 +1,32 @@ { "compilerOptions": { "target": "ESNext", + // Volar + "jsx": "preserve", + "lib": [ + "ESNext", + "DOM" + ], + "rootDir": "src", "module": "ESNext", "moduleResolution": "node", - "outDir": "dist", - "rootDir": "src", - "allowSyntheticDefaultImports": true, - "esModuleInterop": true, - "removeComments": false, "resolveJsonModule": true, - "skipLibCheck": true, "types": [ "node" ], - "lib": [ - "ESNext", - "DOM" - ], - "sourceMap": false, - "preserveWatchOutput": true, + "strictBindCallApply": true, + "strictFunctionTypes": true, + "alwaysStrict": true, // Strict "noImplicitAny": false, "noImplicitThis": true, - "alwaysStrict": true, - "strictBindCallApply": true, - "strictFunctionTypes": true, - // Volar - "jsx": "preserve" + "outDir": "dist", + "removeComments": false, + "sourceMap": false, + "allowSyntheticDefaultImports": true, + "esModuleInterop": true, + "skipLibCheck": true, + "preserveWatchOutput": true }, "include": [ "src" diff --git a/packages/histoire-plugin-vue/vite.config.ts b/packages/histoire-plugin-vue/vite.config.ts index 180031e7..3bc3247b 100644 --- a/packages/histoire-plugin-vue/vite.config.ts +++ b/packages/histoire-plugin-vue/vite.config.ts @@ -1,5 +1,5 @@ -import { defineConfig } from 'vite' import fs from 'node:fs' +import { defineConfig } from 'vite' import { globbySync } from 'globby' export default defineConfig({ @@ -7,14 +7,14 @@ export default defineConfig({ { name: 'histoire:preserve:import.dynamic', enforce: 'pre', - transform (code) { + transform(code) { if (code.includes('import(')) { return { code: code.replace(/import\(/g, 'import__dyn('), } } }, - closeBundle () { + closeBundle() { try { const files = globbySync('./dist/**/*.js') for (const file of files) { @@ -23,7 +23,8 @@ export default defineConfig({ fs.writeFileSync(file, content.replace(/import__dyn\(/g, 'import(/* @vite-ignore */'), 'utf-8') } } - } catch (e) { + } + catch (e) { console.error(e) } }, diff --git a/packages/histoire-plugin-vue2/package.json b/packages/histoire-plugin-vue2/package.json index 19a16f44..91fb96d9 100644 --- a/packages/histoire-plugin-vue2/package.json +++ b/packages/histoire-plugin-vue2/package.json @@ -1,11 +1,12 @@ { "name": "@histoire/plugin-vue2", + "type": "module", "version": "0.17.16", "description": "Histoire plugin for Vue.js 2 support", - "license": "MIT", "author": { "name": "Guillaume Chau" }, + "license": "MIT", "repository": { "url": "https://github.com/Akryum/histoire.git", "type": "git", @@ -14,7 +15,6 @@ "publishConfig": { "access": "public" }, - "type": "module", "exports": { "./client": { "types": "./dist/client/client.d.ts", @@ -37,6 +37,10 @@ "build:types": "tsc --declaration --emitDeclarationOnly", "watch": "concurrently \"vite build --watch\" \"pnpm run build:types --watch\"" }, + "peerDependencies": { + "histoire": "workspace:^", + "vue": "^2.7.8" + }, "dependencies": { "@histoire/controls": "workspace:^", "@histoire/shared": "workspace:^", @@ -48,12 +52,8 @@ "concurrently": "^7.6.0", "globby": "^13.2.2", "histoire": "workspace:*", - "typescript": "^4.9.5", + "typescript": "^5.4.4", "vite": "^5.0.11", "vue": "^2.7.15" - }, - "peerDependencies": { - "histoire": "workspace:^", - "vue": "^2.7.8" } } diff --git a/packages/histoire-plugin-vue2/src/client/app/MountStory.ts b/packages/histoire-plugin-vue2/src/client/app/MountStory.ts index 17ef17d2..aa5836f5 100644 --- a/packages/histoire-plugin-vue2/src/client/app/MountStory.ts +++ b/packages/histoire-plugin-vue2/src/client/app/MountStory.ts @@ -1,23 +1,23 @@ -/* eslint-disable vue/one-component-per-file */ - -import Vue, { ref, h, provide } from 'vue' +import Vue, { h, provide, ref } from 'vue' +import type { + PropType as _PropType, +} from '@histoire/vendors/vue' import { defineComponent as _defineComponent, - PropType as _PropType, + h as _h, onMounted as _onMounted, onUnmounted as _onUnmounted, ref as _ref, watch as _watch, - h as _h, } from '@histoire/vendors/vue' import type { Story } from '@histoire/shared' // @ts-expect-error virtual module id import * as setup from 'virtual:$histoire-setup' // @ts-expect-error virtual module id import * as generatedSetup from 'virtual:$histoire-generated-global-setup' +import type { Vue2StorySetupApi, Vue2StorySetupHandler } from '../../index.js' import { registerGlobalComponents } from './global-components.js' import { RouterLinkStub } from './RouterLinkStub' -import type { Vue2StorySetupApi, Vue2StorySetupHandler } from '../../index.js' export default _defineComponent({ name: 'MountStory', @@ -29,13 +29,13 @@ export default _defineComponent({ }, }, - setup (props) { + setup(props) { const el = _ref<HTMLDivElement>() let app: Vue const forceUpdateKey = ref(0) - async function mountStory () { + async function mountStory() { const wrappers: any[] = [] // Call app setups to resolve global assets such as components @@ -70,7 +70,7 @@ export default _defineComponent({ app = new Vue({ name: 'MountStorySubApp', - setup () { + setup() { provide('hstStory', props.story) }, @@ -106,7 +106,7 @@ export default _defineComponent({ app.$mount(target) } - function unmountStory () { + function unmountStory() { app?.$destroy() } @@ -135,7 +135,7 @@ export default _defineComponent({ } }, - render () { + render() { return _h('div', { ref: 'el', }) diff --git a/packages/histoire-plugin-vue2/src/client/app/RenderStory.ts b/packages/histoire-plugin-vue2/src/client/app/RenderStory.ts index 72285b5f..c1537ed6 100644 --- a/packages/histoire-plugin-vue2/src/client/app/RenderStory.ts +++ b/packages/histoire-plugin-vue2/src/client/app/RenderStory.ts @@ -1,26 +1,25 @@ -/* eslint-disable vue/one-component-per-file */ - -import Vue, { onMounted, reactive, h } from 'vue' +import Vue, { h, onMounted, reactive } from 'vue' +import type { + PropType as _PropType, +} from '@histoire/vendors/vue' import { defineComponent as _defineComponent, + h as _h, onBeforeUnmount as _onBeforeUnmount, onMounted as _onMounted, - PropType as _PropType, ref as _ref, watch as _watch, - h as _h, } from '@histoire/vendors/vue' -import { applyState } from '@histoire/shared' -import type { Story, Variant, PropDefinition, AutoPropComponentDefinition } from '@histoire/shared' +import type { Story, Variant } from '@histoire/shared' // import { getTagName } from '../codegen' -import { registerGlobalComponents } from './global-components.js' -import { RouterLinkStub } from './RouterLinkStub' // @ts-expect-error virtual module id import * as setup from 'virtual:$histoire-setup' // @ts-expect-error virtual module id import * as generatedSetup from 'virtual:$histoire-generated-global-setup' -import { syncStateBundledAndExternal } from './util.js' import type { Vue2StorySetupApi, Vue2StorySetupHandler } from '../../index.js' +import { registerGlobalComponents } from './global-components.js' +import { RouterLinkStub } from './RouterLinkStub' +import { syncStateBundledAndExternal } from './util.js' export default _defineComponent({ name: 'RenderStory', @@ -46,7 +45,7 @@ export default _defineComponent({ ready: () => true, }, - setup (props, { emit }) { + setup(props, { emit }) { const sandbox = _ref<HTMLDivElement>() let app: Vue let mounting = false @@ -55,20 +54,20 @@ export default _defineComponent({ syncStateBundledAndExternal(props.variant.state, externalState) - function unmountVariant () { + function unmountVariant() { if (app) { app.$destroy() app = null } } - async function mountVariant () { + async function mountVariant() { if (mounting) return mounting = true unmountVariant() - let lastPropsTypesSnapshot: string + // let lastPropsTypesSnapshot: string const wrappers: any[] = [] @@ -111,7 +110,7 @@ export default _defineComponent({ app = new Vue({ name: 'RenderStorySubApp', - setup () { + setup() { onMounted(() => { mounting = false }) @@ -121,9 +120,11 @@ export default _defineComponent({ const ensureFn = (fn: any) => { if (typeof fn === 'function') { return fn - } else if (fn != null) { + } + else if (fn != null) { return () => fn - } else { + } + else { return null } } @@ -255,11 +256,12 @@ export default _defineComponent({ } }) - _watch(() => props.variant, async value => { + _watch(() => props.variant, async (value) => { if (value.configReady && !mounting) { if (!app) { await mountVariant() - } else { + } + else { app.$forceUpdate() } } @@ -276,7 +278,7 @@ export default _defineComponent({ } }, - render () { + render() { return _h('div', { ref: 'sandbox', }) diff --git a/packages/histoire-plugin-vue2/src/client/app/RouterLinkStub.ts b/packages/histoire-plugin-vue2/src/client/app/RouterLinkStub.ts index 506fc006..8d442186 100644 --- a/packages/histoire-plugin-vue2/src/client/app/RouterLinkStub.ts +++ b/packages/histoire-plugin-vue2/src/client/app/RouterLinkStub.ts @@ -28,8 +28,8 @@ export const RouterLinkStub = defineComponent({ default: 'click', }, }, - render (h) { - // @ts-ignore + render(h) { + // @ts-expect-error TODO return h(this.tag, undefined, this.$slots.default) }, }) diff --git a/packages/histoire-plugin-vue2/src/client/app/Story.ts b/packages/histoire-plugin-vue2/src/client/app/Story.ts index 7f2c854b..29d0f92f 100644 --- a/packages/histoire-plugin-vue2/src/client/app/Story.ts +++ b/packages/histoire-plugin-vue2/src/client/app/Story.ts @@ -1,9 +1,11 @@ -import { defineComponent, provide, VNode, h, PropType, getCurrentInstance, reactive, inject } from 'vue' -import { Story, omitInheritStoryProps } from '@histoire/shared' +import type { PropType, VNode } from 'vue' +import { defineComponent, getCurrentInstance, h, inject, provide, reactive } from 'vue' +import type { Story } from '@histoire/shared' +import { omitInheritStoryProps } from '@histoire/shared' import Variant from './Variant' export default Object.assign(defineComponent({ - // eslint-disable-next-line vue/multi-word-component-names + name: 'Story', inheritAttrs: false, @@ -20,7 +22,7 @@ export default Object.assign(defineComponent({ }, }, - setup (props) { + setup(props) { const vm = getCurrentInstance() const story = inject('hstStory') as Story @@ -31,7 +33,7 @@ export default Object.assign(defineComponent({ const implicitState = { $data: storyComponent.data, } - function addImplicitState (key, value) { + function addImplicitState(key, value) { if (typeof value === 'function' || (value?.__file) || typeof value?.render === 'function' || typeof value?.setup === 'function') { return } @@ -49,7 +51,7 @@ export default Object.assign(defineComponent({ // Wrap with reactive to unwrap refs provide('implicitState', () => reactive({ ...implicitState })) - function updateStory () { + function updateStory() { Object.assign(story, { meta: props.meta, slots: () => vm.proxy.$slots, @@ -62,7 +64,7 @@ export default Object.assign(defineComponent({ } }, - render () { + render() { this.updateStory() const [firstVariant] = this.story.variants @@ -70,7 +72,6 @@ export default Object.assign(defineComponent({ return h(Variant, { props: { variant: firstVariant, - // @ts-ignore initState: this.initState, ...this.$attrs, }, @@ -111,7 +112,8 @@ export default Object.assign(defineComponent({ } vnode.key = variant ? `variant-${variant.id}` : `null-variant-${index}` index++ - } else if (vnode.children?.length) { + } + else if (vnode.children?.length) { applyAttrs(vnode.children as VNode[]) } } diff --git a/packages/histoire-plugin-vue2/src/client/app/Variant.ts b/packages/histoire-plugin-vue2/src/client/app/Variant.ts index 6409c77a..01527ef5 100644 --- a/packages/histoire-plugin-vue2/src/client/app/Variant.ts +++ b/packages/histoire-plugin-vue2/src/client/app/Variant.ts @@ -1,4 +1,5 @@ -import { defineComponent, getCurrentInstance, inject, PropType } from 'vue' +import type { PropType } from 'vue' +import { defineComponent, getCurrentInstance, inject } from 'vue' import type { Variant } from '@histoire/shared' import { applyState } from '@histoire/shared' import { syncStateBundledAndExternal, toRawDeep } from './util.js' @@ -6,7 +7,7 @@ import { syncStateBundledAndExternal, toRawDeep } from './util.js' // const logLocation = location.href.includes('__sandbox') ? '[Sandbox]' : '[Host]' export default Object.assign(defineComponent({ - // eslint-disable-next-line vue/multi-word-component-names + name: 'Variant', props: { @@ -46,7 +47,7 @@ export default Object.assign(defineComponent({ }, }, - setup (props) { + setup(props) { const vm = getCurrentInstance() const implicitState = inject<() => any>('implicitState') @@ -60,7 +61,7 @@ export default Object.assign(defineComponent({ syncStateBundledAndExternal(props.variant.state, implicitState()) } - function updateVariant () { + function updateVariant() { if (!props.variant) return Object.assign(props.variant, { slots: () => vm.proxy.$scopedSlots, @@ -79,9 +80,8 @@ export default Object.assign(defineComponent({ } }, - render () { + render() { // Trigger variant updates to (re-)render slots - // @ts-ignore this.updateVariant() return null }, diff --git a/packages/histoire-plugin-vue2/src/client/app/global-components.ts b/packages/histoire-plugin-vue2/src/client/app/global-components.ts index 6d523826..1964d973 100644 --- a/packages/histoire-plugin-vue2/src/client/app/global-components.ts +++ b/packages/histoire-plugin-vue2/src/client/app/global-components.ts @@ -1,18 +1,10 @@ -/* eslint-disable vue/one-component-per-file */ - -import Vue, { - defineComponent, - ref, - h, - onMounted, - onUpdated, - onBeforeUnmount, - computed, -} from 'vue' +import Vue, { computed, defineComponent, h, onBeforeUnmount, onMounted, onUpdated, ref } from 'vue' +import type { + App as _App, +} from '@histoire/vendors/vue' import { createApp as _createApp, h as _h, - App as _App, reactive as _reactive, } from '@histoire/vendors/vue' import { components } from '@histoire/controls' @@ -20,12 +12,11 @@ import Story from './Story' import Variant from './Variant' import { syncStateBundledAndExternal } from './util.js' -export function registerGlobalComponents (app) { +export function registerGlobalComponents(_app) { Vue.config.productionTip = false - // eslint-disable-next-line vue/multi-word-component-names Vue.component('Story', Story) - // eslint-disable-next-line vue/multi-word-component-names + Vue.component('Variant', Variant) for (const key in components) { @@ -33,11 +24,11 @@ export function registerGlobalComponents (app) { } } -function wrapControlComponent (controlComponent) { +function wrapControlComponent(controlComponent) { return defineComponent({ name: controlComponent.name, inheritAttrs: false, - setup (props, { attrs, listeners }) { + setup(props, { attrs, listeners }) { const el = ref<HTMLDivElement>() const slotEl = ref<HTMLDivElement>() @@ -58,7 +49,7 @@ function wrapControlComponent (controlComponent) { let newSlotCalls = [] const slotCalls = ref([]) - function moveSlotContent () { + function moveSlotContent() { slotCalls.value.forEach((props, index) => { const renderedEl = slotEl.value.querySelector(`[renderslotid="${index}"]`) if (!renderedEl) return @@ -76,15 +67,15 @@ function wrapControlComponent (controlComponent) { onMounted(() => { app = _createApp({ - mounted () { + mounted() { slotCalls.value = newSlotCalls newSlotCalls = [] }, - updated () { + updated() { slotCalls.value = newSlotCalls newSlotCalls = [] }, - render () { + render() { const finalAttrs = {} if (state.attrs) { for (const key in state.attrs) { @@ -106,7 +97,7 @@ function wrapControlComponent (controlComponent) { ...finalListeners, key: 'component', }, { - default: props => { + default: (props) => { newSlotCalls.push(props) return _h('div', { slotId: newSlotCalls.length - 1, @@ -132,7 +123,7 @@ function wrapControlComponent (controlComponent) { slotCalls, } }, - render () { + render() { return h('div', [ h('div', { ref: 'el', @@ -143,7 +134,7 @@ function wrapControlComponent (controlComponent) { attrs: { renderSlotId: index, }, - // eslint-disable-next-line vue/no-deprecated-dollar-scopedslots-api + }, this.$scopedSlots.default(props)))), ]) }, diff --git a/packages/histoire-plugin-vue2/src/client/app/util.ts b/packages/histoire-plugin-vue2/src/client/app/util.ts index 768592ba..ffa71f9f 100644 --- a/packages/histoire-plugin-vue2/src/client/app/util.ts +++ b/packages/histoire-plugin-vue2/src/client/app/util.ts @@ -1,17 +1,17 @@ -import { unref, isRef, watch } from 'vue' +import { isRef, unref, watch } from 'vue' import { - unref as _unref, isRef as _isRef, + unref as _unref, watch as _watch, } from '@histoire/vendors/vue' import { applyState } from '@histoire/shared' -const isObject = (val) => val !== null && typeof val === 'object' +const isObject = val => val !== null && typeof val === 'object' /** * Using external/user Vue */ -export function toRawDeep (val, seen = new WeakMap()) { +export function toRawDeep(val, seen = new WeakMap()) { const unwrappedValue = isRef(val) ? unref(val) : val if (typeof unwrappedValue === 'symbol') { @@ -31,7 +31,8 @@ export function toRawDeep (val, seen = new WeakMap()) { seen.set(unwrappedValue, result) result.push(...unwrappedValue.map(value => toRawDeep(value, seen))) return result - } else { + } + else { const result = {} seen.set(unwrappedValue, result) toRawObject(unwrappedValue, result, seen) @@ -39,7 +40,7 @@ export function toRawDeep (val, seen = new WeakMap()) { } } -const toRawObject = (obj: Record<any, any>, target: Record<any, any>, seen = new WeakMap()) => { +function toRawObject(obj: Record<any, any>, target: Record<any, any>, seen = new WeakMap()) { Object.keys(obj).forEach((key) => { target[key] = toRawDeep(obj[key], seen) }) @@ -48,7 +49,7 @@ const toRawObject = (obj: Record<any, any>, target: Record<any, any>, seen = new /** * Using bundled Vue */ -export function _toRawDeep (val, seen = new WeakMap()) { +export function _toRawDeep(val, seen = new WeakMap()) { const unwrappedValue = _isRef(val) ? _unref(val) : val if (typeof unwrappedValue === 'symbol') { @@ -68,7 +69,8 @@ export function _toRawDeep (val, seen = new WeakMap()) { seen.set(unwrappedValue, result) result.push(...unwrappedValue.map(value => _toRawDeep(value, seen))) return result - } else { + } + else { const result = {} seen.set(unwrappedValue, result) _toRawObject(unwrappedValue, result, seen) @@ -76,7 +78,7 @@ export function _toRawDeep (val, seen = new WeakMap()) { } } -const _toRawObject = (obj: Record<any, any>, target: Record<any, any>, seen = new WeakMap()) => { +function _toRawObject(obj: Record<any, any>, target: Record<any, any>, seen = new WeakMap()) { Object.keys(obj).forEach((key) => { target[key] = toRawDeep(obj[key], seen) }) @@ -87,10 +89,10 @@ const _toRawObject = (obj: Record<any, any>, target: Record<any, any>, seen = ne * @param bundledState Reactive state created with the bundled Vue * @param externalState Reactive state created with the external/user Vue */ -export function syncStateBundledAndExternal (bundledState, externalState) { +export function syncStateBundledAndExternal(bundledState, externalState) { let syncing = false - const stop = watch(() => externalState, value => { + const stop = watch(() => externalState, (value) => { if (value == null) return if (!syncing) { syncing = true @@ -98,7 +100,8 @@ export function syncStateBundledAndExternal (bundledState, externalState) { value = value.value } applyState(bundledState, toRawDeep(value)) - } else { + } + else { syncing = false } }, { @@ -106,7 +109,7 @@ export function syncStateBundledAndExternal (bundledState, externalState) { immediate: true, }) - const _stop = _watch(() => bundledState, value => { + const _stop = _watch(() => bundledState, (value) => { if (value == null) return if (!syncing) { syncing = true @@ -114,7 +117,8 @@ export function syncStateBundledAndExternal (bundledState, externalState) { value = value.value } applyState(externalState, _toRawDeep(value)) - } else { + } + else { syncing = false } }, { @@ -123,7 +127,7 @@ export function syncStateBundledAndExternal (bundledState, externalState) { }) return { - stop () { + stop() { _stop() stop() }, diff --git a/packages/histoire-plugin-vue2/src/client/codegen.ts b/packages/histoire-plugin-vue2/src/client/codegen.ts index aaf7b0f0..b5eb452a 100644 --- a/packages/histoire-plugin-vue2/src/client/codegen.ts +++ b/packages/histoire-plugin-vue2/src/client/codegen.ts @@ -1,12 +1,12 @@ /* eslint-disable prefer-const */ // @TODO remove @ts-ignore -import { VNode } from 'vue' -import { pascalCase, paramCase } from 'change-case' +import type { VNode } from 'vue' +import { paramCase, pascalCase } from 'change-case' import { createAutoBuildingObject, indent, serializeJs, voidElements } from '@histoire/shared' import type { Variant } from '@histoire/shared' -export async function generateSourceCode (variant: Variant) { +export async function generateSourceCode(variant: Variant) { const vnode = variant.slots().default?.({ state: variant.state ?? {} }) ?? [] const list = Array.isArray(vnode) ? vnode : [vnode] const lines: string[] = [] @@ -17,7 +17,7 @@ export async function generateSourceCode (variant: Variant) { return lines.join('\n') } -async function printVNode (vnode: VNode, propsOverrides: Record<string, any> = null): Promise<{ lines: string[], isText?: boolean }> { +async function printVNode(vnode: VNode, propsOverrides: Record<string, any> = null): Promise<{ lines: string[], isText?: boolean }> { if (vnode.tag == null && vnode.text) { return { lines: [vnode.text], @@ -34,7 +34,7 @@ async function printVNode (vnode: VNode, propsOverrides: Record<string, any> = n ] // Directives - function genDirective (dirName: string, dir, valueCode: string = null) { + function genDirective(dirName: string, dir, valueCode: string = null) { let modifiers = '' for (const key in dir.modifiers) { if (dir.modifiers[key]) { @@ -57,7 +57,8 @@ async function printVNode (vnode: VNode, propsOverrides: Record<string, any> = n attr.push(...valueLines.slice(1, valueLines.length - 1)) attr.push(`${valueLines[valueLines.length - 1]}"`) multilineAttrs = true - } else { + } + else { attr.push(`${dirAttr}${valueLines[0] ?? ''}"`) } attrs.push(attr) @@ -65,7 +66,7 @@ async function printVNode (vnode: VNode, propsOverrides: Record<string, any> = n if (dirName === 'model') { let propName = 'value' let eventName = 'input' - // @ts-ignore + // @ts-expect-error TODO const modelOption = vnode.componentOptions?.Ctor?.options?.model if (modelOption?.prop) { propName = modelOption.prop @@ -77,9 +78,9 @@ async function printVNode (vnode: VNode, propsOverrides: Record<string, any> = n skipProps.push(eventName) } } - // @ts-ignore + // @ts-expect-error TODO if (vnode.data?.model) { - // @ts-ignore + // @ts-expect-error TODO genDirective('model', vnode.data.model, vnode.data.model.expression) } if (vnode.data?.directives) { @@ -89,7 +90,7 @@ async function printVNode (vnode: VNode, propsOverrides: Record<string, any> = n } // Attributes - function addAttr (prop: string, value: any, isListener = false) { + function addAttr(prop: string, value: any, isListener = false) { let modifiers: string[] = [] const formatModifiers = () => modifiers.map(m => `.${m}`).join('') @@ -97,7 +98,6 @@ async function printVNode (vnode: VNode, propsOverrides: Record<string, any> = n // v-model on component const vmodelListener = `update:${prop}` - // @ts-ignore if (typeof value !== 'string' || vnode.componentOptions?.listeners?.[vmodelListener]) { let directive = ':' if (isListener) { @@ -106,7 +106,6 @@ async function printVNode (vnode: VNode, propsOverrides: Record<string, any> = n let serialized: string[] - // @ts-ignore if (directive === ':' && vnode.componentOptions?.listeners?.[vmodelListener]) { modifiers.push('sync') // Expression @@ -124,13 +123,15 @@ async function printVNode (vnode: VNode, propsOverrides: Record<string, any> = n if (typeof value === 'string' && value.startsWith('{{') && value.endsWith('}}')) { // It was formatted from auto building object (slot props) serialized = cleanupExpression(value.substring(2, value.length - 2).trim()).split('\n') - } else if (typeof value === 'function') { + } + else if (typeof value === 'function') { let code = cleanupExpression(value.toString().replace(/'/g, '\\\'').replace(/"/g, '\'')) const testResult = /function ([^\s]+)\(/.exec(code) if (testResult) { // Function name only serialized = [testResult[1]] - } else { + } + else { if (code.startsWith('($event) => ')) { // Remove unnecessary `($event) => ` code = code.substring('($event) => '.length) @@ -150,7 +151,8 @@ async function printVNode (vnode: VNode, propsOverrides: Record<string, any> = n return } } - } else { + } + else { serialized = serializeAndCleanJs(value) } } @@ -160,10 +162,12 @@ async function printVNode (vnode: VNode, propsOverrides: Record<string, any> = n indented.push(...serialized.slice(1, serialized.length - 1)) indented.push(`${serialized[serialized.length - 1]}"`) attrs.push(indented) - } else { + } + else { attrs.push([`${directive}${prop}${formatModifiers()}="${serialized[0]}"`]) } - } else { + } + else { attrs.push([`${prop}${formatModifiers()}="${value}"`]) } } @@ -243,7 +247,6 @@ async function printVNode (vnode: VNode, propsOverrides: Record<string, any> = n ] let isAllChildText for (const child of rawChildren) { - // @ts-ignore const result = await printVNode(child) if (result.isText) { if (isAllChildText === undefined) { @@ -252,10 +255,12 @@ async function printVNode (vnode: VNode, propsOverrides: Record<string, any> = n const text = result.lines[0] if (!childLines.length || /^\s/.test(text)) { childLines.push(text.trim()) - } else { + } + else { childLines[childLines.length - 1] += text } - } else { + } + else { if (isAllChildText === undefined) { isAllChildText = false } @@ -289,9 +294,11 @@ async function printVNode (vnode: VNode, propsOverrides: Record<string, any> = n childLines.push(`<template #${key}="{ ${slotProps.join(', ')} }">`) childLines.push(...indent(slotLines)) childLines.push('</template>') - } else if (key === 'default') { + } + else if (key === 'default') { childLines.push(...slotLines) - } else { + } + else { childLines.push(`<template #${key}>`) childLines.push(...indent(slotLines)) childLines.push(`</template>`) @@ -308,7 +315,8 @@ async function printVNode (vnode: VNode, propsOverrides: Record<string, any> = n if (childLines.length > 0) { tag.push('>') } - } else { + } + else { if (attrs.length === 1) { tag[0] += ` ${attrs[0]}` } @@ -322,15 +330,18 @@ async function printVNode (vnode: VNode, propsOverrides: Record<string, any> = n if (childLines.length > 0) { if (childLines.length === 1 && tag.length === 1 && !attrs.length && isChildText) { lines.push(`${tag[0]}${childLines[0]}</${tagName}>`) - } else { + } + else { lines.push(...tag) lines.push(...indent(childLines)) lines.push(`</${tagName}>`) } - } else if (tag.length > 1) { + } + else if (tag.length > 1) { lines.push(...tag) lines.push(isVoid ? '>' : '/>') - } else { + } + else { lines.push(`${tag[0]}${isVoid ? '' : ' /'}>`) } @@ -339,22 +350,24 @@ async function printVNode (vnode: VNode, propsOverrides: Record<string, any> = n } } -export function getTagName (vnode: VNode) { +export function getTagName(vnode: VNode) { if (typeof vnode.tag === 'string' && !vnode.componentOptions) { return vnode.tag - // @ts-ignore - } else if (vnode.componentOptions?.Ctor?.options?.name) { - // @ts-ignore + } + // @ts-expect-error TODO + else if (vnode.componentOptions?.Ctor?.options?.name) { + // @ts-expect-error TODO return vnode.componentOptions?.Ctor?.options.name - // @ts-ignore - } else if (vnode.componentOptions?.Ctor?.options?.__file) { - // @ts-ignore + } + // @ts-expect-error TODO + else if (vnode.componentOptions?.Ctor?.options?.__file) { + // @ts-expect-error TODO return getNameFromFile(vnode.componentOptions?.Ctor?.options.__file) } return 'Anonymous' } -function getNameFromFile (file: string) { +function getNameFromFile(file: string) { const parts = /([^/]+)\.vue$/.exec(file) if (parts) { return pascalCase(parts[1]) @@ -362,17 +375,18 @@ function getNameFromFile (file: string) { return 'Anonymous' } -function serializeAndCleanJs (value: any) { +function serializeAndCleanJs(value: any) { const isAutoBuildingObject = !!value?.__autoBuildingObject const result = serializeJs(value) if (isAutoBuildingObject) { - // @ts-ignore + // @ts-expect-error TODO return [cleanupExpression(result.__autoBuildingObjectGetKey)] - } else { + } + else { return cleanupExpression(result).split('\n') } } -function cleanupExpression (expr: string) { +function cleanupExpression(expr: string) { return expr.replace(/\$setup\./g, '') } diff --git a/packages/histoire-plugin-vue2/src/client/server/Story.ts b/packages/histoire-plugin-vue2/src/client/server/Story.ts index 7ec8924b..d0f3f424 100644 --- a/packages/histoire-plugin-vue2/src/client/server/Story.ts +++ b/packages/histoire-plugin-vue2/src/client/server/Story.ts @@ -1,18 +1,19 @@ -import { defineComponent, inject, onMounted, PropType, provide, useAttrs, h } from 'vue' -import type { ServerStoryFile, ServerStory, ServerVariant } from '@histoire/shared' - -const stub = { name: 'StubbedComponent', render: () => null } - -function autoStubComponents (vnodes: any[]) { - for (const vnode of vnodes) { - if (typeof vnode.type === 'object' && (vnode.type as any).name !== 'HistoireVariant') { - vnode.type = stub - } - if (Array.isArray(vnode.children)) { - autoStubComponents(vnode.children) - } - } -} +import type { PropType } from 'vue' +import { defineComponent, h, inject, onMounted, provide } from 'vue' +import type { ServerStory, ServerStoryFile, ServerVariant } from '@histoire/shared' + +// const stub = { name: 'StubbedComponent', render: () => null } + +// function autoStubComponents (vnodes: any[]) { +// for (const vnode of vnodes) { +// if (typeof vnode.type === 'object' && (vnode.type as any).name !== 'HistoireVariant') { +// vnode.type = stub +// } +// if (Array.isArray(vnode.children)) { +// autoStubComponents(vnode.children) +// } +// } +// } export default defineComponent({ name: 'HistoireStory', @@ -61,7 +62,7 @@ export default defineComponent({ }, }, - setup (props) { + setup(props) { const file = inject('htsFile') as ServerStoryFile // Story @@ -102,12 +103,11 @@ export default defineComponent({ } }, - render () { + render() { let suppressError = false try { - // eslint-disable-next-line vue/no-deprecated-dollar-scopedslots-api const vnodes = this.$scopedSlots.default?.({ - get state () { + get state() { // No variant tags suppressError = true return {} @@ -121,7 +121,8 @@ export default defineComponent({ // } return h('div', vnodes) - } catch (e) { + } + catch (e) { if (!suppressError) { console.error(e) } diff --git a/packages/histoire-plugin-vue2/src/client/server/Variant.ts b/packages/histoire-plugin-vue2/src/client/server/Variant.ts index c48b5de2..5ba3d58d 100644 --- a/packages/histoire-plugin-vue2/src/client/server/Variant.ts +++ b/packages/histoire-plugin-vue2/src/client/server/Variant.ts @@ -1,4 +1,4 @@ -import { defineComponent, inject, type PropType } from 'vue' +import { type PropType, defineComponent, inject } from 'vue' import type { ServerStory, ServerVariant } from '@histoire/shared' export default defineComponent({ @@ -31,10 +31,10 @@ export default defineComponent({ }, }, - setup (props) { + setup(props) { const story = inject<ServerStory>('story') - function generateId () { + function generateId() { return `${story.id}-${story.variants.length}` } @@ -50,7 +50,7 @@ export default defineComponent({ addVariant(variant) }, - render () { + render() { return null }, }) diff --git a/packages/histoire-plugin-vue2/src/client/server/run.ts b/packages/histoire-plugin-vue2/src/client/server/run.ts index aa1961f6..d1d207d0 100644 --- a/packages/histoire-plugin-vue2/src/client/server/run.ts +++ b/packages/histoire-plugin-vue2/src/client/server/run.ts @@ -4,11 +4,11 @@ import type { ServerRunPayload } from '@histoire/shared' import * as setup from 'virtual:$histoire-setup' // @ts-expect-error virtual module id import * as generatedSetup from 'virtual:$histoire-generated-global-setup' +import type { Vue2StorySetupApi, Vue2StorySetupHandler } from '../../index.js' import Story from './Story' import Variant from './Variant' -import type { Vue2StorySetupApi, Vue2StorySetupHandler } from '../../index.js' -export async function run ({ file, storyData, el }: ServerRunPayload) { +export async function run({ file, storyData, el }: ServerRunPayload) { const { default: Comp } = await import(/* @vite-ignore */ file.moduleId) // Call app setups to resolve global assets such as components @@ -39,11 +39,11 @@ export async function run ({ file, storyData, el }: ServerRunPayload) { const app = new Vue({ provide: { htsFile: file, - addStory (data) { + addStory(data) { storyData.push(data) }, }, - render () { + render() { return h(Comp, { ref: 'comp', }) @@ -51,9 +51,8 @@ export async function run ({ file, storyData, el }: ServerRunPayload) { ...appOptions, }) - // eslint-disable-next-line vue/multi-word-component-names Vue.component('Story', Story) - // eslint-disable-next-line vue/multi-word-component-names + Vue.component('Variant', Variant) app.$mount(el) @@ -62,7 +61,7 @@ export async function run ({ file, storyData, el }: ServerRunPayload) { const el = document.createElement('div') el.innerHTML = Comp.doc const text = el.textContent - storyData.forEach(s => { + storyData.forEach((s) => { s.docsText = text }) } diff --git a/packages/histoire-plugin-vue2/src/index.ts b/packages/histoire-plugin-vue2/src/index.ts index 7996e0b3..74b459a1 100644 --- a/packages/histoire-plugin-vue2/src/index.ts +++ b/packages/histoire-plugin-vue2/src/index.ts @@ -1,11 +1,11 @@ import type { Plugin } from 'histoire' import type { Story, Variant } from '@histoire/shared' -export function HstVue (): Plugin { +export function HstVue(): Plugin { return { name: '@histoire/plugin-vue2', - defaultConfig () { + defaultConfig() { return { supportMatch: [ { @@ -36,6 +36,6 @@ export interface Vue2StorySetupApi { export type Vue2StorySetupHandler = (api: Vue2StorySetupApi) => Promise<Vue2StorySetupReturn> | Vue2StorySetupReturn -export function defineSetupVue2 (handler: Vue2StorySetupHandler): Vue2StorySetupHandler { +export function defineSetupVue2(handler: Vue2StorySetupHandler): Vue2StorySetupHandler { return handler } diff --git a/packages/histoire-plugin-vue2/tsconfig.json b/packages/histoire-plugin-vue2/tsconfig.json index d2eaabe6..7bc11641 100644 --- a/packages/histoire-plugin-vue2/tsconfig.json +++ b/packages/histoire-plugin-vue2/tsconfig.json @@ -1,32 +1,32 @@ { "compilerOptions": { "target": "ESNext", + // Volar + "jsx": "preserve", + "lib": [ + "ESNext", + "DOM" + ], + "rootDir": "src", "module": "ESNext", "moduleResolution": "node", - "outDir": "dist", - "rootDir": "src", - "allowSyntheticDefaultImports": true, - "esModuleInterop": true, - "removeComments": false, "resolveJsonModule": true, - "skipLibCheck": true, "types": [ "node" ], - "lib": [ - "ESNext", - "DOM" - ], - "sourceMap": false, - "preserveWatchOutput": true, + "strictBindCallApply": true, + "strictFunctionTypes": true, + "alwaysStrict": true, // Strict "noImplicitAny": false, "noImplicitThis": true, - "alwaysStrict": true, - "strictBindCallApply": true, - "strictFunctionTypes": true, - // Volar - "jsx": "preserve", + "outDir": "dist", + "removeComments": false, + "sourceMap": false, + "allowSyntheticDefaultImports": true, + "esModuleInterop": true, + "skipLibCheck": true, + "preserveWatchOutput": true }, "include": [ "src" diff --git a/packages/histoire-plugin-vue2/vite.config.ts b/packages/histoire-plugin-vue2/vite.config.ts index 7a3c0acd..08867350 100644 --- a/packages/histoire-plugin-vue2/vite.config.ts +++ b/packages/histoire-plugin-vue2/vite.config.ts @@ -1,5 +1,5 @@ -import { defineConfig } from 'vite' import fs from 'node:fs' +import { defineConfig } from 'vite' import { globbySync } from 'globby' export default defineConfig({ @@ -7,14 +7,14 @@ export default defineConfig({ { name: 'histoire:preserve:import.dynamic', enforce: 'pre', - transform (code) { + transform(code) { if (code.includes('import(')) { return { code: code.replace(/import\(/g, 'import__dyn('), } } }, - closeBundle () { + closeBundle() { try { const files = globbySync('./dist/**/*.js') for (const file of files) { @@ -23,7 +23,8 @@ export default defineConfig({ fs.writeFileSync(file, content.replace(/import__dyn\(/g, 'import(/* @vite-ignore */'), 'utf-8') } } - } catch (e) { + } + catch (e) { console.error(e) } }, diff --git a/packages/histoire-shared/package.json b/packages/histoire-shared/package.json index 76cdb5a5..23916e57 100644 --- a/packages/histoire-shared/package.json +++ b/packages/histoire-shared/package.json @@ -1,11 +1,12 @@ { "name": "@histoire/shared", + "type": "module", "version": "0.17.16", "description": "Shared utilities for Histoire", - "license": "MIT", "author": { "name": "Guillaume Chau" }, + "license": "MIT", "repository": { "url": "https://github.com/Akryum/histoire.git", "type": "git", @@ -14,7 +15,7 @@ "publishConfig": { "access": "public" }, - "type": "module", + "sideEffects": false, "exports": { ".": "./dist/index.js", "./*": "./*", @@ -23,11 +24,13 @@ "main": "./dist/index.js", "module": "./dist/index.js", "types": "./dist/index.d.ts", - "sideEffects": false, "scripts": { "build": "rimraf dist && tsc -d", "watch": "tsc -d -w --sourceMap" }, + "peerDependencies": { + "vite": "^2.9.0 || ^3.0.0 || ^4.0.0 || ^5.0.0" + }, "dependencies": { "@histoire/vendors": "workspace:^", "@types/fs-extra": "^9.0.13", @@ -36,11 +39,8 @@ "pathe": "^1.1.1", "picocolors": "^1.0.0" }, - "peerDependencies": { - "vite": "^2.9.0 || ^3.0.0 || ^4.0.0 || ^5.0.0" - }, "devDependencies": { - "typescript": "^4.9.5", + "typescript": "^5.4.4", "vite": "^5.0.11" } } diff --git a/packages/histoire-shared/src/codegen/const.ts b/packages/histoire-shared/src/codegen/const.ts index 4663075e..807c442e 100644 --- a/packages/histoire-shared/src/codegen/const.ts +++ b/packages/histoire-shared/src/codegen/const.ts @@ -1,3 +1,17 @@ export const voidElements = [ - 'area', 'base', 'br', 'col', 'embed', 'hr', 'img', 'input', 'keygen', 'link', 'meta', 'param', 'source', 'track', 'wbr', + 'area', + 'base', + 'br', + 'col', + 'embed', + 'hr', + 'img', + 'input', + 'keygen', + 'link', + 'meta', + 'param', + 'source', + 'track', + 'wbr', ] diff --git a/packages/histoire-shared/src/codegen/serialize-js.ts b/packages/histoire-shared/src/codegen/serialize-js.ts index 0ae0121a..c2b7c080 100644 --- a/packages/histoire-shared/src/codegen/serialize-js.ts +++ b/packages/histoire-shared/src/codegen/serialize-js.ts @@ -6,7 +6,7 @@ interface Line { line: string } -export function serializeJs (value: any): string { +export function serializeJs(value: any): string { const seen = new Set() if (value === undefined) { @@ -36,20 +36,21 @@ export function serializeJs (value: any): string { return value.toString() } -function printLines (lines: Line[]) { +function printLines(lines: Line[]) { return lines.map(line => ' '.repeat(line.spaces) + line.line).join('\n') } -function objectToSourceLines (object, seen: Set<unknown>, indentCount = 0) { +function objectToSourceLines(object, seen: Set<unknown>, indentCount = 0) { if (seen.has(object)) { object = {} - } else { + } + else { seen.add(object) } - return createLines(indentCount, lines => { + return createLines(indentCount, (lines) => { lines.push('{') - lines.push(...createLines(1, lines => { + lines.push(...createLines(1, (lines) => { for (const key in object) { const value = object[key] @@ -65,37 +66,40 @@ function objectToSourceLines (object, seen: Set<unknown>, indentCount = 0) { }) } -function arrayToSourceLines (array: any[], seen: Set<unknown>, indentCount = 0): Array<Line> { +function arrayToSourceLines(array: any[], seen: Set<unknown>, indentCount = 0): Array<Line> { if (seen.has(array)) { array = [] - } else { + } + else { seen.add(array) } - return createLines(indentCount, lines => { - const contentLines = createLines(1, lines => { + return createLines(indentCount, (lines) => { + const contentLines = createLines(1, (lines) => { for (const value of array) { addLinesFromValue(lines, value, '', ',', seen) } }) if (contentLines.length === 0) { lines.push('[]') - } else if (contentLines.length <= MAX_SINGLE_LINE_ARRAY_LENGTH && !contentLines.some(line => line.spaces > 1)) { + } + else if (contentLines.length <= MAX_SINGLE_LINE_ARRAY_LENGTH && !contentLines.some(line => line.spaces > 1)) { const [first] = contentLines first.line = contentLines.map(({ line }) => line.substring(0, line.length - 1)).join(', ') first.line = `[${first.line}]` first.spaces-- lines.push(first) - } else { + } + else { lines.push('[', ...contentLines, ']') } }) } -function createLines (indentCount: number, handler: (lines: any[]) => unknown): Array<Line> { +function createLines(indentCount: number, handler: (lines: any[]) => unknown): Array<Line> { const lines: any[] = [] handler(lines) - return lines.map(line => { + return lines.map((line) => { if (line.spaces != null) { line.spaces += indentCount return line @@ -104,29 +108,35 @@ function createLines (indentCount: number, handler: (lines: any[]) => unknown): }) } -function addLinesFromValue (lines: Line[], value, before, after, seen) { +function addLinesFromValue(lines: Line[], value, before, after, seen) { let result if (Array.isArray(value)) { lines.push(...wrap(arrayToSourceLines(value, seen), before, after)) return - } else if (value && typeof value === 'object') { + } + else if (value && typeof value === 'object') { lines.push(...wrap(objectToSourceLines(value, seen), before, after)) return - } else if (typeof value === 'string') { + } + else if (typeof value === 'string') { result = value.includes('\'') ? `\`${value}\`` : `'${value}'` - } else if (typeof value === 'undefined') { + } + else if (typeof value === 'undefined') { result = 'undefined' - } else if (value === null) { + } + else if (value === null) { result = 'null' - } else if (typeof value === 'boolean') { + } + else if (typeof value === 'boolean') { result = value ? 'true' : 'false' - } else { + } + else { result = value } lines.push(before + result + after) } -function wrap (lines: Line[], before: string, after: string) { +function wrap(lines: Line[], before: string, after: string) { lines[0].line = before + lines[0].line lines[lines.length - 1].line += after return lines diff --git a/packages/histoire-shared/src/codegen/util.ts b/packages/histoire-shared/src/codegen/util.ts index fc1d384a..b9b89521 100644 --- a/packages/histoire-shared/src/codegen/util.ts +++ b/packages/histoire-shared/src/codegen/util.ts @@ -1,10 +1,8 @@ -/* eslint-disable @typescript-eslint/ban-types */ - -export function indent (lines: string[], count = 1) { +export function indent(lines: string[], count = 1) { return lines.map(line => `${' '.repeat(count)}${line}`) } -export function unindent (code: string) { +export function unindent(code: string) { const lines = code.split('\n') let indentLevel = -1 let indentText: string @@ -30,15 +28,15 @@ interface AutoBuildingOject { proxy: any } -export function createAutoBuildingObject (format?: (key: string) => string, specialKeysHandler?: (target: any, p: string | symbol) => (() => unknown) | null, key = '', depth = 0): AutoBuildingOject { +export function createAutoBuildingObject(format?: (key: string) => string, specialKeysHandler?: (target: any, p: string | symbol) => (() => unknown) | null, key = '', depth = 0): AutoBuildingOject { const cache: Record<string | symbol, AutoBuildingOject> = {} if (depth > 32) return { key, cache, target: {}, proxy: () => key } const target: any = () => { - const k = key + '()' + const k = `${key}()` return format ? format(k) : k } const proxy = new Proxy(target, { - get (_, p) { + get(_, p) { if (p === '__autoBuildingObject') { return true } @@ -52,7 +50,7 @@ export function createAutoBuildingObject (format?: (key: string) => string, spec } } if (p === 'toString') { - const k = key + '.toString()' + const k = `${key}.toString()` return () => format ? format(k) : k } if (p === Symbol.toPrimitive) { @@ -65,7 +63,7 @@ export function createAutoBuildingObject (format?: (key: string) => string, spec } return cache[p].proxy }, - apply (_, thisArg, args) { + apply(_, thisArg, args) { const k = `${key}(${args.join(', ')})` return format ? format(k) : k }, diff --git a/packages/histoire-shared/src/state.ts b/packages/histoire-shared/src/state.ts index 6ab07e64..21351b8d 100644 --- a/packages/histoire-shared/src/state.ts +++ b/packages/histoire-shared/src/state.ts @@ -1,18 +1,20 @@ -export function clone (data) { +export function clone(data) { try { return structuredClone(data) - } catch (e) { + } + catch (e) { console.warn(e, `Fallback to JSON cloning`) try { return JSON.parse(JSON.stringify(data)) - } catch (e) { + } + catch (e) { console.error(e) } return data } } -export function omit (data, keys: string[]) { +export function omit(data, keys: string[]) { const copy = {} for (const key in data) { if (!keys.includes(key)) { @@ -22,15 +24,17 @@ export function omit (data, keys: string[]) { return copy } -export function applyState (target: any, state: any, override = false) { +export function applyState(target: any, state: any, override = false) { for (const key in state) { // iframe sync needs to update properties without overriding them if (!override && target[key] && !key.startsWith('_h') && typeof target[key] === 'object' && !Array.isArray(target[key])) { Object.assign(target[key], state[key]) - } else { + } + else { try { target[key] = state[key] - } catch (e) { + } + catch (e) { // noop } } diff --git a/packages/histoire-shared/src/types/command.ts b/packages/histoire-shared/src/types/command.ts index f0eb1ccb..436a28e2 100644 --- a/packages/histoire-shared/src/types/command.ts +++ b/packages/histoire-shared/src/types/command.ts @@ -31,7 +31,7 @@ export interface ClientCommandContext { } export interface PluginCommand< - TParams = Record<string, any> + TParams = Record<string, any>, > extends Command { serverAction?: (params: TParams) => unknown // @TODO ctx clientSetupFile?: string | { file: string, importName: string } diff --git a/packages/histoire-shared/src/types/config.ts b/packages/histoire-shared/src/types/config.ts index a4e8496b..132ea6b1 100644 --- a/packages/histoire-shared/src/types/config.ts +++ b/packages/histoire-shared/src/types/config.ts @@ -108,7 +108,7 @@ export interface HistoireConfig { colors?: { [key in CustomizableColors]?: key extends 'gray' ? { [key in GrayColorKeys]?: string - } :{ + } : { [key in ColorKeys]?: string } } diff --git a/packages/histoire-shared/src/types/plugin.ts b/packages/histoire-shared/src/types/plugin.ts index fbb0af03..dcb1ab59 100644 --- a/packages/histoire-shared/src/types/plugin.ts +++ b/packages/histoire-shared/src/types/plugin.ts @@ -3,19 +3,19 @@ import type fs from 'fs-extra' import type pc from 'picocolors' import type chokidar from 'chokidar' import type { InlineConfig as ViteInlineConfig } from 'vite' +import type { Awaitable } from '../type-utils.js' import type { - ServerStoryFile, ServerStory, + ServerStoryFile, ServerVariant, } from './story.js' import type { - HistoireConfig, ConfigMode, + HistoireConfig, } from './config.js' import type { PluginCommand, } from './command.js' -import type { Awaitable } from '../type-utils.js' export interface SupportPlugin { id: string @@ -47,10 +47,10 @@ export interface PluginApiBase { warn: (...msg) => void error: (...msg) => void - getStories (): ServerStory[] + getStories: () => ServerStory[] addStoryFile: (file: string) => void - getConfig (): HistoireConfig + getConfig: () => HistoireConfig } export interface PluginApiDev extends PluginApiBase { diff --git a/packages/histoire-shared/src/types/prompt.ts b/packages/histoire-shared/src/types/prompt.ts index b17d3b1e..fc10ec5b 100644 --- a/packages/histoire-shared/src/types/prompt.ts +++ b/packages/histoire-shared/src/types/prompt.ts @@ -1,4 +1,4 @@ -import { Awaitable } from '../type-utils.js' +import type { Awaitable } from '../type-utils.js' export interface PromptBase<TValue> { field: string @@ -18,5 +18,6 @@ export interface SelectPrompt extends PromptBase<string> { options: SelectPromptOption[] | ((search: string, answers: Record<string, any>) => Awaitable<SelectPromptOption[]>) } +// eslint-disable-next-line unused-imports/no-unused-vars export type Prompt<TValue = any> = TextPrompt -| SelectPrompt + | SelectPrompt diff --git a/packages/histoire-shared/tsconfig.json b/packages/histoire-shared/tsconfig.json index bcef95f0..9d7786f1 100644 --- a/packages/histoire-shared/tsconfig.json +++ b/packages/histoire-shared/tsconfig.json @@ -1,30 +1,16 @@ { "compilerOptions": { "target": "ESNext", - "module": "ESNext", - "moduleResolution": "node", - "outDir": "dist", - "rootDir": "src", - "baseUrl": ".", - "allowSyntheticDefaultImports": true, - "esModuleInterop": true, - "removeComments": false, - "resolveJsonModule": true, - "skipLibCheck": true, + // Volar + "jsx": "preserve", "lib": [ "ESNext", "DOM" ], - "sourceMap": false, - "preserveWatchOutput": true, - // Strict - "noImplicitAny": false, - "noImplicitThis": true, - "alwaysStrict": true, - "strictBindCallApply": true, - "strictFunctionTypes": true, - // Volar - "jsx": "preserve", + "baseUrl": ".", + "rootDir": "src", + "module": "ESNext", + "moduleResolution": "node", // Alias "paths": { "floating-vue": ["node_modules/@histoire/vendors/floating-vue"], @@ -34,7 +20,21 @@ "vue-router": ["node_modules/@histoire/vendors/vue-router"], "@vueuse/core": ["node_modules/@histoire/vendors/vue-use"], "vue": ["node_modules/@histoire/vendors/vue"] - } + }, + "resolveJsonModule": true, + "strictBindCallApply": true, + "strictFunctionTypes": true, + "alwaysStrict": true, + // Strict + "noImplicitAny": false, + "noImplicitThis": true, + "outDir": "dist", + "removeComments": false, + "sourceMap": false, + "allowSyntheticDefaultImports": true, + "esModuleInterop": true, + "skipLibCheck": true, + "preserveWatchOutput": true }, "include": [ "src" diff --git a/packages/histoire-vendors/floating-vue.d.ts b/packages/histoire-vendors/floating-vue.d.ts index a209ed92..adb334af 100644 --- a/packages/histoire-vendors/floating-vue.d.ts +++ b/packages/histoire-vendors/floating-vue.d.ts @@ -1,3 +1,4 @@ import Default from './dist/client/b-floating-vue' + export default Default export * from './dist/client/b-floating-vue' diff --git a/packages/histoire-vendors/iconify.d.ts b/packages/histoire-vendors/iconify.d.ts index 2fd2b213..e9f9a79f 100644 --- a/packages/histoire-vendors/iconify.d.ts +++ b/packages/histoire-vendors/iconify.d.ts @@ -1,3 +1,4 @@ import Default from './dist/client/b-iconify' + export default Default export * from './dist/client/b-iconify' diff --git a/packages/histoire-vendors/package.json b/packages/histoire-vendors/package.json index bb752178..ee7737ba 100644 --- a/packages/histoire-vendors/package.json +++ b/packages/histoire-vendors/package.json @@ -1,11 +1,12 @@ { "name": "@histoire/vendors", + "type": "module", "version": "0.17.16", "description": "Bundled vendors for histoire", - "license": "MIT", "author": { "name": "Guillaume Chau" }, + "license": "MIT", "repository": { "url": "https://github.com/Akryum/histoire.git", "type": "git", @@ -14,7 +15,7 @@ "publishConfig": { "access": "public" }, - "type": "module", + "sideEffects": false, "exports": { "./floating-vue": "./dist/client/b-floating-vue.js", "./iconify": "./dist/client/b-iconify.js", @@ -25,7 +26,6 @@ "./vue": "./dist/client/b-vue.js", "./*": "./*" }, - "sideEffects": false, "scripts": { "build": "rimraf dist && rollup -c rollup.config.mjs" }, @@ -43,7 +43,7 @@ "rollup": "^4.8.0", "rollup-plugin-typescript2": "^0.34.1", "scroll-into-view-if-needed": "^2.2.31", - "typescript": "^4.9.5", + "typescript": "^5.4.4", "vue": "^3.3.8", "vue-router": "^4.2.5" } diff --git a/packages/histoire-vendors/pinia.d.ts b/packages/histoire-vendors/pinia.d.ts index 5f2ce725..14f2b542 100644 --- a/packages/histoire-vendors/pinia.d.ts +++ b/packages/histoire-vendors/pinia.d.ts @@ -1,3 +1,4 @@ import Default from './dist/client/b-pinia' + export default Default export * from './dist/client/b-pinia' diff --git a/packages/histoire-vendors/rollup.config.mjs b/packages/histoire-vendors/rollup.config.mjs index 0339febf..8b185bd0 100644 --- a/packages/histoire-vendors/rollup.config.mjs +++ b/packages/histoire-vendors/rollup.config.mjs @@ -1,6 +1,6 @@ -import { createRequire } from 'module' -import { fileURLToPath } from 'url' -import path from 'path' +import { createRequire } from 'node:module' +import { fileURLToPath } from 'node:url' +import path from 'node:path' import { defineConfig } from 'rollup' import ts from 'rollup-plugin-typescript2' import resolve from '@rollup/plugin-node-resolve' @@ -67,6 +67,7 @@ export default defineConfig({ { const filepath = file.replace(/\.d\.ts$/, '') const content = `import Default from '${filepath}' + export default Default export * from '${filepath}'\n`.replace(/\n/g, process.platform === 'win32' ? '\r\n' : '\n') fs.writeFileSync(path.basename(file).replace(/^b-/, ''), content, 'utf-8') @@ -93,7 +94,8 @@ export * from '${filepath}'\n`.replace(/\n/g, process.platform === 'win32' ? '\r pkgExports['./*'] = './*' pkg.exports = pkgExports fs.writeJsonSync('./package.json', pkg, { spaces: 2 }) - } catch (e) { + } + catch (e) { console.error(e) } }, diff --git a/packages/histoire-vendors/scroll.d.ts b/packages/histoire-vendors/scroll.d.ts index 2379c355..39d220fa 100644 --- a/packages/histoire-vendors/scroll.d.ts +++ b/packages/histoire-vendors/scroll.d.ts @@ -1,3 +1,4 @@ import Default from './dist/client/b-scroll' + export default Default export * from './dist/client/b-scroll' diff --git a/packages/histoire-vendors/src/client/b-floating-vue.ts b/packages/histoire-vendors/src/client/b-floating-vue.ts index 86e75b9d..86a06990 100644 --- a/packages/histoire-vendors/src/client/b-floating-vue.ts +++ b/packages/histoire-vendors/src/client/b-floating-vue.ts @@ -1,3 +1,5 @@ +// eslint-disable-next-line import/no-named-default import { default as Default } from 'floating-vue' + export * from 'floating-vue' export default Default diff --git a/packages/histoire-vendors/src/client/b-scroll.ts b/packages/histoire-vendors/src/client/b-scroll.ts index 36a34f13..9855cb78 100644 --- a/packages/histoire-vendors/src/client/b-scroll.ts +++ b/packages/histoire-vendors/src/client/b-scroll.ts @@ -1,2 +1,4 @@ +// eslint-disable-next-line import/no-named-default import { default as Default } from 'scroll-into-view-if-needed' + export default Default diff --git a/packages/histoire-vendors/tsconfig.json b/packages/histoire-vendors/tsconfig.json index e28b5008..cb5d3934 100644 --- a/packages/histoire-vendors/tsconfig.json +++ b/packages/histoire-vendors/tsconfig.json @@ -1,32 +1,32 @@ { "compilerOptions": { "target": "ESNext", + // Volar + "jsx": "preserve", + "lib": [ + "ESNext", + "DOM" + ], "module": "ESNext", "moduleResolution": "node", - "outDir": "dist", - "allowSyntheticDefaultImports": true, - "esModuleInterop": true, - "removeComments": false, "resolveJsonModule": true, - "skipLibCheck": true, - "declaration": true, "types": [ "node" ], - "lib": [ - "ESNext", - "DOM" - ], - "sourceMap": false, - "preserveWatchOutput": true, + "strictBindCallApply": true, + "strictFunctionTypes": true, + "alwaysStrict": true, // Strict "noImplicitAny": false, "noImplicitThis": true, - "alwaysStrict": true, - "strictBindCallApply": true, - "strictFunctionTypes": true, - // Volar - "jsx": "preserve", + "declaration": true, + "outDir": "dist", + "removeComments": false, + "sourceMap": false, + "allowSyntheticDefaultImports": true, + "esModuleInterop": true, + "skipLibCheck": true, + "preserveWatchOutput": true }, "include": [ "src" diff --git a/packages/histoire-vendors/vue-router.d.ts b/packages/histoire-vendors/vue-router.d.ts index 9aead41e..bcdcf2b3 100644 --- a/packages/histoire-vendors/vue-router.d.ts +++ b/packages/histoire-vendors/vue-router.d.ts @@ -1,3 +1,4 @@ import Default from './dist/client/b-vue-router' + export default Default export * from './dist/client/b-vue-router' diff --git a/packages/histoire-vendors/vue-use.d.ts b/packages/histoire-vendors/vue-use.d.ts index 98ba9ff3..3aa0ffa4 100644 --- a/packages/histoire-vendors/vue-use.d.ts +++ b/packages/histoire-vendors/vue-use.d.ts @@ -1,3 +1,4 @@ import Default from './dist/client/b-vue-use' + export default Default export * from './dist/client/b-vue-use' diff --git a/packages/histoire-vendors/vue.d.ts b/packages/histoire-vendors/vue.d.ts index ef697bb3..c88ef7e4 100644 --- a/packages/histoire-vendors/vue.d.ts +++ b/packages/histoire-vendors/vue.d.ts @@ -1,3 +1,4 @@ import Default from './dist/client/b-vue' + export default Default export * from './dist/client/b-vue' diff --git a/packages/histoire/client.d.ts b/packages/histoire/client.d.ts index 63667534..df10579c 100644 --- a/packages/histoire/client.d.ts +++ b/packages/histoire/client.d.ts @@ -1,19 +1,19 @@ /** * @deprecated */ -export function hstEvent (name: string, argument): void +export function hstEvent(name: string, argument): void /** * Logs an event to the 'Events' sidepane. * @param name Event name * @param argument Additional log data displayed when inspecting the event. */ -export function logEvent (name: string, argument): void +export function logEvent(name: string, argument): void /** * Returns `true` when in the NodeJS server while collecting stories. */ -export function isCollecting (): boolean +export function isCollecting(): boolean -export function toggleDark (value?: boolean): boolean -export function isDark (): boolean +export function toggleDark(value?: boolean): boolean +export function isDark(): boolean diff --git a/packages/histoire/client.js b/packages/histoire/client.js index a22a03a3..c75ea7b9 100644 --- a/packages/histoire/client.js +++ b/packages/histoire/client.js @@ -2,14 +2,14 @@ import { logEvent } from '@histoire/app' export * from '@histoire/app' -export function isCollecting () { +export function isCollecting() { return process.env.HST_COLLECT === 'true' } /** * @deprecated */ -export function hstEvent (...args) { +export function hstEvent(...args) { console.warn(`'hstEvent' is deprecated. Use 'logEvent' instead.`) return logEvent(...args) } diff --git a/packages/histoire/package.json b/packages/histoire/package.json index 4433995c..93d679c2 100644 --- a/packages/histoire/package.json +++ b/packages/histoire/package.json @@ -1,11 +1,12 @@ { "name": "histoire", + "type": "module", "version": "0.17.16", "description": "A fast story book powered by Vite", - "license": "MIT", "author": { "name": "Guillaume Chau" }, + "license": "MIT", "repository": { "url": "https://github.com/Akryum/histoire.git", "type": "git", @@ -14,7 +15,6 @@ "publishConfig": { "access": "public" }, - "type": "module", "exports": { ".": { "types": "./dist/node/index.d.ts", @@ -42,6 +42,9 @@ "test": "vitest run", "test:dev": "vitest" }, + "peerDependencies": { + "vite": "^2.9.0 || ^3.0.0 || ^4.0.0 || ^5.0.0" + }, "dependencies": { "@akryum/tinypool": "^0.3.1", "@histoire/app": "workspace:^", @@ -75,9 +78,6 @@ "sirv": "^2.0.3", "vite-node": "^0.34.6" }, - "peerDependencies": { - "vite": "^2.9.0 || ^3.0.0 || ^4.0.0 || ^5.0.0" - }, "devDependencies": { "@types/fs-extra": "^9.0.13", "@types/markdown-it": "^12.2.3", @@ -85,7 +85,7 @@ "@types/node": "^18.11.9", "esbuild": "^0.18.20", "rollup": "^4.8.0", - "typescript": "^4.9.5", + "typescript": "^5.4.4", "vite": "^5.0.11", "vitest": "^0.34.6" } diff --git a/packages/histoire/plugin.d.ts b/packages/histoire/plugin.d.ts index 6d50cdf5..7240bdfe 100644 --- a/packages/histoire/plugin.d.ts +++ b/packages/histoire/plugin.d.ts @@ -1,3 +1,3 @@ -export function sendEvent (event: string, payload?: any): Promise<any> +export function sendEvent(event: string, payload?: any): Promise<any> -export function openStory (storyId: string): void +export function openStory(storyId: string): void diff --git a/packages/histoire/plugin.js b/packages/histoire/plugin.js index b1d880f7..87a99e2e 100644 --- a/packages/histoire/plugin.js +++ b/packages/histoire/plugin.js @@ -1,10 +1,10 @@ -export function sendEvent (event, payload) { +export function sendEvent(event, payload) { if (window.__HST_PLUGIN_API__) { return window.__HST_PLUGIN_API__.sendEvent(event, payload) } } -export function openStory (storyId) { +export function openStory(storyId) { if (window.__HST_PLUGIN_API__) { return window.__HST_PLUGIN_API__.openStory(storyId) } diff --git a/packages/histoire/src/node/__tests__/markdown.spec.ts b/packages/histoire/src/node/__tests__/markdown.spec.ts index 11bae242..d998945c 100644 --- a/packages/histoire/src/node/__tests__/markdown.spec.ts +++ b/packages/histoire/src/node/__tests__/markdown.spec.ts @@ -1,9 +1,10 @@ import { createWriteStream, unlinkSync } from 'node:fs' import path from 'node:path' -import { describe, test, expect, vi, beforeEach, afterEach } from 'vitest' +import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest' import { createMarkdownFilesWatcher } from '../markdown.js' import { watchStories } from '../stories.js' -import { Context, createContext } from '../context.js' +import type { Context } from '../context.js' +import { createContext } from '../context.js' describe('markdown', async () => { vi.spyOn(process, 'cwd').mockReturnValue(path.resolve(__dirname, './markdown')) @@ -24,7 +25,7 @@ describe('markdown', async () => { storyWatcher.close() }) - test('should not throw error or depend on - resolve order for linking', async () => { + it('should not throw error or depend on - resolve order for linking', async () => { // FileWatcher should pickup the test markdown files (test1 and test2) // test1 links to test2 (issue previously as test1 resolved first) // test 2 links to test1 @@ -33,21 +34,22 @@ describe('markdown', async () => { stop() }) - test('should render html from md', async () => { + it('should render html from md', async () => { const { stop } = await createMarkdownFilesWatcher(ctx) expect(ctx.markdownFiles[0].html).toContain('<p>') stop() }) - test('should throw error on missing [md] story file.', async () => { + it('should throw error on missing [md] story file.', async () => { const testFile3 = '/markdown/test3.story.md' const writer = createWriteStream(__dirname.concat(testFile3)) // link to missing file. writer.write( - '<!-- File should link to test1 file. -->\n' + - '# Test3\n\n' + - 'Link to test 4\n' + - '[TEST](./test4.story.md)\n') + '<!-- File should link to test1 file. -->\n' + + '# Test3\n\n' + + 'Link to test 4\n' + + '[TEST](./test4.story.md)\n', + ) writer.end() await new Promise(resolve => writer.on('finish', resolve)) diff --git a/packages/histoire/src/node/__tests__/tree.spec.ts b/packages/histoire/src/node/__tests__/tree.spec.ts index 5c0928de..d246975c 100644 --- a/packages/histoire/src/node/__tests__/tree.spec.ts +++ b/packages/histoire/src/node/__tests__/tree.spec.ts @@ -1,4 +1,4 @@ -import { describe, test, expect } from 'vitest' +import { describe, expect, it } from 'vitest' import type { ServerStoryFile } from '@histoire/shared' import { makeTree } from '../tree.js' import { getDefaultConfig } from '../config.js' @@ -9,7 +9,7 @@ interface StoryFileFactoryOptions { treePath: string[] } -function storyFileFactory (options: StoryFileFactoryOptions): ServerStoryFile { +function storyFileFactory(options: StoryFileFactoryOptions): ServerStoryFile { return { id: `id_${id++}`, path: options.treePath.join('/'), @@ -22,7 +22,7 @@ function storyFileFactory (options: StoryFileFactoryOptions): ServerStoryFile { } describe('makeTree', () => { - test('should create an ascending ordered tree', () => { + it('should create an ascending ordered tree', () => { const config = getDefaultConfig() const files = [ { treePath: ['hi'] }, @@ -46,7 +46,7 @@ describe('makeTree', () => { ]) }) - test('should handle title conflict', () => { + it('should handle title conflict', () => { const config = getDefaultConfig() const files = [ { treePath: ['hi'] }, @@ -63,7 +63,7 @@ describe('makeTree', () => { ]) }) - test('should handle file-folder conflict when folder in first', () => { + it('should handle file-folder conflict when folder in first', () => { const config = getDefaultConfig() const files = [ { treePath: ['hi', 'dad'] }, @@ -85,7 +85,7 @@ describe('makeTree', () => { ]) }) - test('should handle file-folder conflict when file in first', () => { + it('should handle file-folder conflict when file in first', () => { const config = getDefaultConfig() const files = [ { treePath: ['hi'] }, diff --git a/packages/histoire/src/node/alias.ts b/packages/histoire/src/node/alias.ts index cf87655a..82523387 100644 --- a/packages/histoire/src/node/alias.ts +++ b/packages/histoire/src/node/alias.ts @@ -1,5 +1,5 @@ -import path from 'pathe' import { createRequire } from 'node:module' +import path from 'pathe' const require = createRequire(import.meta.url) diff --git a/packages/histoire/src/node/bin.ts b/packages/histoire/src/node/bin.ts index 792a07de..081a20ca 100644 --- a/packages/histoire/src/node/bin.ts +++ b/packages/histoire/src/node/bin.ts @@ -1,6 +1,6 @@ import fs from 'node:fs' -import { dirname, resolve } from 'pathe' import { fileURLToPath } from 'node:url' +import { dirname, resolve } from 'pathe' import sade from 'sade' const __dirname = dirname(fileURLToPath(import.meta.url)) diff --git a/packages/histoire/src/node/build-serialize.ts b/packages/histoire/src/node/build-serialize.ts index 36f75b6f..5691297f 100644 --- a/packages/histoire/src/node/build-serialize.ts +++ b/packages/histoire/src/node/build-serialize.ts @@ -1,5 +1,5 @@ -import type { Context } from './context.js' import type { ServerStory } from '@histoire/shared' +import type { Context } from './context.js' interface SerializedStory extends Omit<ServerStory, 'docsText'> { relativePath: string @@ -21,7 +21,7 @@ interface SerializedStoryData { markdownFiles: SerializedMarkdownFile[] } -export function getSerializedStoryData (ctx: Context): SerializedStoryData { +export function getSerializedStoryData(ctx: Context): SerializedStoryData { const data: SerializedStoryData = { stories: [], markdownFiles: [], @@ -39,11 +39,11 @@ export function getSerializedStoryData (ctx: Context): SerializedStoryData { virtual: storyFile.virtual, markdownFile: storyFile.markdownFile ? { - id: storyFile.markdownFile.id, - relativePath: storyFile.markdownFile.relativePath, - isRelatedToStory: storyFile.markdownFile.isRelatedToStory, - frontmatter: storyFile.markdownFile.frontmatter, - } + id: storyFile.markdownFile.id, + relativePath: storyFile.markdownFile.relativePath, + isRelatedToStory: storyFile.markdownFile.isRelatedToStory, + frontmatter: storyFile.markdownFile.frontmatter, + } : null, }) } diff --git a/packages/histoire/src/node/build.ts b/packages/histoire/src/node/build.ts index 9b2eec75..597eee2f 100644 --- a/packages/histoire/src/node/build.ts +++ b/packages/histoire/src/node/build.ts @@ -1,23 +1,25 @@ +import { performance } from 'node:perf_hooks' import { join } from 'pathe' +import type { + InlineConfig as ViteInlineConfig, + Plugin as VitePlugin, +} from 'vite' import { - build as viteBuild, createServer as createViteServer, - InlineConfig as ViteInlineConfig, mergeConfig as mergeViteConfig, - Plugin as VitePlugin, + build as viteBuild, } from 'vite' import fs from 'fs-extra' import { lookup as lookupMime } from 'mrmime' import pc from 'picocolors' -import { performance } from 'node:perf_hooks' import type { - ChangeViteConfigCallback, BuildEndCallback, + ChangeViteConfigCallback, PreviewStoryCallback, } from '@histoire/shared' import type { RollupOutput } from 'rollup' import { APP_PATH } from './alias.js' -import { Context } from './context.js' +import type { Context } from './context.js' import { getViteConfigWithPlugins } from './vite.js' import { findAllStories } from './stories.js' import { useCollectStories } from './collect/index.js' @@ -37,7 +39,7 @@ const PREFETCHED_MODULES = [ 'global-components', ] -export async function build (ctx: Context) { +export async function build(ctx: Context) { const startTime = performance.now() await findAllStories(ctx) @@ -94,7 +96,7 @@ export async function build (ctx: Context) { { name: 'histoire-build-rollup-options-override', enforce: 'post', - options (options) { + options(options) { // Don't externalize options.external = [] }, @@ -110,7 +112,7 @@ export async function build (ctx: Context) { // Nuxt: replaces the Nuxt vite dev server buildViteConfig.plugins.push({ name: 'histoire-vue-plugin-override', - config (config) { + config(config) { const vuePlugin = config.plugins.find((p: any) => p.name === 'vite:vue') as VitePlugin if (vuePlugin) { // @ts-expect-error vue plugin use function form @@ -135,13 +137,13 @@ export async function build (ctx: Context) { buildViteConfig.plugins.push({ name: 'histoire-build-config-override', enforce: 'post', - config (config) { + config(config) { // Don't externalize config.build.rollupOptions.external = [] // Force chunk strategy config.build.rollupOptions.output = { - manualChunks (id) { + manualChunks(id) { if (!id.includes('@histoire/app') && id.includes('node_modules')) { for (const test of ctx.config.build?.excludeFromVendorsChunk ?? []) { if (( @@ -240,7 +242,7 @@ export async function build (ctx: Context) { } } -function generateBaseHtml (head: string, body: string, ctx: Context) { +function generateBaseHtml(head: string, body: string, ctx: Context) { return `<!DOCTYPE html> <html> <head> @@ -256,7 +258,7 @@ function generateBaseHtml (head: string, body: string, ctx: Context) { </html>` } -function generateEntryHtml (jsEntryFile: string, cssEntryFile: string, variables: { HEAD?: string }, ctx: Context) { +function generateEntryHtml(jsEntryFile: string, cssEntryFile: string, variables: { HEAD?: string }, ctx: Context) { return generateBaseHtml( `<link rel="stylesheet" href="${ctx.resolvedViteConfig.base}${cssEntryFile}"> ${ctx.config.theme?.favicon ? `<link rel="icon" type="${lookupMime(ctx.config.theme.favicon)}" href="${ctx.resolvedViteConfig.base}${ctx.config.theme.favicon}"/>` : ''} @@ -267,10 +269,10 @@ function generateEntryHtml (jsEntryFile: string, cssEntryFile: string, variables ) } -async function writeFile (fileName: string, content: string, ctx: Context) { +async function writeFile(fileName: string, content: string, ctx: Context) { await fs.writeFile(join(ctx.config.outDir, fileName), content, 'utf8') } -function generateScriptLinks (prefetchScripts: string[], rel: string, ctx: Context) { +function generateScriptLinks(prefetchScripts: string[], rel: string, ctx: Context) { return prefetchScripts.map(s => `<link rel="${rel}" href="${ctx.resolvedViteConfig.base}${s}" as="script" crossOrigin="anonymous">`).join('') } diff --git a/packages/histoire/src/node/builtin-plugins/pinceau-tokens.ts b/packages/histoire/src/node/builtin-plugins/pinceau-tokens.ts index 3bd793ca..82f1ec7f 100644 --- a/packages/histoire/src/node/builtin-plugins/pinceau-tokens.ts +++ b/packages/histoire/src/node/builtin-plugins/pinceau-tokens.ts @@ -1,17 +1,16 @@ import type { Plugin, PluginApiBase } from '@histoire/shared' -import { getInjectedImport } from '../util/vendors.js' -import { findUp } from '../util/find-up.js' import { join } from 'pathe' +import { getInjectedImport } from '../util/vendors.js' export interface PinceauTokensOptions { configOrPaths?: string | string[] configFileName?: string } -export function pinceauTokens (options: PinceauTokensOptions = {}): Plugin { +export function pinceauTokens(_options: PinceauTokensOptions = {}): Plugin { const themePath = join(process.cwd(), 'node_modules/.vite/pinceau/index.js') - async function generate (api: PluginApiBase) { + async function generate(api: PluginApiBase) { try { await api.fs.ensureDir(api.pluginTempDir) await api.fs.emptyDir(api.pluginTempDir) @@ -21,7 +20,8 @@ export function pinceauTokens (options: PinceauTokensOptions = {}): Plugin { const storyFile = api.path.resolve(api.pluginTempDir, 'Pinceau.story.js') await api.fs.writeFile(storyFile, storyTemplate(theme)) api.addStoryFile(storyFile) - } catch (e) { + } + catch (e) { api.error(e.stack ?? e.message) } } @@ -29,7 +29,7 @@ export function pinceauTokens (options: PinceauTokensOptions = {}): Plugin { return { name: 'builtin:pinceau-tokens', - config (config) { + config(config) { // Add 'design-system' group if (!config.tree) { config.tree = {} @@ -52,7 +52,7 @@ export function pinceauTokens (options: PinceauTokensOptions = {}): Plugin { } }, - onDev (api, onCleanup) { + onDev(api, onCleanup) { const watcher = api.watcher.watch(themePath) .on('change', () => generate(api)) .on('add', () => generate(api)) @@ -62,13 +62,13 @@ export function pinceauTokens (options: PinceauTokensOptions = {}): Plugin { }) }, - async onBuild (api) { + async onBuild(api) { await generate(api) }, } } -const storyTemplate = (pinceauConfig: any) => { +function storyTemplate(pinceauConfig: any) { pinceauConfig = pinceauConfig?.theme || pinceauConfig?.default?.theme || {} return `import 'histoire-style' diff --git a/packages/histoire/src/node/builtin-plugins/tailwind-tokens.ts b/packages/histoire/src/node/builtin-plugins/tailwind-tokens.ts index ce657133..08fdb0ae 100644 --- a/packages/histoire/src/node/builtin-plugins/tailwind-tokens.ts +++ b/packages/histoire/src/node/builtin-plugins/tailwind-tokens.ts @@ -6,7 +6,7 @@ export interface TailwindTokensOptions { configFile?: string } -export function tailwindTokens (options: TailwindTokensOptions = {}): Plugin { +export function tailwindTokens(options: TailwindTokensOptions = {}): Plugin { const tailwindConfigFile = options.configFile ?? findUp(process.cwd(), [ 'tailwind.config.js', 'tailwind.config.cjs', @@ -18,7 +18,7 @@ export function tailwindTokens (options: TailwindTokensOptions = {}): Plugin { 'tailwind-config.ts', ]) - async function generate (api: PluginApiBase) { + async function generate(api: PluginApiBase) { try { await api.fs.ensureDir(api.pluginTempDir) await api.fs.emptyDir(api.pluginTempDir) @@ -30,7 +30,8 @@ export function tailwindTokens (options: TailwindTokensOptions = {}): Plugin { const storyFile = api.path.resolve(api.pluginTempDir, 'Tailwind.story.js') await api.fs.writeFile(storyFile, storyTemplate(resolvedTailwindConfig)) api.addStoryFile(storyFile) - } catch (e) { + } + catch (e) { api.error(e.stack ?? e.message) } } @@ -38,7 +39,7 @@ export function tailwindTokens (options: TailwindTokensOptions = {}): Plugin { return { name: 'builtin:tailwind-tokens', - config (config) { + config(config) { if (tailwindConfigFile) { // Add 'design-system' group if (!config.tree) { @@ -63,7 +64,7 @@ export function tailwindTokens (options: TailwindTokensOptions = {}): Plugin { } }, - onDev (api, onCleanup) { + onDev(api, onCleanup) { if (tailwindConfigFile) { const watcher = api.watcher.watch(tailwindConfigFile) .on('change', () => generate(api)) @@ -74,7 +75,7 @@ export function tailwindTokens (options: TailwindTokensOptions = {}): Plugin { } }, - async onBuild (api) { + async onBuild(api) { if (tailwindConfigFile) { await generate(api) } @@ -82,7 +83,8 @@ export function tailwindTokens (options: TailwindTokensOptions = {}): Plugin { } } -const storyTemplate = (tailwindConfig: any) => `import 'histoire-style' +function storyTemplate(tailwindConfig: any) { + return `import 'histoire-style' import './style.css' import { createApp, h, markRaw, ref } from ${getInjectedImport('@histoire/vendors/vue')} import { @@ -446,6 +448,7 @@ export default { }, ], }` +} const css = `.__hst-shade { height: 80px; diff --git a/packages/histoire/src/node/builtin-plugins/vanilla-support/MountStory.ts b/packages/histoire/src/node/builtin-plugins/vanilla-support/MountStory.ts index 7f02d5b0..ba13b090 100644 --- a/packages/histoire/src/node/builtin-plugins/vanilla-support/MountStory.ts +++ b/packages/histoire/src/node/builtin-plugins/vanilla-support/MountStory.ts @@ -1,7 +1,5 @@ -import { - defineComponent as _defineComponent, - PropType as _PropType, -} from '@histoire/vendors/vue' +import type { PropType as _PropType } from '@histoire/vendors/vue' +import { defineComponent as _defineComponent } from '@histoire/vendors/vue' import type { Story } from '@histoire/shared' import type { StoryOptions, VariantOptions } from './types' @@ -15,7 +13,7 @@ export default _defineComponent({ }, }, - setup (props) { + setup(props) { const options = props.story.file.component as StoryOptions let rawVariants: VariantOptions[] = [] @@ -27,7 +25,8 @@ export default _defineComponent({ onMount: options.onMount, onMountControls: options.onMountControls, }] - } else { + } + else { rawVariants = options.variants } @@ -44,7 +43,7 @@ export default _defineComponent({ } }, - render () { + render() { return null }, }) diff --git a/packages/histoire/src/node/builtin-plugins/vanilla-support/RenderStory.ts b/packages/histoire/src/node/builtin-plugins/vanilla-support/RenderStory.ts index 296627bd..248f6dd4 100644 --- a/packages/histoire/src/node/builtin-plugins/vanilla-support/RenderStory.ts +++ b/packages/histoire/src/node/builtin-plugins/vanilla-support/RenderStory.ts @@ -1,13 +1,11 @@ -/* eslint-disable vue/one-component-per-file */ - +import type { PropType as _PropType } from '@histoire/vendors/vue' import { defineComponent as _defineComponent, + h as _h, onBeforeUnmount as _onBeforeUnmount, onMounted as _onMounted, - PropType as _PropType, ref as _ref, watch as _watch, - h as _h, } from '@histoire/vendors/vue' import type { Story, Variant } from '@histoire/shared' // @ts-expect-error virtual module id @@ -40,13 +38,13 @@ export default _defineComponent({ ready: () => true, }, - setup (props, { emit }) { + setup(props, { emit }) { const sandbox = _ref<HTMLDivElement>() let mounting = false let app: App let appHooks: Record<'onUpdate' | 'onUnmount', (() => unknown)[]> - async function unmountVariant () { + async function unmountVariant() { if (app) { await app.onUnmount?.() if (appHooks) { @@ -60,7 +58,7 @@ export default _defineComponent({ } } - async function mountVariant () { + async function mountVariant() { if (mounting) return mounting = true @@ -126,11 +124,12 @@ export default _defineComponent({ } }) - _watch(() => props.variant, async value => { + _watch(() => props.variant, async (value) => { if (value.configReady && !mounting) { if (!app) { await mountVariant() - } else { + } + else { // @TODO check if need to refresh here } } @@ -157,7 +156,7 @@ export default _defineComponent({ } }, - render () { + render() { return _h('div', { ref: 'sandbox', }) diff --git a/packages/histoire/src/node/builtin-plugins/vanilla-support/client.ts b/packages/histoire/src/node/builtin-plugins/vanilla-support/client.ts index b7b2b745..4a15d9a8 100644 --- a/packages/histoire/src/node/builtin-plugins/vanilla-support/client.ts +++ b/packages/histoire/src/node/builtin-plugins/vanilla-support/client.ts @@ -1,6 +1,6 @@ export { default as MountStory } from './MountStory' export { default as RenderStory } from './RenderStory' -export function generateSourceCode () { +export function generateSourceCode() { // noop } diff --git a/packages/histoire/src/node/builtin-plugins/vanilla-support/collect.ts b/packages/histoire/src/node/builtin-plugins/vanilla-support/collect.ts index 896088c7..532dbfd9 100644 --- a/packages/histoire/src/node/builtin-plugins/vanilla-support/collect.ts +++ b/packages/histoire/src/node/builtin-plugins/vanilla-support/collect.ts @@ -1,7 +1,7 @@ import type { ServerRunPayload, ServerStory, ServerVariant } from '@histoire/shared' import type { StoryOptions, VariantOptions } from './types' -export async function run ({ file, storyData }: ServerRunPayload) { +export async function run({ file, storyData }: ServerRunPayload) { const { default: Comp } = await import(/* @vite-ignore */ file.moduleId) const options = Comp as StoryOptions @@ -14,7 +14,8 @@ export async function run ({ file, storyData }: ServerRunPayload) { id: '_default', title: 'default', }] - } else { + } + else { rawVariants = options.variants } diff --git a/packages/histoire/src/node/builtin-plugins/vanilla-support/plugin.ts b/packages/histoire/src/node/builtin-plugins/vanilla-support/plugin.ts index e459c522..918a77a5 100644 --- a/packages/histoire/src/node/builtin-plugins/vanilla-support/plugin.ts +++ b/packages/histoire/src/node/builtin-plugins/vanilla-support/plugin.ts @@ -1,14 +1,14 @@ -import { dirname } from 'pathe' import { fileURLToPath } from 'node:url' +import { dirname } from 'pathe' import type { Plugin } from '@histoire/shared' const __dirname = dirname(fileURLToPath(import.meta.url)) -export function vanillaSupport (): Plugin { +export function vanillaSupport(): Plugin { return { name: 'builtin:vanilla-support', - defaultConfig () { + defaultConfig() { return { supportMatch: [ { diff --git a/packages/histoire/src/node/builtin-plugins/vanilla-support/types.ts b/packages/histoire/src/node/builtin-plugins/vanilla-support/types.ts index 9a1800ad..75169840 100644 --- a/packages/histoire/src/node/builtin-plugins/vanilla-support/types.ts +++ b/packages/histoire/src/node/builtin-plugins/vanilla-support/types.ts @@ -1,4 +1,4 @@ -import type { StoryProps, VariantProps, Story, Variant, Awaitable } from '@histoire/shared' +import type { Awaitable, Story, StoryProps, Variant, VariantProps } from '@histoire/shared' export interface App { el: HTMLElement @@ -35,6 +35,6 @@ export interface VariantOptions extends Omit<VariantProps, 'setupApp'>, CommonPr } -export function defineStory (story: StoryOptions) { +export function defineStory(story: StoryOptions) { return story } diff --git a/packages/histoire/src/node/collect/index.ts b/packages/histoire/src/node/collect/index.ts index cfefd02f..772d614d 100644 --- a/packages/histoire/src/node/collect/index.ts +++ b/packages/histoire/src/node/collect/index.ts @@ -1,4 +1,5 @@ import { MessageChannel } from 'node:worker_threads' +import { cpus } from 'node:os' import type { ViteDevServer } from 'vite' import { ViteNodeServer } from 'vite-node/server' import type { FetchFunction, ResolveIdFunction } from 'vite-node' @@ -6,12 +7,11 @@ import { relative } from 'pathe' import pc from 'picocolors' import Tinypool from '@akryum/tinypool' import { createBirpc } from 'birpc' -import { cpus } from 'node:os' import type { ServerStoryFile } from '@histoire/shared' import { createPath } from '../tree.js' import type { Context } from '../context.js' -import type { Payload, ReturnData } from './worker.js' import { slash } from '../util/fs.js' +import type { Payload, ReturnData } from './worker.js' export interface UseCollectStoriesOptions { server: ViteDevServer @@ -19,7 +19,7 @@ export interface UseCollectStoriesOptions { throws?: boolean } -export function useCollectStories (options: UseCollectStoriesOptions, ctx: Context) { +export function useCollectStories(options: UseCollectStoriesOptions, ctx: Context) { const { server, mainServer } = options const node = new ViteNodeServer(server, { @@ -55,12 +55,12 @@ export function useCollectStories (options: UseCollectStoriesOptions, ctx: Conte maxThreads: threadsCount, }) - function clearCache () { + function clearCache() { server.moduleGraph.invalidateAll() node.fetchCache.clear() } - function createChannel () { + function createChannel() { const channel = new MessageChannel() const port = channel.port2 const workerPort = channel.port1 @@ -69,7 +69,7 @@ export function useCollectStories (options: UseCollectStoriesOptions, ctx: Conte fetchModule: FetchFunction resolveId: ResolveIdFunction }>({ - fetchModule: (id) => node.fetchModule(id), + fetchModule: id => node.fetchModule(id), resolveId: (id, importer) => node.resolveId(id, importer), }, { post: data => port.postMessage(data), @@ -92,7 +92,7 @@ export function useCollectStories (options: UseCollectStoriesOptions, ctx: Conte }) } - async function executeStoryFile (storyFile: ServerStoryFile) { + async function executeStoryFile(storyFile: ServerStoryFile) { try { const { workerPort } = createChannel() const payload: Payload = { @@ -109,7 +109,8 @@ export function useCollectStories (options: UseCollectStoriesOptions, ctx: Conte if (storyData.length === 0) { console.warn(pc.yellow(`⚠️ No story found for ${storyFile.path}`)) return - } else if (storyData.length > 1) { + } + else if (storyData.length > 1) { console.warn(pc.yellow(`⚠️ Multiple stories not supported: ${storyFile.path}`)) } @@ -136,7 +137,8 @@ export function useCollectStories (options: UseCollectStoriesOptions, ctx: Conte } storyFile.treePath = createPath(ctx.config, storyFile.treeFile) storyFile.story.title = storyFile.treePath[storyFile.treePath.length - 1] - } catch (e) { + } + catch (e) { console.error(pc.red(`Error while collecting story ${storyFile.path}:\n${e.frame ? `${pc.bold(e.message)}\n${e.frame}` : e.stack}`)) if (options.throws) { throw e @@ -144,7 +146,7 @@ export function useCollectStories (options: UseCollectStoriesOptions, ctx: Conte } } - async function destroy () { + async function destroy() { await threadPool.destroy() } diff --git a/packages/histoire/src/node/collect/run.ts b/packages/histoire/src/node/collect/run.ts index def7e773..00e099aa 100644 --- a/packages/histoire/src/node/collect/run.ts +++ b/packages/histoire/src/node/collect/run.ts @@ -2,7 +2,7 @@ import type { ServerRunPayload } from '@histoire/shared' // @ts-expect-error virtual module import { collectSupportPlugins } from 'virtual:$histoire-support-plugins-collect' -export async function run (payload: ServerRunPayload) { +export async function run(payload: ServerRunPayload) { const { run } = await collectSupportPlugins[payload.file.supportPluginId]() const result = await run(payload) return result diff --git a/packages/histoire/src/node/collect/worker.ts b/packages/histoire/src/node/collect/worker.ts index eb68cef8..d625e104 100644 --- a/packages/histoire/src/node/collect/worker.ts +++ b/packages/histoire/src/node/collect/worker.ts @@ -7,7 +7,7 @@ import { createBirpc } from 'birpc' import type { FetchFunction, ResolveIdFunction } from 'vite-node' import { dirname, resolve } from 'pathe' import pc from 'picocolors' -import type { ServerStoryFile, ServerStory, ServerRunPayload } from '@histoire/shared' +import type { ServerRunPayload, ServerStory, ServerStoryFile } from '@histoire/shared' import { createDomEnv } from '../dom/env.js' const __dirname = dirname(fileURLToPath(import.meta.url)) @@ -31,7 +31,7 @@ let _rpc: ReturnType<typeof createBirpc<{ }>> // Cleanup module cache -parentPort.on('message', message => { +parentPort.on('message', (message) => { if (message?.kind === 'hst:invalidate') { _moduleCache.delete(message.file) } @@ -53,10 +53,10 @@ export default async (payload: Payload): Promise<ReturnData> => { root: payload.root, base: payload.base, moduleCache: _moduleCache, - fetchModule (id) { + fetchModule(id) { return _rpc.fetchModule(id) }, - resolveId (id, importer) { + resolveId(id, importer) { return _rpc.resolveId(id, importer) }, })) @@ -81,7 +81,7 @@ export default async (payload: Payload): Promise<ReturnData> => { const el = document.createElement('div') el.innerHTML = payload.storyFile.markdownFile.html const text = el.textContent - storyData.forEach(s => { + storyData.forEach((s) => { s.docsText = text }) } diff --git a/packages/histoire/src/node/colors.ts b/packages/histoire/src/node/colors.ts index aada1135..2084b9e8 100644 --- a/packages/histoire/src/node/colors.ts +++ b/packages/histoire/src/node/colors.ts @@ -292,7 +292,7 @@ const HSL = new RegExp( `^hsla?\\(\\s*((?:${VALUE})(?:deg|rad|grad|turn)?)${SEP}(${VALUE})${SEP}(${VALUE})(?:${ALPHA_SEP}(${VALUE}))?\\s*\\)$`, ) -export function parseColor (value) { +export function parseColor(value) { if (typeof value !== 'string') { return null } @@ -309,10 +309,10 @@ export function parseColor (value) { if (hex !== null) { return { mode: 'rgb', - color: [parseInt(hex[1], 16), parseInt(hex[2], 16), parseInt(hex[3], 16)].map((v) => + color: [Number.parseInt(hex[1], 16), Number.parseInt(hex[2], 16), Number.parseInt(hex[3], 16)].map(v => v.toString(), ), - alpha: hex[4] ? (parseInt(hex[4], 16) / 255).toString() : undefined, + alpha: hex[4] ? (Number.parseInt(hex[4], 16) / 255).toString() : undefined, } } @@ -321,7 +321,7 @@ export function parseColor (value) { if (rgbMatch !== null) { return { mode: 'rgb', - color: [rgbMatch[1], rgbMatch[2], rgbMatch[3]].map((v) => v.toString()), + color: [rgbMatch[1], rgbMatch[2], rgbMatch[3]].map(v => v.toString()), alpha: rgbMatch[4]?.toString?.(), } } @@ -331,7 +331,7 @@ export function parseColor (value) { if (hslMatch !== null) { return { mode: 'hsl', - color: [hslMatch[1], hslMatch[2], hslMatch[3]].map((v) => v.toString()), + color: [hslMatch[1], hslMatch[2], hslMatch[3]].map(v => v.toString()), alpha: hslMatch[4]?.toString?.(), } } diff --git a/packages/histoire/src/node/commands/build.ts b/packages/histoire/src/node/commands/build.ts index 131c0024..6f82fb34 100644 --- a/packages/histoire/src/node/commands/build.ts +++ b/packages/histoire/src/node/commands/build.ts @@ -5,7 +5,7 @@ export interface BuildOptions { config?: string } -export async function buildCommand (options: BuildOptions) { +export async function buildCommand(options: BuildOptions) { const ctx = await createContext({ configFile: options.config, mode: 'build', diff --git a/packages/histoire/src/node/commands/dev.ts b/packages/histoire/src/node/commands/dev.ts index 73320a4d..1705dd01 100644 --- a/packages/histoire/src/node/commands/dev.ts +++ b/packages/histoire/src/node/commands/dev.ts @@ -10,10 +10,10 @@ export interface DevOptions { config?: string } -export async function devCommand (options: DevOptions) { +export async function devCommand(options: DevOptions) { let stop: () => Promise<void> - async function start () { + async function start() { const ctx = await createContext({ configFile: options.config, mode: 'dev', @@ -41,7 +41,7 @@ export async function devCommand (options: DevOptions) { } } - async function restart (source: string) { + async function restart(source: string) { if (stop) { console.log(pc.blue(`${source} config changed, restarting...`)) await stop() diff --git a/packages/histoire/src/node/commands/preview.ts b/packages/histoire/src/node/commands/preview.ts index 2d66ccb0..2c66ecda 100644 --- a/packages/histoire/src/node/commands/preview.ts +++ b/packages/histoire/src/node/commands/preview.ts @@ -6,7 +6,7 @@ export interface PreviewOptions { port?: number } -export async function previewCommand (options: PreviewOptions) { +export async function previewCommand(options: PreviewOptions) { const ctx = await createContext({ mode: 'build', }) diff --git a/packages/histoire/src/node/config.ts b/packages/histoire/src/node/config.ts index 3ea232f6..9c1b9454 100644 --- a/packages/histoire/src/node/config.ts +++ b/packages/histoire/src/node/config.ts @@ -1,19 +1,19 @@ +import { fileURLToPath } from 'node:url' +import fs from 'node:fs' import path from 'pathe' import { createDefu } from 'defu' import { - resolveConfig as resolveViteConfig, mergeConfig as mergeViteConfig, + resolveConfig as resolveViteConfig, } from 'vite' import jiti from 'jiti' -import { fileURLToPath } from 'node:url' import pc from 'picocolors' import type { - HistoireConfig, - SupportMatchPattern, ConfigMode, + HistoireConfig, Plugin, + SupportMatchPattern, } from '@histoire/shared' -import fs from 'node:fs' import { defaultColors } from './colors.js' import { findUp } from './util/find-up.js' import { tailwindTokens } from './builtin-plugins/tailwind-tokens.js' @@ -22,7 +22,7 @@ import type { Context } from './context.js' const __filename = fileURLToPath(import.meta.url) -export function getDefaultConfig (): HistoireConfig { +export function getDefaultConfig(): HistoireConfig { return { plugins: [ vanillaSupport(), @@ -128,11 +128,11 @@ export function getDefaultConfig (): HistoireConfig { }, vite: (config) => { // Remove vite:legacy plugins https://github.com/histoire-dev/histoire/issues/156 - const index = config.plugins?.findIndex(plugin => Array.isArray(plugin) && - typeof plugin[0] === 'object' && - !Array.isArray(plugin[0]) && + const index = config.plugins?.findIndex(plugin => Array.isArray(plugin) + && typeof plugin[0] === 'object' + && !Array.isArray(plugin[0]) // @ts-expect-error could have no property 'name' - plugin[0].name?.startsWith('vite:legacy')) + && plugin[0].name?.startsWith('vite:legacy')) if (index !== -1) { config.plugins?.splice(index, 1) } @@ -154,16 +154,17 @@ export const configFileNames = [ '.histoire.js', ] -export function resolveConfigFile (cwd: string = process.cwd(), configFile?: string): string { +export function resolveConfigFile(cwd: string = process.cwd(), configFile?: string): string { if (configFile) { // explicit config path is always resolved from cwd return path.resolve(configFile) - } else { + } + else { return findUp(cwd, configFileNames) } } -export async function loadConfigFile (configFile: string): Promise<Partial<HistoireConfig>> { +export async function loadConfigFile(configFile: string): Promise<Partial<HistoireConfig>> { try { const result = jiti(__filename, { esmResolve: true, @@ -173,7 +174,8 @@ export async function loadConfigFile (configFile: string): Promise<Partial<Histo throw new Error(`Expected default export in ${configFile}`) } return result.default - } catch (e) { + } + catch (e) { console.error(pc.red(`Error while loading ${configFile}`)) throw e } @@ -230,7 +232,8 @@ export const mergeConfig = createDefu((obj: any, key, value) => { if (existing) { existing.patterns = [...existing.patterns, ...item.patterns] existing.pluginIds = [...existing.pluginIds, ...item.pluginIds] - } else { + } + else { obj[key].push(item) } } @@ -249,7 +252,7 @@ export const mergeConfig = createDefu((obj: any, key, value) => { } }) -export async function resolveConfig (cwd: string = process.cwd(), mode: ConfigMode, configFile: string): Promise<HistoireConfig> { +export async function resolveConfig(cwd: string = process.cwd(), mode: ConfigMode, configFile: string): Promise<HistoireConfig> { let result: Partial<HistoireConfig> const resolvedConfigFile = resolveConfigFile(cwd, configFile) if (resolvedConfigFile) { @@ -264,7 +267,7 @@ export async function resolveConfig (cwd: string = process.cwd(), mode: ConfigMo return resolveConfigPlugins(mergeConfig(preUserConfig, processedDefaultConfig), mode) } -async function resolveConfigPlugins (config: HistoireConfig, mode: ConfigMode): Promise<HistoireConfig> { +async function resolveConfigPlugins(config: HistoireConfig, mode: ConfigMode): Promise<HistoireConfig> { for (const plugin of config.plugins) { if (plugin.config) { const result = await plugin.config(config, mode) @@ -276,7 +279,7 @@ async function resolveConfigPlugins (config: HistoireConfig, mode: ConfigMode): return config } -async function processDefaultConfig (defaultConfig: HistoireConfig, preUserConfig: HistoireConfig, mode: ConfigMode, cwd: string): Promise<HistoireConfig> { +async function processDefaultConfig(defaultConfig: HistoireConfig, preUserConfig: HistoireConfig, mode: ConfigMode, _cwd: string): Promise<HistoireConfig> { // Apply plugins for (const plugin of [...defaultConfig.plugins, ...preUserConfig.plugins ?? []]) { if (plugin.defaultConfig) { @@ -289,7 +292,7 @@ async function processDefaultConfig (defaultConfig: HistoireConfig, preUserConfi return defaultConfig } -export async function processConfig (ctx: Context) { +export async function processConfig(ctx: Context) { const { config, root } = ctx // Resolve files paths @@ -347,7 +350,8 @@ export async function processConfig (ctx: Context) { throw new Error(pc.red(`Histoire config: theme.favicon seems to target a file that does not exist: ${file} (resolved as ${resolvedFile})`)) } config.theme.favicon = relativeFile - } else { + } + else { // Check if URL path is valid const resolvedFile = path.resolve(publicDir, file) if (!fs.existsSync(resolvedFile)) { @@ -358,7 +362,7 @@ export async function processConfig (ctx: Context) { } } -export function defineConfig (config: Partial<HistoireConfig>) { +export function defineConfig(config: Partial<HistoireConfig>) { return config } diff --git a/packages/histoire/src/node/context.ts b/packages/histoire/src/node/context.ts index 3ab59556..5c307605 100644 --- a/packages/histoire/src/node/context.ts +++ b/packages/histoire/src/node/context.ts @@ -1,11 +1,12 @@ -import { resolveConfig as resolveViteConfig, ResolvedConfig } from 'vite' +import type { ResolvedConfig } from 'vite' +import { resolveConfig as resolveViteConfig } from 'vite' import type { - ServerStoryFile, + ConfigMode, FinalSupportPlugin, - ServerMarkdownFile, HistoireConfig, - ConfigMode, PluginCommand, + ServerMarkdownFile, + ServerStoryFile, } from '@histoire/shared' import { processConfig, resolveConfig } from './config.js' import { mergeHistoireViteConfig } from './vite.js' @@ -26,7 +27,7 @@ export interface CreateContextOptions { configFile?: string } -export async function createContext (options: CreateContextOptions): Promise<Context> { +export async function createContext(options: CreateContextOptions): Promise<Context> { const config = await resolveConfig(process.cwd(), options.mode, options.configFile) const command = options.mode === 'dev' ? 'serve' : 'build' const viteConfig = await resolveViteConfig({}, command) diff --git a/packages/histoire/src/node/dom/env.ts b/packages/histoire/src/node/dom/env.ts index 0e7d764e..e49559ab 100644 --- a/packages/histoire/src/node/dom/env.ts +++ b/packages/histoire/src/node/dom/env.ts @@ -4,32 +4,32 @@ import { } from 'jsdom' import { populateGlobal } from './util.js' -export function createDomEnv () { +export function createDomEnv() { const dom = new JSDOM( '<!DOCTYPE html>', { pretendToBeVisual: true, runScripts: 'dangerously', url: 'http://localhost:3000', - virtualConsole: console && global.console ? new VirtualConsole().sendTo(global.console) : undefined, + virtualConsole: console && globalThis.console ? new VirtualConsole().sendTo(globalThis.console) : undefined, includeNodeLocations: false, contentType: 'text/html', }, ) - const { keys, originals } = populateGlobal(global, dom.window, { bindFunctions: true }) + const { keys, originals } = populateGlobal(globalThis, dom.window, { bindFunctions: true }) - function destroy () { - keys.forEach(key => delete global[key]) + function destroy() { + keys.forEach(key => delete globalThis[key]) originals.forEach((v, k) => { - global[k] = v + globalThis[k] = v }) } window.ResizeObserver = window.ResizeObserver || class ResizeObserver { - disconnect (): void { /* noop */ } - observe (target: Element, options?: ResizeObserverOptions): void { /* noop */ } - unobserve (target: Element): void { /* noop */ } + disconnect(): void { /* noop */ } + observe(_target: Element, _options?: ResizeObserverOptions): void { /* noop */ } + unobserve(_target: Element): void { /* noop */ } } return { diff --git a/packages/histoire/src/node/dom/util.ts b/packages/histoire/src/node/dom/util.ts index 47cd2f1a..1c890707 100644 --- a/packages/histoire/src/node/dom/util.ts +++ b/packages/histoire/src/node/dom/util.ts @@ -11,7 +11,7 @@ const skipKeys = [ 'parent', ] -export function getWindowKeys (global: any, win: any) { +export function getWindowKeys(global: any, win: any) { const keys = new Set(KEYS.concat(Object.getOwnPropertyNames(win)) .filter((k) => { if (skipKeys.includes(k)) { @@ -26,7 +26,7 @@ export function getWindowKeys (global: any, win: any) { return keys } -function isClassLikeName (name: string) { +function isClassLikeName(name: string) { return name[0] === name[0].toUpperCase() } @@ -38,7 +38,7 @@ interface PopulateOptions { bindFunctions?: boolean } -export function populateGlobal (global: any, win: any, options: PopulateOptions = {}) { +export function populateGlobal(global: any, win: any, options: PopulateOptions = {}) { const { bindFunctions = false } = options const keys = getWindowKeys(global, win) @@ -46,20 +46,20 @@ export function populateGlobal (global: any, win: any, options: PopulateOptions const overrideObject = new Map<string | symbol, any>() for (const key of keys) { - const boundFunction = bindFunctions && - typeof win[key] === 'function' && - !isClassLikeName(key) && - win[key].bind(win) + const boundFunction = bindFunctions + && typeof win[key] === 'function' + && !isClassLikeName(key) + && win[key].bind(win) - if (KEYS.includes(key) && key in global) { originals.set(key, global[key]) } + if (KEYS.includes(key) && key in global) originals.set(key, global[key]) Object.defineProperty(global, key, { - get () { - if (overrideObject.has(key)) { return overrideObject.get(key) } - if (boundFunction) { return boundFunction } + get() { + if (overrideObject.has(key)) return overrideObject.get(key) + if (boundFunction) return boundFunction return win[key] }, - set (v) { + set(v) { overrideObject.set(key, v) }, configurable: true, @@ -71,7 +71,7 @@ export function populateGlobal (global: any, win: any, options: PopulateOptions global.top = global global.parent = global - if (global.global) { global.global = global } + if (global.global) global.global = global skipKeys.forEach(k => keys.add(k)) diff --git a/packages/histoire/src/node/load.ts b/packages/histoire/src/node/load.ts index 0ea4997d..9376899f 100644 --- a/packages/histoire/src/node/load.ts +++ b/packages/histoire/src/node/load.ts @@ -12,7 +12,7 @@ export interface UseModuleLoaderOptions { let _load: ModuleLoader['loadModule'] -export function useModuleLoader (options: UseModuleLoaderOptions): ModuleLoader { +export function useModuleLoader(options: UseModuleLoaderOptions): ModuleLoader { const { server } = options const node = new ViteNodeServer(server) @@ -24,17 +24,18 @@ export function useModuleLoader (options: UseModuleLoaderOptions): ModuleLoader resolveId: (id, importer) => node.resolveId(id, importer), }) - function clearCache () { + function clearCache() { server.moduleGraph.invalidateAll() node.fetchCache.clear() runner.moduleCache.clear() } - async function loadModule (file: string) { + async function loadModule(file: string) { try { const result = await runner.executeFile(resolve(file)) return result - } catch (e) { + } + catch (e) { console.error(pc.red(`Error while loading module ${file}:\n${e.frame ? `${pc.bold(e.message)}\n${e.frame}` : e.stack}`)) if (options.throws) { throw e @@ -44,7 +45,7 @@ export function useModuleLoader (options: UseModuleLoaderOptions): ModuleLoader _load = loadModule - async function destroy () { + async function destroy() { // Noop } diff --git a/packages/histoire/src/node/markdown.ts b/packages/histoire/src/node/markdown.ts index bf9022d8..b21e700b 100644 --- a/packages/histoire/src/node/markdown.ts +++ b/packages/histoire/src/node/markdown.ts @@ -17,17 +17,17 @@ import { addStory, notifyStoryChange, removeStory } from './stories.js' const onMarkdownListChangeHandlers: (() => unknown)[] = [] -export function onMarkdownListChange (handler: () => unknown) { +export function onMarkdownListChange(handler: () => unknown) { onMarkdownListChangeHandlers.push(handler) } -function notifyMarkdownListChange () { +function notifyMarkdownListChange() { for (const handler of onMarkdownListChangeHandlers) { handler() } } -export async function createMarkdownRenderer (ctx: Context) { +export async function createMarkdownRenderer(ctx: Context) { const highlighter = await getHighlighter({ theme: 'github-dark', }) @@ -78,13 +78,15 @@ export async function createMarkdownRenderer (ctx: Context) { const newHref = `${ctx.resolvedViteConfig.base}story/${encodeURIComponent(storyFile?.id ?? mdFile.storyFile.id)}${query}` token.attrSet('href', newHref) token.attrSet('data-route', 'true') - } else if (!href.startsWith('/') && !href.startsWith('#') && (classIndex < 0 || !token.attrs[classIndex][1].includes('header-anchor'))) { + } + else if (!href.startsWith('/') && !href.startsWith('#') && (classIndex < 0 || !token.attrs[classIndex][1].includes('header-anchor'))) { // Add target="_blank" to external links const aIndex = token.attrIndex('target') if (aIndex < 0) { token.attrPush(['target', '_blank']) // add new attribute - } else { + } + else { token.attrs[aIndex][1] = '_blank' // replace value of existing attr } } @@ -98,7 +100,7 @@ export async function createMarkdownRenderer (ctx: Context) { return md } -async function createMarkdownRendererWithPlugins (ctx: Context) { +async function createMarkdownRendererWithPlugins(ctx: Context) { let md = await createMarkdownRenderer(ctx) if (ctx.config.markdown) { const result = await ctx.config.markdown(md) @@ -109,14 +111,14 @@ async function createMarkdownRendererWithPlugins (ctx: Context) { return md } -export async function createMarkdownPlugins (ctx: Context) { +export async function createMarkdownPlugins(ctx: Context) { const plugins: VitePlugin[] = [] const md = await createMarkdownRendererWithPlugins(ctx) // @TODO extract plugins.push({ name: 'histoire-vue-docs-block', - transform (code, id) { + transform(code, id) { if (!id.includes('?vue&type=docs')) return if (!id.includes('lang.md')) return const file = id.substring(0, id.indexOf('?vue')) @@ -132,7 +134,7 @@ export async function createMarkdownPlugins (ctx: Context) { return plugins } -export async function createMarkdownFilesWatcher (ctx: Context) { +export async function createMarkdownFilesWatcher(ctx: Context) { const md = await createMarkdownRendererWithPlugins(ctx) const watcher = chokidar.watch(['**/*.story.md'], { @@ -145,11 +147,11 @@ export async function createMarkdownFilesWatcher (ctx: Context) { */ let watcherIsReady = false - function addFile (relativePath: string) { + function addFile(relativePath: string) { const absolutePath = path.resolve(ctx.root, relativePath) const dirFiles = fs.readdirSync(path.dirname(absolutePath)) const truncatedName = path.basename(absolutePath, '.md') - const isRelatedToStory = dirFiles.some((file) => !file.endsWith('.md') && file.startsWith(truncatedName)) + const isRelatedToStory = dirFiles.some(file => !file.endsWith('.md') && file.startsWith(truncatedName)) const { data: frontmatter, content } = matter(fs.readFileSync(absolutePath, 'utf8')) @@ -189,7 +191,8 @@ export async function createMarkdownFilesWatcher (ctx: Context) { file.storyFile = storyFile storyFile.markdownFile = file notifyStoryChange(storyFile) - } else { + } + else { const searchPath = path.join(path.dirname(relativePath), truncatedName) const storyFile = ctx.storyFiles.find(f => f.relativePath.startsWith(searchPath)) if (storyFile) { @@ -204,8 +207,8 @@ export async function createMarkdownFilesWatcher (ctx: Context) { return file } - function removeFile (relativePath: string) { - const index = ctx.markdownFiles.findIndex((file) => file.relativePath === relativePath) + function removeFile(relativePath: string) { + const index = ctx.markdownFiles.findIndex(file => file.relativePath === relativePath) if (index !== -1) { const file = ctx.markdownFiles[index] if (!file.isRelatedToStory) { @@ -217,7 +220,7 @@ export async function createMarkdownFilesWatcher (ctx: Context) { } } - async function stop () { + async function stop() { await watcher.close() } @@ -229,7 +232,7 @@ export async function createMarkdownFilesWatcher (ctx: Context) { removeFile(relativePath) }) - await new Promise(resolve => { + await new Promise((resolve) => { watcher.once('ready', resolve) }) @@ -245,7 +248,8 @@ export async function createMarkdownFilesWatcher (ctx: Context) { return { stop, } - } catch (e) { + } + catch (e) { stop() throw e } diff --git a/packages/histoire/src/node/plugin.ts b/packages/histoire/src/node/plugin.ts index 531bb09d..be1f91b4 100644 --- a/packages/histoire/src/node/plugin.ts +++ b/packages/histoire/src/node/plugin.ts @@ -3,17 +3,17 @@ import path from 'pathe' import fs from 'fs-extra' import pc from 'picocolors' import type { + BuildEndCallback, + ChangeViteConfigCallback, + HistoireConfig, + ModuleLoader, Plugin, PluginApiBase, - PluginApiDev, PluginApiBuild, - ChangeViteConfigCallback, - BuildEndCallback, + PluginApiDev, + PluginApiDevEvent, PreviewStoryCallback, - ModuleLoader, ServerStory, - PluginApiDevEvent, - HistoireConfig, } from '@histoire/shared' import { TEMP_PATH } from './alias.js' import type { Context } from './context.js' @@ -24,39 +24,38 @@ export class BasePluginApi implements PluginApiBase { path = path fs = fs - // eslint-disable-next-line no-useless-constructor - constructor ( + constructor( protected ctx: Context, protected plugin: Plugin, public moduleLoader: ModuleLoader, ) { } - get pluginTempDir () { + get pluginTempDir() { return path.resolve(TEMP_PATH, 'plugins', this.plugin.name.replace(/:/g, '_')) } - log (...msg) { + log(...msg) { console.log(this.colors.gray(`[Plugin:${this.plugin.name}]`), ...msg) } - warn (...msg) { + warn(...msg) { console.warn(this.colors.yellow(`[Plugin:${this.plugin.name}]`), ...msg) } - error (...msg) { + error(...msg) { console.error(this.colors.red(`[Plugin:${this.plugin.name}]`), ...msg) } - addStoryFile (file: string) { + addStoryFile(file: string) { removeStory(file) addStory(file) } - getStories (): ServerStory[] { + getStories(): ServerStory[] { return this.ctx.storyFiles.map(f => f.story).filter(Boolean) } - getConfig (): HistoireConfig { + getConfig(): HistoireConfig { return this.ctx.config } } @@ -70,21 +69,21 @@ export class BuildPluginApi extends BasePluginApi implements PluginApiBuild { buildEndCallbacks: BuildEndCallback[] = [] previewStoryCallbacks: PreviewStoryCallback[] = [] - changeViteConfig (cb: ChangeViteConfigCallback) { + changeViteConfig(cb: ChangeViteConfigCallback) { this.changeViteConfigCallbacks.push(cb) } - onBuildEnd (cb: BuildEndCallback) { + onBuildEnd(cb: BuildEndCallback) { this.buildEndCallbacks.push(cb) } - onPreviewStory (cb: PreviewStoryCallback) { + onPreviewStory(cb: PreviewStoryCallback) { this.previewStoryCallbacks.push(cb) } } export class DevEventPluginApi extends BasePluginApi implements PluginApiDevEvent { - constructor ( + constructor( ctx: Context, plugin: Plugin, moduleLoader: ModuleLoader, diff --git a/packages/histoire/src/node/preview.ts b/packages/histoire/src/node/preview.ts index ebaefcf3..bbf36aee 100644 --- a/packages/histoire/src/node/preview.ts +++ b/packages/histoire/src/node/preview.ts @@ -8,7 +8,7 @@ interface ReturnPayload { close: () => Promise<void> } -export async function startPreview (port: number | null, ctx: Context): Promise<ReturnPayload> { +export async function startPreview(port: number | null, ctx: Context): Promise<ReturnPayload> { const app = connect() app.use( @@ -25,10 +25,11 @@ export async function startPreview (port: number | null, ctx: Context): Promise< const httpServer = http.createServer(app) return new Promise((resolve, reject) => { - function onError (e: Error & { code?: string }) { + function onError(e: Error & { code?: string }) { if (e.code === 'EADDRINUSE') { httpServer.listen(++finalPort) - } else { + } + else { reject(e) } } @@ -44,7 +45,8 @@ export async function startPreview (port: number | null, ctx: Context): Promise< httpServer.close((err) => { if (err) { reject(err) - } else { + } + else { resolve() } }) diff --git a/packages/histoire/src/node/search.ts b/packages/histoire/src/node/search.ts index e9f37f59..40c4c7af 100644 --- a/packages/histoire/src/node/search.ts +++ b/packages/histoire/src/node/search.ts @@ -2,12 +2,12 @@ import { createRequire } from 'node:module' import flexsearch from 'flexsearch' import path from 'pathe' import { noCase } from 'change-case' -import { Context } from './context.js' +import type { Context } from './context.js' import { loadModule } from './load.js' const require = createRequire(import.meta.url) -export async function generateTitleSearchData (ctx: Context) { +export async function generateTitleSearchData(ctx: Context) { const searchIndex = await createIndex() const { idMap, addToIdMap } = createIdMap() @@ -32,7 +32,7 @@ export async function generateTitleSearchData (ctx: Context) { } } -export async function generateDocSearchData (ctx: Context) { +export async function generateDocSearchData(ctx: Context) { const searchIndex = await createIndex() const { idMap, addToIdMap } = createIdMap() @@ -51,7 +51,7 @@ export async function generateDocSearchData (ctx: Context) { } } -async function createIndex () { +async function createIndex() { const flexsearchRoot = path.dirname(require.resolve('flexsearch/package.json')) return new flexsearch.Document({ preset: 'match', @@ -67,11 +67,11 @@ async function createIndex () { }) } -function createIdMap () { +function createIdMap() { let uid = 0 const idMap: Record<number, { id: string, kind: string }> = {} - function addToIdMap (id: string, kind: string) { + function addToIdMap(id: string, kind: string) { const n = uid++ idMap[n] = { id, kind } return n @@ -92,7 +92,7 @@ const exportKeys = new Set([ 'store', ]) -async function exportSearchIndex (index) { +async function exportSearchIndex(index) { // eslint-disable-next-line no-async-promise-executor return new Promise(async (resolve) => { const exportedData: Record<string, any> = {} @@ -107,12 +107,12 @@ async function exportSearchIndex (index) { }) } -function convertTitleToSentence (text: string) { +function convertTitleToSentence(text: string) { return text.split(' ').map(str => noCase(str)).join(' ') } // @TODO clear handlers when SearchPane unmounts -export function getSearchDataJS (data: any) { +export function getSearchDataJS(data: any) { return `export let searchData = ${JSON.stringify(data)} const handlers = [] export function onUpdate (cb) { diff --git a/packages/histoire/src/node/server.ts b/packages/histoire/src/node/server.ts index 38da3b3b..da87a1d9 100644 --- a/packages/histoire/src/node/server.ts +++ b/packages/histoire/src/node/server.ts @@ -2,12 +2,12 @@ import { performance } from 'node:perf_hooks' import { createServer as createViteServer } from 'vite' import pc from 'picocolors' import type { ServerStoryFile } from '@histoire/shared' -import { Context } from './context.js' +import type { Context } from './context.js' import { getViteConfigWithPlugins } from './vite.js' import * as VirtualFiles from './virtual/index.js' import { onStoryChange, onStoryListChange, watchStories } from './stories.js' import { useCollectStories } from './collect/index.js' -import { DevPluginApi, DevEventPluginApi } from './plugin.js' +import { DevEventPluginApi, DevPluginApi } from './plugin.js' import { useModuleLoader } from './load.js' import { wrapLogError } from './util/log.js' import { createMarkdownFilesWatcher, onMarkdownListChange } from './markdown.js' @@ -17,7 +17,7 @@ export interface CreateServerOptions { open?: boolean } -export async function createServer (ctx: Context, options: CreateServerOptions = {}) { +export async function createServer(ctx: Context, options: CreateServerOptions = {}) { const getViteServer = async (collecting: boolean) => { const { viteConfig, viteConfigFile } = await getViteConfigWithPlugins(collecting, ctx) @@ -106,7 +106,7 @@ export async function createServer (ctx: Context, options: CreateServerOptions = type: 'js-update', acceptedPath: mod.url, path: mod.url, - timestamp: timestamp, + timestamp, }, ], }) @@ -121,7 +121,8 @@ export async function createServer (ctx: Context, options: CreateServerOptions = if (!queuedFiles.includes(changedFile)) { queuedFiles.push(changedFile) } - } else { + } + else { queuedFiles = [] } @@ -131,14 +132,15 @@ export async function createServer (ctx: Context, options: CreateServerOptions = clearTimeout(queueTimer) // Debounce queueTimer = setTimeout(collect, 100) - } else if (!changedFile && !currentFiles.length) { + } + else if (!changedFile && !currentFiles.length) { // Full collect in progress queued = false } } }) - async function collect () { + async function collect() { collecting = true clearCache() @@ -150,13 +152,14 @@ export async function createServer (ctx: Context, options: CreateServerOptions = console.log('Collect stories start', currentFiles.length ? currentFiles.map(f => f.fileName).join(', ') : 'all') const time = performance.now() if (currentFiles.length) { - await Promise.all(currentFiles.map(async storyFile => { + await Promise.all(currentFiles.map(async (storyFile) => { await executeStoryFile(storyFile) if (storyFile.story) { await invalidateModule(`/__resolved__virtual:story-source:${storyFile.story.id}`) } })) - } else { + } + else { // Full update // Progress tracking @@ -171,7 +174,7 @@ export async function createServer (ctx: Context, options: CreateServerOptions = sendProgress() - await Promise.all(ctx.storyFiles.map(async storyFile => { + await Promise.all(ctx.storyFiles.map(async (storyFile) => { await executeStoryFile(storyFile) loadedFilesCount++ sendProgress() @@ -201,7 +204,7 @@ export async function createServer (ctx: Context, options: CreateServerOptions = invalidateModule(VirtualFiles.RESOLVED_MARKDOWN_FILES) }) - async function close () { + async function close() { for (const cb of pluginOnCleanups) { await wrapLogError('plugin.onDev.onCleanup', () => cb()) } diff --git a/packages/histoire/src/node/stories.ts b/packages/histoire/src/node/stories.ts index 341782b0..8ec6d134 100644 --- a/packages/histoire/src/node/stories.ts +++ b/packages/histoire/src/node/stories.ts @@ -1,10 +1,10 @@ import chokidar from 'chokidar' import { globby } from 'globby' import { paramCase } from 'change-case' -import { resolve, basename } from 'pathe' +import { basename, resolve } from 'pathe' import micromatch from 'micromatch' import type { ServerStoryFile } from '@histoire/shared' -import { Context } from './context.js' +import type { Context } from './context.js' type StoryChangeHandler = (file?: ServerStoryFile) => unknown const storyChangeHandlers: StoryChangeHandler[] = [] @@ -13,11 +13,11 @@ const storyChangeHandlers: StoryChangeHandler[] = [] * Called when a new story is added or modified. Collecting should be done. * @param handler */ -export function onStoryChange (handler: StoryChangeHandler) { +export function onStoryChange(handler: StoryChangeHandler) { storyChangeHandlers.push(handler) } -export function notifyStoryChange (file?: ServerStoryFile) { +export function notifyStoryChange(file?: ServerStoryFile) { for (const handler of storyChangeHandlers) { handler(file) } @@ -30,11 +30,11 @@ const storyListChangeHandlers: StoryListChangeHandler[] = [] * Called when the story list has changed (ex: removed a story). No collecting should be needed. * @param handler */ -export function onStoryListChange (handler: StoryListChangeHandler) { +export function onStoryListChange(handler: StoryListChangeHandler) { storyListChangeHandlers.push(handler) } -export function notifyStoryListChange () { +export function notifyStoryListChange() { for (const handler of storyListChangeHandlers) { handler() } @@ -42,7 +42,7 @@ export function notifyStoryListChange () { let context: Context -export async function watchStories (newContext: Context) { +export async function watchStories(newContext: Context) { context = newContext const watcher = chokidar.watch(context.config.storyMatch, { cwd: context.root, @@ -62,11 +62,11 @@ export async function watchStories (newContext: Context) { return watcher } -function getAbsoluteFilePath (relativeFilePath: string) { +function getAbsoluteFilePath(relativeFilePath: string) { return resolve(context.root, relativeFilePath) } -export function addStory (relativeFilePath: string, virtualModuleCode?: string) { +export function addStory(relativeFilePath: string, virtualModuleCode?: string) { const absoluteFilePath = getAbsoluteFilePath(relativeFilePath) for (const file of context.storyFiles) { @@ -110,13 +110,13 @@ export function addStory (relativeFilePath: string, virtualModuleCode?: string) return file } -export function removeStory (relativeFilePath: string) { +export function removeStory(relativeFilePath: string) { const absoluteFilePath = getAbsoluteFilePath(relativeFilePath) - const index = context.storyFiles.findIndex((file) => file.path === absoluteFilePath) + const index = context.storyFiles.findIndex(file => file.path === absoluteFilePath) if (index !== -1) context.storyFiles.splice(index, 1) } -export async function findAllStories (newContext: Context) { +export async function findAllStories(newContext: Context) { context = newContext const files = await globby(context.config.storyMatch, { diff --git a/packages/histoire/src/node/tree.ts b/packages/histoire/src/node/tree.ts index 22a7d7f0..b86690a0 100644 --- a/packages/histoire/src/node/tree.ts +++ b/packages/histoire/src/node/tree.ts @@ -1,13 +1,13 @@ import pc from 'picocolors' import type { + HistoireConfig, ServerStoryFile, ServerTree, ServerTreeFile, - HistoireConfig, TreeGroupConfig, } from '@histoire/shared' -export function createPath (config: HistoireConfig, file: ServerTreeFile) { +export function createPath(config: HistoireConfig, file: ServerTreeFile) { if (config.tree.file === 'title') { return file.title.split('/') } @@ -28,7 +28,7 @@ export function createPath (config: HistoireConfig, file: ServerTreeFile) { return config.tree.file(file) } -export function makeTree (config: HistoireConfig, files: ServerStoryFile[]) { +export function makeTree(config: HistoireConfig, files: ServerStoryFile[]) { interface ITreeObject { [index: string]: number | ITreeObject } @@ -63,7 +63,8 @@ export function makeTree (config: HistoireConfig, files: ServerStoryFile[]) { for (const group of groups) { if (group === defaultGroup) { result.push(...buildTree(group.treeObject)) - } else { + } + else { result.push({ group: true, id: group.groupConfig.id, @@ -75,12 +76,13 @@ export function makeTree (config: HistoireConfig, files: ServerStoryFile[]) { return result - function getGroup (file: ServerStoryFile): ITreeGroup { + function getGroup(file: ServerStoryFile): ITreeGroup { if (file.story?.group) { const group = groups.find(g => g.groupConfig?.id === file.story.group) if (group) { return group - } else { + } + else { console.error(pc.red(`Group ${file.story.group} not found for story ${file.path}`)) } } @@ -92,25 +94,27 @@ export function makeTree (config: HistoireConfig, files: ServerStoryFile[]) { return defaultGroup } - function setPath (path: string[], value: unknown, tree: unknown) { + function setPath(path: string[], value: unknown, tree: unknown) { path.reduce((subtree, key, i) => { if (i === path.length - 1) { setKey(subtree, key, value) - } else if (isLeaf(subtree[key])) { + } + else if (isLeaf(subtree[key])) { setKey(subtree, key, subtree[key]) subtree[key] = {} - } else if (!subtree[key]) { + } + else if (!subtree[key]) { subtree[key] = {} } return subtree[key] }, tree) - function isLeaf (element) { - return !isNaN(element) + function isLeaf(element) { + return !Number.isNaN(Number(element)) } } - function setKey (tree, key, value) { + function setKey(tree, key, value) { if (isUndefined(tree[key])) { tree[key] = value return @@ -124,12 +128,12 @@ export function makeTree (config: HistoireConfig, files: ServerStoryFile[]) { tree[`${key}-${copyNumber}`] = value - function isUndefined (element) { + function isUndefined(element) { return element === undefined } } - function buildTree (treeObject: ITreeObject): ServerTree { + function buildTree(treeObject: ITreeObject): ServerTree { const tree: ServerTree = [] for (const [key, element] of Object.entries(treeObject)) { @@ -138,7 +142,8 @@ export function makeTree (config: HistoireConfig, files: ServerStoryFile[]) { title: key, index: element as number, }) - } else { + } + else { tree.push({ title: key, children: buildTree(element as ITreeObject), diff --git a/packages/histoire/src/node/util/find-up.ts b/packages/histoire/src/node/util/find-up.ts index a0b011ad..a67d0eb8 100644 --- a/packages/histoire/src/node/util/find-up.ts +++ b/packages/histoire/src/node/util/find-up.ts @@ -1,7 +1,7 @@ -import path from 'pathe' import fs from 'node:fs' +import path from 'pathe' -export function findUp (cwd: string = process.cwd(), fileNames: string[]): string { +export function findUp(cwd: string = process.cwd(), fileNames: string[]): string { let { root } = path.parse(cwd) let dir = cwd diff --git a/packages/histoire/src/node/util/log.ts b/packages/histoire/src/node/util/log.ts index ba39de29..0d070ecf 100644 --- a/packages/histoire/src/node/util/log.ts +++ b/packages/histoire/src/node/util/log.ts @@ -1,9 +1,10 @@ import pc from 'picocolors' -export async function wrapLogError (id: string, cb: () => unknown) { +export async function wrapLogError(id: string, cb: () => unknown) { try { await cb() - } catch (e) { + } + catch (e) { console.error(pc.red(`[Error] ${id}: ${e}`)) } } diff --git a/packages/histoire/src/node/util/slugify.ts b/packages/histoire/src/node/util/slugify.ts index 42f5e75f..b96607d3 100644 --- a/packages/histoire/src/node/util/slugify.ts +++ b/packages/histoire/src/node/util/slugify.ts @@ -4,10 +4,10 @@ // use a custom implementation here import { remove as removeDiacritics } from 'diacritics' // eslint-disable-next-line no-control-regex -const rControl = /[\u0000-\u001f]/g +const rControl = /[\u0000-\u001F]/g const rSpecial = /[\s~`!@#$%^&*()\-_+=[\]{}|\\;:"'<>,.?/]+/g -export const slugify = (str: string): string => { +export function slugify(str: string): string { return ( removeDiacritics(str) // Remove control characters diff --git a/packages/histoire/src/node/util/vendors.ts b/packages/histoire/src/node/util/vendors.ts index f502f414..fbb3bf0a 100644 --- a/packages/histoire/src/node/util/vendors.ts +++ b/packages/histoire/src/node/util/vendors.ts @@ -11,7 +11,7 @@ const alias = { '@histoire/controls': path.resolve(__dirname, '../vendors/controls.js'), } -export function getInjectedImport (request: string) { +export function getInjectedImport(request: string) { let id: string = request if (alias[id]) { diff --git a/packages/histoire/src/node/virtual/markdown.ts b/packages/histoire/src/node/virtual/markdown.ts index 33ec1145..e8ba2186 100644 --- a/packages/histoire/src/node/virtual/markdown.ts +++ b/packages/histoire/src/node/virtual/markdown.ts @@ -1,6 +1,6 @@ import type { Context } from '../context.js' -export const markdown = (ctx: Context, id: string) => { +export function markdown(ctx: Context, id: string) { const fileId = id.slice('/__resolved__virtual:md:'.length) const file = ctx.markdownFiles.find(f => f.id === fileId) if (!file) { diff --git a/packages/histoire/src/node/virtual/resolved-commands.ts b/packages/histoire/src/node/virtual/resolved-commands.ts index 82dcf717..e2aae408 100644 --- a/packages/histoire/src/node/virtual/resolved-commands.ts +++ b/packages/histoire/src/node/virtual/resolved-commands.ts @@ -3,7 +3,7 @@ import type { Context } from '../context.js' const serializedFields: Readonly<(keyof PluginCommand)[]> = ['id', 'label', 'prompts', 'icon', 'searchText'] as const -export const resolvedCommands = (ctx: Context) => { +export function resolvedCommands(ctx: Context) { const imports: string[] = [] const commands: string[] = [] @@ -17,7 +17,7 @@ export const registeredCommands = [${commands.join(', ')}] ` } -function getCommandFields (command: PluginCommand, imports: string[]) { +function getCommandFields(command: PluginCommand, imports: string[]) { const fields: string[] = [] for (const field of serializedFields) { @@ -31,7 +31,8 @@ function getCommandFields (command: PluginCommand, imports: string[]) { const importedVar = `__setup${imports.length}__` if (typeof command.clientSetupFile === 'string') { imports.push(`import ${importedVar} from '${command.clientSetupFile}'`) - } else { + } + else { imports.push(`import { ${command.clientSetupFile.importName} as ${importedVar} } from '${command.clientSetupFile.file}'`) } fields.push(`...${importedVar}`) diff --git a/packages/histoire/src/node/virtual/resolved-config.ts b/packages/histoire/src/node/virtual/resolved-config.ts index 17a37faf..80699e8f 100644 --- a/packages/histoire/src/node/virtual/resolved-config.ts +++ b/packages/histoire/src/node/virtual/resolved-config.ts @@ -1,6 +1,6 @@ import type { Context } from '../context.js' -export const resolvedConfig = (ctx: Context) => { +export function resolvedConfig(ctx: Context) { let js = `export const config = ${JSON.stringify(ctx.config)}\n` if (ctx.config.theme?.logo) { for (const key in ctx.config.theme.logo) { diff --git a/packages/histoire/src/node/virtual/resolved-generated-global-setup.ts b/packages/histoire/src/node/virtual/resolved-generated-global-setup.ts index cebedc84..2733dc78 100644 --- a/packages/histoire/src/node/virtual/resolved-generated-global-setup.ts +++ b/packages/histoire/src/node/virtual/resolved-generated-global-setup.ts @@ -1,8 +1,8 @@ import type { Context } from '../context.js' -import { GENERATED_SETUP_CODE } from './index.js' import { ID_SEPARATOR } from './util.js' +import { GENERATED_SETUP_CODE } from './index.js' -export const resolvedGeneratedGlobalSetup = (ctx: Context) => { +export function resolvedGeneratedGlobalSetup(ctx: Context) { if (ctx.config.setupCode) { return [ // Import @@ -18,7 +18,8 @@ export const resolvedGeneratedGlobalSetup = (ctx: Context) => { } }`), ].join('\n') - } else { + } + else { return '' } } diff --git a/packages/histoire/src/node/virtual/resolved-generated-setup-code.ts b/packages/histoire/src/node/virtual/resolved-generated-setup-code.ts index da18fa7d..49a938ae 100644 --- a/packages/histoire/src/node/virtual/resolved-generated-setup-code.ts +++ b/packages/histoire/src/node/virtual/resolved-generated-setup-code.ts @@ -1,7 +1,7 @@ import type { Context } from '../context.js' import { ID_SEPARATOR } from './util.js' -export const resolvedGeneratedSetupCode = (ctx: Context, id: string) => { +export function resolvedGeneratedSetupCode(ctx: Context, id: string) { const [, index] = id.split(ID_SEPARATOR) return ctx.config.setupCode?.[index] ?? '' } diff --git a/packages/histoire/src/node/virtual/resolved-markdown-files.ts b/packages/histoire/src/node/virtual/resolved-markdown-files.ts index 07c85720..33e5abe3 100644 --- a/packages/histoire/src/node/virtual/resolved-markdown-files.ts +++ b/packages/histoire/src/node/virtual/resolved-markdown-files.ts @@ -1,7 +1,7 @@ import type { Context } from '../context.js' import { getInjectedImport } from '../util/vendors.js' -export const resolvedMarkdownFiles = (ctx: Context) => { +export function resolvedMarkdownFiles(ctx: Context) { const filesJs = ctx.markdownFiles.map(f => `${JSON.stringify(f.relativePath)}: () => import(${JSON.stringify(`virtual:md:${f.id}`)})`).join(',') return `import { reactive } from ${process.env.HISTOIRE_DEV ? `'vue'` : getInjectedImport('@histoire/vendors/vue')} export const markdownFiles = reactive({${filesJs}}) diff --git a/packages/histoire/src/node/virtual/resolved-stories.ts b/packages/histoire/src/node/virtual/resolved-stories.ts index 027673ee..181c0074 100644 --- a/packages/histoire/src/node/virtual/resolved-stories.ts +++ b/packages/histoire/src/node/virtual/resolved-stories.ts @@ -1,7 +1,7 @@ import type { Context } from '../context.js' import { makeTree } from '../tree.js' -export const resolvedStories = (ctx: Context) => { +export function resolvedStories(ctx: Context) { const resolvedStories = ctx.storyFiles.filter(s => !!s.story) const files = resolvedStories.map((file, index) => { return { @@ -25,7 +25,7 @@ ${resolvedStories.map((file, index) => { } return supportPlugin.importStoryComponent(file, index) }).filter(Boolean).join('\n')} -export let files = [${files.map((file) => `{${JSON.stringify(file).slice(1, -1)}, component: Comp${file.index}, source: () => import('virtual:story-source:${file.story.id}')}`).join(',\n')}] +export let files = [${files.map(file => `{${JSON.stringify(file).slice(1, -1)}, component: Comp${file.index}, source: () => import('virtual:story-source:${file.story.id}')}`).join(',\n')}] export let tree = ${JSON.stringify(makeTree(ctx.config, resolvedStories))} const handlers = [] export function onUpdate (cb) { diff --git a/packages/histoire/src/node/virtual/resolved-support-plugins-client.ts b/packages/histoire/src/node/virtual/resolved-support-plugins-client.ts index 9b554d27..e280f688 100644 --- a/packages/histoire/src/node/virtual/resolved-support-plugins-client.ts +++ b/packages/histoire/src/node/virtual/resolved-support-plugins-client.ts @@ -4,7 +4,7 @@ import { PLUGINS_HAVE_DEV } from './util.js' const require = createRequire(import.meta.url) -export const resolvedSupportPluginsClient = (ctx: Context) => { +export function resolvedSupportPluginsClient(ctx: Context) { const plugins = ctx.supportPlugins.map(p => `'${p.id}': () => import(${JSON.stringify(require.resolve(`${p.moduleName}/client${process.env.HISTOIRE_DEV && PLUGINS_HAVE_DEV.includes(p.moduleName) ? '-dev' : ''}`, { paths: [ctx.root, import.meta.url], }))})`) diff --git a/packages/histoire/src/node/virtual/resolved-support-plugins-collect.ts b/packages/histoire/src/node/virtual/resolved-support-plugins-collect.ts index c89273ce..db919cd9 100644 --- a/packages/histoire/src/node/virtual/resolved-support-plugins-collect.ts +++ b/packages/histoire/src/node/virtual/resolved-support-plugins-collect.ts @@ -4,7 +4,7 @@ import { PLUGINS_HAVE_DEV } from './util.js' const require = createRequire(import.meta.url) -export const resolvedSupportPluginsCollect = (ctx: Context) => { +export function resolvedSupportPluginsCollect(ctx: Context) { const plugins = ctx.supportPlugins.map(p => `'${p.id}': () => import(${JSON.stringify(require.resolve(`${p.moduleName}/collect${process.env.HISTOIRE_DEV && PLUGINS_HAVE_DEV.includes(p.moduleName) ? '-dev' : ''}`, { paths: [ctx.root, import.meta.url], }))})`) diff --git a/packages/histoire/src/node/virtual/resolved-theme.ts b/packages/histoire/src/node/virtual/resolved-theme.ts index 83bda2ca..600290ed 100644 --- a/packages/histoire/src/node/virtual/resolved-theme.ts +++ b/packages/histoire/src/node/virtual/resolved-theme.ts @@ -1,7 +1,7 @@ import { parseColor } from '../colors.js' import type { Context } from '../context.js' -export const resolvedTheme = (ctx: Context) => { +export function resolvedTheme(ctx: Context) { let css = '*, ::before, ::after {' // Colors for (const color in ctx.config.theme?.colors ?? {}) { diff --git a/packages/histoire/src/node/virtual/story-source.ts b/packages/histoire/src/node/virtual/story-source.ts index 884c555b..3b0fca1b 100644 --- a/packages/histoire/src/node/virtual/story-source.ts +++ b/packages/histoire/src/node/virtual/story-source.ts @@ -2,14 +2,15 @@ import fs from 'fs-extra' import { resolve } from 'pathe' import type { Context } from '../context.js' -export const storySource = async (ctx: Context, id: string) => { +export async function storySource(ctx: Context, id: string) { const storyId = id.slice('/__resolved__virtual:story-source:'.length) const storyFile = ctx.storyFiles.find(f => f.story?.id === storyId) if (storyFile) { let source: string if (storyFile.virtual) { source = storyFile.moduleCode - } else { + } + else { source = await fs.readFile(resolve(ctx.root, storyFile.relativePath), 'utf-8') } return `export default ${JSON.stringify(source)}` diff --git a/packages/histoire/src/node/virtual/story.ts b/packages/histoire/src/node/virtual/story.ts index c425f795..8d5abb15 100644 --- a/packages/histoire/src/node/virtual/story.ts +++ b/packages/histoire/src/node/virtual/story.ts @@ -1,6 +1,6 @@ import type { Context } from '../context.js' -export const story = (ctx: Context, id: string) => { +export function story(ctx: Context, id: string) { const moduleId = id.replace('\0', '') const storyFile = ctx.storyFiles.find(f => f.moduleId === moduleId && f.virtual) if (storyFile) { diff --git a/packages/histoire/src/node/virtual/vite-plugin.ts b/packages/histoire/src/node/virtual/vite-plugin.ts index a269f4d6..2813b2f1 100644 --- a/packages/histoire/src/node/virtual/vite-plugin.ts +++ b/packages/histoire/src/node/virtual/vite-plugin.ts @@ -1,142 +1,146 @@ import type { Plugin as VitePlugin } from 'vite' import { resolve } from 'pathe' import type { Context } from '../context.js' -import * as VirtualFiles from './index.js' -import { ID_SEPARATOR } from './util.js' import { generateDocSearchData, generateTitleSearchData, getSearchDataJS } from '../search.js' +import { ID_SEPARATOR } from './util.js' +import * as VirtualFiles from './index.js' -export const createVirtualFilesPlugin = (ctx: Context, isServer: boolean) => ({ - name: 'histoire-virtual-files', - - async resolveId (id, importer) { - if (id.startsWith(VirtualFiles.STORIES_ID)) { - return VirtualFiles.RESOLVED_STORIES_ID - } - if (id.startsWith(VirtualFiles.SETUP_ID)) { - const setupFileConfig = ctx.config.setupFile - if (setupFileConfig) { - let file: string - if (typeof setupFileConfig === 'string') { - file = setupFileConfig - } else if (isServer && 'server' in setupFileConfig) { - file = setupFileConfig.server - } else if (!isServer && 'browser' in setupFileConfig) { - file = setupFileConfig.browser - } - if (file) { - return this.resolve(resolve(ctx.root, file), importer, { - skipSelf: true, - }) +export function createVirtualFilesPlugin(ctx: Context, isServer: boolean) { + return { + name: 'histoire-virtual-files', + + async resolveId(id, importer) { + if (id.startsWith(VirtualFiles.STORIES_ID)) { + return VirtualFiles.RESOLVED_STORIES_ID + } + if (id.startsWith(VirtualFiles.SETUP_ID)) { + const setupFileConfig = ctx.config.setupFile + if (setupFileConfig) { + let file: string + if (typeof setupFileConfig === 'string') { + file = setupFileConfig + } + else if (isServer && 'server' in setupFileConfig) { + file = setupFileConfig.server + } + else if (!isServer && 'browser' in setupFileConfig) { + file = setupFileConfig.browser + } + if (file) { + return this.resolve(resolve(ctx.root, file), importer, { + skipSelf: true, + }) + } } + return VirtualFiles.NOOP_ID + } + if (id.startsWith(VirtualFiles.CONFIG_ID)) { + return VirtualFiles.RESOLVED_CONFIG_ID + } + if (id.startsWith(VirtualFiles.THEME_ID)) { + return VirtualFiles.RESOLVED_THEME_ID + } + if (id.startsWith(VirtualFiles.SEARCH_TITLE_DATA_ID)) { + return VirtualFiles.RESOLVED_SEARCH_TITLE_DATA_ID + } + if (id.startsWith(VirtualFiles.SEARCH_DOCS_DATA_ID)) { + return VirtualFiles.RESOLVED_SEARCH_DOCS_DATA_ID + } + if (id.startsWith(VirtualFiles.GENERATED_GLOBAL_SETUP)) { + return VirtualFiles.RESOLVED_GENERATED_GLOBAL_SETUP + } + if (id.startsWith(VirtualFiles.GENERATED_SETUP_CODE)) { + const [, index] = id.split(ID_SEPARATOR) + return `${VirtualFiles.RESOLVED_GENERATED_SETUP_CODE}${ID_SEPARATOR}${index}` } - return VirtualFiles.NOOP_ID - } - if (id.startsWith(VirtualFiles.CONFIG_ID)) { - return VirtualFiles.RESOLVED_CONFIG_ID - } - if (id.startsWith(VirtualFiles.THEME_ID)) { - return VirtualFiles.RESOLVED_THEME_ID - } - if (id.startsWith(VirtualFiles.SEARCH_TITLE_DATA_ID)) { - return VirtualFiles.RESOLVED_SEARCH_TITLE_DATA_ID - } - if (id.startsWith(VirtualFiles.SEARCH_DOCS_DATA_ID)) { - return VirtualFiles.RESOLVED_SEARCH_DOCS_DATA_ID - } - if (id.startsWith(VirtualFiles.GENERATED_GLOBAL_SETUP)) { - return VirtualFiles.RESOLVED_GENERATED_GLOBAL_SETUP - } - if (id.startsWith(VirtualFiles.GENERATED_SETUP_CODE)) { - const [, index] = id.split(ID_SEPARATOR) - return `${VirtualFiles.RESOLVED_GENERATED_SETUP_CODE}${ID_SEPARATOR}${index}` - } - if (id.startsWith(VirtualFiles.SUPPORT_PLUGINS_CLIENT)) { - return VirtualFiles.RESOLVED_SUPPORT_PLUGINS_CLIENT - } - if (id.startsWith(VirtualFiles.SUPPORT_PLUGINS_COLLECT)) { - return VirtualFiles.RESOLVED_SUPPORT_PLUGINS_COLLECT - } - if (id.startsWith(VirtualFiles.MARKDOWN_FILES)) { - return VirtualFiles.RESOLVED_MARKDOWN_FILES - } - if (id.startsWith(VirtualFiles.COMMANDS)) { - return VirtualFiles.RESOLVED_COMMANDS - } - if (id.startsWith('virtual:story:')) { - return `\0${id}` - } - if (id.startsWith('virtual:story-source:')) { - return `/__resolved__${id}` + if (id.startsWith(VirtualFiles.SUPPORT_PLUGINS_CLIENT)) { + return VirtualFiles.RESOLVED_SUPPORT_PLUGINS_CLIENT + } + if (id.startsWith(VirtualFiles.SUPPORT_PLUGINS_COLLECT)) { + return VirtualFiles.RESOLVED_SUPPORT_PLUGINS_COLLECT + } + if (id.startsWith(VirtualFiles.MARKDOWN_FILES)) { + return VirtualFiles.RESOLVED_MARKDOWN_FILES + } + if (id.startsWith(VirtualFiles.COMMANDS)) { + return VirtualFiles.RESOLVED_COMMANDS + } + if (id.startsWith('virtual:story:')) { + return `\0${id}` + } + if (id.startsWith('virtual:story-source:')) { + return `/__resolved__${id}` // @TODO // return `\0${id}` - } + } - if (id.startsWith('virtual:md:')) { - return `/__resolved__${id}` + if (id.startsWith('virtual:md:')) { + return `/__resolved__${id}` // @TODO // return `\0${id}` - } - }, - - async load (id) { - if (id === VirtualFiles.RESOLVED_STORIES_ID) { - return VirtualFiles.resolvedStories(ctx) - } - - if (id === VirtualFiles.NOOP_ID) { - return VirtualFiles.noop() - } - - if (id === VirtualFiles.RESOLVED_CONFIG_ID) { - return VirtualFiles.resolvedConfig(ctx) - } - - if (id === VirtualFiles.RESOLVED_THEME_ID) { - return VirtualFiles.resolvedTheme(ctx) - } - - if (id === VirtualFiles.RESOLVED_SEARCH_TITLE_DATA_ID) { - return getSearchDataJS(await generateTitleSearchData(ctx)) - } - - if (id === VirtualFiles.RESOLVED_SEARCH_DOCS_DATA_ID) { - return getSearchDataJS(await generateDocSearchData(ctx)) - } - - if (id === VirtualFiles.RESOLVED_GENERATED_GLOBAL_SETUP) { - return VirtualFiles.resolvedGeneratedGlobalSetup(ctx) - } - - if (id.startsWith(VirtualFiles.RESOLVED_GENERATED_SETUP_CODE)) { - return VirtualFiles.resolvedGeneratedSetupCode(ctx, id) - } - - if (id === VirtualFiles.RESOLVED_SUPPORT_PLUGINS_CLIENT) { - return VirtualFiles.resolvedSupportPluginsClient(ctx) - } - - if (id === VirtualFiles.RESOLVED_SUPPORT_PLUGINS_COLLECT) { - return VirtualFiles.resolvedSupportPluginsCollect(ctx) - } - - if (id === VirtualFiles.RESOLVED_MARKDOWN_FILES) { - return VirtualFiles.resolvedMarkdownFiles(ctx) - } - - if (id === VirtualFiles.RESOLVED_COMMANDS) { - return VirtualFiles.resolvedCommands(ctx) - } - - if (id.startsWith('\0virtual:story:')) { - return VirtualFiles.story(ctx, id) - } - - if (id.startsWith('/__resolved__virtual:story-source:')) { - return VirtualFiles.storySource(ctx, id) - } - - if (id.startsWith('/__resolved__virtual:md:')) { - return VirtualFiles.markdown(ctx, id) - } - }, -} as VitePlugin) + } + }, + + async load(id) { + if (id === VirtualFiles.RESOLVED_STORIES_ID) { + return VirtualFiles.resolvedStories(ctx) + } + + if (id === VirtualFiles.NOOP_ID) { + return VirtualFiles.noop() + } + + if (id === VirtualFiles.RESOLVED_CONFIG_ID) { + return VirtualFiles.resolvedConfig(ctx) + } + + if (id === VirtualFiles.RESOLVED_THEME_ID) { + return VirtualFiles.resolvedTheme(ctx) + } + + if (id === VirtualFiles.RESOLVED_SEARCH_TITLE_DATA_ID) { + return getSearchDataJS(await generateTitleSearchData(ctx)) + } + + if (id === VirtualFiles.RESOLVED_SEARCH_DOCS_DATA_ID) { + return getSearchDataJS(await generateDocSearchData(ctx)) + } + + if (id === VirtualFiles.RESOLVED_GENERATED_GLOBAL_SETUP) { + return VirtualFiles.resolvedGeneratedGlobalSetup(ctx) + } + + if (id.startsWith(VirtualFiles.RESOLVED_GENERATED_SETUP_CODE)) { + return VirtualFiles.resolvedGeneratedSetupCode(ctx, id) + } + + if (id === VirtualFiles.RESOLVED_SUPPORT_PLUGINS_CLIENT) { + return VirtualFiles.resolvedSupportPluginsClient(ctx) + } + + if (id === VirtualFiles.RESOLVED_SUPPORT_PLUGINS_COLLECT) { + return VirtualFiles.resolvedSupportPluginsCollect(ctx) + } + + if (id === VirtualFiles.RESOLVED_MARKDOWN_FILES) { + return VirtualFiles.resolvedMarkdownFiles(ctx) + } + + if (id === VirtualFiles.RESOLVED_COMMANDS) { + return VirtualFiles.resolvedCommands(ctx) + } + + if (id.startsWith('\0virtual:story:')) { + return VirtualFiles.story(ctx, id) + } + + if (id.startsWith('/__resolved__virtual:story-source:')) { + return VirtualFiles.storySource(ctx, id) + } + + if (id.startsWith('/__resolved__virtual:md:')) { + return VirtualFiles.markdown(ctx, id) + } + }, + } as VitePlugin +} diff --git a/packages/histoire/src/node/vite.ts b/packages/histoire/src/node/vite.ts index cfbbbaca..12709c19 100644 --- a/packages/histoire/src/node/vite.ts +++ b/packages/histoire/src/node/vite.ts @@ -1,22 +1,24 @@ import { createRequire } from 'node:module' -import { relative, join, dirname } from 'pathe' -import { - Plugin as VitePlugin, - UserConfig as ViteConfig, +import { dirname, join, relative } from 'pathe' +import type { InlineConfig, - mergeConfig as mergeViteConfig, + UserConfig as ViteConfig, + Plugin as VitePlugin, +} from 'vite' +import { loadConfigFromFile as loadViteConfigFromFile, + mergeConfig as mergeViteConfig, } from 'vite' import { lookup as lookupMime } from 'mrmime' import { APP_PATH, TEMP_PATH } from './alias.js' -import { Context } from './context.js' +import type { Context } from './context.js' import { notifyStoryChange } from './stories.js' import { createMarkdownPlugins } from './markdown.js' import { createVirtualFilesPlugin } from './virtual/vite-plugin.js' const require = createRequire(import.meta.url) -export async function mergeHistoireViteConfig (viteConfig: InlineConfig, ctx: Context) { +export async function mergeHistoireViteConfig(viteConfig: InlineConfig, ctx: Context) { if (ctx.config.vite) { const command = ctx.mode === 'dev' ? 'serve' : 'build' const overrides = typeof ctx.config.vite === 'function' @@ -36,7 +38,8 @@ export async function mergeHistoireViteConfig (viteConfig: InlineConfig, ctx: Co const resolvedPluginOption = await pluginOption if (Array.isArray(resolvedPluginOption)) { flatPlugins.push(...await Promise.all(resolvedPluginOption)) - } else { + } + else { flatPlugins.push(resolvedPluginOption) } } @@ -57,20 +60,21 @@ export interface ViteConfigWithPlugins { viteConfigFile: string | null } -export async function getViteConfigWithPlugins (isServer: boolean, ctx: Context): Promise<ViteConfigWithPlugins> { +export async function getViteConfigWithPlugins(isServer: boolean, ctx: Context): Promise<ViteConfigWithPlugins> { const userViteConfigFile = await loadViteConfigFromFile({ command: ctx.mode === 'dev' ? 'serve' : 'build', mode: ctx.mode }) const userViteConfig = mergeViteConfig(userViteConfigFile?.config ?? {}, { server: { port: 6006 } }) const inlineConfig = await mergeHistoireViteConfig(userViteConfig, ctx) const plugins: VitePlugin[] = [] - function optimizeDeps (deps: string[]): string[] { + function optimizeDeps(deps: string[]): string[] { const result = [] for (const dep of deps) { result.push(dep) try { result.push(dirname(require.resolve(`${dep}/package.json`))) - } catch (e) { + } + catch (e) { // Noop } } @@ -80,7 +84,7 @@ export async function getViteConfigWithPlugins (isServer: boolean, ctx: Context) plugins.push({ name: 'histoire-vite-plugin', - config (_, { command }) { + config(_, { command }) { return { resolve: { dedupe: [ @@ -93,8 +97,8 @@ export async function getViteConfigWithPlugins (isServer: boolean, ctx: Context) ...(isServer ? { // Force resolving deps like Node.JS resolution algorithm (in case some modules are not loaded with ssr: true e.g. .vue files) - conditions: ['node'], - } + conditions: ['node'], + } : {}), }, optimizeDeps: { @@ -123,8 +127,8 @@ export async function getViteConfigWithPlugins (isServer: boolean, ctx: Context) process.cwd(), ...process.env.HISTOIRE_DEV ? [ - '../../packages/histoire-vendors', - ] + '../../packages/histoire-vendors', + ] : [], ], }, @@ -135,36 +139,35 @@ export async function getViteConfigWithPlugins (isServer: boolean, ctx: Context) }, define: { // We need to force this to be able to use `devtoolsRawSetupState` - __VUE_PROD_DEVTOOLS__: 'true', + '__VUE_PROD_DEVTOOLS__': 'true', // Disable warnings 'process.env.NODE_ENV': JSON.stringify(isServer ? 'production' : process.env.NODE_ENV ?? 'development'), ...!isServer ? { // Collect flag - 'process.env.HST_COLLECT': 'false', - } + 'process.env.HST_COLLECT': 'false', + } : {}, - __HST_COLLECT__: isServer, + '__HST_COLLECT__': isServer, }, cacheDir: isServer ? 'node_modules/.hst-vite-server' : 'node_modules/.hst-vite', } }, - options () { - // @ts-ignore + options() { this.meta.histoire = { isCollecting: isServer, } }, - handleHotUpdate (updateContext) { + handleHotUpdate(updateContext) { const story = ctx.storyFiles.find(file => file.path === updateContext.file) if (story) { notifyStoryChange(story) } }, - configureServer (server) { + configureServer(server) { let firstMount = true server.ws.on('histoire:mount', () => { if (!firstMount) { @@ -249,18 +252,18 @@ export async function getViteConfigWithPlugins (isServer: boolean, ctx: Context) // Replace dev flag const flags = { '_ctx.__HISTOIRE_DEV__': JSON.stringify(ctx.mode === 'dev'), - __HISTOIRE_DEV__: JSON.stringify(ctx.mode === 'dev'), + '__HISTOIRE_DEV__': JSON.stringify(ctx.mode === 'dev'), } plugins.push({ name: 'histoire:flags', enforce: 'pre', - transform (code, id) { + transform(code, id) { if (id.match(/\.(vue|js)($|\?)/)) { const original = code for (const flag in flags) { code = code.replace(new RegExp(flag, 'g'), flags[flag]) } - if (original !== code) { return code } + if (original !== code) return code } }, }) @@ -269,7 +272,7 @@ export async function getViteConfigWithPlugins (isServer: boolean, ctx: Context) // Dev commands plugins.push({ name: 'histoire:dev-commands', - configureServer (server) { + configureServer(server) { server.ws.on('histoire:dev-command', ({ id, params }) => { const command = ctx.registeredCommands.find(c => c.id === id) if (command?.serverAction) { @@ -291,7 +294,7 @@ export async function getViteConfigWithPlugins (isServer: boolean, ctx: Context) name: 'histoire-file-name-plugin', enforce: 'post', - transform (code, id) { + transform(code, id) { if (exclude.some(r => r.test(id))) return if (include.some(r => r.test(id))) { const file = relative(ctx.resolvedViteConfig.root, id) @@ -306,7 +309,7 @@ export async function getViteConfigWithPlugins (isServer: boolean, ctx: Context) if (process.env.HISTOIRE_DEV && !isServer) { plugins.push({ name: 'histoire-dev-plugin', - config () { + config() { // Examples context return { resolve: { diff --git a/packages/histoire/tsconfig.json b/packages/histoire/tsconfig.json index 7c1ad58e..aa140461 100644 --- a/packages/histoire/tsconfig.json +++ b/packages/histoire/tsconfig.json @@ -1,34 +1,34 @@ { "compilerOptions": { "target": "ESNext", + // Volar + "jsx": "preserve", + "lib": [ + "ESNext", + "DOM" + ], + "baseUrl": ".", + "rootDir": "src", "module": "ESNext", "moduleResolution": "node", - "outDir": "dist", - "rootDir": "src", - "baseUrl": ".", - "allowSyntheticDefaultImports": true, - "esModuleInterop": true, - "removeComments": false, "resolveJsonModule": true, - "skipLibCheck": true, "types": [ "node" ], - "lib": [ - "ESNext", - "DOM" - ], - "sourceMap": false, - "preserveWatchOutput": true, - "declaration": true, + "strictBindCallApply": true, + "strictFunctionTypes": true, + "alwaysStrict": true, // Strict "noImplicitAny": false, "noImplicitThis": true, - "alwaysStrict": true, - "strictBindCallApply": true, - "strictFunctionTypes": true, - // Volar - "jsx": "preserve" + "declaration": true, + "outDir": "dist", + "removeComments": false, + "sourceMap": false, + "allowSyntheticDefaultImports": true, + "esModuleInterop": true, + "skipLibCheck": true, + "preserveWatchOutput": true }, "include": [ "src" diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index b5fa469a..8532a565 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -11,24 +11,15 @@ importers: '@akryum/sheep': specifier: ^0.5.0 version: 0.5.0 + '@antfu/eslint-config': + specifier: ^2.13.0 + version: 2.13.0(@vue/compiler-sfc@3.3.11)(eslint@9.0.0)(typescript@5.4.4) '@histoire/vendors': specifier: workspace:* version: link:packages/histoire-vendors '@iconify/vue': specifier: ^3.2.1 version: 3.2.1(vue@3.3.8) - '@typescript-eslint/eslint-plugin': - specifier: ^5.62.0 - version: 5.62.0(@typescript-eslint/parser@5.62.0)(eslint@8.54.0)(typescript@4.9.5) - '@typescript-eslint/parser': - specifier: ^5.62.0 - version: 5.62.0(eslint@8.54.0)(typescript@4.9.5) - '@vue/eslint-config-standard': - specifier: ^6.1.0 - version: 6.1.0(eslint-plugin-import@2.29.0)(eslint-plugin-node@11.1.0)(eslint-plugin-promise@6.1.1)(eslint-plugin-vue@9.18.1)(eslint@8.54.0) - '@vue/eslint-config-typescript': - specifier: ^10.0.0 - version: 10.0.0(eslint-plugin-vue@9.18.1)(eslint@8.54.0)(typescript@4.9.5) '@vueuse/core': specifier: ^9.13.0 version: 9.13.0(vue@3.3.11) @@ -36,23 +27,8 @@ importers: specifier: ^10.4.16 version: 10.4.16(postcss@8.4.31) eslint: - specifier: ^8.54.0 - version: 8.54.0 - eslint-plugin-cypress: - specifier: ^2.15.1 - version: 2.15.1(eslint@8.54.0) - eslint-plugin-import: - specifier: ^2.29.0 - version: 2.29.0(@typescript-eslint/parser@5.62.0)(eslint@8.54.0) - eslint-plugin-node: - specifier: ^11.1.0 - version: 11.1.0(eslint@8.54.0) - eslint-plugin-promise: - specifier: ^6.1.1 - version: 6.1.1(eslint@8.54.0) - eslint-plugin-vue: - specifier: ^9.18.1 - version: 9.18.1(eslint@8.54.0) + specifier: ^9.0.0 + version: 9.0.0 floating-vue: specifier: 2.0.0-beta.19 version: 2.0.0-beta.19(vue@3.3.8) @@ -66,20 +42,20 @@ importers: specifier: ^3.3.5 version: 3.3.5 typescript: - specifier: ^4.9.5 - version: 4.9.5 + specifier: ^5.4.4 + version: 5.4.4 vitepress: specifier: 1.0.0-alpha.10 - version: 1.0.0-alpha.10(search-insights@2.13.0)(typescript@4.9.5) + version: 1.0.0-alpha.10(search-insights@2.13.0)(typescript@5.4.4) vue-eslint-parser: specifier: ^9.3.2 - version: 9.3.2(eslint@8.54.0) + version: 9.3.2(eslint@9.0.0) docs: devDependencies: vue: specifier: ^3.3.8 - version: 3.3.8(typescript@4.9.5) + version: 3.3.8(typescript@5.4.4) examples/nuxt3: devDependencies: @@ -100,13 +76,13 @@ importers: version: link:../../packages/histoire nuxt: specifier: ^3.8.2 - version: 3.8.2(eslint@8.54.0)(typescript@4.9.5)(vite@4.5.1) + version: 3.8.2(eslint@9.0.0)(typescript@5.4.4)(vite@4.5.1) start-server-and-test: specifier: ^1.15.4 version: 1.15.4 vue: specifier: ^3.3.8 - version: 3.3.8(typescript@4.9.5) + version: 3.3.8(typescript@5.4.4) examples/svelte4: dependencies: @@ -131,7 +107,7 @@ importers: version: 1.15.4 svelte-preprocess: specifier: ^5.1.0 - version: 5.1.0(postcss@8.4.31)(svelte@4.2.7)(typescript@4.9.5) + version: 5.1.0(postcss@8.4.31)(svelte@4.2.7)(typescript@5.4.4) vite: specifier: ^5.0.11 version: 5.0.11(@types/node@18.11.9) @@ -168,13 +144,13 @@ importers: version: 2.10.3(postcss@8.4.31)(svelte@3.59.2) svelte-preprocess: specifier: ^4.10.7 - version: 4.10.7(postcss@8.4.31)(svelte@3.59.2)(typescript@4.9.5) + version: 4.10.7(postcss@8.4.31)(svelte@3.59.2)(typescript@5.4.4) tslib: specifier: ^2.6.2 version: 2.6.2 typescript: - specifier: ^4.9.5 - version: 4.9.5 + specifier: ^5.4.4 + version: 5.4.4 vite: specifier: ^5.0.11 version: 5.0.11(@types/node@18.11.9) @@ -208,10 +184,10 @@ importers: version: 5.12.2 pinia: specifier: ^2.1.7 - version: 2.1.7(typescript@4.9.5)(vue@3.3.8) + version: 2.1.7(typescript@5.4.4)(vue@3.3.8) vue: specifier: ^3.3.8 - version: 3.3.8(typescript@4.9.5) + version: 3.3.8(typescript@5.4.4) devDependencies: '@histoire/app': specifier: workspace:* @@ -254,7 +230,7 @@ importers: dependencies: vue: specifier: ^3.3.8 - version: 3.3.8(typescript@4.9.5) + version: 3.3.8(typescript@5.4.4) devDependencies: '@histoire/plugin-percy': specifier: workspace:* @@ -276,7 +252,7 @@ importers: dependencies: vue: specifier: ^3.3.8 - version: 3.3.8(typescript@4.9.5) + version: 3.3.8(typescript@5.4.4) devDependencies: '@histoire/plugin-screenshot': specifier: workspace:* @@ -298,7 +274,7 @@ importers: dependencies: vue: specifier: ^3.3.8 - version: 3.3.8(typescript@4.9.5) + version: 3.3.8(typescript@5.4.4) devDependencies: '@histoire/plugin-vue': specifier: workspace:* @@ -320,10 +296,10 @@ importers: version: 7.3.67 vue: specifier: ^3.3.11 - version: 3.3.11(typescript@4.9.5) + version: 3.3.11(typescript@5.4.4) vuetify: specifier: ^3.4.6 - version: 3.4.6(typescript@4.9.5)(vite-plugin-vuetify@1.0.2)(vue@3.3.11) + version: 3.4.6(typescript@5.4.4)(vite-plugin-vuetify@1.0.2)(vue@3.3.11) devDependencies: '@histoire/plugin-vue': specifier: workspace:* @@ -453,8 +429,8 @@ importers: specifier: ^4.8.0 version: 4.8.0 typescript: - specifier: ^4.9.5 - version: 4.9.5 + specifier: ^5.4.4 + version: 5.4.4 vite: specifier: ^5.0.11 version: 5.0.11(@types/node@18.11.9) @@ -523,14 +499,14 @@ importers: specifier: ^3.3.5 version: 3.3.5 typescript: - specifier: ^4.9.5 - version: 4.9.5 + specifier: ^5.4.4 + version: 5.4.4 vite: specifier: ^5.0.11 version: 5.0.11(@types/node@18.11.9) vue: specifier: ^3.3.8 - version: 3.3.8(typescript@4.9.5) + version: 3.3.8(typescript@5.4.4) packages/histoire-controls: dependencies: @@ -599,8 +575,8 @@ importers: specifier: ^3.3.5 version: 3.3.5 typescript: - specifier: ^4.9.5 - version: 4.9.5 + specifier: ^5.4.4 + version: 5.4.4 vite: specifier: ^5.0.11 version: 5.0.11(@types/node@18.11.9) @@ -609,10 +585,10 @@ importers: version: 0.34.6(jsdom@22.1.0) vue: specifier: ^3.3.8 - version: 3.3.8(typescript@4.9.5) + version: 3.3.8(typescript@5.4.4) vue-tsc: - specifier: ^1.8.22 - version: 1.8.22(typescript@4.9.5) + specifier: ^2.0.11 + version: 2.0.11(typescript@5.4.4) packages/histoire-controls-stories: dependencies: @@ -621,7 +597,7 @@ importers: version: link:../histoire-controls vue: specifier: ^3.3.8 - version: 3.3.8(typescript@4.9.5) + version: 3.3.8(typescript@5.4.4) devDependencies: '@histoire/plugin-vue': specifier: workspace:* @@ -652,7 +628,7 @@ importers: version: 1.9.0 nuxt: specifier: ^3.0.0-rc.11 - version: 3.8.2(@types/node@18.11.9)(eslint@8.54.0)(typescript@4.9.5)(vite@5.0.11) + version: 3.8.2(@types/node@18.11.9)(eslint@9.0.0)(typescript@5.4.4)(vite@5.0.11) ofetch: specifier: ^1.3.3 version: 1.3.3 @@ -670,8 +646,8 @@ importers: specifier: workspace:* version: link:../histoire typescript: - specifier: ^4.9.5 - version: 4.9.5 + specifier: ^5.4.4 + version: 5.4.4 vite: specifier: ^5.0.11 version: 5.0.11(@types/node@18.11.9) @@ -701,8 +677,8 @@ importers: specifier: workspace:* version: link:../histoire typescript: - specifier: ^4.9.5 - version: 4.9.5 + specifier: ^5.4.4 + version: 5.4.4 packages/histoire-plugin-screenshot: dependencies: @@ -726,8 +702,8 @@ importers: specifier: workspace:* version: link:../histoire typescript: - specifier: ^4.9.5 - version: 4.9.5 + specifier: ^5.4.4 + version: 5.4.4 packages/histoire-plugin-svelte: dependencies: @@ -754,8 +730,8 @@ importers: version: 1.1.1 devDependencies: '@sveltejs/vite-plugin-svelte': - specifier: ^1.4.0 - version: 1.4.0(svelte@4.2.7)(vite@5.0.11) + specifier: ^3.0.2 + version: 3.0.2(svelte@4.2.12)(vite@5.0.11) '@types/node': specifier: ^18.11.9 version: 18.11.9 @@ -769,14 +745,14 @@ importers: specifier: workspace:* version: link:../histoire svelte: - specifier: ^4.2.7 - version: 4.2.7 + specifier: ^4.2.12 + version: 4.2.12 svelte-preprocess: - specifier: ^4.10.7 - version: 4.10.7(postcss@8.4.31)(svelte@4.2.7)(typescript@4.9.5) + specifier: ^5.1.3 + version: 5.1.3(postcss@8.4.31)(svelte@4.2.12)(typescript@5.4.4) typescript: - specifier: ^4.9.5 - version: 4.9.5 + specifier: ^5.4.4 + version: 5.4.4 vite: specifier: ^5.0.11 version: 5.0.11(@types/node@18.11.9) @@ -815,14 +791,14 @@ importers: specifier: workspace:* version: link:../histoire typescript: - specifier: ^4.9.5 - version: 4.9.5 + specifier: ^5.4.4 + version: 5.4.4 vite: specifier: ^5.0.11 version: 5.0.11(@types/node@18.11.9) vue: specifier: ^3.3.8 - version: 3.3.8(typescript@4.9.5) + version: 3.3.8(typescript@5.4.4) packages/histoire-plugin-vue2: dependencies: @@ -852,8 +828,8 @@ importers: specifier: workspace:* version: link:../histoire typescript: - specifier: ^4.9.5 - version: 4.9.5 + specifier: ^5.4.4 + version: 5.4.4 vite: specifier: ^5.0.11 version: 5.0.11(@types/node@18.11.9) @@ -883,8 +859,8 @@ importers: version: 1.0.0 devDependencies: typescript: - specifier: ^4.9.5 - version: 4.9.5 + specifier: ^5.4.4 + version: 5.4.4 vite: specifier: ^5.0.11 version: 5.0.11(@types/node@18.11.9) @@ -920,22 +896,22 @@ importers: version: 13.2.2 pinia: specifier: ^2.1.7 - version: 2.1.7(typescript@4.9.5)(vue@3.3.8) + version: 2.1.7(typescript@5.4.4)(vue@3.3.8) rollup: specifier: ^4.8.0 version: 4.8.0 rollup-plugin-typescript2: specifier: ^0.34.1 - version: 0.34.1(rollup@4.8.0)(typescript@4.9.5) + version: 0.34.1(rollup@4.8.0)(typescript@5.4.4) scroll-into-view-if-needed: specifier: ^2.2.31 version: 2.2.31 typescript: - specifier: ^4.9.5 - version: 4.9.5 + specifier: ^5.4.4 + version: 5.4.4 vue: specifier: ^3.3.8 - version: 3.3.8(typescript@4.9.5) + version: 3.3.8(typescript@5.4.4) vue-router: specifier: ^4.2.5 version: 4.2.5(vue@3.3.8) @@ -1106,6 +1082,99 @@ packages: '@jridgewell/gen-mapping': 0.3.3 '@jridgewell/trace-mapping': 0.3.20 + /@antfu/eslint-config@2.13.0(@vue/compiler-sfc@3.3.11)(eslint@9.0.0)(typescript@5.4.4): + resolution: {integrity: sha512-yI3X5ispR8jWnUz9gtPoEF5Wug/a+7rF/bQ34nVWnAB86LZUhOOR8jbR+ihD+OGkU/BTcfzVEKCK78SgqoS5xA==} + hasBin: true + peerDependencies: + '@unocss/eslint-plugin': '>=0.50.0' + astro-eslint-parser: ^0.16.3 + eslint: '*' + eslint-plugin-astro: ^0.31.4 + eslint-plugin-format: '>=0.1.0' + eslint-plugin-react: ^7.33.2 + eslint-plugin-react-hooks: ^4.6.0 + eslint-plugin-react-refresh: ^0.4.4 + eslint-plugin-solid: ^0.13.2 + eslint-plugin-svelte: '>=2.35.1' + prettier-plugin-astro: ^0.13.0 + prettier-plugin-slidev: ^1.0.5 + svelte-eslint-parser: ^0.33.1 + peerDependenciesMeta: + '@unocss/eslint-plugin': + optional: true + astro-eslint-parser: + optional: true + eslint: + optional: true + eslint-plugin-astro: + optional: true + eslint-plugin-format: + optional: true + eslint-plugin-react: + optional: true + eslint-plugin-react-hooks: + optional: true + eslint-plugin-react-refresh: + optional: true + eslint-plugin-solid: + optional: true + eslint-plugin-svelte: + optional: true + prettier-plugin-astro: + optional: true + prettier-plugin-slidev: + optional: true + svelte-eslint-parser: + optional: true + dependencies: + '@antfu/install-pkg': 0.3.2 + '@clack/prompts': 0.7.0 + '@stylistic/eslint-plugin': 1.7.0(eslint@9.0.0)(typescript@5.4.4) + '@typescript-eslint/eslint-plugin': 7.5.0(@typescript-eslint/parser@7.5.0)(eslint@9.0.0)(typescript@5.4.4) + '@typescript-eslint/parser': 7.5.0(eslint@9.0.0)(typescript@5.4.4) + eslint: 9.0.0 + eslint-config-flat-gitignore: 0.1.5 + eslint-flat-config-utils: 0.2.1 + eslint-merge-processors: 0.1.0(eslint@9.0.0) + eslint-plugin-antfu: 2.1.2(eslint@9.0.0) + eslint-plugin-eslint-comments: 3.2.0(eslint@9.0.0) + eslint-plugin-import-x: 0.5.0(eslint@9.0.0)(typescript@5.4.4) + eslint-plugin-jsdoc: 48.2.3(eslint@9.0.0) + eslint-plugin-jsonc: 2.15.0(eslint@9.0.0) + eslint-plugin-markdown: 4.0.1(eslint@9.0.0) + eslint-plugin-n: 17.0.0(eslint@9.0.0) + eslint-plugin-no-only-tests: 3.1.0 + eslint-plugin-perfectionist: 2.8.0(eslint@9.0.0)(typescript@5.4.4)(vue-eslint-parser@9.4.2) + eslint-plugin-toml: 0.11.0(eslint@9.0.0) + eslint-plugin-unicorn: 52.0.0(eslint@9.0.0) + eslint-plugin-unused-imports: 3.1.0(@typescript-eslint/eslint-plugin@7.5.0)(eslint@9.0.0) + eslint-plugin-vitest: 0.4.1(@typescript-eslint/eslint-plugin@7.5.0)(eslint@9.0.0)(typescript@5.4.4) + eslint-plugin-vue: 9.24.1(eslint@9.0.0) + eslint-plugin-yml: 1.14.0(eslint@9.0.0) + eslint-processor-vue-blocks: 0.1.1(@vue/compiler-sfc@3.3.11)(eslint@9.0.0) + globals: 15.0.0 + jsonc-eslint-parser: 2.4.0 + local-pkg: 0.5.0 + parse-gitignore: 2.0.0 + picocolors: 1.0.0 + toml-eslint-parser: 0.9.3 + vue-eslint-parser: 9.4.2(eslint@9.0.0) + yaml-eslint-parser: 1.2.2 + yargs: 17.7.2 + transitivePeerDependencies: + - '@vue/compiler-sfc' + - supports-color + - svelte + - typescript + - vitest + dev: true + + /@antfu/install-pkg@0.3.2: + resolution: {integrity: sha512-FFYqME8+UHlPnRlX/vn+8cTD4Wo/nG/lzRxpABs3XANBmdJdNImVz3QvjNAE/W3PSCNbG387FOz8o5WelnWOlg==} + dependencies: + execa: 8.0.1 + dev: true + /@antfu/utils@0.7.6: resolution: {integrity: sha512-pvFiLP2BeOKA/ZOS6jxx4XhKzdVLHDhGlFEaZ2flWWYf2xOqVniqpk38I04DFRyz+L0ASggl7SkItTc+ZLju4w==} @@ -1309,6 +1378,14 @@ packages: dependencies: '@babel/types': 7.23.6 + /@babel/parser@7.24.4: + resolution: {integrity: sha512-zTvEBcghmeBma9QIGunWevvBAp4/Qu9Bdq+2k0Ot4fVMD6v3dsC9WOcRSKk7tRRyBM/53yKMJko9xOatGQAwSg==} + engines: {node: '>=6.0.0'} + hasBin: true + dependencies: + '@babel/types': 7.23.6 + dev: true + /@babel/plugin-proposal-decorators@7.23.3(@babel/core@7.23.3): resolution: {integrity: sha512-u8SwzOcP0DYSsa++nHd/9exlHb0NAlHCb890qtZZbSwPX2bFv8LBEztxwN7Xg/dS8oAFFidhrI9PBcLBJSkGRQ==} engines: {node: '>=6.9.0'} @@ -1422,6 +1499,23 @@ packages: '@babel/helper-validator-identifier': 7.22.20 to-fast-properties: 2.0.0 + /@clack/core@0.3.4: + resolution: {integrity: sha512-H4hxZDXgHtWTwV3RAVenqcC4VbJZNegbBjlPvzOzCouXtS2y3sDvlO3IsbrPNWuLWPPlYVYPghQdSF64683Ldw==} + dependencies: + picocolors: 1.0.0 + sisteransi: 1.0.5 + dev: true + + /@clack/prompts@0.7.0: + resolution: {integrity: sha512-0MhX9/B4iL6Re04jPrttDm+BsP8y6mS7byuv0BvXgdXhbV5PdlsHt55dvNsuBCPZ7xq1oTAOOuotR9NFbQyMSA==} + dependencies: + '@clack/core': 0.3.4 + picocolors: 1.0.0 + sisteransi: 1.0.5 + dev: true + bundledDependencies: + - is-unicode-supported + /@cliqz/adblocker-content@1.26.12: resolution: {integrity: sha512-4LWW3kntWuTDo10u24uuk0GmTzegkw9cZ8eDBzzDvHOtRVRMUv4fuoaWCwnB6UpA1VH7iU5nCbRlXNvjnnUA2Q==} dependencies: @@ -1634,6 +1728,15 @@ packages: - '@algolia/client-search' dev: true + /@es-joy/jsdoccomment@0.42.0: + resolution: {integrity: sha512-R1w57YlVA6+YE01wch3GPYn6bCsrOV3YW/5oGGE2tmX6JcL9Nr+b5IikrjMPF+v9CV3ay+obImEdsDhovhJrzw==} + engines: {node: '>=16'} + dependencies: + comment-parser: 1.4.1 + esquery: 1.5.0 + jsdoc-type-pratt-parser: 4.0.0 + dev: true + /@esbuild/android-arm64@0.18.20: resolution: {integrity: sha512-Nz4rJcchGDtENV0eMKUNa6L12zz2zBDXuhj/Vjh18zGqB44Bi7MBMSXjgunJgjRhCmKOjnPuZp4Mb6OKqtMHLQ==} engines: {node: '>=12'} @@ -2180,7 +2283,7 @@ packages: requiresBuild: true optional: true - /@eslint-community/eslint-utils@4.4.0(eslint@8.54.0): + /@eslint-community/eslint-utils@4.4.0(eslint@9.0.0): resolution: {integrity: sha512-1/sA4dwrzBAyeUoQ6oxahHKmrZvsnLCg4RfxW3ZFGGmQkSNQPFNLV9CUEFQP1x9EYXHTo5p6xdhZM1Ne9p/AfA==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} peerDependencies: @@ -2189,15 +2292,15 @@ packages: eslint: optional: true dependencies: - eslint: 8.54.0 + eslint: 9.0.0 eslint-visitor-keys: 3.4.3 /@eslint-community/regexpp@4.10.0: resolution: {integrity: sha512-Cu96Sd2By9mCNTx2iyKOmq10v22jUVQv0lQnlGNy16oE9589yE+QADPbrMGCkA51cKZSg3Pu/aTJVTGfL/qjUA==} engines: {node: ^12.0.0 || ^14.0.0 || >=16.0.0} - /@eslint/eslintrc@2.1.3: - resolution: {integrity: sha512-yZzuIG+jnVu6hNSzFEN07e8BxF3uAzYtQb6uDkaYZLo6oYZDCq454c5kB8zxnzfCYyP4MIuyBn10L0DqwujTmA==} + /@eslint/eslintrc@2.1.4: + resolution: {integrity: sha512-269Z39MS6wVJtsoUl10L60WdkhJVdPG24Q4eZTH3nnF6lpvSShEK3wQjDX9JRWAUPvPh7COouPpU9IrqaZFvtQ==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} dependencies: ajv: 6.12.6 @@ -2211,10 +2314,27 @@ packages: strip-json-comments: 3.1.1 transitivePeerDependencies: - supports-color + dev: true - /@eslint/js@8.54.0: - resolution: {integrity: sha512-ut5V+D+fOoWPgGGNj83GGjnntO39xDy6DWxO0wb7Jp3DcMX0TfIqdzHF85VTQkerdyGmuuMD9AKAo5KiNlf/AQ==} - engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} + /@eslint/eslintrc@3.0.2: + resolution: {integrity: sha512-wV19ZEGEMAC1eHgrS7UQPqsdEiCIbTKTasEfcXAigzoXICcqZSjBZEHlZwNVvKg6UBCjSlos84XiLqsRJnIcIg==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} + dependencies: + ajv: 6.12.6 + debug: 4.3.4(supports-color@8.1.1) + espree: 10.0.1 + globals: 14.0.0 + ignore: 5.3.0 + import-fresh: 3.3.0 + js-yaml: 4.1.0 + minimatch: 3.1.2 + strip-json-comments: 3.1.1 + transitivePeerDependencies: + - supports-color + + /@eslint/js@9.0.0: + resolution: {integrity: sha512-RThY/MnKrhubF6+s1JflwUjPEsnCEmYCWwqa/aRISKWNXGZ9epUwft4bUMM35SdKF9xvBrLydAM1RDHd1Z//ZQ==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} /@fastify/busboy@2.1.0: resolution: {integrity: sha512-+KpH+QxZU7O4675t3mnkQKcZZg56u+K/Ct2K+N2AZYNVK8kyeo/bI18tI8aPm3tvNNRyTWfj6s5tnGNlcbQRsA==} @@ -2244,11 +2364,11 @@ packages: '@hapi/hoek': 9.3.0 dev: true - /@humanwhocodes/config-array@0.11.13: - resolution: {integrity: sha512-JSBDMiDKSzQVngfRjOdFXgFfklaXI4K9nLF49Auh21lmBWRLIK3+xTErTWD4KU54pb6coM6ESE7Awz/FNU3zgQ==} + /@humanwhocodes/config-array@0.12.3: + resolution: {integrity: sha512-jsNnTBlMWuTpDkeE3on7+dWJi0D6fdDfeANj/w7MpS8ztROCoLvIO2nG0CcFj+E4k8j4QrSTh4Oryi3i2G669g==} engines: {node: '>=10.10.0'} dependencies: - '@humanwhocodes/object-schema': 2.0.1 + '@humanwhocodes/object-schema': 2.0.3 debug: 4.3.4(supports-color@8.1.1) minimatch: 3.1.2 transitivePeerDependencies: @@ -2258,8 +2378,8 @@ packages: resolution: {integrity: sha512-bxveV4V8v5Yb4ncFTT3rPSgZBOpCkjfK0y4oVVVJwIuDVBRMDXrPyXRL988i5ap9m9bnyEEjWfm5WkBmtffLfA==} engines: {node: '>=12.22'} - /@humanwhocodes/object-schema@2.0.1: - resolution: {integrity: sha512-dvuCeX5fC9dXgJn9t+X5atfmgQAzUOWqS1254Gh0m6i8wKd10ebXkfNKiRK+1GWi/yTvvLDHpoxLr0xxxeslWw==} + /@humanwhocodes/object-schema@2.0.3: + resolution: {integrity: sha512-93zYdMES/c1D69yZiKDBj0V24vqNzB/koF26KPaagAfd3P/4gUlh3Dys5ogAK+Exi9QyzlD8x/08Zt7wIKcDcA==} /@iconify/vue@3.2.1(vue@3.3.8): resolution: {integrity: sha512-c4R6ZgFo1JrJ8aPMMgOPgfU7lBswihMGR+yWe/P4ZukC3kTkeT4+lkt9Pc/itVFMkwva/S/7u9YofmYv57fnNQ==} @@ -2269,7 +2389,7 @@ packages: vue: optional: true dependencies: - vue: 3.3.8(typescript@4.9.5) + vue: 3.3.8(typescript@5.4.4) dev: true /@ioredis/commands@1.2.0: @@ -2502,7 +2622,7 @@ packages: '@nuxt/kit': 3.8.2 '@nuxt/schema': 3.8.2 execa: 7.2.0 - nuxt: 3.8.2(eslint@8.54.0)(typescript@4.9.5)(vite@4.5.1) + nuxt: 3.8.2(eslint@9.0.0)(typescript@5.4.4)(vite@4.5.1) vite: 4.5.1(@types/node@18.11.9) transitivePeerDependencies: - rollup @@ -2518,7 +2638,7 @@ packages: '@nuxt/kit': 3.8.2 '@nuxt/schema': 3.8.2 execa: 7.2.0 - nuxt: 3.8.2(@types/node@18.11.9)(eslint@8.54.0)(typescript@4.9.5)(vite@5.0.11) + nuxt: 3.8.2(@types/node@18.11.9)(eslint@9.0.0)(typescript@5.4.4)(vite@5.0.11) vite: 5.0.11(@types/node@18.11.9) transitivePeerDependencies: - rollup @@ -2567,7 +2687,7 @@ packages: local-pkg: 0.5.0 magicast: 0.3.2 nitropack: 2.8.0 - nuxt: 3.8.2(eslint@8.54.0)(typescript@4.9.5)(vite@4.5.1) + nuxt: 3.8.2(eslint@9.0.0)(typescript@5.4.4)(vite@4.5.1) nypm: 0.3.3 ofetch: 1.3.3 ohash: 1.1.3 @@ -2635,7 +2755,7 @@ packages: local-pkg: 0.5.0 magicast: 0.3.2 nitropack: 2.8.0 - nuxt: 3.8.2(@types/node@18.11.9)(eslint@8.54.0)(typescript@4.9.5)(vite@5.0.11) + nuxt: 3.8.2(@types/node@18.11.9)(eslint@9.0.0)(typescript@5.4.4)(vite@5.0.11) nypm: 0.3.3 ofetch: 1.3.3 ohash: 1.1.3 @@ -2764,7 +2884,7 @@ packages: /@nuxt/ui-templates@1.3.1: resolution: {integrity: sha512-5gc02Pu1HycOVUWJ8aYsWeeXcSTPe8iX8+KIrhyEtEoOSkY0eMBuo0ssljB8wALuEmepv31DlYe5gpiRwkjESA==} - /@nuxt/vite-builder@3.8.2(@types/node@18.11.9)(eslint@8.54.0)(typescript@4.9.5)(vue@3.3.11): + /@nuxt/vite-builder@3.8.2(@types/node@18.11.9)(eslint@9.0.0)(typescript@5.4.4)(vue@3.3.11): resolution: {integrity: sha512-l/lzDDTbd3M89BpmWqjhVLgLVRqfkKp0tyYgV5seJQjj3SX+IeqI7k6k8+dMEifdeO34jUajVWptNpITXQryyg==} engines: {node: ^14.18.0 || >=16.10.0} peerDependencies: @@ -2804,8 +2924,8 @@ packages: unplugin: 1.5.1 vite: 4.5.1(@types/node@18.11.9) vite-node: 0.33.0(@types/node@18.11.9) - vite-plugin-checker: 0.6.2(eslint@8.54.0)(typescript@4.9.5)(vite@4.5.1) - vue: 3.3.11(typescript@4.9.5) + vite-plugin-checker: 0.6.2(eslint@9.0.0)(typescript@5.4.4)(vite@4.5.1) + vue: 3.3.11(typescript@5.4.4) vue-bundle-renderer: 2.0.0 transitivePeerDependencies: - '@types/node' @@ -2827,7 +2947,7 @@ packages: - vue-tsc dev: false - /@nuxt/vite-builder@3.8.2(eslint@8.54.0)(typescript@4.9.5)(vue@3.3.8): + /@nuxt/vite-builder@3.8.2(eslint@9.0.0)(typescript@5.4.4)(vue@3.3.8): resolution: {integrity: sha512-l/lzDDTbd3M89BpmWqjhVLgLVRqfkKp0tyYgV5seJQjj3SX+IeqI7k6k8+dMEifdeO34jUajVWptNpITXQryyg==} engines: {node: ^14.18.0 || >=16.10.0} peerDependencies: @@ -2867,8 +2987,8 @@ packages: unplugin: 1.5.1 vite: 4.5.1(@types/node@18.11.9) vite-node: 0.33.0(@types/node@18.11.9) - vite-plugin-checker: 0.6.2(eslint@8.54.0)(typescript@4.9.5)(vite@4.5.1) - vue: 3.3.8(typescript@4.9.5) + vite-plugin-checker: 0.6.2(eslint@9.0.0)(typescript@5.4.4)(vite@4.5.1) + vue: 3.3.8(typescript@5.4.4) vue-bundle-renderer: 2.0.0 transitivePeerDependencies: - '@types/node' @@ -3388,6 +3508,93 @@ packages: resolution: {integrity: sha512-rUV5WyJrJLoloD4NDN1V1+LDMDWOa4OTsT4yYJwQNpTU6FWxkxHpL7eu4w+DmiH8x/EAM1otkPE1+LaspIbplw==} engines: {node: '>=18'} + /@stylistic/eslint-plugin-js@1.7.0(eslint@9.0.0): + resolution: {integrity: sha512-PN6On/+or63FGnhhMKSQfYcWutRlzOiYlVdLM6yN7lquoBTqUJHYnl4TA4MHwiAt46X5gRxDr1+xPZ1lOLcL+Q==} + engines: {node: ^16.0.0 || >=18.0.0} + peerDependencies: + eslint: '*' + peerDependenciesMeta: + eslint: + optional: true + dependencies: + '@types/eslint': 8.56.7 + acorn: 8.11.3 + escape-string-regexp: 4.0.0 + eslint: 9.0.0 + eslint-visitor-keys: 3.4.3 + espree: 9.6.1 + dev: true + + /@stylistic/eslint-plugin-jsx@1.7.0(eslint@9.0.0): + resolution: {integrity: sha512-BACdBwXakQvjYIST5N2WWhRbvhRsIxa/F59BiZol+0IH4FSmDXhie7v/yaxDIIA9CbfElzOmIA5nWNYTVXcnwQ==} + engines: {node: ^16.0.0 || >=18.0.0} + peerDependencies: + eslint: '*' + peerDependenciesMeta: + eslint: + optional: true + dependencies: + '@stylistic/eslint-plugin-js': 1.7.0(eslint@9.0.0) + '@types/eslint': 8.56.7 + eslint: 9.0.0 + estraverse: 5.3.0 + picomatch: 4.0.2 + dev: true + + /@stylistic/eslint-plugin-plus@1.7.0(eslint@9.0.0)(typescript@5.4.4): + resolution: {integrity: sha512-AabDw8sXsc70Ydx3qnbeTlRHZnIwY6UKEenBPURPhY3bfYWX+/pDpZH40HkOu94v8D0DUrocPkeeEUxl4e0JDg==} + peerDependencies: + eslint: '*' + peerDependenciesMeta: + eslint: + optional: true + dependencies: + '@types/eslint': 8.56.7 + '@typescript-eslint/utils': 6.21.0(eslint@9.0.0)(typescript@5.4.4) + eslint: 9.0.0 + transitivePeerDependencies: + - supports-color + - typescript + dev: true + + /@stylistic/eslint-plugin-ts@1.7.0(eslint@9.0.0)(typescript@5.4.4): + resolution: {integrity: sha512-QsHv98mmW1xaucVYQTyLDgEpybPJ/6jPPxVBrIchntWWwj74xCWKUiw79hu+TpYj/Pbhd9rkqJYLNq3pQGYuyA==} + engines: {node: ^16.0.0 || >=18.0.0} + peerDependencies: + eslint: '*' + peerDependenciesMeta: + eslint: + optional: true + dependencies: + '@stylistic/eslint-plugin-js': 1.7.0(eslint@9.0.0) + '@types/eslint': 8.56.7 + '@typescript-eslint/utils': 6.21.0(eslint@9.0.0)(typescript@5.4.4) + eslint: 9.0.0 + transitivePeerDependencies: + - supports-color + - typescript + dev: true + + /@stylistic/eslint-plugin@1.7.0(eslint@9.0.0)(typescript@5.4.4): + resolution: {integrity: sha512-ThMUjGIi/jeWYNvOdjZkoLw1EOVs0tEuKXDgWvTn8uWaEz55HuPlajKxjKLpv19C+qRDbKczJfzUODfCdME53A==} + engines: {node: ^16.0.0 || >=18.0.0} + peerDependencies: + eslint: '*' + peerDependenciesMeta: + eslint: + optional: true + dependencies: + '@stylistic/eslint-plugin-js': 1.7.0(eslint@9.0.0) + '@stylistic/eslint-plugin-jsx': 1.7.0(eslint@9.0.0) + '@stylistic/eslint-plugin-plus': 1.7.0(eslint@9.0.0)(typescript@5.4.4) + '@stylistic/eslint-plugin-ts': 1.7.0(eslint@9.0.0)(typescript@5.4.4) + '@types/eslint': 8.56.7 + eslint: 9.0.0 + transitivePeerDependencies: + - supports-color + - typescript + dev: true + /@sveltejs/adapter-auto@1.0.3(@sveltejs/kit@1.27.6): resolution: {integrity: sha512-hc7O12YQqvZ1CD4fo1gMJuPzBZvuoG5kwxb2RRoz4fVoB8B2vuPO2cY751Ln0G6T/HMrAf8kCqw6Pg+wbxcstw==} peerDependencies: @@ -3457,21 +3664,18 @@ packages: - supports-color dev: true - /@sveltejs/vite-plugin-svelte@1.4.0(svelte@4.2.7)(vite@5.0.11): - resolution: {integrity: sha512-6QupI/jemMfK+yI2pMtJcu5iO2gtgTfcBdGwMZZt+lgbFELhszbDl6Qjh000HgAV8+XUA+8EY8DusOFk8WhOIg==} - engines: {node: ^14.18.0 || >= 16} + /@sveltejs/vite-plugin-svelte-inspector@2.0.0(@sveltejs/vite-plugin-svelte@3.0.2)(svelte@4.2.12)(vite@5.0.11): + resolution: {integrity: sha512-gjr9ZFg1BSlIpfZ4PRewigrvYmHWbDrq2uvvPB1AmTWKuM+dI1JXQSUu2pIrYLb/QncyiIGkFDFKTwJ0XqQZZg==} + engines: {node: ^18.0.0 || >=20} peerDependencies: - svelte: ^3.44.0 - vite: ^3.0.0 || ^2.9.0 || ^4.0.0 + '@sveltejs/vite-plugin-svelte': ^3.0.0 + svelte: ^4.0.0 || ^5.0.0-next.0 + vite: ^5.0.0 || ^2.9.0 || ^3.0.0 || ^4.0.0 dependencies: + '@sveltejs/vite-plugin-svelte': 3.0.2(svelte@4.2.12)(vite@5.0.11) debug: 4.3.4(supports-color@8.1.1) - deepmerge: 4.3.1 - kleur: 4.1.5 - magic-string: 0.26.7 - svelte: 4.2.7 - svelte-hmr: 0.15.3(svelte@4.2.7) + svelte: 4.2.12 vite: 5.0.11(@types/node@18.11.9) - vitefu: 0.2.5(vite@5.0.11) transitivePeerDependencies: - supports-color dev: true @@ -3516,6 +3720,26 @@ packages: - supports-color dev: true + /@sveltejs/vite-plugin-svelte@3.0.2(svelte@4.2.12)(vite@5.0.11): + resolution: {integrity: sha512-MpmF/cju2HqUls50WyTHQBZUV3ovV/Uk8k66AN2gwHogNAG8wnW8xtZDhzNBsFJJuvmq1qnzA5kE7YfMJNFv2Q==} + engines: {node: ^18.0.0 || >=20} + peerDependencies: + svelte: ^4.0.0 || ^5.0.0-next.0 + vite: ^5.0.0 || ^2.9.0 || ^3.0.0 || ^4.0.0 + dependencies: + '@sveltejs/vite-plugin-svelte-inspector': 2.0.0(@sveltejs/vite-plugin-svelte@3.0.2)(svelte@4.2.12)(vite@5.0.11) + debug: 4.3.4(supports-color@8.1.1) + deepmerge: 4.3.1 + kleur: 4.1.5 + magic-string: 0.30.5 + svelte: 4.2.12 + svelte-hmr: 0.15.3(svelte@4.2.12) + vite: 5.0.11(@types/node@18.11.9) + vitefu: 0.2.5(vite@5.0.11) + transitivePeerDependencies: + - supports-color + dev: true + /@tailwindcss/typography@0.5.10(tailwindcss@3.3.5): resolution: {integrity: sha512-Pe8BuPJQJd3FfRnm6H0ulKIGoMEQS+Vq01R6M5aCrFB/ccR/shT+0kXLjouGC1gFLm9hopTFN+DMP0pfwRWzPw==} peerDependencies: @@ -3572,6 +3796,13 @@ packages: resolution: {integrity: sha512-7z/eR6O859gyWIAjuvBWFzNURmf2oPBmJlfVWkwehU5nzIyjwBsTh7WMmEEV4JFnHuQ3ex4oyTvfKzcyJVDBNA==} dev: true + /@types/eslint@8.56.7: + resolution: {integrity: sha512-SjDvI/x3zsZnOkYZ3lCt9lOZWZLB2jIlNKz+LBgCtDurK0JZcwucxYHn1w2BJkD34dgX9Tjnak0txtq4WTggEA==} + dependencies: + '@types/estree': 1.0.5 + '@types/json-schema': 7.0.15 + dev: true + /@types/estree@1.0.5: resolution: {integrity: sha512-/kYRxGDLWzHOB7q+wtSUQlFrtcdUccpfy+X+9iMBpHK8QLLhx2wIPYuS5DYtR9Wa/YlZAbIovy7qVdB1Aq6Lyw==} @@ -3611,10 +3842,6 @@ packages: resolution: {integrity: sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==} dev: true - /@types/json5@0.0.29: - resolution: {integrity: sha512-dRLjCWHYg4oaA77cxO64oO+7JwCwnIzkZPdrrC71jQmQtlhM556pwKo5bUzqvZndkVbeFLIIi+9TC40JNF5hNQ==} - dev: true - /@types/linkify-it@3.0.5: resolution: {integrity: sha512-yg6E+u0/+Zjva+buc3EIb+29XEg4wltq7cSmd4Uc2EE/1nUVmxyzpX6gUXD0V8jIrG0r7YeOGVIbYRkxeooCtw==} dev: false @@ -3626,6 +3853,12 @@ packages: '@types/mdurl': 1.0.5 dev: false + /@types/mdast@3.0.15: + resolution: {integrity: sha512-LnwD+mUEfxWMa1QpDraczIn6k0Ee3SMicuYSSzS6ZYl2gKS09EClnJYGd8Du6rfc5r/GZEk5o1mRb8TaTj03sQ==} + dependencies: + '@types/unist': 2.0.10 + dev: true + /@types/mdurl@1.0.5: resolution: {integrity: sha512-6L6VymKTzYSrEf4Nev4Xa1LCHKrlTlYCBMTlQKFuddo1CvQcE52I0mwfOJayueUC7MJuXOeHTcIU683lzd0cUA==} dev: false @@ -3649,6 +3882,10 @@ packages: dependencies: undici-types: 5.26.5 + /@types/normalize-package-data@2.4.4: + resolution: {integrity: sha512-37i+OaWTh9qeK4LSHPsyRC7NahnGotNuZvjLSgcPzblpHB3rrCJxAOgI5gCdKm7coonsaX1Of0ILiTcnZjbfxA==} + dev: true + /@types/parse-json@4.0.2: resolution: {integrity: sha512-dISoDXWWQwUquiKsyZ4Ng+HX2KsPL7LyHKHQwgGFEA3IaKac4Obd+h2a/a6waisAoepJlBcx9paWqjA8/HVjCw==} dev: true @@ -3679,6 +3916,10 @@ packages: resolution: {integrity: sha512-sU5MNKvSFdbT97qLSabU6jxceY9BfYQe9uF+b8E1rdTecpq9ROkkKoiHlblUlhgfaz9bdCByWjAI40Y3mHf1iQ==} dev: true + /@types/unist@2.0.10: + resolution: {integrity: sha512-IfYcSBWE3hLpBg8+X2SEa8LVkJdJEkT2Ese2aaLs3ptGdVtABxndrMaxuFlQ1qdFf9Q5rDvDpxI3WwgvKFAsQA==} + dev: true + /@types/web-bluetooth@0.0.16: resolution: {integrity: sha512-oh8q2Zc32S6gd/j50GowEjKLoOVOwHP/bWVjKJInBwQqdOYMdPrf1oVlelTlyfFK3CKxL1uahMDAr+vy8T7yMQ==} dev: true @@ -3690,11 +3931,11 @@ packages: '@types/node': 18.18.11 optional: true - /@typescript-eslint/eslint-plugin@5.62.0(@typescript-eslint/parser@5.62.0)(eslint@8.54.0)(typescript@4.9.5): - resolution: {integrity: sha512-TiZzBSJja/LbhNPvk6yc0JrX9XqhQ0hdh6M2svYfsHGejaKFIAGd9MQ+ERIMzLGlN/kZoYIgdxFV0PuljTKXag==} - engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} + /@typescript-eslint/eslint-plugin@7.5.0(@typescript-eslint/parser@7.5.0)(eslint@9.0.0)(typescript@5.4.4): + resolution: {integrity: sha512-HpqNTH8Du34nLxbKgVMGljZMG0rJd2O9ecvr2QLYp+7512ty1j42KnsFwspPXg1Vh8an9YImf6CokUBltisZFQ==} + engines: {node: ^18.18.0 || >=20.0.0} peerDependencies: - '@typescript-eslint/parser': ^5.0.0 + '@typescript-eslint/parser': ^7.0.0 eslint: '*' typescript: '*' peerDependenciesMeta: @@ -3704,25 +3945,26 @@ packages: optional: true dependencies: '@eslint-community/regexpp': 4.10.0 - '@typescript-eslint/parser': 5.62.0(eslint@8.54.0)(typescript@4.9.5) - '@typescript-eslint/scope-manager': 5.62.0 - '@typescript-eslint/type-utils': 5.62.0(eslint@8.54.0)(typescript@4.9.5) - '@typescript-eslint/utils': 5.62.0(eslint@8.54.0)(typescript@4.9.5) + '@typescript-eslint/parser': 7.5.0(eslint@9.0.0)(typescript@5.4.4) + '@typescript-eslint/scope-manager': 7.5.0 + '@typescript-eslint/type-utils': 7.5.0(eslint@9.0.0)(typescript@5.4.4) + '@typescript-eslint/utils': 7.5.0(eslint@9.0.0)(typescript@5.4.4) + '@typescript-eslint/visitor-keys': 7.5.0 debug: 4.3.4(supports-color@8.1.1) - eslint: 8.54.0 + eslint: 9.0.0 graphemer: 1.4.0 ignore: 5.3.0 - natural-compare-lite: 1.4.0 + natural-compare: 1.4.0 semver: 7.5.4 - tsutils: 3.21.0(typescript@4.9.5) - typescript: 4.9.5 + ts-api-utils: 1.3.0(typescript@5.4.4) + typescript: 5.4.4 transitivePeerDependencies: - supports-color dev: true - /@typescript-eslint/parser@5.62.0(eslint@8.54.0)(typescript@4.9.5): - resolution: {integrity: sha512-VlJEV0fOQ7BExOsHYAGrgbEiZoi8D+Bl2+f6V2RrXerRSylnp+ZBHmPvaIa8cz0Ajx7WO7Z5RqfgYg7ED1nRhA==} - engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} + /@typescript-eslint/parser@7.5.0(eslint@9.0.0)(typescript@5.4.4): + resolution: {integrity: sha512-cj+XGhNujfD2/wzR1tabNsidnYRaFfEkcULdcIyVBYcXjBvBKOes+mpMBP7hMpOyk+gBcfXsrg4NBGAStQyxjQ==} + engines: {node: ^18.18.0 || >=20.0.0} peerDependencies: eslint: '*' typescript: '*' @@ -3732,27 +3974,36 @@ packages: typescript: optional: true dependencies: - '@typescript-eslint/scope-manager': 5.62.0 - '@typescript-eslint/types': 5.62.0 - '@typescript-eslint/typescript-estree': 5.62.0(typescript@4.9.5) + '@typescript-eslint/scope-manager': 7.5.0 + '@typescript-eslint/types': 7.5.0 + '@typescript-eslint/typescript-estree': 7.5.0(typescript@5.4.4) + '@typescript-eslint/visitor-keys': 7.5.0 debug: 4.3.4(supports-color@8.1.1) - eslint: 8.54.0 - typescript: 4.9.5 + eslint: 9.0.0 + typescript: 5.4.4 transitivePeerDependencies: - supports-color dev: true - /@typescript-eslint/scope-manager@5.62.0: - resolution: {integrity: sha512-VXuvVvZeQCQb5Zgf4HAxc04q5j+WrNAtNh9OwCsCgpKqESMTu3tF/jhZ3xG6T4NZwWl65Bg8KuS2uEvhSfLl0w==} - engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} + /@typescript-eslint/scope-manager@6.21.0: + resolution: {integrity: sha512-OwLUIWZJry80O99zvqXVEioyniJMa+d2GrqpUTqi5/v5D5rOrppJVBPa0yKCblcigC0/aYAzxxqQ1B+DS2RYsg==} + engines: {node: ^16.0.0 || >=18.0.0} dependencies: - '@typescript-eslint/types': 5.62.0 - '@typescript-eslint/visitor-keys': 5.62.0 + '@typescript-eslint/types': 6.21.0 + '@typescript-eslint/visitor-keys': 6.21.0 dev: true - /@typescript-eslint/type-utils@5.62.0(eslint@8.54.0)(typescript@4.9.5): - resolution: {integrity: sha512-xsSQreu+VnfbqQpW5vnCJdq1Z3Q0U31qiWmRhr98ONQmcp/yhiPJFPq8MXiJVLiksmOKSjIldZzkebzHuCGzew==} - engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} + /@typescript-eslint/scope-manager@7.5.0: + resolution: {integrity: sha512-Z1r7uJY0MDeUlql9XJ6kRVgk/sP11sr3HKXn268HZyqL7i4cEfrdFuSSY/0tUqT37l5zT0tJOsuDP16kio85iA==} + engines: {node: ^18.18.0 || >=20.0.0} + dependencies: + '@typescript-eslint/types': 7.5.0 + '@typescript-eslint/visitor-keys': 7.5.0 + dev: true + + /@typescript-eslint/type-utils@7.5.0(eslint@9.0.0)(typescript@5.4.4): + resolution: {integrity: sha512-A021Rj33+G8mx2Dqh0nMO9GyjjIBK3MqgVgZ2qlKf6CJy51wY/lkkFqq3TqqnH34XyAHUkq27IjlUkWlQRpLHw==} + engines: {node: ^18.18.0 || >=20.0.0} peerDependencies: eslint: '*' typescript: '*' @@ -3762,75 +4013,129 @@ packages: typescript: optional: true dependencies: - '@typescript-eslint/typescript-estree': 5.62.0(typescript@4.9.5) - '@typescript-eslint/utils': 5.62.0(eslint@8.54.0)(typescript@4.9.5) + '@typescript-eslint/typescript-estree': 7.5.0(typescript@5.4.4) + '@typescript-eslint/utils': 7.5.0(eslint@9.0.0)(typescript@5.4.4) debug: 4.3.4(supports-color@8.1.1) - eslint: 8.54.0 - tsutils: 3.21.0(typescript@4.9.5) - typescript: 4.9.5 + eslint: 9.0.0 + ts-api-utils: 1.3.0(typescript@5.4.4) + typescript: 5.4.4 transitivePeerDependencies: - supports-color dev: true - /@typescript-eslint/types@5.62.0: - resolution: {integrity: sha512-87NVngcbVXUahrRTqIK27gD2t5Cu1yuCXxbLcFtCzZGlfyVWWh8mLHkoxzjsB6DDNnvdL+fW8MiwPEJyGJQDgQ==} - engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} + /@typescript-eslint/types@6.21.0: + resolution: {integrity: sha512-1kFmZ1rOm5epu9NZEZm1kckCDGj5UJEf7P1kliH4LKu/RkwpsfqqGmY2OOcUs18lSlQBKLDYBOGxRVtrMN5lpg==} + engines: {node: ^16.0.0 || >=18.0.0} dev: true - /@typescript-eslint/typescript-estree@5.62.0(typescript@4.9.5): - resolution: {integrity: sha512-CmcQ6uY7b9y694lKdRB8FEel7JbU/40iSAPomu++SjLMntB+2Leay2LO6i8VnJk58MtE9/nQSFIH6jpyRWyYzA==} - engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} + /@typescript-eslint/types@7.5.0: + resolution: {integrity: sha512-tv5B4IHeAdhR7uS4+bf8Ov3k793VEVHd45viRRkehIUZxm0WF82VPiLgHzA/Xl4TGPg1ZD49vfxBKFPecD5/mg==} + engines: {node: ^18.18.0 || >=20.0.0} + dev: true + + /@typescript-eslint/typescript-estree@6.21.0(typescript@5.4.4): + resolution: {integrity: sha512-6npJTkZcO+y2/kr+z0hc4HwNfrrP4kNYh57ek7yCNlrBjWQ1Y0OS7jiZTkgumrvkX5HkEKXFZkkdFNkaW2wmUQ==} + engines: {node: ^16.0.0 || >=18.0.0} peerDependencies: typescript: '*' peerDependenciesMeta: typescript: optional: true dependencies: - '@typescript-eslint/types': 5.62.0 - '@typescript-eslint/visitor-keys': 5.62.0 + '@typescript-eslint/types': 6.21.0 + '@typescript-eslint/visitor-keys': 6.21.0 debug: 4.3.4(supports-color@8.1.1) globby: 11.1.0 is-glob: 4.0.3 + minimatch: 9.0.3 semver: 7.5.4 - tsutils: 3.21.0(typescript@4.9.5) - typescript: 4.9.5 + ts-api-utils: 1.3.0(typescript@5.4.4) + typescript: 5.4.4 transitivePeerDependencies: - supports-color dev: true - /@typescript-eslint/utils@5.62.0(eslint@8.54.0)(typescript@4.9.5): - resolution: {integrity: sha512-n8oxjeb5aIbPFEtmQxQYOLI0i9n5ySBEY/ZEHHZqKQSFnxio1rv6dthascc9dLuwrL0RC5mPCxB7vnAVGAYWAQ==} - engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} + /@typescript-eslint/typescript-estree@7.5.0(typescript@5.4.4): + resolution: {integrity: sha512-YklQQfe0Rv2PZEueLTUffiQGKQneiIEKKnfIqPIOxgM9lKSZFCjT5Ad4VqRKj/U4+kQE3fa8YQpskViL7WjdPQ==} + engines: {node: ^18.18.0 || >=20.0.0} + peerDependencies: + typescript: '*' + peerDependenciesMeta: + typescript: + optional: true + dependencies: + '@typescript-eslint/types': 7.5.0 + '@typescript-eslint/visitor-keys': 7.5.0 + debug: 4.3.4(supports-color@8.1.1) + globby: 11.1.0 + is-glob: 4.0.3 + minimatch: 9.0.3 + semver: 7.5.4 + ts-api-utils: 1.3.0(typescript@5.4.4) + typescript: 5.4.4 + transitivePeerDependencies: + - supports-color + dev: true + + /@typescript-eslint/utils@6.21.0(eslint@9.0.0)(typescript@5.4.4): + resolution: {integrity: sha512-NfWVaC8HP9T8cbKQxHcsJBY5YE1O33+jpMwN45qzWWaPDZgLIbo12toGMWnmhvCpd3sIxkpDw3Wv1B3dYrbDQQ==} + engines: {node: ^16.0.0 || >=18.0.0} peerDependencies: eslint: '*' peerDependenciesMeta: eslint: optional: true dependencies: - '@eslint-community/eslint-utils': 4.4.0(eslint@8.54.0) + '@eslint-community/eslint-utils': 4.4.0(eslint@9.0.0) '@types/json-schema': 7.0.15 '@types/semver': 7.5.6 - '@typescript-eslint/scope-manager': 5.62.0 - '@typescript-eslint/types': 5.62.0 - '@typescript-eslint/typescript-estree': 5.62.0(typescript@4.9.5) - eslint: 8.54.0 - eslint-scope: 5.1.1 + '@typescript-eslint/scope-manager': 6.21.0 + '@typescript-eslint/types': 6.21.0 + '@typescript-eslint/typescript-estree': 6.21.0(typescript@5.4.4) + eslint: 9.0.0 semver: 7.5.4 transitivePeerDependencies: - supports-color - typescript dev: true - /@typescript-eslint/visitor-keys@5.62.0: - resolution: {integrity: sha512-07ny+LHRzQXepkGg6w0mFY41fVUNBrL2Roj/++7V1txKugfjm/Ci/qSND03r2RhlJhJYMcTn9AhhSSqQp0Ysyw==} - engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} + /@typescript-eslint/utils@7.5.0(eslint@9.0.0)(typescript@5.4.4): + resolution: {integrity: sha512-3vZl9u0R+/FLQcpy2EHyRGNqAS/ofJ3Ji8aebilfJe+fobK8+LbIFmrHciLVDxjDoONmufDcnVSF38KwMEOjzw==} + engines: {node: ^18.18.0 || >=20.0.0} + peerDependencies: + eslint: '*' + peerDependenciesMeta: + eslint: + optional: true + dependencies: + '@eslint-community/eslint-utils': 4.4.0(eslint@9.0.0) + '@types/json-schema': 7.0.15 + '@types/semver': 7.5.6 + '@typescript-eslint/scope-manager': 7.5.0 + '@typescript-eslint/types': 7.5.0 + '@typescript-eslint/typescript-estree': 7.5.0(typescript@5.4.4) + eslint: 9.0.0 + semver: 7.5.4 + transitivePeerDependencies: + - supports-color + - typescript + dev: true + + /@typescript-eslint/visitor-keys@6.21.0: + resolution: {integrity: sha512-JJtkDduxLi9bivAB+cYOVMtbkqdPOhZ+ZI5LC47MIRrDV4Yn2o+ZnW10Nkmr28xRpSpdJ6Sm42Hjf2+REYXm0A==} + engines: {node: ^16.0.0 || >=18.0.0} dependencies: - '@typescript-eslint/types': 5.62.0 + '@typescript-eslint/types': 6.21.0 eslint-visitor-keys: 3.4.3 dev: true - /@ungap/structured-clone@1.2.0: - resolution: {integrity: sha512-zuVdFrMJiuCDQUMCzQaD6KL28MjnqqN8XnAqiEq9PNm/hCPTSGfrXCOfwj1ow4LFb/tNymJPwsNbVePc1xFqrQ==} + /@typescript-eslint/visitor-keys@7.5.0: + resolution: {integrity: sha512-mcuHM/QircmA6O7fy6nn2w/3ditQkj+SgtOc8DW3uQ10Yfj42amm2i+6F2K4YAOPNNTmE6iM1ynM6lrSwdendA==} + engines: {node: ^18.18.0 || >=20.0.0} + dependencies: + '@typescript-eslint/types': 7.5.0 + eslint-visitor-keys: 3.4.3 + dev: true /@unhead/dom@1.8.5: resolution: {integrity: sha512-CLgOw5mF9Moo29z2SwNrJcdX75pPEJxoNpxbrlf3BctwpZJV19MMyxp9HaG9yAYLNTrYIsHjma/dZ2I0184StA==} @@ -3867,7 +4172,7 @@ packages: '@unhead/shared': 1.8.5 hookable: 5.5.3 unhead: 1.8.5 - vue: 3.3.11(typescript@4.9.5) + vue: 3.3.11(typescript@5.4.4) dev: false /@unhead/vue@1.8.5(vue@3.3.8): @@ -3882,7 +4187,7 @@ packages: '@unhead/shared': 1.8.5 hookable: 5.5.3 unhead: 1.8.5 - vue: 3.3.8(typescript@4.9.5) + vue: 3.3.8(typescript@5.4.4) dev: true /@vercel/nft@0.24.3: @@ -3919,7 +4224,7 @@ packages: '@babel/plugin-transform-typescript': 7.23.4(@babel/core@7.23.3) '@vue/babel-plugin-jsx': 1.1.5(@babel/core@7.23.3) vite: 4.5.1(@types/node@18.11.9) - vue: 3.3.11(typescript@4.9.5) + vue: 3.3.11(typescript@5.4.4) transitivePeerDependencies: - supports-color dev: false @@ -3938,7 +4243,7 @@ packages: '@babel/plugin-transform-typescript': 7.23.4(@babel/core@7.23.3) '@vue/babel-plugin-jsx': 1.1.5(@babel/core@7.23.3) vite: 4.5.1(@types/node@18.11.9) - vue: 3.3.8(typescript@4.9.5) + vue: 3.3.8(typescript@5.4.4) transitivePeerDependencies: - supports-color dev: true @@ -3968,7 +4273,7 @@ packages: optional: true dependencies: vite: 3.2.7 - vue: 3.3.11(typescript@4.9.5) + vue: 3.3.11(typescript@5.4.4) dev: true /@vitejs/plugin-vue@4.5.0(vite@5.0.11)(vue@3.3.8): @@ -3982,7 +4287,7 @@ packages: optional: true dependencies: vite: 5.0.11(sass@1.69.5) - vue: 3.3.8(typescript@4.9.5) + vue: 3.3.8(typescript@5.4.4) dev: true /@vitejs/plugin-vue@4.5.2(vite@4.5.1)(vue@3.3.11): @@ -3996,7 +4301,7 @@ packages: optional: true dependencies: vite: 4.5.1(@types/node@18.11.9) - vue: 3.3.11(typescript@4.9.5) + vue: 3.3.11(typescript@5.4.4) dev: false /@vitejs/plugin-vue@4.5.2(vite@4.5.1)(vue@3.3.8): @@ -4010,7 +4315,7 @@ packages: optional: true dependencies: vite: 4.5.1(@types/node@18.11.9) - vue: 3.3.8(typescript@4.9.5) + vue: 3.3.8(typescript@5.4.4) dev: true /@vitejs/plugin-vue@4.5.2(vite@5.0.11)(vue@3.3.11): @@ -4024,7 +4329,7 @@ packages: optional: true dependencies: vite: 5.0.11(@types/node@18.11.9) - vue: 3.3.11(typescript@4.9.5) + vue: 3.3.11(typescript@5.4.4) dev: true /@vitest/expect@0.34.6: @@ -4065,22 +4370,22 @@ packages: pretty-format: 29.7.0 dev: true - /@volar/language-core@1.10.10: - resolution: {integrity: sha512-nsV1o3AZ5n5jaEAObrS3MWLBWaGwUj/vAsc15FVNIv+DbpizQRISg9wzygsHBr56ELRH8r4K75vkYNMtsSNNWw==} + /@volar/language-core@2.2.0-alpha.6: + resolution: {integrity: sha512-GmT28LX2w4x82uuQqNN/P94VOCsZRHBbGcGe+5bFtA2hbIbH6f8tFdMfgXFtyhbft/pj6f3xl37xe+t+nomLIA==} dependencies: - '@volar/source-map': 1.10.10 + '@volar/source-map': 2.2.0-alpha.6 dev: true - /@volar/source-map@1.10.10: - resolution: {integrity: sha512-GVKjLnifV4voJ9F0vhP56p4+F3WGf+gXlRtjFZsv6v3WxBTWU3ZVeaRaEHJmWrcv5LXmoYYpk/SC25BKemPRkg==} + /@volar/source-map@2.2.0-alpha.6: + resolution: {integrity: sha512-EztD2zoUopETY+ZCUZAGUHKgj4gOkY/2WnaOS+RSTc56xm85miSA4qOBS8Lt1Ruu5vV52WIZKHW/R9PbjkZWFA==} dependencies: - muggle-string: 0.3.1 + muggle-string: 0.4.1 dev: true - /@volar/typescript@1.10.10: - resolution: {integrity: sha512-4a2r5bdUub2m+mYVnLu2wt59fuoYWe7nf0uXtGHU8QQ5LDNfzAR0wK7NgDiQ9rcl2WT3fxT2AA9AylAwFtj50A==} + /@volar/typescript@2.2.0-alpha.6: + resolution: {integrity: sha512-wTr0jO3wVXQ9FjBbWE2iX8GgDoiHp1Nttsb+tKk5IeUUb6f1uOjyeIXuS4KfeMBpCufthRO2st2O2uatAs/UXQ==} dependencies: - '@volar/language-core': 1.10.10 + '@volar/language-core': 2.2.0-alpha.6 path-browserify: 1.0.1 dev: true @@ -4099,7 +4404,7 @@ packages: ast-kit: 0.11.2 local-pkg: 0.5.0 magic-string-ast: 0.3.0 - vue: 3.3.11(typescript@4.9.5) + vue: 3.3.11(typescript@5.4.4) transitivePeerDependencies: - rollup dev: false @@ -4119,7 +4424,7 @@ packages: ast-kit: 0.11.2 local-pkg: 0.5.0 magic-string-ast: 0.3.0 - vue: 3.3.8(typescript@4.9.5) + vue: 3.3.8(typescript@5.4.4) transitivePeerDependencies: - rollup dev: true @@ -4161,6 +4466,16 @@ packages: estree-walker: 2.0.2 source-map-js: 1.0.2 + /@vue/compiler-core@3.4.21: + resolution: {integrity: sha512-MjXawxZf2SbZszLPYxaFCjxfibYrzr3eYbKxwpLR9EQN+oaziSu3qKVbwBERj1IFIB8OLUewxB5m/BFzi613og==} + dependencies: + '@babel/parser': 7.24.4 + '@vue/shared': 3.4.21 + entities: 4.5.0 + estree-walker: 2.0.2 + source-map-js: 1.0.2 + dev: true + /@vue/compiler-dom@3.3.11: resolution: {integrity: sha512-zoAiUIqSKqAJ81WhfPXYmFGwDRuO+loqLxvXmfUdR5fOitPoUiIeFI9cTTyv9MU5O1+ZZglJVTusWzy+wfk5hw==} dependencies: @@ -4173,6 +4488,13 @@ packages: '@vue/compiler-core': 3.3.8 '@vue/shared': 3.3.8 + /@vue/compiler-dom@3.4.21: + resolution: {integrity: sha512-IZC6FKowtT1sl0CR5DpXSiEB5ayw75oT2bma1BEhV7RRR1+cfwLrxc2Z8Zq/RGFzJ8w5r9QtCOvTjQgdn0IKmA==} + dependencies: + '@vue/compiler-core': 3.4.21 + '@vue/shared': 3.4.21 + dev: true + /@vue/compiler-sfc@2.7.15: resolution: {integrity: sha512-FCvIEevPmgCgqFBH7wD+3B97y7u7oj/Wr69zADBf403Tui377bThTjBvekaZvlRr4IwUAu3M6hYZeULZFJbdYg==} dependencies: @@ -4223,73 +4545,21 @@ packages: /@vue/devtools-api@6.5.1: resolution: {integrity: sha512-+KpckaAQyfbvshdDW5xQylLni1asvNSGme1JFs8I1+/H5pHEhqUKMEQD/qn3Nx5+/nycBq11qAEi8lk+LXI2dA==} - /@vue/eslint-config-standard@6.1.0(eslint-plugin-import@2.29.0)(eslint-plugin-node@11.1.0)(eslint-plugin-promise@6.1.1)(eslint-plugin-vue@9.18.1)(eslint@8.54.0): - resolution: {integrity: sha512-9+hrEyflDzsGdlBDl9jPV5DIYUx1TOU5OSQqRDKCrNumrxRj5HRWKuk+ocXWnha6uoNRtLC24mY7d/MwqvBCNw==} - peerDependencies: - '@vue/cli-service': ^3.0.0 || ^4.0.0 || ^5.0.0-0 - eslint: '*' - eslint-plugin-import: ^2.22.1 - eslint-plugin-node: ^11.1.0 - eslint-plugin-promise: '*' - eslint-plugin-vue: '*' - peerDependenciesMeta: - '@vue/cli-service': - optional: true - eslint: - optional: true - dependencies: - eslint: 8.54.0 - eslint-config-standard: 16.0.3(eslint-plugin-import@2.29.0)(eslint-plugin-node@11.1.0)(eslint-plugin-promise@6.1.1)(eslint@8.54.0) - eslint-import-resolver-node: 0.3.9 - eslint-import-resolver-webpack: 0.13.8(eslint-plugin-import@2.29.0) - eslint-plugin-import: 2.29.0(@typescript-eslint/parser@5.62.0)(eslint@8.54.0) - eslint-plugin-node: 11.1.0(eslint@8.54.0) - eslint-plugin-promise: 6.1.1(eslint@8.54.0) - eslint-plugin-vue: 9.18.1(eslint@8.54.0) - transitivePeerDependencies: - - supports-color - - webpack - dev: true - - /@vue/eslint-config-typescript@10.0.0(eslint-plugin-vue@9.18.1)(eslint@8.54.0)(typescript@4.9.5): - resolution: {integrity: sha512-F94cL8ug3FaYXlCfU5/wiGjk1qeadmoBpRGAOBq+qre3Smdupa59dd6ZJrsfRODpsMPyTG7330juMDsUvpZ3Rw==} - engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} - peerDependencies: - eslint: '*' - eslint-plugin-vue: '*' - typescript: '*' - peerDependenciesMeta: - eslint: - optional: true - typescript: - optional: true - dependencies: - '@typescript-eslint/eslint-plugin': 5.62.0(@typescript-eslint/parser@5.62.0)(eslint@8.54.0)(typescript@4.9.5) - '@typescript-eslint/parser': 5.62.0(eslint@8.54.0)(typescript@4.9.5) - eslint: 8.54.0 - eslint-plugin-vue: 9.18.1(eslint@8.54.0) - typescript: 4.9.5 - vue-eslint-parser: 8.3.0(eslint@8.54.0) - transitivePeerDependencies: - - supports-color - dev: true - - /@vue/language-core@1.8.22(typescript@4.9.5): - resolution: {integrity: sha512-bsMoJzCrXZqGsxawtUea1cLjUT9dZnDsy5TuZ+l1fxRMzUGQUG9+Ypq4w//CqpWmrx7nIAJpw2JVF/t258miRw==} + /@vue/language-core@2.0.11(typescript@5.4.4): + resolution: {integrity: sha512-5ivg8Vem/yckzXI3L3n0mdKBPRcHSlsGt6/dpbEx42PcH3MIHAjSAJBYvENXeWJxv2ClQc8BS2mH1Ho2U7jZig==} peerDependencies: typescript: '*' peerDependenciesMeta: typescript: optional: true dependencies: - '@volar/language-core': 1.10.10 - '@volar/source-map': 1.10.10 - '@vue/compiler-dom': 3.3.11 - '@vue/shared': 3.3.11 + '@volar/language-core': 2.2.0-alpha.6 + '@vue/compiler-dom': 3.4.21 + '@vue/shared': 3.4.21 computeds: 0.0.1 minimatch: 9.0.3 - muggle-string: 0.3.1 - typescript: 4.9.5 + path-browserify: 1.0.1 + typescript: 5.4.4 vue-template-compiler: 2.7.15 dev: true @@ -4357,7 +4627,7 @@ packages: dependencies: '@vue/compiler-ssr': 3.3.11 '@vue/shared': 3.3.11 - vue: 3.3.11(typescript@4.9.5) + vue: 3.3.11(typescript@5.4.4) /@vue/server-renderer@3.3.8(vue@3.3.8): resolution: {integrity: sha512-zVCUw7RFskvPuNlPn/8xISbrf0zTWsTSdYTsUTN1ERGGZGVnRxM2QZ3x1OR32+vwkkCm0IW6HmJ49IsPm7ilLg==} @@ -4369,7 +4639,7 @@ packages: dependencies: '@vue/compiler-ssr': 3.3.8 '@vue/shared': 3.3.8 - vue: 3.3.8(typescript@4.9.5) + vue: 3.3.8(typescript@5.4.4) /@vue/shared@3.3.11: resolution: {integrity: sha512-u2G8ZQ9IhMWTMXaWqZycnK4UthG1fA238CD+DP4Dm4WJi5hdUKKLg0RMRaRpDPNMdkTwIDkp7WtD0Rd9BH9fLw==} @@ -4377,6 +4647,10 @@ packages: /@vue/shared@3.3.8: resolution: {integrity: sha512-8PGwybFwM4x8pcfgqEQFy70NaQxASvOC5DJwLQfpArw1UDfUXrJkdxD3BhVTMS+0Lef/TU7YO0Jvr0jJY8T+mw==} + /@vue/shared@3.4.21: + resolution: {integrity: sha512-PuJe7vDIi6VYSinuEbUIQgMIRZGgM8e4R+G+/dQTk0X1NEdvgvvgv7m+rfmDH1gZzyA1OjjoWskvHlfRNfQf3g==} + dev: true + /@vue/test-utils@2.4.2(vue@3.3.8): resolution: {integrity: sha512-07lLjpG1o9tEBoWQfVOFhDT7+WFCdDeECoeSdzOuVgIi6nxb2JDLGNNOV6+3crPpyg/jMlIocj96UROcgomiGg==} peerDependencies: @@ -4389,7 +4663,7 @@ packages: optional: true dependencies: js-beautify: 1.14.11 - vue: 3.3.8(typescript@4.9.5) + vue: 3.3.8(typescript@5.4.4) vue-component-type-helpers: 1.8.22 dev: true @@ -4404,8 +4678,8 @@ packages: dependencies: find-cache-dir: 3.3.2 upath: 2.0.1 - vue: 3.3.11(typescript@4.9.5) - vuetify: 3.4.6(typescript@4.9.5)(vite-plugin-vuetify@1.0.2)(vue@3.3.11) + vue: 3.3.11(typescript@5.4.4) + vuetify: 3.4.6(typescript@5.4.4)(vite-plugin-vuetify@1.0.2)(vue@3.3.11) /@vueuse/core@9.13.0(vue@3.3.11): resolution: {integrity: sha512-pujnclbeHWxxPRqXWmdkKV5OX4Wk4YeK7wusHqRwU0Q7EFusHoqNA/aPhB6KCh9hEqJkLAJo7bb0Lh9b+OIVzw==} @@ -4483,6 +4757,14 @@ packages: acorn: ^6.0.0 || ^7.0.0 || ^8.0.0 dependencies: acorn: 8.11.2 + dev: true + + /acorn-jsx@5.3.2(acorn@8.11.3): + resolution: {integrity: sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==} + peerDependencies: + acorn: ^6.0.0 || ^7.0.0 || ^8.0.0 + dependencies: + acorn: 8.11.3 /acorn-walk@8.3.0: resolution: {integrity: sha512-FS7hV565M5l1R08MXqo8odwMTB02C2UqzB17RVgu9EyuYFBqJZ3/ZY97sQD5FewVu1UyDFc1yztUDrAwT0EypA==} @@ -4493,6 +4775,11 @@ packages: engines: {node: '>=0.4.0'} hasBin: true + /acorn@8.11.3: + resolution: {integrity: sha512-Y9rRfJG5jcKOE0CLisYbojUjIrIEE7AGMzA/Sm4BslANhbS+cDMpgBdcPT91oJ7OuJ9hYJBx59RjbhxVnrF8Xg==} + engines: {node: '>=0.4.0'} + hasBin: true + /agent-base@6.0.2: resolution: {integrity: sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ==} engines: {node: '>= 6.0.0'} @@ -4630,6 +4917,11 @@ packages: tar-stream: 3.1.6 zip-stream: 5.0.1 + /are-docs-informative@0.0.2: + resolution: {integrity: sha512-ixiS0nLNNG5jNQzgZJNoUpBKdo9yTYZMGJ+QgT2jmjR7G7+QHRCc4v6LQ3NgE7EBJq+o0ams3waJwkrlBom8Ig==} + engines: {node: '>=14'} + dev: true + /are-we-there-yet@2.0.0: resolution: {integrity: sha512-Ci/qENmwHnsYo9xKIcUJN5LeDKdJ6R1Z1j9V/J5wyq8nh/mYPEpIKJbBZXtZjG04HiK7zV/p6Vs9952MrMeUIw==} engines: {node: '>=10'} @@ -4655,82 +4947,11 @@ packages: dependencies: dequal: 2.0.3 - /array-buffer-byte-length@1.0.0: - resolution: {integrity: sha512-LPuwb2P+NrQw3XhxGc36+XSvuBPopovXYTR9Ew++Du9Yb/bx5AzBfrIsBoj0EZUifjQU+sHL21sseZ3jerWO/A==} - dependencies: - call-bind: 1.0.5 - is-array-buffer: 3.0.2 - dev: true - - /array-includes@3.1.7: - resolution: {integrity: sha512-dlcsNBIiWhPkHdOEEKnehA+RNUWDc4UqFtnIXU4uuYDPtA4LDkr7qip2p0VvFAEXNDr0yWZ9PJyIRiGjRLQzwQ==} - engines: {node: '>= 0.4'} - dependencies: - call-bind: 1.0.5 - define-properties: 1.2.1 - es-abstract: 1.22.3 - get-intrinsic: 1.2.2 - is-string: 1.0.7 - dev: true - /array-union@2.1.0: resolution: {integrity: sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw==} engines: {node: '>=8'} dev: true - /array.prototype.find@2.2.2: - resolution: {integrity: sha512-DRumkfW97iZGOfn+lIXbkVrXL04sfYKX+EfOodo8XboR5sxPDVvOjZTF/rysusa9lmhmSOeD6Vp6RKQP+eP4Tg==} - dependencies: - call-bind: 1.0.5 - define-properties: 1.2.1 - es-abstract: 1.22.3 - es-shim-unscopables: 1.0.2 - dev: true - - /array.prototype.findlastindex@1.2.3: - resolution: {integrity: sha512-LzLoiOMAxvy+Gd3BAq3B7VeIgPdo+Q8hthvKtXybMvRV0jrXfJM/t8mw7nNlpEcVlVUnCnM2KSX4XU5HmpodOA==} - engines: {node: '>= 0.4'} - dependencies: - call-bind: 1.0.5 - define-properties: 1.2.1 - es-abstract: 1.22.3 - es-shim-unscopables: 1.0.2 - get-intrinsic: 1.2.2 - dev: true - - /array.prototype.flat@1.3.2: - resolution: {integrity: sha512-djYB+Zx2vLewY8RWlNCUdHjDXs2XOgm602S9E7P/UpHgfeHL00cRiIF+IN/G/aUJ7kGPb6yO/ErDI5V2s8iycA==} - engines: {node: '>= 0.4'} - dependencies: - call-bind: 1.0.5 - define-properties: 1.2.1 - es-abstract: 1.22.3 - es-shim-unscopables: 1.0.2 - dev: true - - /array.prototype.flatmap@1.3.2: - resolution: {integrity: sha512-Ewyx0c9PmpcsByhSW4r+9zDU7sGjFc86qf/kKtuSCRdhfbk0SNLLkaT5qvcHnRGgc5NP/ly/y+qkXkqONX54CQ==} - engines: {node: '>= 0.4'} - dependencies: - call-bind: 1.0.5 - define-properties: 1.2.1 - es-abstract: 1.22.3 - es-shim-unscopables: 1.0.2 - dev: true - - /arraybuffer.prototype.slice@1.0.2: - resolution: {integrity: sha512-yMBKppFur/fbHu9/6USUe03bZ4knMYiwFBcyiaXB8Go0qNehwX6inYPzK9U0NeQvGxKthcmHcaR8P5MStSRBAw==} - engines: {node: '>= 0.4'} - dependencies: - array-buffer-byte-length: 1.0.0 - call-bind: 1.0.5 - define-properties: 1.2.1 - es-abstract: 1.22.3 - get-intrinsic: 1.2.2 - is-array-buffer: 3.0.2 - is-shared-array-buffer: 1.0.2 - dev: true - /asn1@0.2.6: resolution: {integrity: sha512-ix/FxPn0MDjeyJ7i/yoHGFt/EX6LyNbxSEhPPXODPL+KB0VPk86UYfL0lMdy+KCnv+fmvIzySwaK5COwqVbWTQ==} dependencies: @@ -4831,11 +5052,6 @@ packages: postcss: 8.4.32 postcss-value-parser: 4.2.0 - /available-typed-arrays@1.0.5: - resolution: {integrity: sha512-DMD0KiN46eipeziST1LPP/STfDU0sufISXmjSgvVsoU2tqxctQeASejWcfNtxYKqETM1UxQ8sp2OrSBWpHY6sw==} - engines: {node: '>= 0.4'} - dev: true - /aws-sign2@0.7.0: resolution: {integrity: sha512-08kcGqnYf/YmjoRhfxyu+CLxBjUtHLXLXX/vUfx9l2LYzG3c1m61nrpyFUZI6zeS+Li/wWMMidD9KgrqtGq3mA==} dev: true @@ -4858,6 +5074,12 @@ packages: dependencies: dequal: 2.0.3 + /axobject-query@4.0.0: + resolution: {integrity: sha512-+60uv1hiVFhHZeO+Lz0RYzsVHy5Wr1ayX0mwda9KPDVLNJgZ1T9Ny7VmFbLDzxsH0D87I86vgj3gFrjTJUYznw==} + dependencies: + dequal: 2.0.3 + dev: true + /b4a@1.6.4: resolution: {integrity: sha512-fpWrvyVHEKyeEvbKZTVOeZF3VSKKWtJxFIxX/jaVPf+cLbGUSitjb49pHLqPV2BUNNZ0LcoeEGfE/YCpyDYHIw==} @@ -4953,6 +5175,17 @@ packages: node-releases: 2.0.13 update-browserslist-db: 1.0.13(browserslist@4.22.1) + /browserslist@4.23.0: + resolution: {integrity: sha512-QW8HiM1shhT2GuzkvklfjcKDiWFXHOeFCIA/huJPwHsslwcydgk7X+z2zXpEijP98UCY7HbubZt5J2Zgvf0CaQ==} + engines: {node: ^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7} + hasBin: true + dependencies: + caniuse-lite: 1.0.30001607 + electron-to-chromium: 1.4.729 + node-releases: 2.0.14 + update-browserslist-db: 1.0.13(browserslist@4.23.0) + dev: true + /buffer-crc32@0.2.13: resolution: {integrity: sha512-VO9Ht/+p3SN7SKWqcrgEzjGbRSJYTx+Q1pTQC0wrWqHx0vpJraQ6GtHx8tvcg1rlK1byhU5gccxgOgj7B0TDkQ==} @@ -5069,6 +5302,10 @@ packages: /caniuse-lite@1.0.30001563: resolution: {integrity: sha512-na2WUmOxnwIZtwnFI2CZ/3er0wdNzU7hN+cPYz/z2ajHThnkWjNBOpEPP4n+4r2WPM847JaMotaJE3bnfzjyKw==} + /caniuse-lite@1.0.30001607: + resolution: {integrity: sha512-WcvhVRjXLKFB/kmOFVwELtMxyhq3iM/MvmXcyCe2PNf166c39mptscOc/45TTS96n2gpNV2z7+NakArTWZCQ3w==} + dev: true + /capital-case@1.0.4: resolution: {integrity: sha512-ds37W8CytHgwnhGGTi88pcPyR15qoNkOpYwmMMfnWqqWgESapLqvDx6huFjQ5vqWSn2Z06173XNA7LtMOeUh1A==} dependencies: @@ -5144,6 +5381,18 @@ packages: snake-case: 3.0.4 tslib: 2.6.2 + /character-entities-legacy@1.1.4: + resolution: {integrity: sha512-3Xnr+7ZFS1uxeiUDvV02wQ+QDbc55o97tIV5zHScSPJpcLm/r0DFPcoY3tYRp+VZukxuMeKgXYmsXQHO05zQeA==} + dev: true + + /character-entities@1.2.4: + resolution: {integrity: sha512-iBMyeEHxfVnIakwOuDXpVkc54HijNgCyQB2w0VfGQThle6NXn50zU6V/u+LDhxHcDUPojn6Kpga3PTAD8W1bQw==} + dev: true + + /character-reference-invalid@1.1.4: + resolution: {integrity: sha512-mKKUkUbhPpQlCOfIuZkvSEgktjPFIsZKRRbC6KWVEMvlzblj3i3asQv5ODsrwt0N3pHAEvjP8KTQPHkp0+6jOg==} + dev: true + /check-error@1.0.3: resolution: {integrity: sha512-iKEoDYaRmd1mxM90a2OEfWhjsjPpYPuQ+lMYsoxB126+t8fw7ySEO48nmDg5COTjxDI65/Y2OWpeEHk3ZOe8zg==} dependencies: @@ -5181,11 +5430,23 @@ packages: resolution: {integrity: sha512-NIxF55hv4nSqQswkAeiOi1r83xy8JldOFDTWiug55KBu9Jnblncd2U6ViHmYgHf01TPZS77NJBhBMKdWj9HQMQ==} engines: {node: '>=8'} + /ci-info@4.0.0: + resolution: {integrity: sha512-TdHqgGf9odd8SXNuxtUBVx8Nv+qZOejE6qyqiy5NtbYYQOeFa6zmHkxlPzmaLxWWHsU6nJmB7AETdVPi+2NBUg==} + engines: {node: '>=8'} + dev: true + /citty@0.1.5: resolution: {integrity: sha512-AS7n5NSc0OQVMV9v6wt3ByujNIrne0/cTjiC2MYqhvao57VNfiuVksTSr2p17nVOhEr2KtqiAkGwHcgMC/qUuQ==} dependencies: consola: 3.2.3 + /clean-regexp@1.0.0: + resolution: {integrity: sha512-GfisEZEJvzKrmGWkvfhgzcz/BllN1USeqD2V6tg14OAOgaCD2Z/PUEuxnAZ/nPvmaHRG7a8y77p1T/IRQ4D1Hw==} + engines: {node: '>=4'} + dependencies: + escape-string-regexp: 1.0.5 + dev: true + /clean-stack@2.2.0: resolution: {integrity: sha512-4diC9HaTE+KRAMWhDhrGOECgWZxoevMc5TlkObMqNSsVU62PYzXZ/SMTjzyGAFF1YusgxGcSWTEXBhp0CPwQ1A==} engines: {node: '>=6'} @@ -5318,6 +5579,11 @@ packages: resolution: {integrity: sha512-OkTL9umf+He2DZkUq8f8J9of7yL6RJKI24dVITBmNfZBmri9zYZQrKkuXiKhyfPSu8tUhnVBB1iKXevvnlR4Ww==} engines: {node: '>= 12'} + /comment-parser@1.4.1: + resolution: {integrity: sha512-buhp5kePrmda3vhc5B9t7pUQXAb2Tnd0qgpkIhPhkHXxJpiPJ11H0ZEU0oBpJ2QztSbzG/ZxMj/CHsYJqRHmyg==} + engines: {node: '>= 12.0.0'} + dev: true + /common-tags@1.8.2: resolution: {integrity: sha512-gk/Z852D2Wtb//0I+kRFNKKE9dIIVirjoqPoA1wJU+XePVXZfGeBpk45+A1rKO4Q43prqWBNY/MiIeRLbPWUaA==} engines: {node: '>=4.0.0'} @@ -5431,6 +5697,12 @@ packages: keygrip: 1.1.0 dev: true + /core-js-compat@3.36.1: + resolution: {integrity: sha512-Dk997v9ZCt3X/npqzyGdTlq6t7lDBhZwGvV94PKzDArjp7BTRm7WlDAXYd/OWdeFHO8OChQYRJNJvUCqCbrtKA==} + dependencies: + browserslist: 4.23.0 + dev: true + /core-util-is@1.0.2: resolution: {integrity: sha512-3lqz5YjWTYnW6dlDa5TLaTCcShfar1e40rmcJVwCBJC6mWlFuj0eCHIElmG1g5kyuJ/GD+8Wn4FFCcz4gJPfaQ==} dev: true @@ -5830,15 +6102,6 @@ packages: resolution: {integrity: sha512-N+MeXYoqr3pOgn8xfyRPREN7gHakLYjhsHhWGT3fWAiL4IkAt0iDw14QiiEm2bE30c5XX5q0FtAA3CK5f9/BUg==} engines: {node: '>=12'} - /define-properties@1.2.1: - resolution: {integrity: sha512-8QmQKqEASLd5nx0U1B1okLElbUuuttJ/AnYmRXbbbGDWh6uS208EjD4Xqq/I9wK7u0v6O08XhTWnt5XtEbR6Dg==} - engines: {node: '>= 0.4'} - dependencies: - define-data-property: 1.1.1 - has-property-descriptors: 1.0.1 - object-keys: 1.1.1 - dev: true - /defu@3.2.2: resolution: {integrity: sha512-8UWj5lNv7HD+kB0e9w77Z7TdQlbUYDVWqITLHNqFIn6khrNHv5WQo38Dcm1f6HeNyZf0U7UbPf6WeZDSdCzGDQ==} dev: true @@ -5925,18 +6188,12 @@ packages: resolution: {integrity: sha512-+HlytyjlPKnIG8XuRG8WvmBP8xs8P71y+SKKS6ZXWoEgLuePxtDoUEiH7WkdePWrQ5JBpE6aoVqfZfJUQkjXwA==} dev: true - /doctrine@2.1.0: - resolution: {integrity: sha512-35mSku4ZXK0vfCuHEDAwt55dg2jNajHZ1odvF+8SSr82EsZY4QmXfuWso8oEd8zRhVObSN18aM0CjSdoBX7zIw==} - engines: {node: '>=0.10.0'} - dependencies: - esutils: 2.0.3 - dev: true - /doctrine@3.0.0: resolution: {integrity: sha512-yS+Q5i3hBf7GBkd4KG8a7eBNNWNGLTaEwwYWUijIYM7zrlYDM0BFXHjjPWlWZ1Rg7UaddZeIDmi9jF3HmqiQ2w==} engines: {node: '>=6.0.0'} dependencies: esutils: 2.0.3 + dev: true /dom-serializer@2.0.0: resolution: {integrity: sha512-wIkAryiqt/nV5EQKqQpo3SToSOV9J0DnbJqwK7Wv/Trc92zIAYZ4FlMu+JPFW1DfGFt81ZTCGgDEabffXeLyJg==} @@ -6013,6 +6270,10 @@ packages: /electron-to-chromium@1.4.589: resolution: {integrity: sha512-zF6y5v/YfoFIgwf2dDfAqVlPPsyQeWNpEWXbAlDUS8Ax4Z2VoiiZpAPC0Jm9hXEkJm2vIZpwB6rc4KnLTQffbQ==} + /electron-to-chromium@1.4.729: + resolution: {integrity: sha512-bx7+5Saea/qu14kmPTDHQxkp2UnziG3iajUQu3BxFvCOnpAJdDbMV4rSl+EqFDkkpNNVUFlR1kDfpL59xfy1HA==} + dev: true + /emoji-regex@8.0.0: resolution: {integrity: sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==} @@ -6040,15 +6301,6 @@ packages: dependencies: once: 1.4.0 - /enhanced-resolve@0.9.1: - resolution: {integrity: sha512-kxpoMgrdtkXZ5h0SeraBS1iRntpTpQ3R8ussdb38+UAFnMGX5DDyJXePm+OCHOcoXvHDw7mc2erbJBpDnl7TPw==} - engines: {node: '>=0.6'} - dependencies: - graceful-fs: 4.2.11 - memory-fs: 0.2.0 - tapable: 0.1.10 - dev: true - /enhanced-resolve@5.15.0: resolution: {integrity: sha512-LXYT42KJ7lpIKECr2mAXIaMldcNCh/7E0KBKOu4KSfkHmP+mZmSs+8V5gBAqisWBy0OO4W5Oyys0GO1Y8KtdKg==} engines: {node: '>=10.13.0'} @@ -6088,75 +6340,6 @@ packages: /error-stack-parser-es@0.1.1: resolution: {integrity: sha512-g/9rfnvnagiNf+DRMHEVGuGuIBlCIMDFoTA616HaP2l9PlCjGjVhD98PNbVSJvmK4TttqT5mV5tInMhoFgi+aA==} - /es-abstract@1.22.3: - resolution: {integrity: sha512-eiiY8HQeYfYH2Con2berK+To6GrK2RxbPawDkGq4UiCQQfZHb6wX9qQqkbpPqaxQFcl8d9QzZqo0tGE0VcrdwA==} - engines: {node: '>= 0.4'} - dependencies: - array-buffer-byte-length: 1.0.0 - arraybuffer.prototype.slice: 1.0.2 - available-typed-arrays: 1.0.5 - call-bind: 1.0.5 - es-set-tostringtag: 2.0.2 - es-to-primitive: 1.2.1 - function.prototype.name: 1.1.6 - get-intrinsic: 1.2.2 - get-symbol-description: 1.0.0 - globalthis: 1.0.3 - gopd: 1.0.1 - has-property-descriptors: 1.0.1 - has-proto: 1.0.1 - has-symbols: 1.0.3 - hasown: 2.0.0 - internal-slot: 1.0.6 - is-array-buffer: 3.0.2 - is-callable: 1.2.7 - is-negative-zero: 2.0.2 - is-regex: 1.1.4 - is-shared-array-buffer: 1.0.2 - is-string: 1.0.7 - is-typed-array: 1.1.12 - is-weakref: 1.0.2 - object-inspect: 1.13.1 - object-keys: 1.1.1 - object.assign: 4.1.4 - regexp.prototype.flags: 1.5.1 - safe-array-concat: 1.0.1 - safe-regex-test: 1.0.0 - string.prototype.trim: 1.2.8 - string.prototype.trimend: 1.0.7 - string.prototype.trimstart: 1.0.7 - typed-array-buffer: 1.0.0 - typed-array-byte-length: 1.0.0 - typed-array-byte-offset: 1.0.0 - typed-array-length: 1.0.4 - unbox-primitive: 1.0.2 - which-typed-array: 1.1.13 - dev: true - - /es-set-tostringtag@2.0.2: - resolution: {integrity: sha512-BuDyupZt65P9D2D2vA/zqcI3G5xRsklm5N3xCwuiy+/vKy8i0ifdsQP1sLgO4tZDSCaQUSnmC48khknGMV3D2Q==} - engines: {node: '>= 0.4'} - dependencies: - get-intrinsic: 1.2.2 - has-tostringtag: 1.0.0 - hasown: 2.0.0 - dev: true - - /es-shim-unscopables@1.0.2: - resolution: {integrity: sha512-J3yBRXCzDu4ULnQwxyToo/OjdMx6akgVC7K6few0a7F/0wLtmKKN7I73AH5T2836UuXRqN7Qg+IIUw/+YJksRw==} - dependencies: - hasown: 2.0.0 - dev: true - - /es-to-primitive@1.2.1: - resolution: {integrity: sha512-QCOllgZJtaUo9miYBcLChTUaHNjJF3PYs1VidD7AwiEj1kYxKeQTctLAezAOH5ZKRH0g2IgPn6KwB4IT8iRpvA==} - engines: {node: '>= 0.4'} - dependencies: - is-callable: 1.2.7 - is-date-object: 1.0.5 - is-symbol: 1.0.4 - dev: true - /es6-promise@3.3.1: resolution: {integrity: sha512-SOp9Phqvqn7jtEUxPWdWfWoLmyt2VaJ6MpvP9Comy1MceMXqE6bxvaTu4iaxpYYPzhny28Lc+M87/c2cPK6lDg==} dev: true @@ -6488,21 +6671,31 @@ packages: optionalDependencies: source-map: 0.6.1 - /eslint-config-standard@16.0.3(eslint-plugin-import@2.29.0)(eslint-plugin-node@11.1.0)(eslint-plugin-promise@6.1.1)(eslint@8.54.0): - resolution: {integrity: sha512-x4fmJL5hGqNJKGHSjnLdgA6U6h1YW/G2dW9fA+cyVur4SK6lyue8+UgNKWlZtUDTXvgKDD/Oa3GQjmB5kjtVvg==} + /eslint-compat-utils@0.5.0(eslint@9.0.0): + resolution: {integrity: sha512-dc6Y8tzEcSYZMHa+CMPLi/hyo1FzNeonbhJL7Ol0ccuKQkwopJcJBA9YL/xmMTLU1eKigXo9vj9nALElWYSowg==} + engines: {node: '>=12'} peerDependencies: eslint: '*' - eslint-plugin-import: ^2.22.1 - eslint-plugin-node: ^11.1.0 - eslint-plugin-promise: '*' peerDependenciesMeta: eslint: optional: true dependencies: - eslint: 8.54.0 - eslint-plugin-import: 2.29.0(@typescript-eslint/parser@5.62.0)(eslint@8.54.0) - eslint-plugin-node: 11.1.0(eslint@8.54.0) - eslint-plugin-promise: 6.1.1(eslint@8.54.0) + eslint: 9.0.0 + semver: 7.5.4 + dev: true + + /eslint-config-flat-gitignore@0.1.5: + resolution: {integrity: sha512-hEZLwuZjDBGDERA49c2q7vxc8sCGv8EdBp6PQYzGOMcHIgrfG9YOM6s/4jx24zhD+wnK9AI8mgN5RxSss5nClQ==} + dependencies: + find-up: 7.0.0 + parse-gitignore: 2.0.0 + dev: true + + /eslint-flat-config-utils@0.2.1: + resolution: {integrity: sha512-SKnSr4YdPD7xxynNpaad/IlJYfeDmtWvZ0UEmHEA0+eTOcZFPt1075KO87LIWN30jXGCREG2qcCqdAnRoCiAWQ==} + dependencies: + '@types/eslint': 8.56.7 + pathe: 1.1.2 dev: true /eslint-import-resolver-node@0.3.9: @@ -6515,144 +6708,195 @@ packages: - supports-color dev: true - /eslint-import-resolver-webpack@0.13.8(eslint-plugin-import@2.29.0): - resolution: {integrity: sha512-Y7WIaXWV+Q21Rz/PJgUxiW/FTBOWmU8NTLdz+nz9mMoiz5vAev/fOaQxwD7qRzTfE3HSm1qsxZ5uRd7eX+VEtA==} - engines: {node: '>= 6'} + /eslint-merge-processors@0.1.0(eslint@9.0.0): + resolution: {integrity: sha512-IvRXXtEajLeyssvW4wJcZ2etxkR9mUf4zpNwgI+m/Uac9RfXHskuJefkHUcawVzePnd6xp24enp5jfgdHzjRdQ==} peerDependencies: - eslint-plugin-import: '>=1.4.0' - webpack: '>=1.11.0' + eslint: '*' peerDependenciesMeta: - webpack: + eslint: optional: true dependencies: - array.prototype.find: 2.2.2 - debug: 3.2.7(supports-color@5.5.0) - enhanced-resolve: 0.9.1 - eslint-plugin-import: 2.29.0(@typescript-eslint/parser@5.62.0)(eslint@8.54.0) - find-root: 1.1.0 - hasown: 2.0.0 - interpret: 1.4.0 - is-core-module: 2.13.1 - is-regex: 1.1.4 - lodash: 4.17.21 - resolve: 2.0.0-next.5 - semver: 5.7.2 - transitivePeerDependencies: - - supports-color + eslint: 9.0.0 dev: true - /eslint-module-utils@2.8.0(@typescript-eslint/parser@5.62.0)(eslint-import-resolver-node@0.3.9)(eslint@8.54.0): - resolution: {integrity: sha512-aWajIYfsqCKRDgUfjEXNN/JlrzauMuSEy5sbd7WXbtW3EH6A6MpwEh42c7qD+MqQo9QMJ6fWLAeIJynx0g6OAw==} - engines: {node: '>=4'} + /eslint-plugin-antfu@2.1.2(eslint@9.0.0): + resolution: {integrity: sha512-s7ZTOM3uq0iqpp6gF0UEotnvup7f2PHBUftCytLZX0+6C9j9KadKZQh6bVVngAyFgsmeD9+gcBopOYLClb2oDg==} peerDependencies: - '@typescript-eslint/parser': '*' eslint: '*' - eslint-import-resolver-node: '*' - eslint-import-resolver-typescript: '*' - eslint-import-resolver-webpack: '*' peerDependenciesMeta: - '@typescript-eslint/parser': - optional: true eslint: optional: true - eslint-import-resolver-node: + dependencies: + eslint: 9.0.0 + dev: true + + /eslint-plugin-es-x@7.6.0(eslint@9.0.0): + resolution: {integrity: sha512-I0AmeNgevgaTR7y2lrVCJmGYF0rjoznpDvqV/kIkZSZbZ8Rw3eu4cGlvBBULScfkSOCzqKbff5LR4CNrV7mZHA==} + engines: {node: ^14.18.0 || >=16.0.0} + peerDependencies: + eslint: '*' + peerDependenciesMeta: + eslint: optional: true - eslint-import-resolver-typescript: + dependencies: + '@eslint-community/eslint-utils': 4.4.0(eslint@9.0.0) + '@eslint-community/regexpp': 4.10.0 + eslint: 9.0.0 + eslint-compat-utils: 0.5.0(eslint@9.0.0) + dev: true + + /eslint-plugin-eslint-comments@3.2.0(eslint@9.0.0): + resolution: {integrity: sha512-0jkOl0hfojIHHmEHgmNdqv4fmh7300NdpA9FFpF7zaoLvB/QeXOGNLIo86oAveJFrfB1p05kC8hpEMHM8DwWVQ==} + engines: {node: '>=6.5.0'} + peerDependencies: + eslint: '*' + peerDependenciesMeta: + eslint: optional: true - eslint-import-resolver-webpack: + dependencies: + escape-string-regexp: 1.0.5 + eslint: 9.0.0 + ignore: 5.3.0 + dev: true + + /eslint-plugin-import-x@0.5.0(eslint@9.0.0)(typescript@5.4.4): + resolution: {integrity: sha512-C7R8Z4IzxmsoOPMtSzwuOBW5FH6iRlxHR6iTks+MzVlrk3r3TUxokkWTx3ypdj9nGOEP+CG/5e6ebZzHbxgbbQ==} + engines: {node: '>=16'} + peerDependencies: + eslint: '*' + peerDependenciesMeta: + eslint: optional: true dependencies: - '@typescript-eslint/parser': 5.62.0(eslint@8.54.0)(typescript@4.9.5) - debug: 3.2.7(supports-color@5.5.0) - eslint: 8.54.0 + '@typescript-eslint/utils': 7.5.0(eslint@9.0.0)(typescript@5.4.4) + debug: 4.3.4(supports-color@8.1.1) + doctrine: 3.0.0 + eslint: 9.0.0 eslint-import-resolver-node: 0.3.9 + get-tsconfig: 4.7.3 + is-glob: 4.0.3 + minimatch: 9.0.3 + semver: 7.6.0 transitivePeerDependencies: - supports-color + - typescript dev: true - /eslint-plugin-cypress@2.15.1(eslint@8.54.0): - resolution: {integrity: sha512-eLHLWP5Q+I4j2AWepYq0PgFEei9/s5LvjuSqWrxurkg1YZ8ltxdvMNmdSf0drnsNo57CTgYY/NIHHLRSWejR7w==} + /eslint-plugin-jsdoc@48.2.3(eslint@9.0.0): + resolution: {integrity: sha512-r9DMAmFs66VNvNqRLLjHejdnJtILrt3xGi+Qx0op0oRfFGVpOR1Hb3BC++MacseHx93d8SKYPhyrC9BS7Os2QA==} + engines: {node: '>=18'} peerDependencies: eslint: '*' peerDependenciesMeta: eslint: optional: true dependencies: - eslint: 8.54.0 - globals: 13.23.0 + '@es-joy/jsdoccomment': 0.42.0 + are-docs-informative: 0.0.2 + comment-parser: 1.4.1 + debug: 4.3.4(supports-color@8.1.1) + escape-string-regexp: 4.0.0 + eslint: 9.0.0 + esquery: 1.5.0 + is-builtin-module: 3.2.1 + semver: 7.6.0 + spdx-expression-parse: 4.0.0 + transitivePeerDependencies: + - supports-color dev: true - /eslint-plugin-es@3.0.1(eslint@8.54.0): - resolution: {integrity: sha512-GUmAsJaN4Fc7Gbtl8uOBlayo2DqhwWvEzykMHSCZHU3XdJ+NSzzZcVhXh3VxX5icqQ+oQdIEawXX8xkR3mIFmQ==} - engines: {node: '>=8.10.0'} + /eslint-plugin-jsonc@2.15.0(eslint@9.0.0): + resolution: {integrity: sha512-wAphMVgTQPAKAYV8d/QEkEYDg8uer9nMQ85N17IUiJcAWLxJs83/Exe59dEH9yKUpvpLf46H+wR7/U7lZ3/NpQ==} + engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} peerDependencies: eslint: '*' peerDependenciesMeta: eslint: optional: true dependencies: - eslint: 8.54.0 - eslint-utils: 2.1.0 - regexpp: 3.2.0 + '@eslint-community/eslint-utils': 4.4.0(eslint@9.0.0) + eslint: 9.0.0 + eslint-compat-utils: 0.5.0(eslint@9.0.0) + espree: 9.6.1 + graphemer: 1.4.0 + jsonc-eslint-parser: 2.4.0 + natural-compare: 1.4.0 + synckit: 0.6.2 dev: true - /eslint-plugin-import@2.29.0(@typescript-eslint/parser@5.62.0)(eslint@8.54.0): - resolution: {integrity: sha512-QPOO5NO6Odv5lpoTkddtutccQjysJuFxoPS7fAHO+9m9udNHvTCPSAMW9zGAYj8lAIdr40I8yPCdUYrncXtrwg==} - engines: {node: '>=4'} + /eslint-plugin-markdown@4.0.1(eslint@9.0.0): + resolution: {integrity: sha512-5/MnGvYU0i8MbHH5cg8S+Vl3DL+bqRNYshk1xUO86DilNBaxtTkhH+5FD0/yO03AmlI6+lfNFdk2yOw72EPzpA==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} peerDependencies: - '@typescript-eslint/parser': '*' eslint: '*' peerDependenciesMeta: - '@typescript-eslint/parser': - optional: true eslint: optional: true dependencies: - '@typescript-eslint/parser': 5.62.0(eslint@8.54.0)(typescript@4.9.5) - array-includes: 3.1.7 - array.prototype.findlastindex: 1.2.3 - array.prototype.flat: 1.3.2 - array.prototype.flatmap: 1.3.2 - debug: 3.2.7(supports-color@5.5.0) - doctrine: 2.1.0 - eslint: 8.54.0 - eslint-import-resolver-node: 0.3.9 - eslint-module-utils: 2.8.0(@typescript-eslint/parser@5.62.0)(eslint-import-resolver-node@0.3.9)(eslint@8.54.0) - hasown: 2.0.0 - is-core-module: 2.13.1 - is-glob: 4.0.3 - minimatch: 3.1.2 - object.fromentries: 2.0.7 - object.groupby: 1.0.1 - object.values: 1.1.7 - semver: 6.3.1 - tsconfig-paths: 3.14.2 + eslint: 9.0.0 + mdast-util-from-markdown: 0.8.5 transitivePeerDependencies: - - eslint-import-resolver-typescript - - eslint-import-resolver-webpack - supports-color dev: true - /eslint-plugin-node@11.1.0(eslint@8.54.0): - resolution: {integrity: sha512-oUwtPJ1W0SKD0Tr+wqu92c5xuCeQqB3hSCHasn/ZgjFdA9iDGNkNf2Zi9ztY7X+hNuMib23LNGRm6+uN+KLE3g==} - engines: {node: '>=8.10.0'} + /eslint-plugin-n@17.0.0(eslint@9.0.0): + resolution: {integrity: sha512-0Ihff+kWUIiXYTNTotGj/yRI1X5uCh/lef5Hr7ih/mFeYMQ3bPfN0KxlrfhU+Xn4x697l/TPO6zxqE33M1yD0w==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} peerDependencies: eslint: '*' peerDependenciesMeta: eslint: optional: true dependencies: - eslint: 8.54.0 - eslint-plugin-es: 3.0.1(eslint@8.54.0) - eslint-utils: 2.1.0 + '@eslint-community/eslint-utils': 4.4.0(eslint@9.0.0) + enhanced-resolve: 5.15.0 + eslint: 9.0.0 + eslint-plugin-es-x: 7.6.0(eslint@9.0.0) + get-tsconfig: 4.7.3 + globals: 14.0.0 ignore: 5.3.0 - minimatch: 3.1.2 - resolve: 1.22.8 - semver: 6.3.1 + is-builtin-module: 3.2.1 + minimatch: 9.0.3 + semver: 7.5.4 + dev: true + + /eslint-plugin-no-only-tests@3.1.0: + resolution: {integrity: sha512-Lf4YW/bL6Un1R6A76pRZyE1dl1vr31G/ev8UzIc/geCgFWyrKil8hVjYqWVKGB/UIGmb6Slzs9T0wNezdSVegw==} + engines: {node: '>=5.0.0'} + dev: true + + /eslint-plugin-perfectionist@2.8.0(eslint@9.0.0)(typescript@5.4.4)(vue-eslint-parser@9.4.2): + resolution: {integrity: sha512-XBjQ4ctU1rOzQ4bFJoUowe8XdsIIz42JqNrouFlae1TO78HjoyYBaRP8+gAHDDQCSdHY10pbChyzlJeBA6D51w==} + peerDependencies: + astro-eslint-parser: ^0.16.0 + eslint: '*' + svelte: '>=3.0.0' + svelte-eslint-parser: ^0.33.0 + vue-eslint-parser: '>=9.0.0' + peerDependenciesMeta: + astro-eslint-parser: + optional: true + eslint: + optional: true + svelte: + optional: true + svelte-eslint-parser: + optional: true + vue-eslint-parser: + optional: true + dependencies: + '@typescript-eslint/utils': 6.21.0(eslint@9.0.0)(typescript@5.4.4) + eslint: 9.0.0 + minimatch: 9.0.3 + natural-compare-lite: 1.4.0 + vue-eslint-parser: 9.4.2(eslint@9.0.0) + transitivePeerDependencies: + - supports-color + - typescript dev: true - /eslint-plugin-promise@6.1.1(eslint@8.54.0): - resolution: {integrity: sha512-tjqWDwVZQo7UIPMeDReOpUgHCmCiH+ePnVT+5zVapL0uuHnegBUs2smM13CzOs2Xb5+MHMRFTs9v24yjba4Oig==} + /eslint-plugin-toml@0.11.0(eslint@9.0.0): + resolution: {integrity: sha512-sau+YvPU4fWTjB+qtBt3n8WS87aoDCs+BVbSUAemGaIsRNbvR9uEk+Tt892iLHTGvp/DPWYoCX4/8DoyAbB+sQ==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} peerDependencies: eslint: '*' @@ -6660,11 +6904,87 @@ packages: eslint: optional: true dependencies: - eslint: 8.54.0 + debug: 4.3.4(supports-color@8.1.1) + eslint: 9.0.0 + eslint-compat-utils: 0.5.0(eslint@9.0.0) + lodash: 4.17.21 + toml-eslint-parser: 0.9.3 + transitivePeerDependencies: + - supports-color + dev: true + + /eslint-plugin-unicorn@52.0.0(eslint@9.0.0): + resolution: {integrity: sha512-1Yzm7/m+0R4djH0tjDjfVei/ju2w3AzUGjG6q8JnuNIL5xIwsflyCooW5sfBvQp2pMYQFSWWCFONsjCax1EHng==} + engines: {node: '>=16'} + peerDependencies: + eslint: '*' + peerDependenciesMeta: + eslint: + optional: true + dependencies: + '@babel/helper-validator-identifier': 7.22.20 + '@eslint-community/eslint-utils': 4.4.0(eslint@9.0.0) + '@eslint/eslintrc': 2.1.4 + ci-info: 4.0.0 + clean-regexp: 1.0.0 + core-js-compat: 3.36.1 + eslint: 9.0.0 + esquery: 1.5.0 + indent-string: 4.0.0 + is-builtin-module: 3.2.1 + jsesc: 3.0.2 + pluralize: 8.0.0 + read-pkg-up: 7.0.1 + regexp-tree: 0.1.27 + regjsparser: 0.10.0 + semver: 7.5.4 + strip-indent: 3.0.0 + transitivePeerDependencies: + - supports-color + dev: true + + /eslint-plugin-unused-imports@3.1.0(@typescript-eslint/eslint-plugin@7.5.0)(eslint@9.0.0): + resolution: {integrity: sha512-9l1YFCzXKkw1qtAru1RWUtG2EVDZY0a0eChKXcL+EZ5jitG7qxdctu4RnvhOJHv4xfmUf7h+JJPINlVpGhZMrw==} + engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} + peerDependencies: + '@typescript-eslint/eslint-plugin': 6 - 7 + eslint: '*' + peerDependenciesMeta: + '@typescript-eslint/eslint-plugin': + optional: true + eslint: + optional: true + dependencies: + '@typescript-eslint/eslint-plugin': 7.5.0(@typescript-eslint/parser@7.5.0)(eslint@9.0.0)(typescript@5.4.4) + eslint: 9.0.0 + eslint-rule-composer: 0.3.0 + dev: true + + /eslint-plugin-vitest@0.4.1(@typescript-eslint/eslint-plugin@7.5.0)(eslint@9.0.0)(typescript@5.4.4): + resolution: {integrity: sha512-+PnZ2u/BS+f5FiuHXz4zKsHPcMKHie+K+1Uvu/x91ovkCMEOJqEI8E9Tw1Wzx2QRz4MHOBHYf1ypO8N1K0aNAA==} + engines: {node: ^18.0.0 || >= 20.0.0} + peerDependencies: + '@typescript-eslint/eslint-plugin': '*' + eslint: '*' + vitest: '*' + peerDependenciesMeta: + '@typescript-eslint/eslint-plugin': + optional: true + eslint: + optional: true + vitest: + optional: true + dependencies: + '@typescript-eslint/eslint-plugin': 7.5.0(@typescript-eslint/parser@7.5.0)(eslint@9.0.0)(typescript@5.4.4) + '@typescript-eslint/utils': 7.5.0(eslint@9.0.0)(typescript@5.4.4) + eslint: 9.0.0 + transitivePeerDependencies: + - supports-color + - typescript dev: true - /eslint-plugin-vue@9.18.1(eslint@8.54.0): - resolution: {integrity: sha512-7hZFlrEgg9NIzuVik2I9xSnJA5RsmOfueYgsUGUokEDLJ1LHtxO0Pl4duje1BriZ/jDWb+44tcIlC3yi0tdlZg==} + /eslint-plugin-vue@9.24.1(eslint@9.0.0): + resolution: {integrity: sha512-wk3SuwmS1pZdcuJlokGYEi/buDOwD6KltvhIZyOnpJ/378dcQ4zchu9PAMbbLAaydCz1iYc5AozszcOOgZIIOg==} engines: {node: ^14.17.0 || >=16.0.0} peerDependencies: eslint: '*' @@ -6672,24 +6992,54 @@ packages: eslint: optional: true dependencies: - '@eslint-community/eslint-utils': 4.4.0(eslint@8.54.0) - eslint: 8.54.0 + '@eslint-community/eslint-utils': 4.4.0(eslint@9.0.0) + eslint: 9.0.0 + globals: 13.24.0 natural-compare: 1.4.0 nth-check: 2.1.1 - postcss-selector-parser: 6.0.13 - semver: 7.5.4 - vue-eslint-parser: 9.3.2(eslint@8.54.0) + postcss-selector-parser: 6.0.16 + semver: 7.6.0 + vue-eslint-parser: 9.4.2(eslint@9.0.0) xml-name-validator: 4.0.0 transitivePeerDependencies: - supports-color dev: true - /eslint-scope@5.1.1: - resolution: {integrity: sha512-2NxwbF/hZ0KpepYN0cNbo+FN6XoK7GaHlQhgx/hIZl6Va0bF45RQOOwhLIy8lQDbuCiadSLCBnH2CFYquit5bw==} - engines: {node: '>=8.0.0'} + /eslint-plugin-yml@1.14.0(eslint@9.0.0): + resolution: {integrity: sha512-ESUpgYPOcAYQO9czugcX5OqRvn/ydDVwGCPXY4YjPqc09rHaUVUA6IE6HLQys4rXk/S+qx3EwTd1wHCwam/OWQ==} + engines: {node: ^14.17.0 || >=16.0.0} + peerDependencies: + eslint: '*' + peerDependenciesMeta: + eslint: + optional: true dependencies: - esrecurse: 4.3.0 - estraverse: 4.3.0 + debug: 4.3.4(supports-color@8.1.1) + eslint: 9.0.0 + eslint-compat-utils: 0.5.0(eslint@9.0.0) + lodash: 4.17.21 + natural-compare: 1.4.0 + yaml-eslint-parser: 1.2.2 + transitivePeerDependencies: + - supports-color + dev: true + + /eslint-processor-vue-blocks@0.1.1(@vue/compiler-sfc@3.3.11)(eslint@9.0.0): + resolution: {integrity: sha512-9+dU5lU881log570oBwpelaJmOfOzSniben7IWEDRYQPPWwlvaV7NhOtsTuUWDqpYT+dtKKWPsgz4OkOi+aZnA==} + peerDependencies: + '@vue/compiler-sfc': ^3.3.0 + eslint: '*' + peerDependenciesMeta: + eslint: + optional: true + dependencies: + '@vue/compiler-sfc': 3.3.11 + eslint: 9.0.0 + dev: true + + /eslint-rule-composer@0.3.0: + resolution: {integrity: sha512-bt+Sh8CtDmn2OajxvNO+BX7Wn4CIWMpTRm3MaiKPCQcnnlm0CS2mhui6QaoeQugs+3Kj2ESKEEGJUdVafwhiCg==} + engines: {node: '>=4.0.0'} dev: true /eslint-scope@7.2.2: @@ -6698,58 +7048,54 @@ packages: dependencies: esrecurse: 4.3.0 estraverse: 5.3.0 - - /eslint-utils@2.1.0: - resolution: {integrity: sha512-w94dQYoauyvlDc43XnGB8lU3Zt713vNChgt4EWwhXAP2XkBvndfxF0AgIqKOOasjPIPzj9JqgwkwbCYD0/V3Zg==} - engines: {node: '>=6'} - dependencies: - eslint-visitor-keys: 1.3.0 dev: true - /eslint-visitor-keys@1.3.0: - resolution: {integrity: sha512-6J72N8UNa462wa/KFODt/PJ3IU60SDpC3QXC1Hjc1BXXpfL2C9R5+AU7jhe0F6GREqVMh4Juu+NY7xn+6dipUQ==} - engines: {node: '>=4'} - dev: true + /eslint-scope@8.0.1: + resolution: {integrity: sha512-pL8XjgP4ZOmmwfFE8mEhSxA7ZY4C+LWyqjQ3o4yWkkmD0qcMT9kkW3zWHOczhWcjTSgqycYAgwSlXvZltv65og==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} + dependencies: + esrecurse: 4.3.0 + estraverse: 5.3.0 /eslint-visitor-keys@3.4.3: resolution: {integrity: sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} - /eslint@8.54.0: - resolution: {integrity: sha512-NY0DfAkM8BIZDVl6PgSa1ttZbx3xHgJzSNJKYcQglem6CppHyMhRIQkBVSSMaSRnLhig3jsDbEzOjwCVt4AmmA==} - engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} + /eslint-visitor-keys@4.0.0: + resolution: {integrity: sha512-OtIRv/2GyiF6o/d8K7MYKKbXrOUBIK6SfkIRM4Z0dY3w+LiQ0vy3F57m0Z71bjbyeiWFiHJ8brqnmE6H6/jEuw==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} + + /eslint@9.0.0: + resolution: {integrity: sha512-IMryZ5SudxzQvuod6rUdIUz29qFItWx281VhtFVc2Psy/ZhlCeD/5DT6lBIJ4H3G+iamGJoTln1v+QSuPw0p7Q==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} hasBin: true dependencies: - '@eslint-community/eslint-utils': 4.4.0(eslint@8.54.0) + '@eslint-community/eslint-utils': 4.4.0(eslint@9.0.0) '@eslint-community/regexpp': 4.10.0 - '@eslint/eslintrc': 2.1.3 - '@eslint/js': 8.54.0 - '@humanwhocodes/config-array': 0.11.13 + '@eslint/eslintrc': 3.0.2 + '@eslint/js': 9.0.0 + '@humanwhocodes/config-array': 0.12.3 '@humanwhocodes/module-importer': 1.0.1 '@nodelib/fs.walk': 1.2.8 - '@ungap/structured-clone': 1.2.0 ajv: 6.12.6 chalk: 4.1.2 cross-spawn: 7.0.3 debug: 4.3.4(supports-color@8.1.1) - doctrine: 3.0.0 escape-string-regexp: 4.0.0 - eslint-scope: 7.2.2 - eslint-visitor-keys: 3.4.3 - espree: 9.6.1 + eslint-scope: 8.0.1 + eslint-visitor-keys: 4.0.0 + espree: 10.0.1 esquery: 1.5.0 esutils: 2.0.3 fast-deep-equal: 3.1.3 - file-entry-cache: 6.0.1 + file-entry-cache: 8.0.0 find-up: 5.0.0 glob-parent: 6.0.2 - globals: 13.23.0 graphemer: 1.4.0 ignore: 5.3.0 imurmurhash: 0.1.4 is-glob: 4.0.3 is-path-inside: 3.0.3 - js-yaml: 4.1.0 json-stable-stringify-without-jsonify: 1.0.1 levn: 0.4.1 lodash.merge: 4.6.2 @@ -6765,6 +7111,14 @@ packages: resolution: {integrity: sha512-Cf6VksWPsTuW01vU9Mk/3vRue91Zevka5SjyNf3nEpokFRuqt/KjUQoGAwq9qMmhpLTHmXzSIrFRw8zxWzmFBA==} dev: true + /espree@10.0.1: + resolution: {integrity: sha512-MWkrWZbJsL2UwnjxTX3gG8FneachS/Mwg7tdGXce011sJd5b0JG54vat5KHnfSBODZ3Wvzd2WnjxyzsRoVv+ww==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} + dependencies: + acorn: 8.11.3 + acorn-jsx: 5.3.2(acorn@8.11.3) + eslint-visitor-keys: 4.0.0 + /espree@9.6.1: resolution: {integrity: sha512-oruZaFkjorTpF32kDSI5/75ViwGeZginGGy2NoOSg3Q9bnwlnmDm4HLnkl0RE3n+njDXR037aY1+x58Z/zFdwQ==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} @@ -6772,6 +7126,7 @@ packages: acorn: 8.11.2 acorn-jsx: 5.3.2(acorn@8.11.2) eslint-visitor-keys: 3.4.3 + dev: true /esprima@4.0.1: resolution: {integrity: sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==} @@ -6790,11 +7145,6 @@ packages: dependencies: estraverse: 5.3.0 - /estraverse@4.3.0: - resolution: {integrity: sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw==} - engines: {node: '>=4.0'} - dev: true - /estraverse@5.3.0: resolution: {integrity: sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==} engines: {node: '>=4.0'} @@ -6997,11 +7347,11 @@ packages: escape-string-regexp: 1.0.5 dev: true - /file-entry-cache@6.0.1: - resolution: {integrity: sha512-7Gps/XWymbLk2QLYK4NzpMOrYjMhdIxXuIvy2QBsLE6ljuodKvdkWs/cpyJJ3CVIVpH0Oi1Hvg1ovbMzLdFBBg==} - engines: {node: ^10.12.0 || >=12.0.0} + /file-entry-cache@8.0.0: + resolution: {integrity: sha512-XXTUwCvisa5oacNGRP9SfNtYBNAMi+RPwBFmblZEF7N7swHYQS6/Zfk7SRwx4D5j3CH211YNRco1DEMNVfZCnQ==} + engines: {node: '>=16.0.0'} dependencies: - flat-cache: 3.2.0 + flat-cache: 4.0.1 /file-uri-to-path@1.0.0: resolution: {integrity: sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw==} @@ -7040,10 +7390,6 @@ packages: make-dir: 3.1.0 pkg-dir: 4.2.0 - /find-root@1.1.0: - resolution: {integrity: sha512-NKfW6bec6GfKc0SGx1e07QZY9PE99u0Bft/0rzSD5k3sO/vwkVUpDUKVm5Gpp5Ue3YfShPFTX2070tDs5kB9Ng==} - dev: true - /find-up@4.1.0: resolution: {integrity: sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==} engines: {node: '>=8'} @@ -7058,13 +7404,21 @@ packages: locate-path: 6.0.0 path-exists: 4.0.0 - /flat-cache@3.2.0: - resolution: {integrity: sha512-CYcENa+FtcUKLmhhqyctpclsq7QF38pKjZHsGNiSQF5r4FtoKDWabFDl3hzaEQMvT1LHEysw5twgLvpYYb4vbw==} - engines: {node: ^10.12.0 || >=12.0.0} + /find-up@7.0.0: + resolution: {integrity: sha512-YyZM99iHrqLKjmt4LJDj58KI+fYyufRLBSYcqycxf//KpBk9FoewoGX0450m9nB44qrZnovzC2oeP5hUibxc/g==} + engines: {node: '>=18'} + dependencies: + locate-path: 7.2.0 + path-exists: 5.0.0 + unicorn-magic: 0.1.0 + dev: true + + /flat-cache@4.0.1: + resolution: {integrity: sha512-f7ccFPK3SXFHpx15UIGyRJ/FJQctuKZ0zVuN3frBo4HnK3cay9VEW0R6yPYFHC0AgqhukPzKjq22t5DmAyqGyw==} + engines: {node: '>=16'} dependencies: flatted: 3.2.9 keyv: 4.5.4 - rimraf: 3.0.2 /flat@5.0.2: resolution: {integrity: sha512-b6suED+5/3rTpUBdG1gupIl8MPFCAMA0QXwmljLhvCUKcUvdE4gWky9zpuGCcXHOsz4J9wPGNWq6OKpmIzz3hQ==} @@ -7086,7 +7440,7 @@ packages: optional: true dependencies: '@floating-ui/dom': 0.1.10 - vue: 3.3.8(typescript@4.9.5) + vue: 3.3.8(typescript@5.4.4) vue-resize: 2.0.0-alpha.1(vue@3.3.8) dev: true @@ -7102,12 +7456,6 @@ packages: debug: 4.3.4(supports-color@8.1.1) dev: true - /for-each@0.3.3: - resolution: {integrity: sha512-jqYfLp7mo9vIyQf8ykW2v7A+2N4QjeCeI5+Dz9XraiO1ign81wjiH7Fb9vSOWvQfNtmSa4H2RoQTrrXivdUZmw==} - dependencies: - is-callable: 1.2.7 - dev: true - /foreground-child@3.1.1: resolution: {integrity: sha512-TMKDUnIte6bfb5nWv7V/caI169OHgvwjb7V4WkeUvbQQdjr5rWKqHFiKWb/fcOwB+CzBT+qbWjvj+DVwRskpIg==} engines: {node: '>=14'} @@ -7209,20 +7557,6 @@ packages: /function-bind@1.1.2: resolution: {integrity: sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==} - /function.prototype.name@1.1.6: - resolution: {integrity: sha512-Z5kx79swU5P27WEayXM1tBi5Ze/lbIyiNgU3qyXUOf9b2rgXYyF9Dy9Cx+IQv/Lc8WCG6L82zwUPpSS9hGehIg==} - engines: {node: '>= 0.4'} - dependencies: - call-bind: 1.0.5 - define-properties: 1.2.1 - es-abstract: 1.22.3 - functions-have-names: 1.2.3 - dev: true - - /functions-have-names@1.2.3: - resolution: {integrity: sha512-xckBUXyTIqT97tq2x2AMb+g163b5JFysYk0x4qxNFwbfQkmNZoiRHb6sPzI9/QV33WeuvVYBUIiD4NzNIyqaRQ==} - dev: true - /gauge@3.0.2: resolution: {integrity: sha512-+5J6MS/5XksCuXq++uFRsnUd7Ovu1XenbeuIuNRJxYWjgQbPuFhT14lAvsWfqfAmnwluf1OwMjz39HjfLPci0Q==} engines: {node: '>=10'} @@ -7275,12 +7609,10 @@ packages: resolution: {integrity: sha512-VaUJspBffn/LMCJVoMvSAdmscJyS1auj5Zulnn5UoYcY531UWmdwhRWkcGKnGU93m5HSXP9LP2usOryrBtQowA==} engines: {node: '>=16'} - /get-symbol-description@1.0.0: - resolution: {integrity: sha512-2EmdH1YvIQiZpltCNgkuiUnyukzxM/R6NDJX31Ke3BG1Nq5b0S2PhX59UKi9vZpPDQVdqn+1IcaAwnzTT5vCjw==} - engines: {node: '>= 0.4'} + /get-tsconfig@4.7.3: + resolution: {integrity: sha512-ZvkrzoUA0PQZM6fy6+/Hce561s+faD1rsNwhnO5FelNjyy7EMGJ3Rz1AQ8GYDWjhRs/7dBLOEJvhK8MiEJOAFg==} dependencies: - call-bind: 1.0.5 - get-intrinsic: 1.2.2 + resolve-pkg-maps: 1.0.0 dev: true /getos@3.2.1: @@ -7400,12 +7732,22 @@ packages: engines: {node: '>=8'} dependencies: type-fest: 0.20.2 + dev: true - /globalthis@1.0.3: - resolution: {integrity: sha512-sFdI5LyBiNTHjRd7cGPWapiHWMOXKyuBNX/cWJ3NfzrZQVa8GI/8cofCl74AOVqq9W5kNmguTIzJ/1s2gyI9wA==} - engines: {node: '>= 0.4'} + /globals@13.24.0: + resolution: {integrity: sha512-AhO5QUcj8llrbG09iWhPU2B204J1xnPeL8kQmVorSsy+Sjj1sk8gIyh6cUocGmH4L0UuhAJy+hJMRA4mgA4mFQ==} + engines: {node: '>=8'} dependencies: - define-properties: 1.2.1 + type-fest: 0.20.2 + dev: true + + /globals@14.0.0: + resolution: {integrity: sha512-oahGvuMGQlPw/ivIYBjVSrWAfWLBeku5tpPE2fOPLi+WHffIWbuh2tCjhyQhTBPMf5E9jDEH4FOmTYgYwbKwtQ==} + engines: {node: '>=18'} + + /globals@15.0.0: + resolution: {integrity: sha512-m/C/yR4mjO6pXDTm9/R/SpYTAIyaUB4EOzcaaMEl7mds7Mshct9GfejiJNQGjHHbdMPey13Kpu4TMbYi9ex1pw==} + engines: {node: '>=18'} dev: true /globalyzer@0.1.0: @@ -7489,10 +7831,6 @@ packages: uncrypto: 0.1.3 unenv: 1.7.4 - /has-bigints@1.0.2: - resolution: {integrity: sha512-tSvCKtBr9lkF0Ex0aQiP9N+OpV4zi2r/Nee5VkRDbaqv35RLYMzbwQfFSZZH0kR+Rd6302UJZ2p/bJCEoR3VoQ==} - dev: true - /has-flag@3.0.0: resolution: {integrity: sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==} engines: {node: '>=4'} @@ -7550,6 +7888,10 @@ packages: /hookable@5.5.3: resolution: {integrity: sha512-Yc+BQe8SvoXH1643Qez1zqLRmbA5rCL+sSmk6TVos0LWVfNIB7PGncdlId77WzLGSIB5KaWgTaNTs2lNVEI6VQ==} + /hosted-git-info@2.8.9: + resolution: {integrity: sha512-mxIDAb9Lsm6DoOJ7xH+5+X4y1LU/4Hi50L9C5sIswK3JzULS4bwk1FvjdBgvYR4bzT4tuUQiC15FE2f5HbLvYw==} + dev: true + /hosted-git-info@7.0.1: resolution: {integrity: sha512-+K84LB1DYwMHoHSgaOY/Jfhw3ucPmSET5v98Ke/HdNSw4a0UktWzyW1mjhjpuxxTqOOsfWT/7iVshHmVZ4IpOA==} engines: {node: ^16.14.0 || >=18.0.0} @@ -7766,20 +8108,6 @@ packages: resolution: {integrity: sha512-QQnnxNyfvmHFIsj7gkPcYymR8Jdw/o7mp5ZFihxn6h8Ci6fh3Dx4E1gPjpQEpIuPo9XVNY/ZUwh4BPMjGyL01g==} engines: {node: ^14.17.0 || ^16.13.0 || >=18.0.0} - /internal-slot@1.0.6: - resolution: {integrity: sha512-Xj6dv+PsbtwyPpEflsejS+oIZxmMlV44zAhG479uYu89MsjcYOhCFnNyKrkJrihbsiasQyY0afoCl/9BLR65bg==} - engines: {node: '>= 0.4'} - dependencies: - get-intrinsic: 1.2.2 - hasown: 2.0.0 - side-channel: 1.0.4 - dev: true - - /interpret@1.4.0: - resolution: {integrity: sha512-agE4QfB2Lkp9uICn7BAqoscw4SZP9kTE2hxiFI3jBPmXJfdqiahTbUuKGsMoN2GtqL9AxhYioAcVvgsb1HvRbA==} - engines: {node: '>= 0.10'} - dev: true - /ioredis@5.3.2: resolution: {integrity: sha512-1DKMMzlIHM02eBBVOFQ1+AolGjs6+xEcM4PDL7NqOS6szq7H9jSaEkIUH6/a5Hl241LzW6JLSiAbNvTQjUupUA==} engines: {node: '>=12.22.0'} @@ -7802,49 +8130,33 @@ packages: /iron-webcrypto@1.0.0: resolution: {integrity: sha512-anOK1Mktt8U1Xi7fCM3RELTuYbnFikQY5VtrDj7kPgpejV7d43tWKhzgioO0zpkazLEL/j/iayRqnJhrGfqUsg==} - /is-array-buffer@3.0.2: - resolution: {integrity: sha512-y+FyyR/w8vfIRq4eQcM1EYgSTnmHXPqaF+IgzgraytCFq5Xh8lllDVmAZolPJiZttZLeFSINPYMaEJ7/vWUa1w==} + /is-alphabetical@1.0.4: + resolution: {integrity: sha512-DwzsA04LQ10FHTZuL0/grVDk4rFoVH1pjAToYwBrHSxcrBIGQuXrQMtD5U1b0U2XVgKZCTLLP8u2Qxqhy3l2Vg==} + dev: true + + /is-alphanumerical@1.0.4: + resolution: {integrity: sha512-UzoZUr+XfVz3t3v4KyGEniVL9BDRoQtY7tOyrRybkVNjDFWyo1yhXNGrrBTQxp3ib9BLAWs7k2YKBQsFRkZG9A==} dependencies: - call-bind: 1.0.5 - get-intrinsic: 1.2.2 - is-typed-array: 1.1.12 + is-alphabetical: 1.0.4 + is-decimal: 1.0.4 dev: true /is-arrayish@0.2.1: resolution: {integrity: sha512-zz06S8t0ozoDXMG+ube26zeCTNXcKIPJZJi8hBrF4idCLms4CG9QtK7qBl1boi5ODzFpjswb5JPmHCbMpjaYzg==} dev: true - /is-bigint@1.0.4: - resolution: {integrity: sha512-zB9CruMamjym81i2JZ3UMn54PKGsQzsJeo6xvN3HJJ4CAsQNB6iRutp2To77OfCNuoxspsIhzaPoO1zyCEhFOg==} - dependencies: - has-bigints: 1.0.2 - dev: true - /is-binary-path@2.1.0: resolution: {integrity: sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==} engines: {node: '>=8'} dependencies: binary-extensions: 2.2.0 - /is-boolean-object@1.1.2: - resolution: {integrity: sha512-gDYaKHJmnj4aWxyj6YHyXVpdQawtVLHU5cb+eztPGczf6cjuTdwve5ZIEfgXqH4e57An1D1AKf8CZ3kYrQRqYA==} - engines: {node: '>= 0.4'} - dependencies: - call-bind: 1.0.5 - has-tostringtag: 1.0.0 - dev: true - /is-builtin-module@3.2.1: resolution: {integrity: sha512-BSLE3HnV2syZ0FK0iMA/yUGplUeMmNz4AW5fnTunbCIqZi4vG3WjJT9FHMy5D69xmAYBHXQhJdALdpwVxV501A==} engines: {node: '>=6'} dependencies: builtin-modules: 3.3.0 - /is-callable@1.2.7: - resolution: {integrity: sha512-1BC0BVFhS/p0qtw6enp8e+8OD0UrK0oFLztSjNzhcKA3WDuJxxAPXzPuPtKkjEY9UUoEWlX/8fgKeu2S8i9JTA==} - engines: {node: '>= 0.4'} - dev: true - /is-ci@3.0.1: resolution: {integrity: sha512-ZYvCgrefwqoQ6yTyYUbQu64HsITZ3NfKX1lzaEYdkTDcfKzzCI/wthRRYKkdjHKFVgNiXKAKm65Zo1pk2as/QQ==} hasBin: true @@ -7857,11 +8169,8 @@ packages: dependencies: hasown: 2.0.0 - /is-date-object@1.0.5: - resolution: {integrity: sha512-9YQaSxsAiSwcvS33MBk3wTCVnWK+HhF8VZR2jRxehM16QcVOdHqPn4VPHmRK4lSr38n9JriurInLcP90xsYNfQ==} - engines: {node: '>= 0.4'} - dependencies: - has-tostringtag: 1.0.0 + /is-decimal@1.0.4: + resolution: {integrity: sha512-RGdriMmQQvZ2aqaQq3awNA6dCGtKpiDFcOzrTWrDAT2MiWrKQVPmxLGHl7Y2nNu6led0kEyoX0enY0qXYsv9zw==} dev: true /is-docker@2.2.1: @@ -7900,6 +8209,10 @@ packages: dependencies: is-extglob: 2.1.1 + /is-hexadecimal@1.0.4: + resolution: {integrity: sha512-gyPJuv83bHMpocVYoqof5VDiZveEoGoFL8m3BXNb2VW8Xs+rz9kqO8LOQ5DH6EsuvilT1ApazU0pyl+ytbPtlw==} + dev: true + /is-inside-container@1.0.0: resolution: {integrity: sha512-KIYLCCJghfHZxqjYBE7rEy0OBuTd5xCHS7tHVgvCLkx7StIoaxwNW3hCALgEUjFfeRk+MG/Qxmp/vtETEF3tRA==} engines: {node: '>=14.16'} @@ -7928,18 +8241,6 @@ packages: /is-module@1.0.0: resolution: {integrity: sha512-51ypPSPCoTEIN9dy5Oy+h4pShgJmPCygKfyRCISBI+JoWT/2oJvK8QPxmwv7b/p239jXrm9M1mlQbyKJ5A152g==} - /is-negative-zero@2.0.2: - resolution: {integrity: sha512-dqJvarLawXsFbNDeJW7zAz8ItJ9cd28YufuuFzh0G8pNHjJMnY08Dv7sYX2uF5UpQOwieAeOExEYAWWfu7ZZUA==} - engines: {node: '>= 0.4'} - dev: true - - /is-number-object@1.0.7: - resolution: {integrity: sha512-k1U0IRzLMo7ZlYIfzRu23Oh6MiIFasgpb9X76eqfFZAqwH44UI4KTBvBYIZ1dSL9ZzChTB9ShHfLkR4pdW5krQ==} - engines: {node: '>= 0.4'} - dependencies: - has-tostringtag: 1.0.0 - dev: true - /is-number@7.0.0: resolution: {integrity: sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==} engines: {node: '>=0.12.0'} @@ -7972,20 +8273,6 @@ packages: dependencies: '@types/estree': 1.0.5 - /is-regex@1.1.4: - resolution: {integrity: sha512-kvRdxDsxZjhzUX07ZnLydzS1TU/TJlTUHHY4YLL87e37oUA49DfkLqgy+VjFocowy29cKvcSiu+kIv728jTTVg==} - engines: {node: '>= 0.4'} - dependencies: - call-bind: 1.0.5 - has-tostringtag: 1.0.0 - dev: true - - /is-shared-array-buffer@1.0.2: - resolution: {integrity: sha512-sqN2UDu1/0y6uvXyStCOzyhAjCSlHceFoMKJW8W9EU9cvic/QdsZ0kEU93HEy3IUEFZIiH/3w+AH/UQbPHNdhA==} - dependencies: - call-bind: 1.0.5 - dev: true - /is-ssh@1.4.0: resolution: {integrity: sha512-x7+VxdxOdlV3CYpjvRLBv5Lo9OJerlYanjwFrPR9fuGPjCiNiCzFgAWpiLAohSbsnH4ZAys3SBh+hq5rJosxUQ==} dependencies: @@ -7999,27 +8286,6 @@ packages: resolution: {integrity: sha512-LnQR4bZ9IADDRSkvpqMGvt/tEJWclzklNgSw48V5EAaAeDd6qGvN8ei6k5p0tvxSR171VmGyHuTiAOfxAbr8kA==} engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} - /is-string@1.0.7: - resolution: {integrity: sha512-tE2UXzivje6ofPW7l23cjDOMa09gb7xlAqG6jG5ej6uPV32TlWP3NKPigtaGeHNu9fohccRYvIiZMfOOnOYUtg==} - engines: {node: '>= 0.4'} - dependencies: - has-tostringtag: 1.0.0 - dev: true - - /is-symbol@1.0.4: - resolution: {integrity: sha512-C/CPBqKWnvdcxqIARxyOh4v1UUEOCHpgDa0WYgpKDFMszcrPcffg5uhwSgPCLD2WWxmq6isisz87tzT01tuGhg==} - engines: {node: '>= 0.4'} - dependencies: - has-symbols: 1.0.3 - dev: true - - /is-typed-array@1.1.12: - resolution: {integrity: sha512-Z14TF2JNG8Lss5/HMqt0//T9JeHXttXy5pH/DBU4vi98ozO2btxzq9MwYDZYnKwU8nRsz/+GVFVRDq3DkVuSPg==} - engines: {node: '>= 0.4'} - dependencies: - which-typed-array: 1.1.13 - dev: true - /is-typedarray@1.0.0: resolution: {integrity: sha512-cyA56iCMHAh5CdzjJIa4aohJyeO1YbwLi3Jc35MmRU6poroFjIGZzUzupGiRPOjgHg9TLu43xbpwXk523fMxKA==} dev: true @@ -8029,12 +8295,6 @@ packages: engines: {node: '>=10'} dev: true - /is-weakref@1.0.2: - resolution: {integrity: sha512-qctsuLZmIQ0+vSSMfoVvyFe2+GSEvnmZ2ezTup1SBse9+twCCeial6EEi3Nc2KFcf6+qz2FBPnjXsk8xhKSaPQ==} - dependencies: - call-bind: 1.0.5 - dev: true - /is-wsl@2.2.0: resolution: {integrity: sha512-fKzAra0rGJUUBwGBgNkHZuToZcn+TtXHpeCgmkMJMMYx1sQDYaCSyjJBSCa2nH1DGm7s3n1oBnohoVTBaN7Lww==} engines: {node: '>=8'} @@ -8044,10 +8304,6 @@ packages: /isarray@1.0.0: resolution: {integrity: sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ==} - /isarray@2.0.5: - resolution: {integrity: sha512-xHjhDr3cNBK0BzdUJSPXZntQUx/mwMS5Rw4A7lPJ90XGAO6ISP/ePDNuo0vhqOZU+UD5JoodwCAAoZQd3FeAKw==} - dev: true - /isexe@2.0.0: resolution: {integrity: sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==} @@ -8113,6 +8369,11 @@ packages: resolution: {integrity: sha512-UVU9dibq2JcFWxQPA6KCqj5O42VOmAY3zQUfEKxU0KpTGXwNoCjkX1e13eHNvw/xPynt6pU0rZ1htjWTNTSXsg==} dev: true + /jsdoc-type-pratt-parser@4.0.0: + resolution: {integrity: sha512-YtOli5Cmzy3q4dP26GraSOeAhqecewG04hoO8DY56CH4KJ9Fvv5qKWUCCo3HZob7esJQHCv6/+bnTy72xZZaVQ==} + engines: {node: '>=12.0.0'} + dev: true + /jsdom@20.0.3: resolution: {integrity: sha512-SYhBvTh89tTfCD/CRdSOm13mOBa42iTaTyfyEWBdKcGdPxPtLFBXuHR8XHb33YNYaP+lLbmSvBTsnoesCNJEsQ==} engines: {node: '>=14'} @@ -8191,11 +8452,22 @@ packages: - utf-8-validate dev: true + /jsesc@0.5.0: + resolution: {integrity: sha512-uZz5UnB7u4T9LvwmFqXii7pZSouaRPorGs5who1Ip7VO0wxanFvBL7GkM6dTHlgX+jhBApRetaWpnDabOeTcnA==} + hasBin: true + dev: true + /jsesc@2.5.2: resolution: {integrity: sha512-OYu7XEzjkCQ3C5Ps3QIZsQfNpqoJyZZA99wd9aWd05NCtC5pWOkShK2mkL6HXQR6/Cy2lbNdPlZBpuQHXE63gA==} engines: {node: '>=4'} hasBin: true + /jsesc@3.0.2: + resolution: {integrity: sha512-xKqzzWXDttJuOcawBt4KnKHHIf5oQ/Cxax+0PWFG+DFDgHNAdi+TXECADI+RYiFUMmx8792xsMbbgXj4CwnP4g==} + engines: {node: '>=6'} + hasBin: true + dev: true + /json-buffer@3.0.1: resolution: {integrity: sha512-4bV5BfR2mqfQTJm+V5tPPdf+ZpuhiIvTuAB5g8kcrXOZpTT/QwwVRWBywX1ozr6lEuPdbHxwaJlm9G6mI2sfSQ==} @@ -8221,18 +8493,21 @@ packages: resolution: {integrity: sha512-ZClg6AaYvamvYEE82d3Iyd3vSSIjQ+odgjaTzRuO3s7toCdFKczob2i0zCh7JE8kWn17yvAWhUVxvqGwUalsRA==} dev: true - /json5@1.0.2: - resolution: {integrity: sha512-g1MWMLBiz8FKi1e4w0UyVL3w+iJceWAFBAaBnnGKOpNa5f8TLktkbre1+s6oICydWAm+HRUGTmI+//xv2hvXYA==} - hasBin: true - dependencies: - minimist: 1.2.8 - dev: true - /json5@2.2.3: resolution: {integrity: sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==} engines: {node: '>=6'} hasBin: true + /jsonc-eslint-parser@2.4.0: + resolution: {integrity: sha512-WYDyuc/uFcGp6YtM2H0uKmUwieOuzeE/5YocFJLnLfclZ4inf3mRn8ZVy1s7Hxji7Jxm6Ss8gqpexD/GlKoGgg==} + engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} + dependencies: + acorn: 8.11.2 + eslint-visitor-keys: 3.4.3 + espree: 9.6.1 + semver: 7.5.4 + dev: true + /jsonc-parser@3.2.0: resolution: {integrity: sha512-gfFQZrcTc8CnKXp6Y4/CBT3fTc0OVuDofpre4aEeEpSBPV5X5v4+Vmx+8snU7RLPrNHPKSgLxGo9YuQzz20o+w==} @@ -8477,6 +8752,13 @@ packages: dependencies: p-locate: 5.0.0 + /locate-path@7.2.0: + resolution: {integrity: sha512-gvVijfZvn7R+2qyPX8mAuKcFGDf6Nc61GdvGafQsHL0sBIxfKzA+usWn4GFC/bk+QdwPUD4kWFJLhElipq+0VA==} + engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} + dependencies: + p-locate: 6.0.0 + dev: true + /lodash.castarray@4.4.0: resolution: {integrity: sha512-aVx8ztPv7/2ULbArGJ2Y42bG1mEQ5mGjpdvrbJcJFU3TbYybe+QlLS4pst9zV52ymy2in1KpFPiZnAOATxD4+Q==} dev: true @@ -8573,13 +8855,6 @@ packages: sourcemap-codec: 1.4.8 dev: true - /magic-string@0.26.7: - resolution: {integrity: sha512-hX9XH3ziStPoPhJxLq1syWuZMxbDvGNbVchfrdCtanC7D13888bMFow61x8axrx+GfHLtVeAx2kxL7tTGRl+Ow==} - engines: {node: '>=12'} - dependencies: - sourcemap-codec: 1.4.8 - dev: true - /magic-string@0.27.0: resolution: {integrity: sha512-8UnnX2PeRAPZuN12svgR9j7M1uWMovg/CEnIwIG0LFkXSJJe4PdfUGiTGl8V9bsBHFUtfVINcSyYxd7q+kx9fA==} engines: {node: '>=12'} @@ -8662,6 +8937,22 @@ packages: uc.micro: 1.0.6 dev: false + /mdast-util-from-markdown@0.8.5: + resolution: {integrity: sha512-2hkTXtYYnr+NubD/g6KGBS/0mFmBcifAsI0yIWRiRo0PjVs6SSOSOdtzbp6kSGnShDN6G5aWZpKQ2lWRy27mWQ==} + dependencies: + '@types/mdast': 3.0.15 + mdast-util-to-string: 2.0.0 + micromark: 2.11.4 + parse-entities: 2.0.0 + unist-util-stringify-position: 2.0.3 + transitivePeerDependencies: + - supports-color + dev: true + + /mdast-util-to-string@2.0.0: + resolution: {integrity: sha512-AW4DRS3QbBayY/jJmD8437V1Gombjf8RSOUCMFBuo5iHi58AGEgVCKQ+ezHkZZDpAQS75hcBMpLqjpJTjtUL7w==} + dev: true + /mdn-data@2.0.28: resolution: {integrity: sha512-aylIc7Z9y4yzHYAJNuESG3hfhC+0Ibp/MAMiaOZgNv4pmEdFyfZhhhny4MNiAfWdBQ1RQ2mfDWmM1x8SvGyp8g==} @@ -8677,10 +8968,6 @@ packages: engines: {node: '>= 0.6'} dev: true - /memory-fs@0.2.0: - resolution: {integrity: sha512-+y4mDxU4rvXXu5UDSGCGNiesFmwCHuefGMoPCO1WYucNYj7DsLqrFaa2fXVI0H+NNiPTwwzKwspn9yTZqUGqng==} - dev: true - /merge-stream@2.0.0: resolution: {integrity: sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==} @@ -8693,6 +8980,15 @@ packages: engines: {node: '>= 0.6'} dev: true + /micromark@2.11.4: + resolution: {integrity: sha512-+WoovN/ppKolQOFIAajxi7Lu9kInbPxFuTBVEavFcL8eAfVstoc5MocPmqBeAdBOJV00uaVjegzH4+MA0DN/uA==} + dependencies: + debug: 4.3.4(supports-color@8.1.1) + parse-entities: 2.0.0 + transitivePeerDependencies: + - supports-color + dev: true + /micromatch@4.0.5: resolution: {integrity: sha512-DMy+ERcEW2q8Z2Po+WNXuw3c5YaUSFjAO5GsJqfEl7UjvtIuFKO6ZrKvcItdy98dwFI2N1tg3zNIdKaQT+aNdA==} engines: {node: '>=8.6'} @@ -8875,8 +9171,8 @@ packages: /ms@2.1.3: resolution: {integrity: sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==} - /muggle-string@0.3.1: - resolution: {integrity: sha512-ckmWDJjphvd/FvZawgygcUeQCxzvohjFO5RxTjj4eq8kw359gFF3E1brjfI+viLMxss5JrHTDRHZvu2/tuy0Qg==} + /muggle-string@0.4.1: + resolution: {integrity: sha512-VNTrAak/KhO2i8dqqnqnAHOa3cYBwXEZe9h+D5h/1ZqFSTEFHdM65lR7RoIqq3tBBYavsOXV84NoHXZ0AkPyqQ==} dev: true /mz@2.7.0: @@ -9078,6 +9374,10 @@ packages: /node-releases@2.0.13: resolution: {integrity: sha512-uYr7J37ae/ORWdZeQ1xxMJe3NtdmqMC/JZK+geofDrkLUApKRHPd18/TxtBOJ4A0/+uUIliorNrfYV6s1b02eQ==} + /node-releases@2.0.14: + resolution: {integrity: sha512-y10wOWt8yZpqXmOgRo77WaHEmhYQYGNA6y421PKsKYWEK8aW+cqAphborZDhqfyKrbZEN92CN1X2KbafY2s7Yw==} + dev: true + /nodemon@2.0.22: resolution: {integrity: sha512-B8YqaKMmyuCO7BowF1Z1/mkPqLk6cs/l63Ojtd6otKjMx47Dq1utxfRxcavH1I7VSaL8n5BUaoutadnsX3AAVQ==} engines: {node: '>=8.10.0'} @@ -9116,6 +9416,15 @@ packages: dependencies: abbrev: 2.0.0 + /normalize-package-data@2.5.0: + resolution: {integrity: sha512-/5CMN3T0R4XTj4DcGaexo+roZSdSFW/0AOOTROrjxzCG1wrWXEsGbRKevjlIL+ZDE4sZlJr5ED4YW0yqmkK+eA==} + dependencies: + hosted-git-info: 2.8.9 + resolve: 1.22.8 + semver: 5.7.2 + validate-npm-package-license: 3.0.4 + dev: true + /normalize-package-data@6.0.0: resolution: {integrity: sha512-UL7ELRVxYBHBgYEtZCXjxuD5vPxnmvMGq0jp/dGPKKrN7tfsBh2IY7TlJ15WWwdjRWD3RJbnsygUurTK3xkPkg==} engines: {node: ^16.14.0 || >=18.0.0} @@ -9219,7 +9528,7 @@ packages: optionalDependencies: fsevents: 2.3.3 - /nuxt@3.8.2(@types/node@18.11.9)(eslint@8.54.0)(typescript@4.9.5)(vite@5.0.11): + /nuxt@3.8.2(@types/node@18.11.9)(eslint@9.0.0)(typescript@5.4.4)(vite@5.0.11): resolution: {integrity: sha512-HUAyifmqTs2zcQBGvcby3KNs2pBAk+l7ZbLjD1oCNqQQ+wBuZ1qgLC4Ebu++y4g3o3Y8WAWSvpafbKRLQZziPw==} engines: {node: ^14.18.0 || >=16.10.0} hasBin: true @@ -9238,7 +9547,7 @@ packages: '@nuxt/schema': 3.8.2 '@nuxt/telemetry': 2.5.2 '@nuxt/ui-templates': 1.3.1 - '@nuxt/vite-builder': 3.8.2(@types/node@18.11.9)(eslint@8.54.0)(typescript@4.9.5)(vue@3.3.11) + '@nuxt/vite-builder': 3.8.2(@types/node@18.11.9)(eslint@9.0.0)(typescript@5.4.4)(vue@3.3.11) '@types/node': 18.11.9 '@unhead/dom': 1.8.5 '@unhead/ssr': 1.8.5 @@ -9284,7 +9593,7 @@ packages: unplugin: 1.5.1 unplugin-vue-router: 0.7.0(vue-router@4.2.5)(vue@3.3.11) untyped: 1.4.0 - vue: 3.3.11(typescript@4.9.5) + vue: 3.3.11(typescript@5.4.4) vue-bundle-renderer: 2.0.0 vue-devtools-stub: 0.1.0 vue-router: 4.2.5(vue@3.3.11) @@ -9325,7 +9634,7 @@ packages: - xml2js dev: false - /nuxt@3.8.2(eslint@8.54.0)(typescript@4.9.5)(vite@4.5.1): + /nuxt@3.8.2(eslint@9.0.0)(typescript@5.4.4)(vite@4.5.1): resolution: {integrity: sha512-HUAyifmqTs2zcQBGvcby3KNs2pBAk+l7ZbLjD1oCNqQQ+wBuZ1qgLC4Ebu++y4g3o3Y8WAWSvpafbKRLQZziPw==} engines: {node: ^14.18.0 || >=16.10.0} hasBin: true @@ -9344,7 +9653,7 @@ packages: '@nuxt/schema': 3.8.2 '@nuxt/telemetry': 2.5.2 '@nuxt/ui-templates': 1.3.1 - '@nuxt/vite-builder': 3.8.2(eslint@8.54.0)(typescript@4.9.5)(vue@3.3.8) + '@nuxt/vite-builder': 3.8.2(eslint@9.0.0)(typescript@5.4.4)(vue@3.3.8) '@unhead/dom': 1.8.5 '@unhead/ssr': 1.8.5 '@unhead/vue': 1.8.5(vue@3.3.8) @@ -9389,7 +9698,7 @@ packages: unplugin: 1.5.1 unplugin-vue-router: 0.7.0(vue-router@4.2.5)(vue@3.3.8) untyped: 1.4.0 - vue: 3.3.8(typescript@4.9.5) + vue: 3.3.8(typescript@5.4.4) vue-bundle-renderer: 2.0.0 vue-devtools-stub: 0.1.0 vue-router: 4.2.5(vue@3.3.8) @@ -9440,62 +9749,20 @@ packages: dependencies: citty: 0.1.5 execa: 8.0.1 - pathe: 1.1.1 - ufo: 1.3.2 - - /object-assign@4.1.1: - resolution: {integrity: sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==} - engines: {node: '>=0.10.0'} - - /object-hash@3.0.0: - resolution: {integrity: sha512-RSn9F68PjH9HqtltsSnqYC1XXoWe9Bju5+213R98cNGttag9q9yAOTzdbsqvIa7aNm5WffBZFpWYr2aWrklWAw==} - engines: {node: '>= 6'} - dev: true - - /object-inspect@1.13.1: - resolution: {integrity: sha512-5qoj1RUiKOMsCCNLV1CBiPYE10sziTsnmNxkAI/rZhiD63CF7IqdFGC/XzjWjpSgLf0LxXX3bDFIh0E18f6UhQ==} - dev: true - - /object-keys@1.1.1: - resolution: {integrity: sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA==} - engines: {node: '>= 0.4'} - dev: true - - /object.assign@4.1.4: - resolution: {integrity: sha512-1mxKf0e58bvyjSCtKYY4sRe9itRk3PJpquJOjeIkz885CczcI4IvJJDLPS72oowuSh+pBxUFROpX+TU++hxhZQ==} - engines: {node: '>= 0.4'} - dependencies: - call-bind: 1.0.5 - define-properties: 1.2.1 - has-symbols: 1.0.3 - object-keys: 1.1.1 - dev: true - - /object.fromentries@2.0.7: - resolution: {integrity: sha512-UPbPHML6sL8PI/mOqPwsH4G6iyXcCGzLin8KvEPenOZN5lpCNBZZQ+V62vdjB1mQHrmqGQt5/OJzemUA+KJmEA==} - engines: {node: '>= 0.4'} - dependencies: - call-bind: 1.0.5 - define-properties: 1.2.1 - es-abstract: 1.22.3 - dev: true + pathe: 1.1.1 + ufo: 1.3.2 - /object.groupby@1.0.1: - resolution: {integrity: sha512-HqaQtqLnp/8Bn4GL16cj+CUYbnpe1bh0TtEaWvybszDG4tgxCJuRpV8VGuvNaI1fAnI4lUJzDG55MXcOH4JZcQ==} - dependencies: - call-bind: 1.0.5 - define-properties: 1.2.1 - es-abstract: 1.22.3 - get-intrinsic: 1.2.2 + /object-assign@4.1.1: + resolution: {integrity: sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==} + engines: {node: '>=0.10.0'} + + /object-hash@3.0.0: + resolution: {integrity: sha512-RSn9F68PjH9HqtltsSnqYC1XXoWe9Bju5+213R98cNGttag9q9yAOTzdbsqvIa7aNm5WffBZFpWYr2aWrklWAw==} + engines: {node: '>= 6'} dev: true - /object.values@1.1.7: - resolution: {integrity: sha512-aU6xnDFYT3x17e/f0IiiwlGPTy2jzMySGfUB4fq6z7CV8l85CWHDk5ErhyhpfDHhrOMwGFhSQkhMGHaIotA6Ng==} - engines: {node: '>= 0.4'} - dependencies: - call-bind: 1.0.5 - define-properties: 1.2.1 - es-abstract: 1.22.3 + /object-inspect@1.13.1: + resolution: {integrity: sha512-5qoj1RUiKOMsCCNLV1CBiPYE10sziTsnmNxkAI/rZhiD63CF7IqdFGC/XzjWjpSgLf0LxXX3bDFIh0E18f6UhQ==} dev: true /ofetch@1.3.3: @@ -9624,6 +9891,13 @@ packages: dependencies: p-limit: 3.1.0 + /p-locate@6.0.0: + resolution: {integrity: sha512-wPrq66Llhl7/4AGC6I+cqxT07LhXvWL08LNXz1fENOw0Ap4sRZZ/gZpTTJ5jpurzzzfS2W/Ge9BY3LgLjCShcw==} + engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} + dependencies: + p-limit: 4.0.0 + dev: true + /p-map@4.0.0: resolution: {integrity: sha512-/bjOqmgETBYB5BoEeGVea8dmvHb2m9GLy1E9W43yeyfP6QQCZGFNa+XRceJEuDB6zqr+gKpIAmlLebMpykw/MQ==} engines: {node: '>=10'} @@ -9680,6 +9954,17 @@ packages: callsites: 3.1.0 dev: true + /parse-entities@2.0.0: + resolution: {integrity: sha512-kkywGpCcRYhqQIchaWqZ875wzpS/bMKhz5HnN3p7wveJTkTtyAB/AlnS0f8DFSqYW1T82t6yEAkEcB+A1I3MbQ==} + dependencies: + character-entities: 1.2.4 + character-entities-legacy: 1.1.4 + character-reference-invalid: 1.1.4 + is-alphanumerical: 1.0.4 + is-decimal: 1.0.4 + is-hexadecimal: 1.0.4 + dev: true + /parse-git-config@3.0.0: resolution: {integrity: sha512-wXoQGL1D+2COYWCD35/xbiKma1Z15xvZL8cI25wvxzled58V51SJM04Urt/uznS900iQor7QO04SgdfT/XlbuA==} engines: {node: '>=8'} @@ -9687,6 +9972,11 @@ packages: git-config-path: 2.0.0 ini: 1.3.8 + /parse-gitignore@2.0.0: + resolution: {integrity: sha512-RmVuCHWsfu0QPNW+mraxh/xjQVw/lhUCUru8Zni3Ctq3AoMhpDTq0OVdKS6iesd6Kqb7viCV3isAL43dciOSog==} + engines: {node: '>=14'} + dev: true + /parse-json@5.2.0: resolution: {integrity: sha512-ayCKvm/phCGxOkYRSCM82iDwct8/EonSEgCSxWxD7ve6jHggsFl4fZVQBPRNgQoKiuV/odhFrGzQXZwbifC8Rg==} engines: {node: '>=8'} @@ -9736,6 +10026,11 @@ packages: resolution: {integrity: sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==} engines: {node: '>=8'} + /path-exists@5.0.0: + resolution: {integrity: sha512-RjhtfwJOxzcFmNOi6ltcbcu4Iu+FL3zEj83dk4kAS+fVpTxXLO1b38RvJgT/0QwvV/L3aY9TAnyv0EOqW4GoMQ==} + engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} + dev: true + /path-is-absolute@1.0.1: resolution: {integrity: sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==} engines: {node: '>=0.10.0'} @@ -9773,6 +10068,10 @@ packages: /pathe@1.1.1: resolution: {integrity: sha512-d+RQGp0MAYTIaDBIMmOfMwz3E+LOZnxx1HZd5R18mmCZY0QBlK0LDZfPc8FW8Ed2DlvsuE6PRjroDY+wg4+j/Q==} + /pathe@1.1.2: + resolution: {integrity: sha512-whLdWMYL2TwI08hn8/ZqAbrVemu0LNaNNJZX73O6qaIdCTfXutsLhMkjdENX0qhsQ9uIimo4/aQOmXkoon2nDQ==} + dev: true + /pathval@1.1.1: resolution: {integrity: sha512-Dp6zGqpTdETdR63lehJYPeIOqpiNBNtc7BpWSLrOje7UaIsE5aY92r/AunQA7rsXvet3lrJ3JnZX29UPTKXyKQ==} dev: true @@ -9807,12 +10106,17 @@ packages: resolution: {integrity: sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==} engines: {node: '>=8.6'} + /picomatch@4.0.2: + resolution: {integrity: sha512-M7BAV6Rlcy5u+m6oPhAPFgJTzAioX/6B0DxyvDlo9l8+T3nLKbrczg2WLUyzd45L8RqfUMyGPzekbMvX2Ldkwg==} + engines: {node: '>=12'} + dev: true + /pify@2.3.0: resolution: {integrity: sha512-udgsAY+fTnvv7kI7aaxbqwWNb0AHiB0qBO89PZKPkoTmGOgdbrHDKD+0B2X4uTfJ/FT1R09r9gTsjUjNJotuog==} engines: {node: '>=0.10.0'} dev: true - /pinia@2.1.7(typescript@4.9.5)(vue@3.3.8): + /pinia@2.1.7(typescript@5.4.4)(vue@3.3.8): resolution: {integrity: sha512-+C2AHFtcFqjPih0zpYuvof37SFxMQ7OEG2zV9jRI12i9BOy3YQVAHwdKtyyc8pDcDyIc33WCIsZaCFWU7WWxGQ==} peerDependencies: '@vue/composition-api': ^1.4.0 @@ -9827,8 +10131,8 @@ packages: optional: true dependencies: '@vue/devtools-api': 6.5.1 - typescript: 4.9.5 - vue: 3.3.8(typescript@4.9.5) + typescript: 5.4.4 + vue: 3.3.8(typescript@5.4.4) vue-demi: 0.14.6(vue@3.3.8) /pirates@4.0.6: @@ -9849,6 +10153,11 @@ packages: mlly: 1.4.2 pathe: 1.1.1 + /pluralize@8.0.0: + resolution: {integrity: sha512-Nc3IT5yHzflTfbjgqWcCPpo7DaKy4FnpB0l/zCAW0Tc7jxAiuqSxHasntB3D7887LSrA93kDJ9IXovxJYxyLCA==} + engines: {node: '>=4'} + dev: true + /portfinder@1.0.32: resolution: {integrity: sha512-on2ZJVVDXRADWE6jnQaX0ioEylzgBpQk8r55NE4wjXW1ZxO+BgDlY6DXwj20i0V8eB4SenDQ00WEaxfiIQPcxg==} engines: {node: '>= 0.12.0'} @@ -10267,6 +10576,14 @@ packages: cssesc: 3.0.0 util-deprecate: 1.0.2 + /postcss-selector-parser@6.0.16: + resolution: {integrity: sha512-A0RVJrX+IUkVZbW3ClroRWurercFhieevHB38sr2+l9eUClMqome3LmEmnhlNy+5Mr2EYN6B2Kaw9wYdd+VHiw==} + engines: {node: '>=4'} + dependencies: + cssesc: 3.0.0 + util-deprecate: 1.0.2 + dev: true + /postcss-svgo@6.0.0(postcss@8.4.32): resolution: {integrity: sha512-r9zvj/wGAoAIodn84dR/kFqwhINp5YsJkLoujybWG59grR/IHx+uQ2Zo+IcOwM0jskfYX3R0mo+1Kip1VSNcvw==} engines: {node: ^14 || ^16 || >= 18} @@ -10509,6 +10826,25 @@ packages: normalize-package-data: 6.0.0 npm-normalize-package-bin: 3.0.1 + /read-pkg-up@7.0.1: + resolution: {integrity: sha512-zK0TB7Xd6JpCLmlLmufqykGE+/TlOePD6qKClNW7hHDKFh/J7/7gCWGR7joEQEW1bKq3a3yUZSObOoWLFQ4ohg==} + engines: {node: '>=8'} + dependencies: + find-up: 4.1.0 + read-pkg: 5.2.0 + type-fest: 0.8.1 + dev: true + + /read-pkg@5.2.0: + resolution: {integrity: sha512-Ug69mNOpfvKDAc2Q8DRpMjjzdtrnv9HcSMX+4VsZxD1aZ6ZzrIE7rlzXBtWTyhULSMKg076AW6WR5iZpD0JiOg==} + engines: {node: '>=8'} + dependencies: + '@types/normalize-package-data': 2.4.4 + normalize-package-data: 2.5.0 + parse-json: 5.2.0 + type-fest: 0.6.0 + dev: true + /readable-stream@2.3.8: resolution: {integrity: sha512-8p0AUk4XODgIewSi0l8Epjs+EVnWiK7NoDIEGU0HhE7+ZyY8D1IMY7odu5lRrFXGg71L15KG8QrPmum45RTtdA==} dependencies: @@ -10553,18 +10889,16 @@ packages: resolution: {integrity: sha512-srw17NI0TUWHuGa5CFGGmhfNIeja30WMBfbslPNhf6JrqQlLN5gcrvig1oqPxiVaXb0oW0XRKtH6Nngs5lKCIA==} dev: true - /regexp.prototype.flags@1.5.1: - resolution: {integrity: sha512-sy6TXMN+hnP/wMy+ISxg3krXx7BAtWVO4UouuCN/ziM9UEne0euamVNafDfvC83bRNr95y0V5iijeDQFUNpvrg==} - engines: {node: '>= 0.4'} - dependencies: - call-bind: 1.0.5 - define-properties: 1.2.1 - set-function-name: 2.0.1 + /regexp-tree@0.1.27: + resolution: {integrity: sha512-iETxpjK6YoRWJG5o6hXLwvjYAoW+FEZn9os0PD/b6AP6xQwsa/Y7lCVgIixBbUPMfhu+i2LtdeAqVTgGlQarfA==} + hasBin: true dev: true - /regexpp@3.2.0: - resolution: {integrity: sha512-pq2bWo9mVD43nbts2wGv17XLiNLya+GklZ8kaDLV2Z08gDCsGpnKn9BFMepvWuHCbyVvY7J5o5+BVvoQbmlJLg==} - engines: {node: '>=8'} + /regjsparser@0.10.0: + resolution: {integrity: sha512-qx+xQGZVsy55CH0a1hiVwHmqjLryfh7wQyF5HO07XJ9f7dQMY/gPQHhlyDkIzJKC+x2fUCpCcUODUUUFrm7SHA==} + hasBin: true + dependencies: + jsesc: 0.5.0 dev: true /replace-in-file@6.3.5: @@ -10606,6 +10940,10 @@ packages: path-is-absolute: 1.0.1 dev: true + /resolve-pkg-maps@1.0.0: + resolution: {integrity: sha512-seS2Tj26TBVOC2NIc2rOe2y2ZO7efxITtLZcGSOnHHNOQ7CkiUBfw0Iw2ck6xkIhPwLhKNLS8BO+hEpngQlqzw==} + dev: true + /resolve@1.22.8: resolution: {integrity: sha512-oKWePCxqpd6FlLvGV1VU0x7bkPmmCNolxzjMf4NczoDnQcIWrAF+cPtZn5i6n+RfD2d9i0tzpKnG6Yk168yIyw==} hasBin: true @@ -10614,15 +10952,6 @@ packages: path-parse: 1.0.7 supports-preserve-symlinks-flag: 1.0.0 - /resolve@2.0.0-next.5: - resolution: {integrity: sha512-U7WjGVG9sH8tvjW5SmGbQuui75FiyjAX72HX15DwBBwF9dNiQZRQAg9nnPhYy+TUnE0+VcrttuvNI8oSxZcocA==} - hasBin: true - dependencies: - is-core-module: 2.13.1 - path-parse: 1.0.7 - supports-preserve-symlinks-flag: 1.0.0 - dev: true - /restore-cursor@3.1.0: resolution: {integrity: sha512-l+sSefzHpj5qimhFSE5a8nufZYAM3sBSVMAPtYkmC+4EH2anSGaEMXSD0izRQbu9nfyQ9y5JrVmp7E8oZrUjvA==} engines: {node: '>=8'} @@ -10656,7 +10985,7 @@ packages: dependencies: glob: 7.2.3 - /rollup-plugin-typescript2@0.34.1(rollup@4.8.0)(typescript@4.9.5): + /rollup-plugin-typescript2@0.34.1(rollup@4.8.0)(typescript@5.4.4): resolution: {integrity: sha512-P4cHLtGikESmqi1CA+tdMDUv8WbQV48mzPYt77TSTOPJpERyZ9TXdDgjSDix8Fkqce6soYz3+fa4lrC93IEkcw==} peerDependencies: rollup: '>=1.26.3' @@ -10668,7 +10997,7 @@ packages: rollup: 4.8.0 semver: 7.5.4 tslib: 2.6.2 - typescript: 4.9.5 + typescript: 5.4.4 dev: true /rollup-plugin-visualizer@5.9.2(rollup@4.8.0): @@ -10749,30 +11078,12 @@ packages: dependencies: mri: 1.2.0 - /safe-array-concat@1.0.1: - resolution: {integrity: sha512-6XbUAseYE2KtOuGueyeobCySj9L4+66Tn6KQMOPQJrAJEowYKW/YR/MGJZl7FdydUdaFu4LYyDZjxf4/Nmo23Q==} - engines: {node: '>=0.4'} - dependencies: - call-bind: 1.0.5 - get-intrinsic: 1.2.2 - has-symbols: 1.0.3 - isarray: 2.0.5 - dev: true - /safe-buffer@5.1.2: resolution: {integrity: sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==} /safe-buffer@5.2.1: resolution: {integrity: sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==} - /safe-regex-test@1.0.0: - resolution: {integrity: sha512-JBUUzyOgEwXQY1NuPtvcj/qcBDbDmEvWufhlnXZIm75DEHp+afM1r1ujJpJsV/gSM4t59tpDyPi1sd6ZaPFfsA==} - dependencies: - call-bind: 1.0.5 - get-intrinsic: 1.2.2 - is-regex: 1.1.4 - dev: true - /safer-buffer@2.1.2: resolution: {integrity: sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==} @@ -10852,6 +11163,14 @@ packages: dependencies: lru-cache: 6.0.0 + /semver@7.6.0: + resolution: {integrity: sha512-EnwXhrlwXMk9gKu5/flx5sv/an57AkRplG3hTK68W7FRDN+k+OWBj65M7719OkA82XLBxrcX0KSHj+X5COhOVg==} + engines: {node: '>=10'} + hasBin: true + dependencies: + lru-cache: 6.0.0 + dev: true + /send@0.18.0: resolution: {integrity: sha512-qqWzuOjSFOuqPjFe4NOsMLafToQQwBSOEpS+FwEt3A2V3vKubTquT3vmLTQpFgMXp8AlFWFuP1qKaJZOtPpVXg==} engines: {node: '>= 0.8.0'} @@ -10917,15 +11236,6 @@ packages: has-property-descriptors: 1.0.1 dev: true - /set-function-name@2.0.1: - resolution: {integrity: sha512-tMNCiqYVkXIZgc2Hnoy2IvC/f8ezc5koaRFkCjrpWzGpCd3qbZXPzVy9MAZzK1ch/X0jvSkojys3oqJN0qCmdA==} - engines: {node: '>= 0.4'} - dependencies: - define-data-property: 1.1.1 - functions-have-names: 1.2.3 - has-property-descriptors: 1.0.1 - dev: true - /setprototypeof@1.1.0: resolution: {integrity: sha512-BvE/TwpZX4FXExxOxZyRGQQv651MSwmWKZGqvmPcRIjDqWub67kTKuIMx43cZZrS/cBBzwBcNDWoFxt2XEFIpQ==} dev: true @@ -11138,6 +11448,13 @@ packages: spdx-exceptions: 2.3.0 spdx-license-ids: 3.0.16 + /spdx-expression-parse@4.0.0: + resolution: {integrity: sha512-Clya5JIij/7C6bRR22+tnGXbc4VKlibKSVj2iHvVeX5iMW7s1SIQlqu699JkODJJIhh/pUu8L0/VLh8xflD+LQ==} + dependencies: + spdx-exceptions: 2.3.0 + spdx-license-ids: 3.0.16 + dev: true + /spdx-license-ids@3.0.16: resolution: {integrity: sha512-eWN+LnM3GR6gPu35WxNgbGl8rmY1AEmoMDvL/QD6zYmPWgywxWqJWNdLGT+ke8dKNWrcYgYjPpG5gbTfghP8rw==} @@ -11236,31 +11553,6 @@ packages: emoji-regex: 9.2.2 strip-ansi: 7.1.0 - /string.prototype.trim@1.2.8: - resolution: {integrity: sha512-lfjY4HcixfQXOfaqCvcBuOIapyaroTXhbkfJN3gcB1OtyupngWK4sEET9Knd0cXd28kTUqu/kHoV4HKSJdnjiQ==} - engines: {node: '>= 0.4'} - dependencies: - call-bind: 1.0.5 - define-properties: 1.2.1 - es-abstract: 1.22.3 - dev: true - - /string.prototype.trimend@1.0.7: - resolution: {integrity: sha512-Ni79DqeB72ZFq1uH/L6zJ+DKZTkOtPIHovb3YZHQViE+HDouuU4mBrLOLDn5Dde3RF8qw5qVETEjhu9locMLvA==} - dependencies: - call-bind: 1.0.5 - define-properties: 1.2.1 - es-abstract: 1.22.3 - dev: true - - /string.prototype.trimstart@1.0.7: - resolution: {integrity: sha512-NGhtDFu3jCEm7B4Fy0DpLewdJQOZcQ0rGbwQ/+stjnrp2i+rlKeCvos9hOIeCmqwratM47OBxY7uFZzjxHXmrg==} - dependencies: - call-bind: 1.0.5 - define-properties: 1.2.1 - es-abstract: 1.22.3 - dev: true - /string_decoder@1.1.1: resolution: {integrity: sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==} dependencies: @@ -11288,11 +11580,6 @@ packages: engines: {node: '>=0.10.0'} dev: false - /strip-bom@3.0.0: - resolution: {integrity: sha512-vavAMRXOgBVNF6nyEEmL3DBK19iRpDcoIwW+swQ+CbGiu7lju6t+JklA1MHweoWtadgt4ISVUsXLyDq34ddcwA==} - engines: {node: '>=4'} - dev: true - /strip-final-newline@2.0.0: resolution: {integrity: sha512-BrpvfNAE3dcvq7ll3xVumzjKjZQ5tI1sEUIKr3Uoks0XUl45St3FlatVqef9prk4jRDzhW6WZg+3bk93y6pLjA==} engines: {node: '>=6'} @@ -11384,8 +11671,8 @@ packages: picocolors: 1.0.0 sade: 1.8.1 svelte: 3.59.2 - svelte-preprocess: 4.10.7(postcss@8.4.31)(svelte@3.59.2)(typescript@4.9.5) - typescript: 4.9.5 + svelte-preprocess: 4.10.7(postcss@8.4.31)(svelte@3.59.2)(typescript@5.4.4) + typescript: 5.4.4 transitivePeerDependencies: - '@babel/core' - coffeescript @@ -11408,6 +11695,15 @@ packages: svelte: 3.59.2 dev: true + /svelte-hmr@0.15.3(svelte@4.2.12): + resolution: {integrity: sha512-41snaPswvSf8TJUhlkoJBekRrABDXDMdpNpT2tfHIv4JuhgvHqLMhEPGtaQn0BmbNSTkuz2Ed20DF2eHw0SmBQ==} + engines: {node: ^12.20 || ^14.13.1 || >= 16} + peerDependencies: + svelte: ^3.19.0 || ^4.0.0 + dependencies: + svelte: 4.2.12 + dev: true + /svelte-hmr@0.15.3(svelte@4.2.7): resolution: {integrity: sha512-41snaPswvSf8TJUhlkoJBekRrABDXDMdpNpT2tfHIv4JuhgvHqLMhEPGtaQn0BmbNSTkuz2Ed20DF2eHw0SmBQ==} engines: {node: ^12.20 || ^14.13.1 || >= 16} @@ -11417,7 +11713,7 @@ packages: svelte: 4.2.7 dev: true - /svelte-preprocess@4.10.7(postcss@8.4.31)(svelte@3.59.2)(typescript@4.9.5): + /svelte-preprocess@4.10.7(postcss@8.4.31)(svelte@3.59.2)(typescript@5.4.4): resolution: {integrity: sha512-sNPBnqYD6FnmdBrUmBCaqS00RyCsCpj2BG58A1JBswNF7b0OKviwxqVrOL/CKyJrLSClrSeqQv5BXNg2RUbPOw==} engines: {node: '>= 9.11.2'} requiresBuild: true @@ -11466,26 +11762,25 @@ packages: sorcery: 0.10.0 strip-indent: 3.0.0 svelte: 3.59.2 - typescript: 4.9.5 + typescript: 5.4.4 dev: true - /svelte-preprocess@4.10.7(postcss@8.4.31)(svelte@4.2.7)(typescript@4.9.5): - resolution: {integrity: sha512-sNPBnqYD6FnmdBrUmBCaqS00RyCsCpj2BG58A1JBswNF7b0OKviwxqVrOL/CKyJrLSClrSeqQv5BXNg2RUbPOw==} - engines: {node: '>= 9.11.2'} + /svelte-preprocess@5.1.0(postcss@8.4.31)(svelte@4.2.7)(typescript@5.4.4): + resolution: {integrity: sha512-EkErPiDzHAc0k2MF5m6vBNmRUh338h2myhinUw/xaqsLs7/ZvsgREiLGj03VrSzbY/TB5ZXgBOsKraFee5yceA==} + engines: {node: '>= 14.10.0'} requiresBuild: true peerDependencies: '@babel/core': ^7.10.2 coffeescript: ^2.5.1 less: ^3.11.3 || ^4.0.0 - node-sass: '*' postcss: ^7 || ^8 postcss-load-config: ^2.1.0 || ^3.0.0 || ^4.0.0 pug: ^3.0.0 sass: ^1.26.8 stylus: ^0.55.0 - sugarss: ^2.0.0 - svelte: ^3.23.0 - typescript: ^3.9.5 || ^4.0.0 + sugarss: ^2.0.0 || ^3.0.0 || ^4.0.0 + svelte: ^3.23.0 || ^4.0.0-next.0 || ^4.0.0 || ^5.0.0-next.0 + typescript: '>=3.9.5 || ^4.0.0 || ^5.0.0' peerDependenciesMeta: '@babel/core': optional: true @@ -11493,8 +11788,6 @@ packages: optional: true less: optional: true - node-sass: - optional: true postcss: optional: true postcss-load-config: @@ -11511,26 +11804,25 @@ packages: optional: true dependencies: '@types/pug': 2.0.10 - '@types/sass': 1.45.0 detect-indent: 6.1.0 - magic-string: 0.25.9 + magic-string: 0.27.0 postcss: 8.4.31 - sorcery: 0.10.0 + sorcery: 0.11.0 strip-indent: 3.0.0 svelte: 4.2.7 - typescript: 4.9.5 + typescript: 5.4.4 dev: true - /svelte-preprocess@5.1.0(postcss@8.4.31)(svelte@4.2.7)(typescript@4.9.5): - resolution: {integrity: sha512-EkErPiDzHAc0k2MF5m6vBNmRUh338h2myhinUw/xaqsLs7/ZvsgREiLGj03VrSzbY/TB5ZXgBOsKraFee5yceA==} - engines: {node: '>= 14.10.0'} + /svelte-preprocess@5.1.3(postcss@8.4.31)(svelte@4.2.12)(typescript@5.4.4): + resolution: {integrity: sha512-xxAkmxGHT+J/GourS5mVJeOXZzne1FR5ljeOUAMXUkfEhkLEllRreXpbl3dIYJlcJRfL1LO1uIAPpBpBfiqGPw==} + engines: {node: '>= 16.0.0', pnpm: ^8.0.0} requiresBuild: true peerDependencies: '@babel/core': ^7.10.2 coffeescript: ^2.5.1 less: ^3.11.3 || ^4.0.0 postcss: ^7 || ^8 - postcss-load-config: ^2.1.0 || ^3.0.0 || ^4.0.0 + postcss-load-config: ^2.1.0 || ^3.0.0 || ^4.0.0 || ^5.0.0 pug: ^3.0.0 sass: ^1.26.8 stylus: ^0.55.0 @@ -11561,12 +11853,12 @@ packages: dependencies: '@types/pug': 2.0.10 detect-indent: 6.1.0 - magic-string: 0.27.0 + magic-string: 0.30.5 postcss: 8.4.31 sorcery: 0.11.0 strip-indent: 3.0.0 - svelte: 4.2.7 - typescript: 4.9.5 + svelte: 4.2.12 + typescript: 5.4.4 dev: true /svelte@3.59.2: @@ -11574,6 +11866,26 @@ packages: engines: {node: '>= 8'} dev: true + /svelte@4.2.12: + resolution: {integrity: sha512-d8+wsh5TfPwqVzbm4/HCXC783/KPHV60NvwitJnyTA5lWn1elhXMNWhXGCJ7PwPa8qFUnyJNIyuIRt2mT0WMug==} + engines: {node: '>=16'} + dependencies: + '@ampproject/remapping': 2.2.1 + '@jridgewell/sourcemap-codec': 1.4.15 + '@jridgewell/trace-mapping': 0.3.20 + '@types/estree': 1.0.5 + acorn: 8.11.3 + aria-query: 5.3.0 + axobject-query: 4.0.0 + code-red: 1.0.4 + css-tree: 2.3.1 + estree-walker: 3.0.3 + is-reference: 3.0.2 + locate-character: 3.0.0 + magic-string: 0.30.5 + periscopic: 3.1.0 + dev: true + /svelte@4.2.7: resolution: {integrity: sha512-UExR1KS7raTdycsUrKLtStayu4hpdV3VZQgM0akX8XbXgLBlosdE/Sf3crOgyh9xIjqSYB3UEBuUlIQKRQX2hg==} engines: {node: '>=16'} @@ -11611,6 +11923,13 @@ packages: /symbol-tree@3.2.4: resolution: {integrity: sha512-9QNk5KwDF+Bvz+PyObkmSYjI5ksVUYtjW7AU22r2NKcfLJcXp96hkDWU3+XndOsUb+AQ9QhfzfCT2O+CNWT5Tw==} + /synckit@0.6.2: + resolution: {integrity: sha512-Vhf+bUa//YSTYKseDiiEuQmhGCoIF3CVBhunm3r/DQnYiGT4JssmnKQc44BIyOZRK2pKjXXAgbhfmbeoC9CJpA==} + engines: {node: '>=12.20'} + dependencies: + tslib: 2.6.2 + dev: true + /tailwind-config-viewer@1.7.3(tailwindcss@3.3.5): resolution: {integrity: sha512-rgeFXe9vL4njtaSI1y2uUAD1aRx05RYHbReN72ARAVEVSlNmS0Zf46pj3/ORc3xQwLK/AzbaIs6UFcK7hJSIlA==} engines: {node: '>=8'} @@ -11662,11 +11981,6 @@ packages: - ts-node dev: true - /tapable@0.1.10: - resolution: {integrity: sha512-jX8Et4hHg57mug1/079yitEKWGB3LCwoxByLsNim89LABq8NqgiX+6iYVOsq0vX8uJHkU+DZ5fnq95f800bEsQ==} - engines: {node: '>=0.6'} - dev: true - /tapable@2.2.1: resolution: {integrity: sha512-GNzQvQTOIP6RyTfE2Qxb8ZVlNmw0n88vp1szwWRimP02mnTsx3Wtn5qRdqY9w2XduFNUgvOwhNnQsjwCp+kqaQ==} engines: {node: '>=6'} @@ -11801,6 +12115,13 @@ packages: resolution: {integrity: sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA==} engines: {node: '>=0.6'} + /toml-eslint-parser@0.9.3: + resolution: {integrity: sha512-moYoCvkNUAPCxSW9jmHmRElhm4tVJpHL8ItC/+uYD0EpPSFXbck7yREz9tNdJVTSpHVod8+HoipcpbQ0oE6gsw==} + engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} + dependencies: + eslint-visitor-keys: 3.4.3 + dev: true + /totalist@3.0.1: resolution: {integrity: sha512-sf4i37nQ2LBx4m3wB74y+ubopq6W/dIzXg0FDGjsYnZHVa1Da8FH853wlL2gtUhg+xJXjfk3kUZS3BRoQeoQBQ==} engines: {node: '>=6'} @@ -11842,21 +12163,17 @@ packages: hasBin: true dev: true - /ts-interface-checker@0.1.13: - resolution: {integrity: sha512-Y/arvbn+rrz3JCKl9C4kVNfTfSm2/mEp5FSz5EsZSANGPSlQrpRI5M4PKF+mJnE52jOO90PnPSc3Ur3bTQw0gA==} - dev: true - - /tsconfig-paths@3.14.2: - resolution: {integrity: sha512-o/9iXgCYc5L/JxCHPe3Hvh8Q/2xm5Z+p18PESBU6Ff33695QnCHBEjcytY2q19ua7Mbl/DavtBOLq+oG0RCL+g==} + /ts-api-utils@1.3.0(typescript@5.4.4): + resolution: {integrity: sha512-UQMIo7pb8WRomKR1/+MFVLTroIvDVtMX3K6OUir8ynLyzB8Jeriont2bTAtmNPa1ekAgN7YPDyf6V+ygrdU+eQ==} + engines: {node: '>=16'} + peerDependencies: + typescript: '>=4.2.0' dependencies: - '@types/json5': 0.0.29 - json5: 1.0.2 - minimist: 1.2.8 - strip-bom: 3.0.0 + typescript: 5.4.4 dev: true - /tslib@1.14.1: - resolution: {integrity: sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==} + /ts-interface-checker@0.1.13: + resolution: {integrity: sha512-Y/arvbn+rrz3JCKl9C4kVNfTfSm2/mEp5FSz5EsZSANGPSlQrpRI5M4PKF+mJnE52jOO90PnPSc3Ur3bTQw0gA==} dev: true /tslib@2.6.2: @@ -11867,16 +12184,6 @@ packages: engines: {node: '>=0.6.x'} dev: true - /tsutils@3.21.0(typescript@4.9.5): - resolution: {integrity: sha512-mHKK3iUXL+3UF6xL5k0PEhKRUBKPBCv/+RkEOpjRWxxx27KKRBmmA60A9pgOUvMi8GKhRMPEmjBRPzs2W7O1OA==} - engines: {node: '>= 6'} - peerDependencies: - typescript: '>=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta' - dependencies: - tslib: 1.14.1 - typescript: 4.9.5 - dev: true - /tuf-js@2.1.0: resolution: {integrity: sha512-eD7YPPjVlMzdggrOeE8zwoegUaG/rt6Bt3jwoQPunRiNVzgcCE009UDFJKJjG+Gk9wFu6W/Vi+P5d/5QpdD9jA==} engines: {node: ^16.14.0 || >=18.0.0} @@ -11911,11 +12218,22 @@ packages: /type-fest@0.20.2: resolution: {integrity: sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==} engines: {node: '>=10'} + dev: true /type-fest@0.21.3: resolution: {integrity: sha512-t0rzBq87m3fVcduHDUFhKmyyX+9eo6WQjZvf51Ea/M0Q7+T374Jp1aUiyUl0GKxp8M/OETVHSDvmkyPgvX+X2w==} engines: {node: '>=10'} + /type-fest@0.6.0: + resolution: {integrity: sha512-q+MB8nYR1KDLrgr4G5yemftpMC7/QLqVndBmEEdqzmNj5dcFOO4Oo8qlwZE3ULT3+Zim1F8Kq4cBnikNhlCMlg==} + engines: {node: '>=8'} + dev: true + + /type-fest@0.8.1: + resolution: {integrity: sha512-4dbzIzqvjtgiM5rw1k5rEHtBANKmdudhGyBEajN01fEyhaAIhsoKNy6y7+IN93IfpFtwY9iqi7kD+xwKhQsNJA==} + engines: {node: '>=8'} + dev: true + /type-fest@3.13.1: resolution: {integrity: sha512-tLq3bSNx+xSpwvAJnzrK0Ep5CLNWjvFTOp71URMaAEWBfRb9nnJiBoUe0tF8bI4ZFO3omgBR6NvnbzVUT3Ly4g==} engines: {node: '>=14.16'} @@ -11928,47 +12246,9 @@ packages: mime-types: 2.1.35 dev: true - /typed-array-buffer@1.0.0: - resolution: {integrity: sha512-Y8KTSIglk9OZEr8zywiIHG/kmQ7KWyjseXs1CbSo8vC42w7hg2HgYTxSWwP0+is7bWDc1H+Fo026CpHFwm8tkw==} - engines: {node: '>= 0.4'} - dependencies: - call-bind: 1.0.5 - get-intrinsic: 1.2.2 - is-typed-array: 1.1.12 - dev: true - - /typed-array-byte-length@1.0.0: - resolution: {integrity: sha512-Or/+kvLxNpeQ9DtSydonMxCx+9ZXOswtwJn17SNLvhptaXYDJvkFFP5zbfU/uLmvnBJlI4yrnXRxpdWH/M5tNA==} - engines: {node: '>= 0.4'} - dependencies: - call-bind: 1.0.5 - for-each: 0.3.3 - has-proto: 1.0.1 - is-typed-array: 1.1.12 - dev: true - - /typed-array-byte-offset@1.0.0: - resolution: {integrity: sha512-RD97prjEt9EL8YgAgpOkf3O4IF9lhJFr9g0htQkm0rchFp/Vx7LW5Q8fSXXub7BXAODyUQohRMyOc3faCPd0hg==} - engines: {node: '>= 0.4'} - dependencies: - available-typed-arrays: 1.0.5 - call-bind: 1.0.5 - for-each: 0.3.3 - has-proto: 1.0.1 - is-typed-array: 1.1.12 - dev: true - - /typed-array-length@1.0.4: - resolution: {integrity: sha512-KjZypGq+I/H7HI5HlOoGHkWUUGq+Q0TPhQurLbyrVrvnKTBgzLhIJ7j6J/XTQOi0d1RjyZ0wdas8bKs2p0x3Ng==} - dependencies: - call-bind: 1.0.5 - for-each: 0.3.3 - is-typed-array: 1.1.12 - dev: true - - /typescript@4.9.5: - resolution: {integrity: sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g==} - engines: {node: '>=4.2.0'} + /typescript@5.4.4: + resolution: {integrity: sha512-dGE2Vv8cpVvw28v8HCPqyb08EzbBURxDpuhJvTrusShUfGnhHBafDsLdS1EhhxyL6BJQE+2cT3dDPAv+MQ6oLw==} + engines: {node: '>=14.17'} hasBin: true /uc.micro@1.0.6: @@ -11981,15 +12261,6 @@ packages: /ultrahtml@1.5.2: resolution: {integrity: sha512-qh4mBffhlkiXwDAOxvSGxhL0QEQsTbnP9BozOK3OYPEGvPvdWzvAUaXNtUSMdNsKDtuyjEbyVUPFZ52SSLhLqw==} - /unbox-primitive@1.0.2: - resolution: {integrity: sha512-61pPlCD9h51VoreyJ0BReideM3MDKMKnh6+V9L08331ipq6Q8OFXZYiqP6n/tbHx4s5I9uRhcye6BrbkizkBDw==} - dependencies: - call-bind: 1.0.5 - has-bigints: 1.0.2 - has-symbols: 1.0.3 - which-boxed-primitive: 1.0.2 - dev: true - /unbzip2-stream@1.4.3: resolution: {integrity: sha512-mlExGW4w71ebDJviH16lQLtZS32VKqsSfk80GCfUlwT/4/hNRFsoscrF/c++9xinkMzECL1uL9DDwXqFWkruPg==} dependencies: @@ -12078,6 +12349,12 @@ packages: dependencies: imurmurhash: 0.1.4 + /unist-util-stringify-position@2.0.3: + resolution: {integrity: sha512-3faScn5I+hy9VleOq/qNbAd6pAx7iH5jYBMS9I1HgQVijz/4mv5Bvw5iw1sC/90CODiKo81G/ps8AJrISn687g==} + dependencies: + '@types/unist': 2.0.10 + dev: true + /universalify@0.2.0: resolution: {integrity: sha512-CJ1QgKmNg3CwvAv/kOFmtnEN05f0D/cn9QntgNOQlQF9dgvVTHj3t+8JPdjqawCHk7V/KA+fbUqzZ9XWhcqPUg==} engines: {node: '>= 4.0.0'} @@ -12248,6 +12525,17 @@ packages: escalade: 3.1.1 picocolors: 1.0.0 + /update-browserslist-db@1.0.13(browserslist@4.23.0): + resolution: {integrity: sha512-xebP81SNcPuNpPP3uzeW1NYXxI3rxyJzF3pD6sH4jE7o/IX+WtSpwnVU+qIsDPyk0d3hmFQ7mjqc6AtV604hbg==} + hasBin: true + peerDependencies: + browserslist: '>= 4.21.0' + dependencies: + browserslist: 4.23.0 + escalade: 3.1.1 + picocolors: 1.0.0 + dev: true + /upper-case-first@2.0.2: resolution: {integrity: sha512-514ppYHBaKwfJRK/pNC6c/OxfGa0obSnAl106u97Ed0I625Nin96KAjttZF6ZL3e1XLtphxnqrOi9iWgm+u+bg==} dependencies: @@ -12356,7 +12644,7 @@ packages: - supports-color - terser - /vite-plugin-checker@0.6.2(eslint@8.54.0)(typescript@4.9.5)(vite@4.5.1): + /vite-plugin-checker@0.6.2(eslint@9.0.0)(typescript@5.4.4)(vite@4.5.1): resolution: {integrity: sha512-YvvvQ+IjY09BX7Ab+1pjxkELQsBd4rPhWNw8WLBeFVxu/E7O+n6VYAqNsKdK/a2luFlX/sMpoWdGFfg4HvwdJQ==} engines: {node: '>=14.16'} peerDependencies: @@ -12392,7 +12680,7 @@ packages: chalk: 4.1.2 chokidar: 3.5.3 commander: 8.3.0 - eslint: 8.54.0 + eslint: 9.0.0 fast-glob: 3.3.2 fs-extra: 11.1.1 lodash.debounce: 4.0.8 @@ -12401,7 +12689,7 @@ packages: semver: 7.5.4 strip-ansi: 6.0.1 tiny-invariant: 1.3.1 - typescript: 4.9.5 + typescript: 5.4.4 vite: 4.5.1(@types/node@18.11.9) vscode-languageclient: 7.0.0 vscode-languageserver: 7.0.0 @@ -12507,7 +12795,7 @@ packages: debug: 4.3.4(supports-color@8.1.1) upath: 2.0.1 vite: 5.0.11(@types/node@18.11.9) - vuetify: 3.4.6(typescript@4.9.5)(vite-plugin-vuetify@1.0.2)(vue@3.3.11) + vuetify: 3.4.6(typescript@5.4.4)(vite-plugin-vuetify@1.0.2)(vue@3.3.11) transitivePeerDependencies: - supports-color - vue @@ -12662,7 +12950,7 @@ packages: vite: 5.0.11(@types/node@18.11.9) dev: true - /vitepress@1.0.0-alpha.10(search-insights@2.13.0)(typescript@4.9.5): + /vitepress@1.0.0-alpha.10(search-insights@2.13.0)(typescript@5.4.4): resolution: {integrity: sha512-RGPU+YApj2jaYplAIJUe+2qlDks9FzPX1QGK+7NdGByeCCVZg6z9eYWjjvfvA/sgCtG3yeJE/4/jCwlv4Y8bVw==} hasBin: true dependencies: @@ -12674,7 +12962,7 @@ packages: body-scroll-lock: 4.0.0-beta.0 shiki: 0.11.1 vite: 3.2.7 - vue: 3.3.11(typescript@4.9.5) + vue: 3.3.11(typescript@5.4.4) transitivePeerDependencies: - '@algolia/client-search' - '@types/node' @@ -12887,7 +13175,7 @@ packages: vue: optional: true dependencies: - vue: 3.3.11(typescript@4.9.5) + vue: 3.3.11(typescript@5.4.4) dev: true /vue-demi@0.14.6(vue@3.3.8): @@ -12904,14 +13192,14 @@ packages: vue: optional: true dependencies: - vue: 3.3.8(typescript@4.9.5) + vue: 3.3.8(typescript@5.4.4) /vue-devtools-stub@0.1.0: resolution: {integrity: sha512-RutnB7X8c5hjq39NceArgXg28WZtZpGc3+J16ljMiYnFhKvd8hITxSWQSQ5bvldxMDU6gG5mkxl1MTQLXckVSQ==} - /vue-eslint-parser@8.3.0(eslint@8.54.0): - resolution: {integrity: sha512-dzHGG3+sYwSf6zFBa0Gi9ZDshD7+ad14DGOdTLjruRVgZXe2J+DcZ9iUhyR48z5g1PqRa20yt3Njna/veLJL/g==} - engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} + /vue-eslint-parser@9.3.2(eslint@9.0.0): + resolution: {integrity: sha512-q7tWyCVaV9f8iQyIA5Mkj/S6AoJ9KBN8IeUSf3XEmBrOtxOZnfTg5s4KClbZBCK3GtnT/+RyCLZyDHuZwTuBjg==} + engines: {node: ^14.17.0 || >=16.0.0} peerDependencies: eslint: '*' peerDependenciesMeta: @@ -12919,7 +13207,7 @@ packages: optional: true dependencies: debug: 4.3.4(supports-color@8.1.1) - eslint: 8.54.0 + eslint: 9.0.0 eslint-scope: 7.2.2 eslint-visitor-keys: 3.4.3 espree: 9.6.1 @@ -12930,8 +13218,8 @@ packages: - supports-color dev: true - /vue-eslint-parser@9.3.2(eslint@8.54.0): - resolution: {integrity: sha512-q7tWyCVaV9f8iQyIA5Mkj/S6AoJ9KBN8IeUSf3XEmBrOtxOZnfTg5s4KClbZBCK3GtnT/+RyCLZyDHuZwTuBjg==} + /vue-eslint-parser@9.4.2(eslint@9.0.0): + resolution: {integrity: sha512-Ry9oiGmCAK91HrKMtCrKFWmSFWvYkpGglCeFAIqDdr9zdXmMMpJOmUJS7WWsW7fX81h6mwHmUZCQQ1E0PkSwYQ==} engines: {node: ^14.17.0 || >=16.0.0} peerDependencies: eslint: '*' @@ -12940,7 +13228,7 @@ packages: optional: true dependencies: debug: 4.3.4(supports-color@8.1.1) - eslint: 8.54.0 + eslint: 9.0.0 eslint-scope: 7.2.2 eslint-visitor-keys: 3.4.3 espree: 9.6.1 @@ -12959,7 +13247,7 @@ packages: vue: optional: true dependencies: - vue: 3.3.8(typescript@4.9.5) + vue: 3.3.8(typescript@5.4.4) dev: true /vue-router@4.2.5(vue@3.3.11): @@ -12971,7 +13259,7 @@ packages: optional: true dependencies: '@vue/devtools-api': 6.5.1 - vue: 3.3.11(typescript@4.9.5) + vue: 3.3.11(typescript@5.4.4) dev: false /vue-router@4.2.5(vue@3.3.8): @@ -12983,7 +13271,7 @@ packages: optional: true dependencies: '@vue/devtools-api': 6.5.1 - vue: 3.3.8(typescript@4.9.5) + vue: 3.3.8(typescript@5.4.4) dev: true /vue-template-compiler@2.7.15: @@ -12993,16 +13281,16 @@ packages: he: 1.2.0 dev: true - /vue-tsc@1.8.22(typescript@4.9.5): - resolution: {integrity: sha512-j9P4kHtW6eEE08aS5McFZE/ivmipXy0JzrnTgbomfABMaVKx37kNBw//irL3+LlE3kOo63XpnRigyPC3w7+z+A==} + /vue-tsc@2.0.11(typescript@5.4.4): + resolution: {integrity: sha512-dl5MEU4VGZdQFGBnKfPpAfV3SQmBDWs9o4YhUPvDmwk+zmb/RprzFJK2sagR6EWazogZhXENvykd3wBXWS9kng==} hasBin: true peerDependencies: typescript: '*' dependencies: - '@volar/typescript': 1.10.10 - '@vue/language-core': 1.8.22(typescript@4.9.5) + '@volar/typescript': 2.2.0-alpha.6 + '@vue/language-core': 2.0.11(typescript@5.4.4) semver: 7.5.4 - typescript: 4.9.5 + typescript: 5.4.4 dev: true /vue@2.7.15: @@ -13011,7 +13299,7 @@ packages: '@vue/compiler-sfc': 2.7.15 csstype: 3.1.2 - /vue@3.3.11(typescript@4.9.5): + /vue@3.3.11(typescript@5.4.4): resolution: {integrity: sha512-d4oBctG92CRO1cQfVBZp6WJAs0n8AK4Xf5fNjQCBeKCvMI1efGQ5E3Alt1slFJS9fZuPcFoiAiqFvQlv1X7t/w==} peerDependencies: typescript: '*' @@ -13024,9 +13312,9 @@ packages: '@vue/runtime-dom': 3.3.11 '@vue/server-renderer': 3.3.11(vue@3.3.11) '@vue/shared': 3.3.11 - typescript: 4.9.5 + typescript: 5.4.4 - /vue@3.3.8(typescript@4.9.5): + /vue@3.3.8(typescript@5.4.4): resolution: {integrity: sha512-5VSX/3DabBikOXMsxzlW8JyfeLKlG9mzqnWgLQLty88vdZL7ZJgrdgBOmrArwxiLtmS+lNNpPcBYqrhE6TQW5w==} peerDependencies: typescript: '*' @@ -13039,9 +13327,9 @@ packages: '@vue/runtime-dom': 3.3.8 '@vue/server-renderer': 3.3.8(vue@3.3.8) '@vue/shared': 3.3.8 - typescript: 4.9.5 + typescript: 5.4.4 - /vuetify@3.4.6(typescript@4.9.5)(vite-plugin-vuetify@1.0.2)(vue@3.3.11): + /vuetify@3.4.6(typescript@5.4.4)(vite-plugin-vuetify@1.0.2)(vue@3.3.11): resolution: {integrity: sha512-Zp6BjKkNcnyHlOmr01Y/Rc4d686PORO+hcpfM76qRaDMIU4H1GnP0JIF3jwxI1q3Uj/2bHKLwn81oCLJZd+8sg==} engines: {node: ^12.20 || >=14.13} peerDependencies: @@ -13062,9 +13350,9 @@ packages: webpack-plugin-vuetify: optional: true dependencies: - typescript: 4.9.5 + typescript: 5.4.4 vite-plugin-vuetify: 1.0.2(vite@5.0.11)(vue@3.3.11)(vuetify@3.4.6) - vue: 3.3.11(typescript@4.9.5) + vue: 3.3.11(typescript@5.4.4) /w3c-keyname@2.2.8: resolution: {integrity: sha512-dpojBhNsCNN7T82Tm7k26A6G9ML3NkhDsnw9n/eoxSRlVBB4CEtIQ/KTCLI2Fwf3ataSXRhYFkQi3SlnFwPvPQ==} @@ -13140,27 +13428,6 @@ packages: tr46: 0.0.3 webidl-conversions: 3.0.1 - /which-boxed-primitive@1.0.2: - resolution: {integrity: sha512-bwZdv0AKLpplFY2KZRX6TvyuN7ojjr7lwkg6ml0roIy9YeuSr7JS372qlNW18UQYzgYK9ziGcerWqZOmEn9VNg==} - dependencies: - is-bigint: 1.0.4 - is-boolean-object: 1.1.2 - is-number-object: 1.0.7 - is-string: 1.0.7 - is-symbol: 1.0.4 - dev: true - - /which-typed-array@1.1.13: - resolution: {integrity: sha512-P5Nra0qjSncduVPEAr7xhoF5guty49ArDTwzJ/yNuPIbZppyRxFQsRCWrocxIY+CnMVG+qfbU2FmDKyvSGClow==} - engines: {node: '>= 0.4'} - dependencies: - available-typed-arrays: 1.0.5 - call-bind: 1.0.5 - for-each: 0.3.3 - gopd: 1.0.1 - has-tostringtag: 1.0.0 - dev: true - /which@2.0.2: resolution: {integrity: sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==} engines: {node: '>= 8'} @@ -13272,6 +13539,15 @@ packages: /yallist@4.0.0: resolution: {integrity: sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==} + /yaml-eslint-parser@1.2.2: + resolution: {integrity: sha512-pEwzfsKbTrB8G3xc/sN7aw1v6A6c/pKxLAkjclnAyo5g5qOh6eL9WGu0o3cSDQZKrTNk4KL4lQSwZW+nBkANEg==} + engines: {node: ^14.17.0 || >=16.0.0} + dependencies: + eslint-visitor-keys: 3.4.3 + lodash: 4.17.21 + yaml: 2.3.4 + dev: true + /yaml@1.10.2: resolution: {integrity: sha512-r3vXyErRCYJ7wg28yvBY5VSoAF8ZvlcW9/BwUzEtUsjvX/DKs24dIkuwjtuprwJJHsbyUbLApepYTR1BN4uHrg==} engines: {node: '>= 6'} diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yaml index dd8cb518..46ce442b 100644 --- a/pnpm-workspace.yaml +++ b/pnpm-workspace.yaml @@ -1,4 +1,4 @@ packages: - 'packages/*' - 'examples/*' - - 'docs' + - docs diff --git a/tailwind.config.cjs b/tailwind.config.cjs index 1e1bbeda..38747a19 100644 --- a/tailwind.config.cjs +++ b/tailwind.config.cjs @@ -1,6 +1,3 @@ -// @ts-nocheck -/* eslint-disable @typescript-eslint/no-var-requires */ - const defaultTheme = require('tailwindcss/defaultTheme') const colors = require('tailwindcss/colors') @@ -36,17 +33,17 @@ module.exports = { screens: Object.keys(defaultTheme.screens).reduce((obj, key) => { const [rawMin] = defaultTheme.screens[key].split('px') - const max = parseInt(rawMin) - 1 + const max = Number.parseInt(rawMin) - 1 obj[`!${key}`] = { max: `${max}px` } return obj }, {}), borderRadius: { - sm: '0.25rem', - DEFAULT: '0.375rem', - md: '0.5rem', - lg: '0.75rem', - xl: '1rem', + 'sm': '0.25rem', + 'DEFAULT': '0.375rem', + 'md': '0.5rem', + 'lg': '0.75rem', + 'xl': '1rem', '2xl': '1.5rem', '3xl': '2rem', },