@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/GUIDE.md +47 -28
- package/README.md +24 -5
- package/REFERENCE.md +487 -485
- package/dist/builder.cjs +795 -206
- package/dist/builder.cjs.map +1 -1
- package/dist/builder.js +795 -206
- package/dist/builder.js.map +1 -1
- package/dist/image.cjs +1 -1
- package/dist/image.cjs.map +1 -1
- package/dist/image.js +1 -1
- package/dist/image.js.map +1 -1
- package/dist/inspect.cjs +3601 -0
- package/dist/inspect.cjs.map +1 -0
- package/dist/inspect.d.cts +472 -0
- package/dist/inspect.d.ts +472 -0
- package/dist/inspect.js +3572 -0
- package/dist/inspect.js.map +1 -0
- package/dist/pdf.cjs +54 -9
- package/dist/pdf.cjs.map +1 -1
- package/dist/pdf.js +54 -9
- package/dist/pdf.js.map +1 -1
- package/dist/primitives.cjs +738 -142
- package/dist/primitives.cjs.map +1 -1
- package/dist/primitives.d.cts +558 -158
- package/dist/primitives.d.ts +558 -158
- package/dist/primitives.js +736 -143
- package/dist/primitives.js.map +1 -1
- package/package.json +10 -1
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: {
|
|
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: {
|
|
456
|
-
|
|
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: {
|
|
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 }), {
|
|
500
|
-
|
|
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: "
|
|
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];
|