@pecot/visual-mcp 1.2.0 → 1.3.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.
Files changed (126) hide show
  1. package/.claude-plugin/plugin.json +1 -1
  2. package/assets/slidev/deck-lint.config.js +2 -2
  3. package/assets/slidev/deck-lint.env.config.js +2 -2
  4. package/assets/slidev/package.json +1 -1
  5. package/assets/slidev/scripts/eslint/_shared/dist/lib/drawio-geometry.js +10 -10
  6. package/assets/slidev/scripts/eslint/_shared/dist/lib/text-measurer.d.ts +2 -2
  7. package/assets/slidev/scripts/eslint/_shared/dist/lib/text-measurer.js +4 -4
  8. package/assets/slidev/scripts/eslint/_shared/dist/tsconfig.tsbuildinfo +1 -1
  9. package/assets/slidev/scripts/eslint/_shared/lib/drawio-geometry.ts +10 -10
  10. package/assets/slidev/scripts/eslint/_shared/lib/text-measurer.ts +4 -4
  11. package/assets/slidev/scripts/eslint/slidev-pages-lint/dist/lib/rules/no-content-before-frontmatter.js +1 -1
  12. package/assets/slidev/scripts/eslint/slidev-pages-lint/dist/lib/rules/no-missing-marker-cell.js +4 -4
  13. package/assets/slidev/scripts/eslint/slidev-pages-lint/dist/lib/rules/no-missing-page.js +1 -1
  14. package/assets/slidev/scripts/eslint/slidev-pages-lint/dist/lib/rules/no-numeric-asset-prefix.js +1 -1
  15. package/assets/slidev/scripts/eslint/slidev-pages-lint/dist/lib/rules/no-numeric-filename-prefix.js +1 -1
  16. package/assets/slidev/scripts/eslint/slidev-pages-lint/dist/lib/rules/no-scaled-drawio.js +3 -3
  17. package/assets/slidev/scripts/eslint/slidev-pages-lint/dist/lib/rules/no-triple-hyphen-in-frontmatter.js +3 -3
  18. package/assets/slidev/scripts/eslint/slidev-pages-lint/dist/lib/rules/no-unknown-props.js +3 -3
  19. package/assets/slidev/scripts/eslint/slidev-pages-lint/dist/lib/rules/one-slide-per-file.js +1 -1
  20. package/assets/slidev/scripts/eslint/slidev-pages-lint/dist/lib/rules/require-matching-length.js +1 -1
  21. package/assets/slidev/scripts/eslint/slidev-pages-lint/dist/lib/rules/require-slides-entry.js +1 -1
  22. package/assets/slidev/scripts/eslint/slidev-pages-lint/dist/lib/rules/validate-clicks.js +7 -7
  23. package/assets/slidev/scripts/eslint/slidev-pages-lint/dist/tsconfig.tsbuildinfo +1 -1
  24. package/assets/slidev/scripts/eslint/slidev-pages-lint/lib/rules/no-content-before-frontmatter.ts +1 -1
  25. package/assets/slidev/scripts/eslint/slidev-pages-lint/lib/rules/no-missing-marker-cell.ts +4 -4
  26. package/assets/slidev/scripts/eslint/slidev-pages-lint/lib/rules/no-missing-page.ts +1 -1
  27. package/assets/slidev/scripts/eslint/slidev-pages-lint/lib/rules/no-numeric-asset-prefix.ts +1 -1
  28. package/assets/slidev/scripts/eslint/slidev-pages-lint/lib/rules/no-numeric-filename-prefix.ts +1 -1
  29. package/assets/slidev/scripts/eslint/slidev-pages-lint/lib/rules/no-scaled-drawio.ts +3 -3
  30. package/assets/slidev/scripts/eslint/slidev-pages-lint/lib/rules/no-triple-hyphen-in-frontmatter.ts +3 -3
  31. package/assets/slidev/scripts/eslint/slidev-pages-lint/lib/rules/no-unknown-props.ts +3 -3
  32. package/assets/slidev/scripts/eslint/slidev-pages-lint/lib/rules/one-slide-per-file.ts +1 -1
  33. package/assets/slidev/scripts/eslint/slidev-pages-lint/lib/rules/require-matching-length.ts +1 -1
  34. package/assets/slidev/scripts/eslint/slidev-pages-lint/lib/rules/require-slides-entry.ts +1 -1
  35. package/assets/slidev/scripts/eslint/slidev-pages-lint/lib/rules/validate-clicks.ts +7 -7
  36. package/assets/slidev/scripts/eslint/text-constraints/dist/lib/rules/max-chars.js +6 -6
  37. package/assets/slidev/scripts/eslint/text-constraints/dist/lib/rules/textlint-body.js +3 -3
  38. package/assets/slidev/scripts/eslint/text-constraints/dist/lib/rules/textlint.js +2 -2
  39. package/assets/slidev/scripts/eslint/text-constraints/dist/tsconfig.tsbuildinfo +1 -1
  40. package/assets/slidev/scripts/eslint/text-constraints/lib/rules/max-chars.ts +6 -6
  41. package/assets/slidev/scripts/eslint/text-constraints/lib/rules/textlint-body.ts +3 -3
  42. package/assets/slidev/scripts/eslint/text-constraints/lib/rules/textlint.ts +2 -2
  43. package/assets/slidev/scripts/eslint/validate-references/dist/index.js +1 -1
  44. package/assets/slidev/scripts/eslint/validate-references/dist/lib/semantic-validator.js +12 -12
  45. package/assets/slidev/scripts/eslint/validate-references/dist/tsconfig.tsbuildinfo +1 -1
  46. package/assets/slidev/scripts/eslint/validate-references/index.ts +1 -1
  47. package/assets/slidev/scripts/eslint/validate-references/lib/semantic-validator.ts +12 -12
  48. package/cli/dist/cli.js +8 -8
  49. package/cli/dist/commands/chromium/host-dependencies.js +3 -3
  50. package/cli/dist/commands/drawio/export.js +15 -15
  51. package/cli/dist/commands/drawio/theme.js +7 -7
  52. package/cli/dist/commands/drawio/url.js +14 -14
  53. package/cli/dist/commands/evidence-xlsx/create.js +11 -11
  54. package/cli/dist/commands/pptx-ooxml/preview.js +13 -13
  55. package/cli/dist/commands/slidev-project/create.js +12 -12
  56. package/cli/dist/commands/slidev-project/linked-theme.js +5 -5
  57. package/cli/dist/commands/slidev-project/lint.js +13 -13
  58. package/cli/dist/commands/slidev-project/sync.js +19 -19
  59. package/cli/dist/commands/slidev-project/theme.js +9 -9
  60. package/cli/dist/commands/slidev-to-pptx/convert.js +47 -47
  61. package/cli/dist/domain/_shared/text-check.js +2 -2
  62. package/cli/dist/domain/drawio/export.js +4 -4
  63. package/cli/dist/domain/drawio/label-text.js +1 -1
  64. package/cli/dist/domain/drawio/url.js +27 -27
  65. package/cli/dist/domain/evidence-xlsx/image-dimensions.js +14 -14
  66. package/cli/dist/domain/evidence-xlsx/spec-schema.js +26 -26
  67. package/cli/dist/domain/pptx-ooxml/merge.js +3 -3
  68. package/cli/dist/domain/slidev-project/generated-files.d.ts +1 -1
  69. package/cli/dist/domain/slidev-project/generated-files.js +34 -34
  70. package/cli/dist/domain/slidev-project/initial-pages.js +4 -4
  71. package/cli/dist/domain/slidev-project/lint.js +11 -11
  72. package/cli/dist/domain/slidev-project/sync.js +13 -13
  73. package/cli/dist/domain/slidev-project/warnings.js +4 -4
  74. package/cli/dist/domain/slidev-theme/declaration.js +9 -9
  75. package/cli/dist/domain/slidev-theme/references.js +10 -10
  76. package/cli/dist/domain/slidev-theme/store-layout.js +6 -6
  77. package/cli/dist/domain/slidev-theme/talk-theme.js +13 -13
  78. package/cli/dist/domain/slidev-theme/theme-spec.js +5 -5
  79. package/cli/dist/domain/slidev-to-pptx/errors.js +3 -3
  80. package/cli/dist/infra/_shared/dependency-root.js +4 -4
  81. package/cli/dist/infra/_shared/patch-apply.js +6 -5
  82. package/cli/dist/infra/_shared/runtime-install.js +4 -3
  83. package/cli/dist/infra/_shared/slidev-bin.js +1 -1
  84. package/cli/dist/infra/drawio/icons.js +3 -3
  85. package/cli/dist/infra/drawio/pdf.js +1 -1
  86. package/cli/dist/infra/drawio/screenshot.js +10 -9
  87. package/cli/dist/infra/evidence-xlsx/workbook-writer.js +2 -2
  88. package/cli/dist/infra/playwright/chromium.js +4 -3
  89. package/cli/dist/infra/playwright/host-dependencies.js +8 -8
  90. package/cli/dist/infra/playwright/launch.js +5 -5
  91. package/cli/dist/infra/pptx-ooxml/soffice.js +2 -2
  92. package/cli/dist/infra/slidev-project/eslint-runner.js +10 -9
  93. package/cli/dist/infra/slidev-project/fs.js +6 -6
  94. package/cli/dist/infra/slidev-theme/store.js +18 -15
  95. package/cli/dist/infra/slidev-to-pptx/cache-store.js +6 -6
  96. package/cli/dist/infra/slidev-to-pptx/dom-converter.js +12 -12
  97. package/cli/dist/infra/slidev-to-pptx/pipeline.d.ts +1 -1
  98. package/cli/dist/infra/slidev-to-pptx/pipeline.js +54 -54
  99. package/cli/dist/infra/slidev-to-pptx/prerender-capture.js +14 -14
  100. package/cli/dist/infra/slidev-to-pptx/prerender.js +10 -10
  101. package/cli/dist/infra/slidev-to-pptx/runner.js +1 -0
  102. package/cli/dist/infra/slidev-to-pptx/scanner.js +10 -10
  103. package/cli/dist/infra/slidev-to-pptx/server.js +2 -2
  104. package/cli/dist/infra/slidev-to-pptx/single-pass-worker.js +39 -39
  105. package/cli/dist/infra/slidev-to-pptx/slide-worker.js +3 -3
  106. package/cli/dist/infra/slidev-to-pptx/visibility-helpers.js +8 -8
  107. package/cli/dist/mcp/dev-server-registry.js +10 -9
  108. package/cli/dist/mcp/queue.js +1 -1
  109. package/cli/dist/mcp/result.js +4 -4
  110. package/cli/dist/mcp/serve.js +1 -1
  111. package/cli/dist/mcp/server.js +2 -2
  112. package/cli/dist/mcp/tools/_shared.d.ts +1 -1
  113. package/cli/dist/mcp/tools/_shared.js +36 -37
  114. package/cli/dist/mcp/tools/drawio.js +22 -22
  115. package/cli/dist/mcp/tools/evidence.js +8 -8
  116. package/cli/dist/mcp/tools/setup.js +26 -26
  117. package/cli/dist/mcp/tools/slide-dev.js +20 -20
  118. package/cli/dist/mcp/tools/slide-page.js +36 -36
  119. package/cli/dist/mcp/tools/slide-theme.js +6 -6
  120. package/cli/dist/mcp/tools/slide.js +49 -49
  121. package/cli/dist/mcp/windows-path.js +8 -7
  122. package/cli/dist/node-runtime.d.ts +6 -1
  123. package/cli/dist/node-runtime.js +16 -8
  124. package/npm-shrinkwrap.json +3 -3
  125. package/package.json +2 -2
  126. package/vendor/text-rules/dist/source-hash +1 -1
