Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
105 commits
Select commit Hold shift + click to select a range
926dfa1
refactor: refactored layout to be a plugin
Haviles04 Aug 4, 2025
86e4df7
type: typing changes
Haviles04 Aug 4, 2025
8b3a65b
type: exclusive or type and typing context
Haviles04 Aug 5, 2025
b2e2124
Merge branch 'master' into haviles04/layout-plugin
Haviles04 Aug 5, 2025
051723d
refactor: pass component ref and calculate sizes based on window or c…
Haviles04 Aug 6, 2025
237f84a
test: updated test to use width and height instead of value
Haviles04 Aug 6, 2025
4058ce9
Merge branch 'master' into haviles04/layout-plugin
Haviles04 Aug 6, 2025
6e6cf03
Merge branch 'master' into haviles04/layout-plugin
Haviles04 Aug 7, 2025
cc602d2
refactor: use value
Haviles04 Aug 7, 2025
56100bc
Merge branch 'master' into haviles04/layout-plugin
Haviles04 Aug 7, 2025
bfe2f11
feat: fix typing
Haviles04 Aug 7, 2025
ed2111b
feat: add plugin to docs
Haviles04 Aug 7, 2025
fa7b882
feat: register element value
Haviles04 Aug 8, 2025
1f93036
feat: utilize in docs components
Haviles04 Aug 8, 2025
17158b5
feat: reactivity fix
Haviles04 Aug 14, 2025
4d0640c
feat: Dogfood useLayout in docs website
Haviles04 Aug 14, 2025
458aa0f
Merge branch 'master' into haviles04/layout-plugin
Haviles04 Aug 14, 2025
b656917
refactor: naming
Haviles04 Aug 14, 2025
490fb99
chore: eol
Haviles04 Aug 14, 2025
29dc462
fix: reactivity fixes
Haviles04 Aug 14, 2025
2762c35
feat: create useLayoutItem
Haviles04 Aug 15, 2025
2894403
feat: composables
Haviles04 Aug 15, 2025
e66f643
feat: added styles
Haviles04 Aug 15, 2025
962005b
fix: styles
Haviles04 Aug 15, 2025
7430df6
fix: fixed reactivity of styles
Haviles04 Aug 16, 2025
ba991cf
fix: nested layouts
Haviles04 Aug 17, 2025
d23156a
fix: bottom and right maths
Haviles04 Aug 17, 2025
b09450f
refactor: return rect object
Haviles04 Aug 17, 2025
2b580a2
refactor: changed calculations
Haviles04 Aug 17, 2025
5c49125
feat: useAtomRef
Haviles04 Aug 18, 2025
fa23d5a
feat: useAtomRef
Haviles04 Aug 18, 2025
799eb19
feat: useAtomRef
Haviles04 Aug 18, 2025
852706f
feat: autoimport
Haviles04 Aug 20, 2025
665af46
Merge branch 'master' into haviles04/layout-plugin
Haviles04 Aug 20, 2025
49d6edf
feat: use plugin
Haviles04 Aug 20, 2025
1018608
feat: calculate previously registered same position elements
Haviles04 Aug 20, 2025
2b752ec
chore: remove debugger
Haviles04 Aug 20, 2025
1ab11e4
feat: utilize layout inside docs app
Haviles04 Aug 20, 2025
2218da8
Merge branch 'master' into haviles04/layout-plugin
Haviles04 Aug 20, 2025
2f007b2
feat: always remove event listener
Haviles04 Aug 20, 2025
c5df9f8
fix: navbar z
Haviles04 Aug 20, 2025
e5baec4
feat: nested layout
Haviles04 Aug 20, 2025
5200704
fix: x value
Haviles04 Aug 20, 2025
78dff89
chore: remove console.log
Haviles04 Aug 20, 2025
485d3e5
chore: remove un-needed ref
Haviles04 Aug 20, 2025
a4afafe
Merge branch 'master' into haviles04/layout-plugin
Haviles04 Aug 21, 2025
16fa3ed
refactor: adjust values based on what came before
Haviles04 Aug 21, 2025
fb3d802
refactor: adjust values based on what came before
Haviles04 Aug 21, 2025
6ea246f
chore: lint
Haviles04 Aug 21, 2025
1aed5e4
fix: stacking
Haviles04 Aug 21, 2025
f66a305
chore: fix right bottom stacking
Haviles04 Aug 21, 2025
d6c496b
refactor: changed calculations
Haviles04 Aug 22, 2025
505c13f
refactor: fix nested
Haviles04 Aug 22, 2025
4047e8f
refactor: update docs to use layout
Haviles04 Aug 22, 2025
919214a
chore: redundant lines and console log
Haviles04 Aug 22, 2025
25bec8f
refactor: computed instead of watcheffect
Haviles04 Aug 22, 2025
a9171de
refactor: object instead of function
Haviles04 Aug 22, 2025
0cfbaff
refactor: dont remake opposite
Haviles04 Aug 22, 2025
480e444
refactor: remove unused sized and redundant return
Haviles04 Aug 22, 2025
0e99ad2
fix: removed icon transition
Haviles04 Aug 22, 2025
c3df407
refactor: reduce function calls
Haviles04 Aug 22, 2025
d0ecc54
Merge branch 'master' into haviles04/layout-plugin
Haviles04 Aug 25, 2025
16ffc68
refactor: remove redundancy
Haviles04 Aug 25, 2025
3be93b3
fix: typing
Haviles04 Aug 26, 2025
cd1189e
Merge branch 'master' into haviles04/layout-plugin
Haviles04 Aug 27, 2025
d3a0f72
fix: app.drawer instead of app.nav.value
Haviles04 Aug 27, 2025
eb2fbdc
Merge branch 'master' into haviles04/layout-plugin
Haviles04 Aug 27, 2025
a0afa15
feat: only show logo on desktop
Haviles04 Aug 27, 2025
3cdb421
fix: styling overflow
Haviles04 Aug 27, 2025
a391cdb
chore: cleanup
Haviles04 Aug 27, 2025
e2afc39
refactor: use computed
Haviles04 Aug 28, 2025
afd5e7e
fix: app nav
Haviles04 Aug 29, 2025
0ef3c4b
refactor: remove useAtomRef
Haviles04 Aug 29, 2025
432397d
Merge branch 'master' into haviles04/layout-plugin
Haviles04 Aug 31, 2025
62b3fd9
refactor: code style tweaks
johnleider Aug 31, 2025
9c39ed2
docs(AppNav): remove extra line
johnleider Aug 31, 2025
86aefb1
chore(useLayout): code style tweaks
johnleider Aug 31, 2025
09fc2d7
chore(useLayout): more cleanup
johnleider Aug 31, 2025
7a70905
fix: calculations
Haviles04 Aug 31, 2025
ef300cd
refactor(useLayout): bring in line with other plugins like useTheme
johnleider Sep 1, 2025
a978491
chore(useLayout): code clean-up
johnleider Sep 1, 2025
47a02ca
fix: allow only element or value
Haviles04 Sep 2, 2025
a7f3205
test: fix current test
Haviles04 Sep 2, 2025
45ec4dc
test: add size test
Haviles04 Sep 2, 2025
8b65ab6
test: also check main
Haviles04 Sep 2, 2025
f3c841f
test: check child component
Haviles04 Sep 3, 2025
bb147d1
fix: ts
Haviles04 Sep 3, 2025
c251d06
chore: comment
Haviles04 Sep 3, 2025
a700504
refactor: pull first HTMLelement type key instead of forcing element
Haviles04 Sep 3, 2025
882125d
fix: return correct value
Haviles04 Sep 3, 2025
fb9213f
Merge branch 'master' into haviles04/layout-plugin
Haviles04 Sep 4, 2025
7419144
chore: import
Haviles04 Sep 5, 2025
d9c77ea
Merge branch 'master' into haviles04/layout-plugin
Haviles04 Sep 5, 2025
ef6c8a3
fix: isSelected
Haviles04 Sep 5, 2025
9618ca3
fix: typing
Haviles04 Sep 5, 2025
c2ff709
fix: typing
Haviles04 Sep 7, 2025
07996bf
feat: added order
Haviles04 Sep 8, 2025
27a8858
feat: added bench
Haviles04 Sep 8, 2025
04a7a35
chore: dont nest ternary
Haviles04 Sep 8, 2025
18e0ca0
bench: fix bench
Haviles04 Sep 8, 2025
b7c04fc
chore: paddings
Haviles04 Sep 8, 2025
0305386
Merge branch 'master' into haviles04/layout-plugin
Haviles04 Sep 9, 2025
7d00aff
Merge branch 'master' into haviles04/layout-plugin
Haviles04 Sep 10, 2025
1f45695
Merge branch 'master' into haviles04/layout-plugin
Haviles04 Sep 11, 2025
1917bac
fix: useContext
Haviles04 Sep 11, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 21 additions & 5 deletions apps/docs/src/components/app/AppBanner.vue
Original file line number Diff line number Diff line change
@@ -1,25 +1,41 @@
<script setup lang="ts">
// Components
import { Atom, useBreakpoints } from '@vuetify/v0'
import { Atom, useBreakpoints, useLayout } from '@vuetify/v0'

