@pie-players/pie-players-shared 0.3.69 → 0.3.71

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 (41) hide show
  1. package/dist/i18n/messages/en-US.d.ts +2 -0
  2. package/dist/i18n/messages/en-US.js +2 -0
  3. package/dist/i18n/messages/nl-NL.d.ts +2 -0
  4. package/dist/i18n/messages/nl-NL.js +2 -0
  5. package/dist/index.d.ts +1 -0
  6. package/dist/index.js +1 -0
  7. package/dist/loaders/iife-adapter.js +7 -3
  8. package/dist/pie/element-observer.d.ts +59 -0
  9. package/dist/pie/element-observer.js +131 -0
  10. package/dist/pie/index.d.ts +4 -2
  11. package/dist/pie/index.js +7 -2
  12. package/dist/pie/initialization.d.ts +13 -13
  13. package/dist/pie/initialization.js +97 -147
  14. package/dist/pie/initialize-element.d.ts +23 -0
  15. package/dist/pie/initialize-element.js +78 -0
  16. package/dist/pie/instrumentation-event-map.d.ts +1 -0
  17. package/dist/pie/instrumentation-event-map.js +18 -0
  18. package/dist/pie/math-rendering.js +6 -2
  19. package/dist/pie/types.d.ts +10 -0
  20. package/dist/pie/utils.d.ts +27 -0
  21. package/dist/pie/utils.js +56 -1
  22. package/dist/security/index.d.ts +3 -2
  23. package/dist/security/index.js +3 -2
  24. package/dist/security/sanitize-forbidden-lists.js +9 -0
  25. package/dist/security/sanitize-item-markup.js +4 -0
  26. package/dist/security/sanitize-style-attribute.d.ts +48 -0
  27. package/dist/security/sanitize-style-attribute.js +129 -0
  28. package/dist/security/sanitize-svg-icon.js +2 -0
  29. package/dist/security/validate-style-url.d.ts +13 -0
  30. package/dist/security/validate-style-url.js +36 -2
  31. package/dist/security/wrap-overwide-images.d.ts +7 -0
  32. package/dist/security/wrap-overwide-images.js +10 -1
  33. package/dist/security/wrap-overwide-tables.d.ts +7 -0
  34. package/dist/security/wrap-overwide-tables.js +10 -1
  35. package/dist/security/wrap-overwide.d.ts +16 -0
  36. package/dist/security/wrap-overwide.js +52 -0
  37. package/dist/ui/overlay-containment.d.ts +48 -0
  38. package/dist/ui/overlay-containment.js +65 -0
  39. package/package.json +6 -10
  40. package/dist/ui/zoom-compensation.d.ts +0 -44
  41. package/dist/ui/zoom-compensation.js +0 -43
@@ -1,43 +0,0 @@
1
- /**
2
- * Pure browser-zoom compensation math (framework-agnostic, no Svelte runes).
3
- *
4
- * Browser zoom is approximated as outerWidth / innerWidth: outerWidth is the
5
- * OS window size (zoom-independent) while innerWidth is in CSS pixels (shrinks
6
- * as zoom increases). Callers apply the returned factor via CSS `zoom` so an
7
- * element that would otherwise keep enlarging past `maxZoom` compounds back
8
- * down to the cap.
9
- *
10
- * This module is tsc-buildable and shipped in `dist`, so it can be consumed by
11
- * packages that resolve `@pie-players/pie-players-shared` from its published
12
- * build (e.g. the assessment-toolkit CE bundle) as well as by the reactive
13
- * Svelte wrapper in `./use-zoom-compensation.svelte.ts`, which packages built
14
- * with Vite alias to source.
15
- */
16
- /**
17
- * Shared zoom-cap settings for the toolbar icon buttons (the TTS play button and
18
- * the calculator button) so both compensate identically and can't drift apart.
19
- * Grow normally up to 200%, then freeze; the 0.25 floor keeps the cap holding
20
- * past 500% browser zoom (see the minCompensation note in
21
- * section-player's SectionPlayerTabbedContent).
22
- */
23
- export const ICON_BUTTON_ZOOM_OPTIONS = {
24
- maxZoom: 2,
25
- minCompensation: 0.25,
26
- };
27
- /**
28
- * Approximate the browser zoom level from an outer/inner width pair. Falls
29
- * back to 1 (100%) if the ratio isn't finite or is non-positive (which happens
30
- * during SSR, in headless envs, and briefly during resize on some browsers).
31
- */
32
- export function approximateZoomFromWidths(outerWidth, innerWidth) {
33
- const ratio = outerWidth / innerWidth;
34
- return Number.isFinite(ratio) && ratio > 0 ? ratio : 1;
35
- }
36
- /**
37
- * Pure zoom-compensation math: exactly 1 at zoom <= maxZoom, then shrinks as
38
- * `maxZoom / zoom`, floored at `minCompensation` to guard against inflated
39
- * ratios from window chrome / side panels making the element unusably small.
40
- */
41
- export function computeZoomCompensation(zoom, maxZoom, minCompensation) {
42
- return Math.max(minCompensation, Math.min(1, maxZoom / zoom));
43
- }