@ox-content/vite-plugin 3.0.0-alpha.12 → 3.0.0-alpha.13

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.cjs CHANGED
@@ -1,6 +1,7 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  const require_vitepress = require("./vitepress.cjs");
3
3
  const require_jsx_html = require("./jsx-html.cjs");
4
+ const require_markdown_tables = require("./markdown-tables.cjs");
4
5
  let path = require("path");
5
6
  path = require_vitepress.__toESM(path, 1);
6
7
  let unified = require("unified");
@@ -20213,61 +20214,6 @@ function createEmptyLintResult() {
20213
20214
  };
20214
20215
  }
20215
20216
  //#endregion
20216
- //#region src/markdown-tables.ts
20217
- const TABINDEX_FLAG = "oxTableScrollTabindex";
20218
- const LABEL_FLAG = "oxTableScrollLabel";
20219
- const SCROLLABLE_ATTR = "data-ox-table-scrollable";
20220
- function markdownTableScrollLabel(locale) {
20221
- if (locale?.split("-")[0]?.toLowerCase() === "ja") return "横スクロールできる表";
20222
- return "Scrollable table";
20223
- }
20224
- /**
20225
- * Makes overflowing Markdown tables keyboard-scrollable without wrapping or
20226
- * replacing the native `<table>` element.
20227
- *
20228
- * Run this after rendering Markdown and again after layout-changing updates.
20229
- * Narrow tables stay out of the tab order when overflow can be measured.
20230
- */
20231
- function enhanceMarkdownTables(root, options = {}) {
20232
- const target = root ?? globalThis.document;
20233
- if (!target?.querySelectorAll) return 0;
20234
- const selector = options.selector ?? ".content table";
20235
- const locale = ownerDocument(target)?.documentElement.lang;
20236
- const label = options.label ?? markdownTableScrollLabel(locale);
20237
- let scrollableCount = 0;
20238
- for (const table of target.querySelectorAll(selector)) {
20239
- if (typeof HTMLElement === "undefined" || !(table instanceof HTMLElement)) continue;
20240
- if (table.tagName !== "TABLE") continue;
20241
- const scrollable = table.scrollWidth > table.clientWidth + 1;
20242
- table.toggleAttribute(SCROLLABLE_ATTR, scrollable);
20243
- if (scrollable) {
20244
- scrollableCount++;
20245
- if (!table.hasAttribute("tabindex")) {
20246
- table.tabIndex = 0;
20247
- table.dataset[TABINDEX_FLAG] = "true";
20248
- }
20249
- if (!table.hasAttribute("aria-label") && !table.hasAttribute("aria-labelledby")) {
20250
- table.setAttribute("aria-label", label);
20251
- table.dataset[LABEL_FLAG] = "true";
20252
- }
20253
- } else {
20254
- if (table.dataset[TABINDEX_FLAG] === "true") {
20255
- table.removeAttribute("tabindex");
20256
- delete table.dataset[TABINDEX_FLAG];
20257
- }
20258
- if (table.dataset[LABEL_FLAG] === "true") {
20259
- table.removeAttribute("aria-label");
20260
- delete table.dataset[LABEL_FLAG];
20261
- }
20262
- }
20263
- }
20264
- return scrollableCount;
20265
- }
20266
- function ownerDocument(root) {
20267
- if (typeof Document !== "undefined" && root instanceof Document) return root;
20268
- return root.ownerDocument ?? globalThis.document;
20269
- }
20270
- //#endregion
20271
20217
  //#region src/ssg-output-write.ts
20272
20218
  /**
20273
20219
  * Writers for composable SSG outputs. Custom hosts call these without `buildSsg()`.
@@ -20870,7 +20816,7 @@ exports.defineTheme = require_vitepress.defineTheme;
20870
20816
  exports.discoverDocumentMdxIslands = discoverDocumentMdxIslands;
20871
20817
  exports.discoverRegisteredMdxComponents = discoverRegisteredMdxComponents;
20872
20818
  exports.each = require_jsx_html.each;
20873
- exports.enhanceMarkdownTables = enhanceMarkdownTables;
20819
+ exports.enhanceMarkdownTables = require_markdown_tables.enhanceMarkdownTables;
20874
20820
  exports.escapeSvelteMarkup = escapeSvelteMarkup;
20875
20821
  exports.extractCodeBlocks = extractCodeBlocks;
20876
20822
  exports.extractDocs = extractDocs;
@@ -20906,7 +20852,7 @@ exports.lintMarkdown = lintMarkdown;
20906
20852
  exports.lintMarkdownAsync = lintMarkdownAsync;
20907
20853
  exports.lintMarkdownFile = lintMarkdownFile;
20908
20854
  exports.lintMarkdownFiles = lintMarkdownFiles;
20909
- exports.markdownTableScrollLabel = markdownTableScrollLabel;
20855
+ exports.markdownTableScrollLabel = require_markdown_tables.markdownTableScrollLabel;
20910
20856
  exports.mergeThemes = require_vitepress.mergeThemes;
20911
20857
  exports.mermaidClientScript = mermaidClientScript;
20912
20858
  exports.normalizeMarkdownExtensions = normalizeMarkdownExtensions;