Skip to content

Commit a9b35f1

Browse files
committed
rewrite main component to script setup with native typescript support, update build to auto-generate ts declarations
1 parent 4d4122b commit a9b35f1

16 files changed

+913
-354
lines changed

dev/demo-styles.css

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ div.color-input__box-inner--active {
1111
div.color-input__box--disabled {}
1212

1313
div.color-input__popup {}
14-
div.color-input__popup .slider {}
15-
div.color-input__popup .slider-pointer {}
16-
div.color-input__popup .saturation-pointer {}
14+
div.color-input__slider {}
15+
div.color-input__slider-pointer {}
16+
div.color-input__saturation-pointer {}
1717

1818
div.color-input__popup--enter-from,
1919
div.color-input__popup--leave-to {}

dev/serve.vue

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@
4343
</div>
4444
</div>
4545
<color-input
46-
:appendTo="appendToActive ? appendTo : null"
4746
v-model="color"
4847
:format="format + (type ? ' ' + type : '')"
4948
:position="position"
@@ -123,8 +122,6 @@
123122
format: '',
124123
type: '',
125124
formatOptions: ['rgb', 'hex', 'hex8', 'name', 'hsl', 'hsv'],
126-
appendToActive: null,
127-
appendTo: '.box-parent',
128125
}
129126
},
130127
computed: {
@@ -269,12 +266,6 @@
269266
});
270267
},
271268
watch: {
272-
appendToActive() {
273-
this.$refs.colorInput.pickEnd()
274-
setTimeout(() => {
275-
this.$refs.colorInput.getParent()
276-
}, 100)
277-
},
278269
color() {
279270
let hsl = this.$refs.colorInput.color.clone().setAlpha(1).toHslString();
280271
let [h,s,l] = hsl.match(/\d+/g);

package.json

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,20 +35,25 @@
3535
"build": "vite build",
3636
"build:demo": "vite build --config vite.config-demo.js",
3737
"publish:demo": "gh-pages -d demo",
38-
"prepublishOnly": "npm run build"
38+
"prepublishOnly": "npm run build",
39+
"prepublish:demo": "npm run build:demo"
3940
},
4041
"dependencies": {
4142
"tinycolor2": "^1.4.2"
4243
},
4344
"devDependencies": {
45+
"@types/tinycolor2": "^1.4.6",
4446
"@vitejs/plugin-vue": "^5.1.1",
4547
"autoprefixer": "^10.3.7",
4648
"gh-pages": "^3.2.3",
4749
"postcss": "^8.2.10",
4850
"sass": "^1.42.1",
51+
"typescript": "^5.5.4",
4952
"vite": "^5.3.5",
53+
"vite-plugin-dts": "3.9.1",
5054
"vite-plugin-lib-inject-css": "^2.1.1",
51-
"vue": "^3.4.26"
55+
"vue": "^3.4.26",
56+
"vue-tsc": "^2.0.29"
5257
},
5358
"peerDependencies": {
5459
"vue": "^3.0.5"

0 commit comments

Comments
 (0)