create-rslib 0.8.0 → 0.9.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (81) hide show
  1. package/README.md +3 -3
  2. package/dist/index.js +64 -5
  3. package/package.json +5 -5
  4. package/template-[node-dual]-[]-ts/package.json +1 -1
  5. package/template-[node-dual]-[vitest]-ts/package.json +1 -1
  6. package/template-[node-esm]-[]-ts/package.json +1 -1
  7. package/template-[node-esm]-[vitest]-ts/package.json +1 -1
  8. package/template-[react]-[]-ts/package.json +1 -1
  9. package/template-[react]-[storybook,vitest]-js/package.json +1 -1
  10. package/template-[react]-[storybook,vitest]-ts/package.json +2 -2
  11. package/template-[react]-[storybook]-js/package.json +1 -1
  12. package/template-[react]-[storybook]-ts/package.json +2 -2
  13. package/template-[react]-[vitest]-ts/package.json +1 -1
  14. package/template-[vue]-[]-js/package.json +27 -0
  15. package/template-[vue]-[]-js/rslib.config.ts +15 -0
  16. package/template-[vue]-[]-js/src/Button.vue +43 -0
  17. package/template-[vue]-[]-js/src/index.js +1 -0
  18. package/template-[vue]-[]-js/src/style.css +34 -0
  19. package/template-[vue]-[]-ts/package.json +29 -0
  20. package/template-[vue]-[]-ts/rslib.config.ts +15 -0
  21. package/template-[vue]-[]-ts/src/Button.vue +35 -0
  22. package/template-[vue]-[]-ts/src/index.ts +1 -0
  23. package/template-[vue]-[]-ts/src/style.css +34 -0
  24. package/template-[vue]-[]-ts/tsconfig.json +25 -0
  25. package/template-[vue]-[storybook,vitest]-js/.storybook/main.js +37 -0
  26. package/template-[vue]-[storybook,vitest]-js/.storybook/preview.js +12 -0
  27. package/template-[vue]-[storybook,vitest]-js/package.json +46 -0
  28. package/template-[vue]-[storybook,vitest]-js/rslib.config.ts +15 -0
  29. package/template-[vue]-[storybook,vitest]-js/src/Button.vue +43 -0
  30. package/template-[vue]-[storybook,vitest]-js/src/index.js +1 -0
  31. package/template-[vue]-[storybook,vitest]-js/src/style.css +34 -0
  32. package/template-[vue]-[storybook,vitest]-js/stories/Button.stories.js +50 -0
  33. package/template-[vue]-[storybook,vitest]-js/tests/index.test.js +16 -0
  34. package/template-[vue]-[storybook,vitest]-js/vitest.config.js +13 -0
  35. package/template-[vue]-[storybook,vitest]-js/vitest.setup.js +1 -0
  36. package/template-[vue]-[storybook,vitest]-ts/.storybook/main.ts +38 -0
  37. package/template-[vue]-[storybook,vitest]-ts/.storybook/preview.ts +12 -0
  38. package/template-[vue]-[storybook,vitest]-ts/package.json +48 -0
  39. package/template-[vue]-[storybook,vitest]-ts/rslib.config.ts +15 -0
  40. package/template-[vue]-[storybook,vitest]-ts/src/Button.vue +35 -0
  41. package/template-[vue]-[storybook,vitest]-ts/src/index.ts +1 -0
  42. package/template-[vue]-[storybook,vitest]-ts/src/style.css +34 -0
  43. package/template-[vue]-[storybook,vitest]-ts/stories/Button.stories.js +50 -0
  44. package/template-[vue]-[storybook,vitest]-ts/tests/index.test.ts +16 -0
  45. package/template-[vue]-[storybook,vitest]-ts/tsconfig.json +25 -0
  46. package/template-[vue]-[storybook,vitest]-ts/vitest.config.js +13 -0
  47. package/template-[vue]-[storybook,vitest]-ts/vitest.setup.js +1 -0
  48. package/template-[vue]-[storybook]-js/.storybook/main.js +37 -0
  49. package/template-[vue]-[storybook]-js/.storybook/preview.js +12 -0
  50. package/template-[vue]-[storybook]-js/package.json +40 -0
  51. package/template-[vue]-[storybook]-js/rslib.config.ts +15 -0
  52. package/template-[vue]-[storybook]-js/src/Button.vue +43 -0
  53. package/template-[vue]-[storybook]-js/src/index.js +1 -0
  54. package/template-[vue]-[storybook]-js/src/style.css +34 -0
  55. package/template-[vue]-[storybook]-js/stories/Button.stories.js +50 -0
  56. package/template-[vue]-[storybook]-ts/.storybook/main.ts +38 -0
  57. package/template-[vue]-[storybook]-ts/.storybook/preview.ts +12 -0
  58. package/template-[vue]-[storybook]-ts/package.json +42 -0
  59. package/template-[vue]-[storybook]-ts/rslib.config.ts +15 -0
  60. package/template-[vue]-[storybook]-ts/src/Button.vue +35 -0
  61. package/template-[vue]-[storybook]-ts/src/index.ts +1 -0
  62. package/template-[vue]-[storybook]-ts/src/style.css +34 -0
  63. package/template-[vue]-[storybook]-ts/stories/Button.stories.js +50 -0
  64. package/template-[vue]-[storybook]-ts/tsconfig.json +25 -0
  65. package/template-[vue]-[vitest]-js/package.json +33 -0
  66. package/template-[vue]-[vitest]-js/rslib.config.ts +15 -0
  67. package/template-[vue]-[vitest]-js/src/Button.vue +43 -0
  68. package/template-[vue]-[vitest]-js/src/index.js +1 -0
  69. package/template-[vue]-[vitest]-js/src/style.css +34 -0
  70. package/template-[vue]-[vitest]-js/tests/index.test.js +16 -0
  71. package/template-[vue]-[vitest]-js/vitest.config.js +13 -0
  72. package/template-[vue]-[vitest]-js/vitest.setup.js +1 -0
  73. package/template-[vue]-[vitest]-ts/package.json +35 -0
  74. package/template-[vue]-[vitest]-ts/rslib.config.ts +15 -0
  75. package/template-[vue]-[vitest]-ts/src/Button.vue +35 -0
  76. package/template-[vue]-[vitest]-ts/src/index.ts +1 -0
  77. package/template-[vue]-[vitest]-ts/src/style.css +34 -0
  78. package/template-[vue]-[vitest]-ts/tests/index.test.ts +16 -0
  79. package/template-[vue]-[vitest]-ts/tsconfig.json +25 -0
  80. package/template-[vue]-[vitest]-ts/vitest.config.js +13 -0
  81. package/template-[vue]-[vitest]-ts/vitest.setup.js +1 -0
