@nowline/embed 0.0.0-dev.20261016065603.g2853a46 → 0.0.0-dev.20261016123749.g5260133

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/meta.json CHANGED
@@ -4988,7 +4988,7 @@
4988
4988
  "format": "esm"
4989
4989
  },
4990
4990
  "../layout/dist/themes/shared.js": {
4991
- "bytes": 17150,
4991
+ "bytes": 17294,
4992
4992
  "imports": [],
4993
4993
  "format": "esm"
4994
4994
  },
@@ -6419,7 +6419,7 @@
6419
6419
  "format": "esm"
6420
6420
  },
6421
6421
  "../layout/dist/nodes/footnote-node.js": {
6422
- "bytes": 2844,
6422
+ "bytes": 6739,
6423
6423
  "imports": [
6424
6424
  {
6425
6425
  "path": "../layout/dist/dsl-utils.js",
@@ -6431,6 +6431,11 @@
6431
6431
  "kind": "import-statement",
6432
6432
  "original": "../style-resolution.js"
6433
6433
  },
6434
+ {
6435
+ "path": "../layout/dist/text-measure.js",
6436
+ "kind": "import-statement",
6437
+ "original": "../text-measure.js"
6438
+ },
6434
6439
  {
6435
6440
  "path": "../layout/dist/themes/shared.js",
6436
6441
  "kind": "import-statement",
@@ -10043,7 +10048,7 @@
10043
10048
  "format": "esm"
10044
10049
  },
10045
10050
  "../renderer/dist/svg/render.js": {
10046
- "bytes": 112640,
10051
+ "bytes": 112254,
10047
10052
  "imports": [
10048
10053
  {
10049
10054
  "path": "../layout/dist/index.js",
@@ -10273,7 +10278,7 @@
10273
10278
  "imports": [],
10274
10279
  "exports": [],
10275
10280
  "inputs": {},
10276
- "bytes": 3666022
10281
+ "bytes": 3671785
10277
10282
  },
10278
10283
  "dist/nowline.min.js": {
10279
10284
  "imports": [],
@@ -11289,7 +11294,7 @@
11289
11294
  "bytesInOutput": 729
11290
11295
  },
11291
11296
  "../layout/dist/nodes/footnote-node.js": {
11292
- "bytesInOutput": 674
11297
+ "bytesInOutput": 1361
11293
11298
  },
11294
11299
  "../layout/dist/positioned-shift.js": {
11295
11300
  "bytesInOutput": 606
@@ -11424,7 +11429,7 @@
11424
11429
  "bytesInOutput": 727
11425
11430
  },
11426
11431
  "../renderer/dist/svg/render.js": {
11427
- "bytesInOutput": 31490
11432
+ "bytesInOutput": 31454
11428
11433
  },
11429
11434
  "../browser/dist/pipeline.js": {
11430
11435
  "bytesInOutput": 2126
@@ -11451,7 +11456,7 @@
11451
11456
  "bytesInOutput": 257
11452
11457
  }
11453
11458
  },
11454
- "bytes": 669246
11459
+ "bytes": 669897
11455
11460
  }
11456
11461
  }
11457
11462
  }
@@ -1,4 +1,4 @@
1
- /*! @nowline/embed 0.0.0-dev.20261016065603.g2853a46 sha=2853a46 built=2026-10-16T06:52:06Z */
1
+ /*! @nowline/embed 0.0.0-dev.20261016123749.g5260133 sha=5260133 built=2026-10-16T12:32:36Z */
2
2
  var __create = Object.create;
3
3
  var __defProp = Object.defineProperty;
