From f53b9df7452ef886cf85db5bb72a48f32dce3dbb Mon Sep 17 00:00:00 2001 From: "(quasar) nebula" Date: Mon, 1 Jan 2024 13:47:10 -0400 Subject: content: specify mutable across html & attributes slots --- .../generateArtistGroupContributionsInfo.js | 6 +- .../dependencies/generateArtistInfoPageChunk.js | 18 ++++-- .../generateArtistInfoPageChunkItem.js | 16 +++++- .../generateArtistInfoPageChunkedList.js | 11 +++- src/content/dependencies/generateContentHeading.js | 11 +++- .../dependencies/generateDatetimestampTemplate.js | 12 +++- .../generateListAllAdditionalFilesChunk.js | 5 +- src/content/dependencies/generateListingPage.js | 5 +- src/content/dependencies/generatePageLayout.js | 65 ++++++++++++++++++---- .../dependencies/generatePreviousNextLinks.js | 17 +++++- src/content/dependencies/generateSecondaryNav.js | 5 +- .../dependencies/generateStickyHeadingContainer.js | 11 +++- .../dependencies/generateWikiHomeContentRow.js | 5 +- src/content/dependencies/image.js | 5 +- src/content/dependencies/linkTemplate.js | 13 ++++- src/content/dependencies/linkThing.js | 17 ++++-- 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'}, }, -- cgit 1.3.0-6-gf8a5