Initial import of LogDarioSeq baseline
Establishes version control for the personal Logseq DB fork before starting the server-client architecture migration and domain features described in docs/agent-guide and the approved implementation plan. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
44
scripts/lib/postcss-strip-ios-web-font-sources.cjs
Normal file
44
scripts/lib/postcss-strip-ios-web-font-sources.cjs
Normal file
@@ -0,0 +1,44 @@
|
||||
const unsupportedIOSWebFontSourcePattern =
|
||||
/\.woff2?(?:[?#][^"')\s]*)?(?:["')\s]|$)|format\(["']woff2?["']\)/i
|
||||
|
||||
const stripUnsupportedIOSWebFontValue = (value) => {
|
||||
const sources = value.split(/,(?=\s*(?:url|local)\()/)
|
||||
const supportedSources = sources.filter((source) =>
|
||||
!unsupportedIOSWebFontSourcePattern.test(source))
|
||||
|
||||
return supportedSources.length === 0 ? null : supportedSources.join(',')
|
||||
}
|
||||
|
||||
const stripUnsupportedIOSWebFontSources = (css) =>
|
||||
css.replace(/@font-face\s*{[^{}]*}/g, (fontFace) => {
|
||||
let hasSupportedSrc = true
|
||||
const nextFontFace = fontFace.replace(/src:([^;}]+)([;}])/g, (_match, value, delimiter) => {
|
||||
const nextValue = stripUnsupportedIOSWebFontValue(value)
|
||||
hasSupportedSrc = nextValue !== null
|
||||
return nextValue === null ? '' : `src:${nextValue}${delimiter}`
|
||||
})
|
||||
return hasSupportedSrc ? nextFontFace : ''
|
||||
})
|
||||
|
||||
const stripIOSWebFontSourcesPlugin = () => ({
|
||||
postcssPlugin: 'strip-ios-web-font-sources',
|
||||
Declaration (decl) {
|
||||
if (decl.prop.toLowerCase() === 'src') {
|
||||
const nextValue = stripUnsupportedIOSWebFontValue(decl.value)
|
||||
if (nextValue === null) {
|
||||
if (decl.parent?.type === 'atrule' && decl.parent.name === 'font-face') {
|
||||
decl.parent.remove()
|
||||
} else {
|
||||
decl.remove()
|
||||
}
|
||||
} else {
|
||||
decl.value = nextValue
|
||||
}
|
||||
}
|
||||
},
|
||||
})
|
||||
|
||||
module.exports = {
|
||||
stripIOSWebFontSourcesPlugin,
|
||||
stripUnsupportedIOSWebFontSources,
|
||||
}
|
||||
Reference in New Issue
Block a user