rapier-markdown-kit 1.2.48 → 1.2.50

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.
@@ -210,6 +210,24 @@ const REFUSALS = {
210
210
  export_too_large: 'The file is larger than the limit. Split the document.',
211
211
  };
212
212
 
213
+ function sliceTallDrawings(main, pageHeight) {
214
+ const document = main.ownerDocument;
215
+ for (const svg of main.querySelectorAll('svg.rapier-native-flowchart, svg.rapier-diagram')) {
216
+ const box = svg.getBoundingClientRect(), view = (svg.getAttribute('viewBox') || '').trim().split(/[\s,]+/).map(Number);
217
+ if (!(box.height > pageHeight) || view.length !== 4 || !view.every(Number.isFinite) || !(view[2] > 0) || !(view[3] > 0)) continue;
218
+ const unit = view[3] / box.height, windows = [];
219
+ for (let offset = 0; offset < box.height; offset += pageHeight) {
220
+ const shown = Math.min(pageHeight, box.height - offset), part = svg.cloneNode(true);
221
+ part.setAttribute('viewBox', [view[0], view[1] + offset * unit, view[2], shown * unit].join(' '));
222
+ part.setAttribute('preserveAspectRatio', 'xMidYMin meet');
223
+ part.style.setProperty('width', box.width + 'px', 'important'); part.style.setProperty('height', shown + 'px', 'important');
224
+ part.style.setProperty('break-before', 'column', 'important'); part.style.setProperty('break-inside', 'avoid', 'important');
225
+ windows.push(part);
226
+ }
227
+ svg.replaceWith(...windows);
228
+ }
229
+ }
230
+
213
231
  async function _rapierWritePrintPdf({root, css, fontCss = '', canonical, bom = false, filename, title, settings, templatePage = null}, {capture, signal, current, maxBytes = 8 * 1024 * 1024, film, ink} = {}) {
214
232
  const refuse = code => { throw Object.assign(new Error(code), {code}); };
215
233
  const spoken = error => {
@@ -295,6 +313,7 @@ async function _rapierWritePrintPdf({root, css, fontCss = '', canonical, bom = f
295
313
  if (holder && !holder.textContent.trim() && !holder.querySelector('img,svg,math,table,pre')) holder.remove();
296
314
  }
297
315
  }
316
+ sliceTallDrawings(main, bodyHeight);
298
317
  wrapMasks(main);
299
318
  check();
300
319
  for (const node of [main, ...main.querySelectorAll('*')]) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rapier-markdown-kit",
3
- "version": "1.2.48",
3
+ "version": "1.2.50",
4
4
  "description": "Read, render and write Self-contained Markdown: one .md file that carries its pictures, drawings and layout, and that any Markdown app can read. HTML renderer, stylesheet, text layout, Will/1 agent permissions, and an edit history with authorship and offline merge. MIT, no dependencies.",
5
5
  "keywords": [
6
6
  "markdown",
package/style.css CHANGED
@@ -220,30 +220,46 @@
220
220
  :where(.md-render) svg.rapier-native-flowchart{display:block;margin-inline:auto;height:auto}
221
221
  :where(.md-render) svg.rapier-diagram{display:block;margin-inline:auto;height:auto;text-rendering:optimizeLegibility}
222
222
  /* The same token bridge serves the document, live preview and portable page. Pele reads --pele-* names; the
223
- adapter (_presentPele in shell/plugin-loader.js) points them at these --md-pele-* names, and the app's own sheet
223
+ theme (presentPele in shell/diagram-theme.mjs) points them at these --md-pele-* names, and the app's own sheet
224
224
  lets its theme (--color-*, --font-*) lead them in the editor. */
225
225
  :where(.md-render) :is(.diagram-block,.diagram-live-preview){
226
- --md-pele-bg:transparent;
226
+ /* v1.2.11's palette (--md-mermaid-*): warm surfaces with a gray edge, Rapier's twelve series and their tints. */
227
+ --md-pele-bg:var(--md-color-bg);
227
228
  --md-pele-fg:var(--md-color-text);
228
229
  --md-pele-line:var(--md-color-text);
229
- --md-pele-muted:var(--md-color-text-secondary);
230
- --md-pele-surface:var(--md-color-surface-2);
231
- --md-pele-surface-alt:var(--md-color-border-focus);
232
- --md-pele-border:var(--md-color-border);
233
- --md-pele-accent:var(--md-color-accent);
230
+ --md-pele-muted:var(--md-mermaid-muted);
231
+ --md-pele-surface:var(--md-mermaid-surface);
232
+ --md-pele-surface-alt:var(--md-color-surface);
233
+ --md-pele-border:var(--md-mermaid-border);
234
+ --md-pele-accent:var(--md-mermaid-series-1);
235
+ --md-pele-critical:var(--md-mermaid-series-5);
234
236
  --md-pele-font:var(--md-font-sans);
235
237
  --md-pele-font-mono:var(--md-font-mono);
236
238
  --md-pele-radius:0;
237
239
  --md-pele-heading-weight:var(--md-fw-semibold);
238
- --md-pele-title-weight:var(--md-fw-semibold);
239
- --md-pele-series-1:var(--md-pele-accent);
240
- --md-pele-series-2:#4f91f7;
241
- --md-pele-series-3:#35c57a;
242
- --md-pele-series-4:#e6b91e;
243
- --md-pele-series-5:#9b6dea;
244
- --md-pele-series-6:#f05a62;
245
- --md-pele-series-7:color-mix(in srgb,var(--md-pele-accent) 50%,#4f91f7);
246
- --md-pele-series-8:color-mix(in srgb,#9b6dea 50%,#f05a62);
240
+ --md-pele-title-weight:700;
241
+ --md-pele-series-1:var(--md-mermaid-series-1);
242
+ --md-pele-series-2:var(--md-mermaid-series-2);
243
+ --md-pele-series-3:var(--md-mermaid-series-3);
244
+ --md-pele-series-4:var(--md-mermaid-series-4);
245
+ --md-pele-series-5:var(--md-mermaid-series-5);
246
+ --md-pele-series-6:var(--md-mermaid-series-6);
247
+ --md-pele-series-7:var(--md-mermaid-series-7);
248
+ --md-pele-series-8:var(--md-mermaid-series-8);
249
+ --md-pele-series-9:var(--md-mermaid-series-9);
250
+ --md-pele-series-10:var(--md-mermaid-series-10);
251
+ --md-pele-series-11:var(--md-mermaid-series-11);
252
+ --md-pele-series-12:var(--md-mermaid-series-12);
253
+ /* C4's own blues and architecture's icon tiles, as v1.2.11 drew them, with a lighter twin on dark paper. */
254
+ --md-diagram-c4-person:light-dark(#08427b,#6a9fe0);
255
+ --md-diagram-c4-system:light-dark(#1168bd,#7fb0ea);
256
+ --md-diagram-c4-container:light-dark(#438dd5,#93c1f0);
257
+ --md-diagram-c4-component:light-dark(#85bbf0,#c2dcf7);
258
+ --md-diagram-c4-external:light-dark(#7a7a7a,#c4c4c4);
259
+ --md-diagram-c4-ink:light-dark(#ffffff,#0b1a2b);
260
+ --md-diagram-c4-component-ink:light-dark(#0b1a2b,#0b1a2b);
261
+ --md-diagram-tile:light-dark(#087ebf,#4aa3dc);
262
+ --md-diagram-tile-ink:light-dark(#ffffff,#04121c);--md-diagram-tile-ink-deep:light-dark(#ffffff,#f4f1ea);
247
263
  }
248
264
 
249
265
  /* Radar gives these SVG labels a color declaration; SVG text needs a fill. */
@@ -251,7 +267,7 @@
251
267
  /* Multiplying a ribbon by black paper makes its entire flow disappear. */
252
268
  :where(.md-render) svg.rapier-diagram[aria-roledescription="sankey"] .link{mix-blend-mode:normal!important}
253
269
  /* Captions keep their baseline while masking chart marks behind their letters. */
254
- :where(.md-render) svg.rapier-diagram[aria-roledescription="c4"] text:not(.c4-shape *),
270
+ :where(.md-render) svg.rapier-diagram[aria-roledescription="c4"] text:not(.c4-shape *,.pele-node *),
255
271
  :where(.md-render) svg.rapier-diagram[aria-roledescription="architecture"] .architecture-service text,
256
272
  :where(.md-render) svg.rapier-diagram[aria-roledescription="wardley"] .wardley-node-label,
257
273
  :where(.md-render) svg.rapier-diagram[aria-roledescription="xychart"] [class^="line-plot-"]>.labels>text,
@@ -264,9 +280,12 @@
264
280
  @media (prefers-reduced-motion:reduce){
265
281
  :where(.md-render) svg.rapier-diagram[aria-roledescription^="flowchart"] :is(path,line,polyline):is(.edge-animation-fast,.edge-animation-slow){animation:none!important;stroke-dashoffset:0!important}
266
282
  }
267
- /* Printed diagrams fit the page. */
283
+ /* Printed diagrams fit the page's width, at their own size; a drawing taller than a page continues onto the next (the
284
+ export slices it, the browser's print fragments it) and the figure's screen height is not held. */
268
285
  @media print{
269
- :where(.md-render) .diagram-block{overflow:visible!important}
286
+ :where(.md-render) .diagram-block{overflow:visible!important;min-height:0!important}
287
+ /* The frame's rules are a background, not ink, and the figure's box and its cache hold no words: the drawing alone is the block. */
288
+ :where(.md-render) .diagram-block:is([data-diagram-state="ready"],[data-diagram-state="idle"]),:where(.md-render) .diagram-block .diagram-cache{display:contents!important}
270
289
  :where(.md-render) svg.rapier-diagram,:where(.md-render) svg.rapier-native-flowchart{width:auto!important;max-width:100%!important}
271
290
  }
272
291
  :where(.md-render) .diagram-reason {