Compare commits

...

3 Commits

Author SHA1 Message Date
2e4a711a67 Merge pull request 'feature/setup-stotybook' (#11) from feature/setup-stotybook into main
Some checks failed
Build / build (push) Has been cancelled
Deploy Pipeline / pipeline (push) Has been cancelled
Lint / Lint Code (push) Has been cancelled
Test / Svelte Checks (push) Has been cancelled
Reviewed-on: #11
2026-01-06 06:19:35 +00:00
Ilia Mashkov
73419799ae feat(ComboControl): create stories for ComboControl component
Some checks failed
Lint / Lint Code (push) Failing after 7m10s
Test / Svelte Checks (push) Failing after 7m17s
Build / build (pull_request) Failing after 7m20s
Lint / Lint Code (pull_request) Failing after 7m16s
Test / Svelte Checks (pull_request) Failing after 7m14s
2026-01-06 09:16:21 +03:00
Ilia Mashkov
917b303240 feat: setup storybook for glyphdiff project 2026-01-05 14:43:19 +03:00
9 changed files with 1464 additions and 18 deletions

3
.gitignore vendored
View File

@@ -34,3 +34,6 @@ vite.config.ts.timestamp-*
/docs
AGENTS.md
*storybook.log
storybook-static

22
.storybook/main.ts Normal file
View File

@@ -0,0 +1,22 @@
import type { StorybookConfig } from '@storybook/svelte-vite';
const config: StorybookConfig = {
'stories': [
'../src/**/*.mdx',
'../src/**/*.stories.@(js|ts|svelte)',
],
'addons': [
{
name: '@storybook/addon-svelte-csf',
options: {
legacyTemplate: true, // Enables the legacy template syntax
},
},
'@chromatic-com/storybook',
'@storybook/addon-vitest',
'@storybook/addon-a11y',
'@storybook/addon-docs',
],
'framework': '@storybook/svelte-vite',
};
export default config;

23
.storybook/preview.ts Normal file
View File

@@ -0,0 +1,23 @@
import type { Preview } from '@storybook/svelte-vite';
import '../src/app/styles/app.css';
const preview: Preview = {
parameters: {
controls: {
matchers: {
color: /(background|color)$/i,
date: /Date$/i,
},
},
a11y: {
// 'todo' - show a11y violations in the test UI only
// 'error' - fail CI on a11y violations
// 'off' - skip a11y checks entirely
test: 'todo',
},
},
};
export default preview;

View File

@@ -0,0 +1,7 @@
import * as a11yAddonAnnotations from '@storybook/addon-a11y/preview';
import { setProjectAnnotations } from '@storybook/svelte-vite';
import * as projectAnnotations from './preview';
// This is an important step to apply the right configuration when testing your stories.
// More info at: https://storybook.js.org/docs/api/portable-stories/portable-stories-vitest#setprojectannotations
setProjectAnnotations([a11yAddonAnnotations, projectAnnotations]);

View File

@@ -15,20 +15,32 @@
"format": "dprint fmt",
"format:check": "dprint check",
"test:e2e": "playwright test",
"test": "npm run test:e2e"
"test": "npm run test:e2e",
"storybook": "storybook dev -p 6006",
"build-storybook": "storybook build"
},
"devDependencies": {
"@chromatic-com/storybook": "^4.1.3",
"@internationalized/date": "^3.10.0",
"@lucide/svelte": "^0.561.0",
"@playwright/test": "^1.57.0",
"@storybook/addon-a11y": "^10.1.11",
"@storybook/addon-docs": "^10.1.11",
"@storybook/addon-svelte-csf": "^5.0.10",
"@storybook/addon-vitest": "^10.1.11",
"@storybook/svelte-vite": "^10.1.11",
"@sveltejs/vite-plugin-svelte": "^6.2.1",
"@tailwindcss/vite": "^4.1.18",
"@tsconfig/svelte": "^5.0.6",
"@vitest/browser-playwright": "^4.0.16",
"@vitest/coverage-v8": "^4.0.16",
"bits-ui": "^2.14.4",
"clsx": "^2.1.1",
"dprint": "^0.50.2",
"lefthook": "^2.0.13",
"oxlint": "^1.35.0",
"playwright": "^1.57.0",
"storybook": "^10.1.11",
"svelte": "^5.45.6",
"svelte-check": "^4.3.4",
"svelte-language-server": "^0.17.23",
@@ -37,6 +49,7 @@
"tailwindcss": "^4.1.18",
"tw-animate-css": "^1.4.0",
"typescript": "^5.9.3",
"vite": "^7.2.6"
"vite": "^7.2.6",
"vitest": "^4.0.16"
}
}

View File

@@ -0,0 +1,64 @@
<script module>
import { defineMeta } from '@storybook/addon-svelte-csf';
const { Story } = defineMeta({
title: 'Shared/UI/ComboControl',
component: ComboControl,
tags: ['autodocs'],
argTypes: {
value: { control: 'number' },
minValue: { control: 'number' },
maxValue: { control: 'number' },
step: { control: 'number' },
increaseDisabled: { control: 'boolean' },
decreaseDisabled: { control: 'boolean' },
onChange: { action: 'onChange' },
onIncrease: { action: 'onIncrease' },
onDecrease: { action: 'onDecrease' },
},
});
</script>
<script lang="ts">
import ComboControl from './ComboControl.svelte';
let integerStep = 1;
let decimalStep = 0.05;
let integerValue = 16;
let decimalValue = 1.5;
let integerMinValue = 8;
let decimalMinValue = 1;
let integerMaxValue = 100;
let decimalMaxValue = 2;
function onChange() {}
function onIncrease() {}
function onDecrease() {}
</script>
<Story name="Integer Step">
<ComboControl
value={integerValue}
step={integerStep}
onChange={onChange}
onIncrease={onIncrease}
onDecrease={onDecrease}
minValue={integerMinValue}
maxValue={integerMaxValue}
/>
</Story>
<Story name="Decimal Step">
<ComboControl
value={decimalValue}
step={decimalStep}
onChange={onChange}
onIncrease={onIncrease}
onDecrease={onDecrease}
minValue={decimalMinValue}
maxValue={decimalMaxValue}
/>
</Story>

View File

@@ -4,7 +4,7 @@ const config = {
preprocess: vitePreprocess(),
compilerOptions: {
runes: true,
runes: undefined,
},
};

1
vitest.shims.d.ts vendored Normal file
View File

@@ -0,0 +1 @@
/// <reference types="@vitest/browser-playwright" />

1343
yarn.lock

File diff suppressed because it is too large Load Diff