@@ -113,7 +113,7 @@ export function validateHtml(xml) {
113
113
  const styleAttribute = attributeValue(cell, 'style') ?? '';
114
114
  // ルール2: シングルクォート属性値検出(生 XML 値で確認)
115
115
  for (const sq of rawValue.matchAll(SINGLE_QUOTE_ATTR_REGEX)) {
116
- warn(`mxCell id=${cellId}: シングルクォート属性値を検出 — ${sq[0]}。" によるダブルクォートを使用してください`);
116
+ warn(`mxCell id=${cellId}: single-quoted attribute value: ${sq[0]} (fix: use double quotes as ")`);
117
117
  }
118
118
  // xmldom の getAttribute() は既に entity デコード済 string を返すため、
119
119
  // Python `html.unescape` 相当の二重デコードは不要。
@@ -128,7 +128,7 @@ export function validateHtml(xml) {
128
128
  if (FONT_ALLOWED_ATTRS.has(attributeName))
129
129
  continue;
130
130
  const sortedAllowed = [...FONT_ALLOWED_ATTRS].toSorted((a, b) => a.localeCompare(b)).join(', ');
131
- warn(`mxCell id=${cellId}: <font> の非対応属性 '${attributeName}' を検出。対応属性: ${sortedAllowed}`);
131
+ warn(`mxCell id=${cellId}: unsupported <font> attribute: ${attributeName} (supported: ${sortedAllowed})`);
132
132
  }
133
133
  }
