@birdycom/omniaui 0.16.2 → 0.17.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.
Files changed (83) hide show
  1. package/bin/lib/copy-js.mjs +8 -0
  2. package/bin/lib/webicons-builtin.json +1 -1
  3. package/dist/back-link.d.ts +6 -0
  4. package/dist/back-link.js +54 -0
  5. package/dist/barcode.d.ts +5 -1
  6. package/dist/barcode.js +29 -8
  7. package/dist/calendar.d.ts +17 -0
  8. package/dist/calendar.js +190 -0
  9. package/dist/code-block.css +3 -0
  10. package/dist/combobox.d.ts +27 -4
  11. package/dist/combobox.js +231 -33
  12. package/dist/components-extra.css +33 -2
  13. package/dist/components.css +2096 -163
  14. package/dist/components.min.css +1 -1
  15. package/dist/countdown.d.ts +11 -0
  16. package/dist/countdown.js +76 -0
  17. package/dist/data-table.d.ts +28 -0
  18. package/dist/data-table.js +186 -18
  19. package/dist/docs-ui.css +11 -1
  20. package/dist/glass-lens.d.ts +41 -0
  21. package/dist/glass-lens.js +307 -0
  22. package/dist/input-mask.d.ts +31 -0
  23. package/dist/input-mask.js +228 -0
  24. package/dist/nav-overflow.d.ts +11 -0
  25. package/dist/nav-overflow.js +151 -0
  26. package/dist/oc-theme.css +1 -1
  27. package/dist/parts/app-0160-apps.css +6 -0
  28. package/dist/parts/app-compound-overlays.css +68 -0
  29. package/dist/parts/app-countdown.css +66 -0
  30. package/dist/parts/app-data-table-footer.css +6 -3
  31. package/dist/parts/app-data-table-server.css +47 -0
  32. package/dist/parts/app-data-table.css +27 -1
  33. package/dist/parts/app-header-settings.css +9 -0
  34. package/dist/parts/app-mode-badge.css +12 -0
  35. package/dist/parts/app-module-color.css +152 -0
  36. package/dist/parts/app-name-card.css +5 -0
  37. package/dist/parts/app-page-header.css +1 -1
  38. package/dist/parts/app-recovery-codes-extras.css +13 -0
  39. package/dist/parts/app-sidebar-meta.css +14 -3
  40. package/dist/parts/app-sidebar-provider.css +98 -0
  41. package/dist/parts/app-table-actions.css +16 -0
  42. package/dist/parts/app-tree.css +6 -0
  43. package/dist/parts/app-type-picker.css +272 -0
  44. package/dist/parts/data-dl-numbered.css +17 -0
  45. package/dist/parts/data-graph.css +12 -4
  46. package/dist/parts/forms-combobox-catalog.css +142 -0
  47. package/dist/parts/forms-combobox-icons.css +40 -2
  48. package/dist/parts/forms-copy-field-extras.css +47 -0
  49. package/dist/parts/forms-field-extras.css +55 -0
  50. package/dist/parts/forms-form-section.css +39 -1
  51. package/dist/parts/forms-ledger.css +98 -0
  52. package/dist/parts/media-aspect-flush.css +6 -0
  53. package/dist/parts/media-barcode.css +25 -4
  54. package/dist/parts/media-doc-viewer.css +2 -0
  55. package/dist/parts/media-entity-card.css +5 -0
  56. package/dist/parts/media-glass-liquid.css +10 -5
  57. package/dist/parts/media-glass-options.css +37 -5
  58. package/dist/parts/media-glass.css +85 -35
  59. package/dist/parts/media-scrim.css +51 -0
  60. package/dist/parts/nav-topbar-variants.css +12 -4
  61. package/dist/parts/site-header-variants.css +40 -4
  62. package/dist/parts/site-hero-media.css +88 -0
  63. package/dist/parts/site-price-card.css +3 -1
  64. package/dist/parts/site-split-reverse.css +11 -0
  65. package/dist/parts/site-tint-card.css +5 -4
  66. package/dist/parts/utility-hover.css +6 -3
  67. package/dist/showcase.css +73 -31
  68. package/dist/sidebar.d.ts +22 -0
  69. package/dist/sidebar.js +161 -0
  70. package/dist/tabs.d.ts +9 -0
  71. package/dist/tabs.js +104 -0
  72. package/dist/theme.js +20 -4
  73. package/manifest.json +24 -0
  74. package/package.json +10 -2
  75. package/snippets/accordion-accent.html +1 -1
  76. package/snippets/copy-field.html +44 -6
  77. package/snippets/countdown.html +12 -0
  78. package/snippets/dropdown-menu.html +2 -0
  79. package/snippets/glass.html +3 -3
  80. package/snippets/hero-media.html +20 -0
  81. package/snippets/page-header.html +1 -1
  82. package/snippets/recovery-codes.html +55 -6
  83. package/snippets/scrim.html +19 -0
