Skip to content

Commit

Permalink
Merge branch 'release/v0.19.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
holtwick committed May 19, 2024
2 parents 7ead5ed + f0c5abb commit 3a3fe7c
Show file tree
Hide file tree
Showing 24 changed files with 509 additions and 68 deletions.
9 changes: 5 additions & 4 deletions lib/basic/oui-notice.styl
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,18 @@

.oui-notice {
position: absolute;
width: 100%;
height: 100%;
left: 0;
top: 0;
right: 0;
bottom: 0;
use: center;
text-align: center;
height: 100%;
color: var(--s2-fg);

&-body {
use: stack-y;
gap: 16;
max-width: min(40ch, 80%);
max-width: unquote("min(40ch, 80%)");
}

svg {
Expand Down
29 changes: 22 additions & 7 deletions lib/modal/oui-modal.styl
Original file line number Diff line number Diff line change
@@ -1,17 +1,21 @@
@require "../../stylus/index.styl";

body {
position: relative;
}

.oui-modal {
--modal-separator: transparent;
--modal-bg: var(--dialog-bg, var(--s2-bg));
align-items: center;
display: none;
justify-content: center;
overflow: hidden;
position: fixed;
top: var(--visible-offset-top, 0px);
position: absolute;
top: 0;
left: 0;
height: var(--visible-height, 100vh);
width: 100vw;
bottom: 0;
right: 0;

@media -media-desktop {
padding: 8;
Expand Down Expand Up @@ -64,12 +68,22 @@
border: inherit;
border-radius: inherit;
max-height: inherit;
position: fixed;
position: absolute;
width: 100%;
top: calc(44px + var(--visible-offset-top, 0px));
height: calc(var(--visible-height, 100vh) - 44px);
top: 44px;
height: calc(100% - 44px);
border-top-left-radius: var(--dialog-radius, 8px);
border-top-right-radius: var(--dialog-radius, 8px);
padding-bottom: -safe-bottom;

.virtual-keyboard & {
padding-bottom: 0;

._modal_footer {
transition: border 400ms;
--modal-separator: var(--t3-bg);
}
}
}
}
}
Expand Down Expand Up @@ -117,6 +131,7 @@
padding-x: 16;
position: relative;
display: block;
// border: 2px solid red;
}

._modal_header + ._modal_body {
Expand Down
42 changes: 17 additions & 25 deletions lib/modal/oui-modal.vue
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
<script lang="ts" setup>
import { onKeyStroke, useEventListener } from '@vueuse/core'
import { onMounted, ref } from 'vue'
import type { LoggerInterface } from 'zeed'
import { Logger } from 'zeed'
import { onKeyStroke } from '@vueuse/core'
import { ref } from 'vue'
import { OuiClose } from '../basic'
import { vFocustrap } from './oui-modal.focustrap'
Expand All @@ -26,8 +24,6 @@ const emit = defineEmits<{
open: []
}>()
const log: LoggerInterface = Logger('oui-modal')
const _active = defineModel({ default: true })
onKeyStroke('Escape', (e) => {
Expand All @@ -38,24 +34,21 @@ onKeyStroke('Escape', (e) => {
}
})
const rootCss = document.documentElement.style
if (window.visualViewport != null) {
function resizeHandler() {
const visibleHeight = `${window.visualViewport?.height.toString()}px`
const visibleOffsetTop = `${window.visualViewport?.offsetTop.toString()}px`
document.documentElement.style.height = visibleHeight
log('new height', visibleHeight, window.visualViewport)
rootCss.setProperty('--visible-height', visibleHeight)
// rootCss.setProperty('--visible-offset-top', visibleOffsetTop)
// window.scrollTo(0, 0)
}
useEventListener(window.visualViewport, 'resize', resizeHandler)
useEventListener(window.visualViewport, 'scroll', resizeHandler)
onMounted(resizeHandler)
}
// const rootCss = document.documentElement.style
// if (window.visualViewport != null) {
// function resizeHandler() {
// const visibleHeight = `${window.visualViewport?.height.toString()}px`
// const visibleOffsetTop = `${window.visualViewport?.offsetTop.toString()}px`
// document.documentElement.style.height = visibleHeight
// log('new height', visibleHeight, window.visualViewport)
// // rootCss.setProperty('--visible-height', visibleHeight)
// // rootCss.setProperty('--visible-offset-top', visibleOffsetTop)
// // window.scrollTo(0, 0)
// }
// useEventListener(window.visualViewport, 'resize', resizeHandler)
// useEventListener(window.visualViewport, 'scroll', resizeHandler)
// onMounted(resizeHandler)
// }
const root = ref()
Expand Down Expand Up @@ -96,7 +89,6 @@ const name = 'oui-modal' // computed(() => String(attrs.class || 'oui-modal').sp
<div
v-if="_active"
ref="root"

:class="{
[name]: true,
[$attrs.class as string]: true,
Expand Down
11 changes: 6 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "oui-kit",
"type": "module",
"version": "0.18.5",
"version": "0.19.0",
"author": {
"email": "[email protected]",
"name": "Dirk Holtwick",
Expand Down Expand Up @@ -62,7 +62,7 @@
"build": "vite build",
"build:demo": "BUILD_DEMO=1 vite build",
"check": "vue-tsc --noEmit",
"dev": "vite",
"dev": "vite --host",
"generate-pwa-assets": "pwa-assets-generator",
"lint": "eslint .",
"lint:fix": "eslint . --fix",
Expand All @@ -79,7 +79,7 @@
"zeed": "^0.20.7"
},
"devDependencies": {
"@antfu/eslint-config": "^2.18.0",
"@antfu/eslint-config": "^2.18.1",
"@antfu/ni": "^0.21.12",
"@shikijs/markdown-it": "^1.5.2",
"@tsconfig/node18": "^18.2.4",
Expand All @@ -89,15 +89,16 @@
"@vitejs/plugin-vue": "^5.0.4",
"@vue/test-utils": "^2.4.6",
"@vue/tsconfig": "^0.5.1",
"eslint": "^9.2.0",
"eslint": "^9.3.0",
"only-allow": "^1.2.1",
"stylus": "^0.63.0",
"tsup": "^8.0.2",
"typescript": "^5.4.5",
"unplugin-vue-markdown": "^0.26.2",
"vite": "^5.2.11",
"vite-plugin-dts": "^3.9.1",
"vite-plugin-qrcode": "^0.2.3",
"vitest": "^1.6.0",
"vue-tsc": "^2.0.17"
"vue-tsc": "^2.0.19"
}
}
50 changes: 50 additions & 0 deletions src/app-mobile-using-oui.styl
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
@require "../stylus/index.styl";
@require "../stylus/theme.styl";

:root {
--footer-bg: var(--t3-bg);
}

body, html {
padding: 0;
margin: 0;
height: 100%;
background: var(--footer-bg);
}

#app {
use: stack-y;
height: 100%;
}