134
134
  // ルール3: fontColor 二重指定検出
@@ -148,7 +148,7 @@ export function validateHtml(xml) {
148
148
  /* c8 ignore next -- FONT_COLOR_VALUE_REGEX は group(1) を必ずキャプチャする。空文字の右辺は到達不能 */
149
149
  const htmlColor = (colorMatch[1] ?? '').trim().toLowerCase();
150
150
  if (htmlColor === fontColorStyle) {
151
- note(`mxCell id=${cellId}: <font color="${htmlColor}"> と style fontColor=${fontColorStyle} が同一値で二重指定されています`);
151
+ note(`mxCell id=${cellId}: <font color="${htmlColor}"> and style fontColor=${fontColorStyle} specify the same value twice`);
152
152
  }
153
153
  }
154
154
  }
@@ -190,7 +190,7 @@ export function validateWhitespaceWrap(xml) {
190
190
  .replaceAll('\r', String.raw `\r`)
191
191
  .replaceAll('\n', String.raw `\n`);
192
192
  const ellipsis = graphemes.length > 20 ? '…' : '';
193
- warn(`mxCell id=${cellId}: 折り返しが必要な value (日本語/改行を含む) ですが style に whiteSpace=wrap がありません — value 先頭: "${preview}${ellipsis}"。style に whiteSpace=wrap を付けてください`);
193
+ warn(`mxCell id=${cellId}: value needs wrapping (contains Japanese text or line breaks) but style has no whiteSpace=wrap; value starts with: "${preview}${ellipsis}" (fix: add whiteSpace=wrap to style)`);
194
194
  }
195
195
  return findings;
196
196
  }
@@ -212,7 +212,7 @@ const FALLBACK_GENERIC_FONT = 'sans-serif';
212
212
  文言に書く確認元。テーマ名があれば「テーマの書体(名前)」、無ければ「既定の書体」。
213
213
  */
214
214
  function fontSourceLabel(themeName) {
215
- return themeName === undefined ? '既定の書体' : `テーマの書体(${themeName})`;
215
+ return themeName === undefined ? 'the default font' : `the theme font (${themeName})`;
216
216
  }
