@embedpdf/plugin-form 3.2.0 → 3.3.0

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/index.cjs CHANGED
@@ -584,8 +584,16 @@ function fieldsWithChangedValues(previous, next) {
584
584
  });
585
585
  }
586
586
  const valueEntryOf = (field) => "valueEntry" in field ? field.valueEntry : null;
587
- /** Whether a widget shows on screen: its `hidden` and `noView` flags hide it. */
588
- const shownOnScreen = (row) => !row.hidden && !row.noView;
587
+ /**
588
+ * Whether a widget's box has an area. One of no size is how a PDF keeps a field that shows
589
+ * nowhere: the field of a document timestamp, an invisible signature.
590
+ */
591
+ const hasArea = (row) => row.rect.width > 0 && row.rect.height > 0;
592
+ /**
593
+ * Whether a widget shows on screen: its `hidden` and `noView` flags hide it, and a box of no
594
+ * size has nothing to show. What doesn't show gets no control, and Tab doesn't stop at it.
595
+ */
596
+ const shownOnScreen = (row) => !row.hidden && !row.noView && hasArea(row);
589
597
  /** The widgets one page shows, from the form's widget rows. */
590
598
  function pageWidgetsOf(index, pageObjectNumber) {
591
599
  const widgets = {};
@@ -3085,7 +3093,8 @@ function createInterchange(ctx, services) {
3085
3093
  * its records and edits them with its tools: select, move, resize, restyle,
3086
3094
  * reorder, delete. Each edit comes back here as the form's ops, in the same
3087
3095
  * change as the rest of it. While the tool fills, nothing is lent, and the
3088
- * form layer draws and fills every widget.
3096
+ * form layer draws and fills every widget. A widget of no size is never lent:
3097
+ * nobody can see it, so nobody should be able to select it by hand.
3089
3098
  */
3090
3099
  const objectNumberOf = (ref) => ref.kind === "objectNumber" ? ref.objectNumber : -1;
3091
3100
  function createWidgetLender(ctx, { fields, design, pictures, looks }, copyOps) {
@@ -3094,8 +3103,8 @@ function createWidgetLender(ctx, { fields, design, pictures, looks }, copyOps) {
3094
3103
  fields.get().snapshot,
3095
3104
  fields.view().snapshot
3096
3105
  ], (lending, confirmed, shown) => lending && confirmed && shown ? {
3097
- confirmed: confirmed.widgets,
3098
- shown: shown.widgets
3106
+ confirmed: confirmed.widgets.filter(hasArea),
3107
+ shown: shown.widgets.filter(hasArea)
3099
3108
  } : null);
3100
3109
  /**
3101
3110
  * Deleted widgets, as the form's ops: a widget leaves its field