@nowline/embed 0.7.0 → 0.8.1

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
@@ -5609,12 +5609,12 @@
5609
5609
  "format": "esm"
5610
5610
  },
5611
5611
  "../core/dist/i18n/codes.js": {
5612
- "bytes": 1668,
5612
+ "bytes": 1915,
5613
5613
  "imports": [],
5614
5614
  "format": "esm"
5615
5615
  },
5616
5616
  "../core/dist/i18n/messages.en.js": {
5617
- "bytes": 4715,
5617
+ "bytes": 5669,
5618
5618
  "imports": [],
5619
5619
  "format": "esm"
5620
5620
  },
@@ -5696,7 +5696,7 @@
5696
5696
  "format": "esm"
5697
5697
  },
5698
5698
  "../core/dist/language/nowline-validator.js": {
5699
- "bytes": 77406,
5699
+ "bytes": 78549,
5700
5700
  "imports": [
5701
5701
  {
5702
5702
  "path": "../../node_modules/.pnpm/langium@4.2.4/node_modules/langium/lib/index.js",
@@ -8917,6 +8917,22 @@
8917
8917
  ],
8918
8918
  "format": "esm"
8919
8919
  },
8920
+ "../layout/dist/layout-insights.js": {
8921
+ "bytes": 3662,
8922
+ "imports": [
8923
+ {
8924
+ "path": "../core/dist/index.js",
8925
+ "kind": "import-statement",
8926
+ "original": "@nowline/core"
8927
+ },
8928
+ {
8929
+ "path": "../layout/dist/item-bar-geometry.js",
8930
+ "kind": "import-statement",
8931
+ "original": "./item-bar-geometry.js"
8932
+ }
8933
+ ],
8934
+ "format": "esm"
8935
+ },
8920
8936
  "../layout/dist/resolve-today.js": {
8921
8937
  "bytes": 9571,
8922
8938
  "imports": [],
@@ -8949,7 +8965,7 @@
8949
8965
  "format": "esm"
8950
8966
  },
8951
8967
  "../layout/dist/index.js": {
8952
- "bytes": 3179,
8968
+ "bytes": 3242,
8953
8969
  "imports": [
8954
8970
  {
8955
8971
  "path": "../layout/dist/capacity.js",
@@ -8981,6 +8997,11 @@
8981
8997
  "kind": "import-statement",
8982
8998
  "original": "./layout.js"
8983
8999
  },
9000
+ {
9001
+ "path": "../layout/dist/layout-insights.js",
9002
+ "kind": "import-statement",
9003
+ "original": "./layout-insights.js"
9004
+ },
8984
9005
  {
8985
9006
  "path": "../layout/dist/resolve-today.js",
8986
9007
  "kind": "import-statement",
@@ -9010,7 +9031,7 @@
9010
9031
  "format": "esm"
9011
9032
  },
9012
9033
  "../browser/dist/diagnostic-row.js": {
9013
- "bytes": 2275,
9034
+ "bytes": 2731,
9014
9035
  "imports": [
9015
9036
  {
9016
9037
  "path": "../core/dist/index.js",
@@ -9120,7 +9141,7 @@
9120
9141
  "format": "esm"
9121
9142
  },
9122
9143
  "../browser/dist/pipeline.js": {
9123
- "bytes": 7172,
9144
+ "bytes": 7936,
9124
9145
  "imports": [
9125
9146
  {
9126
9147
  "path": "../core/dist/index.js",
@@ -9156,7 +9177,7 @@
9156
9177
  "format": "esm"
9157
9178
  },
9158
9179
  "../browser/dist/index.js": {
9159
- "bytes": 1218,
9180
+ "bytes": 1267,
9160
9181
  "imports": [
9161
9182
  {
9162
9183
  "path": "../layout/dist/index.js",
@@ -9283,7 +9304,7 @@
9283
9304
  "imports": [],
9284
9305
  "exports": [],
9285
9306
  "inputs": {},
9286
- "bytes": 3357583
9307
+ "bytes": 3370631
9287
9308
  },
9288
9309
  "dist/nowline.min.js": {
9289
9310
  "imports": [],
@@ -10242,7 +10263,7 @@
10242
10263
  "bytesInOutput": 182
10243
10264
  },
10244
10265
  "../core/dist/i18n/messages.en.js": {
10245
- "bytesInOutput": 3229
10266
+ "bytesInOutput": 4034
10246
10267
  },
10247
10268
  "../core/dist/i18n/messages.fr.js": {
10248
10269
  "bytesInOutput": 4425
@@ -10263,7 +10284,7 @@
10263
10284
  "bytesInOutput": 5776
10264
10285
  },
10265
10286
  "../core/dist/language/nowline-validator.js": {
10266
- "bytesInOutput": 26567
10287
+ "bytesInOutput": 26827
10267
10288
  },
10268
10289
  "../core/dist/language/nowline-module.js": {
10269
10290
  "bytesInOutput": 831
@@ -10499,11 +10520,14 @@
10499
10520
  "../layout/dist/layout.js": {
10500
10521
  "bytesInOutput": 12623
10501
10522
  },
10523
+ "../layout/dist/layout-insights.js": {
10524
+ "bytesInOutput": 1202
10525
+ },
10502
10526
  "../layout/dist/resolve-today.js": {
10503
10527
  "bytesInOutput": 2264
10504
10528
  },
10505
10529
  "../browser/dist/diagnostic-row.js": {
10506
- "bytesInOutput": 699
10530
+ "bytesInOutput": 838
10507
10531
  },
10508
10532
  "../browser/dist/no-op-include-resolver.js": {
10509
10533
  "bytesInOutput": 189
@@ -10530,7 +10554,7 @@
10530
10554
  "bytesInOutput": 0
10531
10555
  },
10532
10556
  "../browser/dist/pipeline.js": {
10533
- "bytesInOutput": 1669
10557
+ "bytesInOutput": 1904
10534
10558
  },
10535
10559
  "../browser/dist/index.js": {
10536
10560
  "bytesInOutput": 0
@@ -10554,7 +10578,7 @@
10554
10578
  "bytesInOutput": 257
10555
10579
  }
10556
10580
  },
10557
- "bytes": 666048
10581
+ "bytes": 668684
10558
10582
  }
10559
10583
  }
10560
10584
  }
@@ -1,4 +1,4 @@
1
- /*! @nowline/embed 0.7.0 sha=0f07e00 built=2026-06-10T21:34:55-07:00 */
1
+ /*! @nowline/embed 0.8.1 sha=d5d3c34 built=2026-06-17T18:31:53Z */
2
2
  var __create = Object.create;
3
3
  var __defProp = Object.defineProperty;
4
4
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -29018,7 +29018,16 @@ var messages = {
29018
29018
  // Item
29019
29019
  "NL.E0600": (a) => `Item "${a.name}" requires a "size:" or "duration:" property.`,
29020
29020
  // Warnings
29021
- "NL.W0700": (a) => `Unknown property "${a.key}" on ${a.entity}. The renderer ignores it.${a.suggested ? ` Did you mean "${a.suggested}"?` : ""}`
29021
+ "NL.W0700": (a) => `Unknown property "${a.key}" on ${a.entity}. The renderer ignores it.${a.suggested ? ` Did you mean "${a.suggested}"?` : ""}`,
29022
+ // Layout warnings
29023
+ "NL.W1000": (a) => `Now-line date ${a.date} is outside the roadmap window (${a.start} \u2013 ${a.end}); it will not be drawn.`,
29024
+ // Layout insights (informational)
29025
+ "NL.I1000": (a) => `Title on item "${a.name}" is wider than its bar at this scale; it rendered to the right of the bar.`,
29026
+ "NL.I1001": (a) => `Label chips on item "${a.name}" did not fit inside the bar; they rendered in a spill column to the right.`,
29027
+ "NL.I1002": (a) => `Item "${a.name}" is too narrow to show its marker at this scale; decorations spilled beside the bar.`,
29028
+ "NL.I1003": (a) => a.anchor ? `Item "${a.name}" extends past its "before:" anchor "${a.anchor}".` : `Item "${a.name}" extends past its "before:" anchor.`,
29029
+ "NL.I1004": (a) => `Swimlane "${a.lane}" packed into ${a.rows} rows to avoid overlap.`,
29030
+ "NL.I1005": (a) => `Swimlane "${a.lane}" is over capacity in one or more periods (red utilization band).`
29022
29031
  };
29023
29032
 
29024
29033
  // ../core/dist/i18n/messages.fr.js
@@ -29752,6 +29761,21 @@ function suggestKey(key, candidates, cap = 2) {
29752
29761
  }
29753
29762
  return best;
29754
29763
  }
29764
+ var CONCEPT_ALIASES = [
29765
+ {
29766
+ keys: /* @__PURE__ */ new Set(["progress", "percent", "percentage", "pct", "complete", "completion"]),
29767
+ requires: "remaining",
29768
+ suggest: "status: + remaining:"
29769
+ }
29770
+ ];
29771
+ function suggestConcept(key, known) {
29772
+ const lower = key.toLowerCase();
29773
+ for (const alias of CONCEPT_ALIASES) {
29774
+ if (alias.keys.has(lower) && known.has(alias.requires))
29775
+ return alias.suggest;
29776
+ }
29777
+ return void 0;
29778
+ }
29755
29779
  function propKey2(prop) {
29756
29780
  return prop.key.endsWith(":") ? prop.key.slice(0, -1) : prop.key;
29757
29781
  }
@@ -30409,7 +30433,7 @@ var NowlineValidator = class {
30409
30433
  if (computedBanned?.has(key))
30410
30434
  continue;
30411
30435
  const candidates = [...known, ...UNIVERSAL_ENTITY_PROPS];
30412
- const suggested = suggestKey(key, candidates) ?? "";
30436
+ const suggested = suggestConcept(key, known) ?? suggestKey(key, candidates) ?? "";
30413
30437
  acceptTr(accept, "warning", { node: prop, property: "key" }, "NL.W0700", {
30414
30438
  key,
30415
30439
  entity: describeNode(node),
@@ -37270,6 +37294,88 @@ function layoutRoadmap(file, resolved, options = {}) {
37270
37294
  });
37271
37295
  }
37272
37296
 
37297
+ // ../layout/dist/layout-insights.js
37298
+ function formatIsoDate(d) {
37299
+ return d.toISOString().slice(0, 10);
37300
+ }
37301
+ function itemLabel(item) {
37302
+ return item.id ?? item.title;
37303
+ }
37304
+ function walkTrackChildren(children, visit) {
37305
+ for (const child of children) {
37306
+ if (child.kind === "item") {
37307
+ visit(child);
37308
+ } else {
37309
+ walkTrackChildren(child.children, visit);
37310
+ }
37311
+ }
37312
+ }
37313
+ function collectItemInsights(item, locale2, out) {
37314
+ const name = itemLabel(item);
37315
+ if (item.textSpills) {
37316
+ out.push(makeInsight(locale2, "NL.I1000", "info", { name }, name));
37317
+ }
37318
+ if (item.chipsOutside) {
37319
+ out.push(makeInsight(locale2, "NL.I1001", "info", { name }, name));
37320
+ }
37321
+ const tooNarrow = item.box.width < MIN_BAR_WIDTH_FOR_DOT_PX || item.dotSpills || item.iconSpills || item.footnoteSpills;
37322
+ if (tooNarrow) {
37323
+ out.push(makeInsight(locale2, "NL.I1002", "info", { name }, name));
37324
+ }
37325
+ if (item.hasOverflow) {
37326
+ out.push(makeInsight(locale2, "NL.I1003", "info", { name, anchor: item.overflowAnchorId }, name));
37327
+ }
37328
+ }
37329
+ function makeInsight(locale2, code, severity, args, entityId) {
37330
+ return {
37331
+ message: tr(locale2, code, args),
37332
+ severity,
37333
+ code,
37334
+ entityId,
37335
+ lspSeverity: severity === "warning" ? 2 : 3,
37336
+ data: { code, args }
37337
+ };
37338
+ }
37339
+ function collectSwimlaneInsights(lane, locale2, out) {
37340
+ const laneName = lane.id ?? lane.title;
37341
+ const items = [];
37342
+ walkTrackChildren(lane.children, (item) => items.push(item));
37343
+ for (const item of items) {
37344
+ collectItemInsights(item, locale2, out);
37345
+ }
37346
+ const rowYs = new Set(items.map((i) => i.box.y));
37347
+ if (rowYs.size > 1) {
37348
+ out.push(makeInsight(locale2, "NL.I1004", "info", { lane: laneName, rows: rowYs.size }, laneName));
37349
+ }
37350
+ const hasRed = lane.utilization?.segments.some((s) => s.classification === "red") ?? false;
37351
+ if (hasRed) {
37352
+ out.push(makeInsight(locale2, "NL.I1005", "info", { lane: laneName }, laneName));
37353
+ }
37354
+ for (const nested of lane.nested) {
37355
+ collectSwimlaneInsights(nested, locale2, out);
37356
+ }
37357
+ }
37358
+ function collectLayoutInsights(layout, context = {}) {
37359
+ const locale2 = context.locale ?? "en-US";
37360
+ const out = [];
37361
+ for (const lane of layout.swimlanes) {
37362
+ collectSwimlaneInsights(lane, locale2, out);
37363
+ }
37364
+ if (context.today) {
37365
+ const today = context.today;
37366
+ const start = layout.timeline.startDate;
37367
+ const end = layout.timeline.endDate;
37368
+ if (today < start || today > end) {
37369
+ out.push(makeInsight(locale2, "NL.W1000", "warning", {
37370
+ date: formatIsoDate(today),
37371
+ start: formatIsoDate(start),
37372
+ end: formatIsoDate(end)
37373
+ }));
37374
+ }
37375
+ }
37376
+ return out;
37377
+ }
37378
+
37273
37379
  // ../layout/dist/resolve-today.js
37274
37380
  var TimezoneError = class extends Error {
37275
37381
  constructor(message) {
@@ -37376,9 +37482,16 @@ function resolveToday(opts = {}) {
37376
37482
  }
37377
37483
 
37378
37484
  // ../browser/dist/diagnostic-row.js
37485
+ function mapLangiumSeverity(severity) {
37486
+ if (severity === 2)
37487
+ return "warning";
37488
+ if (severity === 3)
37489
+ return "info";
37490
+ return "error";
37491
+ }
37379
37492
  function fromLangiumDiagnostic(diag, file) {
37380
37493
  return {
37381
- severity: diag.severity === 2 ? "warning" : "error",
37494
+ severity: mapLangiumSeverity(diag.severity),
37382
37495
  // resolveDiagnosticCode prefers the stable validator code (NL.Exxxx)
37383
37496
  // carried in `data` so the preview table matches the CLI / Problems
37384
37497
  // panel, then falls back to Langium's `code`, then a message heuristic.
@@ -37430,6 +37543,16 @@ function fromRenderWarning(message, file, severity = "warning") {
37430
37543
  column: 1
37431
37544
  };
37432
37545
  }
37546
+ function fromLayoutInsight(insight, file) {
37547
+ return {
37548
+ severity: insight.severity,
37549
+ code: insight.code,
37550
+ message: insight.message,
37551
+ file,
37552
+ line: 1,
37553
+ column: 1
37554
+ };
37555
+ }
37433
37556
 
37434
37557
  // ../browser/dist/no-op-include-resolver.js
37435
37558
  var NOWLINE_BROWSER_NOOP_INCLUDE_TAG = "__nowline_browser_noop_include__";
@@ -39193,6 +39316,19 @@ async function renderSvg(model, options = {}) {
39193
39316
 
39194
39317
  // ../browser/dist/pipeline.js
39195
39318
  var DEFAULT_SYNTHETIC_PATH = "/browser-source.nowline";
39319
+ var SEVERITY_RANK = {
39320
+ error: 3,
39321
+ warning: 2,
39322
+ info: 1
39323
+ };
39324
+ var LEVEL_RANK = {
39325
+ error: 3,
39326
+ warning: 2,
39327
+ info: 1
39328
+ };
39329
+ function severityMeetsDiagnosticLevel(severity, level) {
39330
+ return SEVERITY_RANK[severity] >= LEVEL_RANK[level];
39331
+ }
39196
39332
  var cachedServices;
39197
39333
  var docCounter = 0;
39198
39334
  function getServices() {
@@ -39277,6 +39413,11 @@ async function renderSource(source, options = {}) {
39277
39413
  locale: options.locale,
39278
39414
  width: options.width
39279
39415
  });
39416
+ const diagnosticLevel = options.diagnosticLevel ?? "error";
39417
+ const layoutInsightRows = collectLayoutInsights(model, {
39418
+ today: today ?? void 0,
39419
+ locale: options.locale ?? "en-US"
39420
+ }).map((insight) => fromLayoutInsight(insight, filePath));
39280
39421
  const showLinks = options.showLinks !== false;
39281
39422
  const strict = options.strict === true;
39282
39423
  const warnMessages = [];
@@ -39288,7 +39429,10 @@ async function renderSource(source, options = {}) {
39288
39429
  warn: (msg) => warnMessages.push(msg),
39289
39430
  fontFamilies: options.fontFamilies
39290
39431
  });
39291
- const warnings = warnMessages.map((m) => fromRenderWarning(m, filePath, strict ? "error" : "warning"));
39432
+ const warnings = [
39433
+ ...layoutInsightRows,
39434
+ ...warnMessages.map((m) => fromRenderWarning(m, filePath, strict ? "error" : "warning"))
39435
+ ].filter((row) => severityMeetsDiagnosticLevel(row.severity, diagnosticLevel));
39292
39436
  if (strict && warnings.length > 0) {
39293
39437
  return { kind: "diagnostics", diagnostics: [...rows, ...warnings] };
39294
39438
  }
@@ -40019,8 +40163,8 @@ function effectiveTheme(theme, systemTheme) {
40019
40163
  }
40020
40164
 
40021
40165
  // src/index.ts
40022
- var version = true ? "0.7.0" : "0.0.0";
40023
- var sha = true ? "0f07e00" : "unknown";
40166
+ var version = true ? "0.8.1" : "0.0.0";
40167
+ var sha = true ? "d5d3c34" : "unknown";
40024
40168
  var DEFAULT_SELECTOR = "pre code.language-nowline, code.language-nowline";
40025
40169
  var initialConfig = {
40026
40170
  theme: "auto",