217
217
  /**
218
218
  直し方に書く fontFamily の値。body と eastAsian の重複(大文字小文字を除く)を除いて `, ` でつなぐ。
@@ -235,9 +235,9 @@ function fontFamilyAdvice(fonts) {
235
235
  }
236
236
  function fontSizeGuide(sizes) {
237
237
  const values = [sizes.heading, sizes.headingSm, sizes.body, sizes.bodySm, sizes.label];
238
- const roles = `見出し ${String(sizes.heading)}・小見出し ${String(sizes.headingSm)}・本文 ${String(sizes.body)}`
239
- + `・補足 ${String(sizes.bodySm)}・ラベル ${String(sizes.label)}`;
240
- return `使えるサイズは ${values.map(String).join('・')}px の 5 つだけです(${roles})`;
238
+ const roles = `heading ${String(sizes.heading)}, subheading ${String(sizes.headingSm)}, body ${String(sizes.body)}`
239
+ + `, caption ${String(sizes.bodySm)}, label ${String(sizes.label)}`;
240
+ return `only these 5 sizes are allowed: ${values.map(String).join(', ')} px (${roles})`;
241
241
  }
242
242
  // draw.io は fontSize 未指定のセルを 11px で描く
243
243
  const DRAWIO_DEFAULT_FONT_SIZE = 11;
@@ -412,7 +412,7 @@ function initialState(style) {
412
412
  fontSizeAttribute: undefined,
413
413
  };
414
414
  }
415
- const SHORTHAND_WARNING = 'CSS の font 一括指定の書体とサイズを読み取れません。使わずに font-family と font-size を個別に指定してください';
415
+ const SHORTHAND_WARNING = 'cannot read the font and size from the CSS font shorthand (fix: specify font-family and font-size separately)';
416
416
  /**
417
417
  図の文字の書体がテーマの宣言の書体から外れる
418
418
  mxCell への警告メッセージ配列を返す。
@@ -446,11 +446,11 @@ export function validateSlideFonts(xml, fonts, themeName) {
446
446
  }
447
447
  const offTheme = runs.find(run => run.font?.[0] === undefined || !allowed.has(run.font[0]));
448
448
  if (offTheme !== undefined) {
449
- const actual = offTheme.font?.[0] === undefined ? '書体指定なし(draw.io 既定の Helvetica)' : `先頭書体「${offTheme.font[0]}」`;
449
+ const actual = offTheme.font?.[0] === undefined ? 'no font specified (draw.io default is Helvetica)' : `first font ${offTheme.font[0]}`;
450
450
  const fix = offTheme.fontSource === 'html'
451
- ? `value 内の font-family 指定(<font face> や style の font-family)を消してください。書体はセルの style の fontFamily=${advice} に任せます`
452
- : `style に fontFamily=${advice} を付けてください`;
453
- warn(`${prefix} ${actual}の文字列が${label}ではありません — "${offTheme.text}"。図の文字は${label}で組みます。${fix}`);
451
+ ? `remove font-family in value (<font face> or style font-family) and leave the font to fontFamily=${advice} in the cell style`
452
+ : `add fontFamily=${advice} to style`;
453
+ warn(`${prefix} ${actual} is not in ${label}: "${offTheme.text}"; diagram text is set in ${label} (fix: ${fix})`);
454
454
  }
455
455
  if (eastAsian === undefined || fonts.eastAsian === undefined)
456
456
  continue;
@@ -458,9 +458,9 @@ export function validateSlideFonts(xml, fonts, themeName) {
458
458
  if (missingJapanese === undefined)
459
459
  continue;
460
460
  const fix = missingJapanese.fontSource === 'html'
461
- ? `value 内の font-family 指定(<font face> や style の font-family)を消すか ${advice} にしてください`
462
- : `fontFamily を ${advice} にしてください`;
463
- warn(`${prefix} 和文を含む文字列の書体の並びに ${fonts.eastAsian} がありません — "${missingJapanese.text}"。和文が代替書体で描かれます。${fix}`);
461
+ ? `remove font-family in value (<font face> or style font-family) or set it to ${advice}`
462
+ : `set fontFamily to ${advice}`;
463
+ warn(`${prefix} font list for text containing Japanese has no ${fonts.eastAsian}: "${missingJapanese.text}"; Japanese is drawn in a fallback font (fix: ${fix})`);
464
464
  }
465
465
  return findings;
466
466
  }
@@ -480,12 +480,12 @@ function offSlideSizes(runs, steps) {
480
480
  }
481
481
  function sizeCause(label, run) {
482
482
  if (run.fontSizeAttribute !== undefined)
483
- return `${label} は使えません`;
483
+ return `${label} is not allowed`;
484
484
  if (Number.isNaN(run.size.px))
485
- return `文字サイズ ${label} は px 以外の指定です。px で指定してください`;
485
+ return `font size ${label} is not in px (fix: specify it in px)`;
486
486
  if (run.sizeSource === 'none')
487
- return 'fontSize 未指定(draw.io 既定の 11px)です';
488
- return `文字サイズ ${label} はテーマの規定外です`;
487
+ return 'fontSize is not set (draw.io default is 11px)';
488
+ return `font size ${label} is not a theme size`;
489
489
  }
490
490
  /**
491
491
  図の文字の大きさがテーマの宣言の 5 段(`fontSizes`)から外れる mxCell への、警告メッセージ配列を返す。
@@ -508,9 +508,9 @@ export function validateSlideFontSizes(xml, sizes) {
508
508
  const { runs } = walkText(cell.text, initialState(cell.style));
509
509
  for (const [label, run] of offSlideSizes(runs, steps)) {
510
510
  const fix = run.sizeSource === 'html' || run.fontSizeAttribute !== undefined
511
- ? 'value 内の font-size 指定(<font size> や style の font-size)を消し、セルの style に fontSize=<サイズ> を付けてください'
512
- : 'style に fontSize=<サイズ> を付けてください';
513
- warn(`mxCell id=${cell.id}: ${sizeCause(label, run)} — "${run.text}"。${guide}。${fix}`);
511
+ ? 'remove font-size in value (<font size> or style font-size) and add fontSize=<size> to the cell style'
512
+ : 'add fontSize=<size> to style';
513
+ warn(`mxCell id=${cell.id}: ${sizeCause(label, run)}: "${run.text}"; ${guide} (fix: ${fix})`);
514
514
  }
515
515
  }
516
516
  return findings;
@@ -662,15 +662,15 @@ export function renderRedirectHtml(url) {
662
662
  const escaped = escapeHtmlAttribute(url);
663
663
  return [
664
664
  '<!doctype html>',
665
- '<html lang="ja">',
665
+ '<html lang="en">',
666
666
  '<head>',
667
667
  '<meta charset="utf-8">',
668
668
  `<meta http-equiv="refresh" content="0;url=${escaped}">`,
669
- '<title>draw.io ダイアグラム</title>',
669
+ '<title>draw.io diagram</title>',
670
670
  '</head>',
671
671
  '<body>',
672
- '<p>draw.io でダイアグラムを開いています。自動で開かない場合は次のリンクをクリックしてください。</p>',
673
- `<p><a id="target" href="${escaped}">draw.io でダイアグラムを開く</a></p>`,
672
+ '<p>Opening the diagram in draw.io. If it does not open automatically, click the link below.</p>',
673
+ `<p><a id="target" href="${escaped}">Open the diagram in draw.io</a></p>`,
674
674
  `<script>location.replace(document.getElementById('target').href)</script>`,
675
675
  '</body>',
676
676
  '</html>',
@@ -48,7 +48,7 @@ bytes) {
48
48
  return {
49
49
  ok: false,
50
50
  reason: 'unsupported-format',
51
- message: `PNG / JPEG のシグネチャに一致しません (先頭 ${describeHead(view)})`,
51
+ message: `not a PNG or JPEG signature (head: ${describeHead(view)})`,
52
52
  };
53
53
  }
54
54
  function hasPngSignature(view) {
@@ -61,14 +61,14 @@ function hasJpegSignature(view) {
61
61
  }
62
62
  function readPngDimensions(view) {
63
63
  if (view.byteLength < PNG_MINIMUM_LENGTH) {
64
- return unreadable(`PNG の IHDR まで届きません (${view.byteLength.toString()} バイト)`);
64
+ return unreadable(`PNG ends before IHDR (${view.byteLength.toString()} bytes)`);
65
65
  }
66
66
  if (view.getUint32(12) !== PNG_IHDR_TYPE) {
67
- return unreadable('PNG の第 1 チャンクが IHDR ではありません');
67
+ return unreadable('first PNG chunk is not IHDR');
68
68
  }
69
69
  const width = view.getUint32(16);
70
70
  const height = view.getUint32(20);
71
- return width === 0 || height === 0 ? unreadable(`PNG の IHDR 寸法が 0 です (${width.toString()}x${height.toString()})`) : { ok: true, format: 'png', width, height };
71
+ return width === 0 || height === 0 ? unreadable(`PNG IHDR size is 0 (${width.toString()}x${height.toString()})`) : { ok: true, format: 'png', width, height };
72
72
  }
73
73
  function readJpegDimensions(view) {
74
74
  // 走査範囲は入力長そのものが上限。1 周ごとに index はマーカー分の 2 バイト以上進むため、
@@ -76,14 +76,14 @@ function readJpegDimensions(view) {
76
76
  let index = 2;
77
77
  while (index < view.byteLength) {
78
78
  if (view.getUint8(index) !== MARKER_PREFIX) {
79
- return unreadable(`JPEG のマーカー境界が不正です (offset ${index.toString()})`);
79
+ return unreadable(`invalid JPEG marker boundary (offset ${index.toString()})`);
80
80
  }
81
81
  index += 1;
82
82
  // マーカー直前の連続 0xFF は fill バイトなので読み飛ばす。
83
83
  while (index < view.byteLength && view.getUint8(index) === MARKER_PREFIX)
84
84
  index += 1;
85
85
  if (index >= view.byteLength) {
86
- return unreadable('JPEG がマーカーの途中で終端しています');
86
+ return unreadable('JPEG ends in the middle of a marker');
87
87
  }
88
88
  const marker = view.getUint8(index);
89
89
  index += 1;
@@ -94,30 +94,30 @@ function readJpegDimensions(view) {
94
94
  }
95
95
  // SOS 以降はエントロピー符号化データで、SOF はもう現れない。
96
96
  if (marker === MARKER_SOS) {
97
- return unreadable('JPEG に SOF セグメントがありません (SOS に到達)');
97
+ return unreadable('no SOF segment in JPEG (reached SOS)');
98
98
  }
99
99
  if (marker === MARKER_EOI) {
100
- return unreadable('JPEG に SOF セグメントがありません (EOI に到達)');
100
+ return unreadable('no SOF segment in JPEG (reached EOI)');
101
101
  }
102
102
  if (index + 2 > view.byteLength) {
103
- return unreadable('JPEG のセグメント長フィールドが欠けています');
103
+ return unreadable('JPEG segment length field is missing');
104
104
  }
105
105
  const segmentLength = view.getUint16(index);
106
106
  // 長さフィールド自身の 2 バイトを含む値なので 2 未満は破損。
107
107
  if (segmentLength < 2) {
108
- return unreadable(`JPEG のセグメント長が不正です (${segmentLength.toString()})`);
108
+ return unreadable(`invalid JPEG segment length (${segmentLength.toString()})`);
109
109
  }
110
110
  if ([MARKER_SOF0, MARKER_SOF1, MARKER_SOF2].includes(marker)) {
111
111
  if (segmentLength < JPEG_SOF_MINIMUM_LENGTH || index + JPEG_SOF_MINIMUM_LENGTH > view.byteLength) {
112
- return unreadable('JPEG の SOF セグメントが寸法の手前で切れています');
112
+ return unreadable('JPEG SOF segment is cut off before the size');
113
113
  }
114
114
  const height = view.getUint16(index + 3);
115
115
  const width = view.getUint16(index + 5);
116
- return width === 0 || height === 0 ? unreadable(`JPEG の SOF 寸法が 0 です (${width.toString()}x${height.toString()})`) : { ok: true, format: 'jpeg', width, height };
116
+ return width === 0 || height === 0 ? unreadable(`JPEG SOF size is 0 (${width.toString()}x${height.toString()})`) : { ok: true, format: 'jpeg', width, height };
117
117
  }
118
118
  index += segmentLength;
119
119
  }
120
- return unreadable('JPEG に SOF セグメントがありません');
120
+ return unreadable('no SOF segment in JPEG');
121
121
  }
122
122
  function unreadable(message) {
123
123
  return { ok: false, reason: 'unreadable', message };
@@ -131,6 +131,6 @@ function describeHead(view) {
131
131
  for (let index = 0; index < limit; index += 1) {
132
132
  parts.push(view.getUint8(index).toString(16).padStart(2, '0'));
133
133
  }
134
- return parts.length === 0 ? '(空)' : parts.join(' ');
134
+ return parts.length === 0 ? '(empty)' : parts.join(' ');
135
135
  }
136
136
  //# sourceMappingURL=image-dimensions.js.map
@@ -26,7 +26,7 @@ export function parseEvidenceSpec(value) {
26
26
  errors.push({ path: pointer, message });
27
27
  };
28
28
  if (!isRecord(value)) {
29
- addError('', 'EvidenceSpec は object である必要があります');
29
+ addError('', 'EvidenceSpec must be an object');
30
30
  return { ok: false, errors };
31
31
  }
32
32
  collectUnknownKeys(value, SPEC_KEYS, '', addError);
@@ -54,13 +54,13 @@ function joinPointer(base, key) {
54
54
  function collectUnknownKeys(record, allowed, pointer, addError) {
55
55
  for (const key of Object.keys(record)) {
56
56
  if (!allowed.has(key)) {
57
- addError(joinPointer(pointer, key), '未知のキーです');
57
+ addError(joinPointer(pointer, key), 'unknown key');
58
58
  }
59
59
  }
60
60
  }
61
61
  function parseString(value, pointer, addError) {
62
62
  if (typeof value !== 'string') {
63
- addError(pointer, '文字列である必要があります');
63
+ addError(pointer, 'must be a string');
64
64
  return undefined;
65
65
  }
66
66
  return value;
@@ -71,7 +71,7 @@ function parseNonEmptyString(value, pointer, addError) {
71
71
  return undefined;
72
72
  }
73
73
  if (text === '') {
74
- addError(pointer, '空文字列は許可されていません');
74
+ addError(pointer, 'must not be empty');
75
75
  return undefined;
76
76
  }
77
77
  return text;
@@ -82,11 +82,11 @@ function parseCreatedDate(value, addError) {
82
82
  return undefined;
83
83
  }
84
84
  if (!CREATED_DATE_PATTERN.test(text)) {
85
- addError('createdDate', `YYYY-MM-DD 形式である必要があります (値: ${text})`);
85
+ addError('createdDate', `must be in YYYY-MM-DD format: ${text}`);
86
86
  return undefined;
87
87
  }
88
88
  if (!isCalendarDate(text)) {
89
- addError('createdDate', `暦に存在しない日付です (値: ${text})`);
89
+ addError('createdDate', `not a valid calendar date: ${text}`);
90
90
  return undefined;
91
91
  }
92
92
  return text;
@@ -111,7 +111,7 @@ function parseExtraHeaders(value, addError) {
111
111
  return [];
112
112
  }
113
113
  if (!isUnknownArray(value)) {
114
- addError('extraHeaders', '配列である必要があります');
114
+ addError('extraHeaders', 'must be an array');
115
115
  return undefined;
116
116
  }
117
117
  const result = [];
@@ -129,7 +129,7 @@ function parseExtraHeaders(value, addError) {
129
129
  }
130
130
  function parseHeaderField(value, pointer, addError) {
131
131
  if (!isRecord(value)) {
132
- addError(pointer, 'object である必要があります');
132
+ addError(pointer, 'must be an object');
133
133
  return undefined;
134
134
  }
135
135
  collectUnknownKeys(value, HEADER_FIELD_KEYS, pointer, addError);
@@ -142,15 +142,15 @@ function parseItems(value, addError) {
142
142
  // 欠落と型不一致は原因が別 (スキル側で項目を組み立て忘れたか、値を作り間違えたか) なので
143
143
  // メッセージを分ける。
144
144
  if (value === undefined) {
145
- addError('items', '必須です');
145
+ addError('items', 'is required');
146
146
  return undefined;
147
147
  }
148
148
  if (!isUnknownArray(value)) {
149
- addError('items', '配列である必要があります');
149
+ addError('items', 'must be an array');
150
150
  return undefined;
151
151
  }
152
152
  if (value.length === 0) {
153
- addError('items', '1 件以上必要です');
153
+ addError('items', 'must have at least one item');
154
154
  return undefined;
155
155
  }
156
156
  const result = [];
@@ -167,7 +167,7 @@ function parseItems(value, addError) {
167
167
  }
168
168
  function parseItem(value, pointer, addError) {
169
169
  if (!isRecord(value)) {
170
- addError(pointer, 'object である必要があります');
170
+ addError(pointer, 'must be an object');
171
171
  return undefined;
172
172
  }
173
173
  collectUnknownKeys(value, ITEM_KEYS, pointer, addError);
@@ -212,7 +212,7 @@ function parseAnnotations(value, itemPointer, addError) {
212
212
  }
213
213
  const pointer = `${itemPointer}.annotations`;
214
214
  if (!isUnknownArray(value)) {
215
- addError(pointer, '配列である必要があります');
215
+ addError(pointer, 'must be an array');
216
216
  return undefined;
217
217
  }
218
218
  const result = [];
@@ -229,12 +229,12 @@ function parseAnnotations(value, itemPointer, addError) {
229
229
  }
230
230
  function parseAnnotation(value, pointer, addError) {
231
231
  if (!isRecord(value)) {
232
- addError(pointer, 'object である必要があります');
232
+ addError(pointer, 'must be an object');
233
233
  return undefined;
234
234
  }
235
235
  const type = value['type'];
236
236
  if (typeof type !== 'string') {
237
- addError(`${pointer}.type`, '文字列である必要があります');
237
+ addError(`${pointer}.type`, 'must be a string');
238
238
  return undefined;
239
239
  }
240
240
  switch (type) {
@@ -248,7 +248,7 @@ function parseAnnotation(value, pointer, addError) {
248
248
  return parseArrow(value, pointer, addError);
249
249
  }
250
250
  default: {
251
- addError(`${pointer}.type`, `未知の注記種別です (値: ${type})`);
251
+ addError(`${pointer}.type`, `unknown annotation type: ${type}`);
252
252
  return undefined;
253
253
  }
254
254
  }
@@ -271,7 +271,7 @@ function parseCalloutText(value, pointer, addError) {
271
271
  return undefined;
272
272
  }
273
273
  if (NEWLINE_PATTERN.test(text)) {
274
- addError(pointer, 'callout の text に改行は含められません');
274
+ addError(pointer, 'callout text must not contain a line break');
275
275
  return undefined;
276
276
  }
277
277
  return text;
@@ -285,11 +285,11 @@ function parseHighlight(record, pointer, addError) {
285
285
  // 面積 0 の枠は描画されないので、どちらの辺が潰れているかをフィールド粒度で返す。
286
286
  let isDegenerate = false;
287
287
  if (box.w <= 0) {
288
- addError(`${pointer}.box.w`, `highlight の box は w > 0 である必要があります (値: ${box.w.toString()})`);
288
+ addError(`${pointer}.box.w`, `highlight box w must be > 0: ${box.w.toString()}`);
289
289
  isDegenerate = true;
290
290
  }
291
291
  if (box.h <= 0) {
292
- addError(`${pointer}.box.h`, `highlight の box は h > 0 である必要があります (値: ${box.h.toString()})`);
292
+ addError(`${pointer}.box.h`, `highlight box h must be > 0: ${box.h.toString()}`);
293
293
  isDegenerate = true;
294
294
  }
295
295
  return isDegenerate ? undefined : { type: 'highlight', box };
@@ -302,14 +302,14 @@ function parseArrow(record, pointer, addError) {
302
302
  return undefined;
303
303
  }
304
304
  if (from.x === to.x && from.y === to.y) {
305
- addError(pointer, 'arrow の from と to が同一座標です');
305
+ addError(pointer, 'arrow from and to must not be the same point');
306
306
  return undefined;
307
307
  }
308
308
  return { type: 'arrow', from, to };
309
309
  }
310
310
  function parsePoint(value, pointer, addError) {
311
311
  if (!isRecord(value)) {
312
- addError(pointer, 'object である必要があります');
312
+ addError(pointer, 'must be an object');
313
313
  return undefined;
314
314
  }
315
315
  collectUnknownKeys(value, POINT_KEYS, pointer, addError);
@@ -319,7 +319,7 @@ function parsePoint(value, pointer, addError) {
319
319
  }
320
320
  function parseRect(value, pointer, addError) {
321
321
  if (!isRecord(value)) {
322
- addError(pointer, 'object である必要があります');
322
+ addError(pointer, 'must be an object');
323
323
  return undefined;
324
324
  }
325
325
  collectUnknownKeys(value, RECT_KEYS, pointer, addError);
@@ -335,11 +335,11 @@ function parseRect(value, pointer, addError) {
335
335
  // 2〜4 桁小数では偽陽性が出ず、入れると真のはみ出しを通してしまう。
336
336
  let isOverflow = false;
337
337
  if (x + w > 1) {
338
- addError(`${pointer}.w`, `x + w が 1 を超えます (x: ${x.toString()}, w: ${w.toString()})`);
338
+ addError(`${pointer}.w`, `x + w exceeds 1 (x: ${x.toString()}, w: ${w.toString()})`);
339
339
  isOverflow = true;
340
340
  }
341
341
  if (y + h > 1) {
342
- addError(`${pointer}.h`, `y + h が 1 を超えます (y: ${y.toString()}, h: ${h.toString()})`);
342
+ addError(`${pointer}.h`, `y + h exceeds 1 (y: ${y.toString()}, h: ${h.toString()})`);
343
343
  isOverflow = true;
344
344
  }
345
345
  return isOverflow ? undefined : { x, y, w, h };
@@ -349,11 +349,11 @@ function parseRect(value, pointer, addError) {
349
349
  */