4
4
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -33357,45 +33357,100 @@ function buildDependencies(items, swimlanes, includes, ctx) {
33357
33357
  function indexFootnotes(footnotes, precedingCount = 0) {
33358
33358
  const index = /* @__PURE__ */ new Map();
33359
33359
  const hosts = /* @__PURE__ */ new Map();
33360
- const ordered = [...footnotes.entries()].sort(([a], [b]) => a.localeCompare(b));
33361
- ordered.forEach(([id, f], i2) => {
33360
+ [...footnotes.entries()].forEach(([id, f], i2) => {
33362
33361
  index.set(id, precedingCount + i2 + 1);
33363
33362
  hosts.set(id, propValues(f.properties, "on"));
33364
33363
  });
33365
33364
  return { index, hosts };
33366
33365
  }
33366
+ var FOOTNOTE_TEXT_FONT_SIZE_PX = 11;
33367
+ var FOOTNOTE_DESCRIPTION_MIN_OFFSET_PX = 120;
33368
+ var FOOTNOTE_TITLE_CHAR_ADVANCE_PX = 6;
33369
+ var DESCRIPTION_LEAD = "\u2014 ";
33367
33370
  function buildFootnotePanel(footnotes, ctx, chartBottomY, chartRightX, regions = []) {
33371
+ const boxX = FOOTNOTE_PANEL_PADDING_PX;
33372
+ const boxY = chartBottomY + FOOTNOTE_PANEL_PADDING_PX;
33373
+ const boxWidth = chartRightX - 2 * FOOTNOTE_PANEL_PADDING_PX;
33374
+ const titleX = boxX + 2 * FOOTNOTE_PANEL_PADDING_PX;
33375
+ const textRightX = boxX + boxWidth - FOOTNOTE_PANEL_PADDING_PX;
33376
+ const firstRowY = boxY + FOOTNOTE_HEADER_HEIGHT_PX + FOOTNOTE_PANEL_PADDING_PX;
33368
33377
  const entries = [];
33378
+ let row = 0;
33369
33379
  const add = (decls, source, region) => {
33370
- const ordered = [...decls.entries()].sort(([a], [b]) => a.localeCompare(b));
33371
- for (const [id, f] of ordered) {
33380
+ for (const [id, f] of decls) {
33381
+ const title = f.title ?? id;
33382
+ const description = f.description?.text;
33383
+ const lines = entryLines(title, description, titleX, textRightX);
33384
+ const y = firstRowY + row * FOOTNOTE_ROW_HEIGHT;
33385
+ const at = (l) => ({
33386
+ x: l.x,
33387
+ y: y + l.row * FOOTNOTE_ROW_HEIGHT,
33388
+ text: l.text
33389
+ });
33372
33390
  const entry = {
33373
33391
  number: source.footnoteIndex.get(id) ?? entries.length + 1,
33374
- title: f.title ?? id,
33375
- description: f.description?.text,
33392
+ y,
33393
+ title,
33394
+ titleLines: lines.title.map(at),
33395
+ description,
33376
33396
  style: resolveStyle("footnote", f.properties, source.styleCtx)
33377
33397
  };
33398
+ if (lines.description.length > 0)
33399
+ entry.descriptionLines = lines.description.map(at);
33378
33400
  if (region !== void 0)
33379
33401
  entry.region = region;
33380
33402
  entries.push(entry);
33403
+ row += lines.rows;
33381
33404
  }
33382
33405
  };
33383
33406
  add(footnotes, ctx);
33384
- let headings = 0;
33385
33407
  for (const r of regions) {
33386
33408
  if (r.footnotes.size === 0)
33387
33409
  continue;
33410
+ const headingY = firstRowY + row * FOOTNOTE_ROW_HEIGHT;
33411
+ row += 1;
33412
+ const first2 = entries.length;
33388
33413
  add(r.footnotes, r.ctx, r.title);
33389
- headings += 1;
33414
+ entries[first2].regionHeadingY = headingY;
33390
33415
  }
33391
33416
  const box = {
33392
- x: FOOTNOTE_PANEL_PADDING_PX,
33393
- y: chartBottomY + FOOTNOTE_PANEL_PADDING_PX,
33394
- width: chartRightX - 2 * FOOTNOTE_PANEL_PADDING_PX,
33395
- height: entries.length === 0 ? 0 : FOOTNOTE_HEADER_HEIGHT_PX + (entries.length + headings) * FOOTNOTE_ROW_HEIGHT + FOOTNOTE_PANEL_PADDING_PX
33417
+ x: boxX,
33418
+ y: boxY,
33419
+ width: boxWidth,
33420
+ height: entries.length === 0 ? 0 : FOOTNOTE_HEADER_HEIGHT_PX + row * FOOTNOTE_ROW_HEIGHT + FOOTNOTE_PANEL_PADDING_PX
33396
33421
  };
33397
33422
  return { box, entries };
33398
33423
  }
33424
+ function entryLines(title, description, titleX, textRightX) {
33425
+ const fullWidth = textRightX - titleX;
33426
+ const titleRows = fitsOrWraps(title, fullWidth, fullWidth);
33427
+ const titleLines = titleRows.map((text, row) => ({ x: titleX, row, text }));
33428
+ if (!description)
33429
+ return { title: titleLines, description: [], rows: titleRows.length };
33430
+ const leadWidth = estimateTextWidth(DESCRIPTION_LEAD, FOOTNOTE_TEXT_FONT_SIZE_PX);
33431
+ const firstWord = description.trim().split(/\s+/)[0] ?? "";
33432
+ const columnX = titleX + Math.max(FOOTNOTE_DESCRIPTION_MIN_OFFSET_PX, title.length * FOOTNOTE_TITLE_CHAR_ADVANCE_PX);
33433
+ const besideTitle = titleRows.length === 1 && leadWidth + estimateTextWidth(firstWord, FOOTNOTE_TEXT_FONT_SIZE_PX) <= textRightX - columnX;
33434
+ const firstX = besideTitle ? columnX : titleX;
33435
+ const firstRow = besideTitle ? titleRows.length - 1 : titleRows.length;
33436
+ const rows = fitsOrWraps(description, fullWidth, textRightX - firstX - leadWidth);
33437
+ const descriptionLines = rows.map((text, i2) => ({
33438
+ x: i2 === 0 ? firstX : titleX,
33439
+ row: firstRow + i2,
33440
+ text: i2 === 0 ? `${DESCRIPTION_LEAD}${text}` : text
33441
+ }));
33442
+ return {
33443
+ title: titleLines,
33444
+ description: descriptionLines,
33445
+ rows: firstRow + rows.length
33446
+ };
33447
+ }
33448
+ function fitsOrWraps(text, width, firstWidth) {
33449
+ if (estimateTextWidth(text, FOOTNOTE_TEXT_FONT_SIZE_PX) <= firstWidth)
33450
+ return [text];
33451
+ const rows = wrapText(text, width, FOOTNOTE_TEXT_FONT_SIZE_PX, firstWidth);
33452
+ return rows.length > 0 ? rows : [text];
33453
+ }
33399
33454
 
33400
33455
  // ../layout/dist/positioned-shift.js
33401
33456
  function shiftTrackChildY(child, dy) {
@@ -38941,50 +38996,44 @@ function renderFootnotes(f, idPrefix, palette, fonts) {
38941
38996
  "font-weight": 700,
38942
38997
  fill: headerColor
38943
38998
  }, "Footnotes"));
38944
- const firstEntryBaselineY = f.box.y + FOOTNOTE_HEADER_HEIGHT_PX + FOOTNOTE_PANEL_PADDING_PX;
38945
38999
  const numberX = f.box.x + FOOTNOTE_PANEL_PADDING_PX;
38946
- const titleX = numberX + FOOTNOTE_PANEL_PADDING_PX;
38947
- let row = 0;
38948
- let region;
38949
39000
  for (const e of f.entries) {
38950
- if (e.region !== void 0 && e.region !== region) {
38951
- region = e.region;
39001
+ if (e.region !== void 0 && e.regionHeadingY !== void 0) {
38952
39002
  parts.push(textTag({
38953
39003
  x: num(numberX),
38954
- y: num(firstEntryBaselineY + row * FOOTNOTE_ROW_HEIGHT),
39004
+ y: num(e.regionHeadingY),
38955
39005
  "font-family": fonts.sans,
38956
39006
  "font-size": 10,
38957
39007
  "font-weight": 700,
38958
39008
  fill: headerColor
38959
39009
  }, e.region));
38960
- row += 1;
38961
39010
  }
38962
- const y = firstEntryBaselineY + row * FOOTNOTE_ROW_HEIGHT;
38963
- row += 1;
38964
39011
  parts.push(textTag({
38965
39012
  x: num(numberX),
38966
- y: num(y),
39013
+ y: num(e.y),
38967
39014
  "font-family": fonts.sans,
38968
39015
  "font-size": 10,
38969
39016
  "font-weight": 700,
38970
39017
  fill: numberColor
38971
39018
  }, String(e.number)));
38972
- parts.push(textTag({
38973
- x: num(titleX),
38974
- y: num(y),
38975
- "font-family": fonts.sans,
38976
- "font-size": 11,
38977
- "font-weight": 600,
38978
- fill: titleColor
38979
- }, e.title));
38980
- if (e.description) {
39019
+ for (const line of e.titleLines) {
39020
+ parts.push(textTag({
39021
+ x: num(line.x),
39022
+ y: num(line.y),
39023
+ "font-family": fonts.sans,
39024
+ "font-size": 11,
39025
+ "font-weight": 600,
39026
+ fill: titleColor
39027
+ }, line.text));
39028
+ }
39029
+ for (const line of e.descriptionLines ?? []) {
38981
39030
  parts.push(textTag({
38982
- x: num(titleX + Math.max(120, e.title.length * 6)),
38983
- y: num(y),
39031
+ x: num(line.x),
39032
+ y: num(line.y),
38984
39033
  "font-family": fonts.sans,
38985
39034
  "font-size": 11,
38986
39035
  fill: descColor
38987
- }, `\u2014 ${e.description}`));
39036
+ }, line.text));
38988
39037
  }
38989
39038
  }
38990
39039
  return tag("g", { "data-layer": "footnotes" }, parts.join(""));
@@ -40518,8 +40567,8 @@ function effectiveTheme(theme, systemTheme) {
40518
40567
  }
40519
40568
 
40520
40569
  // src/index.ts
40521
- var version = true ? "0.0.0-dev.20261016065603.g2853a46" : "0.0.0";
40522
- var sha = true ? "2853a46" : "unknown";
40570
+ var version = true ? "0.0.0-dev.20261016123749.g5260133" : "0.0.0";
40571
+ var sha = true ? "5260133" : "unknown";
40523
40572
  var DEFAULT_SELECTOR = "pre code.language-nowline, code.language-nowline";
40524
40573
  var initialConfig = {
40525
40574
  theme: "auto",