@fuentis/phoenix-ui 0.0.9-alpha.610 → 0.0.9-alpha.612

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.
@@ -2462,6 +2462,36 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImpo
2462
2462
  }]
2463
2463
  }], ctorParameters: () => [{ type: i1$2.DatePipe }] });
2464
2464
 
2465
+ // DejaVu Sans font in base64 format for jsPDF
2466
+ // This font has excellent support for Serbian characters (ć, č, đ, š, ž)
2467
+ // Font source: https://github.com/dejavu-fonts/dejavu-fonts
2468
+ // Note: Full base64 string is very large, so we'll load it dynamically from CDN
2469
+ const DEJAVU_SANS = '';
2470
+ // Function to load DejaVu Sans font dynamically
2471
+ async function loadDejaVuSansFont() {
2472
+ try {
2473
+ const response = await fetch('https://cdn.jsdelivr.net/npm/dejavu-fonts-ttf@2.37.3/ttf/DejaVuSans.ttf');
2474
+ if (!response.ok) {
2475
+ return null;
2476
+ }
2477
+ const arrayBuffer = await response.arrayBuffer();
2478
+ // Convert to base64 using chunking to avoid stack overflow
2479
+ const bytes = new Uint8Array(arrayBuffer);
2480
+ let binary = '';
2481
+ const chunkSize = 8192;
2482
+ for (let i = 0; i < bytes.length; i += chunkSize) {
2483
+ const chunk = bytes.subarray(i, i + chunkSize);
2484
+ binary += String.fromCharCode.apply(null, Array.from(chunk));
2485
+ }
2486
+ const base64 = btoa(binary);
2487
+ return base64;
2488
+ }
2489
+ catch (error) {
2490
+ console.warn('Failed to load DejaVu Sans font from CDN:', error);
2491
+ return null;
2492
+ }
2493
+ }
2494
+
2465
2495
  /* ----------------------------- Helpers ----------------------------- */
