1
0
Fork 0

fix builds

This commit is contained in:
lightling 2025-04-20 16:00:35 -04:00
parent 22361db2a9
commit 4419fe2e92
Signed by: lightling
GPG key ID: F1F29650D537C773
3 changed files with 11 additions and 3 deletions
libs/types/src/config
projects/frontend/src

View file

@ -3,6 +3,7 @@ import { ArticleEntry } from '../content/templates/article-list'
import { GalleryEntry } from '../content/templates/gallery-list'
import { TemplateType } from '../content/templates/templateType'
import { WarningModal } from './warnings'
import { mount } from 'mount-vue-component'
/**
* Defines the shared options for a route
@ -79,6 +80,7 @@ export type RouteCollection = { [key: string]: RouteDefinition }
* Defines {@link Window} globals
*/
export interface RoutedWindow extends Window {
mountComponent: typeof mount
/** refers to a template's primary route config; may briefly refer to sub config until a view is fully resolved */
routeConfig: RouteDefinition
/** refers to a template's sub config in the case of child routes under a template (e.g. article-view under article-list) */

View file

@ -1,11 +1,13 @@
<script setup lang="ts">
import { onMounted, createApp, getCurrentInstance } from 'vue'
import { mount } from 'mount-vue-component'
import { onMounted, getCurrentInstance } from 'vue'
import type { RoutedWindow } from '@goldenwere/mackenzii-types'
import PrimeVueImage from 'primevue/image'
import { inflateEmbeds } from 'src/components/inflators/embed'
declare const window: RoutedWindow
const props = defineProps<{
content: string
}>()
@ -14,7 +16,7 @@ const instance = getCurrentInstance()
const inflateComponents = () => {
// replace images with primevue/image
document.querySelectorAll('.content img:not(.no-inflate)').forEach((_element) => {
const inflated = mount(PrimeVueImage, {
const inflated = window.mountComponent(PrimeVueImage, {
props: {
alt: _element.getAttribute('alt'),
title: _element.getAttribute('title'),

View file

@ -40,10 +40,14 @@ export const createApp = ViteSSG(
},
}))
// vue-ssg doesn't like certain imports running at runtime like these, so they must be registered at the client level here
if (isClient) {
import('@goldenwere/mackenzii-embeds').then(({ registerLinkEmbed }) => {
registerLinkEmbed()
})
import('mount-vue-component').then(({ mount }) => {
window.mountComponent = mount
})
window.router = router
}