@nowline/embed 0.0.0-dev.20261013003401.g0426eb1 → 0.0.0-dev.20261013004110.g00a00d7

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
@@ -27,7 +27,7 @@
27
27
  "format": "esm"
28
28
  },
29
29
  "../layout/dist/working-calendar.js": {
30
- "bytes": 26011,
30
+ "bytes": 29059,
31
31
  "imports": [
32
32
  {
33
33
  "path": "../layout/dist/calendar.js",
@@ -8877,7 +8877,7 @@
8877
8877
  "format": "esm"
8878
8878
  },
8879
8879
  "../layout/dist/view-preset.js": {
8880
- "bytes": 20980,
8880
+ "bytes": 22047,
8881
8881
  "imports": [
8882
8882
  {
8883
8883
  "path": "../layout/dist/calendar.js",
@@ -9175,7 +9175,7 @@
9175
9175
  "format": "esm"
9176
9176
  },
9177
9177
  "../layout/dist/nodes/roadmap-node.js": {
9178
- "bytes": 52095,
9178
+ "bytes": 53637,
9179
9179
  "imports": [
9180
9180
  {
9181
9181
  "path": "../layout/dist/band-scale.js",
@@ -9643,7 +9643,7 @@
9643
9643
  "format": "esm"
9644
9644
  },
9645
9645
  "../renderer/dist/svg/render.js": {
9646
- "bytes": 108314,
9646
+ "bytes": 108812,
9647
9647
  "imports": [
9648
9648
  {
9649
9649
  "path": "../layout/dist/index.js",
@@ -9858,7 +9858,7 @@
9858
9858
  "imports": [],
9859
9859
  "exports": [],
9860
9860
  "inputs": {},
9861
- "bytes": 3838056
9861
+ "bytes": 3849577
9862
9862
  },
9863
9863
  "dist/nowline.min.js": {
9864
9864
  "imports": [],
@@ -10007,7 +10007,7 @@
10007
10007
  "bytesInOutput": 1831
10008
10008
  },
10009
10009
  "../layout/dist/working-calendar.js": {
10010
- "bytesInOutput": 8037
10010
+ "bytesInOutput": 8921
10011
10011
  },
10012
10012
  "../layout/dist/calendar-resolver.js": {
10013
10013
  "bytesInOutput": 1875
@@ -10943,7 +10943,7 @@
10943
10943
  "bytesInOutput": 1928
10944
10944
  },
10945
10945
  "../layout/dist/view-preset.js": {
10946
- "bytesInOutput": 5201
10946
+ "bytesInOutput": 5519
10947
10947
  },
10948
10948
  "../layout/dist/nodes/anchor-node.js": {
10949
10949
  "bytesInOutput": 916
@@ -10973,7 +10973,7 @@
10973
10973
  "bytesInOutput": 5667
10974
10974
  },
10975
10975
  "../layout/dist/nodes/roadmap-node.js": {
10976
- "bytesInOutput": 10222
10976
+ "bytesInOutput": 10607
10977
10977
  },
10978
10978
  "../layout/dist/layout.js": {
10979
10979
  "bytesInOutput": 14236
@@ -11006,7 +11006,7 @@
11006
11006
  "bytesInOutput": 728
11007
11007
  },
11008
11008
  "../renderer/dist/svg/render.js": {
11009
- "bytesInOutput": 30544
11009
+ "bytesInOutput": 30679
11010
11010
  },
11011
11011
  "../renderer/dist/index.js": {
11012
11012
  "bytesInOutput": 0
@@ -11036,7 +11036,7 @@
11036
11036
  "bytesInOutput": 257
11037
11037
  }
11038
11038
  },
11039
- "bytes": 748601
11039
+ "bytes": 750323
11040
11040
  }
11041
11041
  }
11042
11042
  }
@@ -1,4 +1,4 @@
1
- /*! @nowline/embed 0.0.0-dev.20261013003401.g0426eb1 sha=0426eb1 built=2026-10-13T00:28:56Z */
1
+ /*! @nowline/embed 0.0.0-dev.20261013004110.g00a00d7 sha=00a00d7 built=2026-10-13T00:36:49Z */
2
2
  var __create = Object.create;
3
3
  var __defProp = Object.defineProperty;
4
4
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -6859,7 +6859,10 @@ function buildCalendar(unitDays, input) {
6859
6859
  }
6860
6860
  const rules = normalized.map((rule) => rule.copy);
6861
6861
  const openMask = openWeekMask(normalized);
6862
- const pieces = overlay(recurringSegments(openMask, boundedSpans(normalized)), datedSegments(normalized));
6862
+ const segments = recurringSegments(openMask, boundedSpans(normalized));
6863
+ const pieces = overlay(segments, datedSegments(normalized));
6864
+ const exceptionRuns = titledWorkingRuns(normalized, segments);
6865
+ const workingExceptionRuns = (from, to) => runsIntersecting(exceptionRuns, from, to);
6863
6866
  const first2 = pieces[0];
6864
6867
  const last = pieces[pieces.length - 1];
6865
6868
  for (const piece of [first2, last]) {
@@ -6869,9 +6872,10 @@ function buildCalendar(unitDays, input) {
6869
6872
  }
6870
6873
  const hasNonWorkingDays = pieces.some((piece) => piece.kind === "non-working" || piece.kind === "mask" && piece.workingPerWeek < DAYS_PER_WEEK);
6871
6874
  const workingWeekdays = weekdaysOutside(openMask);
6872
- if (!hasNonWorkingDays)
6873
- return identityCalendar(unitDays, rules, workingWeekdays);
6874
- const index = new WorkingDayIndex(pieces, titledRules(normalized));
6875
+ if (!hasNonWorkingDays) {
6876
+ return identityCalendar(unitDays, rules, workingWeekdays, workingExceptionRuns);
6877
+ }
6878
+ const index = new WorkingDayIndex(pieces, titledRules(normalized, false));
6875
6879
  const dateAtWorkingIndex = (base, workingIndex) => index.dateAt(base, workingIndex);
6876
6880
  return {
6877
6881
  rules,
@@ -6883,10 +6887,11 @@ function buildCalendar(unitDays, input) {
6883
6887
  isWorkingDay: (date) => index.isWorkingDay(date),
6884
6888
  workingIndexOf: (base, date) => index.indexOf(base, date),
6885
6889
  dateAtWorkingIndex,
6886
- nonWorkingRuns: (from, to) => index.runs(from, to)
6890
+ nonWorkingRuns: (from, to) => index.runs(from, to),
6891
+ workingExceptionRuns
6887
6892
  };
6888
6893
  }
6889
- function identityCalendar(unitDays, rules, workingWeekdays) {
6894
+ function identityCalendar(unitDays, rules, workingWeekdays, workingExceptionRuns) {
6890
6895
  return {
6891
6896
  rules,
6892
6897
  hasNonWorkingDays: false,
@@ -6897,7 +6902,8 @@ function identityCalendar(unitDays, rules, workingWeekdays) {
6897
6902
  isWorkingDay: () => true,
6898
6903
  workingIndexOf: (base, date) => daysBetween(base, date),
6899
6904
  dateAtWorkingIndex: (base, index) => addDays(base, index),
6900
- nonWorkingRuns: () => []
6905
+ nonWorkingRuns: () => [],
6906
+ workingExceptionRuns
6901
6907
  };
6902
6908
  }
6903
6909
  function normalizeRule(rule) {
@@ -7096,11 +7102,11 @@ function maskPiece(start, end, mask) {
7096
7102
  const workingPerWeek = off.filter((isOff) => !isOff).length;
7097
7103
  return { start, end, kind: "mask", off, workingPerWeek };
7098
7104
  }
7099
- function titledRules(rules) {
7105
+ function titledRules(rules, working) {
7100
7106
  const titled = [];
7101
7107
  for (const [order, rule] of rules.entries()) {
7102
7108
  const title = rule.copy.title;
7103
- if (rule.mask !== void 0 || rule.working || title === void 0)
7109
+ if (rule.mask !== void 0 || rule.working !== working || title === void 0)
7104
7110
  continue;
7105
7111
  if (rule.spans.length === 0)
7106
7112
  continue;
@@ -7110,6 +7116,54 @@ function titledRules(rules) {
7110
7116
  titled.sort((a, b) => a.first - b.first || a.order - b.order);
7111
7117
  return titled.map(({ title, spans }) => ({ title, spans }));
7112
7118
  }
7119
+ function titledWorkingRuns(rules, segments) {
7120
+ const titled = titledRules(rules, true);
7121
+ if (titled.length === 0)
7122
+ return [];
7123
+ const closures = rules.filter((rule) => !rule.working);
7124
+ const baseline = overlay(segments, datedSegments(closures));
7125
+ const turned = /* @__PURE__ */ new Map();
7126
+ titled.forEach((rule, i2) => {
7127
+ for (const span of rule.spans) {
7128
+ for (let day = span.start; day < span.end; day++) {
7129
+ if (!isNonWorkingIn(baseline, day))
7130
+ continue;
7131
+ const owners = turned.get(day) ?? /* @__PURE__ */ new Set();
7132
+ owners.add(i2);
7133
+ turned.set(day, owners);
7134
+ }
7135
+ }
7136
+ });
7137
+ const days = [...turned.keys()].sort((a, b) => a - b);
7138
+ const out = [];
7139
+ for (let i2 = 0; i2 < days.length; ) {
7140
+ let j = i2;
7141
+ const owners = /* @__PURE__ */ new Set();
7142
+ while (j < days.length && days[j] - days[i2] === j - i2) {
7143
+ for (const owner of turned.get(days[j]) ?? [])
7144
+ owners.add(owner);
7145
+ j++;
7146
+ }
7147
+ out.push({
7148
+ from: dateOfDay(days[i2]),
7149
+ through: dateOfDay(days[j - 1]),
7150
+ titles: [...owners].sort((a, b) => a - b).map((owner) => titled[owner].title)
7151
+ });
7152
+ i2 = j;
7153
+ }
7154
+ return out;
7155
+ }
7156
+ function runsIntersecting(runs, fromDate, toDate) {
7157
+ const from = dayNumber(fromDate);
7158
+ const to = dayNumber(toDate);
7159
+ if (Number.isNaN(from) || Number.isNaN(to))
7160
+ return [];
7161
+ return runs.filter((run2) => dayNumber(run2.from) < to && dayNumber(run2.through) >= from).map((run2) => ({
7162
+ from: new Date(run2.from.getTime()),
7163
+ through: new Date(run2.through.getTime()),
7164
+ titles: [...run2.titles]
7165
+ }));
7166
+ }
7113
7167
  function weekStartOf(openMask) {
7114
7168
  const isOff = (weekday) => (openMask & 1 << weekday) !== 0;
7115
7169
  let best;
@@ -7139,6 +7193,24 @@ function weekdayOf(day) {
7139
7193
  function remainderScanError() {
7140
7194
  return new Error("working calendar: remainder scan exceeded its cap (internal error)");
7141
7195
  }
7196
+ function pieceIndexAt(pieces, day) {
7197
+ let low = 0;
7198
+ let high = pieces.length - 1;
7199
+ while (low < high) {
7200
+ const middle = low + high >> 1;
7201
+ if (day >= pieces[middle].end)
7202
+ low = middle + 1;
7203
+ else
7204
+ high = middle;
7205
+ }
7206
+ return low;
7207
+ }
7208
+ function isNonWorkingIn(pieces, day) {
7209
+ const piece = pieces[pieceIndexAt(pieces, day)];
7210
+ if (piece.kind === "mask")
7211
+ return piece.off[weekdayOf(day)];
7212
+ return piece.kind === "non-working";
7213
+ }
7142
7214
  function workingDaysIn(piece, from, to) {
7143
7215
  if (piece.kind !== "mask")
7144
7216
  return piece.kind === "working" ? to - from : 0;
@@ -7226,22 +7298,10 @@ var WorkingDayIndex = class {
7226
7298
  return out;
7227
7299
  }
7228
7300
  pieceAt(day) {
7229
- let low = 0;
7230
- let high = this.pieces.length - 1;
7231
- while (low < high) {
7232
- const middle = low + high >> 1;
7233
- if (day >= this.pieces[middle].end)
7234
- low = middle + 1;
7235
- else
7236
- high = middle;
7237
- }
7238
- return low;
7301
+ return pieceIndexAt(this.pieces, day);
7239
7302
  }
7240
7303
  isNonWorking(day) {
7241
- const piece = this.pieces[this.pieceAt(day)];
7242
- if (piece.kind === "mask")
7243
- return piece.off[weekdayOf(day)];
7244
- return piece.kind === "non-working";
7304
+ return isNonWorkingIn(this.pieces, day);
7245
7305
  }
7246
7306
  /** Working days in [from, to), from <= to. */
7247
7307
  count(from, to) {
@@ -37470,6 +37530,23 @@ function buildNonWorkingRuns(scale, ticks, unit, minorGrid) {
37470
37530
  return out;
37471
37531
  });
37472
37532
  }
37533
+ function buildWorkingExceptions(scale) {
37534
+ const runs = scale.calendar?.workingExceptionRuns(scale.domain[0], scale.domain[1]) ?? [];
37535
+ if (runs.length === 0)
37536
+ return void 0;
37537
+ const [left] = scale.range;
37538
+ return runs.map((run2) => ({
37539
+ x: Math.max(left, scale.forward(run2.from)),
37540
+ from: run2.from,
37541
+ through: run2.through,
37542
+ titles: run2.titles,
37543
+ label: workingExceptionLabel(run2)
37544
+ }));
37545
+ }
37546
+ function workingExceptionLabel(run2) {
37547
+ const days = daysBetween(run2.from, run2.through) + 1;
37548
+ return `${run2.titles.join(", ")}${RUN_LABEL_DAY_SEPARATOR}+${days}d`;
37549
+ }
37473
37550
  var RUN_LABEL_DAY_SEPARATOR = " \xB7 ";
37474
37551
  function nonWorkingRunLabel(run2, workingWeekdays) {
37475
37552
  let workingDays = 0;
@@ -38673,22 +38750,24 @@ function growChartRightX(ctx, rightX) {
38673
38750
  function nonWorkingRunMarkerId(run2) {
38674
38751
  return `nonworking:${run2.from.toISOString().slice(0, 10)}`;
38675
38752
  }
38753
+ function workingExceptionMarkerId(exception) {
38754
+ return `working:${exception.from.toISOString().slice(0, 10)}`;
38755
+ }
38756
+ function calendarLabelEntry(id, x2, label) {
38757
+ return { id, centerX: x2, radius: 0, title: label, fontSize: 10, bold: false };
38758
+ }
38676
38759
  function nonWorkingRunEntries(runs) {
38677
38760
  const entries = [];
38678
38761
  for (const run2 of runs ?? []) {
38679
38762
  if (run2.label === void 0)
38680
38763
  continue;
38681
- entries.push({
38682
- id: nonWorkingRunMarkerId(run2),
38683
- centerX: run2.x,
38684
- radius: 0,
38685
- title: run2.label,
38686
- fontSize: 10,
38687
- bold: false
38688
- });
38764
+ entries.push(calendarLabelEntry(nonWorkingRunMarkerId(run2), run2.x, run2.label));
38689
38765
  }
38690
38766
  return entries;
38691
38767
  }
38768
+ function workingExceptionEntries(exceptions) {
38769
+ return (exceptions ?? []).map((exception) => calendarLabelEntry(workingExceptionMarkerId(exception), exception.x, exception.label));
38770
+ }
38692
38771
  function markerLabelsRightX(entries, chartLeftX, chartRightX, estimateTextWidth2) {
38693
38772
  let rightX = chartRightX;
38694
38773
  for (const e of entries) {
@@ -38701,12 +38780,15 @@ function markerLabelsRightX(entries, chartLeftX, chartRightX, estimateTextWidth2
38701
38780
  }
38702
38781
  return rightX;
38703
38782
  }
38704
- function setNonWorkingRuns(timeline, scale, unit) {
38783
+ function setCalendarRuns(timeline, scale, unit) {
38705
38784
  const runs = buildNonWorkingRuns(scale, timeline.ticks, unit, timeline.minorGrid);
38706
- if (!runs)
38707
- return;
38708
- timeline.nonWorkingDisplay = scale.showsNonWorking ? "show" : "hide";
38709
- timeline.nonWorking = runs;
38785
+ if (runs) {
38786
+ timeline.nonWorkingDisplay = scale.showsNonWorking ? "show" : "hide";
38787
+ timeline.nonWorking = runs;
38788
+ }
38789
+ const exceptions = buildWorkingExceptions(scale);
38790
+ if (exceptions)
38791
+ timeline.workingExceptions = exceptions;
38710
38792
  }
38711
38793
  var RoadmapNode = class {
38712
38794
  /**
@@ -38762,7 +38844,10 @@ var RoadmapNode = class {
38762
38844
  calendar,
38763
38845
  nonWorking
38764
38846
  });
38765
- const provisionalRunEntries = nonWorkingRunEntries(buildNonWorkingRuns(timeScale, [], scale.unit, false));
38847
+ const provisionalRunEntries = [
38848
+ ...nonWorkingRunEntries(buildNonWorkingRuns(timeScale, [], scale.unit, false)),
38849
+ ...workingExceptionEntries(buildWorkingExceptions(timeScale))
38850
+ ];
38766
38851
  const hasMarkerEntities = resolved.content.anchors.size + resolved.content.milestones.size > 0 || provisionalRunEntries.length > 0;
38767
38852
  const finalChartRightX = originX + totalChartWidth + GUTTER_PX;
38768
38853
  const datePinnedEntries = [];
@@ -38838,7 +38923,7 @@ var RoadmapNode = class {
38838
38923
  minorGrid: headerStyle.minorGrid,
38839
38924
  ...plan ? { waveStrip: { y: waveStripY, height: waveStripHeight } } : {}
38840
38925
  };
38841
- setNonWorkingRuns(timeline, timeScale, scale.unit);
38926
+ setCalendarRuns(timeline, timeScale, scale.unit);
38842
38927
  const markerRowPlacements = /* @__PURE__ */ new Map();
38843
38928
  for (const [id, p] of packed.placements) {
38844
38929
  const centerY = markerRowY + MARKER_ROW_CENTER_OFFSET_PX + p.rowIndex * MARKER_ROW_PITCH_PX;
@@ -38995,7 +39080,7 @@ var RoadmapNode = class {
38995
39080
  timeline.endDate = extendedEndDate;
38996
39081
  timeline.box.width = extendedWidth;
38997
39082
  timeline.ticks = buildHeaderTicks(extendedScale, scale, calendar, locale);
38998
- setNonWorkingRuns(timeline, extendedScale, scale.unit);
39083
+ setCalendarRuns(timeline, extendedScale, scale.unit);
38999
39084
  growChartRightX(ctx, originX + extendedWidth + GUTTER_PX);
39000
39085
  }
39001
39086
  const allMarkerEntries = datePinnedEntries.map((e) => ({
@@ -39018,7 +39103,10 @@ var RoadmapNode = class {
39018
39103
  bold: true
39019
39104
  });
39020
39105
  }
39021
- const runEntries = nonWorkingRunEntries(timeline.nonWorking);
39106
+ const runEntries = [
39107
+ ...nonWorkingRunEntries(timeline.nonWorking),
39108
+ ...workingExceptionEntries(timeline.workingExceptions)
39109
+ ];
39022
39110
  allMarkerEntries.push(...runEntries);
39023
39111
  growChartRightX(ctx, markerLabelsRightX(allMarkerEntries, chartLeftX, ctx.chartRightX, deps.estimateTextWidth));
39024
39112
  for (const lane of swimlanes) {
@@ -39055,6 +39143,13 @@ var RoadmapNode = class {
39055
39143
  run2.labelBox = placement.labelBox;
39056
39144
  run2.labelSide = placement.labelSide;
39057
39145
  }
39146
+ for (const exception of timeline.workingExceptions ?? []) {
39147
+ const placement = ctx.markerRowPlacements.get(workingExceptionMarkerId(exception));
39148
+ if (!placement)
39149
+ continue;
39150
+ exception.labelBox = placement.labelBox;
39151
+ exception.labelSide = placement.labelSide;
39152
+ }
39058
39153
  for (const e of datePinnedEntries) {
39059
39154
  const p = ctx.markerRowPlacements.get(e.id);
39060
39155
  if (!p)
@@ -41317,12 +41412,10 @@ function renderNonWorkingLabels(t, palette, fonts) {
41317
41412
  for (const run2 of t.nonWorking ?? []) {
41318
41413
  if (run2.label === void 0 || !run2.labelBox)
41319
41414
  continue;
41320
- const box = run2.labelBox;
41321
- const centerY = box.y + 4;
41322
41415
  if (run2.cut) {
41323
41416
  parts.push(tag("line", {
41324
41417
  x1: num(run2.x),
41325
- y1: num(centerY),
41418
+ y1: num(run2.labelBox.y + 4),
41326
41419
  x2: num(run2.x),
41327
41420
  y2: num(bottomY),
41328
41421
  stroke: palette.timeline.nonWorkingSeam,
@@ -41330,22 +41423,31 @@ function renderNonWorkingLabels(t, palette, fonts) {
41330
41423
  "stroke-dasharray": "1 3"
41331
41424
  }));
41332
41425
  }
41333
- const isLeft = run2.labelSide === "left";
41334
- const labelAttrs = {
41335
- x: num(isLeft ? box.x + box.width : box.x),
41336
- y: num(centerY + 4),
41337
- "font-family": fonts.sans,
41338
- "font-size": 10,
41339
- fill: palette.timeline.labelText
41340
- };
41341
- if (isLeft)
41342
- labelAttrs["text-anchor"] = "end";
41343
- parts.push(textTag(labelAttrs, run2.label));
41426
+ parts.push(calendarLabelText(run2.label, run2.labelBox, run2.labelSide, palette, fonts));
41427
+ }
41428
+ for (const exception of t.workingExceptions ?? []) {
41429
+ if (!exception.labelBox)
41430
+ continue;
41431
+ parts.push(calendarLabelText(exception.label, exception.labelBox, exception.labelSide, palette, fonts));
41344
41432
  }
41345
41433
  if (parts.length === 0)
41346
41434
  return "";
41347
41435
  return tag("g", { "data-layer": "non-working-label" }, parts.join(""));
41348
41436
  }
41437
+ function calendarLabelText(label, box, side, palette, fonts) {
41438
+ const isLeft = side === "left";
41439
+ const centerY = box.y + 4;
41440
+ const labelAttrs = {
41441
+ x: num(isLeft ? box.x + box.width : box.x),
41442
+ y: num(centerY + 4),
41443
+ "font-family": fonts.sans,
41444
+ "font-size": 10,
41445
+ fill: palette.timeline.labelText
41446
+ };
41447
+ if (isLeft)
41448
+ labelAttrs["text-anchor"] = "end";
41449
+ return textTag(labelAttrs, label);
41450
+ }
41349
41451
  function renderTimeline(t, palette, fonts) {
41350
41452
  const panelFill = palette.timeline.panelFill;
41351
41453
  const borderColor = palette.timeline.border;
@@ -43637,8 +43739,8 @@ function effectiveTheme(theme, systemTheme) {
43637
43739
  }
43638
43740
 
43639
43741
  // src/index.ts
43640
- var version = true ? "0.0.0-dev.20261013003401.g0426eb1" : "0.0.0";
43641
- var sha = true ? "0426eb1" : "unknown";
43742
+ var version = true ? "0.0.0-dev.20261013004110.g00a00d7" : "0.0.0";
43743
+ var sha = true ? "00a00d7" : "unknown";
43642
43744
  var DEFAULT_SELECTOR = "pre code.language-nowline, code.language-nowline";
43643
43745
  var initialConfig = {
43644
43746
  theme: "auto",