@hyper-elements/react 0.3.0 → 0.3.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/pdf.cjs CHANGED
@@ -440,7 +440,12 @@ var textStyle = {
440
440
  fontFamily: { kind: fontFamily(), label: "Font", inherited: true, support: { email: { level: "full", source: "outlook-captures" }, web: css } },
441
441
  // Word rounds sizes to half points (13px is 10pt): a fraction of a px.
442
442
  fontSize: { kind: length(["px"], { min: 1 }), label: "Font size", inherited: true, mobile: true, support: { email: { level: "full", source: "outlook-captures" }, web: css } },
443
- fontWeight: { kind: fontWeight(), label: "Font weight", inherited: true, support: { email: { level: "full", source: "caniemail" }, web: css } },
443
+ fontWeight: {
444
+ kind: fontWeight(),
445
+ label: "Font weight",
446
+ inherited: true,
447
+ support: { email: { level: "outlook", values: [100, 200, 300, 500], shows: "normal weight: Word draws only normal and bold (600 and over)", source: "caniemail", feature: "css-font-weight" }, web: css }
448
+ },
444
449
  fontStyle: { kind: enumOf(["normal", "italic"]), label: "Font style", inherited: true, support: { email: { level: "full", source: "caniemail" }, web: css } },
445
450
  // Written in px with mso-line-height-rule: exactly, which Word keeps (it drops unitless ones).
446
451
  lineHeight: { kind: lineHeight(), label: "Line height", inherited: true, mobile: true, support: { email: { level: "full", source: "outlook-captures" }, web: css } },
@@ -452,8 +457,21 @@ var textStyle = {
452
457
  support: { email: { level: "outlook", shows: "normal spacing: Word keeps letter spacing but doesn't draw it", source: "outlook-captures" }, web: css }
453
458
  },
454
459
  textAlign: { kind: enumOf(["left", "center", "right", "justify"]), label: "Alignment", inherited: true, mobile: true, support: { email: { level: "full", source: "caniemail" }, web: css } },
455
- textTransform: { kind: enumOf(["none", "uppercase", "lowercase", "capitalize"]), label: "Letter case", inherited: true, support: { email: { level: "full", source: "assumed" }, web: css } },
456
- textDecoration: { kind: enumOf(["none", "underline", "line-through"]), label: "Decoration", support: { email: { level: "full", source: "caniemail" }, web: css } }
460
+ textTransform: {
461
+ kind: enumOf(["none", "uppercase", "lowercase", "capitalize"]),
462
+ label: "Letter case",
463
+ inherited: true,
464
+ support: { email: { level: "outlook", values: ["lowercase"], shows: "the text as written: Word doesn't lowercase it", source: "caniemail", feature: "css-text-transform" }, web: css }
465
+ },
466
+ textDecoration: {
467
+ kind: enumOf(["none", "underline", "line-through"]),
468
+ label: "Decoration",
469
+ support: {
470
+ // Removed, so "none" leaves a link the client's own underline: said only where a line is asked for.
471
+ email: { level: "partial", values: ["underline", "line-through"], shows: "no line: the client removes it", source: "caniemail", feature: "css-text-decoration", clients: ["gmail-app-other", "protonmail", "orange", "sfr"] },
472
+ web: css
473
+ }
474
+ }
457
475
  };
458
476
  var inheritedTextStyle = (({ textDecoration: _, ...rest }) => rest)(textStyle);
