File tree Expand file tree Collapse file tree 3 files changed +13
-16
lines changed
pages/package-code/[[org]]/[packageName]/v/[version] Expand file tree Collapse file tree 3 files changed +13
-16
lines changed Original file line number Diff line number Diff line change @@ -24,7 +24,7 @@ const emit = defineEmits<{
2424 ' mobile-tree-drawer-toggle' : []
2525}>()
2626
27- const { codeContainerFull, toggleCodeContainer } = useCodeContainer ()
27+ const { toggleCodeContainer } = useCodeContainer ()
2828
2929const markdownViewModes = [
3030 {
@@ -254,9 +254,7 @@ useEventListener('keydown', (event: KeyboardEvent) => {
254254 <ButtonBase
255255 class =" px-3 max-xl:hidden"
256256 :disabled =" loading"
257- :classicon ="
258- codeContainerFull ? 'i-lucide:fold-horizontal' : 'i-lucide:unfold-horizontal'
259- "
257+ classicon =" i-lucide:unfold-horizontal [.container-full>& ]:i-lucide:fold-horizontal"
260258 :aria-label =" $t('code.toggle_container')"
261259 @click =" toggleCodeContainer()"
262260 />
Original file line number Diff line number Diff line change @@ -81,8 +81,6 @@ const STORAGE_KEY = 'npmx-settings'
8181// Shared settings instance (singleton per app)
8282let settingsRef : RemovableRef < AppSettings > | null = null
8383
84- const hasHydrated = ref ( false )
85-
8684/**
8785 * Composable for managing application settings with localStorage persistence.
8886 * Settings are shared across all components that use this composable.
@@ -244,11 +242,7 @@ export function useBackgroundTheme() {
244242export function useCodeContainer ( ) {
245243 const { settings } = useSettings ( )
246244
247- onMounted ( ( ) => {
248- hasHydrated . value = true
249- } )
250-
251- const codeContainerFull = computed ( ( ) => hasHydrated . value && settings . value . codeContainerFull )
245+ const codeContainerFull = computed ( ( ) => settings . value . codeContainerFull )
252246
253247 function toggleCodeContainer ( ) {
254248 settings . value . codeContainerFull = ! settings . value . codeContainerFull
Original file line number Diff line number Diff line change @@ -290,11 +290,10 @@ defineOgImageComponent('Default', {
290290
291291onPrehydrate (el => {
292292 const settingsSaved = JSON .parse (localStorage .getItem (' npmx-settings' ) || ' {}' )
293- const container = el .getElementById ( ' code-page-container' )
293+ const container = el .querySelector ( ' # code-page-container' )
294294
295295 if (settingsSaved ?.codeContainerFull === true && container ) {
296- console .log (' add max-w-full' )
297- container ! .classList .add (' max-w-full' , ' border-0' )
296+ container .classList .add (' container-full' )
298297 }
299298})
300299 </script >
@@ -336,8 +335,8 @@ onPrehydrate(el => {
336335 <div
337336 v-else-if =" !!fileTree"
338337 id =" code-page-container"
339- class =" w-full grid grid-cols-[18rem_1fr] max-lg:grid-cols-[16rem_1fr] max-md:grid-cols-[1fr] border-border border-x px-0 mx-auto transition-[max-width] duration-300"
340- :class =" [ codeContainerFull ? 'max-w- full border-0 ' : 'container'] "
338+ class =" w-full container grid grid-cols-[18rem_1fr] max-lg:grid-cols-[16rem_1fr] max-md:grid-cols-[1fr] border-border border-x px-0 mx-auto transition-[max-width] duration-300"
339+ :class =" codeContainerFull ? 'container- full' : '' "
341340 dir =" ltr"
342341 >
343342 <!-- File tree sidebar - sticky with internal scroll -->
@@ -479,3 +478,9 @@ onPrehydrate(el => {
479478 </ClientOnly >
480479 </main >
481480</template >
481+
482+ <style >
483+ .container-full.container-full {
484+ @apply max-w-full border- 0;
485+ }
486+ </style >
You can’t perform that action at this time.
0 commit comments