@expressive-code/plugin-frames
Advanced tools
Comparing version 0.5.0 to 0.6.0
@@ -1,2 +0,2 @@ | ||
import { StyleSettings, ExpressiveCodePlugin, AttachedPluginData } from '@expressive-code/core'; | ||
import { StyleSettings, PluginTexts, ExpressiveCodePlugin, AttachedPluginData } from '@expressive-code/core'; | ||
@@ -19,2 +19,7 @@ declare const framesStyleSettings: StyleSettings<"shadowColor" | "frameBoxShadowCssValue" | "editorActiveTabBackground" | "editorActiveTabForeground" | "editorActiveTabBorder" | "editorActiveTabBorderTop" | "editorActiveTabBorderBottom" | "editorActiveTabMarginInlineStart" | "editorActiveTabMarginBlockStart" | "editorTabBorderRadius" | "editorTabBarBackground" | "editorTabBarBorderColor" | "editorTabBarBorderBottom" | "editorBackground" | "terminalTitlebarDotsForeground" | "terminalTitlebarBackground" | "terminalTitlebarForeground" | "terminalTitlebarBorderBottom" | "terminalBackground" | "inlineButtonForeground" | "inlineButtonHoverBackground" | "inlineButtonActiveBorder" | "tooltipSuccessBackground" | "tooltipSuccessForeground">; | ||
} | ||
declare const pluginFramesTexts: PluginTexts<{ | ||
terminalWindowFallbackTitle: string; | ||
copyButtonTooltip: string; | ||
copyButtonCopied: string; | ||
}>; | ||
declare function pluginFrames(options?: PluginFramesOptions): ExpressiveCodePlugin; | ||
@@ -26,2 +31,2 @@ interface PluginFramesData { | ||
export { PluginFramesData, PluginFramesOptions, pluginFrames, pluginFramesData }; | ||
export { PluginFramesData, PluginFramesOptions, pluginFrames, pluginFramesData, pluginFramesTexts }; |
// src/index.ts | ||
import { AttachedPluginData, replaceDelimitedValues } from "@expressive-code/core"; | ||
import { AttachedPluginData, PluginTexts, replaceDelimitedValues } from "@expressive-code/core"; | ||
import { h } from "hastscript"; | ||
@@ -394,2 +394,12 @@ | ||
// src/index.ts | ||
var pluginFramesTexts = new PluginTexts({ | ||
terminalWindowFallbackTitle: "Terminal window", | ||
copyButtonTooltip: "Copy to clipboard", | ||
copyButtonCopied: "Copied!" | ||
}); | ||
pluginFramesTexts.addLocale("de", { | ||
terminalWindowFallbackTitle: "Terminal-Fenster", | ||
copyButtonTooltip: "In die Zwischenablage kopieren", | ||
copyButtonCopied: "Kopiert!" | ||
}); | ||
function pluginFrames(options = {}) { | ||
@@ -430,12 +440,10 @@ const extractFileNameFromCode = options.extractFileNameFromCode ?? true; | ||
}, | ||
postprocessRenderedBlock: ({ codeBlock, renderData }) => { | ||
postprocessRenderedBlock: ({ codeBlock, renderData, locale }) => { | ||
const texts = pluginFramesTexts.get(locale); | ||
const titleText = pluginFramesData.getOrCreateFor(codeBlock).title; | ||
const isTerminal = isTerminalLanguage(codeBlock.language); | ||
const visibleTitle = titleText ? [h("span", { className: "title" }, titleText)] : []; | ||
const fallbackTerminalWindowTitle = "Terminal window"; | ||
const screenReaderTitle = !titleText && isTerminal ? [h("span", { className: "sr-only" }, fallbackTerminalWindowTitle)] : []; | ||
const screenReaderTitle = !titleText && isTerminal ? [h("span", { className: "sr-only" }, texts.terminalWindowFallbackTitle)] : []; | ||
const extraElements = []; | ||
if (showCopyToClipboardButton) { | ||
const copyButtonTooltip = "Copy to clipboard"; | ||
const copyButtonCopied = "Copied!"; | ||
const codeToCopy = codeBlock.code.replace(/\n/g, "\x7F"); | ||
@@ -445,4 +453,4 @@ extraElements.push( | ||
h("button", { | ||
title: copyButtonTooltip, | ||
"data-copied": copyButtonCopied, | ||
title: texts.copyButtonTooltip, | ||
"data-copied": texts.copyButtonCopied, | ||
"data-code": codeToCopy | ||
@@ -478,4 +486,5 @@ }) | ||
pluginFrames, | ||
pluginFramesData | ||
pluginFramesData, | ||
pluginFramesTexts | ||
}; | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "@expressive-code/plugin-frames", | ||
"version": "0.5.0", | ||
"version": "0.6.0", | ||
"description": "Frames plugin for Expressive Code. Wraps code blocks in a styled editor or terminal frame with support for titles, multiple tabs and more.", | ||
@@ -21,7 +21,7 @@ "keywords": [], | ||
"dependencies": { | ||
"@expressive-code/core": "^0.5.0", | ||
"@expressive-code/core": "^0.6.0", | ||
"hastscript": "^7.2.0" | ||
}, | ||
"devDependencies": { | ||
"@internal/test-utils": "^0.2.0", | ||
"@internal/test-utils": "^0.2.1", | ||
"hast-util-select": "^5.0.5", | ||
@@ -28,0 +28,0 @@ "hast-util-to-html": "^8.0.4" |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
127494
1467
+ Added@expressive-code/core@0.6.0(transitive)
- Removed@expressive-code/core@0.5.0(transitive)
Updated@expressive-code/core@^0.6.0