350
350
  function parseRelativeCoordinate(value, pointer, addError) {
351
351
  if (typeof value !== 'number' || !Number.isFinite(value)) {
352
- addError(pointer, '有限数である必要があります');
352
+ addError(pointer, 'must be a finite number');
353
353
  return undefined;
354
354
  }
355
355
  if (value < 0 || value > 1) {
356
- addError(pointer, `0.0–1.0 の範囲外です (値: ${value.toString()})`);
356
+ addError(pointer, `out of range 0.0-1.0: ${value.toString()}`);
357
357
  return undefined;
358
358
  }
359
359
  return value;
@@ -176,9 +176,9 @@ perSlide) {
176
176
  continue;
177
177
  }
178
178
  warned.add(key);
179
- warnings.push(`埋め込みフォント "${font.typeface}" [${font.style}] の実体がスライド間で一致しません`
180
- + `(${String(existing.buffer.length)} B と ${String(font.buffer.length)} B)。`
181
- + 'スライド 1 に近い側(先に現れたスライド)の実体を採ります。');
179
+ warnings.push(`embedded font data differs between slides: "${font.typeface}" [${font.style}] `
180
+ + `(${String(existing.buffer.length)} B and ${String(font.buffer.length)} B); `
181
+ + 'using the data from the slide closer to slide 1 (the one that appears first)');
182
182
  }
