New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@thegetty/quire-11ty

Package Overview
Dependencies
Maintainers
14
Versions
45
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@thegetty/quire-11ty - npm Package Compare versions

Comparing version 1.0.0-rc.14 to 1.0.0-rc.15

_includes/components/object-filters/object-card/object-card.webc

22

_includes/components/figure/audio/print.js
const { html } = require('~lib/common-tags')
const chalkFactory = require('~lib/chalk')
const path = require('path')

@@ -13,16 +14,23 @@ /**

module.exports = function(eleventyConfig) {
const { imageDir } = eleventyConfig.globalData.config.figures
const figureCaption = eleventyConfig.getFilter('figureCaption')
const figureImage = eleventyConfig.getFilter('figureImage')
const figureLabel = eleventyConfig.getFilter('figureLabel')
const figureAudioElement = eleventyConfig.getFilter('figureAudioElement')
return function({ caption, credit, id, label, mediaId, mediaType }) {
const audioElement = figureAudioElement({ id, mediaId, mediaType })
return function({ caption, credit, id, label, mediaId, mediaType, poster='' }) {
const labelElement = figureLabel({ caption, id, label })
const captionElement = figureCaption({ caption, content: labelElement, credit, mediaId, mediaType })
const posterSrc = poster.startsWith('http')
? poster
: path.join(imageDir, poster)
const imageElement = poster
? `<div class="q-figure__media-wrapper">
<img src="${posterSrc}" />
</div>`
: ''
return html`
<div class="q-figure__media-wrapper">
${audioElement}
</div>
${imageElement}
${captionElement}

@@ -29,0 +37,0 @@ `

@@ -83,3 +83,3 @@ const path = require ('path')

const firstObjectId = pageObject[0].id
const object = getObject(firstObjectId)
const object = firstObjectId ? getObject(firstObjectId) : pageObject[0]
const firstObjectFigure = object && object.figure

@@ -86,0 +86,0 @@ ? getFigure(object.figure[0].id)

@@ -43,3 +43,3 @@ const chalkFactory = require('~lib/chalk')

return
case data.canvasId:
case !!data.canvasId:
return data.canvasId

@@ -64,3 +64,3 @@ default:

return
case data.manifestId:
case !!data.manifestId:
return data.manifestId

@@ -254,2 +254,4 @@ default:

staticInlineFigureImage: this.staticInlineFigureImage,
// TODO: implement thumbnail getter
thumbnail: this.staticInlineFigureImage
}

@@ -282,3 +284,5 @@ }

await this.calcCanvasDimensions()
await this.processAnnotationImages()
if (this.isSequence) {

@@ -289,2 +293,3 @@ await this.processFigureSequence()

}
await this.createManifest()

@@ -304,2 +309,3 @@

logger.debug(`processing annotation image ${item.src}`)
if (item.isImageService) this.validateImageForTiling(item.src)
return item.src && this.processImage(item.src, this.outputDir, {

@@ -319,2 +325,3 @@ tile: item.isImageService

const { transformations } = this.iiifConfig
this.validateImageForTiling(this.src)
const { errors } = await this.processImage(this.src, this.outputDir, {

@@ -350,2 +357,15 @@ tile: true,

/**
* Check if image dimensions are valid before proceeding with image processing
*/
validateImageForTiling(src) {
const minLength = this.iiifConfig.tileSize * 2
this.dimensionsValidForTiling = this.canvasWidth > minLength && this.canvasHeight > minLength
if (!this.dimensionsValidForTiling) {
logger.error(`Unable to create a zooming image from "${path.parse(src).base}". Images under ${minLength}px will not display unless zoom is set to false.`)
}
}
/**
* Create the IIIF `manifest.json` for <canvas-panel> components,

@@ -352,0 +372,0 @@ * collect errors from calling toJSON and the file system writer.

@@ -110,3 +110,4 @@ const chalkFactory = require('~lib/chalk')

resize: {
width: 800
width: 2025,
withoutEnlargement: true
}

@@ -113,0 +114,0 @@ },

@@ -19,3 +19,2 @@ {

"input": [
".jp2",
".jpg",

@@ -43,3 +42,4 @@ ".jpeg",

"resize": {
"width": 800
"width": 2025,
"withoutEnlargement": true
}

@@ -46,0 +46,0 @@ }

@@ -13,3 +13,3 @@ const { html } = require('~lib/common-tags')

<meta charset="utf-8" />
<link rel="stylesheet" type="text/css" href="/_assets/epub.css" />
<link rel="stylesheet" type="text/css" href="_assets/epub.css" />
${titleElement}

@@ -16,0 +16,0 @@ ${stylesheets}

@@ -8,3 +8,3 @@ const chalkFactory = require('~lib/chalk')

* Returns publication.yaml data as JSON for the EPUB generation library
*
*
* @param {Object} publication

@@ -89,6 +89,12 @@ * @return {Object}

const pubTitle = () => {
if (subtitle && readingLine) {
return `${title}: ${subtitle} ${readingLine}`
} else if (subtitle) {
return `${title}: ${subtitle}`
const separator = title.match(/[.,:!?]$/) ? '' : ':';
switch (true) {
case !!subtitle && !!readingLine:
return `${title}${separator} ${subtitle} ${readingLine}`;
case !!readingLine:
return `${title} (${readingLine})`;
case !!subtitle:
return `${title}${separator} ${subtitle}`;
default:
return title;
}

@@ -95,0 +101,0 @@ }

@@ -45,2 +45,25 @@ const filterOutputs = require('../filter.js')

/**
* Removes preceding slashes from asset paths
* @param {HTMLElement} element
*/
const transformPaths = (element) => {
const images = element.querySelectorAll('img')
const links = element.querySelectorAll('a')
const heros = element.querySelectorAll('.quire-page__header.hero, .quire-cover__overlay')
heros.forEach((item) => {
item.style.backgroundImage = item.style.backgroundImage.replace(/(?<=url\()\//, '')
})
images.forEach((item) => {
const src = item.getAttribute('src')
if (!src) return
item.setAttribute('src', src.replace(/^\//, ''))
})
links.forEach((item) => {
const href = item.getAttribute('href')
if (!href) return
item.setAttribute('href', href.replace(/^\//, ''))
})
}
/**
* Remove pages excluded from this output type

@@ -63,3 +86,3 @@ */

const name = slugify(page.url) || path.parse(page.inputPath).name
return `${sequenceNumber}_${name}.xhtml`
return `page-${sequenceNumber}_${name}.xhtml`
}

@@ -75,2 +98,14 @@

const body = document.createElement('body')
/**
* Add SVGs to body
*/
const svgSymbolElements = document.querySelectorAll('body > svg')
const svgsOnPage = mainElement.querySelectorAll('svg')
if (Array.from(svgsOnPage).length) {
Array.from(svgSymbolElements).forEach((svgSymbolElement) => {
body.appendChild(svgSymbolElement)
})
}
body.innerHTML = mainElement.innerHTML

@@ -83,2 +118,3 @@ body.setAttribute('id', mainElement.dataset.pageId)

filterOutputs(body, 'epub')
getAssets(body)

@@ -114,10 +150,25 @@

function relativeUrl (path) {
const base = eleventyConfig.baseURL || 'http://localhost'
let url;
try {
url = new URL(path)
} catch (TypeError) {
url = new URL(path, base)
} finally {
return url
}
}
const { hash, href, pathname } = relativeUrl(href)
const index = collections.epub
.findIndex(({ url }) => url === href)
.findIndex(({ url }) => url === pathname)
if (index === -1) return
linkElement.setAttribute('href', filename(index, collections.epub[index]))
linkElement.setAttribute('href', `${filename(index, collections.epub[index])}${hash}`)
})
transformPaths(body)
/**

@@ -134,6 +185,11 @@ * Sequence and write files

const item = {
url: outputFilename,
encodingFormat: 'application/xhtml+xml'
encodingFormat: 'application/xhtml+xml',
url: outputFilename
}
const pageHasSvgContent = !!body.querySelector('svg')
if (pageHasSvgContent) {
item.properties = ['svg']
}
switch (page.data.layout) {

@@ -140,0 +196,0 @@ case 'table-of-contents':

@@ -21,2 +21,24 @@ # Changelog

## [unreleased]
### Added
- Validation method to check if an image can be tiled, and log error if invalid.
### Changed
- Increase `print-image` transformation width to `2025px`
- Remove preceding slash from relative paths in epub output
- Updated audio component print output to exclude audio embed and include optional poster image.
### Fixed
- Resolved issue with logic rendering external manifests
- Prefix epub filename with `page-` to ensure validity if filename begins with a number
- Include `svg` definitions in body of epub pages using `svg`
### Removed
- Remove `.jp2` from supported image extensions
## [1.0.0-rc.14]

@@ -23,0 +45,0 @@

@@ -66,3 +66,3 @@ const chalkFactory = require('~lib/chalk')

// filter null values, handles 11ty's first pass at build
const filteredClasses = classes.filter((x) => x)
const filteredClasses = Array.from(classes).filter((x) => x)

@@ -86,3 +86,3 @@ // add custom classes from page frontmatter

/**
* Figures data for figures referenced by id in page frontmatter
* Figures data for figures referenced by id in page frontmatter
*/

@@ -100,3 +100,5 @@ pageFigures: ({ figure, figures }) => {

.reduce((validObjects, item) => {
const objectData = objects.object_list.find(({ id }) => id === item.id)
const objectData = objects.object_list && objects.object_list.length
? objects.object_list.find(({ id }) => id === item.id)
: item
if (!objectData) {

@@ -107,5 +109,3 @@ warn(`pageObjects: no object found with id ${item.id}`)

if (!objectData.figure) {
warn(`pageObjects: object id ${objectData.id} has no figure data`)
} else {
if (objectData.figure) {
objectData.figures = objectData.figure.map((figure) => {

@@ -112,0 +112,0 @@ if (figure.id) {

{
"name": "@thegetty/quire-11ty",
"version": "1.0.0-rc.14",
"version": "1.0.0-rc.15",
"description": "Quire 11ty static site generator",

@@ -61,3 +61,3 @@ "keywords": [

"@11ty/eleventy-plugin-vite": "^4.0.0",
"@11ty/eleventy-plugin-webc": "^0.9.4",
"@11ty/eleventy-plugin-webc": "^0.11.0",
"@11ty/is-land": "^3.0.1",

@@ -64,0 +64,0 @@ "@iiif/parser": "^1.1.2",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc