@embedpdf/models 2.6.2 → 2.8.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.js CHANGED
@@ -931,6 +931,9 @@ var PdfActionType = /* @__PURE__ */ ((PdfActionType2) => {
931
931
  PdfActionType2[PdfActionType2["LaunchAppOrOpenFile"] = 4] = "LaunchAppOrOpenFile";
932
932
  return PdfActionType2;
933
933
  })(PdfActionType || {});
934
+ const AP_MODE_NORMAL = 1;
935
+ const AP_MODE_ROLLOVER = 2;
936
+ const AP_MODE_DOWN = 4;
934
937
  var PdfAnnotationSubtype = /* @__PURE__ */ ((PdfAnnotationSubtype2) => {
935
938
  PdfAnnotationSubtype2[PdfAnnotationSubtype2["UNKNOWN"] = 0] = "UNKNOWN";
936
939
  PdfAnnotationSubtype2[PdfAnnotationSubtype2["TEXT"] = 1] = "TEXT";
@@ -1473,6 +1476,15 @@ function webColorToPdfColor(color) {
1473
1476
  blue: parseInt(b, 16)
1474
1477
  };
1475
1478
  }
1479
+ function getContrastStrokeColor(fillColor) {
1480
+ try {
1481
+ const { red, green, blue } = webColorToPdfColor(fillColor);
1482
+ const luminance = (0.299 * red + 0.587 * green + 0.114 * blue) / 255;
1483
+ return luminance < 0.45 ? "#fff" : "#000";
1484
+ } catch {
1485
+ return "#000";
1486
+ }
1487
+ }
1476
1488
  function pdfAlphaToWebOpacity(alpha) {
1477
1489
  const clamp = (n) => Math.max(0, Math.min(255, n));
1478
1490
  return clamp(alpha) / 255;
@@ -2189,6 +2201,9 @@ class TaskSequence {
2189
2201
  function ignore() {
2190
2202
  }
2191
2203
  export {
2204
+ AP_MODE_DOWN,
2205
+ AP_MODE_NORMAL,
2206
+ AP_MODE_ROLLOVER,
2192
2207
  AllLogger,
2193
2208
  AppearanceMode,
2194
2209
  CompoundTask,
@@ -2274,6 +2289,7 @@ export {
2274
2289
  extractWebOpacity,
2275
2290
  flagsToNames,
2276
2291
  getBlendModeInfo,
2292
+ getContrastStrokeColor,
2277
2293
  getRectCenter,
2278
2294
  getStandardFontDescriptor,
2279
2295
  getTextAlignmentInfo,