diff --git a/dist/app.js b/dist/app.js
index 91d68de..67fd260 100644
--- a/dist/app.js
+++ b/dist/app.js
@@ -8,17 +8,12 @@ import { createApp } from 'wkitd'
import { css, html } from 'wkit'
import 'es.shim'
-// import '//jscdn.ink/@bd/ui/latest/form/input.js'
-// import '//jscdn.ink/@bd/ui/latest/form/button.js'
-// import '//jscdn.ink/@bd/ui/latest/form/checkbox.js'
-// import '//jscdn.ink/@bd/ui/latest/form/switch.js'
-// import '//jscdn.ink/@bd/ui/latest/form/link.js'
-// import '//jscdn.ink/@bd/ui/latest/layer/index.js'
-// // import 'http://127.0.0.1:8090/dist/layer/index.js'
-// import '//jscdn.ink/@bd/ui/latest/pager/index.js'
-// import '//jscdn.ink/@bytedo/wcui/1.0.12/form/dropdown.js'
-
-// import App from './app.vue'
+import '@ui/form/input.js'
+import '@ui/form/button.js'
+import '@ui/form/switch.js'
+import '@ui/form/link.js'
+import '@ui/layer/index.js'
+import '@ui/pager/index.js'
import router from './router.js'
import store from './store.js'
diff --git a/dist/assets/app.css b/dist/assets/app.css
index 4db0a91..5600d38 100644
--- a/dist/assets/app.css
+++ b/dist/assets/app.css
@@ -9,6 +9,7 @@
background: var(--color-dark-1);
}
}
+
body {
line-height: 1.5;
font-size: 14px;
diff --git a/dist/components/header.js b/dist/components/header.js
index b58c94d..96cbc73 100644
--- a/dist/components/header.js
+++ b/dist/components/header.js
@@ -1,13 +1,13 @@
import { html, css, Component, classMap } from 'wkit'
+import { watch } from 'wkitd'
import fetch from '/lib/fetch.js'
class Header extends Component {
- static props = {
- input: ''
- }
-
static styles = css`
+ ::selection {
+ background: var(--color-plain-a);
+ }
.common-header {
flex-shrink: 0;
display: flex;
@@ -51,13 +51,10 @@ class Header extends Component {
border-radius: 4px;
transition: background 0.2s ease-in-out;
- &:hover {
+ &:hover,
+ &.active {
background: rgba(255, 255, 255, 0.3);
}
-
- &.router-link-active {
- text-decoration: underline;
- }
}
}
}
@@ -78,6 +75,7 @@ class Header extends Component {
height: 320px;
.search {
display: inline-block;
+ --wc-input-border-color: none;
}
}
@@ -105,36 +103,59 @@ class Header extends Component {
}
`
- search() {
- let id = this.input.trim()
+ #search(ev) {
+ let id = this.$store.searchInput
+
if (id) {
- fetch('/package/search/' + encodeURIComponent(id)).then(r => {
- let dict = { versions: [], id }
- let last = null
- for (let it of r.data) {
- let tmp = it.split('/')
- let v = tmp.shift()
- let n = tmp.join('/')
- if (last === v) {
- dict[last].push(n)
- } else {
- last = v
- dict.versions.push(last)
- dict[last] = [n]
+ fetch('/package/search/' + encodeURIComponent(id))
+ .then(r => {
+ let dict = { versions: [], id }
+ let last = null
+ for (let it of r.data) {
+ let tmp = it.split('/')
+ let v = tmp.shift()
+ let n = tmp.join('/')
+ if (last === v) {
+ dict[last].push(n)
+ } else {
+ last = v
+ dict.versions.push(last)
+ dict[last] = [n]
+ }
}
- }
- this.$store.result = dict
- })
+ dict.version = last
+ this.$store.result = dict
+ })
+ .catch(err => {
+ this.$store.result = { version: '', versions: [], id: '' }
+ })
} else {
- this.$store.result = null
+ this.$store.result = { version: '', versions: [], id: '' }
}
}
+ #handleInput(ev) {
+ this.$store.searchInput = ev.target.value
+ }
+
+ mounted() {
+ watch('$store.searchInput', val => {
+ this.#search()
+ })
+ watch('$route', route => {
+ if (route.path === '/' && !route.query.name) {
+ this.$store.searchInput = ''
+ }
+ })
+ }
+
render() {
return html`