-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b14b75e
commit e3ef1ec
Showing
7 changed files
with
406 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
<template x-component:hui="dialog" x-modelable="_isOpen" x-show="_isOpen" x-trap.inert.noscroll="_isOpen" | ||
@keydown.escape="$api.close()" x-data="{ | ||
_isOpen: false | ||
}"> | ||
<slot></slot> | ||
<script> | ||
const _ = $vui._ | ||
return { | ||
open() { | ||
this._isOpen = true | ||
}, | ||
get isOpen() { return this._isOpen }, | ||
close() { | ||
if (this.$prop('open')) | ||
this.$dispatch('close', false) | ||
else | ||
this._isOpen = false | ||
}, | ||
toggle() { | ||
if (this.isOpen) | ||
this.close() | ||
else | ||
this.open() | ||
}, | ||
onMounted() { | ||
if (this.$prop('open') !== undefined) { | ||
$vui.effect(() => { | ||
this._isOpen = this.$prop('open') | ||
}) | ||
} | ||
} | ||
} | ||
</script> | ||
</template> | ||
<template x-component:hui="dialog-overlay" x-show="$api && $api.context.isOpen" | ||
@click.prevent.stop="$api.context.close()"> | ||
<slot></slot> | ||
<script> | ||
return { | ||
get context() { return this.$of(':dialog') }, | ||
} | ||
</script> | ||
</template> | ||
<template x-component:hui="dialog-panel" @click.outside="$api.context.close()" x-show="$api && $api.context.isOpen"> | ||
<slot></slot> | ||
<script> | ||
return { | ||
get context() { return this.$of(':dialog') }, | ||
} | ||
</script> | ||
</template> | ||
<template x-component:hui="dialog-title"> | ||
<slot></slot> | ||
<script> | ||
return { | ||
get context() { return this.$of(':dialog') }, | ||
} | ||
</script> | ||
</template> | ||
<template x-component:hui="dialog-description"> | ||
<slot></slot> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,6 @@ | ||
<template x-component:hui="popover"> | ||
<slot></slot> | ||
<script> | ||
const _ = $vui._ | ||
return { | ||
_isOpen: false, | ||
open() { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{ | ||
"name": "@vimesh/headless", | ||
"version": "0.5.0", | ||
"version": "0.6.0", | ||
"repository": "https://github.com/vimeshjs/vimesh-headless.git", | ||
"author": "Jacky ZHANG <[email protected]>", | ||
"license": "MIT", | ||
|
@@ -9,8 +9,8 @@ | |
}, | ||
"dependencies": {}, | ||
"devDependencies": { | ||
"@vimesh/style": "^1.0.4", | ||
"@vimesh/ui": "^0.12.3", | ||
"@vimesh/style": "^1.0.5", | ||
"@vimesh/ui": "^0.12.4", | ||
"alpinejs": "^3.10.5", | ||
"http-server": "^14.1.1", | ||
"universal-router": "^9.1.0" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.