Skip to content
This repository was archived by the owner on Mar 17, 2024. It is now read-only.

Commit 777bc0c

Browse files
committed
build v0.6.4
perf: Navigation perf: Examples completely converted to tsx files
1 parent c12c626 commit 777bc0c

File tree

7 files changed

+50
-29
lines changed

7 files changed

+50
-29
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@xsoulspace/vue_flutter_tailwind",
33
"description": "Vue3 styled like Flutter with Tailwind CSS",
4-
"version": "0.6.3",
4+
"version": "0.6.4",
55
"private": false,
66
"author": {
77
"name": "Anton Malofeev",

src/abstract/Navigation.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@ export class NavigationController {
3434
return this._currentRoute?.widget
3535
}
3636
get _isFullscreen() {
37-
return this._currentRoute?.fullscreen
37+
const maybeFullscreen = this._currentRoute?.fullscreen
38+
return maybeFullscreen == null || maybeFullscreen == true
3839
}
3940
get _isNotFullscreen() {
4041
return !this._isFullscreen

src/components/Navigation.tsx

Lines changed: 24 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,10 @@ import {
33
computed,
44
defineComponent,
55
h,
6-
Teleport,
6+
Ref,
77
watch,
88
} from '@vue/runtime-core'
9+
import { Maybe } from '../abstract/BasicTypes'
910
import { Colors } from '../abstract/Colors'
1011
import { EdgeInsetsStep } from '../abstract/EdgeInsets'
1112
import { NavigationController } from '../abstract/Navigation'
@@ -18,9 +19,10 @@ import { Center } from './Center'
1819
import { Positioned } from './Positioned'
1920
import { MultiProvider } from './Provider'
2021
import { Visibility } from './Visibility'
21-
22+
import VueTeleport from './VueTeleport.vue'
2223
interface NavigationI {
2324
child: Component
25+
debug?: Ref<Maybe<boolean>>
2426
}
2527
/**
2628
* This class provides a way to render and manage routes
@@ -40,23 +42,33 @@ interface NavigationI {
4042
* })
4143
* ```
4244
*/
43-
export const Navigation = ({ child }: NavigationI) => {
45+
export const Navigation = ({ child, debug }: NavigationI) => {
4446
return defineComponent({
4547
name: 'Navigation',
46-
48+
components: {
49+
VueTeleport,
50+
},
4751
setup() {
4852
const routeController = MultiProvider.get<NavigationController>(
4953
NavigationController
5054
)
5155

5256
const isRoutesExists = computed(() => routeController.count > 0)
53-
watch(isRoutesExists, () => {
54-
console.log({ isRoutesExists })
55-
})
57+
watch(
58+
isRoutesExists,
59+
() => {
60+
if (debug?.value) console.log({ isRoutesExists })
61+
},
62+
{ deep: true, immediate: true }
63+
)
5664
const isFullscreen = computed(() => routeController._isFullscreen)
57-
watch(isRoutesExists, () => {
58-
console.log({ isFullscreen })
59-
})
65+
watch(
66+
isRoutesExists,
67+
() => {
68+
if (debug?.value) console.log({ isFullscreen })
69+
},
70+
{ deep: true, immediate: true }
71+
)
6072
const isNotFullscreen = computed(() => routeController._isNotFullscreen)
6173
return () =>
6274
h('div', {}, [
@@ -65,7 +77,7 @@ export const Navigation = ({ child }: NavigationI) => {
6577
Visibility({
6678
visible: isRoutesExists,
6779
child: h(
68-
<Teleport to="#app">
80+
<vue-teleport to="#app">
6981
{h(
7082
Positioned({
7183
_zIndex: routeController._backgroundZIndex.value,
@@ -147,7 +159,7 @@ export const Navigation = ({ child }: NavigationI) => {
147159
),
148160
})
149161
)}
150-
</Teleport>
162+
</vue-teleport>
151163
),
152164
})
153165
),

src/components/VueTeleport.vue

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<template>
2+
<teleport :to="to">
3+
<slot />
4+
</teleport>
5+
</template>
6+
<script lang="ts">
7+
export default {
8+
name: 'VueTeleport',
9+
props: {
10+
to: {
11+
type: String,
12+
required: true,
13+
},
14+
},
15+
}
16+
</script>
File renamed without changes.
Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,19 @@
1-
<script lang="ts">
2-
import { h } from 'vue'
3-
import { WrapperApp } from '../example/App'
1+
import { NavigationController } from '@/abstract'
42
import { MultiProvider, Navigation } from '@/components'
3+
import { h, ref } from 'vue'
4+
import { WrapperApp } from '../example/App'
55
import { HeroesModel } from './HeroesModel'
6-
import { NavigationController } from '@/abstract'
7-
export default {
6+
export const AppProvider = {
87
setup() {
98
return () =>
109
h(
1110
MultiProvider.create({
1211
models: [HeroesModel, NavigationController],
1312
child: Navigation({
1413
child: WrapperApp(),
14+
debug: ref(true),
1515
}),
1616
})
1717
)
1818
},
1919
}
20-
</script>
21-
<style lang="scss">
22-
#app {
23-
font-family: Avenir, Helvetica, Arial, sans-serif;
24-
-webkit-font-smoothing: antialiased;
25-
-moz-osx-font-smoothing: grayscale;
26-
}
27-
</style>

src/main.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { createApp } from 'vue'
22
import vueGridLayout from 'vue-grid-layout'
33
import 'vue3-virtual-scroller/dist/vue3-virtual-scroller.css'
44
import './components/index.scss'
5-
import App from './example/App.vue'
5+
import { AppProvider } from './example/AppProvider'
66
import './tailwind.css'
77

8-
createApp(App).use(vueGridLayout).mount('#app')
8+
createApp(AppProvider).use(vueGridLayout).mount('#app')

0 commit comments

Comments
 (0)