2466
2496
  /**
2467
2497
  * Safely retrieves nested object property using dot notation.
@@ -2499,8 +2529,9 @@ function sanitizeText(v) {
2499
2529
  const s = (v ?? '').toString();
2500
2530
  const noHtml = s.replace(/<[^>]*>/g, '');
2501
2531
  // Remove emoji characters - they don't render properly in PDF
2502
- // Emoji ranges: U+1F300–U+1F9FF, U+2600–U+26FF, U+2700–U+27BF, U+FE00–U+FE0F, U+1F900–U+1F9FF, U+1F1E0–U+1F1FF
2503
- const emojiRegex = /[\u{1F300}-\u{1F9FF}\u{2600}-\u{26FF}\u{2700}-\u{27BF}\u{FE00}-\u{FE0F}\u{1F900}-\u{1F9FF}\u{1F1E0}-\u{1F1FF}]/gu;
2532
+ // Note: U+2600–U+26FF (Miscellaneous Symbols, e.g. ♥ ★ ♠) and U+2700–U+27BF (Dingbats) are kept
2533
+ // because Noto Sans supports them and they are legitimate text symbols, not emoji.
2534
+ const emojiRegex = /[\u{1F300}-\u{1F9FF}\u{FE00}-\u{FE0F}\u{1F900}-\u{1F9FF}\u{1F1E0}-\u{1F1FF}]/gu;
2504
2535
  const noEmoji = noHtml.replace(emojiRegex, '');
2505
2536
  return noEmoji
2506
2537
  .replace(/&nbsp;/g, ' ')
@@ -2585,32 +2616,6 @@ function collapseInlineSpaces(s) {
2585
2616
  .replace(/[^\S\r\n]+/g, ' ')
2586
2617
  .trim();
2587
2618
  }
2588
- /**
2589
- * Loads Noto Sans font from CDN for better emoji support
2590
- */
2591
- async function loadNotoSansFont() {
2592
- try {
2593
- // Noto Sans has better Unicode and emoji support than Roboto
2594
- // Try jsDelivr CDN first (more reliable)
2595
- const response = await fetch('https://cdn.jsdelivr.net/gh/google/fonts@main/ofl/notosans/NotoSans-Regular.ttf');
2596
- if (!response.ok) {
2597
- return null;
2598
- }
2599
- const arrayBuffer = await response.arrayBuffer();
2600
- const bytes = new Uint8Array(arrayBuffer);
2601
- let binary = '';
2602
- const chunkSize = 8192;
2603
- for (let i = 0; i < bytes.length; i += chunkSize) {
2604
- const chunk = bytes.subarray(i, i + chunkSize);
2605
- binary += String.fromCharCode.apply(null, Array.from(chunk));
2606
- }
2607
- return btoa(binary);
2608
- }
2609
- catch (error) {
2610
- console.warn('Failed to load Noto Sans font from CDN:', error);
2611
- return null;
2612
- }
2613
- }
2614
2619
  /**
2615
2620
  * Exports table rows to a PDF file using pdfmake.
2616
2621
  * - Uses pdfmake which has excellent Unicode support for Serbian characters (ć, č, đ, š, ž)
@@ -2657,21 +2662,20 @@ async function exportRowsToPdf(columns, rows, columnTypeMap, columnTypeEnum, t,
2657
2662
  pdfMake.vfs = pdfFonts || {};
2658
2663
  }
2659
2664
  try {
2660
- const notoSansFont = await loadNotoSansFont();
2661
- if (notoSansFont) {
2665
+ const dejaVuFont = await loadDejaVuSansFont();
2666
+ if (dejaVuFont) {
2662
2667
  pdfMake.fonts ??= {};
2663
- pdfMake.fonts.NotoSans = {
2664
- normal: 'NotoSans-Regular.ttf',
2665
- bold: 'NotoSans-Bold.ttf',
2666
- italics: 'NotoSans-Italic.ttf',
2667
- bolditalics: 'NotoSans-BoldItalic.ttf',
2668
+ pdfMake.fonts.DejaVuSans = {
2669
+ normal: 'DejaVuSans.ttf',
2670
+ bold: 'DejaVuSans.ttf',
2671
+ italics: 'DejaVuSans.ttf',
2672
+ bolditalics: 'DejaVuSans.ttf',
2668
2673
  };
2669
- pdfMake.vfs['NotoSans-Regular.ttf'] = notoSansFont;
2670
- pdfMake.vfs['NotoSans-Bold.ttf'] = notoSansFont;
2674
+ pdfMake.vfs['DejaVuSans.ttf'] = dejaVuFont;
2671
2675
  }
2672
2676
  }
2673
2677
  catch {
2674
- console.warn('NotoSans not loaded, fallback to Roboto');
2678
+ console.warn('DejaVuSans not loaded, fallback to Roboto');
2675
2679
  }
2676
2680
  /* =========================
2677
2681
  FIXED TABLE WIDTH LOGIC
@@ -2777,7 +2781,7 @@ async function exportRowsToPdf(columns, rows, columnTypeMap, columnTypeEnum, t,
2777
2781
  },
2778
2782
  },
2779
2783
  defaultStyle: {
2780
- font: pdfMake.fonts?.NotoSans ? 'NotoSans' : 'Roboto',
2784
+ font: pdfMake.fonts?.DejaVuSans ? 'DejaVuSans' : 'Roboto',
2781
2785
  },
2782
2786
  };
2783
2787
  pdfMake.createPdf(docDefinition).download(fileName);
@@ -9561,10 +9565,10 @@ class MetaPasswordFieldV2Component {
9561
9565
  return;
9562
9566
  const next = this.getInputValue(event);
9563
9567
  // Prevent redundant emits.
9564
- if (next === this.value) {
9565
- this.cdr.markForCheck();
9566
- return;
9567
- }
9568
+ // if (next === this.value) {
9569
+ // this.cdr.markForCheck();
9570
+ // return;
9571
+ // }
9568
9572
  this.value = next;
9569
9573
  this.onChange(next);
9570
9574
  this.cdr.markForCheck();