Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 | 22x 22x 22x 3x 3x 2x 2x 2x 2x 2x 2x 3x 3x 3x 3x 3x 2x 2x 2x 1x 1x | /**
* Native's look on top of `@be-music/player-ui`'s neutral defaults: its spacing scale and type, set through the
* elements' documented custom properties and parts. Colours stay the page's Basecoat tokens.
*/
export const NATIVE_THEME_CSS = `
[data-native-screen] {
--be-music-screen-padding: clamp(16px, 3cqi, 36px);
--be-music-section-gap: 24px;
--be-music-gap: 8px;
--be-music-panel-padding: 16px;
--be-music-title-size: clamp(22px, 3cqi, 36px);
--be-music-title-weight: 700;
--be-music-title-tracking: -0.035em;
--be-music-stat-size: clamp(28px, 4cqi, 44px);
}
[data-native-screen]::part(eyebrow) {
font-size: 11px;
letter-spacing: 0.14em;
text-transform: uppercase;
}
`;
/** The product line over the collection's title. */
export const NATIVE_EYEBROW = 'Be-Music / Native';
const THEMED = new WeakMap<Node, { style: HTMLStyleElement; users: number }>();
/** Puts Native's theme in `container` for as long as one of its screens is mounted there; call the result to release. */
export function adoptNativeTheme(container: HTMLElement): () => void {
let entry = THEMED.get(container);
if (!entry) {
const style = container.ownerDocument.createElement('style');
style.dataset.nativeTheme = '';
style.textContent = NATIVE_THEME_CSS;
container.prepend(style);
entry = { style, users: 0 };
THEMED.set(container, entry);
}
entry.users += 1;
const adopted = entry;
let released = false;
return () => {
if (released) return;
released = true;
adopted.users -= 1;
if (adopted.users === 0) {
adopted.style.remove();
THEMED.delete(container);
}
};
}
|