Skip to content

Commit 53ebd70

Browse files
authored
feat: add new vue-resizor package (#174)
1 parent 74264a5 commit 53ebd70

32 files changed

+994
-249
lines changed
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
"vue-qrcode": patch
3+
"vue-qrious": patch
4+
---
5+
6+
chore: add `package.json` into `exports`

.changeset/shy-ravens-rest.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"vue-resizor": minor
3+
---
4+
5+
feat: add new `vue-resizor` package, it just works

.editorconfig

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
root = true
1+
root=true
22

33
[*]
4-
indent_style = space
5-
indent_size = 2
6-
tab_width = 2
7-
end_of_line = lf
8-
charset = utf-8
9-
trim_trailing_whitespace = true
10-
insert_final_newline = true
4+
indent_style=space
5+
indent_size=2
6+
tab_width=2
7+
end_of_line=lf
8+
charset=utf-8
9+
trim_trailing_whitespace=true
10+
insert_final_newline=true

.eslintrc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,16 @@
44
"overrides": [
55
{
66
"files": [
7-
"*.ts",
8-
"*.vue"
7+
"*.{ts,tsx,vue}"
98
],
109
"rules": {
10+
"vue/multi-word-component-names": "off",
1111
"vue/require-default-prop": "off"
1212
}
1313
},
1414
{
1515
"files": [
16-
"*.ts"
16+
"*.{ts,tsx}"
1717
],
1818
"rules": {
1919
"@typescript-eslint/consistent-type-imports": "error"

.stylelintignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
dist
22
lib
3+
packages/*/lib/*
34
LICENSE
45
*.json
56
*.lock
67
*.log
78
*.ts
89
*.tsbuildinfo
10+
*.tsx
911
*.yaml
1012
*.yml

.stylelintrc

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
11
{
2-
"extends": "@1stg/stylelint-config"
2+
"extends": "@1stg/stylelint-config",
3+
"rules": {
4+
"color-function-notation": null
5+
}
36
}

.vitepress/components/VueQrcodeDemo.vue

Lines changed: 9 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -114,8 +114,8 @@
114114
</label>
115115
<ul v-if="manualMode">
116116
<li
117-
v-for="(v, index) of value"
118-
:key="v"
117+
v-for="(v, index) of value as QRCodeSegment[]"
118+
:key="v.data as string"
119119
>
120120
<label v-if="value.length > 0">
121121
<button @click="removeValue(index)">-</button>
@@ -135,7 +135,7 @@
135135
<div>
136136
<label>data</label>
137137
<textarea
138-
v-model="v.data"
138+
v-model="v.data as string"
139139
rows="6"
140140
cols="80"
141141
></textarea>
@@ -144,7 +144,7 @@
144144
</ul>
145145
<textarea
146146
v-else
147-
v-model="value"
147+
v-model="value as string"
148148
rows="6"
149149
cols="80"
150150
></textarea>
@@ -155,7 +155,7 @@
155155
:href="dataUrl"
156156
>
157157
<vue-qrcode
158-
v-bind="qrcodeProps"
158+
v-bind="qrcodeProps as any"
159159
@change="onChange"
160160
@error="onError"
161161
/>
@@ -176,9 +176,9 @@ import VueQrcode, {
176176
LEVELS,
177177
MASK_PATTERNS,
178178
MODES,
179-
QRCodeSegment,
180179
QRCodeValue,
181180
TYPES,
181+
type QRCodeSegment,
182182
} from 'vue-qrcode'
183183
184184
const DEFAULT_TEXT = 'http://www.1stg.me'
@@ -219,7 +219,7 @@ export default defineComponent({
219219
quality: 0.92,
220220
value: DEFAULT_TEXT as QRCodeValue,
221221
manualMode: false,
222-
dataUrl: null,
222+
dataUrl: undefined as string | undefined,
223223
}
224224
},
225225
computed: {
@@ -229,20 +229,12 @@ export default defineComponent({
229229
},
230230
watch: {
231231
manualMode() {
232-
this.value = this.manualMode
233-
? [
234-
{
235-
data: DEFAULT_TEXT,
236-
},
237-
]
238-
: DEFAULT_TEXT
232+
this.value = this.manualMode ? [{ data: DEFAULT_TEXT }] : DEFAULT_TEXT
239233
},
240234
},
241235
methods: {
242236
addValue() {
243-
;(this.value as QRCodeSegment[]).push({
244-
data: DEFAULT_TEXT,
245-
})
237+
;(this.value as QRCodeSegment[]).push({ data: DEFAULT_TEXT })
246238
},
247239
removeValue(index: number) {
248240
;(this.value as QRCodeSegment[]).splice(index, 1)

.vitepress/components/VueQriousDemo.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@
7777
:href="dataUrl"
7878
>
7979
<vue-qrious
80-
v-bind="qriousProps"
80+
v-bind="qriousProps as any"
8181
@change="onChange"
8282
@error="onError"
8383
/>
@@ -125,7 +125,7 @@ export default defineComponent({
125125
padding: 0,
126126
size: 100,
127127
value: 'http://www.1stg.me',
128-
dataUrl: null,
128+
dataUrl: undefined as string | undefined,
129129
}
130130
},
131131
computed: {
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<template>
2+
<div class="parent">
3+
<vue-resizor v-model:indicators="indicators">
4+
<div class="child">Child 1</div>
5+
<div class="child">Child 2</div>
6+
</vue-resizor>
7+
</div>
8+
</template>
9+
<script lang="ts" setup>
10+
import { ref } from 'vue'
11+
import VueResizor, { Indicator } from 'vue-resizor'
12+
13+
import 'vue-resizor/styles.css'
14+
15+
const indicators = ref<Indicator[]>()
16+
</script>
17+
<style lang="less" scoped>
18+
.parent {
19+
height: 200px;
20+
background-color: pink;
21+
}
22+
23+
.child {
24+
height: 20%;
25+
26+
~ .child {
27+
height: 80%;
28+
background-color: lightgreen;
29+
min-height: 0;
30+
}
31+
}
32+
</style>

.vitepress/components/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
export { default as VueQrcodeDemo } from './VueQrcodeDemo.vue'
22
export { default as VueQriousDemo } from './VueQriousDemo.vue'
3+
export { default as VueResizorDemo } from './VueResizorDemo.vue'

0 commit comments

Comments
 (0)