Skip to content

Commit 8774f53

Browse files
authored
feat(template): add Vue (#960)
1 parent c58d08a commit 8774f53

File tree

100 files changed

+2284
-6
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

100 files changed

+2284
-6
lines changed
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
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+
},
19+
"devDependencies": {
20+
"@rslib/core": "workspace:*",
21+
"rsbuild-plugin-unplugin-vue": "^0.1.0",
22+
"vue": "^3.2.0"
23+
},
24+
"peerDependencies": {
25+
"vue": "^3.2.0"
26+
}
27+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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+
});
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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>
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export { default as Button } from './Button.vue';
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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+
}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
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+
},
19+
"devDependencies": {
20+
"@rslib/core": "workspace:*",
21+
"rsbuild-plugin-unplugin-vue": "^0.1.0",
22+
"typescript": "^5.8.3",
23+
"vue": "^3.2.0",
24+
"vue-tsc": "^2.2.10"
25+
},
26+
"peerDependencies": {
27+
"vue": "^3.2.0"
28+
}
29+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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+
});
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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>
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export { default as Button } from './Button.vue';
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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 commit comments

Comments
 (0)