// Utilities
import { useTemplateRef } from 'vue'

// Types
import type { AtomProps } from '@vuetify/v0'

const { as = 'header' } = defineProps<AtomProps>()

const breakpoints = useBreakpoints()
const element = useTemplateRef('banner')
const layout = useLayout()
const item = layout.register({
id: 'banner',
position: 'top',
element,
value: 24,
})
</script>

<template>
<Atom
ref="banner"
:as
class="app-banner flex items-center justify-center h-[24px] fixed left-0 top-0 right-0 px-3 text-xs gap-2"
class="app-banner flex items-center justify-center fixed px-3 text-xs gap-2"
:style="{
top: item.rect.y.value + 'px',
left: item.rect.x.value + 'px',
height: item.rect.height.value + 'px',
width: item.rect.width.value + 'px',
}"
>
<AppIcon icon="alert" :size="14" />

<div>
You are viewing Pre-Alpha documentation. <span v-if="!breakpoints.isMobile">Some features may not work as expected.</span>
</div>
You are viewing Pre-Alpha documentation. <span v-if="!breakpoints.isMobile">Some features may not work as expected.</span>
</Atom>
</template>

Expand Down
22 changes: 19 additions & 3 deletions apps/docs/src/components/app/AppBar.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
<script setup lang="ts">
// Components
import { Atom, useBreakpoints } from '@vuetify/v0'
import { Atom, useBreakpoints, useLayout } from '@vuetify/v0'

