@pie-players/pie-players-shared 0.3.31 → 0.3.33
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.
|
@@ -78,6 +78,7 @@
|
|
|
78
78
|
onPlayerError,
|
|
79
79
|
onSessionChanged,
|
|
80
80
|
onModelUpdated,
|
|
81
|
+
baseHeadingLevel = undefined,
|
|
81
82
|
}: {
|
|
82
83
|
itemConfig: ConfigEntity;
|
|
83
84
|
passageConfig?: ConfigEntity | null;
|
|
@@ -106,6 +107,26 @@
|
|
|
106
107
|
onPlayerError?: (detail?: any) => void;
|
|
107
108
|
onSessionChanged?: (detail?: any) => void;
|
|
108
109
|
onModelUpdated?: (detail?: any) => void;
|
|
110
|
+
/**
|
|
111
|
+
* The level of the first heading emitted inside this player.
|
|
112
|
+
*
|
|
113
|
+
* Rewrites `<p data-heading="headingN">…</p>` →
|
|
114
|
+
* `<h{clamp(baseLevel + N − 1, 1, 6)} data-heading="headingN">…</h…>`,
|
|
115
|
+
* preserving the `data-heading` attribute so host CSS keyed on
|
|
116
|
+
* `[data-heading]` continues to match.
|
|
117
|
+
*
|
|
118
|
+
* Fast path: when `baseHeadingLevel` is `undefined` **or** the markup
|
|
119
|
+
* contains no `data-heading=` substring, the input is returned unchanged
|
|
120
|
+
* (the common case for legacy content, so the transform is effectively free).
|
|
121
|
+
*
|
|
122
|
+
* PIE elements can read this value by walking up the DOM:
|
|
123
|
+
*
|
|
124
|
+
* const player = element.closest('pie-item-player');
|
|
125
|
+
* let raw = player?.baseHeadingLevel
|
|
126
|
+
* ?? player?.getAttribute('base-heading-level')
|
|
127
|
+
* ?? player?.getAttribute('baseheadinglevel');
|
|
128
|
+
*/
|
|
129
|
+
baseHeadingLevel?: 1 | 2 | 3 | 4 | 5 | 6;
|
|
109
130
|
} = $props();
|
|
110
131
|
|
|
111
132
|
// Track if correct responses have been added
|
|
@@ -40,7 +40,8 @@
|
|
|
40
40
|
onLoadComplete,
|
|
41
41
|
onPlayerError,
|
|
42
42
|
onSessionChanged,
|
|
43
|
-
onModelUpdated
|
|
43
|
+
onModelUpdated,
|
|
44
|
+
baseHeadingLevel = undefined,
|
|
44
45
|
}: {
|
|
45
46
|
mode?: 'author' | 'preview';
|
|
46
47
|
itemConfig: ConfigEntity;
|
|
@@ -65,6 +66,11 @@
|
|
|
65
66
|
onPlayerError?: (detail?: any) => void;
|
|
66
67
|
onSessionChanged?: (detail?: any) => void;
|
|
67
68
|
onModelUpdated?: (detail?: any) => void;
|
|
69
|
+
/**
|
|
70
|
+
* The level of the first heading emitted inside this player.
|
|
71
|
+
* Passed through to `PieItemPlayer` unchanged — see that component for full docs.
|
|
72
|
+
*/
|
|
73
|
+
baseHeadingLevel?: 1 | 2 | 3 | 4 | 5 | 6;
|
|
68
74
|
} = $props();
|
|
69
75
|
|
|
70
76
|
// Track current mode state
|
|
@@ -120,6 +126,7 @@
|
|
|
120
126
|
{onPlayerError}
|
|
121
127
|
{onSessionChanged}
|
|
122
128
|
{onModelUpdated}
|
|
129
|
+
{baseHeadingLevel}
|
|
123
130
|
/>
|
|
124
131
|
{/key}
|
|
125
132
|
</div>
|