@bendyline/squisq 1.5.1 → 1.5.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.
@@ -7,11 +7,11 @@ import {
7
7
  hashString
8
8
  } from "./chunk-FVTQSNR7.js";
9
9
  import {
10
- clipEndpoints,
11
10
  connectorPath,
12
11
  lineStyleDasharray,
13
- shapePath
14
- } from "./chunk-RUDYOTA6.js";
12
+ shapePath,
13
+ snapEndpoints
14
+ } from "./chunk-LTN6I7QW.js";
15
15
  import {
16
16
  DEFAULT_THEME,
17
17
  FRONTMATTER_CUSTOM_TEMPLATES_KEY,
@@ -43,7 +43,7 @@ import {
43
43
  serializeAnnotation,
44
44
  splitKeyValueToken,
45
45
  tokenizeAttrTokens
46
- } from "./chunk-TEEEILMP.js";
46
+ } from "./chunk-BEQODJWV.js";
47
47
  import {
48
48
  extractPlainText,
49
49
  getChildren,
@@ -3672,7 +3672,7 @@ function diagramBlock(input, context) {
3672
3672
  const a = positions.get(edge.source);
3673
3673
  const b = positions.get(edge.target);
3674
3674
  if (!a || !b) continue;
3675
- const { start, end } = clipEndpoints(a, b);
3675
+ const { start, end } = snapEndpoints(a, b);
3676
3676
  const pathLayer = {
3677
3677
  type: "path",
3678
3678
  id: `edge-${edge.id}`,
@@ -4108,7 +4108,7 @@ function drawingBlock(input, context) {
4108
4108
  const a = boxes.get(conn.from);
4109
4109
  const b = boxes.get(conn.to);
4110
4110
  if (!a || !b) continue;
4111
- const { start, end } = clipEndpoints(a, b);
4111
+ const { start, end } = snapEndpoints(a, b);
4112
4112
  const path = {
4113
4113
  type: "path",
4114
4114
  id: `connector-${conn.id}`,
@@ -4472,10 +4472,15 @@ function fitCoverTitleSize(title) {
4472
4472
  const scaled = COVER_TITLE_BASE_PX * Math.sqrt(COVER_TITLE_COMFORTABLE_CHARS / len);
4473
4473
  return Math.max(COVER_TITLE_MIN_BASE_PX, Math.round(scaled));
4474
4474
  }
4475
+ function isStandardLightCover(context) {
4476
+ const { theme } = context;
4477
+ return theme.id === "standard" && relativeLuminance(theme.colors.background) > 0.85;
4478
+ }
4475
4479
  function coverBlock(input, context) {
4476
4480
  const treatment = themedImageTreatment(context, input.imageTreatment);
4477
4481
  const { heroSrc, heroAlt, title, subtitle, ambientMotion, heroCredit, heroLicense } = input;
4478
4482
  const { theme, layout } = context;
4483
+ const standardLightCover = !heroSrc && isStandardLightCover(context);
4479
4484
  const titleFontSize = themedFontSize(fitCoverTitleSize(title), context, true);
4480
4485
  const subtitleFontSize = themedFontSize(40, context, false);
4481
4486
  const layers = [];
@@ -4507,21 +4512,44 @@ function coverBlock(input, context) {
4507
4512
  }
4508
4513
  );
4509
4514
  } else {
4510
- layers.push({
4511
- type: "shape",
4512
- id: "cover-bg",
4513
- content: {
4514
- shape: "rect",
4515
- fill: `radial-gradient(ellipse at 50% 40%, ${theme.colors.primary} 0%, ${theme.colors.background} 100%)`
4516
- },
4517
- position: { x: 0, y: 0, width: "100%", height: "100%" }
4518
- });
4515
+ if (standardLightCover) {
4516
+ layers.push(
4517
+ {
4518
+ type: "shape",
4519
+ id: "cover-bg",
4520
+ content: {
4521
+ shape: "rect",
4522
+ fill: theme.colors.background
4523
+ },
4524
+ position: { x: 0, y: 0, width: "100%", height: "100%" }
4525
+ },
4526
+ {
4527
+ type: "shape",
4528
+ id: "cover-bg-tint",
4529
+ content: {
4530
+ shape: "rect",
4531
+ fill: `radial-gradient(ellipse at 50% 40%, ${withAlpha(theme.colors.primary, 0.16)} 0%, ${withAlpha(theme.colors.primary, 0.07)} 38%, ${withAlpha(theme.colors.primary, 0)} 78%)`
4532
+ },
4533
+ position: { x: 0, y: 0, width: "100%", height: "100%" }
4534
+ }
4535
+ );
4536
+ } else {
4537
+ layers.push({
4538
+ type: "shape",
4539
+ id: "cover-bg",
4540
+ content: {
4541
+ shape: "rect",
4542
+ fill: `radial-gradient(ellipse at 50% 40%, ${theme.colors.primary} 0%, ${theme.colors.background} 100%)`
4543
+ },
4544
+ position: { x: 0, y: 0, width: "100%", height: "100%" }
4545
+ });
4546
+ }
4519
4547
  layers.push({
4520
4548
  type: "shape",
4521
4549
  id: "cover-accent",
4522
4550
  content: {
4523
4551
  shape: "rect",
4524
- fill: "rgba(255, 255, 255, 0.2)"
4552
+ fill: standardLightCover ? withAlpha(theme.colors.primary, 0.24) : "rgba(255, 255, 255, 0.2)"
4525
4553
  },
4526
4554
  position: {
4527
4555
  x: "35%",
@@ -4542,7 +4570,7 @@ function coverBlock(input, context) {
4542
4570
  fontWeight: "bold",
4543
4571
  color: theme.colors.text,
4544
4572
  textAlign: "center",
4545
- shadow: true
4573
+ shadow: !standardLightCover
4546
4574
  }
4547
4575
  },
4548
4576
  position: {
@@ -4563,7 +4591,8 @@ function coverBlock(input, context) {
4563
4591
  style: {
4564
4592
  fontSize: subtitleFontSize,
4565
4593
  fontFamily: getThemeFont(context, "body"),
4566
- color: theme.colors.textMuted,
4594
+ fontWeight: standardLightCover ? "bold" : "normal",
4595
+ color: standardLightCover ? withAlpha(theme.colors.text, 0.78) : theme.colors.textMuted,
4567
4596
  textAlign: "center",
4568
4597
  lineHeight: 1.5
4569
4598
  }
@@ -6331,6 +6360,7 @@ function buildStartBlock(markdownDoc, rootBlocks) {
6331
6360
  }
6332
6361
 
6333
6362
  // src/doc/docToMarkdown.ts
6363
+ var TRANSITION_PARAM_KEYS = ["transition", "transitionDuration", "transitionDirection"];
6334
6364
  function docToMarkdown(doc) {
6335
6365
  const children = [];
6336
6366
  function emitBlock(block) {
@@ -6380,42 +6410,60 @@ function synthesizeAnnotationParagraph(block) {
6380
6410
  return { type: "paragraph", children: [{ type: "text", value: text }] };
6381
6411
  }
6382
6412
  function ensureAnnotation(block, heading) {
6383
- const attrs = ensureTransitionAttributes(block, heading);
6413
+ const { attributes, transitionParams } = ensureTransitionMetadata(block, heading);
6384
6414
  const hasExplicitTemplate = block.template && block.template !== "sectionHeader" && block.autoTemplate !== true;
6385
6415
  const hasOverrides = block.templateOverrides && Object.keys(block.templateOverrides).length > 0;
6386
- if (heading.templateAnnotation) {
6387
- return attrs === heading.attributes ? heading : { ...heading, attributes: attrs };
6416
+ let templateAnnotation = heading.templateAnnotation;
6417
+ if (!templateAnnotation && (hasExplicitTemplate || hasOverrides || transitionParams)) {
6418
+ templateAnnotation = {
6419
+ ...hasExplicitTemplate ? { template: block.template ?? "sectionHeader" } : {},
6420
+ ...hasOverrides ? { params: block.templateOverrides } : {}
6421
+ };
6388
6422
  }
6389
- if (!hasExplicitTemplate && !hasOverrides) {
6390
- return attrs === heading.attributes ? heading : { ...heading, attributes: attrs };
6423
+ if (transitionParams) {
6424
+ templateAnnotation = {
6425
+ ...templateAnnotation ?? {},
6426
+ params: {
6427
+ ...templateAnnotation?.params ?? {},
6428
+ ...transitionParams
6429
+ }
6430
+ };
6391
6431
  }
6392
- return {
6393
- ...heading,
6394
- children: [...heading.children],
6395
- attributes: attrs,
6396
- templateAnnotation: {
6397
- template: block.template ?? "sectionHeader",
6398
- ...hasOverrides ? { params: block.templateOverrides } : {}
6399
- }
6400
- };
6432
+ if (attributes === heading.attributes && templateAnnotation === heading.templateAnnotation) {
6433
+ return heading;
6434
+ }
6435
+ return { ...heading, children: [...heading.children], attributes, templateAnnotation };
6401
6436
  }
6402
- function ensureTransitionAttributes(block, heading) {
6437
+ function ensureTransitionMetadata(block, heading) {
6403
6438
  const transition = block.transition;
6404
- if (!transition) return heading.attributes;
6405
- const attrs = heading.attributes ?? {};
6406
- return {
6439
+ if (!transition) {
6440
+ return { attributes: heading.attributes, transitionParams: void 0 };
6441
+ }
6442
+ const attrs = removeTransitionParams(heading.attributes) ?? {};
6443
+ const attributes = {
6407
6444
  ...attrs,
6408
- params: {
6409
- ...attrs.params ?? {},
6410
- transition: transition.type,
6411
- ...transition.duration !== void 0 ? { transitionDuration: String(transition.duration) } : {},
6412
- ...transition.direction ? { transitionDirection: transition.direction } : {}
6413
- },
6414
6445
  blockMeta: {
6415
6446
  ...attrs.blockMeta ?? {},
6416
6447
  transition
6417
6448
  }
6418
6449
  };
6450
+ return {
6451
+ attributes,
6452
+ transitionParams: {
6453
+ transition: transition.type,
6454
+ ...transition.duration !== void 0 ? { transitionDuration: String(transition.duration) } : {},
6455
+ ...transition.direction ? { transitionDirection: transition.direction } : {}
6456
+ }
6457
+ };
6458
+ }
6459
+ function removeTransitionParams(attrs) {
6460
+ if (!attrs?.params) return attrs;
6461
+ const params = { ...attrs.params };
6462
+ for (const key of TRANSITION_PARAM_KEYS) delete params[key];
6463
+ return {
6464
+ ...attrs,
6465
+ ...Object.keys(params).length > 0 ? { params } : { params: void 0 }
6466
+ };
6419
6467
  }
6420
6468
 
6421
6469
  // src/doc/resolveDocTheme.ts
@@ -7205,4 +7253,4 @@ export {
7205
7253
  validateMarkdownSource,
7206
7254
  validateMarkdownDoc
7207
7255
  };
7208
- //# sourceMappingURL=chunk-LH7I6SH7.js.map
7256
+ //# sourceMappingURL=chunk-5TYS5V3G.js.map