183
183
  }
184
184
  return { fonts: union.values().toArray(), warnings };
@@ -8,7 +8,7 @@ export interface ViteConfigOptions {
8
8
  }
9
9
  /**
10
10
  `vite.config.ts` の中身。
11
- 日本語を含む行は、文章 lint が 1 行ずつ読む。そのため、中身は 1 行 1 要素の配列で組み立てる。
11
+ 中身は 1 行 1 要素の配列で組み立てる。
12
12
  */
13
13
  export declare function viteConfigSource(options: Readonly<ViteConfigOptions>): string;
14
14
  /**
@@ -23,10 +23,10 @@ vite-plugin-static-copy は、talk-dir からの相対パスの先頭の `../`
23
23
  function themePublicLines(themeName) {
24
24
  return [
25
25
  '',
26
- '// talk-dir の位置。設定ファイルの隣にある。',
26
+ '// location of the talk-dir, next to this config file.',
27
27
  'const talkDirectory = path.dirname(fileURLToPath(import.meta.url))',
28
28
  '',
29
- '// 実体のパスを求める。無ければ undefined にして、Slidev の既定に任せる。',
29
+ '// resolve the real path; return undefined when it is missing and leave it to the Slidev default.',
30
30
  'function resolveRealPath(...segments: string[]): string | undefined {',
31
31
  ' try {',
32
32
  ' return realpathSync(path.join(...segments))',
@@ -36,20 +36,20 @@ function themePublicLines(themeName) {
36
36
  ' }',
37
37
  '}',
38
38
  '',
39
- '// glob の特殊文字を、文字そのものとして扱わせる。Windows の区切りは / にそろえる。',
39
+ '// make glob special characters match literally; normalize the Windows separator to /.',
40
40
  'function escapeGlob(value: string): string {',
41
41
  ' const posixPath = path.sep === \'\\\\\' ? value.replaceAll(\'\\\\\', \'/\') : value',
42
42
  ' const specials = path.sep === \'\\\\\' ? /[()[\\]{}!+@]/gu : /[\\\\()[\\]{}!*?|+@]/gu',
43
43
  ' return posixPath.replaceAll(specials, \'\\\\$&\')',
44
44
  '}',
45
45
  '',
46
- '// テーマの実体と、その public/。',
46
+ '// real path of the theme and its public/.',
47
47
  `const themeRoot = resolveRealPath(talkDirectory, 'node_modules', ${quoted(themeName)})`,
48
48
  'const themePublic = themeRoot === undefined ? undefined : resolveRealPath(themeRoot, \'public\')',
49
49
  '',
50
- '// テーマの peerDependencies のうち、talk-dir の node_modules から解決できる名前。',
51
- '// optional の名前は除く。Vite は dedupe の名前を root からだけ解決し、見つからないと起動が失敗する。',
52
- '// 読めない・JSON でないときは空にして、設定の読み込みを止めない。',
50
+ '// names in the theme peerDependencies that resolve from node_modules of the talk-dir.',
51
+ '// optional ones are excluded; Vite resolves dedupe names from the root only and fails to start when one is not found.',
52
+ '// return an empty list when the file is unreadable or not JSON, so loading the config does not stop.',
53
53
  'function readThemePeers(): string[] {',
54
54
  ' if (themeRoot === undefined) return []',
55
55
  ' try {',
@@ -68,7 +68,7 @@ function themePublicLines(themeName) {
68
68
  '',
69
69
  'const themePeers = readThemePeers()',
70
70
  '',
71
- '// talk-dir からテーマの public/ までの区間の数(先頭の ../ は数えない)。',
71
+ '// number of segments from the talk-dir to the theme public/ (leading ../ are not counted).',
72
72
  'const themePublicDepth = themePublic === undefined',
73
73
  ' ? 0',
74
74
  ' : path.relative(talkDirectory, themePublic).split(/[\\\\/]/u).filter(segment => segment !== \'..\').length',
@@ -87,9 +87,9 @@ function themePublicLines(themeName) {
87
87
  ' },',
88
88
  ' }',
89
89
  '',
90
- '// テーマの layouts・components・styles は、dev の起動時の warmup で変換しておく。',
91
- '// node_modules の下の glob は、Vite が無視する。そのためテーマの実体のパスで書く。',
92
- '// talk-dir の側の同名のファイルは、テーマを上書きする利用者のものなので、相対の glob で並べる。',
90
+ '// transform theme layouts, components and styles in the warmup at dev start.',
91
+ '// Vite ignores globs under node_modules, so write them with the real path of the theme.',
92
+ '// files of the same name on the talk-dir side override the theme and belong to the user, so list them with relative globs.',
93
93
  'const themeServer = themeRoot === undefined',
94
94
  ' ? {}',
95
95
  ' : {',
@@ -108,7 +108,7 @@ function themePublicLines(themeName) {
108
108
  }
109
109
  /**
110
110
  `vite.config.ts` の中身。
111
- 日本語を含む行は、文章 lint が 1 行ずつ読む。そのため、中身は 1 行 1 要素の配列で組み立てる。
111
+ 中身は 1 行 1 要素の配列で組み立てる。
112
112
  */
