@pie-element/element-player 0.1.2-next.13 → 0.1.2-next.14

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/README.md CHANGED
@@ -83,7 +83,6 @@ For elements with import maps:
83
83
 
84
84
  - Loads elements via dynamic ESM imports: `import('@pie-element/hotspot')`
85
85
  - Handles session state and user interactions
86
- - Manages math rendering internally (MathJax)
87
86
  - Emits `session-changed` events
88
87
  - Works with both React and Svelte elements
89
88
 
@@ -92,16 +91,18 @@ For elements with import maps:
92
91
  - Loads print exports: `import('@pie-element/hotspot/print')`
93
92
  - Stateless (no session management)
94
93
  - Optimized for print layouts
95
- - Manages math rendering internally (MathJax)
96
94
  - Role-based rendering (student/instructor)
97
95
 
98
96
  **All views:**
99
97
 
100
98
  - Use import maps for module resolution
101
99
  - Self-contained (no external setup needed)
102
- - Handle math rendering automatically
103
100
  - Support for both React and Svelte elements
104
101
 
102
+ ### Math rendering
103
+
104
+ The player typesets math through `window['@pie-lib/math-rendering'].renderMath`, read on every render. A renderer the host installs there before the player mounts, such as the legacy MathJax 3 one, is used and no MathJax 4 loads. Without one, the player installs a MathJax 4 renderer from `@pie-element/shared-math-rendering-mathjax`, which elements and later players on the page share.
105
+
105
106
  ### Events
106
107
 
107
108
  The player dispatches each event from `<pie-element-player>`, bubbling and composed. A bubble-phase listener on the player, on an ancestor or on `document` hears each event once, with `event.target` the player; a listener outside a shadow root that contains the player sees that root's host instead. The element's own `session-changed` stops at the element, and the player dispatches its copy in its place. A capture-phase listener on the player or above it also hears every `session-changed` the element dispatches, ahead of the player's copy, and should ignore events whose `event.composedPath()[0]` is not the player. That equals `event.target` when no shadow root lies between listener and player. A closed shadow root hides the player from both, so listen in the bubble phase there.