@@ -13,13 +13,21 @@ const SCRIPTS = [
13
13
  ["@birdycom/omniaui", "dist/carousel.js", "oc-carousel.js", "looping carousel (.oc-carousel--loop)"],
14
14
  ["@birdycom/omniaui", "dist/barcode.js", "oc-barcode.js", "barcode SVG (.oc-barcode: EAN-13, EAN-8, UPC-A, Code 128)"],
15
15
  ["@birdycom/omniaui", "dist/lazy.js", "oc-lazy.js", "lazy images: fade in over the placeholder (.oc-lazy)"],
16
+ ["@birdycom/omniaui", "dist/back-link.js", "oc-back-link.js", "back link: history.back() within the site, else the fallback href and label (.oc-back-link[data-oc-back])"],
16
17
  ["@birdycom/omniaui", "dist/contact-form.js", "oc-contact-form.js", "contact form: send with fetch, field errors and the result in place ([data-contact-form])"],
17
18
  ["@birdycom/omniaui", "dist/fly.js", "oc-fly.js", "cards that fly in from the middle of their row on scroll (.oc-reveal--fly)"],
18
19
  ["@birdycom/omniaui", "dist/particles.js", "oc-particles.js", "particle field: drifting points with lines on a background canvas (canvas.oc-particles)"],
19
20
  ["@birdycom/omniaui", "dist/language-select.js", "oc-language-select.js", "language select: go to the chosen language's page, keeping the #hash ([data-oc-language-select])"],
21
+ ["@birdycom/omniaui", "dist/calendar.js", "oc-calendar.js", "calendar: pick a day or a range with a click or Enter, arrow keys between the days ([data-oc-calendar])"],
22
+ ["@birdycom/omniaui", "dist/glass-lens.js", "oc-glass-lens.js", "glass lens: the backdrop bends at the edge of .oc-glass / .oc-glass-bar (Chromium; elsewhere frosted glass); data-oc-glass-drag makes a sheet draggable"],
23
+ ["@birdycom/omniaui", "dist/countdown.js", "oc-countdown.js", "countdown: time left that ticks, turns orange when low and fires oc-countdown-end ([data-oc-countdown])"],
20
24
  ["@birdycom/omniaui", "dist/combobox.js", "oc-combobox.js", "combobox: filter while typing, arrow keys, choose with Enter or a click ([data-oc-combobox])"],
21
25
  ["@birdycom/omniaui", "dist/logo.js", "oc-logo.js", "logo: a neutral plate only in the theme where the logo would disappear (.oc-logo[data-plate=auto])"],
22
26
  ["@birdycom/omniaui", "dist/theme.js","oc-theme.js", "theme: remember the choice of a .oc-theme-switch, data-theme on <html>, a light/dark toggle button"],
27
+ ["@birdycom/omniaui", "dist/tabs.js", "oc-tabs.js", "class-toggle tabs: aria-selected, the .is-active panel and arrow keys ([data-oc-tabs], <x-oc::tabs mode=\"buttons\">)"],
28
+ ["@birdycom/omniaui", "dist/input-mask.js", "oc-input-mask.js", "input masks and validation: IBAN, BIC, VAT, phone or a pattern while typing, checked on blur (input[data-oc-mask], input[data-oc-validate])"],
29
+ ["@birdycom/omniaui", "dist/nav-overflow.js", "oc-nav-overflow.js", "app header overflow: items that do not fit go into a More menu ([data-oc-nav-overflow])"],
30
+ ["@birdycom/omniaui", "dist/sidebar.js", "oc-sidebar.js", "sidebar provider: persist, trigger, rail, mobile overlay ([data-oc-sidebar-provider])"],
23
31
  ["@birdycom/omniaui", "dist/toc.js", "oc-toc.js", "table of contents: highlight the heading you are reading where :target-current is missing (.oc-toc)"],
24
32
  ["@birdycom/omniaui", "dist/form-extras.js", "oc-form-extras.js", "ISO week in date fields, name card rename, avatar picker preview, quantity steps, language code"],
25
33
  ["@birdycom/omniaui-pro", "dist/spotlight.js", "oc-spotlight.js", "spotlight cards (Pro)"],
@@ -1 +1 @@
1
- {"mdi:check":{"body":"<path fill=\"currentColor\" d=\"M21 7L9 19l-5.5-5.5l1.41-1.41L9 16.17L19.59 5.59z\"/>","width":24,"height":24},"mdi:check-all":{"body":"<path fill=\"currentColor\" d=\"M.41 13.41L6 19l1.41-1.42L1.83 12m20.41-6.42L11.66 16.17L7.5 12l-1.43 1.41L11.66 19l12-12M18 7l-1.41-1.42l-6.35 6.35l1.42 1.41z\"/>","width":24,"height":24},"mdi:close":{"body":"<path fill=\"currentColor\" d=\"M19 6.41L17.59 5L12 10.59L6.41 5L5 6.41L10.59 12L5 17.59L6.41 19L12 13.41L17.59 19L19 17.59L13.41 12z\"/>","width":24,"height":24},"mdi:menu":{"body":"<path fill=\"currentColor\" d=\"M3 6h18v2H3zm0 5h18v2H3zm0 5h18v2H3z\"/>","width":24,"height":24},"mdi:magnify":{"body":"<path fill=\"currentColor\" d=\"M9.5 3A6.5 6.5 0 0 1 16 9.5c0 1.61-.59 3.09-1.56 4.23l.27.27h.79l5 5l-1.5 1.5l-5-5v-.79l-.27-.27A6.52 6.52 0 0 1 9.5 16A6.5 6.5 0 0 1 3 9.5A6.5 6.5 0 0 1 9.5 3m0 2C7 5 5 7 5 9.5S7 14 9.5 14S14 12 14 9.5S12 5 9.5 5\"/>","width":24,"height":24},"mdi:dots-vertical":{"body":"<path fill=\"currentColor\" d=\"M12 16a2 2 0 0 1 2 2a2 2 0 0 1-2 2a2 2 0 0 1-2-2a2 2 0 0 1 2-2m0-6a2 2 0 0 1 2 2a2 2 0 0 1-2 2a2 2 0 0 1-2-2a2 2 0 0 1 2-2m0-6a2 2 0 0 1 2 2a2 2 0 0 1-2 2a2 2 0 0 1-2-2a2 2 0 0 1 2-2\"/>","width":24,"height":24},"mdi:content-copy":{"body":"<path fill=\"currentColor\" d=\"M19 21H8V7h11m0-2H8a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h11a2 2 0 0 0 2-2V7a2 2 0 0 0-2-2m-3-4H4a2 2 0 0 0-2 2v14h2V3h12z\"/>","width":24,"height":24},"mdi:chevron-down":{"body":"<path fill=\"currentColor\" d=\"M7.41 8.58L12 13.17l4.59-4.59L18 10l-6 6l-6-6z\"/>","width":24,"height":24},"mdi:chevron-up":{"body":"<path fill=\"currentColor\" d=\"M7.41 15.41L12 10.83l4.59 4.58L18 14l-6-6l-6 6z\"/>","width":24,"height":24},"mdi:chevron-left":{"body":"<path fill=\"currentColor\" d=\"M15.41 16.58L10.83 12l4.58-4.59L14 6l-6 6l6 6z\"/>","width":24,"height":24},"mdi:chevron-right":{"body":"<path fill=\"currentColor\" d=\"M8.59 16.58L13.17 12L8.59 7.41L10 6l6 6l-6 6z\"/>","width":24,"height":24},"mdi:arrow-up":{"body":"<path fill=\"currentColor\" d=\"M13 20h-2V8l-5.5 5.5l-1.42-1.42L12 4.16l7.92 7.92l-1.42 1.42L13 8z\"/>","width":24,"height":24},"mdi:arrow-down":{"body":"<path fill=\"currentColor\" d=\"M11 4h2v12l5.5-5.5l1.42 1.42L12 19.84l-7.92-7.92L5.5 10.5L11 16z\"/>","width":24,"height":24},"mdi:arrow-left":{"body":"<path fill=\"currentColor\" d=\"M20 11v2H8l5.5 5.5l-1.42 1.42L4.16 12l7.92-7.92L13.5 5.5L8 11z\"/>","width":24,"height":24},"mdi:arrow-right":{"body":"<path fill=\"currentColor\" d=\"M4 11v2h12l-5.5 5.5l1.42 1.42L19.84 12l-7.92-7.92L10.5 5.5L16 11z\"/>","width":24,"height":24},"mdi:trash-can-outline":{"body":"<path fill=\"currentColor\" d=\"M9 3v1H4v2h1v13a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V6h1V4h-5V3zM7 6h10v13H7zm2 2v9h2V8zm4 0v9h2V8z\"/>","width":24,"height":24},"mdi:walk":{"body":"<path fill=\"currentColor\" d=\"M14.12 10H19V8.2h-3.62l-2-3.33c-.3-.5-.84-.84-1.46-.84c-.18 0-.34.03-.5.08L6 5.8V11h1.8V7.33l2.11-.66L6 22h1.8l2.87-8.11L13 17v5h1.8v-6.41l-2.49-4.54l.73-2.87M14 3.8c1 0 1.8-.8 1.8-1.8S15 .2 14 .2S12.2 1 12.2 2S13 3.8 14 3.8\"/>","width":24,"height":24},"mdi:flag-checkered":{"body":"<path fill=\"currentColor\" d=\"M14.4 6H20v10h-7l-.4-2H7v7H5V4h9zm-.4 8h2v-2h2v-2h-2V8h-2v2l-1-2V6h-2v2H9V6H7v2h2v2H7v2h2v-2h2v2h2v-2l1 2zm-3-4V8h2v2zm3 0h2v2h-2z\"/>","width":24,"height":24},"mdi:map-marker-outline":{"body":"<path fill=\"currentColor\" d=\"M12 6.5A2.5 2.5 0 0 1 14.5 9a2.5 2.5 0 0 1-2.5 2.5A2.5 2.5 0 0 1 9.5 9A2.5 2.5 0 0 1 12 6.5M12 2a7 7 0 0 1 7 7c0 5.25-7 13-7 13S5 14.25 5 9a7 7 0 0 1 7-7m0 2a5 5 0 0 0-5 5c0 1 0 3 5 9.71C17 12 17 10 17 9a5 5 0 0 0-5-5\"/>","width":24,"height":24},"mdi:target":{"body":"<path fill=\"currentColor\" d=\"M11 2v2.07A8 8 0 0 0 4.07 11H2v2h2.07A8 8 0 0 0 11 19.93V22h2v-2.07A8 8 0 0 0 19.93 13H22v-2h-2.07A8 8 0 0 0 13 4.07V2m-2 4.08V8h2V6.09c2.5.41 4.5 2.41 4.92 4.91H16v2h1.91c-.41 2.5-2.41 4.5-4.91 4.92V16h-2v1.91C8.5 17.5 6.5 15.5 6.08 13H8v-2H6.09C6.5 8.5 8.5 6.5 11 6.08M12 11a1 1 0 0 0-1 1a1 1 0 0 0 1 1a1 1 0 0 0 1-1a1 1 0 0 0-1-1\"/>","width":24,"height":24},"mdi:text":{"body":"<path fill=\"currentColor\" d=\"M21 6v2H3V6zM3 18h9v-2H3zm0-5h18v-2H3z\"/>","width":24,"height":24},"mdi:web":{"body":"<path fill=\"currentColor\" d=\"M16.36 14c.08-.66.14-1.32.14-2s-.06-1.34-.14-2h3.38c.16.64.26 1.31.26 2s-.1 1.36-.26 2m-5.15 5.56c.6-1.11 1.06-2.31 1.38-3.56h2.95a8.03 8.03 0 0 1-4.33 3.56M14.34 14H9.66c-.1-.66-.16-1.32-.16-2s.06-1.35.16-2h4.68c.09.65.16 1.32.16 2s-.07 1.34-.16 2M12 19.96c-.83-1.2-1.5-2.53-1.91-3.96h3.82c-.41 1.43-1.08 2.76-1.91 3.96M8 8H5.08A7.92 7.92 0 0 1 9.4 4.44C8.8 5.55 8.35 6.75 8 8m-2.92 8H8c.35 1.25.8 2.45 1.4 3.56A8 8 0 0 1 5.08 16m-.82-2C4.1 13.36 4 12.69 4 12s.1-1.36.26-2h3.38c-.08.66-.14 1.32-.14 2s.06 1.34.14 2M12 4.03c.83 1.2 1.5 2.54 1.91 3.97h-3.82c.41-1.43 1.08-2.77 1.91-3.97M18.92 8h-2.95a15.7 15.7 0 0 0-1.38-3.56c1.84.63 3.37 1.9 4.33 3.56M12 2C6.47 2 2 6.5 2 12a10 10 0 0 0 10 10a10 10 0 0 0 10-10A10 10 0 0 0 12 2\"/>","width":24,"height":24},"mdi:monitor":{"body":"<path fill=\"currentColor\" d=\"M21 16H3V4h18m0-2H3c-1.11 0-2 .89-2 2v12a2 2 0 0 0 2 2h7v2H8v2h8v-2h-2v-2h7a2 2 0 0 0 2-2V4a2 2 0 0 0-2-2\"/>","width":24,"height":24},"mdi:white-balance-sunny":{"body":"<path fill=\"currentColor\" d=\"m3.55 19.09l1.41 1.41l1.8-1.79l-1.42-1.42M12 6c-3.31 0-6 2.69-6 6s2.69 6 6 6s6-2.69 6-6c0-3.32-2.69-6-6-6m8 7h3v-2h-3m-2.76 7.71l1.8 1.79l1.41-1.41l-1.79-1.8M20.45 5l-1.41-1.4l-1.8 1.79l1.42 1.42M13 1h-2v3h2M6.76 5.39L4.96 3.6L3.55 5l1.79 1.81zM1 13h3v-2H1m12 9h-2v3h2\"/>","width":24,"height":24},"mdi:weather-night":{"body":"<path fill=\"currentColor\" d=\"m17.75 4.09l-2.53 1.94l.91 3.06l-2.63-1.81l-2.63 1.81l.91-3.06l-2.53-1.94L12.44 4l1.06-3l1.06 3zm3.5 6.91l-1.64 1.25l.59 1.98l-1.7-1.17l-1.7 1.17l.59-1.98L15.75 11l2.06-.05L18.5 9l.69 1.95zm-2.28 4.95c.83-.08 1.72 1.1 1.19 1.85c-.32.45-.66.87-1.08 1.27C15.17 23 8.84 23 4.94 19.07c-3.91-3.9-3.91-10.24 0-14.14c.4-.4.82-.76 1.27-1.08c.75-.53 1.93.36 1.85 1.19c-.27 2.86.69 5.83 2.89 8.02a9.96 9.96 0 0 0 8.02 2.89m-1.64 2.02a12.08 12.08 0 0 1-7.8-3.47c-2.17-2.19-3.33-5-3.49-7.82c-2.81 3.14-2.7 7.96.31 10.98c3.02 3.01 7.84 3.12 10.98.31\"/>","width":24,"height":24},"material-symbols:arrow-outward-rounded":{"body":"<path fill=\"currentColor\" d=\"m16 8.4l-8.9 8.9q-.275.275-.7.275t-.7-.275t-.275-.7t.275-.7L14.6 7H7q-.425 0-.712-.288T6 6t.288-.712T7 5h10q.425 0 .713.288T18 6v10q0 .425-.288.713T17 17t-.712-.288T16 16z\"/>","width":24,"height":24},"flag:nl-4x3":{"body":"<path fill=\"#ae1c28\" d=\"M0 0h640v160H0z\"/><path fill=\"#fff\" d=\"M0 160h640v160H0z\"/><path fill=\"#21468b\" d=\"M0 320h640v160H0z\"/>","width":640,"height":480},"flag:be-4x3":{"body":"<g fill-rule=\"evenodd\" stroke-width=\"1pt\"><path fill=\"#000001\" d=\"M0 0h213.3v480H0z\"/><path fill=\"#ffd90c\" d=\"M213.3 0h213.4v480H213.3z\"/><path fill=\"#f31830\" d=\"M426.7 0H640v480H426.7z\"/></g>","width":640,"height":480},"flag:fr-4x3":{"body":"<path fill=\"#000091\" d=\"M0 0h213.3v480H0z\"/><path fill=\"#fff\" d=\"M213.3 0h213.4v480H213.3z\"/><path fill=\"#e1000f\" d=\"M426.7 0H640v480H426.7z\"/>","width":640,"height":480},"flag:de-4x3":{"body":"<path fill=\"#fc0\" d=\"M0 320h640v160H0z\"/><path fill=\"#000001\" d=\"M0 0h640v160H0z\"/><path fill=\"red\" d=\"M0 160h640v160H0z\"/>","width":640,"height":480},"flag:gb-4x3":{"body":"<path fill=\"#012169\" d=\"M0 0h640v480H0z\"/><path fill=\"#fff\" d=\"m75 0l244 181L562 0h78v62L400 241l240 178v61h-80L320 301L81 480H0v-60l239-178L0 64V0z\"/><path fill=\"#c8102e\" d=\"m424 281l216 159v40L369 281zm-184 20l6 35L54 480H0zM640 0v3L391 191l2-44L590 0zM0 0l239 176h-60L0 42z\"/><path fill=\"#fff\" d=\"M241 0v480h160V0zM0 160v160h640V160z\"/><path fill=\"#c8102e\" d=\"M0 193v96h640v-96zM273 0v480h96V0z\"/>","width":640,"height":480},"flag:it-4x3":{"body":"<g fill-rule=\"evenodd\" stroke-width=\"1pt\"><path fill=\"#fff\" d=\"M0 0h640v480H0z\"/><path fill=\"#009246\" d=\"M0 0h213.3v480H0z\"/><path fill=\"#ce2b37\" d=\"M426.7 0H640v480H426.7z\"/></g>","width":640,"height":480},"flag:us-4x3":{"body":"<path fill=\"#bd3d44\" d=\"M0 0h640v480H0\"/><path stroke=\"#fff\" stroke-width=\"37\" d=\"M0 55.3h640M0 129h640M0 203h640M0 277h640M0 351h640M0 425h640\"/><path fill=\"#192f5d\" d=\"M0 0h364.8v258.5H0\"/><marker id=\"SVGEq3dreKJ\" markerHeight=\"30\" markerWidth=\"30\"><path fill=\"#fff\" d=\"m14 0l9 27L0 10h28L5 27z\"/></marker><path fill=\"none\" marker-mid=\"url(#SVGEq3dreKJ)\" d=\"m0 0l16 11h61h61h61h61h60L47 37h61h61h60h61L16 63h61h61h61h61h60L47 89h61h61h60h61L16 115h61h61h61h61h60L47 141h61h61h60h61L16 166h61h61h61h61h60L47 192h61h61h60h61L16 218h61h61h61h61h60z\"/>","width":640,"height":480}}
1
+ {"mdi:check":{"body":"<path fill=\"currentColor\" d=\"M21 7L9 19l-5.5-5.5l1.41-1.41L9 16.17L19.59 5.59z\"/>","width":24,"height":24},"mdi:check-all":{"body":"<path fill=\"currentColor\" d=\"M.41 13.41L6 19l1.41-1.42L1.83 12m20.41-6.42L11.66 16.17L7.5 12l-1.43 1.41L11.66 19l12-12M18 7l-1.41-1.42l-6.35 6.35l1.42 1.41z\"/>","width":24,"height":24},"mdi:close":{"body":"<path fill=\"currentColor\" d=\"M19 6.41L17.59 5L12 10.59L6.41 5L5 6.41L10.59 12L5 17.59L6.41 19L12 13.41L17.59 19L19 17.59L13.41 12z\"/>","width":24,"height":24},"mdi:menu":{"body":"<path fill=\"currentColor\" d=\"M3 6h18v2H3zm0 5h18v2H3zm0 5h18v2H3z\"/>","width":24,"height":24},"mdi:magnify":{"body":"<path fill=\"currentColor\" d=\"M9.5 3A6.5 6.5 0 0 1 16 9.5c0 1.61-.59 3.09-1.56 4.23l.27.27h.79l5 5l-1.5 1.5l-5-5v-.79l-.27-.27A6.52 6.52 0 0 1 9.5 16A6.5 6.5 0 0 1 3 9.5A6.5 6.5 0 0 1 9.5 3m0 2C7 5 5 7 5 9.5S7 14 9.5 14S14 12 14 9.5S12 5 9.5 5\"/>","width":24,"height":24},"mdi:calendar":{"body":"<path fill=\"currentColor\" d=\"M19 19H5V8h14m-3-7v2H8V1H6v2H5c-1.11 0-2 .89-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V5a2 2 0 0 0-2-2h-1V1m-1 11h-5v5h5z\"/>","width":24,"height":24},"mdi:dots-vertical":{"body":"<path fill=\"currentColor\" d=\"M12 16a2 2 0 0 1 2 2a2 2 0 0 1-2 2a2 2 0 0 1-2-2a2 2 0 0 1 2-2m0-6a2 2 0 0 1 2 2a2 2 0 0 1-2 2a2 2 0 0 1-2-2a2 2 0 0 1 2-2m0-6a2 2 0 0 1 2 2a2 2 0 0 1-2 2a2 2 0 0 1-2-2a2 2 0 0 1 2-2\"/>","width":24,"height":24},"mdi:content-copy":{"body":"<path fill=\"currentColor\" d=\"M19 21H8V7h11m0-2H8a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h11a2 2 0 0 0 2-2V7a2 2 0 0 0-2-2m-3-4H4a2 2 0 0 0-2 2v14h2V3h12z\"/>","width":24,"height":24},"mdi:chevron-down":{"body":"<path fill=\"currentColor\" d=\"M7.41 8.58L12 13.17l4.59-4.59L18 10l-6 6l-6-6z\"/>","width":24,"height":24},"mdi:chevron-up":{"body":"<path fill=\"currentColor\" d=\"M7.41 15.41L12 10.83l4.59 4.58L18 14l-6-6l-6 6z\"/>","width":24,"height":24},"mdi:chevron-left":{"body":"<path fill=\"currentColor\" d=\"M15.41 16.58L10.83 12l4.58-4.59L14 6l-6 6l6 6z\"/>","width":24,"height":24},"mdi:chevron-right":{"body":"<path fill=\"currentColor\" d=\"M8.59 16.58L13.17 12L8.59 7.41L10 6l6 6l-6 6z\"/>","width":24,"height":24},"mdi:arrow-up":{"body":"<path fill=\"currentColor\" d=\"M13 20h-2V8l-5.5 5.5l-1.42-1.42L12 4.16l7.92 7.92l-1.42 1.42L13 8z\"/>","width":24,"height":24},"mdi:arrow-down":{"body":"<path fill=\"currentColor\" d=\"M11 4h2v12l5.5-5.5l1.42 1.42L12 19.84l-7.92-7.92L5.5 10.5L11 16z\"/>","width":24,"height":24},"mdi:arrow-left":{"body":"<path fill=\"currentColor\" d=\"M20 11v2H8l5.5 5.5l-1.42 1.42L4.16 12l7.92-7.92L13.5 5.5L8 11z\"/>","width":24,"height":24},"mdi:arrow-right":{"body":"<path fill=\"currentColor\" d=\"M4 11v2h12l-5.5 5.5l1.42 1.42L19.84 12l-7.92-7.92L10.5 5.5L16 11z\"/>","width":24,"height":24},"mdi:trash-can-outline":{"body":"<path fill=\"currentColor\" d=\"M9 3v1H4v2h1v13a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V6h1V4h-5V3zM7 6h10v13H7zm2 2v9h2V8zm4 0v9h2V8z\"/>","width":24,"height":24},"mdi:walk":{"body":"<path fill=\"currentColor\" d=\"M14.12 10H19V8.2h-3.62l-2-3.33c-.3-.5-.84-.84-1.46-.84c-.18 0-.34.03-.5.08L6 5.8V11h1.8V7.33l2.11-.66L6 22h1.8l2.87-8.11L13 17v5h1.8v-6.41l-2.49-4.54l.73-2.87M14 3.8c1 0 1.8-.8 1.8-1.8S15 .2 14 .2S12.2 1 12.2 2S13 3.8 14 3.8\"/>","width":24,"height":24},"mdi:flag-checkered":{"body":"<path fill=\"currentColor\" d=\"M14.4 6H20v10h-7l-.4-2H7v7H5V4h9zm-.4 8h2v-2h2v-2h-2V8h-2v2l-1-2V6h-2v2H9V6H7v2h2v2H7v2h2v-2h2v2h2v-2l1 2zm-3-4V8h2v2zm3 0h2v2h-2z\"/>","width":24,"height":24},"mdi:map-marker-outline":{"body":"<path fill=\"currentColor\" d=\"M12 6.5A2.5 2.5 0 0 1 14.5 9a2.5 2.5 0 0 1-2.5 2.5A2.5 2.5 0 0 1 9.5 9A2.5 2.5 0 0 1 12 6.5M12 2a7 7 0 0 1 7 7c0 5.25-7 13-7 13S5 14.25 5 9a7 7 0 0 1 7-7m0 2a5 5 0 0 0-5 5c0 1 0 3 5 9.71C17 12 17 10 17 9a5 5 0 0 0-5-5\"/>","width":24,"height":24},"mdi:target":{"body":"<path fill=\"currentColor\" d=\"M11 2v2.07A8 8 0 0 0 4.07 11H2v2h2.07A8 8 0 0 0 11 19.93V22h2v-2.07A8 8 0 0 0 19.93 13H22v-2h-2.07A8 8 0 0 0 13 4.07V2m-2 4.08V8h2V6.09c2.5.41 4.5 2.41 4.92 4.91H16v2h1.91c-.41 2.5-2.41 4.5-4.91 4.92V16h-2v1.91C8.5 17.5 6.5 15.5 6.08 13H8v-2H6.09C6.5 8.5 8.5 6.5 11 6.08M12 11a1 1 0 0 0-1 1a1 1 0 0 0 1 1a1 1 0 0 0 1-1a1 1 0 0 0-1-1\"/>","width":24,"height":24},"mdi:text":{"body":"<path fill=\"currentColor\" d=\"M21 6v2H3V6zM3 18h9v-2H3zm0-5h18v-2H3z\"/>","width":24,"height":24},"mdi:web":{"body":"<path fill=\"currentColor\" d=\"M16.36 14c.08-.66.14-1.32.14-2s-.06-1.34-.14-2h3.38c.16.64.26 1.31.26 2s-.1 1.36-.26 2m-5.15 5.56c.6-1.11 1.06-2.31 1.38-3.56h2.95a8.03 8.03 0 0 1-4.33 3.56M14.34 14H9.66c-.1-.66-.16-1.32-.16-2s.06-1.35.16-2h4.68c.09.65.16 1.32.16 2s-.07 1.34-.16 2M12 19.96c-.83-1.2-1.5-2.53-1.91-3.96h3.82c-.41 1.43-1.08 2.76-1.91 3.96M8 8H5.08A7.92 7.92 0 0 1 9.4 4.44C8.8 5.55 8.35 6.75 8 8m-2.92 8H8c.35 1.25.8 2.45 1.4 3.56A8 8 0 0 1 5.08 16m-.82-2C4.1 13.36 4 12.69 4 12s.1-1.36.26-2h3.38c-.08.66-.14 1.32-.14 2s.06 1.34.14 2M12 4.03c.83 1.2 1.5 2.54 1.91 3.97h-3.82c.41-1.43 1.08-2.77 1.91-3.97M18.92 8h-2.95a15.7 15.7 0 0 0-1.38-3.56c1.84.63 3.37 1.9 4.33 3.56M12 2C6.47 2 2 6.5 2 12a10 10 0 0 0 10 10a10 10 0 0 0 10-10A10 10 0 0 0 12 2\"/>","width":24,"height":24},"mdi:monitor":{"body":"<path fill=\"currentColor\" d=\"M21 16H3V4h18m0-2H3c-1.11 0-2 .89-2 2v12a2 2 0 0 0 2 2h7v2H8v2h8v-2h-2v-2h7a2 2 0 0 0 2-2V4a2 2 0 0 0-2-2\"/>","width":24,"height":24},"mdi:white-balance-sunny":{"body":"<path fill=\"currentColor\" d=\"m3.55 19.09l1.41 1.41l1.8-1.79l-1.42-1.42M12 6c-3.31 0-6 2.69-6 6s2.69 6 6 6s6-2.69 6-6c0-3.32-2.69-6-6-6m8 7h3v-2h-3m-2.76 7.71l1.8 1.79l1.41-1.41l-1.79-1.8M20.45 5l-1.41-1.4l-1.8 1.79l1.42 1.42M13 1h-2v3h2M6.76 5.39L4.96 3.6L3.55 5l1.79 1.81zM1 13h3v-2H1m12 9h-2v3h2\"/>","width":24,"height":24},"mdi:weather-night":{"body":"<path fill=\"currentColor\" d=\"m17.75 4.09l-2.53 1.94l.91 3.06l-2.63-1.81l-2.63 1.81l.91-3.06l-2.53-1.94L12.44 4l1.06-3l1.06 3zm3.5 6.91l-1.64 1.25l.59 1.98l-1.7-1.17l-1.7 1.17l.59-1.98L15.75 11l2.06-.05L18.5 9l.69 1.95zm-2.28 4.95c.83-.08 1.72 1.1 1.19 1.85c-.32.45-.66.87-1.08 1.27C15.17 23 8.84 23 4.94 19.07c-3.91-3.9-3.91-10.24 0-14.14c.4-.4.82-.76 1.27-1.08c.75-.53 1.93.36 1.85 1.19c-.27 2.86.69 5.83 2.89 8.02a9.96 9.96 0 0 0 8.02 2.89m-1.64 2.02a12.08 12.08 0 0 1-7.8-3.47c-2.17-2.19-3.33-5-3.49-7.82c-2.81 3.14-2.7 7.96.31 10.98c3.02 3.01 7.84 3.12 10.98.31\"/>","width":24,"height":24},"mdi:lock-outline":{"body":"<path fill=\"currentColor\" d=\"M12 17a2 2 0 0 1-2-2c0-1.11.89-2 2-2a2 2 0 0 1 2 2a2 2 0 0 1-2 2m6 3V10H6v10zm0-12a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V10c0-1.11.89-2 2-2h1V6a5 5 0 0 1 5-5a5 5 0 0 1 5 5v2zm-6-5a3 3 0 0 0-3 3v2h6V6a3 3 0 0 0-3-3\"/>","width":24,"height":24},"mdi:lightbulb-on-outline":{"body":"<path fill=\"currentColor\" d=\"M20 11h3v2h-3zM1 11h3v2H1zM13 1v3h-2V1zM4.92 3.5l2.13 2.14l-1.42 1.41L3.5 4.93zm12.03 2.13l2.12-2.13l1.43 1.43l-2.13 2.12zM12 6a6 6 0 0 1 6 6c0 2.22-1.21 4.16-3 5.2V19a1 1 0 0 1-1 1h-4a1 1 0 0 1-1-1v-1.8c-1.79-1.04-3-2.98-3-5.2a6 6 0 0 1 6-6m2 15v1a1 1 0 0 1-1 1h-2a1 1 0 0 1-1-1v-1zm-3-3h2v-2.13c1.73-.44 3-2.01 3-3.87a4 4 0 0 0-4-4a4 4 0 0 0-4 4c0 1.86 1.27 3.43 3 3.87z\"/>","width":24,"height":24},"mdi:eye":{"body":"<path fill=\"currentColor\" d=\"M12 9a3 3 0 0 0-3 3a3 3 0 0 0 3 3a3 3 0 0 0 3-3a3 3 0 0 0-3-3m0 8a5 5 0 0 1-5-5a5 5 0 0 1 5-5a5 5 0 0 1 5 5a5 5 0 0 1-5 5m0-12.5C7 4.5 2.73 7.61 1 12c1.73 4.39 6 7.5 11 7.5s9.27-3.11 11-7.5c-1.73-4.39-6-7.5-11-7.5\"/>","width":24,"height":24},"mdi:eye-off":{"body":"<path fill=\"currentColor\" d=\"M11.83 9L15 12.16V12a3 3 0 0 0-3-3zm-4.3.8l1.55 1.55c-.05.21-.08.42-.08.65a3 3 0 0 0 3 3c.22 0 .44-.03.65-.08l1.55 1.55c-.67.33-1.41.53-2.2.53a5 5 0 0 1-5-5c0-.79.2-1.53.53-2.2M2 4.27l2.28 2.28l.45.45C3.08 8.3 1.78 10 1 12c1.73 4.39 6 7.5 11 7.5c1.55 0 3.03-.3 4.38-.84l.43.42L19.73 22L21 20.73L3.27 3M12 7a5 5 0 0 1 5 5c0 .64-.13 1.26-.36 1.82l2.93 2.93c1.5-1.25 2.7-2.89 3.43-4.75c-1.73-4.39-6-7.5-11-7.5c-1.4 0-2.74.25-4 .7l2.17 2.15C10.74 7.13 11.35 7 12 7\"/>","width":24,"height":24},"mdi:download":{"body":"<path fill=\"currentColor\" d=\"M5 20h14v-2H5m14-9h-4V3H9v6H5l7 7z\"/>","width":24,"height":24},"mdi:printer":{"body":"<path fill=\"currentColor\" d=\"M18 3H6v4h12m1 5a1 1 0 0 1-1-1a1 1 0 0 1 1-1a1 1 0 0 1 1 1a1 1 0 0 1-1 1m-3 7H8v-5h8m3-6H5a3 3 0 0 0-3 3v6h4v4h12v-4h4v-6a3 3 0 0 0-3-3\"/>","width":24,"height":24},"mdi:alert-outline":{"body":"<path fill=\"currentColor\" d=\"M12 2L1 21h22M12 6l7.53 13H4.47M11 10v4h2v-4m-2 6v2h2v-2\"/>","width":24,"height":24},"mdi:heart":{"body":"<path fill=\"currentColor\" d=\"m12 21.35l-1.45-1.32C5.4 15.36 2 12.27 2 8.5C2 5.41 4.42 3 7.5 3c1.74 0 3.41.81 4.5 2.08C13.09 3.81 14.76 3 16.5 3C19.58 3 22 5.41 22 8.5c0 3.77-3.4 6.86-8.55 11.53z\"/>","width":24,"height":24},"mdi:star":{"body":"<path fill=\"currentColor\" d=\"M12 17.27L18.18 21l-1.64-7.03L22 9.24l-7.19-.62L12 2L9.19 8.62L2 9.24l5.45 4.73L5.82 21z\"/>","width":24,"height":24},"material-symbols:arrow-outward-rounded":{"body":"<path fill=\"currentColor\" d=\"m16 8.4l-8.9 8.9q-.275.275-.7.275t-.7-.275t-.275-.7t.275-.7L14.6 7H7q-.425 0-.712-.288T6 6t.288-.712T7 5h10q.425 0 .713.288T18 6v10q0 .425-.288.713T17 17t-.712-.288T16 16z\"/>","width":24,"height":24},"flag:nl-4x3":{"body":"<path fill=\"#ae1c28\" d=\"M0 0h640v160H0z\"/><path fill=\"#fff\" d=\"M0 160h640v160H0z\"/><path fill=\"#21468b\" d=\"M0 320h640v160H0z\"/>","width":640,"height":480},"flag:be-4x3":{"body":"<g fill-rule=\"evenodd\" stroke-width=\"1pt\"><path fill=\"#000001\" d=\"M0 0h213.3v480H0z\"/><path fill=\"#ffd90c\" d=\"M213.3 0h213.4v480H213.3z\"/><path fill=\"#f31830\" d=\"M426.7 0H640v480H426.7z\"/></g>","width":640,"height":480},"flag:fr-4x3":{"body":"<path fill=\"#000091\" d=\"M0 0h213.3v480H0z\"/><path fill=\"#fff\" d=\"M213.3 0h213.4v480H213.3z\"/><path fill=\"#e1000f\" d=\"M426.7 0H640v480H426.7z\"/>","width":640,"height":480},"flag:de-4x3":{"body":"<path fill=\"#fc0\" d=\"M0 320h640v160H0z\"/><path fill=\"#000001\" d=\"M0 0h640v160H0z\"/><path fill=\"red\" d=\"M0 160h640v160H0z\"/>","width":640,"height":480},"flag:gb-4x3":{"body":"<path fill=\"#012169\" d=\"M0 0h640v480H0z\"/><path fill=\"#fff\" d=\"m75 0l244 181L562 0h78v62L400 241l240 178v61h-80L320 301L81 480H0v-60l239-178L0 64V0z\"/><path fill=\"#c8102e\" d=\"m424 281l216 159v40L369 281zm-184 20l6 35L54 480H0zM640 0v3L391 191l2-44L590 0zM0 0l239 176h-60L0 42z\"/><path fill=\"#fff\" d=\"M241 0v480h160V0zM0 160v160h640V160z\"/><path fill=\"#c8102e\" d=\"M0 193v96h640v-96zM273 0v480h96V0z\"/>","width":640,"height":480},"flag:it-4x3":{"body":"<g fill-rule=\"evenodd\" stroke-width=\"1pt\"><path fill=\"#fff\" d=\"M0 0h640v480H0z\"/><path fill=\"#009246\" d=\"M0 0h213.3v480H0z\"/><path fill=\"#ce2b37\" d=\"M426.7 0H640v480H426.7z\"/></g>","width":640,"height":480},"flag:us-4x3":{"body":"<path fill=\"#bd3d44\" d=\"M0 0h640v480H0\"/><path stroke=\"#fff\" stroke-width=\"37\" d=\"M0 55.3h640M0 129h640M0 203h640M0 277h640M0 351h640M0 425h640\"/><path fill=\"#192f5d\" d=\"M0 0h364.8v258.5H0\"/><marker id=\"SVGEq3dreKJ\" markerHeight=\"30\" markerWidth=\"30\"><path fill=\"#fff\" d=\"m14 0l9 27L0 10h28L5 27z\"/></marker><path fill=\"none\" marker-mid=\"url(#SVGEq3dreKJ)\" d=\"m0 0l16 11h61h61h61h61h60L47 37h61h61h60h61L16 63h61h61h61h61h60L47 89h61h61h60h61L16 115h61h61h61h61h60L47 141h61h61h60h61L16 166h61h61h61h61h60L47 192h61h61h60h61L16 218h61h61h61h61h60z\"/>","width":640,"height":480}}
@@ -0,0 +1,6 @@
1
+ // File: packages/ui/src/back-link.d.ts
2
+ // Types for the back link script.
3
+
4
+ export function canGoBack(win?: Window): boolean;
5
+ export function bindBackLink(link: HTMLAnchorElement): void;
6
+ export function initBackLinks(scope?: ParentNode): void;
@@ -0,0 +1,54 @@
1
+ // File: packages/ui/src/back-link.js
2
+ // Map: same-site history? -> bind one .oc-back-link[data-oc-back] (label, click) -> bind every one -> boot
3
+ // Back link with a fallback: <a class="oc-back-link" href="/products" data-oc-back data-oc-fallback-label="Back to Products">Back</a>.
4
+ // When the visitor came from a page of the same site (document.referrer on this origin, or more than one entry in the
5
+ // tab's history), a click goes back (history.back()) so filters and scroll position stay. Otherwise the link simply
6
+ // follows its href (the fallback) and, with data-oc-fallback-label, shows that label. Without the script it is a plain link.
7
+
8
+ /** True when going back stays on this site: the referrer has this origin, or the tab has more than one history entry. */
9
+ export function canGoBack(win = typeof window === "undefined" ? undefined : window) {
10
+ if (!win) return false;
11
+ try {
12
+ const ref = win.document.referrer;
13
+ if (ref && new URL(ref).origin === win.location.origin) return true;
14
+ } catch {
15
+ // An unparsable referrer counts as none.
16
+ }
17
+ return win.history.length > 1;
18
+ }
19
+
20
+ /** Bind one back link: fallback label now, history.back() on a plain click when there is somewhere to go back to. */
21
+ export function bindBackLink(link) {
22
+ if (!link || link.dataset.ocBound !== undefined) return;
23
+ link.dataset.ocBound = "";
24
+ const win = link.ownerDocument.defaultView;
25
+ const back = canGoBack(win);
26
+ const label = link.dataset.ocFallbackLabel;
27
+ if (!back && label) link.textContent = label;
28
+ link.addEventListener("click", (event) => {
29
+ // Ctrl/Cmd/Shift/middle click: let the browser open the fallback href in a new tab or window.
30
+ if (event.defaultPrevented || event.button !== 0 || event.metaKey || event.ctrlKey || event.shiftKey || event.altKey) return;
31
+ if (!canGoBack(win)) return;
32
+ event.preventDefault();
33
+ win.history.back();
34
+ });
35
+ }
36
+
37
+ /** Bind every .oc-back-link[data-oc-back] under scope. */
38
+ export function initBackLinks(scope = document) {
39
+ scope.querySelectorAll(".oc-back-link[data-oc-back], a[data-oc-back]").forEach(bindBackLink);
40
+ }
41
+
42
+ // Starts on its own as /js/oc-back-link.js (`npx omniaui copy-js`), with ?auto in the URL or data-oc-auto on the tag.
43
+ function autoStart() {
44
+ if (typeof document === "undefined") return false;
45
+ const url = String(import.meta.url);
46
+ if (url.includes("oc-back-link") || /[?&]auto(=|&|$)/.test(url)) return true;
47
+ const file = url.split(/[?#]/)[0];
48
+ return [...document.querySelectorAll("script[data-oc-auto][src]")].some((s) => s.src.split(/[?#]/)[0] === file);
49
+ }
50
+ if (autoStart()) {
51
+ const boot = () => initBackLinks(document);
52
+ if (document.readyState === "loading") document.addEventListener("DOMContentLoaded", boot);
53
+ else boot();
54
+ }
package/dist/barcode.d.ts CHANGED
@@ -8,7 +8,11 @@ export function eanCheck(body: string): string;
8
8
  export function encodeEan(value: string, length: 8 | 13): { bits: string; text: string };
9
9
  export function code128Values(text: string): number[];
10
10
  export function encodeCode128(text: string): { bits: string; text: string };
11
- export function encodeBarcode(value: string, format?: BarcodeFormat | string): { bits: string; text: string };
11
+ export function encodeBarcode(value: string, format?: BarcodeFormat | string): { bits: string; text: string; format: Exclude<BarcodeFormat, "auto"> };
12
+ /** EAN-13 1 6 6, EAN-8 4 4, UPC-A 1 5 5 1 (0.17.0); Code 128 stays one group. */
13
+ export function digitGroups(text: string, format?: string): string[];
14
+ /** The figcaption markup with one span.oc-barcode__group per group (0.17.0). */
15
+ export function digitsHtml(text: string, format?: string, group?: boolean): string;
12
16
  export function barsToSvg(bits: string, label?: string): string;
13
17
  export function barcodeFile(value: string, options?: { format?: BarcodeFormat | string; digits?: boolean; moduleWidth?: number; height?: number }): string;
14
18
  export function renderBarcode(el: HTMLElement): void;
package/dist/barcode.js CHANGED
@@ -1,7 +1,8 @@
1
1
  // File: packages/ui/src/barcode.js
2
- // Map: format guess -> EAN-13 / EAN-8 / UPC-A -> Code 128 (B, or C for even digit runs) -> bars to SVG -> SVG file -> bind -> boot
2
+ // Map: format guess -> EAN-13 / EAN-8 / UPC-A -> Code 128 (B, or C for even digit runs) -> digit groups -> bars to SVG -> SVG file -> bind -> boot
3
3
  // Barcode display without a dependency : <figure class="oc-barcode" data-value="5412345678908">
4
4
  // gets an SVG with the bars and the digits under it. data-format="auto|EAN13|EAN8|UPC|CODE128" (default auto).
5
+ // The digits are grouped like on a product (EAN-13 1 6 6, EAN-8 4 4, UPC-A 1 5 5 1); data-group="false" keeps one run.
5
6
 
6
7
  /** Module widths of the Code 128 symbols 0–105 (6 elements, 11 modules each) and the stop (7 elements, 13 modules). */
7
8
  export const CODE128 = [
@@ -79,15 +80,29 @@ export function encodeCode128(text) {
79
80
  return { bits, text };
80
81
  }
81
82
 
82
- /** Encode a value in a format (auto picks one). Returns the module string and the human-readable text. */
83
+ /** Encode a value in a format (auto picks one). Returns the module string, the human-readable text and the format
84
+ * that was used (EAN13, EAN8, UPC or CODE128). */
83
85
  export function encodeBarcode(value, format = "auto") {
84
86
  const code = String(value ?? "").trim();
85
87
  if (!code) throw new Error("empty value");
86
88
  const kind = format === "auto" ? guessFormat(code) : format.toUpperCase();
87
- if (kind === "EAN13") return encodeEan(code.padStart(code.length === 12 ? 12 : 13, "0"), 13);
88
- if (kind === "UPC") return encodeEan(`0${code}`, 13);
89
- if (kind === "EAN8") return encodeEan(code, 8);
90
- return encodeCode128(code);
89
+ if (kind === "EAN13") return { ...encodeEan(code.padStart(code.length === 12 ? 12 : 13, "0"), 13), format: "EAN13" };
90
+ if (kind === "UPC") return { ...encodeEan(`0${code}`, 13), format: "UPC" };
91
+ if (kind === "EAN8") return { ...encodeEan(code, 8), format: "EAN8" };
92
+ return { ...encodeCode128(code), format: "CODE128" };
93
+ }
94
+
95
+ /** The human-readable text in groups, as printed on a product: EAN-13 1 · 6 · 6, EAN-8 4 · 4, UPC-A 1 · 5 · 5 · 1
96
+ * (the 12 UPC digits, without the leading 0 of its EAN-13 form). Code 128 stays one group. */
97
+ export function digitGroups(text, format) {
98
+ const t = String(text ?? "");
99
+ if (format === "EAN13" && t.length === 13) return [t.slice(0, 1), t.slice(1, 7), t.slice(7)];
100
+ if (format === "EAN8" && t.length === 8) return [t.slice(0, 4), t.slice(4)];
101
+ if (format === "UPC" && t.length === 13) {
102
+ const u = t.slice(1);
103
+ return [u.slice(0, 1), u.slice(1, 6), u.slice(6, 11), u.slice(11)];
104
+ }
105
+ return [t];
91
106
  }
92
107
 
93
108
  /** Text for HTML: the value can come from user input (Code 128 encodes < > & " too). */
@@ -129,15 +144,21 @@ export function barcodeFile(value, { format = "auto", digits = true, moduleWidth
129
144
  return `<svg xmlns="http://www.w3.org/2000/svg" width="${width}" height="${full}" viewBox="0 0 ${width} ${full}"><rect width="100%" height="100%" fill="#fff"/><g fill="#000">${rects}${caption}</g></svg>`;
130
145
  }
131
146
 
147
+ /** The figcaption with the digits: one span per group (textContent stays the plain number for copy and tests). */
148
+ export function digitsHtml(text, format, group = true) {
149
+ const groups = group ? digitGroups(text, format) : [String(text)];
150
+ return `<figcaption class="oc-barcode__digits">${groups.map((g) => `<span class="oc-barcode__group">${escapeHtml(g)}</span>`).join("")}</figcaption>`;
151
+ }
152
+
132
153
  /** Draw one .oc-barcode from its data-value and data-format. Shows a short error instead of bars when it cannot. */
133
154
  export function renderBarcode(el) {
134
155
  if (!el) return;
135
156
  const value = el.dataset.value ?? "";
136
157
  const digits = el.dataset.digits !== "false";
137
158
  try {
138
- const { bits, text } = encodeBarcode(value, el.dataset.format || "auto");
159
+ const { bits, text, format } = encodeBarcode(value, el.dataset.format || "auto");
139
160
  el.removeAttribute("data-error");
140
- el.innerHTML = barsToSvg(bits, `Barcode ${text}`) + (digits ? `<figcaption class="oc-barcode__digits">${escapeHtml(text)}</figcaption>` : "");
161
+ el.innerHTML = barsToSvg(bits, `Barcode ${text}`) + (digits ? digitsHtml(text, format, el.dataset.group !== "false") : "");
141
162
  } catch (err) {
142
163
  el.setAttribute("data-error", "");
143
164
  el.innerHTML = `<figcaption class="oc-barcode__digits">${escapeHtml(value)}: ${escapeHtml(err.message)}</figcaption>`;
@@ -0,0 +1,17 @@
1
+ // File: packages/ui/src/calendar.d.ts
2
+ // Types for the calendar behaviour (pick a day or a range, arrow keys) of the CSS calendar.
3
+
4
+ /** The ISO date `days` after (or before) an ISO date ("2026-10-31", 1 -> "2026-11-01"). */
5
+ export function shiftDate(iso: string, days: number): string;
6
+ /** aria-selected and the --range-* classes of one day for a choice (one day, or start..end). */
7
+ export function dayState(iso: string, start?: string, end?: string): { selected: boolean; cls: string[] };
8
+ /** Starts one [data-oc-calendar] root; returns a function that stops it. Event: oc-calendar-change. */
9
+ export function bindCalendar(root: HTMLElement): () => void;
10
+ /** Date picker: hides the nearest open [popover] around a calendar root; true when it closed one. */
11
+ export function closePicker(root: Element): boolean;
12
+ /** Starts every [data-oc-calendar] in scope. */
13
+ export function initCalendar(scope?: ParentNode): Array<() => void>;
14
+ /** 6 weeks of 7 days for a month grid ("2026-10"), Monday first (1) or Sunday first (0); outside = another month. */
15
+ export function monthGrid(month: string, weekStart?: 0 | 1): Array<Array<{ iso: string; day: number; outside: boolean }>>;
16
+ /** "2026-10" plus or minus some months. */
17
+ export function shiftMonth(month: string, by: number): string;
@@ -0,0 +1,190 @@
1
+ // File: packages/ui/src/calendar.js
2
+ // Map: days of a root -> pick (single: one day, range: start then end) -> paint (aria-selected, --range-*) -> summary line
3
+ // -> arrow keys between days -> bind one [data-oc-calendar] -> init every one -> boot
4
+ // Behaviour for the CSS calendar (.oc-calendar, button.oc-calendar-day[data-date]) in plain HTML and Blade: a click or
5
+ // Enter picks a day, the arrow keys move between the days (one day, one week; Home / End: start / end of the week).
6
+ // The root carries data-oc-calendar="single" (default) or "range"; it may hold more than one month (two calendars side by
7
+ // side), a range then runs over both. An element with data-oc-calendar-summary in the root shows the choice, with its
8
+ // data-template ("{start} – {end} ({days} days)", "{date}"); dates are written with Intl in the language of the page. An
9
+ // input[data-oc-calendar-value] in the root gets the ISO date (or "start/end") for a form.
10
+ // Event on the root: oc-calendar-change { mode, date } or { mode, start, end }.
11
+
12
+ const DAY = "button.oc-calendar-day[data-date]";
13
+
14
+ /** "2026-10-20" -> a Date at noon (no time zone jumps). */
15
+ const toDate = (iso) => new Date(`${iso}T12:00:00`);
16
+ /** A Date -> "2026-10-20". */
17
+ const toIso = (d) => `${d.getFullYear()}-${String(d.getMonth() + 1).padStart(2, "0")}-${String(d.getDate()).padStart(2, "0")}`;
18
+
19
+ /** The date `days` after (or before) an ISO date. */
20
+ export function shiftDate(iso, days) {
21
+ const d = toDate(iso);
22
+ d.setDate(d.getDate() + days);
23
+ return toIso(d);
24
+ }
25
+
26
+ /** Classes and aria-selected for the days of a choice: one day, or a range from start to end. */
27
+ export function dayState(iso, start, end) {
28
+ if (!start) return { selected: false, cls: [] };
29
+ if (!end || end === start) return { selected: iso === start, cls: iso === start && end ? ["oc-calendar-day--range-start", "oc-calendar-day--range-end"] : [] };
30
+ if (iso === start) return { selected: true, cls: ["oc-calendar-day--range-start"] };
31
+ if (iso === end) return { selected: true, cls: ["oc-calendar-day--range-end"] };
32
+ if (iso > start && iso < end) return { selected: false, cls: ["oc-calendar-day--range-middle"] };
33
+ return { selected: false, cls: [] };
34
+ }
35
+
36
+ const RANGE = ["oc-calendar-day--range-start", "oc-calendar-day--range-middle", "oc-calendar-day--range-end"];
37
+
38
+ /** The weeks of a month for a calendar grid: 6 rows of 7 ISO dates, Monday first (weekStart 1) or Sunday (0), with
39
+ * `outside` for the days of the months before and after. month: "2026-10". */
40
+ export function monthGrid(month, weekStart = 1) {
41
+ const [y, m] = month.split("-").map(Number);
42
+ const first = new Date(y, m - 1, 1, 12);
43
+ const lead = (first.getDay() - weekStart + 7) % 7;
44
+ const start = toIso(new Date(y, m - 1, 1 - lead, 12));
45
+ return Array.from({ length: 6 }, (_, w) => Array.from({ length: 7 }, (_, d) => {
46
+ const iso = shiftDate(start, w * 7 + d);
47
+ return { iso, day: Number(iso.slice(8)), outside: iso.slice(0, 7) !== month };
48
+ }));
49
+ }
50
+
51
+ /** "2026-10" plus or minus some months. */
52
+ export function shiftMonth(month, by) {
53
+ const [y, m] = month.split("-").map(Number);
54
+ const d = new Date(y, m - 1 + by, 1, 12);
55
+ return `${d.getFullYear()}-${String(d.getMonth() + 1).padStart(2, "0")}`;
56
+ }
57
+
58
+ /** Date picker: closes the nearest open [popover] around a calendar root (the popover wraps the calendar). */
59
+ export function closePicker(root) {
60
+ const pop = root.closest?.("[popover]");
61
+ if (!pop) return false;
62
+ try {
63
+ if (!pop.matches(":popover-open")) return false;
64
+ pop.hidePopover();
65
+ return true;
66
+ } catch { return false; /* closed or no popover support */ }
67
+ }
68
+
69
+ /** Starts one calendar root. Returns a function that stops it. */
70
+ export function bindCalendar(root) {
71
+ if (root.dataset.ocBound != null) return () => {};
72
+ root.dataset.ocBound = "";
73
+ const mode = root.dataset.ocCalendar === "range" ? "range" : "single";
74
+ const days = () => [...root.querySelectorAll(DAY)].filter((b) => !b.disabled);
75
+ const lang = root.closest("[lang]")?.getAttribute("lang") || document.documentElement.lang || undefined;
76
+ // data-format on the summary: short (12 Oct 2026, default), long (12 October 2026), full (Monday 12 October 2026).
77
+ const FORMATS = {
78
+ short: { day: "numeric", month: "short", year: "numeric" },
79
+ long: { day: "numeric", month: "long", year: "numeric" },
80
+ full: { weekday: "long", day: "numeric", month: "long", year: "numeric" },
81
+ };
82
+ const fmtFor = (el) => new Intl.DateTimeFormat(lang, FORMATS[el?.dataset.format] ?? FORMATS.short);
83
+
84
+ // Start from what the markup already shows.
85
+ const marked = days().filter((b) => b.getAttribute("aria-selected") === "true" || RANGE.some((c) => b.classList.contains(c)));
86
+ const isoOf = (b) => b.dataset.date;
87
+ let start = marked.find((b) => b.classList.contains("oc-calendar-day--range-start"))?.dataset.date ?? (marked[0] && isoOf(marked[0]));
88
+ let end = marked.find((b) => b.classList.contains("oc-calendar-day--range-end"))?.dataset.date ?? (mode === "range" && marked.length > 1 ? isoOf(marked[marked.length - 1]) : undefined);
89
+
90
+ const paint = () => {
91
+ // Two months side by side show some dates twice (as a grey outside day in the other month): only the real day
92
+ // is painted.
93
+ const inMonth = new Set([...root.querySelectorAll(DAY)].filter((b) => !b.classList.contains("oc-calendar-day--outside")).map((b) => b.dataset.date));
94
+ for (const b of root.querySelectorAll(DAY)) {
95
+ const twin = b.classList.contains("oc-calendar-day--outside") && inMonth.has(b.dataset.date);
96
+ const s = twin ? { selected: false, cls: [] } : dayState(b.dataset.date, start, mode === "range" ? end : undefined);
97
+ b.classList.remove(...RANGE);
98
+ b.classList.add(...s.cls);
99
+ if (s.selected) b.setAttribute("aria-selected", "true");
100
+ else b.removeAttribute("aria-selected");
101
+ }
102
+ for (const out of root.querySelectorAll("[data-oc-calendar-summary]")) {
103
+ if (!start) break;
104
+ const fmt = fmtFor(out);
105
+ const tpl = out.dataset.template || (mode === "range" ? "{start} – {end}" : "{date}");
106
+ const days = end ? Math.round((toDate(end) - toDate(start)) / 86400000) + 1 : 1;
107
+ out.textContent = tpl.replace("{date}", fmt.format(toDate(start))).replace("{start}", fmt.format(toDate(start))).replace("{end}", end ? fmt.format(toDate(end)) : "…").replace("{days}", String(days));
108
+ }
109
+ const field = root.querySelector("input[data-oc-calendar-value]");
110
+ if (field && start) field.value = mode === "range" ? `${start}/${end ?? ""}` : start;
111
+ };
112
+
113
+ const pick = (iso) => {
114
+ if (mode === "single") { start = iso; end = undefined; }
115
+ else if (!start || end) { start = iso; end = undefined; }
116
+ else if (iso < start) { end = start; start = iso; }
117
+ else end = iso;
118
+ paint();
119
+ const detail = mode === "single" ? { mode, date: start } : { mode, start, end };
120
+ root.dispatchEvent(new CustomEvent("oc-calendar-change", { bubbles: true, detail }));
121
+ };
122
+
123
+ const onClick = (e) => {
124
+ // Presets: a button with data-oc-calendar-days="1" picks the day that many days after today (the --today day of
125
+ // the calendar, else the real today).
126
+ const preset = e.target.closest("[data-oc-calendar-days]");
127
+ if (preset && root.contains(preset)) {
128
+ const today = root.querySelector(".oc-calendar-day--today")?.dataset.date ?? toIso(new Date());
129
+ const iso = shiftDate(today, Number(preset.dataset.ocCalendarDays) || 0);
130
+ if (mode === "range") { start = undefined; end = undefined; }
131
+ pick(iso);
132
+ return;
133
+ }
134
+ const b = e.target.closest(DAY);
135
+ if (!b || !root.contains(b) || b.disabled) return;
136
+ pick(b.dataset.date);
137
+ // A date picker: the calendar sits in a popover; a complete choice closes it (single: the day, range: the end).
138
+ if (mode === "single" || end) closePicker(root);
139
+ };
140
+ const onKey = (e) => {
141
+ const b = e.target.closest(DAY);
142
+ if (!b || !root.contains(b)) return;
143
+ const step = { ArrowLeft: -1, ArrowRight: 1, ArrowUp: -7, ArrowDown: 7 }[e.key];
144
+ let target;
145
+ if (step) target = shiftDate(b.dataset.date, step);
146
+ else if (e.key === "Home" || e.key === "End") {
147
+ const dow = (toDate(b.dataset.date).getDay() + 6) % 7; // Monday = 0
148
+ target = shiftDate(b.dataset.date, e.key === "Home" ? -dow : 6 - dow);
149
+ } else return;
150
+ const next = days().find((x) => x.dataset.date === target);
151
+ if (!next) return;
152
+ e.preventDefault();
153
+ for (const x of days()) x.tabIndex = -1;
154
+ next.tabIndex = 0;
155
+ next.focus();
156
+ };
157
+
158
+ // One day in the tab order: the chosen one, else today, else the first day of the month.
159
+ const first = days().find((b) => b.getAttribute("aria-selected") === "true") ?? days().find((b) => b.classList.contains("oc-calendar-day--today")) ?? days().find((b) => !b.classList.contains("oc-calendar-day--outside"));
160
+ for (const b of days()) b.tabIndex = b === first ? 0 : -1;
161
+
162
+ root.addEventListener("click", onClick);
163
+ root.addEventListener("keydown", onKey);
164
+ paint();
165
+ return () => {
166
+ root.removeEventListener("click", onClick);
167
+ root.removeEventListener("keydown", onKey);
168
+ delete root.dataset.ocBound;
169
+ };
170
+ }
171
+
172
+ /** Starts every [data-oc-calendar] under `scope`. */
173
+ export function initCalendar(scope = document) {
174
+ return [...scope.querySelectorAll("[data-oc-calendar]")].map(bindCalendar);
175
+ }
176
+
177
+ // Starts on its own as /js/oc-calendar.js (`npx omniaui copy-js calendar`), with ?auto in the URL or data-oc-auto on the
178
+ // tag.
179
+ function autoStart() {
180
+ if (typeof document === "undefined") return false;
181
+ const url = String(import.meta.url);
182
+ if (url.includes("oc-calendar") || /[?&]auto(=|&|$)/.test(url)) return true;
183
+ const file = url.split(/[?#]/)[0];
184
+ return [...document.querySelectorAll("script[data-oc-auto][src]")].some((s) => s.src.split(/[?#]/)[0] === file);
185
+ }
186
+ if (autoStart()) {
187
+ const boot = () => initCalendar(document);
188
+ if (document.readyState === "loading") document.addEventListener("DOMContentLoaded", boot);
189
+ else boot();
190
+ }
@@ -100,6 +100,9 @@ pre.code-preview {
100
100
  /* Code inhoud: spaties en newlines behouden, regels onder elkaar, monospace voor uitlijning */
101
101
  pre.code-preview code {
102
102
  display: block;
103
+ /* As wide as the longest line (at least the block): a long line scrolls inside the window and keeps the end padding. */
104
+ inline-size: max-content;
105
+ min-inline-size: 100%;
103
106
  white-space: pre;
104
107
  font-family: inherit;
105
108
  font-size: inherit;
@@ -1,13 +1,36 @@
1
1
  // File: packages/ui/src/combobox.d.ts
2
- // Types for the combobox behaviour (filter, keyboard, choose) of the CSS combobox.
2
+ // Types for the combobox behaviour (filter, keyboard, choose, catalog mode) of the CSS combobox.
3
3
 
4
- /** Text label of an option (without its icon). */
4
+ /** Option data for server search results and root.ocSetOptions(). */
5
+ export interface ComboboxItem {
6
+ value: string | number;
7
+ label: string;
8
+ description?: string;
9
+ /** Webicon name, drawn with <iconify-icon>. */
10
+ icon?: string;
11
+ image?: string;
12
+ emoji?: string;
13
+ disabled?: boolean;
14
+ }
15
+
16
+ /** The wrapper after bindCombobox: ocSetOptions replaces the options (server search results); with `query`, an answer
17
+ * for an older question than what is in the field is dropped. */
18
+ export interface ComboboxRoot extends HTMLElement {
19
+ ocSetOptions?: (items: ComboboxItem[], query?: string) => void;
20
+ }
21
+
22
+ /** Text label of an option (without its icon, image, emoji or description). */
5
23
  export function optionLabel(option: Element): string;
6
24
  /** data-value of an option, else its label. */
7
25
  export function optionValue(option: HTMLElement): string;
8
26
  /** True when the label contains the query (case and accents ignored). */
9
27
  export function matches(label: string, query: string): boolean;
10
- /** Starts one .oc-combobox; returns a function that stops it. Event: oc-combobox-change { value, label }. */
11
- export function bindCombobox(root: HTMLElement): () => void;
28
+ /** One <li class="oc-combobox-option"> from data. */
29
+ export function optionElement(item: ComboboxItem, doc?: Document): HTMLLIElement;
30
+ /**
31
+ * Starts one .oc-combobox; returns a function that stops it. Events: oc-combobox-change { value, label, custom },
32
+ * oc-combobox-search { query } (data-oc-search="event"), oc-combobox-manage { href }.
33
+ */
34
+ export function bindCombobox(root: ComboboxRoot): () => void;
12
35
  /** Starts every .oc-combobox[data-oc-combobox] in scope; returns a function that stops them. */
13
36
  export function initCombobox(scope?: ParentNode): () => void;