.app-mobile {
use: stack-y;
height: 100%;
background: yellow;
// use: safe-margin;
}

main {
use: grow;
use: scroll;
}

header, footer {
min-height: 44;
background: var(--footer-bg);
padding-left: -safe-left;
padding-right: -safe-right;
}

header {
padding-top: -safe-top;
}

footer {
padding-bottom: -safe-bottom;

.virtual-keyboard & {
background: lime;
padding-bottom: 0;
}
}
40 changes: 40 additions & 0 deletions src/app-mobile-using-oui.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<script lang="ts" setup>
import OuiMobile from './oui-mobile.vue'
import './app-mobile-using-oui.styl'
</script>

<template>
<OuiMobile />
<div class="app-mobile">
<header>
Header
</header>
<main data-scroll="true">
<ol>
<template v-for="i in 100" :key="i">
<li>
<input type="text" value="Hallo">
<!-- <OuiInput v-model="text" title="fasdfd" /> -->
{{ i }} Lorem ipsum dolor sit amet consectetur adipisicing elit. Voluptatibus at voluptatem, optio nihil
facere dolorum, porro excepturi ducimus cupiditate, odio officiis laboriosam exercitationem tempore voluptas
repellat corporis ex accusamus iste!
<select>
<option value="1">
1
</option>
<option value="2">
2
</option>
<option value="3">
3
</option>
</select>
</li>
</template>
</ol>
</main>
<footer>
Footer
</footer>
</div>
</template>
95 changes: 95 additions & 0 deletions src/app-mobile.styl
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
@require "../stylus/index.styl";
@require "../stylus/theme.styl";

:root {
--footer-bg: var(--t3-bg);
}

html, body {
/* This seems to fix overscrolling */
/* https://www.bram.us/2016/05/02/prevent-overscroll-bounce-in-ios-mobilesafari-pure-css/ */
position: fixed;
overflow: hidden;
}

@keyframes keyboard_animation {
/* https://gist.github.com/kiding/72721a0553fa93198ae2bb6eefaa3299 */
0% {
opacity: 0;
}

100% {
opacity: 1;
}
}

body, html {
padding: 0;
margin: 0;
height: 100%;
background: var(--footer-bg);
}

body {
/* https://forums.developer.apple.com/forums/thread/48088 */
transition: height 400ms cubic-bezier(0.38, 0.7, 0.125, 1);
}

#app {
use: stack-y;
height: 100%;
}

.app-mobile {
use: stack-y;
height: 100%;
background: yellow;
// use: safe-margin;
}

main {
use: grow;
use: scroll;
}

header, footer {
min-height: 44;
background: var(--footer-bg);
padding-left: -safe-left;
padding-right: -safe-right;
}

header {
padding-top: -safe-top;
}

footer {
padding-bottom: -safe-bottom;

.virtual-keyboard & {
background: lime;
padding-bottom: 0;
}
}

body {
/* Avoids overflow */
-webkit-overflow-scrolling: none;
overscroll-behavior: none;
}

@keyframes blink_input_opacity_to_prevent_scrolling_when_focus {
/* https://gist.github.com/kiding/72721a0553fa93198ae2bb6eefaa3299 */
0% {
opacity: 0;
}

100% {
opacity: 1;
}
}

input:focus, textarea:focus, [contenteditable]:focus {
/* Avoids scroll issues on keyboard showup */
animation: blink_input_opacity_to_prevent_scrolling_when_focus 0.01s;
}
Loading

0 comments on commit 3a3fe7c

Please sign in to comment.