@templatical/quality 0.8.0 → 0.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +59 -19
- package/dist/index.js +242 -199
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../src/types.ts","../src/contrast.ts","../src/walk.ts","../src/run-rules.ts","../src/accessibility/messages/de.ts","../src/accessibility/messages/en.ts","../src/accessibility/messages/index.ts","../src/accessibility/rules/img-missing-alt.ts","../src/accessibility/rules/img-alt-is-filename.ts","../src/accessibility/rules/img-alt-too-long.ts","../src/accessibility/rules/img-decorative-needs-empty-alt.ts","../src/accessibility/dictionaries/de.ts","../src/accessibility/dictionaries/en.ts","../src/accessibility/dictionaries/index.ts","../src/accessibility/rules/img-linked-no-context.ts","../src/html-utils.ts","../src/accessibility/rules/heading-empty.ts","../src/accessibility/rules/heading-skip-level.ts","../src/accessibility/rules/heading-multiple-h1.ts","../src/accessibility/rules/link-empty.ts","../src/accessibility/rules/link-vague-text.ts","../src/accessibility/rules/link-href-empty.ts","../src/accessibility/rules/link-target-blank-no-rel.ts","../src/accessibility/rules/text-all-caps.ts","../src/accessibility/rules/text-low-contrast.ts","../src/accessibility/rules/text-too-small.ts","../src/accessibility/rules/button-vague-label.ts","../src/accessibility/rules/button-touch-target.ts","../src/accessibility/rules/button-low-contrast.ts","../src/accessibility/rules/missing-preheader.ts","../src/accessibility/index.ts","../src/structure/messages/de.ts","../src/structure/messages/en.ts","../src/structure/messages/index.ts","../src/structure/rules/duplicate-block-id.ts","../src/structure/rules/empty-column.ts","../src/structure/rules/empty-section.ts","../src/structure/rules/nested-section.ts","../src/structure/rules/section-column-mismatch.ts","../src/structure/index.ts","../src/links/messages/de.ts","../src/links/messages/en.ts","../src/links/messages/index.ts","../src/url-walker.ts","../src/links/rules/javascript-protocol.ts","../src/links/rules/unsupported-protocol.ts","../src/links/rules/malformed-mailto.ts","../src/links/rules/malformed-tel.ts","../src/links/rules/localhost-or-staging.ts","../src/links/index.ts"],"sourcesContent":["import type {\n Block,\n SectionBlock,\n TemplateContent,\n TemplateSettings,\n} from \"@templatical/types\";\n\nexport type Severity = \"error\" | \"warning\" | \"info\" | \"off\";\n\nexport interface LintIssue {\n /** Block id, or null for template-level issues. */\n blockId: string | null;\n ruleId: string;\n severity: Exclude<Severity, \"off\">;\n message: string;\n fix?: LintPatch;\n}\n\nexport interface LintPatchContext {\n updateBlock: (blockId: string, patch: Partial<Block>) => void;\n updateSettings: (patch: Partial<TemplateSettings>) => void;\n removeBlock: (blockId: string) => void;\n}\n\nexport interface LintPatch {\n description: string;\n apply: (ctx: LintPatchContext) => void;\n}\n\nexport interface LintThresholds {\n altMaxLength: number;\n minFontSize: number;\n allCapsMinLength: number;\n minTouchTargetPx: number;\n}\n\nexport interface LintLinksOptions {\n /**\n * Host patterns that should flag as \"staging / non-production\".\n * Each entry is a glob-style pattern matched against the URL host.\n * `*` matches any run of characters (including `.`), so `*.staging.*`\n * matches `app.staging.example.com`.\n *\n * Default: ['localhost', '127.0.0.1', '0.0.0.0', '*.local',\n * '*.staging.*', '*.dev.*']\n */\n nonProductionHosts?: string[];\n}\n\nexport interface LintOptions {\n /**\n * Fully disable linting. When true, the editor skips lazy-loading the\n * package, hides the sidebar tab, and suppresses inline badges.\n */\n disabled?: boolean;\n /** Locale for vague-text dictionaries and message text. Falls back to `en`. */\n locale?: string;\n /** Per-rule severity override. Set to `'off'` to disable a specific rule. */\n rules?: Record<string, Severity>;\n thresholds?: Partial<LintThresholds>;\n /** Per-linter knobs. Only `lintLinks` reads `links` today. */\n links?: LintLinksOptions;\n}\n\nexport interface ResolvedLinksOptions {\n nonProductionHosts: string[];\n}\n\nexport interface ResolvedOptions {\n locale: string;\n rules: Record<string, Severity>;\n thresholds: LintThresholds;\n links: ResolvedLinksOptions;\n /** Returns the effective severity for a rule (override or default). */\n severity: (ruleId: string) => Severity;\n}\n\nexport interface WalkContext {\n parent: Block | null;\n section: SectionBlock | null;\n columnIndex: number | null;\n depth: number;\n /**\n * Nearest opaque ancestor background, or template settings background.\n * Hex string, lowercased.\n */\n resolvedBackgroundColor: string;\n}\n\nexport interface RuleMeta {\n /** Stable identifier — used for severity overrides and message lookup. */\n id: string;\n /** Default severity when no override is supplied. */\n severity: Exclude<Severity, \"off\">;\n}\n\n/**\n * What a rule emits per match. The orchestrator combines this with the\n * rule's `meta` (for `ruleId` + default severity) and resolves the\n * localized message via the active locale's message map.\n */\nexport interface RuleHit {\n blockId: string | null;\n /** Interpolation values for the rule's localized message template. */\n params?: Record<string, string | number>;\n fix?: LintPatch;\n}\n\nexport interface Rule {\n meta: RuleMeta;\n /** Block-level rule. Returns a hit or null. */\n block?: (\n block: Block,\n ctx: WalkContext,\n opts: ResolvedOptions,\n ) => RuleHit | null;\n /** Template-level rule. Runs once after the walk. */\n template?: (content: TemplateContent, opts: ResolvedOptions) => RuleHit[];\n}\n\nexport const DEFAULT_A11Y_THRESHOLDS: LintThresholds = {\n altMaxLength: 125,\n minFontSize: 14,\n allCapsMinLength: 20,\n minTouchTargetPx: 44,\n};\n\nexport const DEFAULT_NON_PRODUCTION_HOSTS: string[] = [\n \"localhost\",\n \"127.0.0.1\",\n \"0.0.0.0\",\n \"*.local\",\n \"*.staging.*\",\n \"*.dev.*\",\n];\n","/**\n * WCAG 2.1 sRGB relative-luminance contrast.\n *\n * Inputs are hex strings (`#rgb`, `#rrggbb`, optional leading `#`).\n * Returns the contrast ratio (1–21) per WCAG, or `NaN` if either input\n * cannot be parsed as an opaque solid hex color.\n *\n * The codebase uses OKLch for design tokens, but contrast math is\n * sRGB-defined; mixing the two gives incorrect results.\n */\nexport function getContrastRatio(fg: string, bg: string): number {\n const fgRgb = parseHex(fg);\n const bgRgb = parseHex(bg);\n\n if (!fgRgb || !bgRgb) {\n return Number.NaN;\n }\n\n const l1 = relativeLuminance(fgRgb);\n const l2 = relativeLuminance(bgRgb);\n const lighter = Math.max(l1, l2);\n const darker = Math.min(l1, l2);\n\n return (lighter + 0.05) / (darker + 0.05);\n}\n\nexport interface Rgb {\n r: number;\n g: number;\n b: number;\n}\n\nconst HEX3 = /^#?([0-9a-f])([0-9a-f])([0-9a-f])$/i;\nconst HEX6 = /^#?([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/i;\n\nexport function parseHex(input: string | undefined | null): Rgb | null {\n if (typeof input !== \"string\") {\n return null;\n }\n\n const trimmed = input.trim();\n\n const match6 = HEX6.exec(trimmed);\n if (match6) {\n return {\n r: parseInt(match6[1], 16),\n g: parseInt(match6[2], 16),\n b: parseInt(match6[3], 16),\n };\n }\n\n const match3 = HEX3.exec(trimmed);\n if (match3) {\n return {\n r: parseInt(match3[1] + match3[1], 16),\n g: parseInt(match3[2] + match3[2], 16),\n b: parseInt(match3[3] + match3[3], 16),\n };\n }\n\n return null;\n}\n\nexport function isOpaqueHex(input: string | undefined | null): boolean {\n return parseHex(input ?? \"\") !== null;\n}\n\nfunction relativeLuminance({ r, g, b }: Rgb): number {\n const rs = channel(r / 255);\n const gs = channel(g / 255);\n const bs = channel(b / 255);\n return 0.2126 * rs + 0.7152 * gs + 0.0722 * bs;\n}\n\nfunction channel(c: number): number {\n return c <= 0.03928 ? c / 12.92 : Math.pow((c + 0.055) / 1.055, 2.4);\n}\n","import type { Block, TemplateContent } from \"@templatical/types\";\nimport { isSection } from \"@templatical/types\";\nimport type { WalkContext } from \"./types\";\nimport { isOpaqueHex } from \"./contrast\";\n\nexport type Visitor = (block: Block, ctx: WalkContext) => void;\n\nconst DEFAULT_BG = \"#ffffff\";\n\n/**\n * Pure traversal of the block tree. Calls `visit` once per block in\n * document order, providing a `WalkContext` that includes the resolved\n * background color (nearest opaque ancestor) and structural refs.\n *\n * Sections cannot nest (renderer enforces this), so the walker doesn't\n * descend into a section that lives inside a column. Custom blocks are\n * visited but not descended into.\n */\nexport function walkBlocks(content: TemplateContent, visit: Visitor): void {\n const rootBg = isOpaqueHex(content.settings.backgroundColor)\n ? content.settings.backgroundColor.toLowerCase()\n : DEFAULT_BG;\n\n const walk = (block: Block, ctx: WalkContext): void => {\n visit(block, ctx);\n\n if (!isSection(block)) {\n return;\n }\n\n const sectionBg = block.styles?.backgroundColor;\n const childBg = isOpaqueHex(sectionBg)\n ? (sectionBg as string).toLowerCase()\n : ctx.resolvedBackgroundColor;\n\n block.children.forEach((column, columnIndex) => {\n column.forEach((child) =>\n walk(child, {\n parent: block,\n section: block,\n columnIndex,\n depth: ctx.depth + 1,\n resolvedBackgroundColor: childBg,\n }),\n );\n });\n };\n\n for (const block of content.blocks) {\n walk(block, {\n parent: null,\n section: null,\n columnIndex: null,\n depth: 0,\n resolvedBackgroundColor: rootBg,\n });\n }\n}\n","import type { TemplateContent } from \"@templatical/types\";\nimport type {\n LintIssue,\n LintOptions,\n ResolvedOptions,\n Rule,\n RuleHit,\n Severity,\n} from \"./types\";\nimport { DEFAULT_A11Y_THRESHOLDS, DEFAULT_NON_PRODUCTION_HOSTS } from \"./types\";\nimport { walkBlocks } from \"./walk\";\n\nexport type MessageFormatter = (\n locale: string,\n ruleId: string,\n params?: Record<string, string | number>,\n) => string;\n\n/**\n * Walk the tree once, dispatch every block-level rule, then run every\n * template-level rule. Each tool (lintAccessibility, lintStructure, …)\n * wraps this with its own rule list + message formatter. Keeps the per-tool\n * orchestrators down to a thin call.\n */\nexport function runRules(\n content: TemplateContent,\n rules: Rule[],\n options: LintOptions,\n formatMessage: MessageFormatter,\n): LintIssue[] {\n if (options.disabled === true) {\n return [];\n }\n\n const opts = resolveOptions(options, rules);\n const issues: LintIssue[] = [];\n\n function buildIssue(\n ruleId: string,\n severity: Exclude<Severity, \"off\">,\n hit: RuleHit,\n ): LintIssue {\n return {\n blockId: hit.blockId,\n ruleId,\n severity,\n message: formatMessage(opts.locale, ruleId, hit.params),\n fix: hit.fix,\n };\n }\n\n walkBlocks(content, (block, ctx) => {\n for (const rule of rules) {\n const sev = opts.severity(rule.meta.id);\n if (sev === \"off\" || !rule.block) continue;\n const hit = rule.block(block, ctx, opts);\n if (hit !== null) {\n issues.push(buildIssue(rule.meta.id, sev, hit));\n }\n }\n });\n\n for (const rule of rules) {\n const sev = opts.severity(rule.meta.id);\n if (sev === \"off\" || !rule.template) continue;\n const hits = rule.template(content, opts);\n for (const hit of hits) {\n issues.push(buildIssue(rule.meta.id, sev, hit));\n }\n }\n\n return issues;\n}\n\nexport function resolveOptions(\n options: LintOptions,\n rules: Rule[],\n): ResolvedOptions {\n const overrides = options.rules ?? {};\n const thresholds = {\n ...DEFAULT_A11Y_THRESHOLDS,\n ...(options.thresholds ?? {}),\n };\n const links = {\n nonProductionHosts:\n options.links?.nonProductionHosts ?? DEFAULT_NON_PRODUCTION_HOSTS,\n };\n const locale = options.locale ?? \"en\";\n\n return {\n locale,\n rules: overrides,\n thresholds,\n links,\n severity: (ruleId: string): Severity => {\n const override = overrides[ruleId];\n if (override !== undefined) {\n return override;\n }\n const rule = rules.find((r) => r.meta.id === ruleId);\n return rule?.meta.severity ?? \"warning\";\n },\n };\n}\n","import type en from \"./en\";\n\nconst de: typeof en = {\n \"a11y.img-missing-alt\":\n \"Bild ohne Alt-Text. Füge eine kurze Beschreibung hinzu oder markiere das Bild als dekorativ.\",\n \"a11y.img-alt-is-filename\":\n 'Alt-Text sieht wie ein Dateiname aus (\"{alt}\"). Beschreibe stattdessen kurz, was das Bild zeigt.',\n \"a11y.img-alt-too-long\":\n \"Alt-Text ist {length} Zeichen lang; bleibe unter {max}.\",\n \"a11y.img-decorative-needs-empty-alt\":\n \"Dekoratives Bild hat Alt-Text. Entferne den Alt-Text oder hebe die Markierung als dekorativ auf.\",\n \"a11y.img-linked-no-context\":\n \"Verlinktes Bild beschreibt nur das Motiv, nicht das Linkziel. Nenne das Ziel (z. B. „Frühlingssale ansehen“).\",\n \"a11y.heading-empty\":\n \"Überschrift ist leer. Füge Text hinzu oder entferne den Block.\",\n \"a11y.heading-skip-level\":\n \"Überschrift springt von H{from} auf H{to}. Eine Ebene pro Schritt.\",\n \"a11y.heading-multiple-h1\":\n \"E-Mail enthält mehr als eine H1. Verwende H1 nur einmal für die Hauptüberschrift.\",\n \"a11y.link-empty\":\n \"Ein Link in diesem Block hat keinen Text und kein beschriebenes Bild.\",\n \"a11y.link-vague-text\":\n \"Link-Text „{text}“ ist unspezifisch. Beschreibe stattdessen das Ziel.\",\n \"a11y.link-href-empty\":\n \"Ein Link in diesem Block hat ein leeres oder „#“-href.\",\n \"a11y.link-target-blank-no-rel\":\n 'Link öffnet in neuem Tab, aber rel=\"noopener\" fehlt – ergänze es, damit das Ziel nicht auf window.opener zugreifen kann.',\n \"a11y.text-all-caps\":\n \"Längere Texte in Großbuchstaben sind schwerer lesbar. Verwende Groß- und Kleinschreibung.\",\n \"a11y.text-low-contrast\":\n \"Überschriftskontrast beträgt {ratio}:1; WCAG AA verlangt mindestens {required}:1.\",\n \"a11y.text-too-small\": \"Text ist {size}px; mindestens {min}px verwenden.\",\n \"a11y.button-vague-label\":\n \"Button-Beschriftung „{text}“ ist unspezifisch. Beschreibe die Aktion.\",\n \"a11y.button-touch-target\":\n \"Button ist etwa {height}px hoch; mindestens {min}px verwenden, um Fehltipper auf Mobilgeräten zu vermeiden.\",\n \"a11y.button-low-contrast\":\n \"Buttontextkontrast beträgt {ratio}:1; WCAG AA verlangt mindestens {required}:1.\",\n \"a11y.missing-preheader\":\n \"Kein Preheader-Text gesetzt. Postfächer zeigen sonst Bruchstücke des ersten Blocks an.\",\n};\n\nexport default de;\n","/**\n * English rule messages. The source of truth — other locales annotate\n * themselves `typeof en` so missing or extra keys fail typecheck.\n *\n * Templates use `{name}` placeholders, interpolated by `formatMessage`.\n */\nconst en = {\n \"a11y.img-missing-alt\":\n \"Image is missing alt text. Add a short description, or mark the image as decorative.\",\n \"a11y.img-alt-is-filename\":\n 'Alt text looks like a filename (\"{alt}\"). Replace with a short description of what the image conveys.',\n \"a11y.img-alt-too-long\":\n \"Alt text is {length} characters; aim for under {max}.\",\n \"a11y.img-decorative-needs-empty-alt\":\n \"Decorative image has alt text. Either clear the alt text or unmark the image as decorative.\",\n \"a11y.img-linked-no-context\":\n \"Linked image alt describes the image but not the link destination. Include where the link goes (e.g. 'Buy spring sale').\",\n \"a11y.heading-empty\": \"Heading is empty. Add text or remove the block.\",\n \"a11y.heading-skip-level\":\n \"Heading jumps from H{from} to H{to}. Step one level at a time.\",\n \"a11y.heading-multiple-h1\":\n \"Email has more than one H1. Use H1 once for the main heading.\",\n \"a11y.link-empty\": \"A link in this block has no text and no described image.\",\n \"a11y.link-vague-text\":\n 'Link text \"{text}\" is vague. Describe the destination instead.',\n \"a11y.link-href-empty\": \"A link in this block has an empty or '#' href.\",\n \"a11y.link-target-blank-no-rel\":\n 'Link opens in a new tab but is missing rel=\"noopener\" — add it to prevent the destination from accessing window.opener.',\n \"a11y.text-all-caps\":\n \"Long all-caps text is harder to read for everyone. Use sentence case.\",\n \"a11y.text-low-contrast\":\n \"Heading contrast is {ratio}:1; WCAG AA requires at least {required}:1.\",\n \"a11y.text-too-small\": \"Text is {size}px; aim for at least {min}px.\",\n \"a11y.button-vague-label\":\n 'Button label \"{text}\" is vague. Describe the action.',\n \"a11y.button-touch-target\":\n \"Button is roughly {height}px tall; aim for at least {min}px to avoid mis-taps on mobile.\",\n \"a11y.button-low-contrast\":\n \"Button text contrast is {ratio}:1; WCAG AA requires at least {required}:1.\",\n \"a11y.missing-preheader\":\n \"No preheader text set. Inboxes will fall back to fragments of the first block.\",\n};\n\nexport default en;\n","import en from \"./en\";\n\nexport type MessageMap = typeof en;\nexport type RuleMessageId = keyof MessageMap;\n\n/**\n * Auto-discovered locale registry. Drop a `messages/<lang>.ts` file and\n * it's bundled automatically — same pattern as the editor's i18n.\n *\n * Eager glob: synchronous, all locales bundled into the package. Tiny\n * (a few hundred bytes per locale) so the cost is negligible compared\n * to the lazy-loading overhead.\n */\nconst modules = import.meta.glob<{ default: MessageMap }>(\"./*.ts\", {\n eager: true,\n});\n\nconst MESSAGES: Record<string, MessageMap> = {};\nfor (const path in modules) {\n const match = /\\.\\/([^/]+)\\.ts$/.exec(path);\n if (!match) continue;\n const locale = match[1];\n if (locale === \"index\") continue;\n MESSAGES[locale] = modules[path].default;\n}\n\nexport const SUPPORTED_MESSAGE_LOCALES = Object.keys(MESSAGES);\n\nexport function getMessages(locale: string): MessageMap {\n const base = locale.split(\"-\")[0]?.toLowerCase() ?? \"en\";\n return MESSAGES[base] ?? MESSAGES.en ?? en;\n}\n\n/**\n * Resolve a localized message for a rule. `params` interpolate `{name}`\n * placeholders. Falls back to English when the locale doesn't ship the\n * key (shouldn't happen — the parity test enforces it).\n */\nexport function formatMessage(\n locale: string,\n ruleId: RuleMessageId,\n params?: Record<string, string | number>,\n): string {\n const map = getMessages(locale);\n const template = map[ruleId] ?? en[ruleId];\n if (!params) return template;\n return template.replace(/\\{(\\w+)\\}/g, (_, key: string) => {\n const value = params[key];\n return value === undefined ? `{${key}}` : String(value);\n });\n}\n","import { isImage } from \"@templatical/types\";\nimport type { Rule, RuleMeta } from \"../../types\";\n\nexport const meta: RuleMeta = {\n id: \"a11y.img-missing-alt\",\n severity: \"error\",\n};\n\nexport const imgMissingAlt: Rule = {\n meta,\n block(block) {\n if (!isImage(block)) return null;\n if (block.decorative === true) return null;\n const alt = block.alt?.trim() ?? \"\";\n if (alt !== \"\") return null;\n if ((block.src ?? \"\").trim() === \"\") return null;\n return { blockId: block.id };\n },\n};\n","import { isImage } from \"@templatical/types\";\nimport type { Rule, RuleMeta } from \"../../types\";\n\nexport const meta: RuleMeta = {\n id: \"a11y.img-alt-is-filename\",\n severity: \"warning\",\n};\n\nconst FILENAME_PATTERNS: RegExp[] = [\n /\\.(jpe?g|png|gif|webp|svg)$/i,\n /^IMG[_-]?\\d+/i,\n /^Untitled/i,\n /^Screen[\\s_-]?Shot/i,\n /^DSC[_-]?\\d+/i,\n];\n\nexport const imgAltIsFilename: Rule = {\n meta,\n block(block) {\n if (!isImage(block) || block.decorative === true) return null;\n const alt = block.alt?.trim() ?? \"\";\n if (alt === \"\") return null;\n if (!FILENAME_PATTERNS.some((re) => re.test(alt))) return null;\n\n return {\n blockId: block.id,\n params: { alt },\n fix: {\n description: \"Clear alt text\",\n apply: (ctx) => ctx.updateBlock(block.id, { alt: \"\" }),\n },\n };\n },\n};\n","import { isImage } from \"@templatical/types\";\nimport type { Rule, RuleMeta } from \"../../types\";\n\nexport const meta: RuleMeta = {\n id: \"a11y.img-alt-too-long\",\n severity: \"warning\",\n};\n\nexport const imgAltTooLong: Rule = {\n meta,\n block(block, _ctx, opts) {\n if (!isImage(block) || block.decorative === true) return null;\n const alt = block.alt ?? \"\";\n if (alt.length <= opts.thresholds.altMaxLength) return null;\n return {\n blockId: block.id,\n params: { length: alt.length, max: opts.thresholds.altMaxLength },\n };\n },\n};\n","import { isImage } from \"@templatical/types\";\nimport type { Rule, RuleMeta } from \"../../types\";\n\nexport const meta: RuleMeta = {\n id: \"a11y.img-decorative-needs-empty-alt\",\n severity: \"info\",\n};\n\nexport const imgDecorativeNeedsEmptyAlt: Rule = {\n meta,\n block(block) {\n if (!isImage(block)) return null;\n if (block.decorative !== true) return null;\n if ((block.alt ?? \"\") === \"\") return null;\n return {\n blockId: block.id,\n fix: {\n description: \"Clear alt text\",\n apply: (ctx) => ctx.updateBlock(block.id, { alt: \"\" }),\n },\n };\n },\n};\n","import type en from \"./en\";\n\nconst de: typeof en = {\n vagueLinkText: [\n \"hier klicken\",\n \"hier\",\n \"mehr lesen\",\n \"mehr\",\n \"weiter\",\n \"weiterlesen\",\n \"siehe mehr\",\n \"dies\",\n \"dieser link\",\n \"link\",\n \"klick\",\n ],\n vagueButtonLabels: [\n \"hier klicken\",\n \"klicken\",\n \"senden\",\n \"los\",\n \"ok\",\n \"okay\",\n \"ja\",\n \"nein\",\n ],\n linkedImageActionHints: [\n \"kaufen\",\n \"shoppen\",\n \"ansehen\",\n \"lesen\",\n \"lernen\",\n \"öffnen\",\n \"los\",\n \"sehen\",\n \"entdecken\",\n \"erkunden\",\n \"stöbern\",\n \"herunterladen\",\n \"holen\",\n \"abholen\",\n \"einlösen\",\n \"anschauen\",\n \"jetzt\",\n ],\n};\n\nexport default de;\n","/**\n * English vague-text dictionaries. Treated as the source of truth — other\n * locales annotate themselves `typeof en` so missing/extra phrases fail\n * typecheck.\n *\n * Phrases are matched case-insensitively against trimmed text content.\n */\nconst en = {\n vagueLinkText: [\n \"click here\",\n \"here\",\n \"read more\",\n \"more\",\n \"learn more\",\n \"see more\",\n \"this\",\n \"this link\",\n \"link\",\n \"click\",\n ],\n vagueButtonLabels: [\n \"click here\",\n \"click\",\n \"submit\",\n \"go\",\n \"ok\",\n \"okay\",\n \"yes\",\n \"no\",\n ],\n /**\n * Action verbs that signal a linked image's alt describes the link\n * destination, not just the visual subject. Used by `img-linked-no-context`.\n * Stored lowercase; tokenized matching is case-insensitive.\n */\n linkedImageActionHints: [\n \"buy\",\n \"shop\",\n \"view\",\n \"read\",\n \"learn\",\n \"open\",\n \"go\",\n \"see\",\n \"explore\",\n \"discover\",\n \"browse\",\n \"download\",\n \"get\",\n \"claim\",\n \"redeem\",\n \"watch\",\n ],\n};\n\nexport default en;\n","import en from \"./en\";\n\nexport type Dictionary = typeof en;\n\n/**\n * Auto-discovered locale registry. Drop a `dictionaries/<lang>.ts` file\n * and it's bundled automatically — same pattern as the editor's i18n\n * and the sibling `messages/` registry.\n *\n * Eager glob: synchronous, all locales bundled into the package. Tiny\n * (a few hundred bytes per locale) so the cost is negligible.\n */\nconst modules = import.meta.glob<{ default: Dictionary }>(\"./*.ts\", {\n eager: true,\n});\n\nconst DICTIONARIES: Record<string, Dictionary> = {};\nfor (const path in modules) {\n const match = /\\.\\/([^/]+)\\.ts$/.exec(path);\n if (!match) continue;\n const locale = match[1];\n if (locale === \"index\") continue;\n DICTIONARIES[locale] = modules[path].default;\n}\n\n/**\n * Returns a dictionary that unions every registered locale. Vague phrases\n * are universally vague — a German-locale email with an English \"Click here\"\n * CTA, or an English email with a French \"cliquez ici\", is still a vague\n * CTA, so the rule must detect across languages regardless of editor locale.\n *\n * The `locale` argument is accepted for API symmetry and future use (e.g.\n * weighted matching) but currently doesn't change the returned set.\n */\nexport function getDictionary(_locale: string): Dictionary {\n return UNIONED_DICTIONARY;\n}\n\nfunction unionAll(pick: (d: Dictionary) => readonly string[]): string[] {\n const set = new Set<string>();\n for (const dict of Object.values(DICTIONARIES)) {\n for (const phrase of pick(dict)) set.add(phrase);\n }\n return Array.from(set);\n}\n\nconst UNIONED_DICTIONARY: Dictionary = {\n vagueLinkText: unionAll((d) => d.vagueLinkText),\n vagueButtonLabels: unionAll((d) => d.vagueButtonLabels),\n linkedImageActionHints: unionAll((d) => d.linkedImageActionHints),\n};\n\nexport const SUPPORTED_DICTIONARY_LOCALES = Object.keys(DICTIONARIES);\n\n/**\n * Normalize text for dictionary matching: lowercase, collapse whitespace,\n * strip leading/trailing non-alphanumeric characters (punctuation, arrows,\n * emoji, decorative symbols). \"Click here!\", \"→ click here\", \"click here?\"\n * all collapse to \"click here\" so the dictionary's plain phrase matches.\n */\nexport function normalizeForMatch(input: string): string {\n return input\n .toLowerCase()\n .replace(/\\s+/g, \" \")\n .replace(/^[^\\p{L}\\p{N}]+|[^\\p{L}\\p{N}]+$/gu, \"\")\n .trim();\n}\n","import { isImage } from \"@templatical/types\";\nimport type { Rule, RuleMeta } from \"../../types\";\nimport { getDictionary } from \"../dictionaries\";\n\nexport const meta: RuleMeta = {\n id: \"a11y.img-linked-no-context\",\n severity: \"warning\",\n};\n\nexport const imgLinkedNoContext: Rule = {\n meta,\n block(block, _ctx, opts) {\n if (!isImage(block) || block.decorative === true) return null;\n if (!block.linkUrl || block.linkUrl.trim() === \"\") return null;\n const alt = (block.alt ?? \"\").trim();\n if (alt === \"\") return null;\n const tokens = alt\n .toLocaleLowerCase()\n .split(/[^\\p{L}\\p{N}]+/u)\n .filter(Boolean);\n const hints = getDictionary(opts.locale).linkedImageActionHints;\n if (tokens.some((token) => hints.includes(token))) return null;\n return { blockId: block.id };\n },\n};\n","import { Parser } from \"htmlparser2\";\n\nexport interface AnchorInfo {\n href: string;\n text: string;\n target: string | null;\n rel: string | null;\n /** True if the anchor wraps an image with non-empty alt. */\n hasImageWithAlt: boolean;\n}\n\n/**\n * Extract every anchor from a TipTap-style HTML fragment. Used by\n * link-* rules. Doesn't try to be a full DOM — only the data the rules\n * need.\n */\nexport function extractAnchors(html: string): AnchorInfo[] {\n const anchors: AnchorInfo[] = [];\n // Each open anchor owns its own text buffer so a nested `<a>` (invalid\n // HTML but parsed permissively) doesn't truncate the outer anchor's text.\n const stack: { anchor: AnchorInfo; buffer: string }[] = [];\n\n const parser = new Parser({\n onopentag(name, attribs) {\n if (name === \"a\") {\n const anchor: AnchorInfo = {\n href: attribs.href ?? \"\",\n text: \"\",\n target: attribs.target ?? null,\n rel: attribs.rel ?? null,\n hasImageWithAlt: false,\n };\n stack.push({ anchor, buffer: \"\" });\n return;\n }\n\n if (name === \"img\" && stack.length > 0) {\n const alt = (attribs.alt ?? \"\").trim();\n if (alt !== \"\") {\n stack[stack.length - 1].anchor.hasImageWithAlt = true;\n }\n }\n },\n ontext(text) {\n for (const frame of stack) {\n frame.buffer += text;\n }\n },\n onclosetag(name) {\n if (name === \"a\" && stack.length > 0) {\n const frame = stack.pop()!;\n frame.anchor.text = frame.buffer.trim();\n anchors.push(frame.anchor);\n }\n },\n });\n\n parser.write(html);\n parser.end();\n\n return anchors;\n}\n\n/**\n * Strip tags and return the visible text content of an HTML fragment.\n * Used by heading-empty and other text-presence rules.\n */\nexport function extractText(html: string): string {\n let text = \"\";\n const parser = new Parser({\n ontext(chunk) {\n text += chunk;\n },\n });\n parser.write(html);\n parser.end();\n return text.trim();\n}\n","import { isTitle } from \"@templatical/types\";\nimport type { Rule, RuleMeta } from \"../../types\";\nimport { extractText } from \"../../html-utils\";\n\nexport const meta: RuleMeta = {\n id: \"a11y.heading-empty\",\n severity: \"error\",\n};\n\nexport const headingEmpty: Rule = {\n meta,\n block(block) {\n if (!isTitle(block)) return null;\n const text = extractText(block.content ?? \"\");\n if (text !== \"\") return null;\n return { blockId: block.id };\n },\n};\n","import { isTitle, isSection } from \"@templatical/types\";\nimport type { Block, TitleBlock, TemplateContent } from \"@templatical/types\";\nimport type { Rule, RuleHit, RuleMeta } from \"../../types\";\n\nexport const meta: RuleMeta = {\n id: \"a11y.heading-skip-level\",\n severity: \"error\",\n};\n\nfunction collectTitles(blocks: Block[], out: TitleBlock[]): void {\n for (const block of blocks) {\n if (isTitle(block)) {\n out.push(block);\n continue;\n }\n if (isSection(block)) {\n for (const column of block.children) {\n collectTitles(column, out);\n }\n }\n }\n}\n\nexport const headingSkipLevel: Rule = {\n meta,\n template(content: TemplateContent) {\n const titles: TitleBlock[] = [];\n collectTitles(content.blocks, titles);\n\n const hits: RuleHit[] = [];\n let lastLevel = 0;\n\n for (const title of titles) {\n if (lastLevel !== 0 && title.level > lastLevel + 1) {\n hits.push({\n blockId: title.id,\n params: { from: lastLevel, to: title.level },\n });\n }\n lastLevel = title.level;\n }\n\n return hits;\n },\n};\n","import { isTitle, isSection } from \"@templatical/types\";\nimport type { Block, TitleBlock, TemplateContent } from \"@templatical/types\";\nimport type { Rule, RuleMeta } from \"../../types\";\n\nexport const meta: RuleMeta = {\n id: \"a11y.heading-multiple-h1\",\n severity: \"warning\",\n};\n\nfunction collectTitles(blocks: Block[], out: TitleBlock[]): void {\n for (const block of blocks) {\n if (isTitle(block)) {\n out.push(block);\n continue;\n }\n if (isSection(block)) {\n for (const column of block.children) {\n collectTitles(column, out);\n }\n }\n }\n}\n\nexport const headingMultipleH1: Rule = {\n meta,\n template(content: TemplateContent) {\n const titles: TitleBlock[] = [];\n collectTitles(content.blocks, titles);\n const h1s = titles.filter((t) => t.level === 1);\n if (h1s.length <= 1) return [];\n return h1s.slice(1).map((title) => ({ blockId: title.id }));\n },\n};\n","import { isParagraph, isTitle } from \"@templatical/types\";\nimport type { Block } from \"@templatical/types\";\nimport type { Rule, RuleMeta } from \"../../types\";\nimport { extractAnchors } from \"../../html-utils\";\n\nexport const meta: RuleMeta = {\n id: \"a11y.link-empty\",\n severity: \"error\",\n};\n\nfunction getHtml(block: Block): string | null {\n if (isParagraph(block) || isTitle(block)) return block.content;\n return null;\n}\n\nexport const linkEmpty: Rule = {\n meta,\n block(block) {\n const html = getHtml(block);\n if (html === null) return null;\n\n const anchors = extractAnchors(html);\n const offender = anchors.find(\n (anchor) => anchor.text === \"\" && !anchor.hasImageWithAlt,\n );\n if (!offender) return null;\n\n return { blockId: block.id };\n },\n};\n","import { isParagraph, isTitle } from \"@templatical/types\";\nimport type { Block } from \"@templatical/types\";\nimport type { Rule, RuleMeta } from \"../../types\";\nimport { extractAnchors } from \"../../html-utils\";\nimport { getDictionary, normalizeForMatch } from \"../dictionaries\";\n\nexport const meta: RuleMeta = {\n id: \"a11y.link-vague-text\",\n severity: \"warning\",\n};\n\nfunction getHtml(block: Block): string | null {\n if (isParagraph(block) || isTitle(block)) return block.content;\n return null;\n}\n\nexport const linkVagueText: Rule = {\n meta,\n block(block, _ctx, opts) {\n const html = getHtml(block);\n if (html === null) return null;\n\n const phrases = getDictionary(opts.locale).vagueLinkText;\n const anchors = extractAnchors(html);\n const offender = anchors.find((a) => {\n const text = normalizeForMatch(a.text);\n return text !== \"\" && phrases.includes(text);\n });\n if (!offender) return null;\n\n return { blockId: block.id, params: { text: offender.text } };\n },\n};\n","import { isParagraph, isTitle } from \"@templatical/types\";\nimport type { Block } from \"@templatical/types\";\nimport type { Rule, RuleMeta } from \"../../types\";\nimport { extractAnchors } from \"../../html-utils\";\n\nexport const meta: RuleMeta = {\n id: \"a11y.link-href-empty\",\n severity: \"error\",\n};\n\nfunction getHtml(block: Block): string | null {\n if (isParagraph(block) || isTitle(block)) return block.content;\n return null;\n}\n\nexport const linkHrefEmpty: Rule = {\n meta,\n block(block) {\n const html = getHtml(block);\n if (html === null) return null;\n const anchors = extractAnchors(html);\n const offender = anchors.find((a) => {\n const href = a.href.trim();\n return href === \"\" || href === \"#\";\n });\n if (!offender) return null;\n return { blockId: block.id };\n },\n};\n","import { isParagraph, isTitle } from \"@templatical/types\";\nimport type { Block } from \"@templatical/types\";\nimport type { Rule, RuleMeta } from \"../../types\";\nimport { extractAnchors } from \"../../html-utils\";\n\nexport const meta: RuleMeta = {\n id: \"a11y.link-target-blank-no-rel\",\n severity: \"warning\",\n};\n\nfunction getHtml(block: Block): string | null {\n if (isParagraph(block) || isTitle(block)) return block.content;\n return null;\n}\n\nfunction hasSafeRel(rel: string | null): boolean {\n if (rel === null) return false;\n const tokens = rel.toLowerCase().split(/\\s+/);\n return tokens.includes(\"noopener\") || tokens.includes(\"noreferrer\");\n}\n\nexport const linkTargetBlankNoRel: Rule = {\n meta,\n block(block) {\n const html = getHtml(block);\n if (html === null) return null;\n const anchors = extractAnchors(html);\n const offender = anchors.find(\n (a) => a.target === \"_blank\" && !hasSafeRel(a.rel),\n );\n if (!offender) return null;\n\n return {\n blockId: block.id,\n fix: {\n description: 'Add rel=\"noopener\"',\n apply: (ctx) => {\n if (!isParagraph(block) && !isTitle(block)) return;\n const updated = addNoopenerToTargetBlank(block.content ?? \"\");\n ctx.updateBlock(block.id, { content: updated } as Partial<Block>);\n },\n },\n };\n },\n};\n\ninterface ParsedAttr {\n raw: string;\n name: string;\n value: string | null;\n /** Start offset of `raw` within the parent attrs string. */\n start: number;\n}\n\nconst ATTR_RE =\n /([^\\s\"'>/=]+)(?:\\s*=\\s*(?:\"([^\"]*)\"|'([^']*)'|([^\\s\"'=<>`]+)))?/g;\n\nfunction parseAttrs(attrs: string): ParsedAttr[] {\n const parsed: ParsedAttr[] = [];\n const re = new RegExp(ATTR_RE.source, ATTR_RE.flags);\n let match: RegExpExecArray | null;\n while ((match = re.exec(attrs)) !== null) {\n const value = match[2] ?? match[3] ?? match[4] ?? null;\n parsed.push({\n raw: match[0],\n name: match[1],\n value,\n start: match.index,\n });\n }\n return parsed;\n}\n\nfunction hasUnsafeTargetBlank(parsed: ParsedAttr[]): boolean {\n return parsed.some(\n (a) =>\n a.name.toLowerCase() === \"target\" &&\n a.value !== null &&\n a.value.toLowerCase() === \"_blank\",\n );\n}\n\nfunction addNoopenerToTargetBlank(html: string): string {\n return html.replace(/<a\\b([^>]*)>/gi, (match, attrs: string) => {\n const parsed = parseAttrs(attrs);\n if (!hasUnsafeTargetBlank(parsed)) return match;\n\n const relAttr = parsed.find((a) => a.name.toLowerCase() === \"rel\");\n if (relAttr) {\n const tokens = (relAttr.value ?? \"\").toLowerCase().split(/\\s+/);\n if (tokens.includes(\"noopener\") || tokens.includes(\"noreferrer\")) {\n return match;\n }\n const newRel = `${relAttr.value ?? \"\"} noopener`.trim();\n const before = attrs.slice(0, relAttr.start);\n const after = attrs.slice(relAttr.start + relAttr.raw.length);\n return `<a${before}rel=\"${newRel}\"${after}>`;\n }\n return `<a${attrs} rel=\"noopener\">`;\n });\n}\n","import { isParagraph, isTitle } from \"@templatical/types\";\nimport type { Rule, RuleMeta } from \"../../types\";\nimport { extractText } from \"../../html-utils\";\n\nexport const meta: RuleMeta = {\n id: \"a11y.text-all-caps\",\n severity: \"warning\",\n};\n\nexport const textAllCaps: Rule = {\n meta,\n block(block, _ctx, opts) {\n if (!isParagraph(block) && !isTitle(block)) return null;\n const text = extractText(block.content ?? \"\");\n const letters = text.replace(/[^\\p{L}]/gu, \"\");\n if (letters.length < opts.thresholds.allCapsMinLength) return null;\n if (letters !== letters.toLocaleUpperCase()) return null;\n return { blockId: block.id };\n },\n};\n","import { isTitle } from \"@templatical/types\";\nimport type { Rule, RuleMeta } from \"../../types\";\nimport { getContrastRatio, isOpaqueHex } from \"../../contrast\";\nimport { HEADING_LEVEL_FONT_SIZE } from \"@templatical/types\";\n\nexport const meta: RuleMeta = {\n id: \"a11y.text-low-contrast\",\n severity: \"error\",\n};\n\nexport const textLowContrast: Rule = {\n meta,\n block(block, ctx) {\n if (!isTitle(block)) return null;\n if (\n !isOpaqueHex(block.color) ||\n !isOpaqueHex(ctx.resolvedBackgroundColor)\n ) {\n return null;\n }\n const fontSize = HEADING_LEVEL_FONT_SIZE[block.level];\n // WCAG large text = 18pt (~24px). Headings have no structured bold\n // flag in this codebase (TipTap stores it inline), so we conservatively\n // skip the 14pt-bold (~18.66px) relaxation and apply the px threshold.\n const required = fontSize >= 24 ? 3 : 4.5;\n const ratio = getContrastRatio(block.color, ctx.resolvedBackgroundColor);\n if (Number.isNaN(ratio) || ratio >= required) return null;\n return {\n blockId: block.id,\n params: { ratio: ratio.toFixed(2), required },\n };\n },\n};\n","import { isMenu, isTable } from \"@templatical/types\";\nimport type { Block } from \"@templatical/types\";\nimport type { Rule, RuleMeta } from \"../../types\";\n\nexport const meta: RuleMeta = {\n id: \"a11y.text-too-small\",\n severity: \"warning\",\n};\n\nfunction getFontSize(block: Block): number | null {\n if (isMenu(block) || isTable(block)) return block.fontSize;\n return null;\n}\n\nexport const textTooSmall: Rule = {\n meta,\n block(block, _ctx, opts) {\n const fontSize = getFontSize(block);\n if (fontSize === null) return null;\n if (fontSize >= opts.thresholds.minFontSize) return null;\n return {\n blockId: block.id,\n params: { size: fontSize, min: opts.thresholds.minFontSize },\n };\n },\n};\n","import { isButton } from \"@templatical/types\";\nimport type { Rule, RuleMeta } from \"../../types\";\nimport { getDictionary, normalizeForMatch } from \"../dictionaries\";\n\nexport const meta: RuleMeta = {\n id: \"a11y.button-vague-label\",\n severity: \"warning\",\n};\n\nexport const buttonVagueLabel: Rule = {\n meta,\n block(block, _ctx, opts) {\n if (!isButton(block)) return null;\n const text = normalizeForMatch(block.text ?? \"\");\n if (text === \"\") return null;\n const phrases = getDictionary(opts.locale).vagueButtonLabels;\n if (!phrases.includes(text)) return null;\n return { blockId: block.id, params: { text: block.text } };\n },\n};\n","import { isButton } from \"@templatical/types\";\nimport type { Rule, RuleMeta } from \"../../types\";\n\nexport const meta: RuleMeta = {\n id: \"a11y.button-touch-target\",\n severity: \"warning\",\n};\n\nexport const buttonTouchTarget: Rule = {\n meta,\n block(block, _ctx, opts) {\n if (!isButton(block)) return null;\n const padding = block.buttonPadding;\n if (!padding) return null;\n const estimatedHeight = block.fontSize * 1.4 + padding.top + padding.bottom;\n if (estimatedHeight >= opts.thresholds.minTouchTargetPx) return null;\n return {\n blockId: block.id,\n params: {\n height: Math.round(estimatedHeight),\n min: opts.thresholds.minTouchTargetPx,\n },\n };\n },\n};\n","import { isButton } from \"@templatical/types\";\nimport type { Rule, RuleMeta } from \"../../types\";\nimport { getContrastRatio } from \"../../contrast\";\n\nexport const meta: RuleMeta = {\n id: \"a11y.button-low-contrast\",\n severity: \"error\",\n};\n\nexport const buttonLowContrast: Rule = {\n meta,\n block(block) {\n if (!isButton(block)) return null;\n const ratio = getContrastRatio(block.textColor, block.backgroundColor);\n if (Number.isNaN(ratio)) return null;\n // WCAG large text = 18pt (~24px). Mirrors the heading rule's threshold.\n const required = block.fontSize >= 24 ? 3 : 4.5;\n if (ratio >= required) return null;\n return {\n blockId: block.id,\n params: { ratio: ratio.toFixed(2), required },\n };\n },\n};\n","import type { Rule, RuleMeta } from \"../../types\";\n\nexport const meta: RuleMeta = {\n id: \"a11y.missing-preheader\",\n severity: \"info\",\n};\n\nexport const missingPreheader: Rule = {\n meta,\n template(content) {\n const text = content.settings.preheaderText?.trim() ?? \"\";\n if (text !== \"\") return [];\n return [{ blockId: null }];\n },\n};\n","import type { TemplateContent } from \"@templatical/types\";\nimport type { LintIssue, LintOptions, Rule } from \"../types\";\nimport { runRules } from \"../run-rules\";\nimport { formatMessage, type RuleMessageId } from \"./messages\";\nimport { imgMissingAlt } from \"./rules/img-missing-alt\";\nimport { imgAltIsFilename } from \"./rules/img-alt-is-filename\";\nimport { imgAltTooLong } from \"./rules/img-alt-too-long\";\nimport { imgDecorativeNeedsEmptyAlt } from \"./rules/img-decorative-needs-empty-alt\";\nimport { imgLinkedNoContext } from \"./rules/img-linked-no-context\";\nimport { headingEmpty } from \"./rules/heading-empty\";\nimport { headingSkipLevel } from \"./rules/heading-skip-level\";\nimport { headingMultipleH1 } from \"./rules/heading-multiple-h1\";\nimport { linkEmpty } from \"./rules/link-empty\";\nimport { linkVagueText } from \"./rules/link-vague-text\";\nimport { linkHrefEmpty } from \"./rules/link-href-empty\";\nimport { linkTargetBlankNoRel } from \"./rules/link-target-blank-no-rel\";\nimport { textAllCaps } from \"./rules/text-all-caps\";\nimport { textLowContrast } from \"./rules/text-low-contrast\";\nimport { textTooSmall } from \"./rules/text-too-small\";\nimport { buttonVagueLabel } from \"./rules/button-vague-label\";\nimport { buttonTouchTarget } from \"./rules/button-touch-target\";\nimport { buttonLowContrast } from \"./rules/button-low-contrast\";\nimport { missingPreheader } from \"./rules/missing-preheader\";\n\nexport const ACCESSIBILITY_RULES: Rule[] = [\n imgMissingAlt,\n imgAltIsFilename,\n imgAltTooLong,\n imgDecorativeNeedsEmptyAlt,\n imgLinkedNoContext,\n headingEmpty,\n headingSkipLevel,\n headingMultipleH1,\n linkEmpty,\n linkVagueText,\n linkHrefEmpty,\n linkTargetBlankNoRel,\n textAllCaps,\n textLowContrast,\n textTooSmall,\n buttonVagueLabel,\n buttonTouchTarget,\n buttonLowContrast,\n missingPreheader,\n];\n\nexport function lintAccessibility(\n content: TemplateContent,\n options: LintOptions = {},\n): LintIssue[] {\n return runRules(content, ACCESSIBILITY_RULES, options, (locale, id, params) =>\n formatMessage(locale, id as RuleMessageId, params),\n );\n}\n","import type en from \"./en\";\n\nconst de: typeof en = {\n \"structure.duplicate-block-id\":\n \"Block-ID erscheint {count}-mal im Baum. Jeder Block muss eine eindeutige ID haben.\",\n \"structure.section-column-mismatch\":\n 'Sektion verwendet Layout „{layout}\" (erwartet {expected} Spalten), hat aber {actual}. Deutet auf beschädigten Zustand hin.',\n \"structure.nested-section\":\n \"Sektion ist in einer anderen Sektion verschachtelt. Sektionen können nicht verschachtelt werden – der Renderer wird sich falsch verhalten.\",\n \"structure.empty-section\":\n \"Sektion enthält keine Blöcke. Entferne sie oder füge Inhalt hinzu.\",\n \"structure.empty-column\":\n \"Spalte {columnIndex} dieser Sektion ist leer. Füge Inhalt hinzu oder reduziere die Spaltenanzahl.\",\n};\n\nexport default de;\n","/**\n * English structure-rule messages. The source of truth — other locales\n * annotate themselves `typeof en` so missing or extra keys fail typecheck.\n *\n * Templates use `{name}` placeholders, interpolated by `formatMessage`.\n */\nconst en = {\n \"structure.duplicate-block-id\":\n \"Block id appears {count} times in the tree. Each block must have a unique id.\",\n \"structure.section-column-mismatch\":\n 'Section uses layout \"{layout}\" (expects {expected} columns) but has {actual}. Indicates corrupted state.',\n \"structure.nested-section\":\n \"Section is nested inside another section. Sections cannot nest — the renderer will misbehave.\",\n \"structure.empty-section\": \"Section has no blocks. Remove it or add content.\",\n \"structure.empty-column\":\n \"Column {columnIndex} of this section is empty. Add content or reduce the column count.\",\n};\n\nexport default en;\n","import en from \"./en\";\n\nexport type StructureMessageMap = typeof en;\nexport type StructureRuleMessageId = keyof StructureMessageMap;\n\nconst modules = import.meta.glob<{ default: StructureMessageMap }>(\"./*.ts\", {\n eager: true,\n});\n\nconst MESSAGES: Record<string, StructureMessageMap> = {};\nfor (const path in modules) {\n const match = /\\.\\/([^/]+)\\.ts$/.exec(path);\n if (!match) continue;\n const locale = match[1];\n if (locale === \"index\") continue;\n MESSAGES[locale] = modules[path].default;\n}\n\nexport const SUPPORTED_STRUCTURE_MESSAGE_LOCALES = Object.keys(MESSAGES);\n\nexport function getStructureMessages(locale: string): StructureMessageMap {\n const base = locale.split(\"-\")[0]?.toLowerCase() ?? \"en\";\n return MESSAGES[base] ?? MESSAGES.en ?? en;\n}\n\nexport function formatStructureMessage(\n locale: string,\n ruleId: StructureRuleMessageId,\n params?: Record<string, string | number>,\n): string {\n const map = getStructureMessages(locale);\n const template = map[ruleId] ?? en[ruleId];\n if (!params) return template;\n return template.replace(/\\{(\\w+)\\}/g, (_, key: string) => {\n const value = params[key];\n return value === undefined ? `{${key}}` : String(value);\n });\n}\n","import type { Block, SectionBlock, TemplateContent } from \"@templatical/types\";\nimport { isSection } from \"@templatical/types\";\nimport type { Rule, RuleHit, RuleMeta } from \"../../types\";\n\nexport const meta: RuleMeta = {\n id: \"structure.duplicate-block-id\",\n severity: \"error\",\n};\n\nfunction collectIds(blocks: Block[], counts: Map<string, number>): void {\n for (const block of blocks) {\n counts.set(block.id, (counts.get(block.id) ?? 0) + 1);\n if (isSection(block)) {\n for (const column of (block as SectionBlock).children) {\n collectIds(column, counts);\n }\n }\n }\n}\n\nexport const duplicateBlockId: Rule = {\n meta,\n template(content: TemplateContent): RuleHit[] {\n const counts = new Map<string, number>();\n collectIds(content.blocks, counts);\n\n const hits: RuleHit[] = [];\n for (const [id, count] of counts) {\n if (count > 1) {\n hits.push({ blockId: id, params: { count } });\n }\n }\n return hits;\n },\n};\n","import type { Block, SectionBlock, TemplateContent } from \"@templatical/types\";\nimport { isSection } from \"@templatical/types\";\nimport type { Rule, RuleHit, RuleMeta } from \"../../types\";\n\nexport const meta: RuleMeta = {\n id: \"structure.empty-column\",\n severity: \"warning\",\n};\n\nfunction findEmptyColumns(blocks: Block[], hits: RuleHit[]): void {\n for (const block of blocks) {\n if (!isSection(block)) continue;\n const section = block as SectionBlock;\n if (section.children.length > 1) {\n section.children.forEach((column, columnIndex) => {\n if (column.length === 0) {\n hits.push({\n blockId: section.id,\n params: { columnIndex: columnIndex + 1 },\n });\n }\n });\n }\n for (const column of section.children) {\n findEmptyColumns(column, hits);\n }\n }\n}\n\nexport const emptyColumn: Rule = {\n meta,\n template(content: TemplateContent): RuleHit[] {\n const hits: RuleHit[] = [];\n findEmptyColumns(content.blocks, hits);\n return hits;\n },\n};\n","import type { SectionBlock } from \"@templatical/types\";\nimport { isSection } from \"@templatical/types\";\nimport type { Rule, RuleMeta } from \"../../types\";\n\nexport const meta: RuleMeta = {\n id: \"structure.empty-section\",\n severity: \"warning\",\n};\n\nfunction isSectionEmpty(section: SectionBlock): boolean {\n if (section.children.length === 0) return true;\n return section.children.every((column) => column.length === 0);\n}\n\nexport const emptySection: Rule = {\n meta,\n block(block) {\n if (!isSection(block)) return null;\n const section = block as SectionBlock;\n if (!isSectionEmpty(section)) return null;\n return {\n blockId: section.id,\n fix: {\n description: \"Remove the empty section\",\n apply: (ctx) => {\n ctx.removeBlock(section.id);\n },\n },\n };\n },\n};\n","import type { SectionBlock } from \"@templatical/types\";\nimport { isSection } from \"@templatical/types\";\nimport type { Rule, RuleMeta, WalkContext } from \"../../types\";\n\nexport const meta: RuleMeta = {\n id: \"structure.nested-section\",\n severity: \"error\",\n};\n\nexport const nestedSection: Rule = {\n meta,\n block(block, ctx: WalkContext) {\n if (!isSection(block)) return null;\n if (ctx.section === null) return null;\n const parentSection = ctx.section as SectionBlock;\n return {\n blockId: block.id,\n params: { parentId: parentSection.id },\n };\n },\n};\n","import type { ColumnLayout, SectionBlock } from \"@templatical/types\";\nimport { isSection } from \"@templatical/types\";\nimport type { Rule, RuleMeta } from \"../../types\";\n\nexport const meta: RuleMeta = {\n id: \"structure.section-column-mismatch\",\n severity: \"error\",\n};\n\nfunction expectedColumnCount(layout: ColumnLayout): number {\n if (layout === \"1\") return 1;\n if (layout === \"3\") return 3;\n return 2;\n}\n\nexport const sectionColumnMismatch: Rule = {\n meta,\n block(block) {\n if (!isSection(block)) return null;\n const section = block as SectionBlock;\n const expected = expectedColumnCount(section.columns);\n const actual = section.children.length;\n if (actual === expected) return null;\n return {\n blockId: section.id,\n params: { layout: section.columns, expected, actual },\n };\n },\n};\n","import type { TemplateContent } from \"@templatical/types\";\nimport type { LintIssue, LintOptions, Rule } from \"../types\";\nimport { runRules } from \"../run-rules\";\nimport {\n formatStructureMessage,\n type StructureRuleMessageId,\n} from \"./messages\";\nimport { duplicateBlockId } from \"./rules/duplicate-block-id\";\nimport { emptyColumn } from \"./rules/empty-column\";\nimport { emptySection } from \"./rules/empty-section\";\nimport { nestedSection } from \"./rules/nested-section\";\nimport { sectionColumnMismatch } from \"./rules/section-column-mismatch\";\n\nexport const STRUCTURE_RULES: Rule[] = [\n duplicateBlockId,\n emptySection,\n emptyColumn,\n nestedSection,\n sectionColumnMismatch,\n];\n\nexport function lintStructure(\n content: TemplateContent,\n options: LintOptions = {},\n): LintIssue[] {\n return runRules(content, STRUCTURE_RULES, options, (locale, id, params) =>\n formatStructureMessage(locale, id as StructureRuleMessageId, params),\n );\n}\n","import type en from \"./en\";\n\nconst de: typeof en = {\n \"link.javascript-protocol\":\n 'Die URL verwendet das „javascript:\"-Protokoll, das aus Sicherheitsgründen beim Rendern entfernt wird. Ersetze sie durch eine echte URL oder entferne sie.',\n \"link.unsupported-protocol\":\n 'Die URL verwendet das Protokoll „{protocol}\", das von den meisten E-Mail-Clients nicht unterstützt wird. Verwende http, https, mailto, tel oder sms.',\n \"link.malformed-mailto\":\n \"Der mailto:-Link ist fehlerhaft. Erwartet wird eine einzelne Empfängeradresse vor einer eventuellen Querystring (z. B. mailto:hallo@example.com).\",\n \"link.malformed-tel\":\n \"Der tel:-Link enthält Zeichen, die keine Ziffern, +, Leerzeichen, Bindestriche, Klammern oder Punkte sind.\",\n \"link.localhost-or-staging\":\n 'Der URL-Host „{host}\" entspricht einem Nicht-Produktionsmuster. Ersetze ihn vor dem Versand durch die Produktions-URL.',\n};\n\nexport default de;\n","/**\n * English link-rule messages. The source of truth — other locales annotate\n * themselves `typeof en` so missing or extra keys fail typecheck.\n *\n * Templates use `{name}` placeholders, interpolated by `formatLinkMessage`.\n */\nconst en = {\n \"link.javascript-protocol\":\n 'URL uses the \"javascript:\" protocol, which is stripped at render time for safety. Replace it with a real link or remove the URL.',\n \"link.unsupported-protocol\":\n 'URL uses the \"{protocol}\" protocol, which most email clients do not support. Use http, https, mailto, tel, or sms.',\n \"link.malformed-mailto\":\n \"mailto: link is malformed. Expected a single recipient address before any query string (e.g. mailto:hello@example.com).\",\n \"link.malformed-tel\":\n \"tel: link contains characters that are not digits, +, spaces, dashes, parentheses, or dots.\",\n \"link.localhost-or-staging\":\n 'URL host \"{host}\" matches a non-production pattern. Replace with the production URL before sending.',\n};\n\nexport default en;\n","import en from \"./en\";\n\nexport type LinkMessageMap = typeof en;\nexport type LinkRuleMessageId = keyof LinkMessageMap;\n\nconst modules = import.meta.glob<{ default: LinkMessageMap }>(\"./*.ts\", {\n eager: true,\n});\n\nconst MESSAGES: Record<string, LinkMessageMap> = {};\nfor (const path in modules) {\n const match = /\\.\\/([^/]+)\\.ts$/.exec(path);\n if (!match) continue;\n const locale = match[1];\n if (locale === \"index\") continue;\n MESSAGES[locale] = modules[path].default;\n}\n\nexport const SUPPORTED_LINK_MESSAGE_LOCALES = Object.keys(MESSAGES);\n\nexport function getLinkMessages(locale: string): LinkMessageMap {\n const base = locale.split(\"-\")[0]?.toLowerCase() ?? \"en\";\n return MESSAGES[base] ?? MESSAGES.en ?? en;\n}\n\nexport function formatLinkMessage(\n locale: string,\n ruleId: LinkRuleMessageId,\n params?: Record<string, string | number>,\n): string {\n const map = getLinkMessages(locale);\n const template = map[ruleId] ?? en[ruleId];\n if (!params) return template;\n return template.replace(/\\{(\\w+)\\}/g, (_, key: string) => {\n const value = params[key];\n return value === undefined ? `{${key}}` : String(value);\n });\n}\n","import type { TemplateContent } from \"@templatical/types\";\nimport {\n isButton,\n isHtml,\n isImage,\n isMenu,\n isParagraph,\n isSocialIcons,\n isTitle,\n isVideo,\n} from \"@templatical/types\";\nimport { walkBlocks } from \"./walk\";\nimport { extractAnchors } from \"./html-utils\";\n\nexport type UrlSource =\n | \"anchor\"\n | \"button\"\n | \"image-link\"\n | \"video\"\n | \"menu-item\"\n | \"social-icon\";\n\nexport interface UrlOccurrence {\n url: string;\n blockId: string;\n source: UrlSource;\n /** Anchor text or block-derived label, if applicable. */\n label?: string;\n}\n\n/**\n * Visit every URL-bearing field in the template tree.\n *\n * Sources covered:\n * - anchor — `<a href>` inside `title.content`, `paragraph.content`,\n * `html.content` (parsed via extractAnchors)\n * - button — `button.url`\n * - image-link — `image.linkUrl` (only when present + non-empty)\n * - video — `video.url`\n * - menu-item — `menu.items[i].url`\n * - social-icon — `social.icons[i].url`\n *\n * Each rule iterates this list once and decides per occurrence.\n */\nexport function walkUrls(content: TemplateContent): UrlOccurrence[] {\n const occurrences: UrlOccurrence[] = [];\n\n walkBlocks(content, (block) => {\n if (isTitle(block) || isParagraph(block) || isHtml(block)) {\n for (const anchor of extractAnchors(block.content)) {\n occurrences.push({\n url: anchor.href,\n blockId: block.id,\n source: \"anchor\",\n label: anchor.text,\n });\n }\n return;\n }\n\n if (isButton(block)) {\n occurrences.push({\n url: block.url,\n blockId: block.id,\n source: \"button\",\n label: block.text,\n });\n return;\n }\n\n if (isImage(block)) {\n if (block.linkUrl && block.linkUrl !== \"\") {\n occurrences.push({\n url: block.linkUrl,\n blockId: block.id,\n source: \"image-link\",\n label: block.alt || undefined,\n });\n }\n return;\n }\n\n if (isVideo(block)) {\n occurrences.push({\n url: block.url,\n blockId: block.id,\n source: \"video\",\n label: block.alt || undefined,\n });\n return;\n }\n\n if (isMenu(block)) {\n for (const item of block.items) {\n occurrences.push({\n url: item.url,\n blockId: block.id,\n source: \"menu-item\",\n label: item.text,\n });\n }\n return;\n }\n\n if (isSocialIcons(block)) {\n for (const icon of block.icons) {\n occurrences.push({\n url: icon.url,\n blockId: block.id,\n source: \"social-icon\",\n label: icon.platform,\n });\n }\n return;\n }\n });\n\n return occurrences;\n}\n","import type { Rule, RuleHit, RuleMeta } from \"../../types\";\nimport { walkUrls } from \"../../url-walker\";\n\nexport const meta: RuleMeta = {\n id: \"link.javascript-protocol\",\n severity: \"error\",\n};\n\n/**\n * Match `javascript:` even when the value is whitespace-padded or mixed-case.\n * Mirrors what HTML attribute parsers see at insert time — leading whitespace\n * (spaces, tabs, newlines) is stripped before scheme parsing.\n */\nfunction isJavascriptProtocol(url: string): boolean {\n if (!url) return false;\n const stripped = url.replace(/\\s+/g, \"\");\n return /^javascript:/i.test(stripped);\n}\n\nexport const javascriptProtocol: Rule = {\n meta,\n template(content): RuleHit[] {\n const hits: RuleHit[] = [];\n for (const occ of walkUrls(content)) {\n if (isJavascriptProtocol(occ.url)) {\n hits.push({ blockId: occ.blockId });\n }\n }\n return hits;\n },\n};\n","import type { Rule, RuleHit, RuleMeta } from \"../../types\";\nimport { walkUrls } from \"../../url-walker\";\n\nexport const meta: RuleMeta = {\n id: \"link.unsupported-protocol\",\n severity: \"warning\",\n};\n\nconst SUPPORTED = new Set([\"http\", \"https\", \"mailto\", \"tel\", \"sms\"]);\n\n/**\n * Treat `javascript:` (covered by its own rule) and bare/relative URLs as\n * \"not unsupported\" — this rule fires only for explicitly named schemes that\n * email clients typically refuse.\n */\nfunction getProtocol(url: string): string | null {\n if (!url) return null;\n const trimmed = url.trim();\n const match = /^([a-z][a-z0-9+\\-.]*):/i.exec(trimmed);\n if (!match) return null;\n return match[1].toLowerCase();\n}\n\nexport const unsupportedProtocol: Rule = {\n meta,\n template(content): RuleHit[] {\n const hits: RuleHit[] = [];\n for (const occ of walkUrls(content)) {\n const protocol = getProtocol(occ.url);\n if (protocol === null) continue;\n if (protocol === \"javascript\") continue;\n if (SUPPORTED.has(protocol)) continue;\n hits.push({ blockId: occ.blockId, params: { protocol } });\n }\n return hits;\n },\n};\n","import type { Rule, RuleHit, RuleMeta } from \"../../types\";\nimport { walkUrls } from \"../../url-walker\";\n\nexport const meta: RuleMeta = {\n id: \"link.malformed-mailto\",\n severity: \"warning\",\n};\n\n/**\n * Pragmatic RFC-5321-ish sanity check, not a full validator. Splits on `?`,\n * requires the left side to contain exactly one `@` with a non-empty local\n * part and a domain that includes at least one dot.\n *\n * Multi-recipient `mailto:a@x.com,b@y.com` is accepted (commas pass through;\n * each recipient is validated individually).\n */\nfunction isMalformedMailto(url: string): boolean {\n const trimmed = url.trim();\n if (!/^mailto:/i.test(trimmed)) return false;\n const value = trimmed.slice(\"mailto:\".length);\n const [recipients] = value.split(\"?\", 2);\n if (recipients.trim() === \"\") return true;\n\n const list = recipients.split(\",\").map((r) => r.trim());\n for (const recipient of list) {\n if (recipient === \"\") return true;\n const at = recipient.split(\"@\");\n if (at.length !== 2) return true;\n const [local, domain] = at;\n if (local === \"\" || domain === \"\") return true;\n if (!domain.includes(\".\")) return true;\n }\n return false;\n}\n\nexport const malformedMailto: Rule = {\n meta,\n template(content): RuleHit[] {\n const hits: RuleHit[] = [];\n for (const occ of walkUrls(content)) {\n if (isMalformedMailto(occ.url)) {\n hits.push({ blockId: occ.blockId });\n }\n }\n return hits;\n },\n};\n","import type { Rule, RuleHit, RuleMeta } from \"../../types\";\nimport { walkUrls } from \"../../url-walker\";\n\nexport const meta: RuleMeta = {\n id: \"link.malformed-tel\",\n severity: \"warning\",\n};\n\nconst VALID_TEL_CHARS = /^[+0-9\\s().\\-]+$/;\n\nfunction isMalformedTel(url: string): boolean {\n const trimmed = url.trim();\n if (!/^tel:/i.test(trimmed)) return false;\n const value = trimmed.slice(\"tel:\".length).trim();\n if (value === \"\") return true;\n return !VALID_TEL_CHARS.test(value);\n}\n\nexport const malformedTel: Rule = {\n meta,\n template(content): RuleHit[] {\n const hits: RuleHit[] = [];\n for (const occ of walkUrls(content)) {\n if (isMalformedTel(occ.url)) {\n hits.push({ blockId: occ.blockId });\n }\n }\n return hits;\n },\n};\n","import type { ResolvedOptions, Rule, RuleHit, RuleMeta } from \"../../types\";\nimport { walkUrls } from \"../../url-walker\";\n\nexport const meta: RuleMeta = {\n id: \"link.localhost-or-staging\",\n severity: \"warning\",\n};\n\n/**\n * Glob → RegExp for the `nonProductionHosts` pattern set. `*` is a wildcard\n * that matches any run of characters (including `.`) so `*.staging.*`\n * matches `app.staging.example.com` and `*.local` matches both `acme.local`\n * and `a.b.c.local`. Case-insensitive.\n */\nfunction globToRegex(pattern: string): RegExp {\n const escaped = pattern.replace(/[.+?^${}()|[\\]\\\\]/g, \"\\\\$&\");\n const expanded = escaped.replace(/\\*/g, \".*\");\n return new RegExp(`^${expanded}$`, \"i\");\n}\n\nfunction extractHost(url: string): string | null {\n if (!url) return null;\n const trimmed = url.trim();\n // mailto/tel/sms have no host concept worth matching.\n if (!/^(https?|ftps?):\\/\\//i.test(trimmed)) return null;\n try {\n return new URL(trimmed).hostname.toLowerCase();\n } catch {\n return null;\n }\n}\n\nexport const localhostOrStaging: Rule = {\n meta,\n template(content, opts: ResolvedOptions): RuleHit[] {\n const patterns = opts.links.nonProductionHosts;\n if (patterns.length === 0) return [];\n const regexes = patterns.map(globToRegex);\n const hits: RuleHit[] = [];\n\n for (const occ of walkUrls(content)) {\n const host = extractHost(occ.url);\n if (host === null) continue;\n if (regexes.some((re) => re.test(host))) {\n hits.push({ blockId: occ.blockId, params: { host } });\n }\n }\n return hits;\n },\n};\n","import type { TemplateContent } from \"@templatical/types\";\nimport type { LintIssue, LintOptions, Rule } from \"../types\";\nimport { runRules } from \"../run-rules\";\nimport { formatLinkMessage, type LinkRuleMessageId } from \"./messages\";\nimport { javascriptProtocol } from \"./rules/javascript-protocol\";\nimport { unsupportedProtocol } from \"./rules/unsupported-protocol\";\nimport { malformedMailto } from \"./rules/malformed-mailto\";\nimport { malformedTel } from \"./rules/malformed-tel\";\nimport { localhostOrStaging } from \"./rules/localhost-or-staging\";\n\nexport const LINK_RULES: Rule[] = [\n javascriptProtocol,\n unsupportedProtocol,\n malformedMailto,\n malformedTel,\n localhostOrStaging,\n];\n\nexport function lintLinks(\n content: TemplateContent,\n options: LintOptions = {},\n): LintIssue[] {\n return runRules(content, LINK_RULES, options, (locale, id, params) =>\n formatLinkMessage(locale, id as LinkRuleMessageId, params),\n );\n}\n"],"mappings":";;;;;;;;;;GAwHa,IAA0C;CACrD,cAAc;CACd,aAAa;CACb,kBAAkB;CAClB,kBAAkB;CACnB,EAEY,IAAyC;CACpD;CACA;CACA;CACA;CACA;CACA;CACD;;;AC5HD,SAAgB,EAAiB,GAAY,GAAoB;CAC/D,IAAM,IAAQ,EAAS,EAAG,EACpB,IAAQ,EAAS,EAAG;AAE1B,KAAI,CAAC,KAAS,CAAC,EACb,QAAO;CAGT,IAAM,IAAK,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C,IAAM,IADU,EAAQ,QAAQ,sBAAsB,OACrC,CAAQ,QAAQ,OAAO,KAAK;AAC7C,QAAW,OAAO,IAAI,EAAS,IAAI,IAAI;;AAGzC,SAAS,GAAY,GAA4B;AAC/C,KAAI,CAAC,EAAK,QAAO;CACjB,IAAM,IAAU,EAAI,MAAM;AAE1B,KAAI,CAAC,wBAAwB,KAAK,EAAQ,CAAE,QAAO;AACnD,KAAI;AACF,SAAO,IAAI,IAAI,EAAQ,CAAC,SAAS,aAAa;SACxC;AACN,SAAO;;;;;AClBX,IAAa,IAAqB;CAChC;CACA;CACA;CACA;CACA;EDkBA;EACA,SAAS,GAAS,GAAkC;GAClD,IAAM,IAAW,EAAK,MAAM;AAC5B,OAAI,EAAS,WAAW,EAAG,QAAO,EAAE;GACpC,IAAM,IAAU,EAAS,IAAI,GAAY,EACnC,IAAkB,EAAE;AAE1B,QAAK,IAAM,KAAO,EAAS,EAAQ,EAAE;IACnC,IAAM,IAAO,GAAY,EAAI,IAAI;AAC7B,UAAS,QACT,EAAQ,MAAM,MAAO,EAAG,KAAK,EAAK,CAAC,IACrC,EAAK,KAAK;KAAE,SAAS,EAAI;KAAS,QAAQ,EAAE,SAAM;KAAE,CAAC;;AAGzD,UAAO;;EChCT;CACD;AAED,SAAgB,GACd,GACA,IAAuB,EAAE,EACZ;AACb,QAAO,EAAS,GAAS,GAAY,IAAU,GAAQ,GAAI,MACzD,EAAkB,GAAQ,GAAyB,EAAO,CAC3D"}
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../src/types.ts","../src/contrast.ts","../src/walk.ts","../src/run-rules.ts","../src/accessibility/messages/de.ts","../src/accessibility/messages/en.ts","../src/accessibility/messages/index.ts","../src/accessibility/rules/img-missing-alt.ts","../src/accessibility/rules/img-alt-is-filename.ts","../src/accessibility/rules/img-alt-too-long.ts","../src/accessibility/rules/img-decorative-needs-empty-alt.ts","../src/accessibility/dictionaries/de.ts","../src/accessibility/dictionaries/en.ts","../src/accessibility/dictionaries/index.ts","../src/accessibility/rules/img-linked-no-context.ts","../src/html-utils.ts","../src/accessibility/rules/heading-empty.ts","../src/accessibility/rules/heading-skip-level.ts","../src/accessibility/rules/heading-multiple-h1.ts","../src/accessibility/rules/link-empty.ts","../src/accessibility/rules/link-vague-text.ts","../src/accessibility/rules/link-href-empty.ts","../src/accessibility/rules/link-target-blank-no-rel.ts","../src/accessibility/rules/text-all-caps.ts","../src/accessibility/rules/text-low-contrast.ts","../src/accessibility/rules/text-too-small.ts","../src/accessibility/rules/button-vague-label.ts","../src/accessibility/rules/button-touch-target.ts","../src/accessibility/rules/button-low-contrast.ts","../src/accessibility/rules/missing-preheader.ts","../src/accessibility/index.ts","../src/structure/messages/de.ts","../src/structure/messages/en.ts","../src/structure/messages/index.ts","../src/structure/rules/duplicate-block-id.ts","../src/structure/rules/empty-column.ts","../src/structure/rules/empty-section.ts","../src/structure/rules/nested-section.ts","../src/structure/rules/section-column-mismatch.ts","../src/structure/index.ts","../src/links/messages/de.ts","../src/links/messages/en.ts","../src/links/messages/index.ts","../src/url-walker.ts","../src/links/rules/javascript-protocol.ts","../src/links/rules/unsupported-protocol.ts","../src/links/rules/malformed-mailto.ts","../src/links/rules/malformed-tel.ts","../src/links/rules/localhost-or-staging.ts","../src/links/index.ts","../src/util.ts"],"sourcesContent":["import type {\n Block,\n SectionBlock,\n TemplateContent,\n TemplateSettings,\n} from \"@templatical/types\";\n\nexport type Severity = \"error\" | \"warning\" | \"info\" | \"off\";\n\nexport interface LintIssue {\n /** Block id, or null for template-level issues. */\n blockId: string | null;\n ruleId: string;\n severity: Exclude<Severity, \"off\">;\n message: string;\n fix?: LintPatch;\n}\n\nexport interface LintPatchContext {\n updateBlock: (blockId: string, patch: Partial<Block>) => void;\n updateSettings: (patch: Partial<TemplateSettings>) => void;\n removeBlock: (blockId: string) => void;\n}\n\nexport interface LintPatch {\n description: string;\n apply: (ctx: LintPatchContext) => void;\n}\n\nexport interface LintThresholds {\n altMaxLength: number;\n minFontSize: number;\n allCapsMinLength: number;\n minTouchTargetPx: number;\n}\n\n/**\n * Per-rule severity override. Set a rule to `'off'` to disable it.\n * Keys are the full prefixed rule IDs (`a11y.*`, `structure.*`, `link.*`)\n * so a value copied from `LintIssue.ruleId` pastes straight in.\n */\nexport type RuleOverrides = Record<string, Severity>;\n\n/** Options consumed only by the accessibility linter. */\nexport interface AccessibilityLintOptions {\n rules?: RuleOverrides;\n thresholds?: Partial<LintThresholds>;\n}\n\n/** Options consumed only by the structure linter. */\nexport interface StructureLintOptions {\n rules?: RuleOverrides;\n}\n\n/** Options consumed only by the links linter. */\nexport interface LinksLintOptions {\n rules?: RuleOverrides;\n /**\n * Host patterns that should flag as \"staging / non-production\".\n * Each entry is a glob-style pattern matched against the URL host.\n * `*` matches any run of characters (including `.`), so `*.staging.*`\n * matches `app.staging.example.com`.\n *\n * Default: ['localhost', '127.0.0.1', '0.0.0.0', '*.local',\n * '*.staging.*', '*.dev.*']\n */\n nonProductionHosts?: string[];\n}\n\nexport interface LintOptions {\n /**\n * Fully disable linting. When true, the editor skips lazy-loading the\n * package, hides the sidebar tab, and suppresses inline badges.\n */\n disabled?: boolean;\n /** Locale for vague-text dictionaries and message text. Falls back to `en`. */\n locale?: string;\n /**\n * Accessibility linter config. Set to `false` to disable the whole\n * `lintAccessibility` linter without enumerating its rules.\n */\n accessibility?: false | AccessibilityLintOptions;\n /**\n * Structure linter config. Set to `false` to disable the whole\n * `lintStructure` linter without enumerating its rules.\n */\n structure?: false | StructureLintOptions;\n /**\n * Links linter config. Set to `false` to disable the whole `lintLinks`\n * linter without enumerating its rules.\n */\n links?: false | LinksLintOptions;\n}\n\nexport interface ResolvedLinksOptions {\n nonProductionHosts: string[];\n}\n\nexport interface ResolvedOptions {\n locale: string;\n rules: RuleOverrides;\n thresholds: LintThresholds;\n links: ResolvedLinksOptions;\n /** Returns the effective severity for a rule (override or default). */\n severity: (ruleId: string) => Severity;\n}\n\nexport interface WalkContext {\n parent: Block | null;\n section: SectionBlock | null;\n columnIndex: number | null;\n depth: number;\n /**\n * Nearest opaque ancestor background, or template settings background.\n * Hex string, lowercased.\n */\n resolvedBackgroundColor: string;\n}\n\nexport interface RuleMeta {\n /** Stable identifier — used for severity overrides and message lookup. */\n id: string;\n /** Default severity when no override is supplied. */\n severity: Exclude<Severity, \"off\">;\n}\n\n/**\n * What a rule emits per match. The orchestrator combines this with the\n * rule's `meta` (for `ruleId` + default severity) and resolves the\n * localized message via the active locale's message map.\n */\nexport interface RuleHit {\n blockId: string | null;\n /** Interpolation values for the rule's localized message template. */\n params?: Record<string, string | number>;\n fix?: LintPatch;\n}\n\nexport interface Rule {\n meta: RuleMeta;\n /** Block-level rule. Returns a hit or null. */\n block?: (\n block: Block,\n ctx: WalkContext,\n opts: ResolvedOptions,\n ) => RuleHit | null;\n /** Template-level rule. Runs once after the walk. */\n template?: (content: TemplateContent, opts: ResolvedOptions) => RuleHit[];\n}\n\nexport const DEFAULT_A11Y_THRESHOLDS: LintThresholds = {\n altMaxLength: 125,\n minFontSize: 14,\n allCapsMinLength: 20,\n minTouchTargetPx: 44,\n};\n\nexport const DEFAULT_NON_PRODUCTION_HOSTS: string[] = [\n \"localhost\",\n \"127.0.0.1\",\n \"0.0.0.0\",\n \"*.local\",\n \"*.staging.*\",\n \"*.dev.*\",\n];\n","/**\n * WCAG 2.1 sRGB relative-luminance contrast.\n *\n * Inputs are hex strings (`#rgb`, `#rrggbb`, optional leading `#`).\n * Returns the contrast ratio (1–21) per WCAG, or `NaN` if either input\n * cannot be parsed as an opaque solid hex color.\n *\n * The codebase uses OKLch for design tokens, but contrast math is\n * sRGB-defined; mixing the two gives incorrect results.\n */\nexport function getContrastRatio(fg: string, bg: string): number {\n const fgRgb = parseHex(fg);\n const bgRgb = parseHex(bg);\n\n if (!fgRgb || !bgRgb) {\n return Number.NaN;\n }\n\n const l1 = relativeLuminance(fgRgb);\n const l2 = relativeLuminance(bgRgb);\n const lighter = Math.max(l1, l2);\n const darker = Math.min(l1, l2);\n\n return (lighter + 0.05) / (darker + 0.05);\n}\n\nexport interface Rgb {\n r: number;\n g: number;\n b: number;\n}\n\nconst HEX3 = /^#?([0-9a-f])([0-9a-f])([0-9a-f])$/i;\nconst HEX6 = /^#?([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/i;\nconst HEX8 = /^#?([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/i;\n\nexport function parseHex(input: string | undefined | null): Rgb | null {\n if (typeof input !== \"string\") {\n return null;\n }\n\n const trimmed = input.trim();\n\n const match8 = HEX8.exec(trimmed);\n if (match8) {\n // Only treat fully-opaque (alpha = ff) as a valid RGB color; partial\n // alpha can't be flattened without knowing the underlay.\n if (match8[4].toLowerCase() !== \"ff\") return null;\n return {\n r: parseInt(match8[1], 16),\n g: parseInt(match8[2], 16),\n b: parseInt(match8[3], 16),\n };\n }\n\n const match6 = HEX6.exec(trimmed);\n if (match6) {\n return {\n r: parseInt(match6[1], 16),\n g: parseInt(match6[2], 16),\n b: parseInt(match6[3], 16),\n };\n }\n\n const match3 = HEX3.exec(trimmed);\n if (match3) {\n return {\n r: parseInt(match3[1] + match3[1], 16),\n g: parseInt(match3[2] + match3[2], 16),\n b: parseInt(match3[3] + match3[3], 16),\n };\n }\n\n return null;\n}\n\nexport function isOpaqueHex(input: string | undefined | null): boolean {\n return parseHex(input ?? \"\") !== null;\n}\n\nfunction relativeLuminance({ r, g, b }: Rgb): number {\n const rs = channel(r / 255);\n const gs = channel(g / 255);\n const bs = channel(b / 255);\n return 0.2126 * rs + 0.7152 * gs + 0.0722 * bs;\n}\n\nfunction channel(c: number): number {\n return c <= 0.03928 ? c / 12.92 : Math.pow((c + 0.055) / 1.055, 2.4);\n}\n","import type { Block, TemplateContent } from \"@templatical/types\";\nimport { isSection } from \"@templatical/types\";\nimport type { WalkContext } from \"./types\";\nimport { isOpaqueHex } from \"./contrast\";\n\nexport type Visitor = (block: Block, ctx: WalkContext) => void;\n\nconst DEFAULT_BG = \"#ffffff\";\n\n/**\n * Pure traversal of the block tree. Calls `visit` once per block in\n * document order, providing a `WalkContext` that includes the resolved\n * background color (nearest opaque ancestor) and structural refs.\n *\n * Sections cannot nest (renderer enforces this), so the walker doesn't\n * descend into a section that lives inside a column. Custom blocks are\n * visited but not descended into.\n */\nexport function walkBlocks(content: TemplateContent, visit: Visitor): void {\n const rootBg = isOpaqueHex(content.settings.backgroundColor)\n ? content.settings.backgroundColor.toLowerCase()\n : DEFAULT_BG;\n\n const walk = (block: Block, ctx: WalkContext): void => {\n // A block's own opaque backgroundColor is what's behind its content —\n // visit it with that resolved bg so contrast rules compare against the\n // right surface. Falls back to the inherited section/template bg.\n const ownBg = block.styles?.backgroundColor;\n const effectiveBg = isOpaqueHex(ownBg)\n ? (ownBg as string).toLowerCase()\n : ctx.resolvedBackgroundColor;\n const blockCtx: WalkContext =\n effectiveBg === ctx.resolvedBackgroundColor\n ? ctx\n : { ...ctx, resolvedBackgroundColor: effectiveBg };\n\n visit(block, blockCtx);\n\n if (!isSection(block)) {\n return;\n }\n\n block.children.forEach((column, columnIndex) => {\n column.forEach((child) =>\n walk(child, {\n parent: block,\n section: block,\n columnIndex,\n depth: ctx.depth + 1,\n resolvedBackgroundColor: effectiveBg,\n }),\n );\n });\n };\n\n for (const block of content.blocks) {\n walk(block, {\n parent: null,\n section: null,\n columnIndex: null,\n depth: 0,\n resolvedBackgroundColor: rootBg,\n });\n }\n}\n","import type { TemplateContent } from \"@templatical/types\";\nimport type {\n AccessibilityLintOptions,\n LinksLintOptions,\n LintIssue,\n ResolvedOptions,\n Rule,\n RuleHit,\n RuleOverrides,\n Severity,\n StructureLintOptions,\n} from \"./types\";\nimport { DEFAULT_A11Y_THRESHOLDS, DEFAULT_NON_PRODUCTION_HOSTS } from \"./types\";\nimport { walkBlocks } from \"./walk\";\n\nexport type MessageFormatter = (\n locale: string,\n ruleId: string,\n params?: Record<string, string | number>,\n) => string;\n\n/**\n * Walk the tree once, dispatch every block-level rule, then run every\n * template-level rule. Each tool (lintAccessibility, lintStructure, …)\n * wraps this with its own rule list + message formatter and a pre-built\n * `ResolvedOptions` containing that tool's overrides and tool-scoped config.\n */\nexport function runRules(\n content: TemplateContent,\n rules: Rule[],\n opts: ResolvedOptions,\n formatMessage: MessageFormatter,\n): LintIssue[] {\n const issues: LintIssue[] = [];\n\n function buildIssue(\n ruleId: string,\n severity: Exclude<Severity, \"off\">,\n hit: RuleHit,\n ): LintIssue {\n return {\n blockId: hit.blockId,\n ruleId,\n severity,\n message: formatMessage(opts.locale, ruleId, hit.params),\n fix: hit.fix,\n };\n }\n\n walkBlocks(content, (block, ctx) => {\n for (const rule of rules) {\n const sev = opts.severity(rule.meta.id);\n if (sev === \"off\" || !rule.block) continue;\n const hit = rule.block(block, ctx, opts);\n if (hit !== null) {\n issues.push(buildIssue(rule.meta.id, sev, hit));\n }\n }\n });\n\n for (const rule of rules) {\n const sev = opts.severity(rule.meta.id);\n if (sev === \"off\" || !rule.template) continue;\n const hits = rule.template(content, opts);\n for (const hit of hits) {\n issues.push(buildIssue(rule.meta.id, sev, hit));\n }\n }\n\n return issues;\n}\n\n/**\n * Build a `ResolvedOptions` for a given tool. Each tool wrapper passes its\n * own per-tool bag; fields not relevant to the tool fall back to defaults\n * (e.g. `lintStructure` still gets `thresholds` populated, but no structure\n * rule reads them).\n */\nexport function resolveOptions(args: {\n locale: string | undefined;\n rules: Rule[];\n overrides: RuleOverrides | undefined;\n thresholds: Partial<import(\"./types\").LintThresholds> | undefined;\n nonProductionHosts: string[] | undefined;\n}): ResolvedOptions {\n const overrides = args.overrides ?? {};\n const thresholds = {\n ...DEFAULT_A11Y_THRESHOLDS,\n ...(args.thresholds ?? {}),\n };\n const links = {\n nonProductionHosts: args.nonProductionHosts ?? DEFAULT_NON_PRODUCTION_HOSTS,\n };\n const locale = args.locale ?? \"en\";\n const rules = args.rules;\n\n return {\n locale,\n rules: overrides,\n thresholds,\n links,\n severity: (ruleId: string): Severity => {\n const override = overrides[ruleId];\n if (override !== undefined) {\n return override;\n }\n const rule = rules.find((r) => r.meta.id === ruleId);\n return rule?.meta.severity ?? \"warning\";\n },\n };\n}\n\n/**\n * Resolver for the accessibility linter — reads `options.accessibility`.\n */\nexport function resolveAccessibilityOptions(\n locale: string | undefined,\n tool: AccessibilityLintOptions,\n rules: Rule[],\n): ResolvedOptions {\n return resolveOptions({\n locale,\n rules,\n overrides: tool.rules,\n thresholds: tool.thresholds,\n nonProductionHosts: undefined,\n });\n}\n\n/**\n * Resolver for the structure linter — reads `options.structure`.\n */\nexport function resolveStructureOptions(\n locale: string | undefined,\n tool: StructureLintOptions,\n rules: Rule[],\n): ResolvedOptions {\n return resolveOptions({\n locale,\n rules,\n overrides: tool.rules,\n thresholds: undefined,\n nonProductionHosts: undefined,\n });\n}\n\n/**\n * Resolver for the links linter — reads `options.links`.\n */\nexport function resolveLinksOptions(\n locale: string | undefined,\n tool: LinksLintOptions,\n rules: Rule[],\n): ResolvedOptions {\n return resolveOptions({\n locale,\n rules,\n overrides: tool.rules,\n thresholds: undefined,\n nonProductionHosts: tool.nonProductionHosts,\n });\n}\n","import type en from \"./en\";\n\nconst de: typeof en = {\n \"a11y.img-missing-alt\":\n \"Bild ohne Alt-Text. Füge eine kurze Beschreibung hinzu oder markiere das Bild als dekorativ.\",\n \"a11y.img-alt-is-filename\":\n 'Alt-Text sieht wie ein Dateiname aus (\"{alt}\"). Beschreibe stattdessen kurz, was das Bild zeigt.',\n \"a11y.img-alt-too-long\":\n \"Alt-Text ist {length} Zeichen lang; bleibe unter {max}.\",\n \"a11y.img-decorative-needs-empty-alt\":\n \"Dekoratives Bild hat Alt-Text. Entferne den Alt-Text oder hebe die Markierung als dekorativ auf.\",\n \"a11y.img-linked-no-context\":\n \"Verlinktes Bild beschreibt nur das Motiv, nicht das Linkziel. Nenne das Ziel (z. B. „Frühlingssale ansehen“).\",\n \"a11y.heading-empty\":\n \"Überschrift ist leer. Füge Text hinzu oder entferne den Block.\",\n \"a11y.heading-skip-level\":\n \"Überschrift springt von H{from} auf H{to}. Eine Ebene pro Schritt.\",\n \"a11y.heading-multiple-h1\":\n \"E-Mail enthält mehr als eine H1. Verwende H1 nur einmal für die Hauptüberschrift.\",\n \"a11y.link-empty\":\n \"Ein Link in diesem Block hat keinen Text und kein beschriebenes Bild.\",\n \"a11y.link-vague-text\":\n \"Link-Text „{text}“ ist unspezifisch. Beschreibe stattdessen das Ziel.\",\n \"a11y.link-href-empty\":\n \"Ein Link in diesem Block hat ein leeres oder „#“-href.\",\n \"a11y.link-target-blank-no-rel\":\n 'Link öffnet in neuem Tab, aber rel=\"noopener\" fehlt – ergänze es, damit das Ziel nicht auf window.opener zugreifen kann.',\n \"a11y.text-all-caps\":\n \"Längere Texte in Großbuchstaben sind schwerer lesbar. Verwende Groß- und Kleinschreibung.\",\n \"a11y.text-low-contrast\":\n \"Überschriftskontrast beträgt {ratio}:1; WCAG AA verlangt mindestens {required}:1.\",\n \"a11y.text-too-small\": \"Text ist {size}px; mindestens {min}px verwenden.\",\n \"a11y.button-vague-label\":\n \"Button-Beschriftung „{text}“ ist unspezifisch. Beschreibe die Aktion.\",\n \"a11y.button-touch-target\":\n \"Button ist etwa {height}px hoch; mindestens {min}px verwenden, um Fehltipper auf Mobilgeräten zu vermeiden.\",\n \"a11y.button-low-contrast\":\n \"Buttontextkontrast beträgt {ratio}:1; WCAG AA verlangt mindestens {required}:1.\",\n \"a11y.missing-preheader\":\n \"Kein Preheader-Text gesetzt. Postfächer zeigen sonst Bruchstücke des ersten Blocks an.\",\n};\n\nexport default de;\n","/**\n * English rule messages. The source of truth — other locales annotate\n * themselves `typeof en` so missing or extra keys fail typecheck.\n *\n * Templates use `{name}` placeholders, interpolated by `formatMessage`.\n */\nconst en = {\n \"a11y.img-missing-alt\":\n \"Image is missing alt text. Add a short description, or mark the image as decorative.\",\n \"a11y.img-alt-is-filename\":\n 'Alt text looks like a filename (\"{alt}\"). Replace with a short description of what the image conveys.',\n \"a11y.img-alt-too-long\":\n \"Alt text is {length} characters; aim for under {max}.\",\n \"a11y.img-decorative-needs-empty-alt\":\n \"Decorative image has alt text. Either clear the alt text or unmark the image as decorative.\",\n \"a11y.img-linked-no-context\":\n \"Linked image alt describes the image but not the link destination. Include where the link goes (e.g. 'Buy spring sale').\",\n \"a11y.heading-empty\": \"Heading is empty. Add text or remove the block.\",\n \"a11y.heading-skip-level\":\n \"Heading jumps from H{from} to H{to}. Step one level at a time.\",\n \"a11y.heading-multiple-h1\":\n \"Email has more than one H1. Use H1 once for the main heading.\",\n \"a11y.link-empty\": \"A link in this block has no text and no described image.\",\n \"a11y.link-vague-text\":\n 'Link text \"{text}\" is vague. Describe the destination instead.',\n \"a11y.link-href-empty\": \"A link in this block has an empty or '#' href.\",\n \"a11y.link-target-blank-no-rel\":\n 'Link opens in a new tab but is missing rel=\"noopener\" — add it to prevent the destination from accessing window.opener.',\n \"a11y.text-all-caps\":\n \"Long all-caps text is harder to read for everyone. Use sentence case.\",\n \"a11y.text-low-contrast\":\n \"Heading contrast is {ratio}:1; WCAG AA requires at least {required}:1.\",\n \"a11y.text-too-small\": \"Text is {size}px; aim for at least {min}px.\",\n \"a11y.button-vague-label\":\n 'Button label \"{text}\" is vague. Describe the action.',\n \"a11y.button-touch-target\":\n \"Button is roughly {height}px tall; aim for at least {min}px to avoid mis-taps on mobile.\",\n \"a11y.button-low-contrast\":\n \"Button text contrast is {ratio}:1; WCAG AA requires at least {required}:1.\",\n \"a11y.missing-preheader\":\n \"No preheader text set. Inboxes will fall back to fragments of the first block.\",\n};\n\nexport default en;\n","import en from \"./en\";\n\nexport type MessageMap = typeof en;\nexport type RuleMessageId = keyof MessageMap;\n\n/**\n * Auto-discovered locale registry. Drop a `messages/<lang>.ts` file and\n * it's bundled automatically — same pattern as the editor's i18n.\n *\n * Eager glob: synchronous, all locales bundled into the package. Tiny\n * (a few hundred bytes per locale) so the cost is negligible compared\n * to the lazy-loading overhead.\n */\nconst modules = import.meta.glob<{ default: MessageMap }>(\"./*.ts\", {\n eager: true,\n});\n\nconst MESSAGES: Record<string, MessageMap> = {};\nfor (const path in modules) {\n const match = /\\.\\/([^/]+)\\.ts$/.exec(path);\n if (!match) continue;\n const locale = match[1];\n if (locale === \"index\") continue;\n MESSAGES[locale] = modules[path].default;\n}\n\nexport const SUPPORTED_MESSAGE_LOCALES = Object.keys(MESSAGES);\n\nexport function getMessages(locale: string): MessageMap {\n const base = locale.split(\"-\")[0]?.toLowerCase() ?? \"en\";\n return MESSAGES[base] ?? MESSAGES.en ?? en;\n}\n\n/**\n * Resolve a localized message for a rule. `params` interpolate `{name}`\n * placeholders. Falls back to English when the locale doesn't ship the\n * key (shouldn't happen — the parity test enforces it).\n */\nexport function formatMessage(\n locale: string,\n ruleId: RuleMessageId,\n params?: Record<string, string | number>,\n): string {\n const map = getMessages(locale);\n const template = map[ruleId] ?? en[ruleId];\n if (!params) return template;\n return template.replace(/\\{(\\w+)\\}/g, (_, key: string) => {\n const value = params[key];\n return value === undefined ? `{${key}}` : String(value);\n });\n}\n","import { isImage } from \"@templatical/types\";\nimport type { Rule, RuleMeta } from \"../../types\";\n\nexport const meta: RuleMeta = {\n id: \"a11y.img-missing-alt\",\n severity: \"error\",\n};\n\nexport const imgMissingAlt: Rule = {\n meta,\n block(block) {\n if (!isImage(block)) return null;\n if (block.decorative === true) return null;\n const alt = block.alt?.trim() ?? \"\";\n if (alt !== \"\") return null;\n if ((block.src ?? \"\").trim() === \"\") return null;\n return { blockId: block.id };\n },\n};\n","import { isImage } from \"@templatical/types\";\nimport type { Rule, RuleMeta } from \"../../types\";\n\nexport const meta: RuleMeta = {\n id: \"a11y.img-alt-is-filename\",\n severity: \"warning\",\n};\n\nconst FILENAME_PATTERNS: RegExp[] = [\n /\\.(jpe?g|png|gif|webp|svg)$/i,\n /^IMG[_-]?\\d+/i,\n /^Untitled/i,\n /^Screen[\\s_-]?Shot/i,\n /^DSC[_-]?\\d+/i,\n];\n\nexport const imgAltIsFilename: Rule = {\n meta,\n block(block) {\n if (!isImage(block) || block.decorative === true) return null;\n const alt = block.alt?.trim() ?? \"\";\n if (alt === \"\") return null;\n if (!FILENAME_PATTERNS.some((re) => re.test(alt))) return null;\n\n return {\n blockId: block.id,\n params: { alt },\n };\n },\n};\n","import { isImage } from \"@templatical/types\";\nimport type { Rule, RuleMeta } from \"../../types\";\n\nexport const meta: RuleMeta = {\n id: \"a11y.img-alt-too-long\",\n severity: \"warning\",\n};\n\nexport const imgAltTooLong: Rule = {\n meta,\n block(block, _ctx, opts) {\n if (!isImage(block) || block.decorative === true) return null;\n const alt = block.alt ?? \"\";\n if (alt.length <= opts.thresholds.altMaxLength) return null;\n return {\n blockId: block.id,\n params: { length: alt.length, max: opts.thresholds.altMaxLength },\n };\n },\n};\n","import { isImage } from \"@templatical/types\";\nimport type { Rule, RuleMeta } from \"../../types\";\n\nexport const meta: RuleMeta = {\n id: \"a11y.img-decorative-needs-empty-alt\",\n severity: \"info\",\n};\n\nexport const imgDecorativeNeedsEmptyAlt: Rule = {\n meta,\n block(block) {\n if (!isImage(block)) return null;\n if (block.decorative !== true) return null;\n if ((block.alt ?? \"\").trim() === \"\") return null;\n return {\n blockId: block.id,\n fix: {\n description: \"Clear alt text\",\n apply: (ctx) => ctx.updateBlock(block.id, { alt: \"\" }),\n },\n };\n },\n};\n","import type en from \"./en\";\n\nconst de: typeof en = {\n vagueLinkText: [\n \"hier klicken\",\n \"hier\",\n \"mehr lesen\",\n \"mehr\",\n \"weiter\",\n \"weiterlesen\",\n \"siehe mehr\",\n \"dies\",\n \"dieser link\",\n \"link\",\n \"klick\",\n ],\n vagueButtonLabels: [\n \"hier klicken\",\n \"klicken\",\n \"senden\",\n \"los\",\n \"ok\",\n \"okay\",\n \"ja\",\n \"nein\",\n ],\n linkedImageActionHints: [\n \"kaufen\",\n \"shoppen\",\n \"ansehen\",\n \"lesen\",\n \"lernen\",\n \"öffnen\",\n \"los\",\n \"sehen\",\n \"entdecken\",\n \"erkunden\",\n \"stöbern\",\n \"herunterladen\",\n \"holen\",\n \"abholen\",\n \"einlösen\",\n \"anschauen\",\n \"jetzt\",\n ],\n};\n\nexport default de;\n","/**\n * English vague-text dictionaries. Treated as the source of truth — other\n * locales annotate themselves `typeof en` so missing/extra phrases fail\n * typecheck.\n *\n * Phrases are matched case-insensitively against trimmed text content.\n */\nconst en = {\n vagueLinkText: [\n \"click here\",\n \"here\",\n \"read more\",\n \"more\",\n \"learn more\",\n \"see more\",\n \"this\",\n \"this link\",\n \"link\",\n \"click\",\n ],\n vagueButtonLabels: [\n \"click here\",\n \"click\",\n \"submit\",\n \"go\",\n \"ok\",\n \"okay\",\n \"yes\",\n \"no\",\n ],\n /**\n * Action verbs that signal a linked image's alt describes the link\n * destination, not just the visual subject. Used by `img-linked-no-context`.\n * Stored lowercase; tokenized matching is case-insensitive.\n */\n linkedImageActionHints: [\n \"buy\",\n \"shop\",\n \"view\",\n \"read\",\n \"learn\",\n \"open\",\n \"go\",\n \"see\",\n \"explore\",\n \"discover\",\n \"browse\",\n \"download\",\n \"get\",\n \"claim\",\n \"redeem\",\n \"watch\",\n ],\n};\n\nexport default en;\n","import en from \"./en\";\n\nexport type Dictionary = typeof en;\n\n/**\n * Auto-discovered locale registry. Drop a `dictionaries/<lang>.ts` file\n * and it's bundled automatically — same pattern as the editor's i18n\n * and the sibling `messages/` registry.\n *\n * Eager glob: synchronous, all locales bundled into the package. Tiny\n * (a few hundred bytes per locale) so the cost is negligible.\n */\nconst modules = import.meta.glob<{ default: Dictionary }>(\"./*.ts\", {\n eager: true,\n});\n\nconst DICTIONARIES: Record<string, Dictionary> = {};\nfor (const path in modules) {\n const match = /\\.\\/([^/]+)\\.ts$/.exec(path);\n if (!match) continue;\n const locale = match[1];\n if (locale === \"index\") continue;\n DICTIONARIES[locale] = modules[path].default;\n}\n\n/**\n * Returns a dictionary that unions every registered locale. Vague phrases\n * are universally vague — a German-locale email with an English \"Click here\"\n * CTA, or an English email with a French \"cliquez ici\", is still a vague\n * CTA, so the rule must detect across languages regardless of editor locale.\n *\n * The `locale` argument is accepted for API symmetry and future use (e.g.\n * weighted matching) but currently doesn't change the returned set.\n */\nexport function getDictionary(_locale: string): Dictionary {\n return UNIONED_DICTIONARY;\n}\n\nfunction unionAll(pick: (d: Dictionary) => readonly string[]): string[] {\n const set = new Set<string>();\n for (const dict of Object.values(DICTIONARIES)) {\n for (const phrase of pick(dict)) set.add(phrase);\n }\n return Array.from(set);\n}\n\nconst UNIONED_DICTIONARY: Dictionary = {\n vagueLinkText: unionAll((d) => d.vagueLinkText),\n vagueButtonLabels: unionAll((d) => d.vagueButtonLabels),\n linkedImageActionHints: unionAll((d) => d.linkedImageActionHints),\n};\n\nexport const SUPPORTED_DICTIONARY_LOCALES = Object.keys(DICTIONARIES);\n\n/**\n * Normalize text for dictionary matching: lowercase, collapse whitespace,\n * strip leading/trailing non-alphanumeric characters (punctuation, arrows,\n * emoji, decorative symbols). \"Click here!\", \"→ click here\", \"click here?\"\n * all collapse to \"click here\" so the dictionary's plain phrase matches.\n */\nexport function normalizeForMatch(input: string): string {\n return input\n .toLowerCase()\n .replace(/\\s+/g, \" \")\n .replace(/^[^\\p{L}\\p{N}]+|[^\\p{L}\\p{N}]+$/gu, \"\")\n .trim();\n}\n","import { isImage } from \"@templatical/types\";\nimport type { Rule, RuleMeta } from \"../../types\";\nimport { getDictionary } from \"../dictionaries\";\n\nexport const meta: RuleMeta = {\n id: \"a11y.img-linked-no-context\",\n severity: \"warning\",\n};\n\nexport const imgLinkedNoContext: Rule = {\n meta,\n block(block, _ctx, opts) {\n if (!isImage(block) || block.decorative === true) return null;\n if (!block.linkUrl || block.linkUrl.trim() === \"\") return null;\n const alt = (block.alt ?? \"\").trim();\n if (alt === \"\") return null;\n const tokens = alt\n .toLocaleLowerCase()\n .split(/[^\\p{L}\\p{N}]+/u)\n .filter(Boolean);\n const hints = getDictionary(opts.locale).linkedImageActionHints;\n if (tokens.some((token) => hints.includes(token))) return null;\n return { blockId: block.id };\n },\n};\n","import { Parser } from \"htmlparser2\";\n\nexport interface AnchorInfo {\n href: string;\n text: string;\n target: string | null;\n rel: string | null;\n /** True if the anchor wraps an image with non-empty alt. */\n hasImageWithAlt: boolean;\n}\n\n/**\n * Extract every anchor from a TipTap-style HTML fragment. Used by\n * link-* rules. Doesn't try to be a full DOM — only the data the rules\n * need.\n */\nexport function extractAnchors(html: string): AnchorInfo[] {\n const anchors: AnchorInfo[] = [];\n // Each open anchor owns its own text buffer so a nested `<a>` (invalid\n // HTML but parsed permissively) doesn't truncate the outer anchor's text.\n const stack: { anchor: AnchorInfo; buffer: string }[] = [];\n\n const parser = new Parser({\n onopentag(name, attribs) {\n if (name === \"a\") {\n const anchor: AnchorInfo = {\n href: attribs.href ?? \"\",\n text: \"\",\n target: attribs.target ?? null,\n rel: attribs.rel ?? null,\n hasImageWithAlt: false,\n };\n stack.push({ anchor, buffer: \"\" });\n return;\n }\n\n if (name === \"img\" && stack.length > 0) {\n const alt = (attribs.alt ?? \"\").trim();\n if (alt !== \"\") {\n stack[stack.length - 1].anchor.hasImageWithAlt = true;\n }\n }\n },\n ontext(text) {\n for (const frame of stack) {\n frame.buffer += text;\n }\n },\n onclosetag(name) {\n if (name === \"a\" && stack.length > 0) {\n const frame = stack.pop()!;\n frame.anchor.text = frame.buffer.trim();\n anchors.push(frame.anchor);\n }\n },\n });\n\n parser.write(html);\n parser.end();\n\n return anchors;\n}\n\n/**\n * Strip tags and return the visible text content of an HTML fragment.\n * Used by heading-empty and other text-presence rules.\n */\nexport function extractText(html: string): string {\n let text = \"\";\n const parser = new Parser({\n ontext(chunk) {\n text += chunk;\n },\n });\n parser.write(html);\n parser.end();\n return text.trim();\n}\n","import { isTitle } from \"@templatical/types\";\nimport type { Rule, RuleMeta } from \"../../types\";\nimport { extractText } from \"../../html-utils\";\n\nexport const meta: RuleMeta = {\n id: \"a11y.heading-empty\",\n severity: \"error\",\n};\n\nexport const headingEmpty: Rule = {\n meta,\n block(block) {\n if (!isTitle(block)) return null;\n const text = extractText(block.content ?? \"\");\n if (text !== \"\") return null;\n return { blockId: block.id };\n },\n};\n","import { isTitle, isSection } from \"@templatical/types\";\nimport type { Block, TitleBlock, TemplateContent } from \"@templatical/types\";\nimport type { Rule, RuleHit, RuleMeta } from \"../../types\";\n\nexport const meta: RuleMeta = {\n id: \"a11y.heading-skip-level\",\n severity: \"error\",\n};\n\nfunction collectTitles(blocks: Block[], out: TitleBlock[]): void {\n for (const block of blocks) {\n if (isTitle(block)) {\n out.push(block);\n continue;\n }\n if (isSection(block)) {\n for (const column of block.children) {\n collectTitles(column, out);\n }\n }\n }\n}\n\nexport const headingSkipLevel: Rule = {\n meta,\n template(content: TemplateContent) {\n const titles: TitleBlock[] = [];\n collectTitles(content.blocks, titles);\n\n const hits: RuleHit[] = [];\n let lastLevel = 0;\n\n for (const title of titles) {\n if (lastLevel !== 0 && title.level > lastLevel + 1) {\n hits.push({\n blockId: title.id,\n params: { from: lastLevel, to: title.level },\n });\n }\n lastLevel = title.level;\n }\n\n return hits;\n },\n};\n","import { isTitle, isSection } from \"@templatical/types\";\nimport type { Block, TitleBlock, TemplateContent } from \"@templatical/types\";\nimport type { Rule, RuleMeta } from \"../../types\";\n\nexport const meta: RuleMeta = {\n id: \"a11y.heading-multiple-h1\",\n severity: \"warning\",\n};\n\nfunction collectTitles(blocks: Block[], out: TitleBlock[]): void {\n for (const block of blocks) {\n if (isTitle(block)) {\n out.push(block);\n continue;\n }\n if (isSection(block)) {\n for (const column of block.children) {\n collectTitles(column, out);\n }\n }\n }\n}\n\nexport const headingMultipleH1: Rule = {\n meta,\n template(content: TemplateContent) {\n const titles: TitleBlock[] = [];\n collectTitles(content.blocks, titles);\n const h1s = titles.filter((t) => t.level === 1);\n if (h1s.length <= 1) return [];\n return h1s.slice(1).map((title) => ({ blockId: title.id }));\n },\n};\n","import { isParagraph, isTitle } from \"@templatical/types\";\nimport type { Block } from \"@templatical/types\";\nimport type { Rule, RuleMeta } from \"../../types\";\nimport { extractAnchors } from \"../../html-utils\";\n\nexport const meta: RuleMeta = {\n id: \"a11y.link-empty\",\n severity: \"error\",\n};\n\nfunction getHtml(block: Block): string | null {\n if (isParagraph(block) || isTitle(block)) return block.content;\n return null;\n}\n\nexport const linkEmpty: Rule = {\n meta,\n block(block) {\n const html = getHtml(block);\n if (html === null) return null;\n\n const anchors = extractAnchors(html);\n const offender = anchors.find(\n (anchor) => anchor.text === \"\" && !anchor.hasImageWithAlt,\n );\n if (!offender) return null;\n\n return { blockId: block.id };\n },\n};\n","import { isParagraph, isTitle } from \"@templatical/types\";\nimport type { Block } from \"@templatical/types\";\nimport type { Rule, RuleMeta } from \"../../types\";\nimport { extractAnchors } from \"../../html-utils\";\nimport { getDictionary, normalizeForMatch } from \"../dictionaries\";\n\nexport const meta: RuleMeta = {\n id: \"a11y.link-vague-text\",\n severity: \"warning\",\n};\n\nfunction getHtml(block: Block): string | null {\n if (isParagraph(block) || isTitle(block)) return block.content;\n return null;\n}\n\nexport const linkVagueText: Rule = {\n meta,\n block(block, _ctx, opts) {\n const html = getHtml(block);\n if (html === null) return null;\n\n const phrases = getDictionary(opts.locale).vagueLinkText;\n const anchors = extractAnchors(html);\n const offender = anchors.find((a) => {\n const text = normalizeForMatch(a.text);\n return text !== \"\" && phrases.includes(text);\n });\n if (!offender) return null;\n\n return { blockId: block.id, params: { text: offender.text } };\n },\n};\n","import { isParagraph, isTitle } from \"@templatical/types\";\nimport type { Block } from \"@templatical/types\";\nimport type { Rule, RuleMeta } from \"../../types\";\nimport { extractAnchors } from \"../../html-utils\";\n\nexport const meta: RuleMeta = {\n id: \"a11y.link-href-empty\",\n severity: \"error\",\n};\n\nfunction getHtml(block: Block): string | null {\n if (isParagraph(block) || isTitle(block)) return block.content;\n return null;\n}\n\nexport const linkHrefEmpty: Rule = {\n meta,\n block(block) {\n const html = getHtml(block);\n if (html === null) return null;\n const anchors = extractAnchors(html);\n const offender = anchors.find((a) => {\n const href = a.href.trim();\n return href === \"\" || href === \"#\";\n });\n if (!offender) return null;\n return { blockId: block.id };\n },\n};\n","import { isParagraph, isTitle } from \"@templatical/types\";\nimport type { Block } from \"@templatical/types\";\nimport type { Rule, RuleMeta } from \"../../types\";\nimport { extractAnchors } from \"../../html-utils\";\n\nexport const meta: RuleMeta = {\n id: \"a11y.link-target-blank-no-rel\",\n severity: \"warning\",\n};\n\nfunction getHtml(block: Block): string | null {\n if (isParagraph(block) || isTitle(block)) return block.content;\n return null;\n}\n\nfunction hasSafeRel(rel: string | null): boolean {\n if (rel === null) return false;\n const tokens = rel.toLowerCase().split(/\\s+/);\n return tokens.includes(\"noopener\") || tokens.includes(\"noreferrer\");\n}\n\nexport const linkTargetBlankNoRel: Rule = {\n meta,\n block(block) {\n const html = getHtml(block);\n if (html === null) return null;\n const anchors = extractAnchors(html);\n const offender = anchors.find(\n (a) => a.target === \"_blank\" && !hasSafeRel(a.rel),\n );\n if (!offender) return null;\n\n return {\n blockId: block.id,\n fix: {\n description: 'Add rel=\"noopener\"',\n apply: (ctx) => {\n if (!isParagraph(block) && !isTitle(block)) return;\n const updated = addNoopenerToTargetBlank(block.content ?? \"\");\n ctx.updateBlock(block.id, { content: updated } as Partial<Block>);\n },\n },\n };\n },\n};\n\ninterface ParsedAttr {\n raw: string;\n name: string;\n value: string | null;\n /** Start offset of `raw` within the parent attrs string. */\n start: number;\n}\n\nconst ATTR_RE =\n /([^\\s\"'>/=]+)(?:\\s*=\\s*(?:\"([^\"]*)\"|'([^']*)'|([^\\s\"'=<>`]+)))?/g;\n\nfunction parseAttrs(attrs: string): ParsedAttr[] {\n const parsed: ParsedAttr[] = [];\n const re = new RegExp(ATTR_RE.source, ATTR_RE.flags);\n let match: RegExpExecArray | null;\n while ((match = re.exec(attrs)) !== null) {\n const value = match[2] ?? match[3] ?? match[4] ?? null;\n parsed.push({\n raw: match[0],\n name: match[1],\n value,\n start: match.index,\n });\n }\n return parsed;\n}\n\nfunction hasUnsafeTargetBlank(parsed: ParsedAttr[]): boolean {\n return parsed.some(\n (a) =>\n a.name.toLowerCase() === \"target\" &&\n a.value !== null &&\n a.value.toLowerCase() === \"_blank\",\n );\n}\n\nfunction addNoopenerToTargetBlank(html: string): string {\n return html.replace(/<a\\b([^>]*)>/gi, (match, attrs: string) => {\n const parsed = parseAttrs(attrs);\n if (!hasUnsafeTargetBlank(parsed)) return match;\n\n const relAttr = parsed.find((a) => a.name.toLowerCase() === \"rel\");\n if (relAttr) {\n const tokens = (relAttr.value ?? \"\").toLowerCase().split(/\\s+/);\n if (tokens.includes(\"noopener\") || tokens.includes(\"noreferrer\")) {\n return match;\n }\n const newRel = `${relAttr.value ?? \"\"} noopener`.trim();\n const before = attrs.slice(0, relAttr.start);\n const after = attrs.slice(relAttr.start + relAttr.raw.length);\n return `<a${before}rel=\"${newRel}\"${after}>`;\n }\n return `<a${attrs} rel=\"noopener\">`;\n });\n}\n","import { isParagraph, isTitle } from \"@templatical/types\";\nimport type { Rule, RuleMeta } from \"../../types\";\nimport { extractText } from \"../../html-utils\";\n\nexport const meta: RuleMeta = {\n id: \"a11y.text-all-caps\",\n severity: \"warning\",\n};\n\nexport const textAllCaps: Rule = {\n meta,\n block(block, _ctx, opts) {\n if (!isParagraph(block) && !isTitle(block)) return null;\n const text = extractText(block.content ?? \"\");\n const letters = text.replace(/[^\\p{L}]/gu, \"\");\n if (letters.length < opts.thresholds.allCapsMinLength) return null;\n if (letters !== letters.toLocaleUpperCase()) return null;\n return { blockId: block.id };\n },\n};\n","import { isTitle } from \"@templatical/types\";\nimport type { Rule, RuleMeta } from \"../../types\";\nimport { getContrastRatio, isOpaqueHex } from \"../../contrast\";\nimport { HEADING_LEVEL_FONT_SIZE } from \"@templatical/types\";\n\nexport const meta: RuleMeta = {\n id: \"a11y.text-low-contrast\",\n severity: \"error\",\n};\n\nexport const textLowContrast: Rule = {\n meta,\n block(block, ctx) {\n if (!isTitle(block)) return null;\n if (\n !isOpaqueHex(block.color) ||\n !isOpaqueHex(ctx.resolvedBackgroundColor)\n ) {\n return null;\n }\n const fontSize = HEADING_LEVEL_FONT_SIZE[block.level];\n // WCAG large text = 18pt (~24px). Headings have no structured bold\n // flag in this codebase (TipTap stores it inline), so we conservatively\n // skip the 14pt-bold (~18.66px) relaxation and apply the px threshold.\n const required = fontSize >= 24 ? 3 : 4.5;\n const ratio = getContrastRatio(block.color, ctx.resolvedBackgroundColor);\n if (Number.isNaN(ratio) || ratio >= required) return null;\n return {\n blockId: block.id,\n params: { ratio: ratio.toFixed(2), required },\n };\n },\n};\n","import { isMenu, isTable } from \"@templatical/types\";\nimport type { Block } from \"@templatical/types\";\nimport type { Rule, RuleMeta } from \"../../types\";\n\nexport const meta: RuleMeta = {\n id: \"a11y.text-too-small\",\n severity: \"warning\",\n};\n\nfunction getFontSize(block: Block): number | null {\n if (isMenu(block) || isTable(block)) return block.fontSize;\n return null;\n}\n\nexport const textTooSmall: Rule = {\n meta,\n block(block, _ctx, opts) {\n const fontSize = getFontSize(block);\n if (fontSize === null) return null;\n if (fontSize >= opts.thresholds.minFontSize) return null;\n return {\n blockId: block.id,\n params: { size: fontSize, min: opts.thresholds.minFontSize },\n };\n },\n};\n","import { isButton } from \"@templatical/types\";\nimport type { Rule, RuleMeta } from \"../../types\";\nimport { getDictionary, normalizeForMatch } from \"../dictionaries\";\n\nexport const meta: RuleMeta = {\n id: \"a11y.button-vague-label\",\n severity: \"warning\",\n};\n\nexport const buttonVagueLabel: Rule = {\n meta,\n block(block, _ctx, opts) {\n if (!isButton(block)) return null;\n const text = normalizeForMatch(block.text ?? \"\");\n if (text === \"\") return null;\n const phrases = getDictionary(opts.locale).vagueButtonLabels;\n if (!phrases.includes(text)) return null;\n return { blockId: block.id, params: { text: block.text } };\n },\n};\n","import { isButton } from \"@templatical/types\";\nimport type { Rule, RuleMeta } from \"../../types\";\n\nexport const meta: RuleMeta = {\n id: \"a11y.button-touch-target\",\n severity: \"warning\",\n};\n\nexport const buttonTouchTarget: Rule = {\n meta,\n block(block, _ctx, opts) {\n if (!isButton(block)) return null;\n const padding = block.buttonPadding;\n if (!padding) return null;\n const estimatedHeight = block.fontSize * 1.4 + padding.top + padding.bottom;\n if (estimatedHeight >= opts.thresholds.minTouchTargetPx) return null;\n return {\n blockId: block.id,\n params: {\n height: Math.round(estimatedHeight),\n min: opts.thresholds.minTouchTargetPx,\n },\n };\n },\n};\n","import { isButton } from \"@templatical/types\";\nimport type { Rule, RuleMeta } from \"../../types\";\nimport { getContrastRatio } from \"../../contrast\";\n\nexport const meta: RuleMeta = {\n id: \"a11y.button-low-contrast\",\n severity: \"error\",\n};\n\nexport const buttonLowContrast: Rule = {\n meta,\n block(block) {\n if (!isButton(block)) return null;\n const ratio = getContrastRatio(block.textColor, block.backgroundColor);\n if (Number.isNaN(ratio)) return null;\n // WCAG large text = 18pt (~24px). Mirrors the heading rule's threshold.\n const required = block.fontSize >= 24 ? 3 : 4.5;\n if (ratio >= required) return null;\n return {\n blockId: block.id,\n params: { ratio: ratio.toFixed(2), required },\n };\n },\n};\n","import type { Rule, RuleMeta } from \"../../types\";\n\nexport const meta: RuleMeta = {\n id: \"a11y.missing-preheader\",\n severity: \"info\",\n};\n\nexport const missingPreheader: Rule = {\n meta,\n template(content) {\n const text = content.settings.preheaderText?.trim() ?? \"\";\n if (text !== \"\") return [];\n return [{ blockId: null }];\n },\n};\n","import type { TemplateContent } from \"@templatical/types\";\nimport type { LintIssue, LintOptions, Rule } from \"../types\";\nimport { resolveAccessibilityOptions, runRules } from \"../run-rules\";\nimport { formatMessage, type RuleMessageId } from \"./messages\";\nimport { imgMissingAlt } from \"./rules/img-missing-alt\";\nimport { imgAltIsFilename } from \"./rules/img-alt-is-filename\";\nimport { imgAltTooLong } from \"./rules/img-alt-too-long\";\nimport { imgDecorativeNeedsEmptyAlt } from \"./rules/img-decorative-needs-empty-alt\";\nimport { imgLinkedNoContext } from \"./rules/img-linked-no-context\";\nimport { headingEmpty } from \"./rules/heading-empty\";\nimport { headingSkipLevel } from \"./rules/heading-skip-level\";\nimport { headingMultipleH1 } from \"./rules/heading-multiple-h1\";\nimport { linkEmpty } from \"./rules/link-empty\";\nimport { linkVagueText } from \"./rules/link-vague-text\";\nimport { linkHrefEmpty } from \"./rules/link-href-empty\";\nimport { linkTargetBlankNoRel } from \"./rules/link-target-blank-no-rel\";\nimport { textAllCaps } from \"./rules/text-all-caps\";\nimport { textLowContrast } from \"./rules/text-low-contrast\";\nimport { textTooSmall } from \"./rules/text-too-small\";\nimport { buttonVagueLabel } from \"./rules/button-vague-label\";\nimport { buttonTouchTarget } from \"./rules/button-touch-target\";\nimport { buttonLowContrast } from \"./rules/button-low-contrast\";\nimport { missingPreheader } from \"./rules/missing-preheader\";\n\nexport const ACCESSIBILITY_RULES: Rule[] = [\n imgMissingAlt,\n imgAltIsFilename,\n imgAltTooLong,\n imgDecorativeNeedsEmptyAlt,\n imgLinkedNoContext,\n headingEmpty,\n headingSkipLevel,\n headingMultipleH1,\n linkEmpty,\n linkVagueText,\n linkHrefEmpty,\n linkTargetBlankNoRel,\n textAllCaps,\n textLowContrast,\n textTooSmall,\n buttonVagueLabel,\n buttonTouchTarget,\n buttonLowContrast,\n missingPreheader,\n];\n\nexport function lintAccessibility(\n content: TemplateContent,\n options: LintOptions = {},\n): LintIssue[] {\n if (options.disabled === true || options.accessibility === false) return [];\n const tool = options.accessibility ?? {};\n const resolved = resolveAccessibilityOptions(\n options.locale,\n tool,\n ACCESSIBILITY_RULES,\n );\n return runRules(\n content,\n ACCESSIBILITY_RULES,\n resolved,\n (locale, id, params) => formatMessage(locale, id as RuleMessageId, params),\n );\n}\n","import type en from \"./en\";\n\nconst de: typeof en = {\n \"structure.duplicate-block-id\":\n \"Block-ID erscheint {count}-mal im Baum. Jeder Block muss eine eindeutige ID haben.\",\n \"structure.section-column-mismatch\":\n 'Sektion verwendet Layout „{layout}\" (erwartet {expected} Spalten), hat aber {actual}. Deutet auf beschädigten Zustand hin.',\n \"structure.nested-section\":\n \"Sektion ist in einer anderen Sektion verschachtelt. Sektionen können nicht verschachtelt werden – der Renderer wird sich falsch verhalten.\",\n \"structure.empty-section\":\n \"Sektion enthält keine Blöcke. Entferne sie oder füge Inhalt hinzu.\",\n \"structure.empty-column\":\n \"Spalte {columnIndex} dieser Sektion ist leer. Füge Inhalt hinzu oder reduziere die Spaltenanzahl.\",\n};\n\nexport default de;\n","/**\n * English structure-rule messages. The source of truth — other locales\n * annotate themselves `typeof en` so missing or extra keys fail typecheck.\n *\n * Templates use `{name}` placeholders, interpolated by `formatMessage`.\n */\nconst en = {\n \"structure.duplicate-block-id\":\n \"Block id appears {count} times in the tree. Each block must have a unique id.\",\n \"structure.section-column-mismatch\":\n 'Section uses layout \"{layout}\" (expects {expected} columns) but has {actual}. Indicates corrupted state.',\n \"structure.nested-section\":\n \"Section is nested inside another section. Sections cannot nest — the renderer will misbehave.\",\n \"structure.empty-section\": \"Section has no blocks. Remove it or add content.\",\n \"structure.empty-column\":\n \"Column {columnIndex} of this section is empty. Add content or reduce the column count.\",\n};\n\nexport default en;\n","import en from \"./en\";\n\nexport type StructureMessageMap = typeof en;\nexport type StructureRuleMessageId = keyof StructureMessageMap;\n\nconst modules = import.meta.glob<{ default: StructureMessageMap }>(\"./*.ts\", {\n eager: true,\n});\n\nconst MESSAGES: Record<string, StructureMessageMap> = {};\nfor (const path in modules) {\n const match = /\\.\\/([^/]+)\\.ts$/.exec(path);\n if (!match) continue;\n const locale = match[1];\n if (locale === \"index\") continue;\n MESSAGES[locale] = modules[path].default;\n}\n\nexport const SUPPORTED_STRUCTURE_MESSAGE_LOCALES = Object.keys(MESSAGES);\n\nexport function getStructureMessages(locale: string): StructureMessageMap {\n const base = locale.split(\"-\")[0]?.toLowerCase() ?? \"en\";\n return MESSAGES[base] ?? MESSAGES.en ?? en;\n}\n\nexport function formatStructureMessage(\n locale: string,\n ruleId: StructureRuleMessageId,\n params?: Record<string, string | number>,\n): string {\n const map = getStructureMessages(locale);\n const template = map[ruleId] ?? en[ruleId];\n if (!params) return template;\n return template.replace(/\\{(\\w+)\\}/g, (_, key: string) => {\n const value = params[key];\n return value === undefined ? `{${key}}` : String(value);\n });\n}\n","import type { Block, SectionBlock, TemplateContent } from \"@templatical/types\";\nimport { isSection } from \"@templatical/types\";\nimport type { Rule, RuleHit, RuleMeta } from \"../../types\";\n\nexport const meta: RuleMeta = {\n id: \"structure.duplicate-block-id\",\n severity: \"error\",\n};\n\nfunction collectIds(blocks: Block[], counts: Map<string, number>): void {\n for (const block of blocks) {\n counts.set(block.id, (counts.get(block.id) ?? 0) + 1);\n if (isSection(block)) {\n for (const column of (block as SectionBlock).children) {\n collectIds(column, counts);\n }\n }\n }\n}\n\nexport const duplicateBlockId: Rule = {\n meta,\n template(content: TemplateContent): RuleHit[] {\n const counts = new Map<string, number>();\n collectIds(content.blocks, counts);\n\n const hits: RuleHit[] = [];\n for (const [id, count] of counts) {\n if (count > 1) {\n hits.push({ blockId: id, params: { count } });\n }\n }\n return hits;\n },\n};\n","import type { Block, SectionBlock, TemplateContent } from \"@templatical/types\";\nimport { isSection } from \"@templatical/types\";\nimport type { Rule, RuleHit, RuleMeta } from \"../../types\";\n\nexport const meta: RuleMeta = {\n id: \"structure.empty-column\",\n severity: \"warning\",\n};\n\nfunction findEmptyColumns(blocks: Block[], hits: RuleHit[]): void {\n for (const block of blocks) {\n if (!isSection(block)) continue;\n const section = block as SectionBlock;\n if (section.children.length > 1) {\n section.children.forEach((column, columnIndex) => {\n if (column.length === 0) {\n hits.push({\n blockId: section.id,\n params: { columnIndex: columnIndex + 1 },\n });\n }\n });\n }\n for (const column of section.children) {\n findEmptyColumns(column, hits);\n }\n }\n}\n\nexport const emptyColumn: Rule = {\n meta,\n template(content: TemplateContent): RuleHit[] {\n const hits: RuleHit[] = [];\n findEmptyColumns(content.blocks, hits);\n return hits;\n },\n};\n","import type { SectionBlock } from \"@templatical/types\";\nimport { isSection } from \"@templatical/types\";\nimport type { Rule, RuleMeta } from \"../../types\";\n\nexport const meta: RuleMeta = {\n id: \"structure.empty-section\",\n severity: \"warning\",\n};\n\nfunction isSectionEmpty(section: SectionBlock): boolean {\n if (section.children.length === 0) return true;\n return section.children.every((column) => column.length === 0);\n}\n\nexport const emptySection: Rule = {\n meta,\n block(block) {\n if (!isSection(block)) return null;\n const section = block as SectionBlock;\n if (!isSectionEmpty(section)) return null;\n return {\n blockId: section.id,\n fix: {\n description: \"Remove the empty section\",\n apply: (ctx) => {\n ctx.removeBlock(section.id);\n },\n },\n };\n },\n};\n","import type { SectionBlock } from \"@templatical/types\";\nimport { isSection } from \"@templatical/types\";\nimport type { Rule, RuleMeta, WalkContext } from \"../../types\";\n\nexport const meta: RuleMeta = {\n id: \"structure.nested-section\",\n severity: \"error\",\n};\n\nexport const nestedSection: Rule = {\n meta,\n block(block, ctx: WalkContext) {\n if (!isSection(block)) return null;\n if (ctx.section === null) return null;\n const parentSection = ctx.section as SectionBlock;\n return {\n blockId: block.id,\n params: { parentId: parentSection.id },\n };\n },\n};\n","import type { ColumnLayout, SectionBlock } from \"@templatical/types\";\nimport { isSection } from \"@templatical/types\";\nimport type { Rule, RuleMeta } from \"../../types\";\n\nexport const meta: RuleMeta = {\n id: \"structure.section-column-mismatch\",\n severity: \"error\",\n};\n\nfunction expectedColumnCount(layout: ColumnLayout): number {\n if (layout === \"1\") return 1;\n if (layout === \"3\") return 3;\n return 2;\n}\n\nexport const sectionColumnMismatch: Rule = {\n meta,\n block(block) {\n if (!isSection(block)) return null;\n const section = block as SectionBlock;\n const expected = expectedColumnCount(section.columns);\n const actual = section.children.length;\n if (actual === expected) return null;\n return {\n blockId: section.id,\n params: { layout: section.columns, expected, actual },\n };\n },\n};\n","import type { TemplateContent } from \"@templatical/types\";\nimport type { LintIssue, LintOptions, Rule } from \"../types\";\nimport { resolveStructureOptions, runRules } from \"../run-rules\";\nimport {\n formatStructureMessage,\n type StructureRuleMessageId,\n} from \"./messages\";\nimport { duplicateBlockId } from \"./rules/duplicate-block-id\";\nimport { emptyColumn } from \"./rules/empty-column\";\nimport { emptySection } from \"./rules/empty-section\";\nimport { nestedSection } from \"./rules/nested-section\";\nimport { sectionColumnMismatch } from \"./rules/section-column-mismatch\";\n\nexport const STRUCTURE_RULES: Rule[] = [\n duplicateBlockId,\n emptySection,\n emptyColumn,\n nestedSection,\n sectionColumnMismatch,\n];\n\nexport function lintStructure(\n content: TemplateContent,\n options: LintOptions = {},\n): LintIssue[] {\n if (options.disabled === true || options.structure === false) return [];\n const tool = options.structure ?? {};\n const resolved = resolveStructureOptions(\n options.locale,\n tool,\n STRUCTURE_RULES,\n );\n return runRules(content, STRUCTURE_RULES, resolved, (locale, id, params) =>\n formatStructureMessage(locale, id as StructureRuleMessageId, params),\n );\n}\n","import type en from \"./en\";\n\nconst de: typeof en = {\n \"link.javascript-protocol\":\n 'Die URL verwendet das „javascript:\"-Protokoll, das aus Sicherheitsgründen beim Rendern entfernt wird. Ersetze sie durch eine echte URL oder entferne sie.',\n \"link.unsupported-protocol\":\n 'Die URL verwendet das Protokoll „{protocol}\", das von den meisten E-Mail-Clients nicht unterstützt wird. Verwende http, https, mailto, tel oder sms.',\n \"link.malformed-mailto\":\n \"Der mailto:-Link ist fehlerhaft. Erwartet wird eine einzelne Empfängeradresse vor einer eventuellen Querystring (z. B. mailto:hallo@example.com).\",\n \"link.malformed-tel\":\n \"Der tel:-Link enthält Zeichen, die keine Ziffern, +, Leerzeichen, Bindestriche, Klammern oder Punkte sind.\",\n \"link.localhost-or-staging\":\n 'Der URL-Host „{host}\" entspricht einem Nicht-Produktionsmuster. Ersetze ihn vor dem Versand durch die Produktions-URL.',\n};\n\nexport default de;\n","/**\n * English link-rule messages. The source of truth — other locales annotate\n * themselves `typeof en` so missing or extra keys fail typecheck.\n *\n * Templates use `{name}` placeholders, interpolated by `formatLinkMessage`.\n */\nconst en = {\n \"link.javascript-protocol\":\n 'URL uses the \"javascript:\" protocol, which is stripped at render time for safety. Replace it with a real link or remove the URL.',\n \"link.unsupported-protocol\":\n 'URL uses the \"{protocol}\" protocol, which most email clients do not support. Use http, https, mailto, tel, or sms.',\n \"link.malformed-mailto\":\n \"mailto: link is malformed. Expected a single recipient address before any query string (e.g. mailto:hello@example.com).\",\n \"link.malformed-tel\":\n \"tel: link contains characters that are not digits, +, spaces, dashes, parentheses, or dots.\",\n \"link.localhost-or-staging\":\n 'URL host \"{host}\" matches a non-production pattern. Replace with the production URL before sending.',\n};\n\nexport default en;\n","import en from \"./en\";\n\nexport type LinkMessageMap = typeof en;\nexport type LinkRuleMessageId = keyof LinkMessageMap;\n\nconst modules = import.meta.glob<{ default: LinkMessageMap }>(\"./*.ts\", {\n eager: true,\n});\n\nconst MESSAGES: Record<string, LinkMessageMap> = {};\nfor (const path in modules) {\n const match = /\\.\\/([^/]+)\\.ts$/.exec(path);\n if (!match) continue;\n const locale = match[1];\n if (locale === \"index\") continue;\n MESSAGES[locale] = modules[path].default;\n}\n\nexport const SUPPORTED_LINK_MESSAGE_LOCALES = Object.keys(MESSAGES);\n\nexport function getLinkMessages(locale: string): LinkMessageMap {\n const base = locale.split(\"-\")[0]?.toLowerCase() ?? \"en\";\n return MESSAGES[base] ?? MESSAGES.en ?? en;\n}\n\nexport function formatLinkMessage(\n locale: string,\n ruleId: LinkRuleMessageId,\n params?: Record<string, string | number>,\n): string {\n const map = getLinkMessages(locale);\n const template = map[ruleId] ?? en[ruleId];\n if (!params) return template;\n return template.replace(/\\{(\\w+)\\}/g, (_, key: string) => {\n const value = params[key];\n return value === undefined ? `{${key}}` : String(value);\n });\n}\n","import type { TemplateContent } from \"@templatical/types\";\nimport {\n isButton,\n isHtml,\n isImage,\n isMenu,\n isParagraph,\n isSocialIcons,\n isTitle,\n isVideo,\n} from \"@templatical/types\";\nimport { walkBlocks } from \"./walk\";\nimport { extractAnchors } from \"./html-utils\";\n\nexport type UrlSource =\n | \"anchor\"\n | \"button\"\n | \"image-link\"\n | \"video\"\n | \"menu-item\"\n | \"social-icon\";\n\nexport interface UrlOccurrence {\n url: string;\n blockId: string;\n source: UrlSource;\n /** Anchor text or block-derived label, if applicable. */\n label?: string;\n}\n\n/**\n * Visit every URL-bearing field in the template tree.\n *\n * Sources covered:\n * - anchor — `<a href>` inside `title.content`, `paragraph.content`,\n * `html.content` (parsed via extractAnchors)\n * - button — `button.url`\n * - image-link — `image.linkUrl` (only when present + non-empty)\n * - video — `video.url`\n * - menu-item — `menu.items[i].url`\n * - social-icon — `social.icons[i].url`\n *\n * Each rule iterates this list once and decides per occurrence.\n */\nexport function walkUrls(content: TemplateContent): UrlOccurrence[] {\n const occurrences: UrlOccurrence[] = [];\n\n walkBlocks(content, (block) => {\n if (isTitle(block) || isParagraph(block) || isHtml(block)) {\n for (const anchor of extractAnchors(block.content)) {\n occurrences.push({\n url: anchor.href,\n blockId: block.id,\n source: \"anchor\",\n label: anchor.text,\n });\n }\n return;\n }\n\n if (isButton(block)) {\n occurrences.push({\n url: block.url,\n blockId: block.id,\n source: \"button\",\n label: block.text,\n });\n return;\n }\n\n if (isImage(block)) {\n if (block.linkUrl && block.linkUrl !== \"\") {\n occurrences.push({\n url: block.linkUrl,\n blockId: block.id,\n source: \"image-link\",\n label: block.alt || undefined,\n });\n }\n return;\n }\n\n if (isVideo(block)) {\n occurrences.push({\n url: block.url,\n blockId: block.id,\n source: \"video\",\n label: block.alt || undefined,\n });\n return;\n }\n\n if (isMenu(block)) {\n for (const item of block.items) {\n occurrences.push({\n url: item.url,\n blockId: block.id,\n source: \"menu-item\",\n label: item.text,\n });\n }\n return;\n }\n\n if (isSocialIcons(block)) {\n for (const icon of block.icons) {\n occurrences.push({\n url: icon.url,\n blockId: block.id,\n source: \"social-icon\",\n label: icon.platform,\n });\n }\n return;\n }\n });\n\n return occurrences;\n}\n","import type { Rule, RuleHit, RuleMeta } from \"../../types\";\nimport { walkUrls } from \"../../url-walker\";\n\nexport const meta: RuleMeta = {\n id: \"link.javascript-protocol\",\n severity: \"error\",\n};\n\n/**\n * Match `javascript:` even when the value is whitespace-padded or mixed-case.\n * Mirrors what HTML attribute parsers see at insert time — leading whitespace\n * (spaces, tabs, newlines) is stripped before scheme parsing.\n */\nfunction isJavascriptProtocol(url: string): boolean {\n if (!url) return false;\n const stripped = url.replace(/\\s+/g, \"\");\n return /^javascript:/i.test(stripped);\n}\n\nexport const javascriptProtocol: Rule = {\n meta,\n template(content): RuleHit[] {\n const hits: RuleHit[] = [];\n for (const occ of walkUrls(content)) {\n if (isJavascriptProtocol(occ.url)) {\n hits.push({ blockId: occ.blockId });\n }\n }\n return hits;\n },\n};\n","import type { Rule, RuleHit, RuleMeta } from \"../../types\";\nimport { walkUrls } from \"../../url-walker\";\n\nexport const meta: RuleMeta = {\n id: \"link.unsupported-protocol\",\n severity: \"warning\",\n};\n\nconst SUPPORTED = new Set([\"http\", \"https\", \"mailto\", \"tel\", \"sms\"]);\n\n/**\n * Treat `javascript:` (covered by its own rule) and bare/relative URLs as\n * \"not unsupported\" — this rule fires only for explicitly named schemes that\n * email clients typically refuse.\n */\nfunction getProtocol(url: string): string | null {\n if (!url) return null;\n const trimmed = url.trim();\n const match = /^([a-z][a-z0-9+\\-.]*):/i.exec(trimmed);\n if (!match) return null;\n return match[1].toLowerCase();\n}\n\nexport const unsupportedProtocol: Rule = {\n meta,\n template(content): RuleHit[] {\n const hits: RuleHit[] = [];\n for (const occ of walkUrls(content)) {\n const protocol = getProtocol(occ.url);\n if (protocol === null) continue;\n if (protocol === \"javascript\") continue;\n if (SUPPORTED.has(protocol)) continue;\n hits.push({ blockId: occ.blockId, params: { protocol } });\n }\n return hits;\n },\n};\n","import type { Rule, RuleHit, RuleMeta } from \"../../types\";\nimport { walkUrls } from \"../../url-walker\";\n\nexport const meta: RuleMeta = {\n id: \"link.malformed-mailto\",\n severity: \"warning\",\n};\n\n/**\n * Pragmatic RFC-5321-ish sanity check, not a full validator. Splits on `?`,\n * requires the left side to contain exactly one `@` with a non-empty local\n * part and a domain that includes at least one dot.\n *\n * Multi-recipient `mailto:a@x.com,b@y.com` is accepted (commas pass through;\n * each recipient is validated individually).\n */\nfunction isMalformedMailto(url: string): boolean {\n const trimmed = url.trim();\n if (!/^mailto:/i.test(trimmed)) return false;\n const value = trimmed.slice(\"mailto:\".length);\n const [recipients] = value.split(\"?\", 2);\n if (recipients.trim() === \"\") return true;\n\n const list = recipients.split(\",\").map((r) => r.trim());\n for (const recipient of list) {\n if (recipient === \"\") return true;\n const at = recipient.split(\"@\");\n if (at.length !== 2) return true;\n const [local, domain] = at;\n if (local === \"\" || domain === \"\") return true;\n if (!domain.includes(\".\")) return true;\n }\n return false;\n}\n\nexport const malformedMailto: Rule = {\n meta,\n template(content): RuleHit[] {\n const hits: RuleHit[] = [];\n for (const occ of walkUrls(content)) {\n if (isMalformedMailto(occ.url)) {\n hits.push({ blockId: occ.blockId });\n }\n }\n return hits;\n },\n};\n","import type { Rule, RuleHit, RuleMeta } from \"../../types\";\nimport { walkUrls } from \"../../url-walker\";\n\nexport const meta: RuleMeta = {\n id: \"link.malformed-tel\",\n severity: \"warning\",\n};\n\nconst VALID_SUBSCRIBER_CHARS = /^[+0-9\\s().\\-]+$/;\n// RFC 3966 par = `;` pname [ \"=\" pvalue ]. pname is alphanum/`-`, pvalue is\n// 1+ paramchar. We accept anything non-empty on the right of `=` since email\n// clients don't validate it.\nconst VALID_PARAM = /^[A-Za-z0-9-]+(=[^;]+)?$/;\n\nfunction isMalformedTel(url: string): boolean {\n const trimmed = url.trim();\n if (!/^tel:/i.test(trimmed)) return false;\n const value = trimmed.slice(\"tel:\".length).trim();\n if (value === \"\") return true;\n const [subscriber, ...params] = value.split(\";\");\n if (!VALID_SUBSCRIBER_CHARS.test(subscriber)) return true;\n return params.some((p) => !VALID_PARAM.test(p));\n}\n\nexport const malformedTel: Rule = {\n meta,\n template(content): RuleHit[] {\n const hits: RuleHit[] = [];\n for (const occ of walkUrls(content)) {\n if (isMalformedTel(occ.url)) {\n hits.push({ blockId: occ.blockId });\n }\n }\n return hits;\n },\n};\n","import type { ResolvedOptions, Rule, RuleHit, RuleMeta } from \"../../types\";\nimport { walkUrls } from \"../../url-walker\";\n\nexport const meta: RuleMeta = {\n id: \"link.localhost-or-staging\",\n severity: \"warning\",\n};\n\n/**\n * Glob → RegExp for the `nonProductionHosts` pattern set. `*` is a wildcard\n * that matches any run of characters (including `.`) so `*.staging.*`\n * matches `app.staging.example.com` and `*.local` matches both `acme.local`\n * and `a.b.c.local`. Case-insensitive.\n */\nfunction globToRegex(pattern: string): RegExp {\n const escaped = pattern.replace(/[.+?^${}()|[\\]\\\\]/g, \"\\\\$&\");\n const expanded = escaped.replace(/\\*/g, \".*\");\n return new RegExp(`^${expanded}$`, \"i\");\n}\n\nfunction extractHost(url: string): string | null {\n if (!url) return null;\n const trimmed = url.trim();\n // mailto/tel/sms have no host concept worth matching.\n if (!/^(https?|ftps?):\\/\\//i.test(trimmed)) return null;\n try {\n return new URL(trimmed).hostname.toLowerCase();\n } catch {\n return null;\n }\n}\n\nexport const localhostOrStaging: Rule = {\n meta,\n template(content, opts: ResolvedOptions): RuleHit[] {\n const patterns = opts.links.nonProductionHosts;\n if (patterns.length === 0) return [];\n const regexes = patterns.map(globToRegex);\n const hits: RuleHit[] = [];\n\n for (const occ of walkUrls(content)) {\n const host = extractHost(occ.url);\n if (host === null) continue;\n if (regexes.some((re) => re.test(host))) {\n hits.push({ blockId: occ.blockId, params: { host } });\n }\n }\n return hits;\n },\n};\n","import type { TemplateContent } from \"@templatical/types\";\nimport type { LintIssue, LintOptions, Rule } from \"../types\";\nimport { resolveLinksOptions, runRules } from \"../run-rules\";\nimport { formatLinkMessage, type LinkRuleMessageId } from \"./messages\";\nimport { javascriptProtocol } from \"./rules/javascript-protocol\";\nimport { unsupportedProtocol } from \"./rules/unsupported-protocol\";\nimport { malformedMailto } from \"./rules/malformed-mailto\";\nimport { malformedTel } from \"./rules/malformed-tel\";\nimport { localhostOrStaging } from \"./rules/localhost-or-staging\";\n\nexport const LINK_RULES: Rule[] = [\n javascriptProtocol,\n unsupportedProtocol,\n malformedMailto,\n malformedTel,\n localhostOrStaging,\n];\n\nexport function lintLinks(\n content: TemplateContent,\n options: LintOptions = {},\n): LintIssue[] {\n if (options.disabled === true || options.links === false) return [];\n const tool = options.links ?? {};\n const resolved = resolveLinksOptions(options.locale, tool, LINK_RULES);\n return runRules(content, LINK_RULES, resolved, (locale, id, params) =>\n formatLinkMessage(locale, id as LinkRuleMessageId, params),\n );\n}\n","import type { LintOptions } from \"./types\";\n\n/**\n * `true` when no linter would run for the given options — either the\n * global `disabled` flag is set, or every per-tool key is `false`.\n *\n * The editor uses this to skip lazy-loading `@templatical/quality`, hide\n * the Issues sidebar tab, and suppress inline canvas badges. Headless\n * callers can use it to short-circuit before any linter call.\n */\nexport function isLintFullyDisabled(options: LintOptions | undefined): boolean {\n if (!options) return false;\n if (options.disabled === true) return true;\n return (\n options.accessibility === false &&\n options.structure === false &&\n options.links === false\n );\n}\n"],"mappings":";;;;;;;;;;GAsJa,IAA0C;CACrD,cAAc;CACd,aAAa;CACb,kBAAkB;CAClB,kBAAkB;CACnB,EAEY,IAAyC;CACpD;CACA;CACA;CACA;CACA;CACA;CACD;;;AC1JD,SAAgB,EAAiB,GAAY,GAAoB;CAC/D,IAAM,IAAQ,EAAS,EAAG,EACpB,IAAQ,EAAS,EAAG;AAE1B,KAAI,CAAC,KAAS,CAAC,EACb,QAAO;CAGT,IAAM,IAAK,EAAkB,EAAM,EAC7B,IAAK,EAAkB,EAAM,EAC7B,IAAU,KAAK,IAAI,GAAI,EAAG,EAC1B,IAAS,KAAK,IAAI,GAAI,EAAG;AAE/B,SAAQ,IAAU,QAAS,IAAS;;AAStC,IAAM,KAAO,uCACP,KAAO,gDACP,KAAO;AAEb,SAAgB,EAAS,GAA8C;AACrE,KAAI,OAAO,KAAU,SACnB,QAAO;CAGT,IAAM,IAAU,EAAM,MAAM,EAEtB,IAAS,GAAK,KAAK,EAAQ;AACjC,KAAI,EAIF,QADI,EAAO,GAAG,aAAa,KAAK,OACzB;EACL,GAAG,SAAS,EAAO,IAAI,GAAG;EAC1B,GAAG,SAAS,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E,SAAM;KAAE,CAAC;;AAGzD,UAAO;;EChCT;CACD;AAED,SAAgB,GACd,GACA,IAAuB,EAAE,EACZ;AACb,KAAI,EAAQ,aAAa,MAAQ,EAAQ,UAAU,GAAO,QAAO,EAAE;CACnE,IAAM,IAAO,EAAQ,SAAS,EAAE;AAEhC,QAAO,EAAS,GAAS,GADR,GAAoB,EAAQ,QAAQ,GAAM,EACtB,GAAW,GAAQ,GAAI,MAC1D,EAAkB,GAAQ,GAAyB,EAAO,CAC3D;;;;ACjBH,SAAgB,GAAoB,GAA2C;AAG7E,QAFK,IACD,EAAQ,aAAa,KAAa,KAEpC,EAAQ,kBAAkB,MAC1B,EAAQ,cAAc,MACtB,EAAQ,UAAU,KALC"}
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@templatical/quality",
|
|
3
3
|
"description": "Accessibility linter for Templatical email templates",
|
|
4
|
-
"version": "0.8.
|
|
4
|
+
"version": "0.8.1",
|
|
5
5
|
"bugs": "https://github.com/templatical/sdk/issues",
|
|
6
6
|
"dependencies": {
|
|
7
7
|
"htmlparser2": "^9.1.0",
|
|
8
|
-
"@templatical/types": "0.8.
|
|
8
|
+
"@templatical/types": "0.8.1"
|
|
9
9
|
},
|
|
10
10
|
"devDependencies": {
|
|
11
11
|
"typescript": "^6.0.3",
|