@openuji/speculator 0.3.1 → 0.3.2

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/browser.cjs CHANGED
@@ -1238,9 +1238,12 @@ var TocPass = class {
1238
1238
  }
1239
1239
  async execute(_data, config) {
1240
1240
  const { toc } = config.postprocess || {};
1241
- if (toc?.enabled === false) return { data: "", warnings: [] };
1241
+ console.log("TOC items:", toc);
1242
1242
  const items = collectTocItems(this.root);
1243
1243
  if (!items.length) return { data: "", warnings: [] };
1244
+ if (toc && toc.render === false) {
1245
+ return { data: items, warnings: [] };
1246
+ }
1244
1247
  const renderer = new TocRenderer(this.root.ownerDocument);
1245
1248
  const { toc: tocHtml } = renderer.render(items);
1246
1249
  return { data: tocHtml, warnings: [] };
@@ -1524,7 +1527,7 @@ var Speculator = class {
1524
1527
  /**
1525
1528
  * Process an entire document described by a SpeculatorConfig
1526
1529
  */
1527
- async renderDocument(spec, configOrOutputs = {}) {
1530
+ async renderDocument(spec, outputs = []) {
1528
1531
  const startTime = performance.now();
1529
1532
  const config = {
1530
1533
  ...this.baseConfig,
@@ -1535,8 +1538,8 @@ var Speculator = class {
1535
1538
  const allWarnings = [...sectionWarnings];
1536
1539
  let areas = getChangedOutputAreas(this.prevConfig, config);
1537
1540
  this.prevConfig = config;
1538
- if (Array.isArray(configOrOutputs)) {
1539
- areas = areas.filter((a) => configOrOutputs.includes(a));
1541
+ if (Array.isArray(outputs) && outputs.length > 0) {
1542
+ areas = areas.filter((a) => outputs.includes(a));
1540
1543
  }
1541
1544
  let toc;
1542
1545
  let boilerplate;
@@ -284,9 +284,7 @@ interface IdlOptions {
284
284
  enable?: boolean;
285
285
  }
286
286
  interface TocOptions {
287
- /** CSS selector for the ToC mount point (default: '#toc'). */
288
- selector?: string;
289
- enabled?: boolean;
287
+ render?: boolean;
290
288
  }
291
289
  interface DiagnosticsOptions {
292
290
  /** Suppress link warnings within elements having this class. */
@@ -367,7 +365,7 @@ declare class Speculator {
367
365
  /**
368
366
  * Process an entire document described by a SpeculatorConfig
369
367
  */
370
- renderDocument(spec: SpeculatorConfig, configOrOutputs?: SpeculatorConfig | OutputArea[]): Promise<RenderResult>;
368
+ renderDocument(spec: SpeculatorConfig, outputs?: OutputArea[]): Promise<RenderResult>;
371
369
  renderSections(inputHtml: string): Promise<RenderResult>;
372
370
  /**
373
371
  * Process HTML string and return processed HTML
package/dist/browser.d.ts CHANGED
@@ -284,9 +284,7 @@ interface IdlOptions {
284
284
  enable?: boolean;
285
285
  }
286
286
  interface TocOptions {
287
- /** CSS selector for the ToC mount point (default: '#toc'). */
288
- selector?: string;
289
- enabled?: boolean;
287
+ render?: boolean;
290
288
  }
291
289
  interface DiagnosticsOptions {
292
290
  /** Suppress link warnings within elements having this class. */
@@ -367,7 +365,7 @@ declare class Speculator {
367
365
  /**
368
366
  * Process an entire document described by a SpeculatorConfig
369
367
  */
370
- renderDocument(spec: SpeculatorConfig, configOrOutputs?: SpeculatorConfig | OutputArea[]): Promise<RenderResult>;
368
+ renderDocument(spec: SpeculatorConfig, outputs?: OutputArea[]): Promise<RenderResult>;
371
369
  renderSections(inputHtml: string): Promise<RenderResult>;
372
370
  /**
373
371
  * Process HTML string and return processed HTML
package/dist/browser.js CHANGED
@@ -15,7 +15,7 @@ import {
15
15
  getDefaultFileLoader,
16
16
  nodeFileLoader,
17
17
  parseMarkdown
18
- } from "./chunk-V4GSFQE7.js";
18
+ } from "./chunk-ONLMOJIJ.js";
19
19
  export {
20
20
  DOMHtmlRenderer,
21
21
  FormatProcessor,
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  Speculator
3
- } from "./chunk-V4GSFQE7.js";
3
+ } from "./chunk-ONLMOJIJ.js";
4
4
 
5
5
  // src/linkedom-html-renderer.ts
6
6
  import { DOMParser } from "linkedom";
@@ -1241,9 +1241,12 @@ var TocPass = class {
1241
1241
  }
1242
1242
  async execute(_data, config) {
1243
1243
  const { toc } = config.postprocess || {};
1244
- if (toc?.enabled === false) return { data: "", warnings: [] };
1244
+ console.log("TOC items:", toc);
1245
1245
  const items = collectTocItems(this.root);
1246
1246
  if (!items.length) return { data: "", warnings: [] };
1247
+ if (toc && toc.render === false) {
1248
+ return { data: items, warnings: [] };
1249
+ }
1247
1250
  const renderer = new TocRenderer(this.root.ownerDocument);
1248
1251
  const { toc: tocHtml } = renderer.render(items);
1249
1252
  return { data: tocHtml, warnings: [] };
@@ -1480,7 +1483,7 @@ var Speculator = class {
1480
1483
  /**
1481
1484
  * Process an entire document described by a SpeculatorConfig
1482
1485
  */
1483
- async renderDocument(spec, configOrOutputs = {}) {
1486
+ async renderDocument(spec, outputs = []) {
1484
1487
  const startTime = performance.now();
1485
1488
  const config = {
1486
1489
  ...this.baseConfig,
@@ -1491,8 +1494,8 @@ var Speculator = class {
1491
1494
  const allWarnings = [...sectionWarnings];
1492
1495
  let areas = getChangedOutputAreas(this.prevConfig, config);
1493
1496
  this.prevConfig = config;
1494
- if (Array.isArray(configOrOutputs)) {
1495
- areas = areas.filter((a) => configOrOutputs.includes(a));
1497
+ if (Array.isArray(outputs) && outputs.length > 0) {
1498
+ areas = areas.filter((a) => outputs.includes(a));
1496
1499
  }
1497
1500
  let toc;
1498
1501
  let boilerplate;
@@ -1209,9 +1209,12 @@ var TocPass = class {
1209
1209
  }
1210
1210
  async execute(_data, config) {
1211
1211
  const { toc } = config.postprocess || {};
1212
- if (toc?.enabled === false) return { data: "", warnings: [] };
1212
+ console.log("TOC items:", toc);
1213
1213
  const items = collectTocItems(this.root);
1214
1214
  if (!items.length) return { data: "", warnings: [] };
1215
+ if (toc && toc.render === false) {
1216
+ return { data: items, warnings: [] };
1217
+ }
1215
1218
  const renderer = new TocRenderer(this.root.ownerDocument);
1216
1219
  const { toc: tocHtml } = renderer.render(items);
1217
1220
  return { data: tocHtml, warnings: [] };
@@ -1495,7 +1498,7 @@ var Speculator = class {
1495
1498
  /**
1496
1499
  * Process an entire document described by a SpeculatorConfig
1497
1500
  */
1498
- async renderDocument(spec, configOrOutputs = {}) {
1501
+ async renderDocument(spec, outputs = []) {
1499
1502
  const startTime = performance.now();
1500
1503
  const config = {
1501
1504
  ...this.baseConfig,
@@ -1506,8 +1509,8 @@ var Speculator = class {
1506
1509
  const allWarnings = [...sectionWarnings];
1507
1510
  let areas = getChangedOutputAreas(this.prevConfig, config);
1508
1511
  this.prevConfig = config;
1509
- if (Array.isArray(configOrOutputs)) {
1510
- areas = areas.filter((a) => configOrOutputs.includes(a));
1512
+ if (Array.isArray(outputs) && outputs.length > 0) {
1513
+ areas = areas.filter((a) => outputs.includes(a));
1511
1514
  }
1512
1515
  let toc;
1513
1516
  let boilerplate;
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  LinkedomHtmlRenderer,
3
3
  Speculator
4
- } from "../chunk-H7C7MOU6.js";
5
- import "../chunk-V4GSFQE7.js";
4
+ } from "../chunk-KC3NVWHK.js";
5
+ import "../chunk-ONLMOJIJ.js";
6
6
 
7
7
  // src/cli/export-assertions.ts
8
8
  import fs from "fs/promises";
package/dist/node.cjs CHANGED
@@ -1239,9 +1239,12 @@ var TocPass = class {
1239
1239
  }
1240
1240
  async execute(_data, config) {
1241
1241
  const { toc } = config.postprocess || {};
1242
- if (toc?.enabled === false) return { data: "", warnings: [] };
1242
+ console.log("TOC items:", toc);
1243
1243
  const items = collectTocItems(this.root);
1244
1244
  if (!items.length) return { data: "", warnings: [] };
1245
+ if (toc && toc.render === false) {
1246
+ return { data: items, warnings: [] };
1247
+ }
1245
1248
  const renderer = new TocRenderer(this.root.ownerDocument);
1246
1249
  const { toc: tocHtml } = renderer.render(items);
1247
1250
  return { data: tocHtml, warnings: [] };
@@ -1525,7 +1528,7 @@ var Speculator = class {
1525
1528
  /**
1526
1529
  * Process an entire document described by a SpeculatorConfig
1527
1530
  */
1528
- async renderDocument(spec, configOrOutputs = {}) {
1531
+ async renderDocument(spec, outputs = []) {
1529
1532
  const startTime = performance.now();
1530
1533
  const config = {
1531
1534
  ...this.baseConfig,
@@ -1536,8 +1539,8 @@ var Speculator = class {
1536
1539
  const allWarnings = [...sectionWarnings];
1537
1540
  let areas = getChangedOutputAreas(this.prevConfig, config);
1538
1541
  this.prevConfig = config;
1539
- if (Array.isArray(configOrOutputs)) {
1540
- areas = areas.filter((a) => configOrOutputs.includes(a));
1542
+ if (Array.isArray(outputs) && outputs.length > 0) {
1543
+ areas = areas.filter((a) => outputs.includes(a));
1541
1544
  }
1542
1545
  let toc;
1543
1546
  let boilerplate;
package/dist/node.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  LinkedomHtmlRenderer,
3
3
  Speculator
4
- } from "./chunk-H7C7MOU6.js";
4
+ } from "./chunk-KC3NVWHK.js";
5
5
  import {
6
6
  DOMHtmlRenderer,
7
7
  FormatProcessor,
@@ -18,7 +18,7 @@ import {
18
18
  getDefaultFileLoader,
19
19
  nodeFileLoader,
20
20
  parseMarkdown
21
- } from "./chunk-V4GSFQE7.js";
21
+ } from "./chunk-ONLMOJIJ.js";
22
22
  export {
23
23
  DOMHtmlRenderer,
24
24
  FormatProcessor,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openuji/speculator",
3
- "version": "0.3.1",
3
+ "version": "0.3.2",
4
4
  "description": "A TypeScript library for processing ReSpec-like markup with markdown support",
5
5
  "type": "module",
6
6
  "sideEffects": false,