« get me outta code hell

content: specify mutable across html & attributes slots - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src/content
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2024-01-01 13:47:10 -0400
committer(quasar) nebula <qznebula@protonmail.com>2024-01-01 20:06:23 -0400
commitf53b9df7452ef886cf85db5bb72a48f32dce3dbb (patch)
treee173634830626d1d25b59c04600966f878f47c3c /src/content
parente0defee7f7ab50bf3e6d33d6ab04f6c6795bab27 (diff)
content: specify mutable across html & attributes slots
Diffstat (limited to 'src/content')
-rw-r--r--src/content/dependencies/generateArtistGroupContributionsInfo.js6
-rw-r--r--src/content/dependencies/generateArtistInfoPageChunk.js18
-rw-r--r--src/content/dependencies/generateArtistInfoPageChunkItem.js16
-rw-r--r--src/content/dependencies/generateArtistInfoPageChunkedList.js11
-rw-r--r--src/content/dependencies/generateContentHeading.js11
-rw-r--r--src/content/dependencies/generateDatetimestampTemplate.js12
-rw-r--r--src/content/dependencies/generateListAllAdditionalFilesChunk.js5
-rw-r--r--src/content/dependencies/generateListingPage.js5
-rw-r--r--src/content/dependencies/generatePageLayout.js65
-rw-r--r--src/content/dependencies/generatePreviousNextLinks.js17
-rw-r--r--src/content/dependencies/generateSecondaryNav.js5
-rw-r--r--src/content/dependencies/generateStickyHeadingContainer.js11
-rw-r--r--src/content/dependencies/generateWikiHomeContentRow.js5
-rw-r--r--src/content/dependencies/image.js5
-rw-r--r--src/content/dependencies/linkTemplate.js13
-rw-r--r--src/content/dependencies/linkThing.js17
16 files changed, 179 insertions, 43 deletions
diff --git a/src/content/dependencies/generateArtistGroupContributionsInfo.js b/src/content/dependencies/generateArtistGroupContributionsInfo.js
index fc82072c..374849ac 100644
--- a/src/content/dependencies/generateArtistGroupContributionsInfo.js
+++ b/src/content/dependencies/generateArtistGroupContributionsInfo.js
@@ -117,7 +117,11 @@ export default {
   },
 
   slots: {
-    title: {type: 'html'},
+    title: {
+      type: 'html',
+      mutable: false,
+    },
+
     showBothColumns: {type: 'boolean'},
     showSortButton: {type: 'boolean'},
     visible: {type: 'boolean', default: true},
diff --git a/src/content/dependencies/generateArtistInfoPageChunk.js b/src/content/dependencies/generateArtistInfoPageChunk.js
index d4c71c32..40943914 100644
--- a/src/content/dependencies/generateArtistInfoPageChunk.js
+++ b/src/content/dependencies/generateArtistInfoPageChunk.js
@@ -6,8 +6,20 @@ export default {
       validate: v => v.is('flash', 'album'),
     },
 
-    albumLink: {type: 'html'},
-    flashActLink: {type: 'html'},
+    albumLink: {
+      type: 'html',
+      mutable: false,
+    },
+
+    flashActLink: {
+      type: 'html',
+      mutable: false,
+    },
+
+    items: {
+      type: 'html',
+      mutable: false,
+    },
 
     date: {validate: v => v.isDate},
     dateRangeStart: {validate: v => v.isDate},
@@ -15,8 +27,6 @@ export default {
 
     duration: {validate: v => v.isDuration},
     durationApproximate: {type: 'boolean'},
-
-    items: {type: 'html'},
   },
 
   generate(slots, {html, language}) {
diff --git a/src/content/dependencies/generateArtistInfoPageChunkItem.js b/src/content/dependencies/generateArtistInfoPageChunkItem.js
index de31d30e..4347df12 100644
--- a/src/content/dependencies/generateArtistInfoPageChunkItem.js
+++ b/src/content/dependencies/generateArtistInfoPageChunkItem.js
@@ -2,10 +2,20 @@ export default {
   extraDependencies: ['html', 'language'],
 
   slots: {
-    content: {type: 'html'},
+    content: {
+      type: 'html',
+      mutable: false,
+    },
+
+    contribution: {
+      type: 'html',
+      mutable: false,
+    },
+
+    otherArtistLinks: {
+      validate: v => v.strictArrayOf(v.isHTML),
+    },
 
-    otherArtistLinks: {validate: v => v.strictArrayOf(v.isHTML)},
-    contribution: {type: 'html'},
     rerelease: {type: 'boolean'},
   },
 
diff --git a/src/content/dependencies/generateArtistInfoPageChunkedList.js b/src/content/dependencies/generateArtistInfoPageChunkedList.js
index a0334cbc..8503d014 100644
--- a/src/content/dependencies/generateArtistInfoPageChunkedList.js
+++ b/src/content/dependencies/generateArtistInfoPageChunkedList.js
@@ -2,8 +2,15 @@ export default {
   extraDependencies: ['html'],
 
   slots: {
-    groupInfo: {type: 'html'},
-    chunks: {type: 'html'},
+    groupInfo: {
+      type: 'html',
+      mutable: false,
+    },
+
+    chunks: {
+      type: 'html',
+      mutable: false,
+    },
   },
 
   generate(slots, {html}) {
diff --git a/src/content/dependencies/generateContentHeading.js b/src/content/dependencies/generateContentHeading.js
index 1c7ef1f1..469db876 100644
--- a/src/content/dependencies/generateContentHeading.js
+++ b/src/content/dependencies/generateContentHeading.js
@@ -7,8 +7,15 @@ export default {
   }),
 
   slots: {
-    title: {type: 'html'},
-    accent: {type: 'html'},
+    title: {
+      type: 'html',
+      mutable: false,
+    },
+
+    accent: {
+      type: 'html',
+      mutable: false,
+    },
 
     color: {validate: v => v.isColor},
 
diff --git a/src/content/dependencies/generateDatetimestampTemplate.js b/src/content/dependencies/generateDatetimestampTemplate.js
index d2648d67..dcc79130 100644
--- a/src/content/dependencies/generateDatetimestampTemplate.js
+++ b/src/content/dependencies/generateDatetimestampTemplate.js
@@ -2,8 +2,16 @@ export default {
   extraDependencies: ['html'],
 
   slots: {
-    mainContent: {type: 'html'},
-    tooltipContent: {type: 'html'},
+    mainContent: {
+      type: 'html',
+      mutable: false,
+    },
+
+    tooltipContent: {
+      type: 'html',
+      mutable: false,
+    },
+
     datetime: {type: 'string'},
   },
 
diff --git a/src/content/dependencies/generateListAllAdditionalFilesChunk.js b/src/content/dependencies/generateListAllAdditionalFilesChunk.js
index e31633f4..b046ccaf 100644
--- a/src/content/dependencies/generateListAllAdditionalFilesChunk.js
+++ b/src/content/dependencies/generateListAllAdditionalFilesChunk.js
@@ -4,7 +4,10 @@ export default {
   extraDependencies: ['html', 'language'],
 
   slots: {
-    title: {type: 'html'},
+    title: {
+      type: 'html',
+      mutable: false,
+    },
 
     additionalFileTitles: {
       validate: v => v.strictArrayOf(v.isHTML),
diff --git a/src/content/dependencies/generateListingPage.js b/src/content/dependencies/generateListingPage.js
index fe65a82d..aa661abd 100644
--- a/src/content/dependencies/generateListingPage.js
+++ b/src/content/dependencies/generateListingPage.js
@@ -104,7 +104,10 @@ export default {
       default: 'unordered',
     },
 
-    content: {type: 'html'},
+    content: {
+      type: 'html',
+      mutable: false,
+    },
   },
 
   generate(data, relations, slots, {html, language}) {
diff --git a/src/content/dependencies/generatePageLayout.js b/src/content/dependencies/generatePageLayout.js
index 3ed6631c..0d2ce557 100644
--- a/src/content/dependencies/generatePageLayout.js
+++ b/src/content/dependencies/generatePageLayout.js
@@ -4,7 +4,10 @@ function sidebarSlots(side) {
   return {
     // Content is a flat HTML array. It'll generate one sidebar section
     // if specified.
-    [side + 'Content']: {type: 'html'},
+    [side + 'Content']: {
+      type: 'html',
+      mutable: false,
+    },
 
     // A single class to apply to the whole sidebar. If specifying multiple
     // sections, this be added to the containing sidebar-column - specify a
@@ -105,14 +108,32 @@ export default {
   },
 
   slots: {
-    title: {type: 'html'},
-    showWikiNameInTitle: {type: 'boolean', default: true},
+    title: {
+      type: 'html',
+      mutable: false,
+    },
+
+    showWikiNameInTitle: {
+      type: 'boolean',
+      default: true,
+    },
 
-    additionalNames: {type: 'html'},
+    additionalNames: {
+      type: 'html',
+      mutable: false,
+    },
 
-    cover: {type: 'html'},
+    cover: {
+      type: 'html',
+      mutable: false,
+    },
 
-    socialEmbed: {type: 'html'},
+    // Strictly speaking we clone this each time we use it, so it doesn't
+    // need to be marked as mutable here.
+    socialEmbed: {
+      type: 'html',
+      mutable: true,
+    },
 
     color: {validate: v => v.isColor},
 
@@ -128,7 +149,10 @@ export default {
 
     // Main
 
-    mainContent: {type: 'html'},
+    mainContent: {
+      type: 'html',
+      mutable: false,
+    },
 
     headingMode: {
       validate: v => v.is('sticky', 'static'),
@@ -142,7 +166,11 @@ export default {
 
     // Banner
 
-    banner: {type: 'html'},
+    banner: {
+      type: 'html',
+      mutable: false,
+    },
+
     bannerPosition: {
       validate: v => v.is('top', 'bottom'),
       default: 'top',
@@ -150,8 +178,15 @@ export default {
 
     // Nav & Footer
 
-    navContent: {type: 'html'},
-    navBottomRowContent: {type: 'html'},
+    navContent: {
+      type: 'html',
+      mutable: false,
+    },
+
+    navBottomRowContent: {
+      type: 'html',
+      mutable: false,
+    },
 
     navLinkStyle: {
       validate: v => v.is('hierarchical', 'index'),
@@ -208,9 +243,15 @@ export default {
         })
     },
 
-    secondaryNav: {type: 'html'},
+    secondaryNav: {
+      type: 'html',
+      mutable: false,
+    },
 
-    footerContent: {type: 'html'},
+    footerContent: {
+      type: 'html',
+      mutable: false,
+    },
   },
 
   generate(data, relations, slots, {
diff --git a/src/content/dependencies/generatePreviousNextLinks.js b/src/content/dependencies/generatePreviousNextLinks.js
index e3417cb8..d3e529bf 100644
--- a/src/content/dependencies/generatePreviousNextLinks.js
+++ b/src/content/dependencies/generatePreviousNextLinks.js
@@ -6,9 +6,20 @@ export default {
   extraDependencies: ['html', 'language'],
 
   slots: {
-    previousLink: {type: 'html'},
-    nextLink: {type: 'html'},
-    id: {type: 'boolean', default: true},
+    previousLink: {
+      type: 'html',
+      mutable: true,
+    },
+
+    nextLink: {
+      type: 'html',
+      mutable: true,
+    },
+
+    id: {
+      type: 'boolean',
+      default: true,
+    },
   },
 
   generate(slots, {html, language}) {
diff --git a/src/content/dependencies/generateSecondaryNav.js b/src/content/dependencies/generateSecondaryNav.js
index 1f965a25..1bc0616e 100644
--- a/src/content/dependencies/generateSecondaryNav.js
+++ b/src/content/dependencies/generateSecondaryNav.js
@@ -2,7 +2,10 @@ export default {
   extraDependencies: ['html'],
 
   slots: {
-    content: {type: 'html'},
+    content: {
+      type: 'html',
+      mutable: false,
+    },
 
     class: {
       validate: v => v.oneOf(v.isString, v.sparseArrayOf(v.isString)),
diff --git a/src/content/dependencies/generateStickyHeadingContainer.js b/src/content/dependencies/generateStickyHeadingContainer.js
index 8eb39e6c..9becfb26 100644
--- a/src/content/dependencies/generateStickyHeadingContainer.js
+++ b/src/content/dependencies/generateStickyHeadingContainer.js
@@ -2,8 +2,15 @@ export default {
   extraDependencies: ['html'],
 
   slots: {
-    title: {type: 'html'},
-    cover: {type: 'html'},
+    title: {
+      type: 'html',
+      mutable: false,
+    },
+
+    cover: {
+      type: 'html',
+      mutable: true,
+    },
   },
 
   generate: (slots, {html}) =>
diff --git a/src/content/dependencies/generateWikiHomeContentRow.js b/src/content/dependencies/generateWikiHomeContentRow.js
index 8bc54e15..27b12e55 100644
--- a/src/content/dependencies/generateWikiHomeContentRow.js
+++ b/src/content/dependencies/generateWikiHomeContentRow.js
@@ -11,7 +11,10 @@ export default {
     ({name: row.name}),
 
   slots: {
-    content: {type: 'html'},
+    content: {
+      type: 'html',
+      mutable: false,
+    },
   },
 
   generate: (data, relations, slots, {html}) =>
diff --git a/src/content/dependencies/image.js b/src/content/dependencies/image.js
index fb4b59b6..6b937043 100644
--- a/src/content/dependencies/image.js
+++ b/src/content/dependencies/image.js
@@ -64,7 +64,10 @@ export default {
     width: {type: 'number'},
     height: {type: 'number'},
 
-    missingSourceContent: {type: 'html'},
+    missingSourceContent: {
+      type: 'html',
+      mutable: false,
+    },
   },
 
   generate(data, relations, slots, {
diff --git a/src/content/dependencies/linkTemplate.js b/src/content/dependencies/linkTemplate.js
index f683ac6b..63cc82e8 100644
--- a/src/content/dependencies/linkTemplate.js
+++ b/src/content/dependencies/linkTemplate.js
@@ -15,10 +15,17 @@ export default {
     path: {validate: v => v.validateArrayItems(v.isString)},
     hash: {type: 'string'},
     linkless: {type: 'boolean', default: false},
-
     tooltip: {type: 'string'},
-    attributes: {type: 'attributes'},
-    content: {type: 'html'},
+
+    attributes: {
+      type: 'attributes',
+      mutable: true,
+    },
+
+    content: {
+      type: 'html',
+      mutable: false,
+    },
   },
 
   generate(slots, {
diff --git a/src/content/dependencies/linkThing.js b/src/content/dependencies/linkThing.js
index 60fcc3ef..c5998c7e 100644
--- a/src/content/dependencies/linkThing.js
+++ b/src/content/dependencies/linkThing.js
@@ -20,9 +20,20 @@ export default {
   }),
 
   slots: {
-    content: {type: 'html'},
+    content: {
+      type: 'html',
+      mutable: false,
+    },
+
+    attributes: {
+      type: 'attributes',
+      mutable: true,
+    },
 
-    preferShortName: {type: 'boolean', default: false},
+    preferShortName: {
+      type: 'boolean',
+      default: false,
+    },
 
     tooltip: {
       validate: v => v.oneOf(v.isBoolean, v.isHTML),
@@ -48,8 +59,6 @@ export default {
 
     anchor: {type: 'boolean', default: false},
     linkless: {type: 'boolean', default: false},
-
-    attributes: {type: 'attributes'},
     hash: {type: 'string'},
   },