@shikijs/core 1.17.6 → 1.17.7

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.mts CHANGED
@@ -215,11 +215,9 @@ declare function splitTokens<T extends Pick<ThemedToken, 'content' | 'offset'>>(
215
215
  * Normalize a getter to a promise.
216
216
  */
217
217
  declare function normalizeGetter<T>(p: MaybeGetter<T>): Promise<T>;
218
- declare function resolveColorReplacements(theme: ThemeRegistrationAny | string, options?: TokenizeWithThemeOptions): {
219
- [x: string]: string;
220
- };
221
- declare function applyColorReplacements(color: string, replacements?: Record<string, string>): string;
222
- declare function applyColorReplacements(color?: string | undefined, replacements?: Record<string, string>): string | undefined;
218
+ declare function resolveColorReplacements(theme: ThemeRegistrationAny | string, options?: TokenizeWithThemeOptions): Record<string, string | undefined>;
219
+ declare function applyColorReplacements(color: string, replacements?: Record<string, string | undefined>): string;
220
+ declare function applyColorReplacements(color?: string | undefined, replacements?: Record<string, string | undefined>): string | undefined;
223
221
  declare function getTokenStyleObject(token: TokenStyles): Record<string, string>;
224
222
  declare function stringifyTokenStyle(token: Record<string, string>): string;
225
223
  /**
package/dist/index.d.ts CHANGED
@@ -215,11 +215,9 @@ declare function splitTokens<T extends Pick<ThemedToken, 'content' | 'offset'>>(
215
215
  * Normalize a getter to a promise.
216
216
  */
217
217
  declare function normalizeGetter<T>(p: MaybeGetter<T>): Promise<T>;
218
- declare function resolveColorReplacements(theme: ThemeRegistrationAny | string, options?: TokenizeWithThemeOptions): {
219
- [x: string]: string;
220
- };
221
- declare function applyColorReplacements(color: string, replacements?: Record<string, string>): string;
222
- declare function applyColorReplacements(color?: string | undefined, replacements?: Record<string, string>): string | undefined;
218
+ declare function resolveColorReplacements(theme: ThemeRegistrationAny | string, options?: TokenizeWithThemeOptions): Record<string, string | undefined>;
219
+ declare function applyColorReplacements(color: string, replacements?: Record<string, string | undefined>): string;
220
+ declare function applyColorReplacements(color?: string | undefined, replacements?: Record<string, string | undefined>): string | undefined;
223
221
  declare function getTokenStyleObject(token: TokenStyles): Record<string, string>;
224
222
  declare function stringifyTokenStyle(token: Record<string, string>): string;
225
223
  /**
package/dist/index.mjs CHANGED
@@ -1110,7 +1110,8 @@ function tokensToHast(tokens, options, transformerContext) {
1110
1110
  children: []
1111
1111
  };
1112
1112
  const {
1113
- structure = "classic"
1113
+ structure = "classic",
1114
+ tabindex = "0"
1114
1115
  } = options;
1115
1116
  let preNode = {
1116
1117
  type: "element",
@@ -1118,7 +1119,9 @@ function tokensToHast(tokens, options, transformerContext) {
1118
1119
  properties: {
1119
1120
  class: `shiki ${options.themeName || ""}`,
1120
1121
  style: options.rootStyle || `background-color:${options.bg};color:${options.fg}`,
1121
- tabindex: "0",
1122
+ ...tabindex !== false && tabindex != null ? {
1123
+ tabindex: tabindex.toString()
1124
+ } : {},
1122
1125
  ...Object.fromEntries(
1123
1126
  Array.from(
1124
1127
  Object.entries(options.meta || {})
@@ -1654,7 +1657,7 @@ function createShikiInternalSync(options) {
1654
1657
  async function loadLanguage(...langs2) {
1655
1658
  return loadLanguageSync(await resolveLangs(langs2));
1656
1659
  }
1657
- async function loadThemeSync(...themes2) {
1660
+ function loadThemeSync(...themes2) {
1658
1661
  ensureNotDisposed();
1659
1662
  for (const theme of themes2.flat(1)) {
1660
1663
  _registry.loadTheme(theme);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@shikijs/core",
3
3
  "type": "module",
4
- "version": "1.17.6",
4
+ "version": "1.17.7",
5
5
  "description": "Core of Shiki",
6
6
  "author": "Pine Wu <octref@gmail.com>; Anthony Fu <anthonyfu117@hotmail.com>",
7
7
  "license": "MIT",
@@ -63,9 +63,9 @@
63
63
  "@shikijs/vscode-textmate": "^9.2.2",
64
64
  "@types/hast": "^3.0.4",
65
65
  "hast-util-to-html": "^9.0.2",
66
- "@shikijs/engine-oniguruma": "1.17.6",
67
- "@shikijs/types": "1.17.6",
68
- "@shikijs/engine-javascript": "1.17.6"
66
+ "@shikijs/engine-javascript": "1.17.7",
67
+ "@shikijs/types": "1.17.7",
68
+ "@shikijs/engine-oniguruma": "1.17.7"
69
69
  },
70
70
  "scripts": {
71
71
  "build": "unbuild",