// Utilities
import { useTemplateRef } from 'vue'

// Composables
import { useAppStore } from '@/stores/app'
Expand All @@ -18,13 +21,26 @@
auth = useAuthStore()
}
const breakpoints = useBreakpoints()
const element = useTemplateRef('bar')
const layout = useLayout()
const item = layout.register({
id: 'bar',
position: 'top',
element,
})

</script>

<template>
<Atom
ref="bar"
:as
class="app-header flex items-center justify-between h-[48px] fixed left-0 top-[24px] right-0 px-3 transition-margin duration-200 ease-in-out"
:class="breakpoints.isMobile && 'left-0'"
class="app-header flex items-center justify-between fixed px-3 h-[48px]"
:style="{
left: item.rect.x.value + 'px',
top: item.rect.y.value + 'px',
width: item.rect.width.value + 'px',
}"
>
<div class="flex items-center gap-1">
<img
Expand Down
23 changes: 20 additions & 3 deletions apps/docs/src/components/app/AppFooter.vue
Original file line number Diff line number Diff line change
@@ -1,20 +1,37 @@
<script setup lang="ts">
// Components
import { Atom, useBreakpoints } from '@vuetify/v0'
import { Atom, useBreakpoints, useLayout } from '@vuetify/v0'

// Utilities
import { useTemplateRef } from 'vue'

// Types
import type { AtomProps } from '@vuetify/v0'

const { as = 'footer' } = defineProps<AtomProps>()

const breakpoints = useBreakpoints()
const element = useTemplateRef('footer')
const layout = useLayout()
const item = layout.register({
id: 'footer',
position: 'bottom',
element,
value: 24,
})
</script>

<template>
<Atom
ref="footer"
:as
class="app-footer flex items-center justify-between h-[24px] fixed bottom-0 left-[220px] right-0 px-3 text-xs bg-surface border-t"
:class="breakpoints.isMobile && 'left-0'"
:class="`app-footer flex items-center justify-end fixed px-3 text-xs ${breakpoints.isMobile && 'left-0'}`"
:style="{
left: item.rect.x.value + 'px',
top: item.rect.y.value + 'px',
height: item.rect.height.value + 'px',
width: item.rect.width.value + 'px',
}"
>
<DocsLastCommit />

Expand Down
12 changes: 8 additions & 4 deletions apps/docs/src/components/app/AppMain.vue
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
<script lang="ts" setup>
import { useBreakpoints } from '@vuetify/v0'
import { useLayout } from '@vuetify/v0'

const breakpoints = useBreakpoints()
const layout = useLayout()
</script>

