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", "name": "@goldenwere/mackenzii-embeds",
"private": true, "private": true,
"version": "0.0.0", "version": "0.1.0",
"type": "module", "type": "module",
"main": "src/index.ts", "main": "src/index.ts",
"peerDependencies": { "peerDependencies": {

View file

@ -1,7 +1,7 @@
{ {
"name": "@goldenwere/mackenzii-types", "name": "@goldenwere/mackenzii-types",
"private": true, "private": true,
"version": "0.0.0", "version": "0.1.0",
"type": "module", "type": "module",
"types": "src/index.d.ts", "types": "src/index.d.ts",
"main": "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. * Defines global values for the site.
*/ */
export type SiteGlobals = { export type SiteGlobals = {
/**
* Route config
*/
routes: RouteCollection routes: RouteCollection
/**
* Header config
*/
header: HeaderEntry[] header: HeaderEntry[]
/**
* Identifier for the site (used for prefixing site cache values)
*/
id: string 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[] stylesheetUrls: string[]
/**
* Theme config
*/
themes: SiteThemeList themes: SiteThemeList
/**
* Tags used by certain templates
*/
tags?: string | MediaEntryTag[] 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 warning: WarningModal
} }

View file

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

View file

@ -3,18 +3,48 @@ import { ArticleEntry } from '../content/templates/article-list'
import { GalleryEntry } from '../content/templates/gallery-list' import { GalleryEntry } from '../content/templates/gallery-list'
import { TemplateType } from '../content/templates/templateType' import { TemplateType } from '../content/templates/templateType'
import { WarningModal } from './warnings' 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 * Defines the shared options for a route
*/ */
export type SharedRouteDefinition = { export type SharedRouteDefinition = BaseRouteDefinition & {
/**
* Unique identifier for the page
*/
id: string id: string
scriptUrl?: string /**
stylesheetUrls?: string[] * What kind of page the route is
*/
template: TemplateType 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 warning?: boolean | WarningModal
} }
@ -22,6 +52,9 @@ export type SharedRouteDefinition = {
* Defines a content-based route * Defines a content-based route
*/ */
export type ContentfulRouteDefintion = SharedRouteDefinition & { export type ContentfulRouteDefintion = SharedRouteDefinition & {
/**
* Url to the page's content
*/
content: string content: string
} }
@ -29,6 +62,9 @@ export type ContentfulRouteDefintion = SharedRouteDefinition & {
* Defines a config-based route * Defines a config-based route
*/ */
export type ConfigfulRouteDefinition = SharedRouteDefinition & { export type ConfigfulRouteDefinition = SharedRouteDefinition & {
/**
* Url to the page's config
*/
config: string config: string
} }
@ -44,11 +80,10 @@ export type MarkdownDefinition = ContentfulRouteDefintion & {
*/ */
export type ArticleListDefinition = ConfigfulRouteDefinition & { export type ArticleListDefinition = ConfigfulRouteDefinition & {
template: 'article-list' template: 'article-list'
view: { /**
title: string * Config for the child view `{parent/path}/view` route
fullTitle: string */
stylesheetUrls: string[] view: BaseRouteDefinition
}
} }
/** /**
@ -56,20 +91,20 @@ export type ArticleListDefinition = ConfigfulRouteDefinition & {
*/ */
export type GalleryListDefinition = ConfigfulRouteDefinition & { export type GalleryListDefinition = ConfigfulRouteDefinition & {
template: 'gallery-list' template: 'gallery-list'
view: { /**
title: string * Config for the child view `{parent/path}/view` route
fullTitle: string */
stylesheetUrls: string[] view: BaseRouteDefinition
}
} }
/** /**
* Defines all available route definitions * Defines all available route definitions
*/ */
export type RouteDefinition = export type RouteDefinition = (
| MarkdownDefinition | MarkdownDefinition
| ArticleListDefinition | ArticleListDefinition
| GalleryListDefinition | GalleryListDefinition
)
/** /**
* Defines the collection of routes the app uses * Defines the collection of routes the app uses
@ -80,6 +115,7 @@ export type RouteCollection = { [key: string]: RouteDefinition }
* Defines {@link Window} globals * Defines {@link Window} globals
*/ */
export interface RoutedWindow extends Window { 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 mountComponent: typeof mount
/** refers to a template's primary route config; may briefly refer to sub config until a view is fully resolved */ /** refers to a template's primary route config; may briefly refer to sub config until a view is fully resolved */
routeConfig: RouteDefinition routeConfig: RouteDefinition

View file

@ -2,8 +2,17 @@
* Defines a stylesheet the site uses for applying a theme * Defines a stylesheet the site uses for applying a theme
*/ */
export type SiteTheme = { export type SiteTheme = {
/**
* User-friendly name to render in the site theme picker
*/
displayName?: string displayName?: string
/**
* What kind of theme it is for accessibility purposes
*/
type: SiteThemeType type: SiteThemeType
/**
* The stylesheet url for the theme
*/
url: string url: string
} }
@ -17,8 +26,9 @@ export type SiteThemeList = { [id: string]: SiteTheme }
* for the purposes of determining a default theme * for the purposes of determining a default theme
* based on the system/browser setting of the visitor * based on the system/browser setting of the visitor
*/ */
export type SiteThemeType = export type SiteThemeType = (
| 'dark' | 'dark'
| 'light' | 'light'
| 'dark_hc' | 'dark_hc'
| 'light_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. * Defines the structure of the warning modal that shows when a route has a content warning of some sort.
*/ */
export type WarningModal = { export type WarningModal = {
/**
* The modal's body text
*/
prompt: string prompt: string
/**
* Information used by the Leave button
*/
leave: { leave: {
/**
* The url the button should kick the user to
*/
url: string, url: string,
/**
* The text shown on the Leave button
*/
text: string, text: string,
}, },
/**
* The text shown on the Acknowledge button
*/
acknowledge: string, acknowledge: string,
/**
* The text shown on the Remember checkbox (which caches the user's consent and avoids re-prompting the modal repeatedly)
*/
remember: string, remember: string,
} }

View file

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

View file

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

16
package-lock.json generated
View file

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

View file

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

View file

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

View file

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