@@ -0,0 +1,50 @@
1
+ import { fn } from '@storybook/test';
2
+ import Button from '../src/Button';
3
+
4
+ // More on how to set up stories at: https://storybook.js.org/docs/writing-stories#default-export
5
+ const meta = {
6
+ title: 'Example/Button',
7
+ component: Button,
8
+ parameters: {
9
+ // Optional parameter to center the component in the Canvas. More info: https://storybook.js.org/docs/configure/story-layout
10
+ layout: 'centered',
11
+ },
12
+ // This component will have an automatically generated Autodocs entry: https://storybook.js.org/docs/writing-docs/autodocs
13
+ tags: ['autodocs'],
14
+ // More on argTypes: https://storybook.js.org/docs/api/argtypes
15
+ argTypes: {
16
+ backgroundColor: { control: 'color' },
17
+ },
18
+ // Use `fn` to spy on the onClick arg, which will appear in the actions panel once invoked: https://storybook.js.org/docs/essentials/actions#action-args
19
+ args: { onClick: fn() },
20
+ };
21
+
22
+ export default meta;
23
+
24
+ // More on writing stories with args: https://storybook.js.org/docs/writing-stories/args
25
+ export const Primary = {
26
+ args: {
27
+ primary: true,
28
+ label: 'Button',
29
+ },
30
+ };
31
+
32
+ export const Secondary = {
33
+ args: {
34
+ label: 'Button',
35
+ },
36
+ };
37
+
38
+ export const Large = {
39
+ args: {
40
+ size: 'large',
41
+ label: 'Button',
42
+ },
43
+ };
44
+
45
+ export const Small = {
46
+ args: {
47
+ size: 'small',
48
+ label: 'Button',
49
+ },
50
+ };
@@ -0,0 +1,38 @@
1
+ import { dirname, join } from 'node:path';
2
+ import type { StorybookConfig } from 'storybook-vue3-rsbuild';
3
+
4
+ /**
5
+ * This function is used to resolve the absolute path of a package.
6
+ * It is needed in projects that use Yarn PnP or are set up within a monorepo.
7
+ */
8
+ function getAbsolutePath(value) {
9
+ return dirname(require.resolve(join(value, 'package.json')));
10
+ }
11
+
12
+ const config: StorybookConfig = {
13
+ stories: [
14
+ '../stories/**/*.mdx',
15
+ '../stories/**/*.stories.@(js|jsx|mjs|ts|tsx)',
16
+ ],
17
+ addons: [
18
+ '@storybook/addon-onboarding',
19
+ '@storybook/addon-links',
20
+ '@storybook/addon-essentials',
21
+ '@storybook/addon-interactions',
22
+ {
23
+ name: getAbsolutePath('storybook-addon-rslib'),
24
+ },
25
+ ],
26
+ framework: {
27
+ name: getAbsolutePath('storybook-vue3-rsbuild'),
28
+ options: {},
29
+ },
30
+ docs: {
31
+ autodocs: 'tag',
32
+ },
33
+ typescript: {
34
+ check: true,
35
+ },
36
+ };
37
+
38
+ export default config;
@@ -0,0 +1,12 @@
1
+ const preview = {
2
+ parameters: {
3
+ controls: {
4
+ matchers: {
5
+ color: /(background|color)$/i,
6
+ date: /Date$/i,
7
+ },
8
+ },
9
+ },
10
+ };
11
+
12
+ export default preview;
@@ -0,0 +1,42 @@
1
+ {
2
+ "name": "rslib-vue-ts",
3
+ "version": "0.0.0",
4
+ "type": "module",
5
+ "exports": {
6
+ ".": {
7
+ "types": "./dist/index.d.ts",
8
+ "import": "./dist/index.js"
9
+ }
10
+ },
11
+ "types": "./dist/index.d.ts",
12
+ "files": [
13
+ "dist"
14
+ ],
15
+ "scripts": {
16
+ "build": "rslib build && vue-tsc",
17
+ "build:storybook": "storybook build",
18
+ "dev": "rslib build --watch",
19
+ "storybook": "storybook dev"
20
+ },
21
+ "devDependencies": {
22
+ "@rsbuild/core": "~1.3.21",
23
+ "@rslib/core": "workspace:*",
24
+ "@storybook/addon-essentials": "^8.6.14",
25
+ "@storybook/addon-interactions": "^8.6.14",
26
+ "@storybook/addon-links": "^8.6.14",
27
+ "@storybook/addon-onboarding": "^8.6.14",
28
+ "@storybook/blocks": "^8.6.14",
29
+ "@storybook/test": "^8.6.14",
30
+ "@storybook/vue3": "^8.6.14",
31
+ "rsbuild-plugin-unplugin-vue": "^0.1.0",
32
+ "storybook": "^8.6.14",
33
+ "storybook-addon-rslib": "^1.0.1",
34
+ "storybook-vue3-rsbuild": "^1.0.1",
35
+ "typescript": "^5.8.3",
36
+ "vue": "^3.5.15",
37
+ "vue-tsc": "^2.2.10"
38
+ },
39
+ "peerDependencies": {
40
+ "vue": "^3.2.0"
41
+ }
42
+ }
@@ -0,0 +1,15 @@
1
+ import { defineConfig } from '@rslib/core';
2
+ import { pluginUnpluginVue } from 'rsbuild-plugin-unplugin-vue';
3
+
4
+ export default defineConfig({
5
+ lib: [
6
+ {
7
+ bundle: false,
8
+ format: 'esm',
9
+ },
10
+ ],
11
+ output: {
12
+ target: 'web',
13
+ },
14
+ plugins: [pluginUnpluginVue()],
15
+ });
@@ -0,0 +1,35 @@
1
+ <script setup lang="ts">
2
+ import { computed } from 'vue';
3
+ import './style.css';
4
+
5
+ interface Props {
6
+ primary?: boolean;
7
+ backgroundColor?: string;
8
+ size?: 'small' | 'medium' | 'large';
9
+ label: string;
10
+ onClick?: () => void;
11
+ }
12
+
13
+ const {
14
+ primary = false,
15
+ backgroundColor = undefined,
16
+ size = 'medium',
17
+ label,
18
+ onClick = undefined,
19
+ } = defineProps<Props>();
20
+
21
+ const mode = computed(() =>
22
+ primary ? 'demo-button--primary' : 'demo-button--secondary',
23
+ );
24
+ </script>
25
+
26
+ <template>
27
+ <button
28
+ type="button"
29
+ :class="['demo-button', `demo-button--${size}`, mode]"
30
+ :style="{ backgroundColor }"
31
+ @click="onClick"
32
+ >
33
+ {{ label }}
34
+ </button>
35
+ </template>
@@ -0,0 +1 @@
1
+ export { default as Button } from './Button.vue';
@@ -0,0 +1,34 @@
1
+ .demo-button {
2
+ font-weight: 700;
3
+ border: 0;
4
+ border-radius: 3em;
5
+ cursor: pointer;
6
+ display: inline-block;
7
+ line-height: 1;
8
+ }
9
+
10
+ .demo-button--primary {
11
+ color: white;
12
+ background-color: #1ea7fd;
13
+ }
14
+
15
+ .demo-button--secondary {
16
+ color: #333;
17
+ background-color: transparent;
18
+ box-shadow: rgba(0, 0, 0, 0.15) 0px 0px 0px 1px inset;
19
+ }
20
+
21
+ .demo-button--small {
22
+ font-size: 12px;
23
+ padding: 10px 16px;
24
+ }
25
+
26
+ .demo-button--medium {
27
+ font-size: 14px;
28
+ padding: 11px 20px;
29
+ }
30
+
31
+ .demo-button--large {
32
+ font-size: 16px;
33
+ padding: 12px 24px;
34
+ }
@@ -0,0 +1,50 @@
1
+ import { fn } from '@storybook/test';
2
+ import Button from '../src/Button';
3
+
4
+ // More on how to set up stories at: https://storybook.js.org/docs/writing-stories#default-export
5
+ const meta = {
6
+ title: 'Example/Button',
7
+ component: Button,
8
+ parameters: {
9
+ // Optional parameter to center the component in the Canvas. More info: https://storybook.js.org/docs/configure/story-layout
10
+ layout: 'centered',
11
+ },
12
+ // This component will have an automatically generated Autodocs entry: https://storybook.js.org/docs/writing-docs/autodocs
13
+ tags: ['autodocs'],
14
+ // More on argTypes: https://storybook.js.org/docs/api/argtypes
15
+ argTypes: {
16
+ backgroundColor: { control: 'color' },
17
+ },
18
+ // Use `fn` to spy on the onClick arg, which will appear in the actions panel once invoked: https://storybook.js.org/docs/essentials/actions#action-args
19
+ args: { onClick: fn() },
20
+ };
21
+
22
+ export default meta;
23
+
24
+ // More on writing stories with args: https://storybook.js.org/docs/writing-stories/args
25
+ export const Primary = {
26
+ args: {
27
+ primary: true,
28
+ label: 'Button',
29
+ },
30
+ };
31
+
32
+ export const Secondary = {
33
+ args: {
34
+ label: 'Button',
35
+ },
36
+ };
37
+
38
+ export const Large = {
39
+ args: {
40
+ size: 'large',
41
+ label: 'Button',
42
+ },
43
+ };
44
+
45
+ export const Small = {
46
+ args: {
47
+ size: 'small',
48
+ label: 'Button',
49
+ },
50
+ };
@@ -0,0 +1,25 @@
1
+ {
2
+ "compilerOptions": {
3
+ "lib": ["DOM", "ES2020"],
4
+ "jsx": "preserve",
5
+ "target": "ES2020",
6
+ "skipLibCheck": true,
7
+ "jsxImportSource": "vue",
8
+ "useDefineForClassFields": true,
9
+ "declaration": true,
10
+ "outDir": "dist",
11
+ "emitDeclarationOnly": true,
12
+
13
+ /* modules */
14
+ "module": "ESNext",
15
+ "isolatedModules": true,
16
+ "resolveJsonModule": true,
17
+ "moduleResolution": "bundler",
18
+
19
+ /* type checking */
20
+ "strict": true,
21
+ "noUnusedLocals": true,
22
+ "noUnusedParameters": true
23
+ },
24
+ "include": ["src"]
25
+ }
@@ -0,0 +1,33 @@
1
+ {
2
+ "name": "rslib-vue-js",
3
+ "version": "0.0.0",
4
+ "type": "module",
5
+ "exports": {
6
+ ".": {
7
+ "types": "./dist/index.d.ts",
8
+ "import": "./dist/index.js"
9
+ }
10
+ },
11
+ "types": "./dist/index.d.ts",
12
+ "files": [
13
+ "dist"
14
+ ],
15
+ "scripts": {
16
+ "build": "rslib build",
17
+ "dev": "rslib build --watch",
18
+ "test": "vitest run"
19
+ },
20
+ "devDependencies": {
21
+ "@rslib/core": "workspace:*",
22
+ "@testing-library/jest-dom": "^6.6.3",
23
+ "@testing-library/vue": "^8.1.0",
24
+ "@vitejs/plugin-vue": "^5.2.4",
25
+ "jsdom": "^26.1.0",
26
+ "rsbuild-plugin-unplugin-vue": "^0.1.0",
27
+ "vitest": "^3.1.4",
28
+ "vue": "^3.5.15"
29
+ },
30
+ "peerDependencies": {
31
+ "vue": "^3.2.0"
32
+ }
33
+ }
@@ -0,0 +1,15 @@
1
+ import { defineConfig } from '@rslib/core';
2
+ import { pluginUnpluginVue } from 'rsbuild-plugin-unplugin-vue';
3
+
4
+ export default defineConfig({
5
+ lib: [
6
+ {
7
+ bundle: false,
8
+ format: 'esm',
9
+ },
10
+ ],
11
+ output: {
12
+ target: 'web',
13
+ },
14
+ plugins: [pluginUnpluginVue()],
15
+ });
@@ -0,0 +1,43 @@
1
+ <script setup>
2
+ import { computed } from 'vue';
3
+ import './style.css';
4
+
5
+ const {
6
+ primary = false,
7
+ backgroundColor,
8
+ size = 'medium',
9
+ label,
10
+ onClick,
11
+ } = defineProps({
12
+ primary: {
13
+ type: Boolean,
14
+ },
15
+ backgroundColor: {
16
+ type: String,
17
+ },
18
+ size: {
19
+ type: String,
20
+ },
21
+ label: {
22
+ type: String,
23
+ },
24
+ onClick: {
25
+ type: Function,
26
+ },
27
+ });
28
+
29
+ const mode = computed(() =>
30
+ primary ? 'demo-button--primary' : 'demo-button--secondary',
31
+ );
32
+ </script>
33
+
34
+ <template>
35
+ <button
36
+ type="button"
37
+ :class="['demo-button', `demo-button--${size}`, mode]"
38
+ :style="{ backgroundColor }"
39
+ @click="onClick"
40
+ >
41
+ {{ label }}
42
+ </button>
43
+ </template>
@@ -0,0 +1 @@
1
+ export { default as Button } from './Button.vue';
@@ -0,0 +1,34 @@
1
+ .demo-button {
2
+ font-weight: 700;
3
+ border: 0;
4
+ border-radius: 3em;
5
+ cursor: pointer;
6
+ display: inline-block;
7
+ line-height: 1;
8
+ }
9
+
10
+ .demo-button--primary {
11
+ color: white;
12
+ background-color: #1ea7fd;
13
+ }
14
+
15
+ .demo-button--secondary {
16
+ color: #333;
17
+ background-color: transparent;
18
+ box-shadow: rgba(0, 0, 0, 0.15) 0px 0px 0px 1px inset;
19
+ }
20
+
21
+ .demo-button--small {
22
+ font-size: 12px;
23
+ padding: 10px 16px;
24
+ }
25
+
26
+ .demo-button--medium {
27
+ font-size: 14px;
28
+ padding: 11px 20px;
29
+ }
30
+
31
+ .demo-button--large {
32
+ font-size: 16px;
33
+ padding: 12px 24px;
34
+ }
@@ -0,0 +1,16 @@
1
+ import { render, screen } from '@testing-library/vue';
2
+ import { expect, test } from 'vitest';
3
+ import Button from '../src/Button.vue';
4
+
5
+ test('The button should have correct background color', async () => {
6
+ render(Button, {
7
+ props: {
8
+ backgroundColor: '#ccc',
9
+ label: 'Demo Button',
10
+ },
11
+ });
12
+ const button = screen.getByText('Demo Button');
13
+ expect(button).toHaveStyle({
14
+ backgroundColor: '#ccc',
15
+ });
16
+ });
@@ -0,0 +1,13 @@
1
+ /// <reference types="vitest/config" />
2
+
3
+ import pluginVue from '@vitejs/plugin-vue';
4
+ import { defineConfig } from 'vitest/config';
5
+
6
+ export default defineConfig({
7
+ // Configure Vitest (https://vitest.dev/config/)
8
+ test: {
9
+ environment: 'jsdom',
10
+ setupFiles: './vitest.setup.js',
11
+ },
12
+ plugins: [pluginVue()],
13
+ });
@@ -0,0 +1 @@
1
+ import '@testing-library/jest-dom/vitest';
@@ -0,0 +1,35 @@
1
+ {
2
+ "name": "rslib-vue-ts",
3
+ "version": "0.0.0",
4
+ "type": "module",
5
+ "exports": {
6
+ ".": {
7
+ "types": "./dist/index.d.ts",
8
+ "import": "./dist/index.js"
9
+ }
10
+ },
11
+ "types": "./dist/index.d.ts",
12
+ "files": [
13
+ "dist"
14
+ ],
15
+ "scripts": {
16
+ "build": "rslib build && vue-tsc",
17
+ "dev": "rslib build --watch",
18
+ "test": "vitest run"
19
+ },
20
+ "devDependencies": {
21
+ "@rslib/core": "workspace:*",
22
+ "@testing-library/jest-dom": "^6.6.3",
23
+ "@testing-library/vue": "^8.1.0",
24
+ "@vitejs/plugin-vue": "^5.2.4",
25
+ "jsdom": "^26.1.0",
26
+ "rsbuild-plugin-unplugin-vue": "^0.1.0",
27
+ "typescript": "^5.8.3",
28
+ "vitest": "^3.1.4",
29
+ "vue": "^3.5.15",
30
+ "vue-tsc": "^2.2.10"
31
+ },
32
+ "peerDependencies": {
33
+ "vue": "^3.2.0"
34
+ }
35
+ }
@@ -0,0 +1,15 @@
1
+ import { defineConfig } from '@rslib/core';
2
+ import { pluginUnpluginVue } from 'rsbuild-plugin-unplugin-vue';
3
+
4
+ export default defineConfig({
5
+ lib: [
6
+ {
7
+ bundle: false,
8
+ format: 'esm',
9
+ },
10
+ ],
11
+ output: {
12
+ target: 'web',
13
+ },
14
+ plugins: [pluginUnpluginVue()],
15
+ });
@@ -0,0 +1,35 @@
1
+ <script setup lang="ts">
2
+ import { computed } from 'vue';
3
+ import './style.css';
4
+
5
+ interface Props {
6
+ primary?: boolean;
7
+ backgroundColor?: string;
8
+ size?: 'small' | 'medium' | 'large';
9
+ label: string;
10
+ onClick?: () => void;
11
+ }
12
+
13
+ const {
14
+ primary = false,
15
+ backgroundColor = undefined,
16
+ size = 'medium',
17
+ label,
18
+ onClick = undefined,
19
+ } = defineProps<Props>();
20
+
21
+ const mode = computed(() =>
22
+ primary ? 'demo-button--primary' : 'demo-button--secondary',
23
+ );
24
+ </script>
25
+
26
+ <template>
27
+ <button
28
+ type="button"
29
+ :class="['demo-button', `demo-button--${size}`, mode]"
30
+ :style="{ backgroundColor }"
31
+ @click="onClick"
32
+ >
33
+ {{ label }}
34
+ </button>
35
+ </template>
@@ -0,0 +1 @@
1
+ export { default as Button } from './Button.vue';
@@ -0,0 +1,34 @@
1
+ .demo-button {
2
+ font-weight: 700;
3
+ border: 0;
4
+ border-radius: 3em;
5
+ cursor: pointer;
6
+ display: inline-block;
7
+ line-height: 1;
8
+ }
9
+
10
+ .demo-button--primary {
11
+ color: white;
12
+ background-color: #1ea7fd;
13
+ }
14
+
15
+ .demo-button--secondary {
16
+ color: #333;
17
+ background-color: transparent;
18
+ box-shadow: rgba(0, 0, 0, 0.15) 0px 0px 0px 1px inset;
19
+ }
20
+
21
+ .demo-button--small {
22
+ font-size: 12px;
23
+ padding: 10px 16px;
24
+ }
25
+
26
+ .demo-button--medium {
27
+ font-size: 14px;
28
+ padding: 11px 20px;
29
+ }
30
+
31
+ .demo-button--large {
32
+ font-size: 16px;
33
+ padding: 12px 24px;
34
+ }
@@ -0,0 +1,16 @@
1
+ import { render, screen } from '@testing-library/vue';
2
+ import { expect, test } from 'vitest';
3
+ import Button from '../src/Button.vue';
4
+
5
+ test('The button should have correct background color', async () => {
6
+ render(Button, {
7
+ props: {
8
+ backgroundColor: '#ccc',
9
+ label: 'Demo Button',
10
+ },
11
+ });
12
+ const button = screen.getByText('Demo Button');
13
+ expect(button).toHaveStyle({
14
+ backgroundColor: '#ccc',
15
+ });
16
+ });
@@ -0,0 +1,25 @@
1
+ {
2
+ "compilerOptions": {
3
+ "lib": ["DOM", "ES2020"],
4
+ "jsx": "preserve",
5
+ "target": "ES2020",
6
+ "skipLibCheck": true,
7
+ "jsxImportSource": "vue",
8
+ "useDefineForClassFields": true,
9
+ "declaration": true,
10
+ "outDir": "dist",
11
+ "emitDeclarationOnly": true,
12
+
13
+ /* modules */
14
+ "module": "ESNext",
15
+ "isolatedModules": true,
16
+ "resolveJsonModule": true,
17
+ "moduleResolution": "bundler",
18
+
19
+ /* type checking */
20
+ "strict": true,
21
+ "noUnusedLocals": true,
22
+ "noUnusedParameters": true
23
+ },
24
+ "include": ["src"]
25
+ }
@@ -0,0 +1,13 @@
1
+ /// <reference types="vitest/config" />
2
+
3
+ import pluginVue from '@vitejs/plugin-vue';
4
+ import { defineConfig } from 'vitest/config';
5
+
6
+ export default defineConfig({
7
+ // Configure Vitest (https://vitest.dev/config/)
8
+ test: {
9
+ environment: 'jsdom',
10
+ setupFiles: './vitest.setup.js',
11
+ },
12
+ plugins: [pluginVue()],
13
+ });
@@ -0,0 +1 @@
1
+ import '@testing-library/jest-dom/vitest';