This commit is contained in:
lightling 2025-04-20 17:04:02 -04:00
parent 4419fe2e92
commit 3d5e310f4b
Signed by: lightling
GPG key ID: F1F29650D537C773
15 changed files with 140 additions and 38 deletions

View file

@ -1,7 +1,7 @@
{
"name": "@goldenwere/mackenzii-embeds",
"private": true,
"version": "0.0.0",
"version": "0.1.0",
"type": "module",
"main": "src/index.ts",
"peerDependencies": {

View file

@ -1,7 +1,7 @@
{
"name": "@goldenwere/mackenzii-types",
"private": true,
"version": "0.0.0",
"version": "0.1.0",
"type": "module",
"types": "src/index.d.ts",
"main": "src/index.d.ts"

View file

@ -8,11 +8,34 @@ import type { WarningModal } from './warnings'
* Defines global values for the site.
*/
export type SiteGlobals = {
/**
* Route config
*/
routes: RouteCollection
/**
* Header config
*/
header: HeaderEntry[]
/**
* Identifier for the site (used for prefixing site cache values)
*/
id: string
/**
* Global stylesheets shared across all pages to load for the site;
* these are additive and not overridden by per-page stylesheet URLs
*/
stylesheetUrls: string[]
/**
* Theme config
*/
themes: SiteThemeList
/**
* Tags used by certain templates
*/
tags?: string | MediaEntryTag[]
/**
* Default modal text shown by certain templates that may feature content warnings;
* can be overridden per-page, this is used as a fallback when not defined per-page.
*/
warning: WarningModal
}

View file

@ -6,12 +6,13 @@ export type HeaderEntry = {
displayName: string
} & ({
path: string
target?:
target?: (
| '_self'
| '_blank'
| '_parent'
| '_top'
| '_unfencedTop'
)
} | {
children: HeaderEntry[]
})

View file

@ -3,18 +3,48 @@ 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'
import type { mount } from 'mount-vue-component'
/**
* Defines the base options for all routes
*/
export type BaseRouteDefinition = {
/**
* The short-form title of the page (used for breadcrumbs/any other place that `fullTitle` isn't used)
*/
title: string
/**
* The full title of the page (used for document title)
*/
fullTitle: string
/**
* Stylesheets to load on the page
*/
stylesheetUrls?: string[]
/**
* Script to load on the page
*/
scriptUrl?: string
}
/**
* Defines the shared options for a route
*/
export type SharedRouteDefinition = {
export type SharedRouteDefinition = BaseRouteDefinition & {
/**
* Unique identifier for the page
*/
id: string
scriptUrl?: string
stylesheetUrls?: string[]
/**
* What kind of page the route is
*/
template: TemplateType
title: string
fullTitle: string
/**
* Modal text shown by certain templates that may feature content warnings;
* setting this to `false` will force the modal off regardless of global site config;
* setting this to `true` or leaving it `undefined`/`null` will use the global site config;
* setting this to {@link WarningModal} will override the global site config with the defined modal definition
*/
warning?: boolean | WarningModal
}
@ -22,6 +52,9 @@ export type SharedRouteDefinition = {
* Defines a content-based route
*/
export type ContentfulRouteDefintion = SharedRouteDefinition & {
/**
* Url to the page's content
*/
content: string
}
@ -29,6 +62,9 @@ export type ContentfulRouteDefintion = SharedRouteDefinition & {
* Defines a config-based route
*/
export type ConfigfulRouteDefinition = SharedRouteDefinition & {
/**
* Url to the page's config
*/
config: string
}
@ -44,11 +80,10 @@ export type MarkdownDefinition = ContentfulRouteDefintion & {
*/
export type ArticleListDefinition = ConfigfulRouteDefinition & {
template: 'article-list'
view: {
title: string
fullTitle: string
stylesheetUrls: string[]
}
/**
* Config for the child view `{parent/path}/view` route
*/
view: BaseRouteDefinition
}
/**
@ -56,20 +91,20 @@ export type ArticleListDefinition = ConfigfulRouteDefinition & {
*/
export type GalleryListDefinition = ConfigfulRouteDefinition & {
template: 'gallery-list'
view: {
title: string
fullTitle: string
stylesheetUrls: string[]
}
/**
* Config for the child view `{parent/path}/view` route
*/
view: BaseRouteDefinition
}
/**
* Defines all available route definitions
*/
export type RouteDefinition =
export type RouteDefinition = (
| MarkdownDefinition
| ArticleListDefinition
| GalleryListDefinition
)
/**
* Defines the collection of routes the app uses
@ -80,6 +115,7 @@ export type RouteCollection = { [key: string]: RouteDefinition }
* Defines {@link Window} globals
*/
export interface RoutedWindow extends Window {
/** function registered by the vite-ssg build which will mount Vue components in place of elements they are replacing (e.g. image embeds with PrimeVue Image) */
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

View file

@ -2,8 +2,17 @@
* Defines a stylesheet the site uses for applying a theme
*/
export type SiteTheme = {
/**
* User-friendly name to render in the site theme picker
*/
displayName?: string
/**
* What kind of theme it is for accessibility purposes
*/
type: SiteThemeType
/**
* The stylesheet url for the theme
*/
url: string
}
@ -17,8 +26,9 @@ export type SiteThemeList = { [id: string]: SiteTheme }
* for the purposes of determining a default theme
* based on the system/browser setting of the visitor
*/
export type SiteThemeType =
export type SiteThemeType = (
| 'dark'
| 'light'
| 'dark_hc'
| 'light_hc'
)

View file

@ -2,11 +2,29 @@
* Defines the structure of the warning modal that shows when a route has a content warning of some sort.
*/
export type WarningModal = {
/**
* The modal's body text
*/
prompt: string
/**
* Information used by the Leave button
*/
leave: {
/**
* The url the button should kick the user to
*/
url: string,
/**
* The text shown on the Leave button
*/
text: string,
},
/**
* The text shown on the Acknowledge button
*/
acknowledge: string,
/**
* The text shown on the Remember checkbox (which caches the user's consent and avoids re-prompting the modal repeatedly)
*/
remember: string,
}

View file

@ -5,7 +5,13 @@ import type { MediaEntry } from './shared'
* to display when listing the entry on the article-list page.
*/
export type ArticleEntry = {
/**
* Alternative text to render for an entry (used on alt attribute for thumbnail where applicable)
*/
alternativeText?: string
/**
* Caption to show for the entry (used on title attribute as well as displayed caption text where applicable)
*/
caption?: string
/**
* URL to the entry's thumbnail

View file

@ -3,10 +3,11 @@ import type { MediaEntry } from './shared'
/**
* Defines the supported formats for a gallery entry
*/
export type GalleryEntryFormat =
export type GalleryEntryFormat = (
| 'image'
)
/**
/**
* Defines properties shared among the different versions of a {@link GalleryEntry}
*/
export type GalleryEntrySharedProperties = {
@ -21,7 +22,13 @@ export type GalleryEntrySharedProperties = {
* It contains a URL to the media that the entry represents.
*/
export type GalleryEntryWithoutVariants = {
/**
* Alternative text to render for an entry (used on alt attribute for images where applicable)
*/
alternativeText?: string
/**
* Caption to show for the entry (used on title attribute as well as displayed caption text where applicable)
*/
caption?: string
/**
* URL to the entry's thumbnail

View file

@ -2,7 +2,8 @@
* Defines the available `views` that can be used to set up routes.
* Each `Template` has different configuration options
*/
export type TemplateType =
export type TemplateType = (
| 'markdown'
| 'article-list'
| 'gallery-list'
)

16
package-lock.json generated
View file

@ -1,12 +1,12 @@
{
"name": "@goldenwere/mackenzii",
"version": "0.0.0",
"version": "0.1.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "@goldenwere/mackenzii",
"version": "0.0.0",
"version": "0.1.0",
"workspaces": [
"projects/*",
"libs/*"
@ -14,14 +14,14 @@
},
"libs/embeds": {
"name": "@goldenwere/mackenzii-embeds",
"version": "0.0.0",
"version": "0.1.0",
"peerDependencies": {
"typescript": "^5"
}
},
"libs/types": {
"name": "@goldenwere/mackenzii-types",
"version": "0.0.0"
"version": "0.1.0"
},
"node_modules/@asamuzakjp/css-color": {
"version": "3.1.2",
@ -10978,7 +10978,7 @@
}
},
"node_modules/github-from-package": {
"version": "0.0.0",
"version": "0.1.0",
"resolved": "https://registry.npmjs.org/github-from-package/-/github-from-package-0.0.0.tgz",
"integrity": "sha512-SyHy3T1v2NUXn29OsWdxmK6RwHD+vkj3v8en8AOBZ1wBQ/hCAQ5bAQTD02kW4W9tUp/3Qh6J8r9EvntiyCmOOw==",
"license": "MIT"
@ -14425,7 +14425,7 @@
}
},
"node_modules/noms": {
"version": "0.0.0",
"version": "0.1.0",
"resolved": "https://registry.npmjs.org/noms/-/noms-0.0.0.tgz",
"integrity": "sha512-lNDU9VJaOPxUmXcLb+HQFeUgQQPtMI24Gt6hgfuMHRJgMRHMF/qZ4HJD3GDru4sSw9IQl2jPjAYnQrdIeLbwow==",
"license": "ISC",
@ -21036,7 +21036,7 @@
}
},
"projects/frontend": {
"version": "0.0.0",
"version": "0.1.0",
"devDependencies": {
"@goldenwere/mackenzii-embeds": "*",
"@goldenwere/mackenzii-types": "*",
@ -21069,7 +21069,7 @@
}
},
"projects/manager": {
"version": "0.0.0",
"version": "0.1.0",
"devDependencies": {
"chalk": "5.4.1",
"symlink-dir": "6.0.5"

View file

@ -1,7 +1,7 @@
{
"name": "@goldenwere/mackenzii",
"private": true,
"version": "0.0.0",
"version": "0.1.0",
"type": "module",
"scripts": {
"start": "npm start -w=frontend",

View file

@ -1,7 +1,7 @@
{
"name": "frontend",
"private": true,
"version": "0.0.0",
"version": "0.1.0",
"type": "module",
"scripts": {
"start": "vite",

View file

@ -1,7 +1,7 @@
{
"name": "manager",
"private": true,
"version": "0.0.0",
"version": "0.1.0",
"type": "module",
"devDependencies": {
"chalk": "5.4.1",