113
113
  export function viteConfigSource(options) {
114
114
  const themeName = options.themeName;
@@ -124,41 +124,41 @@ export function viteConfigSource(options) {
124
124
  const slidevLines = themeName === undefined
125
125
  ? []
126
126
  : [
127
- ' // テーマの public/ を /theme/ で配る。',
127
+ ' // serve the theme public/ at /theme/.',
128
128
  ' slidev: themeStaticCopy,',
129
129
  ];
130
130
  const serverSpread = themeName === undefined ? [] : [' ...themeServer,'];
131
131
  return [
132
- '// 本体が生成するファイル。本体の更新で書き直す。',
133
- '// Vite の追加設定は setup/vite-plugins.ts に置く。',
132
+ '// generated by pecotv; rewritten when pecotv is updated.',
133
+ '// put extra Vite settings in setup/vite-plugins.ts.',
134
134
  '/// <reference types="@slidev/types" />',
135
135
  ...importLines,
136
136
  'import { defineConfig } from \'vite\'',
137
137
  ...themeLines,
138
138
  '',
139
139
  'export default defineConfig({',
140
- ' // キャッシュを talk-dir に閉じる。',
141
- ' // node_modules/.vite を共有すると衝突する。',
140
+ ' // keep the cache inside the talk-dir.',
141
+ ' // sharing node_modules/.vite causes conflicts.',
142
142
  ' cacheDir: \'./.vite\',',
143
143
  ' resolve: {',
144
- ' // node_modules とテーマは symlink で張る。',
145
- ' // Vite の既定(false)では、symlink 先の Vue ファイルの scoped CSS が build に入らない。',
144
+ ' // node_modules and the theme are linked with symlinks.',
145
+ ' // with the Vite default (false), scoped CSS of Vue files behind a symlink is left out of the build.',
146
146
  ' preserveSymlinks: true,',
147
- ' // テーマの peerDependencies は、本体の 1 つに寄せる。',
147
+ ' // dedupe the theme peerDependencies to the single copy of the main package.',
148
148
  dedupeLine,
149
149
  ' },',
150
150
  ...slidevLines,
151
151
  ' server: {',
152
152
  ...serverSpread,
153
- ' // dev サーバを起動し直した後も、ブラウザに古い変換結果を使わせない。',
154
- ' // 古い結果を使うと、許可リストの外の CSS が 403 で拒まれ、プレビューが白紙のままになる。',
153
+ ' // keep the browser from using stale transform results after the dev server restarts.',
154
+ ' // with stale results, CSS outside the allow list is rejected with 403 and the preview stays blank.',
155
155
  ' headers: { \'Cache-Control\': \'no-cache\' },',
156
156
  ' },',
157
157
  ' define: {',
158
- ' // pecotv の slide convert は print ページを 1 回読み込んで全ページを変換する。',
159
- ' // その print ルートを build 済み SPA に入れるための指定。',
160
- ' // Slidev 内部の define であり、公開 API ではない。',
161
- ' // このフラグが働かない build では、pecotv が警告を出して従来方式で変換する。',
158
+ ' // pecotv slide convert loads the print page once and converts all pages.',
159
+ ' // this setting puts the print route into the built SPA.',
160
+ ' // it is a Slidev-internal define, not a public API.',
161
+ ' // when this flag has no effect on a build, pecotv warns and converts the old way.',
162
162
  ' __SLIDEV_FEATURE_PRINT__: \'true\',',
163
163
  ' },',
164
164
  '})',
@@ -173,14 +173,14 @@ export const START_SCRIPT_SOURCE = [
173
173
  '#!/usr/bin/env node',
174
174
  '',
175
175
  '/**',
176
- ' * OS 非依存の Slidev 起動スクリプト(pecotv が生成する)。',
176
+ ' * OS-independent Slidev start script (generated by pecotv).',
177
177
  ' *',
178
- ' * MCP を使わない環境向けの、手動プレビューの手段。',
179
- ' * 対象は、pecot-visual サーバを登録していないエディタや素の端末。',
180
- ' * このスクリプトのあるディレクトリを動作起点とする。',
181
- ' * node_modules は pecotv slide create と pecotv slide sync が用意する。',
182
- ' * 無ければ sync を案内して終了する。',
183
- ' * Slidev の bin を、node で直接起動する。',
178
+ ' * A way to preview manually in environments that do not use MCP.',
179
+ ' * It targets editors and plain terminals that have not registered the pecot-visual server.',
180
+ ' * The directory of this script is the working root.',
181
+ ' * node_modules is prepared by pecotv slide create and pecotv slide sync.',
182
+ ' * When it is missing, the script points to sync and exits.',
183
+ ' * It starts the Slidev bin directly with node.',
184
184
  ' */',
185
185
  '',
186
186
  'import { fileURLToPath } from \'node:url\'',
@@ -195,7 +195,7 @@ export const START_SCRIPT_SOURCE = [
195
195
  '',
196
196
  'if (!existsSync(slidevBin)) {',
197
197
  ' console.error(\'error: @slidev/cli not found at \' + slidevBin + \'.\')',
198
- ' console.error(\' pecotv slide sync --dir \' + __dirname + \' --node-modules-only を実行してください。\')',
198
+ ' console.error(\' run pecotv slide sync --dir \' + __dirname + \' --node-modules-only\')',
199
199
  ' process.exit(1)',
200
200
  '}',
201
201
  '',