Skip to content

Commit 8b7309e

Browse files
authored
Merge pull request #219 from pie-framework/feat/PIE-151-MASTER
feat: add baseHeadingLevel prop to player for heading control PIE-151
2 parents 170d719 + 660ccdc commit 8b7309e

2 files changed

Lines changed: 24 additions & 1 deletion

File tree

src/components.d.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,10 @@ export namespace Components {
114114
*/
115115
'allowedResize'?: boolean;
116116
/**
117+
* The level of the first heading emitted inside this player. Rewrites `<p data-heading="headingN">…</p>` → `<h{clamp(baseLevel + N − 1, 1, 6)} data-heading="headingN">…</h…>`, preserving the `data-heading` attribute so host CSS keyed on `[data-heading]` continues to match. Fast path: when `baseHeadingLevel` is `undefined` **or** the markup contains no `data-heading=` substring, the input is returned unchanged (the common case for legacy content, so the transform is effectively free).
118+
*/
119+
'baseHeadingLevel'?: 1 | 2 | 3 | 4 | 5 | 6;
120+
/**
117121
* Provide this property override the default endpoints used by the player to retrieve JS bundles. Must be set before setting the config property. Most users will not need to use this property.
118122
*/
119123
'bundleEndpoints'?: BundleEndpoints;
@@ -333,6 +337,10 @@ declare namespace LocalJSX {
333337
*/
334338
'allowedResize'?: boolean;
335339
/**
340+
* The level of the first heading emitted inside this player. Rewrites `<p data-heading="headingN">…</p>` → `<h{clamp(baseLevel + N − 1, 1, 6)} data-heading="headingN">…</h…>`, preserving the `data-heading` attribute so host CSS keyed on `[data-heading]` continues to match. Fast path: when `baseHeadingLevel` is `undefined` **or** the markup contains no `data-heading=` substring, the input is returned unchanged (the common case for legacy content, so the transform is effectively free).
341+
*/
342+
'baseHeadingLevel'?: 1 | 2 | 3 | 4 | 5 | 6;
343+
/**
336344
* Provide this property override the default endpoints used by the player to retrieve JS bundles. Must be set before setting the config property. Most users will not need to use this property.
337345
*/
338346
'bundleEndpoints'?: BundleEndpoints;

src/components/pie-player/pie-player.tsx

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,20 @@ export class Player {
207207
*/
208208
@Prop() customClassname: string = "";
209209

210+
/**
211+
* The level of the first heading emitted inside this player.
212+
*
213+
* Rewrites `<p data-heading="headingN">…</p>` →
214+
* `<h{clamp(baseLevel + N − 1, 1, 6)} data-heading="headingN">…</h…>`,
215+
* preserving the `data-heading` attribute so host CSS keyed on
216+
* `[data-heading]` continues to match.
217+
*
218+
* Fast path: when `baseHeadingLevel` is `undefined` **or** the markup
219+
* contains no `data-heading=` substring, the input is returned unchanged
220+
* (the common case for legacy content, so the transform is effectively free).
221+
*/
222+
@Prop() baseHeadingLevel?: 1 | 2 | 3 | 4 | 5 | 6;
223+
210224
pieLoader = new PieLoader(null, this.loaderConfig);
211225
private loadingStyles = new Set<string>();
212226

@@ -709,7 +723,8 @@ export class Player {
709723
bundleEndpoints: this.bundleEndpoints,
710724
addCorrectResponse: this.addCorrectResponse,
711725
reFetchBundle: this.reFetchBundle,
712-
customClassname: this.customClassname
726+
customClassname: this.customClassname,
727+
baseHeadingLevel: this.baseHeadingLevel
713728
};
714729

715730
if (this.renderStimulus) {

0 commit comments

Comments
 (0)