459
477
  var boxStyle = {
@@ -466,7 +484,17 @@ var boxStyle = {
466
484
  padding: { kind: insets(), label: "Padding", mobile: true, support: { email: { level: "full", source: "outlook-captures" }, web: css } },
467
485
  backgroundColor: { kind: color(), label: "Background color", support: { email: writer, web: css } },
468
486
  border: { kind: border(), label: "Border", mobile: true, support: { email: { level: "full", source: "caniemail" }, web: css } },
469
- borderRadius: { kind: radius(), label: "Corner radius", support: { email: { level: "outlook", shows: "square corners", source: "caniemail" }, web: css } },
487
+ borderRadius: {
488
+ kind: radius(),
489
+ label: "Corner radius",
490
+ support: {
491
+ email: [
492
+ { level: "outlook", shows: "square corners", source: "caniemail", feature: "css-border-radius" },
493
+ { level: "partial", shows: "square corners", source: "caniemail", feature: "css-border-radius", clients: ["gmx", "web-de", "orange"] }
494
+ ],
495
+ web: css
496
+ }
497
+ },
470
498
  overflow: {
471
499
  kind: enumOf(["visible", "hidden"]),
472
500
  label: "Overflow",
@@ -494,13 +522,27 @@ function pick(group, ...keys) {
494
522
  return Object.fromEntries(keys.map((key) => [key, group[key]]));
495
523
  }
496
524
  var WRITTEN = { email: { level: "full", source: "writer" }, web: { level: "full", source: "writer" } };
525
+ var NO_WEB_FONTS = ["outlook", "outlook-com", "outlook-mac", "outlook-app", "gmail", "gmail-app", "gmail-app-other", "yahoo", "aol", "protonmail", "fastmail", "gmx", "web-de", "orange", "sfr", "laposte", "mail-ru", "ionos"];
497
526
  var ROOT_PROPS = {
498
527
  title: prop(text(), { support: WRITTEN, label: "Title", description: "The document's title (shown in a browser tab, and by some email clients)." }),
499
- lang: prop(text({ maxLength: 35 }), { support: WRITTEN, label: "Language", description: 'Its language, as a BCP 47 tag ("en", "ar").' }),
500
- dir: prop(enumOf(["ltr", "rtl", "auto"]), { support: WRITTEN, label: "Text direction" }),
528
+ lang: prop(text({ maxLength: 35 }), {
529
+ support: {
530
+ ...WRITTEN,
531
+ email: { level: "partial", shows: "no language: the client removes it, and a screen reader reads the email in its own", source: "caniemail", feature: "html-lang", clients: ["hey", "gmx", "web-de", "orange", "ionos"] }
532
+ },
533
+ label: "Language",
534
+ description: 'Its language, as a BCP 47 tag ("en", "ar").'
535
+ }),
536
+ dir: prop(enumOf(["ltr", "rtl", "auto"]), {
537
+ support: {
538
+ ...WRITTEN,
539
+ email: { level: "partial", values: ["rtl", "auto"], shows: "left to right: the client removes the direction", source: "caniemail", feature: "html-dir", clients: ["gmx", "web-de"] }
540
+ },
541
+ label: "Text direction"
542
+ }),
501
543
  fonts: prop(fontFaces(), {
502
544
  support: {
503
- email: { level: "partial", shows: "Apple Mail and iOS Mail load web fonts; Gmail and classic Outlook don't, and show the next font in each stack", source: "caniemail" },
545
+ email: { level: "partial", shows: "no web font loads: the next font in each stack shows", source: "caniemail", feature: "css-at-font-face", clients: NO_WEB_FONTS },
504
546
  web: { level: "full", source: "writer" }
505
547
  },
506
548
  label: "Web fonts",
@@ -592,7 +634,10 @@ defineComponent({
592
634
  style: {},
593
635
  children: {},
594
636
  sizing: "none",
595
- targets: { web: {} }
637
+ targets: { web: {} },
638
+ // A Page's or a Canvas's text has no page to number.
639
+ roots: ["Document"],
640
+ notAllowed: { code: "document/page-number", message: (root) => `A PageNumber is a page's number in a Document; this ${root} has no pages` }
596
641
  });
597
642
  function documentPages(root) {
598
643
  const pages = [];
@@ -711,7 +756,7 @@ var flex2 = (value) => typeof value === "string" ? FLEX[value] : void 0;
711
756
  function alignSelf(child, stack) {
712
757
  const sized = child.style.width !== void 0 || child.style.maxWidth !== void 0;
713
758
  if (child.type === "Divider" || child.definition.sizing !== "shrink" && !sized) return void 0;
714
- const align = stack.style.alignItems;
759
+ const align = child.style.alignSelf ?? stack.style.alignItems;
715
760
  if (align === "stretch") return void 0;
716
761
  if (align) return flex2(align);
717
762
  return { left: "flex-start", justify: "flex-start", center: "center", right: "flex-end" }[stack.text.textAlign];