<template>
<div
class="pa-4 pb-6 mt-[72px] transition-margin duration-200 ease-in-out"
:class="breakpoints.isMobile ? 'ml-0' : 'ml-[220px]'"
class="pa-4 fixed inset-0 overflow-y-auto"
:style="{
top: layout.main.y.value + 'px',
width: layout.main.width.value + 'px',
left: layout.main.x.value + 'px',
}"
>
<div class="max-w-[688px] mx-auto pb-4">
<router-view />
Expand Down
31 changes: 27 additions & 4 deletions apps/docs/src/components/app/AppNav.vue
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<script setup lang="ts">
import { Atom, useBreakpoints } from '@vuetify/v0'
import { Atom, useBreakpoints, useLayout } from '@vuetify/v0'
import { useAppStore } from '@/stores/app'
import { useRoute } from 'vue-router'
import { watch } from 'vue'
import { watch, watchEffect, useTemplateRef } from 'vue'
import type { AtomProps } from '@vuetify/v0'

const { as = 'nav' } = defineProps<AtomProps>()
Expand All @@ -16,16 +16,39 @@
app.drawer = false
}
})

const element = useTemplateRef('nav')
const layout = useLayout()
const item = layout.register({
id: 'nav',
position: 'left',
element,
value: 220,
})

watchEffect(() => {
if (breakpoints.isMobile) {
item.unselect()
} else {
item.select()
}
})
</script>

<template>
<Atom
ref="nav"
:as
class="bg-4 app-nav flex flex-col fixed top-[72px] w-[220px] overflow-y-auto py-4 transition-transform duration-200 ease-in-out"
class="bg-4 z-1000 app-nav flex flex-col py-4 fixed overflow-y-auto transition-transform duration-200 ease-in-out"
:class="[
breakpoints.isMobile && !app.drawer ? 'translate-x-[-100%]' : 'translate-x-0',
breakpoints.isMobile ? 'top-[72px] bottom-[24px]' : 'top-[24px] bottom-0'
]"
:style="{
height: item.rect.height.value + 'px',
width: item.rect.width.value + 'px',
left: item.rect.x.value + 'px',
top: item.rect.y.value + 'px',
}"
>
<ul class="flex gap-2 flex-col">
<template v-for="(nav, i) in app.nav" :key="i">
Expand Down
2 changes: 1 addition & 1 deletion apps/docs/src/layouts/default.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

<template>
<AppBanner />
<AppNav />
<AppBar />
<AppNav />
<AppMain />
<AppFooter />
</template>
3 changes: 2 additions & 1 deletion apps/docs/src/plugins/zero.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Vuetify0
import { createBreakpointsPlugin, createHydrationPlugin, createLoggerPlugin, createThemePlugin } from '@vuetify/v0'
import { createBreakpointsPlugin, createHydrationPlugin, createLoggerPlugin, createThemePlugin, createLayoutPlugin } from '@vuetify/v0'

// Plugins
import { createIconPlugin } from './icons'
Expand All @@ -12,6 +12,7 @@ export default function zero (app: App) {
app.use(createLoggerPlugin())
app.use(createHydrationPlugin())
app.use(createBreakpointsPlugin())
app.use(createLayoutPlugin())
app.use(
createThemePlugin({
default: 'light',
Expand Down
31 changes: 31 additions & 0 deletions packages/0/src/composables/useLayout/index.bench.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import { createLayout } from '#v0'
import { bench, describe, beforeAll } from 'vitest'

describe('useLayout benchmarks', () => {
let layout: any

beforeAll(() => {
for (let i = 0; i < 500; i++) {
const order = i % 25 === 0 ? i * -1 : 0
function getPosition (i: number): 'top' | 'left' | 'bottom' | 'right' {
if (i % 25 === 0) return 'top'
if (i % 30 === 0) return 'left'
if (i % 20 === 0) return 'bottom'
return 'right'
}

const position = getPosition(i)

layout.register({ id: `Component${i}`, position, value: i, order })
}
})

bench('register and get items', () => {

Check failure on line 23 in packages/0/src/composables/useLayout/index.bench.ts

View workflow job for this annotation

GitHub Actions / test

src/composables/useLayout/index.bench.ts

Error: `bench()` is only available in benchmark mode. ❯ src/composables/useLayout/index.bench.ts:23:3
const layout = createLayout()[2]
// Register 500 components
for (let i = 0; i < 500; i++) {
const gotItem = layout.get(`component${i}`)
void gotItem?.cumulative
}
})
})
Loading
Loading