@dr-ishaan/rehype-perfect-code-blocks 1.3.3 → 2.1.0

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/CHANGELOG.md CHANGED
@@ -5,6 +5,181 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [2.1.0] — 2026-06-20
9
+
10
+ ### Summary
11
+
12
+ Minor release implementing the four P1 items from the v2.0.0 roadmap: Math/LaTeX rendering (KaTeX integration), Lazy Shiki initialization, Dev-mode warnings, and Screen reader copy announcement. No breaking changes — all new features are opt-in with backward-compatible defaults.
13
+
14
+ ### Features
15
+
16
+ #### P1-1: Math/LaTeX rendering (KaTeX integration)
17
+
18
+ New `math` option — renders LaTeX at build time via KaTeX (server-side, no client JS needed):
19
+
20
+ ```js
21
+ perfectCode({
22
+ math: {
23
+ engine: 'katex', // 'katex' | 'none' (default: 'none')
24
+ inline: true, // render $...$ inline
25
+ block: true, // render $$...$$ and ```math blocks
26
+ injectCss: true, // inject KaTeX CSS
27
+ throwOnError: true, // graceful fallback for invalid LaTeX
28
+ },
29
+ })
30
+ ```
31
+
32
+ - `katex` is an optional peer dependency — if not installed, falls back to rendering the LaTeX source as plain text
33
+ - Handles fenced code blocks with language `math`, `latex`, or `tex` → renders via KaTeX instead of Shiki
34
+ - New `src/math.ts` module with `isMathLanguage()`, `renderMath()`, `resolveMathOptions()` utilities
35
+ - New `src/katex.d.ts` minimal type declaration for the optional `katex` module
36
+
37
+ #### P1-2: Lazy Shiki initialization
38
+
39
+ New `shiki.lazy` option — don't load Shiki languages until the first code block is encountered:
40
+
41
+ ```js
42
+ perfectCode({
43
+ shiki: {
44
+ lazy: true, // skip preloading langs; only load what's in each document
45
+ preloadLangs: ['typescript', 'bash'], // langs to preload when code blocks exist
46
+ },
47
+ })
48
+ ```
49
+
50
+ When `lazy: true`, the plugin skips preloading `shiki.langs` and only loads languages actually found in the document. On pages with no code blocks, Shiki is never initialized. Saves ~1MB of bundle on code-free pages.
51
+
52
+ #### P1-3: Dev-mode warnings
53
+
54
+ New `devWarnings` option — emits warnings during build/dev for common misconfigurations:
55
+
56
+ ```js
57
+ perfectCode({
58
+ devWarnings: true, // default: true in dev (NODE_ENV !== 'production'), false in prod
59
+ })
60
+ ```
61
+
62
+ Warnings include:
63
+ - Unknown language not loaded in Shiki
64
+ - Invalid meta syntax (e.g., `{1,a-5}` instead of `{1,3-5}`)
65
+ - Conflicting options (e.g., `wrap` + `collapseAfter` both enabled)
66
+ - Code block inside raw HTML detected but rehype-raw not installed
67
+
68
+ Warnings are deduped per unique message to avoid spam. New `src/dev-warnings.ts` module with `runDevWarnings()` and `warnUnknownLanguage()`.
69
+
70
+ #### P1-4: Screen reader copy announcement
71
+
72
+ The copy button now dynamically updates its `aria-label` when copy succeeds:
73
+ - Before copy: `aria-label="Copy code"`
74
+ - After copy: `aria-label="copied! — Copy code"` (announced via screen reader)
75
+ - After feedback duration: restores original `aria-label`
76
+
77
+ Combined with the existing `aria-live="polite"` region (from v1.3.0), screen readers now announce both the button state change AND the "Copied!" text — WCAG 4.1.3 compliant.
78
+
79
+ ### New exports
80
+
81
+ - `resolveMathOptions(options)` — resolves math config with defaults
82
+ - `isMathLanguage(lang)` — checks if a language is a math language
83
+ - `renderMath(latex, displayMode, options)` — renders LaTeX via KaTeX (or fallback)
84
+ - `runDevWarnings(tree, context)` — runs dev warning checks on a hast tree
85
+ - `warnUnknownLanguage(lang, context)` — warns about an unknown language
86
+ - `MathOptions`, `ResolvedMathOptions` types
87
+
88
+ ### Verification
89
+
90
+ - All 1177 pre-existing tests pass (no regressions).
91
+ - New `test-v2-phase2.mjs` adds 42 regression tests covering all 4 P1 features.
92
+ - Total: 1219/1219 tests passing.
93
+
94
+ ## [2.0.0] — 2026-06-20
95
+
96
+ ### Summary
97
+
98
+ **Major release** implementing the four P0 CSS architecture items from the v2.0.0 roadmap. These are the foundational cascade-control features that every production site needs to adopt the plugin without fighting the CSS cascade. No breaking changes — all new features are opt-in with backward-compatible defaults.
99
+
100
+ ### Features
101
+
102
+ #### P0-1: `@layer` CSS injection support
103
+
104
+ New `cssInjection` and `cssLayer` options:
105
+
106
+ - `cssInjection: 'inline'` (default, backward-compatible) — injects CSS in a `<style>` tag as before
107
+ - `cssInjection: 'layer'` — wraps CSS in `@layer <cssLayer> { ... }` so it sits in the correct cascade layer on sites using `@layer` (Tailwind v3+, daisyUI, etc.)
108
+ - `cssInjection: 'import'` — does NOT inject CSS; user imports manually via `import '@dr-ishaan/rehype-perfect-code-blocks/styles.css'`
109
+ - `cssLayer: 'pcb'` (default) — the layer name to use when `cssInjection: 'layer'`
110
+
111
+ Example:
112
+ ```js
113
+ perfectCode({
114
+ cssInjection: 'layer',
115
+ cssLayer: 'components',
116
+ })
117
+ // User's CSS: @layer base, components, utilities;
118
+ ```
119
+
120
+ #### P0-2: Design-token bridge
121
+
122
+ New `tokens` option — provide 5 core values and the plugin auto-derives 20+ `--pcb-*` variables using `color-mix(in oklch, ...)`:
123
+
124
+ ```js
125
+ perfectCode({
126
+ tokens: {
127
+ bg: 'var(--bg-subtle)',
128
+ fg: 'var(--ink)',
129
+ border: 'var(--rule)',
130
+ radius: 'var(--radius-card)',
131
+ monoFont: 'var(--font-mono)',
132
+ },
133
+ })
134
+ ```
135
+
136
+ The plugin generates `--pcb-ln-fg`, `--pcb-bg-header`, `--pcb-line-highlight`, `--pcb-line-add`, `--pcb-line-del`, `--pcb-line-focus`, `--pcb-copy-hover-bg`, `--pcb-word-bg`, and more — all derived from the 5 core tokens. Applied via `:where(.pcb)` (zero specificity) so user CSS still wins.
137
+
138
+ Uses `color-mix(in oklch, ...)` (Chrome 111+, Safari 16.4+, Firefox 113+). For older browsers, the v1.3.0 theme-aware defaults from Shiki still apply.
139
+
140
+ #### P0-3: Dark mode strategy options
141
+
142
+ New `darkMode` option — controls how the plugin switches between light and dark themes:
143
+
144
+ - `strategy: 'media'` (default, backward-compatible) — uses `@media (prefers-color-scheme: dark)`
145
+ - `strategy: 'attribute'` — switches on `html[data-theme="dark"]` (configurable attribute + value)
146
+ - `strategy: 'class'` — switches on `html.dark` (configurable class name)
147
+ - `strategy: 'custom'` — switches on a user-provided CSS selector
148
+
149
+ Example:
150
+ ```js
151
+ perfectCode({
152
+ darkMode: { strategy: 'class', class: 'dark' },
153
+ })
154
+ ```
155
+
156
+ #### P0-4: CSS containment scope
157
+
158
+ New `scope` option — prefixes all generated CSS selectors with the given scope:
159
+
160
+ ```js
161
+ perfectCode({
162
+ scope: '.prose',
163
+ })
164
+ // All selectors become: .prose .pcb { ... }, .prose .pcb__copy { ... }, etc.
165
+ ```
166
+
167
+ Applied to ALL generated CSS including the framework-reset overrides, token-bridge CSS, and dark-mode selectors.
168
+
169
+ ### New exports
170
+
171
+ - `generateTokenStyles(tokens, scope?)` — generates the derived `--pcb-*` CSS
172
+ - `applyScopeToCss(css, scope)` — prefixes all selectors in a CSS string
173
+ - `generateDarkModeSelector(darkMode, scope?)` — generates the dark-mode CSS selector
174
+ - `generateLightModeSelector(darkMode, scope?)` — generates the light-mode CSS selector
175
+ - `DesignTokens` type — the token bridge input interface
176
+
177
+ ### Verification
178
+
179
+ - All 1134 pre-existing tests pass (no regressions).
180
+ - New `test-v2-css-architecture.mjs` adds 43 regression tests covering all 4 P0 features.
181
+ - Total: 1177/1177 tests passing.
182
+
8
183
  ## [1.3.3] — 2026-06-20
9
184
 
10
185
  ### Summary
@@ -1 +1 @@
1
- {"version":3,"file":"astro.d.ts","sourceRoot":"","sources":["../src/astro.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,OAAO,CAAC;AAI9C,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAyDrD,MAAM,CAAC,OAAO,UAAU,WAAW,CACjC,OAAO,GAAE,kBAAuB,GAC/B,gBAAgB,CAwGlB"}
1
+ {"version":3,"file":"astro.d.ts","sourceRoot":"","sources":["../src/astro.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,OAAO,CAAC;AAI9C,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AA0DrD,MAAM,CAAC,OAAO,UAAU,WAAW,CACjC,OAAO,GAAE,kBAAuB,GAC/B,gBAAgB,CAyHlB"}
package/dist/astro.js CHANGED
@@ -19,6 +19,7 @@
19
19
  import { rehypePerfectCodeBlocks } from './index.js';
20
20
  import { remarkPreserveCodeMeta } from './remark.js';
21
21
  import { COPY_SCRIPT } from './copy-script.js';
22
+ import { generateTokenStyles, applyScopeToCss } from './tokens.js';
22
23
  import { readFileSync } from 'node:fs';
23
24
  import { readdirSync, writeFileSync, readFileSync as readFile } from 'node:fs';
24
25
  import { fileURLToPath } from 'node:url';
@@ -112,9 +113,23 @@ export default function perfectCode(options = {}) {
112
113
  // so they pass a strict Content-Security-Policy.
113
114
  const nonceAttr = options.cspNonce ? ` nonce="${escapeAttr(options.cspNonce)}"` : '';
114
115
  // CSS
115
- if (options.injectStyles !== false) {
116
- const css = loadCss();
116
+ if (options.injectStyles !== false && options.cssInjection !== 'import') {
117
+ let css = loadCss();
117
118
  if (css) {
119
+ // v2.0.0: Apply CSS scope if configured
120
+ if (options.scope) {
121
+ css = applyScopeToCss(css, options.scope);
122
+ }
123
+ // v2.0.0: Generate token-bridge CSS (derived --pcb-* variables)
124
+ const tokenCss = generateTokenStyles(options.tokens ?? {}, options.scope);
125
+ if (tokenCss) {
126
+ css = css + '\n' + tokenCss;
127
+ }
128
+ // v2.0.0: Wrap in @layer if configured
129
+ const layerName = options.cssLayer ?? 'pcb';
130
+ if (options.cssInjection === 'layer') {
131
+ css = `@layer ${layerName} {\n${css}\n}`;
132
+ }
118
133
  injections.push(`<style data-pcb${nonceAttr}>${css}</style>`);
119
134
  }
120
135
  }
package/dist/astro.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"astro.js","sourceRoot":"","sources":["../src/astro.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAGH,OAAO,EAAE,uBAAuB,EAAE,MAAM,YAAY,CAAC;AACrD,OAAO,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AACrD,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAE/C,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,YAAY,IAAI,QAAQ,EAAE,MAAM,SAAS,CAAC;AAC/E,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAE1C,MAAM,SAAS,GAAG,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;AAE1D;;;;;;;;;;GAUG;AACH,SAAS,OAAO;IACd,IAAI,CAAC;QACH,OAAO,YAAY,CAAC,IAAI,CAAC,SAAS,EAAE,YAAY,CAAC,EAAE,MAAM,CAAC,CAAC;IAC7D,CAAC;IAAC,MAAM,CAAC;QACP,IAAI,CAAC;YACH,OAAO,YAAY,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,YAAY,CAAC,EAAE,MAAM,CAAC,CAAC;QAC1E,CAAC;QAAC,MAAM,CAAC;YACP,OAAO,EAAE,CAAC;QACZ,CAAC;IACH,CAAC;AACH,CAAC;AAED,6EAA6E;AAC7E,SAAS,UAAU,CAAC,CAAS;IAC3B,OAAO,CAAC,CAAC,OAAO,CAAC,UAAU,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;QACnC,GAAG,EAAE,MAAM,EAAE,GAAG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1C,CAAC;gBACH,CAAC;YACH,CAAC;SACF;KACF,CAAC;AACJ,CAAC"}
@@ -21,5 +21,5 @@
21
21
  * class swap when new code blocks are added to the DOM (SPA support).
22
22
  * - `astro:page-load` event listener for Astro view transitions.
23
23
  */
24
- export declare const COPY_SCRIPT = "\n(function () {\n if (window.__pcbCopyReady) return;\n window.__pcbCopyReady = true;\n\n // Remove the .no-js class so the copy buttons become visible (graceful degradation).\n function swapNoJs() {\n if (document.documentElement.classList.contains('no-js')) {\n document.documentElement.classList.remove('no-js');\n document.documentElement.classList.add('js');\n }\n }\n swapNoJs();\n\n // Reuse a single aria-live region for all copy announcements.\n var liveRegion = null;\n function ensureLiveRegion() {\n if (liveRegion && document.body.contains(liveRegion)) return liveRegion;\n liveRegion = document.querySelector('.pcb__sr-live');\n if (!liveRegion) {\n liveRegion = document.createElement('span');\n liveRegion.className = 'pcb__sr-live';\n liveRegion.setAttribute('aria-live', 'polite');\n liveRegion.setAttribute('aria-atomic', 'true');\n liveRegion.setAttribute('role', 'status');\n document.body.appendChild(liveRegion);\n }\n return liveRegion;\n }\n ensureLiveRegion();\n\n function announce(msg) {\n var lr = ensureLiveRegion();\n if (!lr) return;\n lr.textContent = '';\n // Force re-announcement by clearing then setting on next tick.\n setTimeout(function () { lr.textContent = msg; }, 50);\n }\n\n function findLabel(btn) {\n return btn.querySelector('.pcb__copy-label');\n }\n\n function findIcon(btn) {\n return btn.querySelector('svg');\n }\n\n // Strip leading comment lines (e.g. shell prompts like \"# comment\") from\n // the text before copying. Used for terminal-preset blocks where the\n // displayed code may include comments the user doesn't want on the clipboard.\n function stripComments(text) {\n // Strip lines that start with optional whitespace followed by # (shell),\n // // (C-style), or REM (Windows batch). Keep everything else.\n return text.replace(/^[ \\t]*(?:#|\\/\\/|REM\\b).*$/gm, '').replace(/\\n{3,}/g, '\\n\\n').trim();\n }\n\n // Event-delegated click handler. Works for buttons added after initial\n // render (e.g. via React/Vue re-render or Astro view transitions) because\n // the listener is on document, not on each button.\n document.addEventListener('click', function (e) {\n var btn = e.target && e.target.closest && e.target.closest('.pcb__copy');\n if (!btn) return;\n var figure = btn.closest('.pcb');\n var code = figure && figure.querySelector('pre code');\n if (!code) return;\n\n var done = btn.getAttribute('data-done-label') || 'copied!';\n var duration = parseInt(btn.getAttribute('data-feedback-duration') || '1600', 10);\n var successIconHtml = btn.getAttribute('data-success-icon');\n var stripCommentsFlag = btn.hasAttribute('data-strip-comments');\n\n var label = findLabel(btn);\n var icon = findIcon(btn);\n var originalLabel = label ? label.textContent : null;\n var originalIconHtml = icon ? icon.outerHTML : null;\n\n var rawText = code.innerText;\n var textToCopy = stripCommentsFlag ? stripComments(rawText) : rawText;\n\n var finish = function () {\n btn.classList.add('pcb__copy--done');\n if (label) label.textContent = done;\n if (successIconHtml && icon) {\n var tmp = document.createElement('span');\n tmp.innerHTML = successIconHtml;\n var newIcon = tmp.firstChild;\n if (newIcon) {\n icon.replaceWith(newIcon);\n icon = newIcon;\n }\n }\n announce(done);\n setTimeout(function () {\n btn.classList.remove('pcb__copy--done');\n if (label && originalLabel != null) label.textContent = originalLabel;\n if (originalIconHtml && icon) {\n var tmp2 = document.createElement('span');\n tmp2.innerHTML = originalIconHtml;\n var oldIcon = icon;\n icon = tmp2.firstChild;\n if (icon) oldIcon.replaceWith(icon);\n }\n }, duration);\n };\n\n if (navigator.clipboard && navigator.clipboard.writeText) {\n navigator.clipboard.writeText(textToCopy).then(finish).catch(fallback);\n } else {\n fallback();\n }\n\n function fallback() {\n var ta = document.createElement('textarea');\n ta.value = textToCopy;\n ta.style.position = 'fixed';\n ta.style.opacity = '0';\n document.body.appendChild(ta);\n ta.select();\n try { document.execCommand('copy'); finish(); } catch (_) {}\n document.body.removeChild(ta);\n }\n });\n\n // Pattern 4: MutationObserver for SPA support + .no-js race fix.\n // Watches for:\n // - New code blocks added to the DOM (React/Vue re-render, Astro view\n // transitions, Turbolinks) \u2192 re-apply .no-js \u2192 .js swap + ensure\n // aria-live region.\n // - Attribute changes on <html> (specifically the class attribute) \u2192\n // catches the case where a later script adds .no-js AFTER this script\n // ran (a race condition that previously left copy buttons hidden).\n if (typeof MutationObserver !== 'undefined') {\n var pendingObserve = false;\n var observer = new MutationObserver(function (mutations) {\n // Batch checks with microtask to avoid layout thrash.\n if (pendingObserve) return;\n pendingObserve = true;\n Promise.resolve().then(function () {\n pendingObserve = false;\n var needsSwap = false;\n for (var i = 0; i < mutations.length; i++) {\n var m = mutations[i];\n // childList: new nodes added (SPA navigation, view transitions)\n if (m.type === 'childList' && m.addedNodes && m.addedNodes.length) {\n needsSwap = true;\n }\n // attributes: class changed on <html> (the .no-js race fix)\n if (m.type === 'attributes' && m.attributeName === 'class') {\n needsSwap = true;\n }\n }\n if (needsSwap) {\n swapNoJs();\n ensureLiveRegion();\n }\n });\n });\n // Observe documentElement for BOTH childList (new nodes) AND attribute\n // changes (class attribute \u2014 catches .no-js being added by a later script).\n observer.observe(document.documentElement, {\n childList: true,\n subtree: true,\n attributes: true,\n attributeFilter: ['class'],\n });\n }\n\n // Defensive: re-run swapNoJs() on DOMContentLoaded and window.load.\n // Belt + suspenders for the .no-js race \u2014 if a framework (Astro, Next.js,\n // etc.) adds .no-js in a way the MutationObserver doesn't catch (e.g.,\n // before the observer is set up, or in a different document context),\n // these event handlers will catch it.\n if (typeof document.addEventListener === 'function') {\n document.addEventListener('DOMContentLoaded', function () {\n swapNoJs();\n ensureLiveRegion();\n });\n }\n if (typeof window.addEventListener === 'function') {\n window.addEventListener('load', function () {\n swapNoJs();\n ensureLiveRegion();\n });\n }\n\n // Pattern 4: astro:page-load event listener for Astro view transitions.\n // Astro emits this event after a view transition completes; the new page's\n // DOM may have replaced the old, so re-apply the .no-js \u2192 .js swap.\n if (typeof document.addEventListener === 'function') {\n document.addEventListener('astro:page-load', function () {\n swapNoJs();\n ensureLiveRegion();\n });\n }\n})();\n";
24
+ export declare const COPY_SCRIPT = "\n(function () {\n if (window.__pcbCopyReady) return;\n window.__pcbCopyReady = true;\n\n // Remove the .no-js class so the copy buttons become visible (graceful degradation).\n function swapNoJs() {\n if (document.documentElement.classList.contains('no-js')) {\n document.documentElement.classList.remove('no-js');\n document.documentElement.classList.add('js');\n }\n }\n swapNoJs();\n\n // Reuse a single aria-live region for all copy announcements.\n var liveRegion = null;\n function ensureLiveRegion() {\n if (liveRegion && document.body.contains(liveRegion)) return liveRegion;\n liveRegion = document.querySelector('.pcb__sr-live');\n if (!liveRegion) {\n liveRegion = document.createElement('span');\n liveRegion.className = 'pcb__sr-live';\n liveRegion.setAttribute('aria-live', 'polite');\n liveRegion.setAttribute('aria-atomic', 'true');\n liveRegion.setAttribute('role', 'status');\n document.body.appendChild(liveRegion);\n }\n return liveRegion;\n }\n ensureLiveRegion();\n\n function announce(msg) {\n var lr = ensureLiveRegion();\n if (!lr) return;\n lr.textContent = '';\n // Force re-announcement by clearing then setting on next tick.\n setTimeout(function () { lr.textContent = msg; }, 50);\n }\n\n function findLabel(btn) {\n return btn.querySelector('.pcb__copy-label');\n }\n\n function findIcon(btn) {\n return btn.querySelector('svg');\n }\n\n // Strip leading comment lines (e.g. shell prompts like \"# comment\") from\n // the text before copying. Used for terminal-preset blocks where the\n // displayed code may include comments the user doesn't want on the clipboard.\n function stripComments(text) {\n // Strip lines that start with optional whitespace followed by # (shell),\n // // (C-style), or REM (Windows batch). Keep everything else.\n return text.replace(/^[ \\t]*(?:#|\\/\\/|REM\\b).*$/gm, '').replace(/\\n{3,}/g, '\\n\\n').trim();\n }\n\n // Event-delegated click handler. Works for buttons added after initial\n // render (e.g. via React/Vue re-render or Astro view transitions) because\n // the listener is on document, not on each button.\n document.addEventListener('click', function (e) {\n var btn = e.target && e.target.closest && e.target.closest('.pcb__copy');\n if (!btn) return;\n var figure = btn.closest('.pcb');\n var code = figure && figure.querySelector('pre code');\n if (!code) return;\n\n var done = btn.getAttribute('data-done-label') || 'copied!';\n var duration = parseInt(btn.getAttribute('data-feedback-duration') || '1600', 10);\n var successIconHtml = btn.getAttribute('data-success-icon');\n var stripCommentsFlag = btn.hasAttribute('data-strip-comments');\n\n var label = findLabel(btn);\n var icon = findIcon(btn);\n var originalLabel = label ? label.textContent : null;\n var originalIconHtml = icon ? icon.outerHTML : null;\n\n var rawText = code.innerText;\n var textToCopy = stripCommentsFlag ? stripComments(rawText) : rawText;\n\n var finish = function () {\n btn.classList.add('pcb__copy--done');\n if (label) label.textContent = done;\n // v2.1.0: Update aria-label for screen readers \u2014 announce \"copied\" state\n var originalAriaLabel = btn.getAttribute('aria-label') || 'Copy code';\n btn.setAttribute('aria-label', done + ' \u2014 ' + originalAriaLabel);\n if (successIconHtml && icon) {\n var tmp = document.createElement('span');\n tmp.innerHTML = successIconHtml;\n var newIcon = tmp.firstChild;\n if (newIcon) {\n icon.replaceWith(newIcon);\n icon = newIcon;\n }\n }\n announce(done);\n setTimeout(function () {\n btn.classList.remove('pcb__copy--done');\n if (label && originalLabel != null) label.textContent = originalLabel;\n // v2.1.0: Restore original aria-label after feedback duration\n btn.setAttribute('aria-label', originalAriaLabel);\n if (originalIconHtml && icon) {\n var tmp2 = document.createElement('span');\n tmp2.innerHTML = originalIconHtml;\n var oldIcon = icon;\n icon = tmp2.firstChild;\n if (icon) oldIcon.replaceWith(icon);\n }\n }, duration);\n };\n\n if (navigator.clipboard && navigator.clipboard.writeText) {\n navigator.clipboard.writeText(textToCopy).then(finish).catch(fallback);\n } else {\n fallback();\n }\n\n function fallback() {\n var ta = document.createElement('textarea');\n ta.value = textToCopy;\n ta.style.position = 'fixed';\n ta.style.opacity = '0';\n document.body.appendChild(ta);\n ta.select();\n try { document.execCommand('copy'); finish(); } catch (_) {}\n document.body.removeChild(ta);\n }\n });\n\n // Pattern 4: MutationObserver for SPA support + .no-js race fix.\n // Watches for:\n // - New code blocks added to the DOM (React/Vue re-render, Astro view\n // transitions, Turbolinks) \u2192 re-apply .no-js \u2192 .js swap + ensure\n // aria-live region.\n // - Attribute changes on <html> (specifically the class attribute) \u2192\n // catches the case where a later script adds .no-js AFTER this script\n // ran (a race condition that previously left copy buttons hidden).\n if (typeof MutationObserver !== 'undefined') {\n var pendingObserve = false;\n var observer = new MutationObserver(function (mutations) {\n // Batch checks with microtask to avoid layout thrash.\n if (pendingObserve) return;\n pendingObserve = true;\n Promise.resolve().then(function () {\n pendingObserve = false;\n var needsSwap = false;\n for (var i = 0; i < mutations.length; i++) {\n var m = mutations[i];\n // childList: new nodes added (SPA navigation, view transitions)\n if (m.type === 'childList' && m.addedNodes && m.addedNodes.length) {\n needsSwap = true;\n }\n // attributes: class changed on <html> (the .no-js race fix)\n if (m.type === 'attributes' && m.attributeName === 'class') {\n needsSwap = true;\n }\n }\n if (needsSwap) {\n swapNoJs();\n ensureLiveRegion();\n }\n });\n });\n // Observe documentElement for BOTH childList (new nodes) AND attribute\n // changes (class attribute \u2014 catches .no-js being added by a later script).\n observer.observe(document.documentElement, {\n childList: true,\n subtree: true,\n attributes: true,\n attributeFilter: ['class'],\n });\n }\n\n // Defensive: re-run swapNoJs() on DOMContentLoaded and window.load.\n // Belt + suspenders for the .no-js race \u2014 if a framework (Astro, Next.js,\n // etc.) adds .no-js in a way the MutationObserver doesn't catch (e.g.,\n // before the observer is set up, or in a different document context),\n // these event handlers will catch it.\n if (typeof document.addEventListener === 'function') {\n document.addEventListener('DOMContentLoaded', function () {\n swapNoJs();\n ensureLiveRegion();\n });\n }\n if (typeof window.addEventListener === 'function') {\n window.addEventListener('load', function () {\n swapNoJs();\n ensureLiveRegion();\n });\n }\n\n // Pattern 4: astro:page-load event listener for Astro view transitions.\n // Astro emits this event after a view transition completes; the new page's\n // DOM may have replaced the old, so re-apply the .no-js \u2192 .js swap.\n if (typeof document.addEventListener === 'function') {\n document.addEventListener('astro:page-load', function () {\n swapNoJs();\n ensureLiveRegion();\n });\n }\n})();\n";
25
25
  //# sourceMappingURL=copy-script.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"copy-script.d.ts","sourceRoot":"","sources":["../src/copy-script.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,eAAO,MAAM,WAAW,kxOAmMvB,CAAC"}
1
+ {"version":3,"file":"copy-script.d.ts","sourceRoot":"","sources":["../src/copy-script.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,eAAO,MAAM,WAAW,0oPAwMvB,CAAC"}
@@ -103,6 +103,9 @@ export const COPY_SCRIPT = `
103
103
  var finish = function () {
104
104
  btn.classList.add('pcb__copy--done');
105
105
  if (label) label.textContent = done;
106
+ // v2.1.0: Update aria-label for screen readers — announce "copied" state
107
+ var originalAriaLabel = btn.getAttribute('aria-label') || 'Copy code';
108
+ btn.setAttribute('aria-label', done + ' — ' + originalAriaLabel);
106
109
  if (successIconHtml && icon) {
107
110
  var tmp = document.createElement('span');
108
111
  tmp.innerHTML = successIconHtml;
@@ -116,6 +119,8 @@ export const COPY_SCRIPT = `
116
119
  setTimeout(function () {
117
120
  btn.classList.remove('pcb__copy--done');
118
121
  if (label && originalLabel != null) label.textContent = originalLabel;
122
+ // v2.1.0: Restore original aria-label after feedback duration
123
+ btn.setAttribute('aria-label', originalAriaLabel);
119
124
  if (originalIconHtml && icon) {
120
125
  var tmp2 = document.createElement('span');
121
126
  tmp2.innerHTML = originalIconHtml;
@@ -1 +1 @@
1
- {"version":3,"file":"copy-script.js","sourceRoot":"","sources":["../src/copy-script.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAmM1B,CAAC"}
1
+ {"version":3,"file":"copy-script.js","sourceRoot":"","sources":["../src/copy-script.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAwM1B,CAAC"}
@@ -0,0 +1,36 @@
1
+ /**
2
+ * Development warnings (v2.1.0).
3
+ *
4
+ * Emits warnings to the logger during build/dev for common misconfigurations:
5
+ * - Unknown language not loaded in Shiki
6
+ * - Invalid meta syntax (e.g., `{1,a-5}` instead of `{1,3-5}`)
7
+ * - Conflicting options (e.g., `wrap` + `collapseAfter` both enabled)
8
+ * - Code block inside raw HTML detected but rehype-raw not installed
9
+ *
10
+ * Warnings are emitted once per unique message (deduped) to avoid spam.
11
+ */
12
+ import type { Root } from 'hast';
13
+ export interface DevWarningContext {
14
+ logger: {
15
+ warn: (msg: string) => void;
16
+ error: (msg: string) => void;
17
+ };
18
+ hasRehypeRaw: boolean;
19
+ wrap: boolean;
20
+ collapseAfter: number | null;
21
+ }
22
+ /**
23
+ * Check for common misconfigurations and emit dev warnings.
24
+ * Call this once per document after the plugin has processed the tree.
25
+ */
26
+ export declare function runDevWarnings(tree: Root, ctx: DevWarningContext): void;
27
+ /**
28
+ * Warn about an unknown language that Shiki couldn't load.
29
+ * Called from shiki.ts when a language fails to tokenize.
30
+ */
31
+ export declare function warnUnknownLanguage(lang: string, ctx: DevWarningContext): void;
32
+ /**
33
+ * Reset the warning dedup set (for testing).
34
+ */
35
+ export declare function resetWarningDedup(): void;
36
+ //# sourceMappingURL=dev-warnings.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dev-warnings.d.ts","sourceRoot":"","sources":["../src/dev-warnings.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EAAW,IAAI,EAAE,MAAM,MAAM,CAAC;AAG1C,MAAM,WAAW,iBAAiB;IAChC,MAAM,EAAE;QAAE,IAAI,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;QAAC,KAAK,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAA;KAAE,CAAC;IACtE,YAAY,EAAE,OAAO,CAAC;IACtB,IAAI,EAAE,OAAO,CAAC;IACd,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;CAC9B;AAUD;;;GAGG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,iBAAiB,GAAG,IAAI,CAuEvE;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,iBAAiB,GAAG,IAAI,CAM9E;AAED;;GAEG;AACH,wBAAgB,iBAAiB,IAAI,IAAI,CAExC"}
@@ -0,0 +1,95 @@
1
+ /**
2
+ * Development warnings (v2.1.0).
3
+ *
4
+ * Emits warnings to the logger during build/dev for common misconfigurations:
5
+ * - Unknown language not loaded in Shiki
6
+ * - Invalid meta syntax (e.g., `{1,a-5}` instead of `{1,3-5}`)
7
+ * - Conflicting options (e.g., `wrap` + `collapseAfter` both enabled)
8
+ * - Code block inside raw HTML detected but rehype-raw not installed
9
+ *
10
+ * Warnings are emitted once per unique message (deduped) to avoid spam.
11
+ */
12
+ import { visit } from 'unist-util-visit';
13
+ const warnedMessages = new Set();
14
+ function warnOnce(ctx, msg) {
15
+ if (warnedMessages.has(msg))
16
+ return;
17
+ warnedMessages.add(msg);
18
+ ctx.logger.warn(msg);
19
+ }
20
+ /**
21
+ * Check for common misconfigurations and emit dev warnings.
22
+ * Call this once per document after the plugin has processed the tree.
23
+ */
24
+ export function runDevWarnings(tree, ctx) {
25
+ // 1. Check for conflicting options
26
+ if (ctx.wrap && ctx.collapseAfter !== null) {
27
+ warnOnce(ctx, '[rehype-perfect-code-blocks] Both `wrap` and `collapseAfter` are enabled. ' +
28
+ 'Collapsed blocks may not wrap correctly. Consider disabling one.');
29
+ }
30
+ // 2. Check for code blocks inside raw HTML without rehype-raw
31
+ if (!ctx.hasRehypeRaw) {
32
+ let foundRawHtmlAroundCode = false;
33
+ visit(tree, 'element', (node) => {
34
+ if (foundRawHtmlAroundCode)
35
+ return;
36
+ // Look for <pre> elements that are children of raw HTML elements
37
+ // like <details>, <div> with class containing "card", etc.
38
+ // This is a heuristic — we can't perfectly detect raw HTML vs markdown HTML.
39
+ if (node.tagName === 'details' ||
40
+ (node.tagName === 'div' && node.properties?.className &&
41
+ Array.isArray(node.properties.className) &&
42
+ node.properties.className.some((c) => typeof c === 'string' && (c.includes('card') || c.includes('container'))))) {
43
+ const hasPre = node.children?.some((c) => c.type === 'element' && c.tagName === 'pre');
44
+ if (hasPre)
45
+ foundRawHtmlAroundCode = true;
46
+ }
47
+ });
48
+ if (foundRawHtmlAroundCode) {
49
+ warnOnce(ctx, '[rehype-perfect-code-blocks] Code block inside raw HTML detected but rehype-raw ' +
50
+ 'does not appear to be installed. Code blocks inside <details>, <div class="card">, ' +
51
+ 'etc. may not render correctly. Add rehype-raw to your pipeline: ' +
52
+ 'npm install rehype-raw');
53
+ }
54
+ }
55
+ // 3. Check for unknown/invalid meta syntax
56
+ visit(tree, 'element', (node) => {
57
+ if (node.tagName !== 'pre')
58
+ return;
59
+ const codeEl = node.children?.find((c) => c.type === 'element' && c.tagName === 'code');
60
+ if (!codeEl)
61
+ return;
62
+ const meta = codeEl.properties?.dataMeta ??
63
+ node.properties?.dataMeta ?? '';
64
+ if (!meta)
65
+ return;
66
+ // Check for invalid range syntax like {1,a-5} or {1-}
67
+ const rangeMatch = meta.match(/\{([^}]*)\}/g);
68
+ if (rangeMatch) {
69
+ for (const range of rangeMatch) {
70
+ const inside = range.slice(1, -1);
71
+ // Valid: digits, commas, hyphens, spaces, #id, /word/
72
+ // Invalid: letters (except in /word/ or "phrase"), other punctuation
73
+ if (!/^[\d\s,/-]+$/.test(inside) && !inside.includes('"') && !inside.includes('/')) {
74
+ warnOnce(ctx, `[rehype-perfect-code-blocks] Invalid meta syntax: "${range}" in "${meta}". ` +
75
+ 'Expected format like {1,3-5} for line highlighting.');
76
+ }
77
+ }
78
+ }
79
+ });
80
+ }
81
+ /**
82
+ * Warn about an unknown language that Shiki couldn't load.
83
+ * Called from shiki.ts when a language fails to tokenize.
84
+ */
85
+ export function warnUnknownLanguage(lang, ctx) {
86
+ warnOnce(ctx, `[rehype-perfect-code-blocks] Unknown language "${lang}" — not loaded in Shiki. ` +
87
+ 'Falling back to plaintext. Add it to `shiki.langs` or install the grammar.');
88
+ }
89
+ /**
90
+ * Reset the warning dedup set (for testing).
91
+ */
92
+ export function resetWarningDedup() {
93
+ warnedMessages.clear();
94
+ }
95
+ //# sourceMappingURL=dev-warnings.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dev-warnings.js","sourceRoot":"","sources":["../src/dev-warnings.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAGH,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AASzC,MAAM,cAAc,GAAG,IAAI,GAAG,EAAU,CAAC;AAEzC,SAAS,QAAQ,CAAC,GAAsB,EAAE,GAAW;IACnD,IAAI,cAAc,CAAC,GAAG,CAAC,GAAG,CAAC;QAAE,OAAO;IACpC,cAAc,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IACxB,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AACvB,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,cAAc,CAAC,IAAU,EAAE,GAAsB;IAC/D,mCAAmC;IACnC,IAAI,GAAG,CAAC,IAAI,IAAI,GAAG,CAAC,aAAa,KAAK,IAAI,EAAE,CAAC;QAC3C,QAAQ,CACN,GA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,CAAC"}
package/dist/index.d.ts CHANGED
@@ -22,11 +22,19 @@ import { disposeHighlighter, runHighlighterTask } from './shiki.js';
22
22
  import { remarkPreserveCodeMeta } from './remark.js';
23
23
  import { wordDiff, hasChanges } from './word-diff.js';
24
24
  import type { DiffToken } from './word-diff.js';
25
+ import { generateTokenStyles, applyScopeToCss, generateDarkModeSelector, generateLightModeSelector } from './tokens.js';
26
+ import type { DesignTokens } from './tokens.js';
27
+ import { resolveMathOptions, isMathLanguage, renderMath } from './math.js';
28
+ import type { MathOptions, ResolvedMathOptions } from './math.js';
29
+ import { runDevWarnings, warnUnknownLanguage } from './dev-warnings.js';
25
30
  import type { PerfectCodeOptions } from './types.js';
26
31
  export { remarkPreserveCodeMeta };
27
32
  export { disposeHighlighter, runHighlighterTask };
28
33
  export { wordDiff, hasChanges };
29
- export type { DiffToken };
34
+ export { generateTokenStyles, applyScopeToCss, generateDarkModeSelector, generateLightModeSelector };
35
+ export { resolveMathOptions, isMathLanguage, renderMath };
36
+ export { runDevWarnings, warnUnknownLanguage };
37
+ export type { DiffToken, DesignTokens, MathOptions, ResolvedMathOptions };
30
38
  export declare const rehypePerfectCodeBlocks: Plugin<[PerfectCodeOptions?], Root>;
31
39
  export default rehypePerfectCodeBlocks;
32
40
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACtC,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAEjC,OAAO,EAAuB,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AACzF,OAAO,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AACrD,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AACtD,OAAO,KAAK,EAA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E,MAAM,YAAY,CAAC;AAErD,OAAO,EAAE,sBAAsB,EAAE,CAAC;AAClC,OAAO,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,CAAC;AAClD,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,CAAC;AAChC,OAAO,EAAE,mBAAmB,EAAE,eAAe,EAAE,wBAAwB,EAAE,yBAAyB,EAAE,CAAC;AACrG,OAAO,EAAE,kBAAkB,EAAE,cAAc,EAAE,UAAU,EAAE,CAAC;AAC1D,OAAO,EAAE,cAAc,EAAE,mBAAmB,EAAE,CAAC;AAC/C,YAAY,EAAE,SAAS,EAAE,YAAY,EAAE,WAAW,EAAE,mBAAmB,EAAE,CAAC;AAE1E,eAAO,MAAM,uBAAuB,EAAE,MAAM,CAAC,CAAC,kBAAkB,CAAC,CAAC,EAAE,IAAI,CAmBrE,CAAC;AAEJ,eAAe,uBAAuB,CAAC"}
package/dist/index.js CHANGED
@@ -20,9 +20,15 @@ import { rehypePerfectCodeBlocks as transformer } from './transformer.js';
20
20
  import { runShikiOnRawBlocks, disposeHighlighter, runHighlighterTask } from './shiki.js';
21
21
  import { remarkPreserveCodeMeta } from './remark.js';
22
22
  import { wordDiff, hasChanges } from './word-diff.js';
23
+ import { generateTokenStyles, applyScopeToCss, generateDarkModeSelector, generateLightModeSelector } from './tokens.js';
24
+ import { resolveMathOptions, isMathLanguage, renderMath } from './math.js';
25
+ import { runDevWarnings, warnUnknownLanguage } from './dev-warnings.js';
23
26
  export { remarkPreserveCodeMeta };
24
27
  export { disposeHighlighter, runHighlighterTask };
25
28
  export { wordDiff, hasChanges };
29
+ export { generateTokenStyles, applyScopeToCss, generateDarkModeSelector, generateLightModeSelector };
30
+ export { resolveMathOptions, isMathLanguage, renderMath };
31
+ export { runDevWarnings, warnUnknownLanguage };
26
32
  export const rehypePerfectCodeBlocks = (options = {}) => {
27
33
  const engine = options.engine ?? 'auto';
28
34
  const opts = options;
@@ -143,6 +149,15 @@ function resolveDefaults(opts) {
143
149
  preset: opts.preset ?? 'default',
144
150
  injectStyles: opts.injectStyles ?? true,
145
151
  theme: opts.theme ?? 'auto',
152
+ // v2.0.0: CSS Architecture options
153
+ cssInjection: opts.cssInjection ?? 'inline',
154
+ cssLayer: opts.cssLayer ?? 'pcb',
155
+ tokens: opts.tokens ?? undefined,
156
+ darkMode: opts.darkMode ?? undefined,
157
+ scope: opts.scope ?? undefined,
158
+ // v2.1.0: P1 features
159
+ math: opts.math ?? undefined,
160
+ devWarnings: opts.devWarnings ?? (process.env.NODE_ENV !== 'production'),
146
161
  inline: opts.inline ?? false,
147
162
  };
148
163
  }
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAIH,OAAO,EAAE,uBAAuB,IAAI,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC1E,OAAO,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AACzF,OAAO,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AACrD,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAItD,OAAO,EAAE,sBAAsB,EAAE,CAAC;AAClC,OAAO,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,CAAC;AAClD,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,CAAC;AAGhC,MAAM,CAAC,MAAM,uBAAuB,GAClC,CAAC,OAAO,GAAG,EAAE,EAAE,EAAE;IACf,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,IAAI,MAAM,CAAC;IACxC,MAAM,IAAI,GAAG,OAAO,CAAC;IAErB,OAAO,KAAK,EAAE,IAAI,EAAE,EAAE;QACpB,8EAA8E;QAC9E,2EAA2E;QAC3E,0EAA0E;QAC1E,0BAA0B;QAC1B,IAAI,MAAM,KAAK,OAAO,IAAI,MAAM,KAAK,MA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