@srgssr/share-button 0.1.0
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/LICENSE +21 -0
- package/README.md +242 -0
- package/dist/lang/de.json +21 -0
- package/dist/lang/en.json +21 -0
- package/dist/lang/fr.json +21 -0
- package/dist/lang/it.json +21 -0
- package/dist/lang/rm.json +21 -0
- package/dist/share-button.cjs +24 -0
- package/dist/share-button.cjs.map +1 -0
- package/dist/share-button.js +890 -0
- package/dist/share-button.js.map +1 -0
- package/dist/share-button.min.css +1 -0
- package/dist/share-button.min.css.map +1 -0
- package/dist/share-button.umd.min.js +24 -0
- package/dist/share-button.umd.min.js.map +1 -0
- package/package.json +56 -0
- package/scss/share-button.scss +223 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"share-button.cjs","names":["i","e","t","DOMParser","parseFromString","documentElement","SVGElement","Error","a","o","apply","arguments","n","fetch","mode","ok","status","statusText","text","s","c","trim","URL","parse","href","startsWith","l","u","s","e","c","apply","arguments","i","icon","t","iconName","n","options","setIcon","r","el","querySelector","classList","toggle","l","u","add","replaceChildren","d","log","createLogger","f","getComponent","p","constructor","appendIcon","catch","error","buildCSSClass","VERSION","o","registerComponent","m","h","g","createEl","Object","assign","className","player_","options_","experimentalSvgIcons","appendChild","dom","videojs","embedIcon","facebookIcon","linkIcon","linkedinIcon","mailIcon","whatsappIcon","xIcon","SvgComponent","getComponent","log","createLogger","ShareButton","constructor","player","options","on","handleClick","createEl","tag","props","attributes","error","Error","title","target","rel","el","obj","merge","href","getHref","localize","prepend","dom","className","textContent","append","label","setUrlGenerator","generateUrl","generateUrl_","updateHref","url","buildUrl","shareText","_ref","_this$options$shareTe","_this$parentComponent","parentComponent_","document","trigger","type","bubbles","buildCSSClass","handleLanguagechange","$","prototype","options_","FacebookShareButton","icon","iconName","encodeURIComponent","XShareButton","text","LinkedinShareButton","WhatsappShareButton","EmailShareButton","encodedText","CopyLinkShareButton","event","preventDefault","copyText","textToCopy","_navigator$clipboard","navigator","clipboard","writeText","warn","Promise","resolve","catch","EmbedShareButton","buildEmbedCode","registerComponent","videojs","Component","getComponent","ShareButtonCollection","setUrlGenerator","generateUrl","children","forEach","child","_child$setUrlGenerato","call","prototype","options_","className","shareText","undefined","registerComponent","de","en","fr","it","rm","videojs","extendLanguage","code","data","_videojs$options$lang","addLanguage","_objectSpread","options","language","videojs","Component","getComponent","baseUrl","player","component","configuredUrl","window","location","href","url","options","context","getMediaComposition","mediaComposition","getMainChapter","_getMediaComposition","_getMediaComposition$","call","getSubdivisions","_getMediaComposition$2","_getMediaComposition2","_getMediaComposition3","containsTime","segment","time","markIn","markOut","getCurrentSubdivision","filter","blockReason","currentTime","pop","getSourceMediaData","_player$currentSource","currentSource","mediaData","getCurrentMedia","ShareUrlOptions","constructor","render","on","updateOptionsState","createEl","role","localize","selected","defaultOption","entries","toggleClass","length","el","replaceChildren","map","name","option","createOption","includeCurrentTime","Object","isOptionHidden","isHidden","isOptionDisabled","isDisabled","Boolean","disabled","_entries$","preferred","some","checked","_option$title","id","label","dom","className","title","for","append","type","value","textContent","input","$","_this$$","forEach","selectDefaultOption","trigger","_this$player$currentS","_this$player","currentMedia","currentSubdivision","mainChapter","subdivisions","generateUrl","handleLanguagechange","setAttribute","prototype","options_","undefined","episode","URL","searchParams","set","Math","floor","toString","registerComponent","videojs","ModalDialog","getComponent","ShareModal","constructor","player","options","handleOutsideClick","bind","fill","render","dispose","unbindOutsideClick","buildCSSClass","title_","createTitle","urlOptions_","addChild","shareUrlOptions","collection_","shareButtonCollection","on","updateUrlGenerator","handleShare","_this$options$title","title","componentClass","className","update","localize","open","bindOutsideClick","close","setUrlGenerator","generateUrl","document","addEventListener","removeEventListener","event","isOwnClick","el","contains","target","handleLanguagechange","_this$options$title2","_this$options$title3","prototype","options_","pauseOnOpen","temporary","registerComponent","videojs","version","SvgButton","getComponent","log","createLogger","ShareToggle","constructor","player","options","ready","bindShareModal","modal","getChild","warn","on","hide","show","toggleClass","opened","handleClick","event","shareModal","open","Error","buildCSSClass","VERSION","prototype","options_","controlText","iconName","registerComponent"],"sources":["../../web-suite-utils/dist/web-suite-utils.js","../../package.json","../../src/svg-icon-loader.js","../../src/svg-button.js","../../src/svg-component.js","../src/share-button.js","../src/share-button-collection.js","../src/lang/de.json","../src/lang/en.json","../src/lang/fr.json","../src/lang/it.json","../src/lang/rm.json","../src/lang/index.js","../src/share-url-options.js","../src/share-modal.js","../package.json","../src/share-toggle.js"],"sourcesContent":["/**\n * Parses an SVG string into an SVGElement after validating its structure.\n *\n * @param {string} svgString - A raw string expected to contain valid SVG markup.\n * @returns {SVGElement} - The root SVG element parsed from the string.\n * @throws {Error} If the input is not a valid SVG or doesn't have an <svg> root element.\n */\nfunction stringToSvgElement(svgString) {\n const doc = new DOMParser().parseFromString(svgString, 'image/svg+xml');\n const root = doc.documentElement;\n\n if (!(root instanceof SVGElement)) {\n throw new Error('Parsed root is not an SVGElement');\n }\n\n return root;\n}\n\n/**\n * Fetches an SVG from a given URL and parses it into an SVGElement.\n *\n * @param {string} urlString - A URL pointing to an SVG resource.\n * @returns {Promise<SVGElement>} - A promise resolving to the parsed SVG element.\n * @throws {Error} If the fetch fails or the response is not a valid SVG.\n */\nasync function fetchSvgElement(urlString) {\n const res = await fetch(urlString, { mode: 'cors' });\n\n if (!res.ok) {\n throw new Error(`Failed to fetch SVG: ${res.status} ${res.statusText}`);\n }\n\n return stringToSvgElement(await res.text());\n}\n\n/**\n * Parses a string that might be a raw SVG or a URL pointing to an SVG.\n *\n * @param {string} icon - A trimmed string containing either an SVG element or a URL.\n * @returns {Promise<SVGElement>} - A promise resolving to the parsed SVG element.\n * @throws {Error} If the string is neither an SVG nor a valid URL.\n */\nasync function resolveSvgFromString(icon) {\n const trimmed = icon.trim();\n const url = URL.parse(trimmed);\n\n if (url) {\n return await fetchSvgElement(url.href);\n }\n\n if (trimmed.startsWith('<')) {\n return stringToSvgElement(trimmed);\n }\n\n throw new Error(`Provided string is not a URL or an SVG element: ${icon}`);\n}\n\n/**\n * Resolves an icon source to an SVGElement.\n *\n * Accepts:\n * - An actual SVGElement (returned as-is)\n * - A URL object (SVG fetched and parsed)\n * - A string (parsed as a URL or inline SVG)\n *\n * @param {SVGElement | string | URL} icon - The source of the SVG.\n * @returns {Promise<SVGElement>} - A promise resolving to the final SVGElement.\n * @throws {Error} If the input type is invalid or the SVG cannot be resolved.\n */\nexport default async function loadSvgElement(icon) {\n if (icon instanceof SVGElement) {\n return icon;\n }\n\n if (icon instanceof URL) {\n return await fetchSvgElement(icon.href);\n }\n\n if (typeof icon === 'string') {\n return await resolveSvgFromString(icon);\n }\n\n throw new Error(`Invalid icon type provided: ${icon}`);\n}\n","{\n \"name\": \"@srgssr/svg-button\",\n \"version\": \"1.1.3\",\n \"license\": \"MIT\",\n \"author\": \"SRG SSR\",\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"git+https://github.com/SRGSSR/pillarbox-web-suite.git\"\n },\n \"publishConfig\": {\n \"access\": \"public\"\n },\n \"homepage\": \"https://github.com/SRGSSR/pillarbox-web-suite/tree/main/packages/svg-button#readme\",\n \"type\": \"module\",\n \"main\": \"dist/svg-button.cjs\",\n \"browser\": \"dist/svg-button.umd.min.js\",\n \"module\": \"dist/svg-button.js\",\n \"style\": \"./dist/svg-button.min.css\",\n \"exports\": {\n \".\": {\n \"import\": \"./dist/svg-button.js\",\n \"require\": \"./dist/svg-button.cjs\"\n },\n \"./*\": \"./*\"\n },\n \"files\": [\n \"dist/*\",\n \"scss/*\"\n ],\n \"keywords\": [\n \"video.js\",\n \"player\"\n ],\n \"scripts\": {\n \"clean\": \"rimraf dist\",\n \"build\": \"npm-run-all clean build:*\",\n \"build:css\": \"sass ./scss/svg-button.scss:dist/svg-button.min.css --style compressed --source-map --load-path node_modules\",\n \"build:lib\": \"vite build --config vite.config.lib.js\",\n \"build:umd\": \"vite build --config vite.config.umd.js\",\n \"github:page\": \"vite build\",\n \"release:ci\": \"semantic-release\",\n \"start\": \" vite --port 4200 --open\",\n \"test\": \"vitest run --coverage --coverage.reporter text\"\n },\n \"dependencies\": {\n \"@srgssr/web-suite-utils\": \"^1.0.0\"\n },\n \"peerDependencies\": {\n \"video.js\": \"^8.0.0\"\n },\n \"devDependencies\": {\n \"@srgssr/pillarbox-web\": \"^1.24.1\"\n }\n}\n","import { loadSvgElement } from '@srgssr/web-suite-utils';\n\n/**\n * Loads and appends an SVG icon into a Video.js component.\n *\n * @param {import('video.js').Component} component - The Video.js component instance.\n */\nexport async function appendSvgIcon(component) {\n const { icon, iconName } = component.options();\n\n if (iconName) component.setIcon(iconName);\n\n const placeholder = component.el().querySelector('.vjs-icon-placeholder');\n\n if (iconName && placeholder) placeholder.classList.toggle(`vjs-icon-${iconName}`, true);\n\n await insertSvgIcon(icon, placeholder);\n}\n\nasync function insertSvgIcon(icon, placeholder) {\n if (!icon || !placeholder) return;\n\n const svg = await loadSvgElement(icon);\n\n svg.classList.add('icon-from-options');\n placeholder.classList.add('vjs-svg-icon');\n placeholder.replaceChildren(svg);\n}\n\n","import videojs from 'video.js';\nimport { version } from '../package.json';\nimport { appendSvgIcon } from './svg-icon-loader.js';\n\n/**\n * @ignore\n * @type {typeof import('video.js/dist/types/utils/log.js').default}\n */\nconst log = videojs.log.createLogger('svg-button');\n\n/**\n * @ignore\n * @type {typeof import('video.js/dist/types/component').default}\n */\nconst Button = videojs.getComponent('Button');\n\n/**\n * A helper Video.js button component that supports various strategies\n * for displaying SVG icons.\n *\n * This component is intended to be extended by other custom buttons\n * that want to display an SVG icon via multiple possible inputs:\n *\n * - Raw SVG string\n * - SVGElement instance\n * - URL to an SVG file\n * - icon font via CSS\n * - experimental Video.js SVG icons\n */\nclass SvgButton extends Button {\n\n /**\n * Creates an instance of SvgButton.\n *\n * @param {import('video.js/dist/types/player.js').default} player The player instance.\n * @param {Object | undefined} options Configuration options for the button.\n * @param {SVGElement|string|URL} [options.icon] An optional icon to be loaded into the button.\n * Can be an SVGElement, a raw SVG string, or a URL to an SVG file.\n * @param {string} [options.iconName] An Optional icon name if using Video.js experimental icon support.\n */\n constructor(player, options) {\n super(player, options);\n\n this.appendIcon().catch((reason) =>\n log.error(`There was a problem loading the provided SVG Icon`, reason));\n }\n\n /**\n * Appends the configured icon to the component element.\n * Uses the {@link appendSvgIcon} helper to handle different icon input formats.\n *\n * Override this function to customize how the SVG icon is appended.\n *\n * @param {Object | undefined} options\n * The parameters used to configure the icon.\n *\n * @param {SVGElement|string|URL} [options.icon]\n * An optional icon to be loaded into the button. Can be an SVGElement,\n * a raw SVG string, or a URL to an SVG file. This will update the\n * current configured icon.\n *\n * @param {string} [options.iconName]\n * A symbolic name for the icon (e.g., `\"play\"`, `\"pause\"`, `\"chromecast\"`).\n * Useful when you want to reference or style icons by name.\n */\n async appendIcon(options = undefined) {\n if (options) {\n const { icon, iconName } = options;\n\n this.options({ icon, iconName });\n }\n\n await appendSvgIcon(this);\n }\n\n /**\n * Builds the CSS class name for the button element.\n *\n * @returns {string} The full CSS class string for this button.\n */\n buildCSSClass() {\n return `vjs-svg-button ${super.buildCSSClass()}`;\n }\n\n /**\n * Static getter for the component version.\n *\n * @returns {string} The current version of the SvgButton component.\n */\n static get VERSION() {\n return version;\n }\n}\n\nvideojs.registerComponent('SvgButton', SvgButton);\n\nexport default SvgButton;\n","import videojs from 'video.js';\nimport { version } from '../package.json';\nimport { appendSvgIcon } from './svg-icon-loader.js';\n\n/**\n * @ignore\n * @type {typeof import('video.js/dist/types/utils/log.js').default}\n */\nconst log = videojs.log.createLogger('svg-component');\n\n/**\n * @ignore\n * @type {typeof import('video.js/dist/types/component').default}\n */\nconst Component = videojs.getComponent('Component');\n\n/**\n * A helper Video.js component that supports various strategies\n * for displaying SVG icons.\n *\n * This component is intended to be extended by other custom components\n * that want to display an SVG icon via multiple possible inputs:\n *\n * - Raw SVG string\n * - SVGElement instance\n * - URL to an SVG file\n * - icon font via CSS\n * - experimental Video.js SVG icons\n */\nclass SvgComponent extends Component {\n /**\n * Creates an instance of SvgComponent.\n *\n * @param {import('video.js/dist/types/player.js').default} player The player instance.\n * @param {Object} options Configuration options for the component.\n * @param {SVGElement|string|URL} [options.icon] An optional icon to be loaded into the component.\n * Can be an SVGElement, a raw SVG string, or a URL to an SVG file.\n * @param {string} [options.iconName] An Optional icon name if using Video.js experimental icon support.\n */\n constructor(player, options) {\n super(player, options);\n\n this.appendIcon().catch((reason) =>\n log.error(`There was a problem loading the provided SVG Icon`, reason));\n }\n\n /**\n * Appends the configured icon to the component element.\n * Uses the {@link appendSvgIcon} helper to handle different icon input formats.\n *\n * Override this function to customize how the SVG icon is appended.\n *\n * @param {Object | undefined} options\n * The parameters used to configure the icon.\n *\n * @param {SVGElement|string|URL} [options.icon]\n * An optional icon to be loaded into the button. Can be an SVGElement,\n * a raw SVG string, or a URL to an SVG file. This will update the\n * current configured icon.\n *\n * @param {string} [options.iconName]\n * A symbolic name for the icon (e.g., `\"play\"`, `\"pause\"`, `\"chromecast\"`).\n * Useful when you want to reference or style icons by name.\n */\n async appendIcon(options = undefined) {\n if (options) {\n const { icon, iconName } = options;\n\n this.options({ icon, iconName });\n }\n\n await appendSvgIcon(this);\n }\n\n /**\n * Creates the DOM element for this component.\n *\n * This overrides the base `createEl` to:\n * - Apply the component's CSS class.\n * - Add a `.vjs-icon-placeholder` span if experimental SVG icons are not enabled.\n *\n * @param {string} [tag] The HTML tag name to use for the element (defaults to `'div'` if not specified by super).\n * @param {Object} [props={}] An object of element properties (such as `className`).\n * @param {Object} [attributes={}] An object of element attributes (such as `aria-hidden`).\n *\n * @returns {Element} The created DOM element for this component.\n */\n createEl(tag, props = {}, attributes = {}) {\n props = Object.assign({ className: this.buildCSSClass() }, props);\n\n const el = super.createEl(tag, props, attributes);\n\n if (!this.player_.options_.experimentalSvgIcons) {\n el.appendChild(videojs.dom.createEl('span', {\n className: 'vjs-icon-placeholder'\n }, {\n 'aria-hidden': true\n }));\n }\n\n return el;\n }\n\n /**\n * Builds the CSS class name for the component element.\n *\n * @returns {string} The full CSS class string for this component.\n */\n buildCSSClass() {\n return `vjs-svg-component ${super.buildCSSClass()}`;\n }\n\n /**\n * Static getter for the component version.\n *\n * @returns {string} The current version of the SvgComponent component.\n */\n static get VERSION() {\n return version;\n }\n}\n\nvideojs.registerComponent('SvgComponent', SvgComponent);\n\nexport default SvgComponent;\n","import videojs from 'video.js';\nimport '@srgssr/svg-button';\nimport embedIcon from '../assets/embed.svg?raw';\nimport facebookIcon from '../assets/facebook.svg?raw';\nimport linkIcon from '../assets/link.svg?raw';\nimport linkedinIcon from '../assets/linkedin.svg?raw';\nimport mailIcon from '../assets/mail.svg?raw';\nimport whatsappIcon from '../assets/whatsapp.svg?raw';\nimport xIcon from '../assets/x.svg?raw';\n\n/**\n * @ignore\n * @type {typeof import('@srgssr/svg-button').SvgComponent}\n */\nconst SvgComponent = videojs.getComponent('SvgComponent');\n\n/**\n * @ignore\n * @type {typeof import('video.js/dist/types/utils/log.js').default}\n */\nconst log = videojs.log.createLogger('share-button');\n\n/**\n * A platform share button. It receives a generated media URL and wraps it for\n * its own platform. The element is a link so the browser handles the\n * navigation, `target` and `rel` natively.\n */\nclass ShareButton extends SvgComponent {\n /**\n * Creates one platform share button.\n *\n * @param {import('video.js/dist/types/player.js').default} player The player instance.\n * @param {Object} options The button options.\n * @param {string} [options.label] The visible label displayed below the icon.\n * @param {string} [options.title] The accessible title of the link.\n * @param {SVGElement|string|URL} [options.icon] The icon displayed by the button.\n * @param {string} [options.iconName] The icon name when using Video.js experimental SVG icons.\n * @param {string} [options.target='_blank'] The `target` attribute of the link.\n * @param {string} [options.rel='noopener noreferrer'] The `rel` attribute of the link.\n * @param {string|function(player, button): string} [options.shareText] The text shared alongside the URL.\n * @param {function(url, text, player, button): string} options.buildUrl Builds the platform URL.\n */\n constructor(player, options = {}) {\n super(player, options);\n\n this.on('click', this.handleClick);\n }\n\n /**\n * Creates the link element.\n *\n * @param {string} [tag='a'] The HTML tag name, must be `a`.\n * @param {Object} [props={}] Additional element properties.\n * @param {Object} [attributes={}] Additional element attributes.\n *\n * @returns {HTMLAnchorElement} The created anchor element.\n */\n createEl(tag = 'a', props = {}, attributes = {}) {\n if (tag !== 'a') {\n log.error(`Creating a ShareButton with an HTML element of ${tag} is not supported; the element must be an 'a'`);\n throw new Error(`'${tag}' is not supported for ShareButton`);\n }\n\n const { title, target, rel } = this.options();\n const el = super.createEl(tag, props, videojs.obj.merge({\n href: this.getHref(),\n title: this.localize(title),\n target,\n rel\n }, attributes));\n\n el.prepend(videojs.dom.createEl('span', {\n className: 'vjs-control-text',\n textContent: this.localize(title)\n }));\n el.append(videojs.dom.createEl('span', {\n className: 'vjs-share-button-title',\n textContent: this.localize(this.options().label)\n }));\n\n return el;\n }\n\n /**\n * Receives the URL generator selected by `ShareUrlOptions`.\n *\n * @param {Function} generateUrl The URL generator.\n */\n setUrlGenerator(generateUrl) {\n this.generateUrl_ = generateUrl;\n this.updateHref();\n }\n\n /**\n * Returns the generated media URL, or an empty string when no generator has\n * been provided yet.\n *\n * @returns {string} The generated media URL.\n */\n generateUrl() {\n return typeof this.generateUrl_ === 'function' ? this.generateUrl_() : '';\n }\n\n /**\n * Returns the platform URL built from the generated media URL.\n *\n * @returns {string} The platform URL.\n */\n getHref() {\n const url = this.generateUrl();\n\n if (!url) return '';\n\n try {\n const { buildUrl } = this.options();\n\n return buildUrl(url, this.shareText(), this.player(), this);\n } catch (error) {\n log.error('Error building the share url:', error);\n }\n\n return '';\n }\n\n /**\n * Returns the text shared alongside the URL.\n *\n * @returns {string} The share text.\n */\n shareText() {\n const shareText = this.options().shareText ??\n this.parentComponent_?.options().shareText ??\n document.title;\n\n return typeof shareText === 'function' ?\n shareText(this.player(), this) :\n shareText;\n }\n\n /**\n * Updates the link `href`.\n */\n updateHref() {\n this.el().href = this.getHref();\n }\n\n /**\n * Notifies that a share action happened. The event bubbles so the modal\n * and the player can react to it.\n */\n handleClick() {\n this.trigger({ type: 'share', bubbles: true });\n }\n\n /**\n * Builds the CSS class string for the button.\n *\n * @returns {string} The CSS class string.\n */\n buildCSSClass() {\n return `vjs-share-button ${super.buildCSSClass()}`;\n }\n\n /**\n * Updates the localized texts when the player language changes.\n */\n handleLanguagechange() {\n const { title, label } = this.options();\n\n this.el().title = this.localize(title);\n this.$('.vjs-control-text').textContent = this.localize(title);\n this.$('.vjs-share-button-title').textContent = this.localize(label);\n }\n}\n\nShareButton.prototype.options_ = {\n target: '_blank',\n rel: 'noopener noreferrer',\n buildUrl: url => url\n};\n\n/**\n * Shares the media URL on Facebook.\n */\nclass FacebookShareButton extends ShareButton {}\nFacebookShareButton.prototype.options_ = videojs.obj.merge(\n ShareButton.prototype.options_,\n {\n className: 'vjs-share-button-facebook',\n label: 'Facebook',\n title: 'Share on Facebook',\n icon: facebookIcon,\n iconName: 'facebook',\n buildUrl: url =>\n `https://www.facebook.com/sharer/sharer.php?u=${encodeURIComponent(url)}`\n }\n);\n\n/**\n * Shares the media URL and the share text on X.\n */\nclass XShareButton extends ShareButton {}\nXShareButton.prototype.options_ = videojs.obj.merge(\n ShareButton.prototype.options_,\n {\n className: 'vjs-share-button-x',\n label: 'X',\n title: 'Share on X',\n icon: xIcon,\n iconName: 'x',\n buildUrl: (url, text) =>\n `https://twitter.com/intent/tweet?url=${encodeURIComponent(url)}&text=${encodeURIComponent(text)}`\n }\n);\n\n/**\n * Shares the media URL on LinkedIn.\n */\nclass LinkedinShareButton extends ShareButton {}\nLinkedinShareButton.prototype.options_ = videojs.obj.merge(\n ShareButton.prototype.options_,\n {\n className: 'vjs-share-button-linkedin',\n label: 'LinkedIn',\n title: 'Share on LinkedIn',\n icon: linkedinIcon,\n iconName: 'linkedin',\n buildUrl: url =>\n `https://www.linkedin.com/sharing/share-offsite/?url=${encodeURIComponent(url)}`\n }\n);\n\n/**\n * Shares the media URL and the share text on WhatsApp.\n */\nclass WhatsappShareButton extends ShareButton {}\nWhatsappShareButton.prototype.options_ = videojs.obj.merge(\n ShareButton.prototype.options_,\n {\n className: 'vjs-share-button-whatsapp',\n label: 'WhatsApp',\n title: 'Share on WhatsApp',\n icon: whatsappIcon,\n iconName: 'whatsapp',\n buildUrl: (url, text) =>\n `https://api.whatsapp.com/send?text=${encodeURIComponent(`${text} ${url}`)}`\n }\n);\n\n/**\n * Shares the media URL and the share text through the default mail client.\n */\nclass EmailShareButton extends ShareButton {}\nEmailShareButton.prototype.options_ = videojs.obj.merge(\n ShareButton.prototype.options_,\n {\n className: 'vjs-share-button-email',\n label: 'E-mail',\n title: 'Share by email',\n icon: mailIcon,\n iconName: 'email',\n target: '_self',\n buildUrl: (url, text) => {\n const encodedText = encodeURIComponent(text);\n\n return `mailto:?subject=${encodedText}&body=${encodedText}%20${encodeURIComponent(url)}`;\n }\n }\n);\n\n/**\n * A share button that copies the generated media URL to the clipboard instead\n * of opening a platform URL.\n */\nclass CopyLinkShareButton extends ShareButton {\n /**\n * Copies the generated media URL and notifies the share action.\n *\n * @param {Event} event The click event.\n */\n handleClick(event) {\n event.preventDefault();\n this.copyText(this.textToCopy());\n super.handleClick(event);\n }\n\n /**\n * Returns the text copied to the clipboard.\n *\n * @returns {string} The generated media URL.\n */\n textToCopy() {\n return this.generateUrl();\n }\n\n /**\n * Copies text to the system clipboard.\n *\n * @param {string} text The text to copy.\n */\n copyText(text) {\n if (!navigator.clipboard?.writeText) {\n log.warn('Clipboard API is unavailable; the text could not be copied.');\n\n return;\n }\n\n Promise.resolve(navigator.clipboard.writeText(text)).catch(error => {\n log.error('The text could not be copied:', error);\n });\n }\n}\nCopyLinkShareButton.prototype.options_ = videojs.obj.merge(\n ShareButton.prototype.options_,\n {\n className: 'vjs-share-button-copy',\n label: 'Copy link',\n title: 'Copy link',\n icon: linkIcon,\n iconName: 'copy-link',\n target: '',\n rel: '',\n buildUrl: () => '#'\n }\n);\n\n/**\n * A share button that copies the embed code of the generated media URL.\n *\n * @param {import('video.js/dist/types/player.js').default} player The player instance.\n * @param {Object} options The button options, on top of the `ShareButton` ones.\n * @param {function(url, player, button): string} [options.buildEmbedCode] Builds the embed code\n * from the generated media URL.\n */\nclass EmbedShareButton extends CopyLinkShareButton {\n /**\n * Returns the embed code copied to the clipboard.\n *\n * @returns {string} The embed code.\n */\n textToCopy() {\n const { buildEmbedCode } = this.options();\n\n return buildEmbedCode(this.generateUrl(), this.player(), this);\n }\n}\nEmbedShareButton.prototype.options_ = videojs.obj.merge(\n CopyLinkShareButton.prototype.options_,\n {\n className: 'vjs-share-button-embed',\n label: 'Embed',\n title: 'Embed',\n icon: embedIcon,\n iconName: 'embed',\n buildEmbedCode: url =>\n `<iframe src=\"${url}\" width=\"560\" height=\"315\" allowfullscreen></iframe>`\n }\n);\n\nvideojs.registerComponent('ShareButton', ShareButton);\nvideojs.registerComponent('FacebookShareButton', FacebookShareButton);\nvideojs.registerComponent('XShareButton', XShareButton);\nvideojs.registerComponent('LinkedinShareButton', LinkedinShareButton);\nvideojs.registerComponent('WhatsappShareButton', WhatsappShareButton);\nvideojs.registerComponent('EmailShareButton', EmailShareButton);\nvideojs.registerComponent('CopyLinkShareButton', CopyLinkShareButton);\nvideojs.registerComponent('EmbedShareButton', EmbedShareButton);\n\nexport {\n CopyLinkShareButton,\n EmailShareButton,\n EmbedShareButton,\n FacebookShareButton,\n LinkedinShareButton,\n ShareButton,\n WhatsappShareButton,\n XShareButton\n};\n\nexport default ShareButton;\n","import videojs from 'video.js';\nimport './share-button.js';\n\n/**\n * @ignore\n * @type {typeof import('video.js/dist/types/component').default}\n */\nconst Component = videojs.getComponent('Component');\n\n/**\n * Holds the platform share buttons. The buttons are declared as default\n * children so integrators can add, remove or configure them through the\n * standard Video.js options.\n *\n * @param {import('video.js/dist/types/player.js').default} player The player instance.\n * @param {Object} options The collection options.\n * @param {string|function(player, button): string} [options.shareText] The text shared by every\n * button that does not define its own, defaults to the document title.\n * @param {string[]} [options.children] The platform buttons to display. Set one to `false` in the\n * options to remove it.\n */\nclass ShareButtonCollection extends Component {\n /**\n * Passes the selected URL generator to every platform button.\n *\n * @param {Function} generateUrl The URL generator.\n */\n setUrlGenerator(generateUrl) {\n this.children().forEach(child => child.setUrlGenerator?.(generateUrl));\n }\n}\n\nShareButtonCollection.prototype.options_ = {\n className: 'vjs-share-button-collection',\n shareText: undefined,\n children: [\n 'facebookShareButton',\n 'xShareButton',\n 'linkedinShareButton',\n 'whatsappShareButton',\n 'emailShareButton',\n 'copyLinkShareButton',\n 'embedShareButton'\n ]\n};\n\nvideojs.registerComponent('ShareButtonCollection', ShareButtonCollection);\n\nexport default ShareButtonCollection;\n","{\n \"Share\": \"Teilen\",\n \"Sharing type\": \"Art des Teilens\",\n \"Close\": \"Schliessen\",\n \"Share episode\": \"Episode teilen\",\n \"Episode\": \"Episode\",\n \"Share the current position\": \"Aktuelle Position teilen\",\n \"Current position\": \"Aktuelle Position\",\n \"Share on Facebook\": \"Auf Facebook teilen\",\n \"Share on X\": \"Auf X teilen\",\n \"Share on LinkedIn\": \"Auf LinkedIn teilen\",\n \"Share on WhatsApp\": \"Auf WhatsApp teilen\",\n \"Share by email\": \"Per E-Mail teilen\",\n \"Copy link\": \"Link kopieren\",\n \"Embed\": \"Einbetten\",\n \"Facebook\": \"Facebook\",\n \"X\": \"X\",\n \"LinkedIn\": \"LinkedIn\",\n \"WhatsApp\": \"WhatsApp\",\n \"E-mail\": \"E-Mail\"\n}\n","{\n \"Share\": \"Share\",\n \"Sharing type\": \"Sharing type\",\n \"Close\": \"Close\",\n \"Share episode\": \"Share episode\",\n \"Episode\": \"Episode\",\n \"Share the current position\": \"Share the current position\",\n \"Current position\": \"Current position\",\n \"Share on Facebook\": \"Share on Facebook\",\n \"Share on X\": \"Share on X\",\n \"Share on LinkedIn\": \"Share on LinkedIn\",\n \"Share on WhatsApp\": \"Share on WhatsApp\",\n \"Share by email\": \"Share by email\",\n \"Copy link\": \"Copy link\",\n \"Embed\": \"Embed\",\n \"Facebook\": \"Facebook\",\n \"X\": \"X\",\n \"LinkedIn\": \"LinkedIn\",\n \"WhatsApp\": \"WhatsApp\",\n \"E-mail\": \"E-mail\"\n}\n","{\n \"Share\": \"Partager\",\n \"Sharing type\": \"Type de partage\",\n \"Close\": \"Fermer\",\n \"Share episode\": \"Partager l'épisode\",\n \"Episode\": \"Épisode\",\n \"Share the current position\": \"Partager la position courante\",\n \"Current position\": \"Position courante\",\n \"Share on Facebook\": \"Partager sur Facebook\",\n \"Share on X\": \"Partager sur X\",\n \"Share on LinkedIn\": \"Partager sur Linkedin\",\n \"Share on WhatsApp\": \"Partager sur Whatsapp\",\n \"Share by email\": \"Partager par e-mail\",\n \"Copy link\": \"Copier le lien\",\n \"Embed\": \"Embed\",\n \"Facebook\": \"Facebook\",\n \"X\": \"X\",\n \"LinkedIn\": \"LinkedIn\",\n \"WhatsApp\": \"WhatsApp\",\n \"E-mail\": \"E-mail\"\n}\n","{\n \"Share\": \"Condividi\",\n \"Sharing type\": \"Tipo di condivisione\",\n \"Close\": \"Chiudi\",\n \"Share episode\": \"Condividi l'episodio\",\n \"Episode\": \"Episodio\",\n \"Share the current position\": \"Condividi la posizione corrente\",\n \"Current position\": \"Posizione corrente\",\n \"Share on Facebook\": \"Condividi su Facebook\",\n \"Share on X\": \"Condividi su X\",\n \"Share on LinkedIn\": \"Condividi su LinkedIn\",\n \"Share on WhatsApp\": \"Condividi su WhatsApp\",\n \"Share by email\": \"Condividi via e-mail\",\n \"Copy link\": \"Copia il link\",\n \"Embed\": \"Incorpora\",\n \"Facebook\": \"Facebook\",\n \"X\": \"X\",\n \"LinkedIn\": \"LinkedIn\",\n \"WhatsApp\": \"WhatsApp\",\n \"E-mail\": \"E-mail\"\n}\n","{\n \"Share\": \"Cundivider\",\n \"Sharing type\": \"Tip da cundivider\",\n \"Close\": \"Serrar\",\n \"Share episode\": \"Cundivider l'episoda\",\n \"Episode\": \"Episoda\",\n \"Share the current position\": \"Cundivider la posiziun actuala\",\n \"Current position\": \"Posiziun actuala\",\n \"Share on Facebook\": \"Cundivider sin Facebook\",\n \"Share on X\": \"Cundivider sin X\",\n \"Share on LinkedIn\": \"Cundivider sin LinkedIn\",\n \"Share on WhatsApp\": \"Cundivider sin WhatsApp\",\n \"Share by email\": \"Cundivider per e-mail\",\n \"Copy link\": \"Copiar il link\",\n \"Embed\": \"Integrar\",\n \"Facebook\": \"Facebook\",\n \"X\": \"X\",\n \"LinkedIn\": \"LinkedIn\",\n \"WhatsApp\": \"WhatsApp\",\n \"E-mail\": \"E-mail\"\n}\n","import de from './de.json';\nimport en from './en.json';\nimport fr from './fr.json';\nimport it from './it.json';\nimport rm from './rm.json';\nimport videojs from 'video.js';\n\nfunction extendLanguage(code, data) {\n videojs.addLanguage(code, {\n ...videojs.options.language[code] ?? {},\n ...data\n });\n}\n\nextendLanguage('de', de);\nextendLanguage('en', en);\nextendLanguage('fr', fr);\nextendLanguage('it', it);\nextendLanguage('rm', rm);\n","import videojs from 'video.js';\nimport './lang';\n\n/**\n * @ignore\n * @type {typeof import('video.js/dist/types/component').default}\n */\nconst Component = videojs.getComponent('Component');\n\nconst baseUrl = (player, component) =>\n configuredUrl(player, component) || window.location.href;\n\nconst configuredUrl = (player, component) => {\n const { url } = component.options();\n\n return typeof url === 'function' ?\n url(player, component, component.context()) :\n url;\n};\n\nconst getMediaComposition = (player) =>\n player.options().mediaComposition;\n\nconst getMainChapter = (player) =>\n getMediaComposition(player)?.getMainChapter?.();\n\nconst getSubdivisions = (player) =>\n getMediaComposition(player)?.getSubdivisions?.() ?? [];\n\nconst containsTime = (segment, time) =>\n time >= segment.markIn / 1000 && time < segment.markOut / 1000;\n\nconst getCurrentSubdivision = (player) =>\n getSubdivisions(player)\n .filter((segment) => !segment.blockReason)\n .filter((segment) => containsTime(segment, player.currentTime()))\n .pop();\n\nconst getSourceMediaData = (player) => player.currentSource()?.mediaData;\n\nconst getCurrentMedia = (player) =>\n getMainChapter(player) ||\n getSourceMediaData(player);\n\n/**\n * A radio group selecting which URL is shared. The selected option generates\n * the media URL that the share buttons wrap for their own platform.\n *\n * The native `change` event of the radio inputs bubbles up to this component\n * element, listen to it to be notified when the selection changes.\n */\nclass ShareUrlOptions extends Component {\n /**\n * Creates the URL option radio group.\n *\n * @param {import('video.js/dist/types/player.js').default} player The player instance.\n * @param {Object} options The URL option configuration.\n * @param {string|function(player, component, context): string} [options.url] The base URL used to\n * generate the share URLs, defaults to the current page URL.\n * @param {boolean} [options.includeCurrentTime=false] Enables the current position option.\n * @param {string} [options.defaultOption] The initially selected option, `'currentTime'` when the\n * current position is enabled, `'episode'` otherwise.\n * @param {Object} [options.options] The available options, keyed by name. Each one declares a\n * `label`, a `title`, a `generateUrl(player, component)` and optionally `isHidden(player, component)`,\n * `isDisabled(player, component)` or a static `disabled`. Set an entry to `false` to remove it.\n */\n constructor(player, options = {}) {\n super(player, options);\n this.render();\n this.on(this.player(), 'timeupdate', this.updateOptionsState);\n }\n\n /**\n * Creates the component element.\n *\n * @returns {HTMLElement} The radio group element.\n */\n createEl() {\n return super.createEl('div', {}, {\n role: 'radiogroup',\n 'aria-label': this.localize('Sharing type')\n });\n }\n\n /**\n * Renders the enabled options. The group is hidden when there is nothing\n * to choose from.\n *\n * @param {string} [selected] The name of the checked option.\n */\n render(selected = this.defaultOption()) {\n const entries = this.entries();\n\n this.toggleClass('vjs-hidden', entries.length <= 1);\n this.el().replaceChildren(...entries.map(\n ([name, option]) => this.createOption(name, option, name === selected)\n ));\n }\n\n /**\n * Returns the enabled URL option entries.\n *\n * @returns {Array} The enabled `[name, option]` pairs.\n */\n entries() {\n const { options, includeCurrentTime } = this.options();\n\n return Object.entries(options).filter(([name, option]) =>\n option !== false &&\n !this.isOptionHidden(option) &&\n (name !== 'currentTime' || includeCurrentTime));\n }\n\n /**\n * Returns whether an option should be hidden.\n *\n * @param {Object} option The option config.\n *\n * @returns {boolean} True when hidden.\n */\n isOptionHidden(option) {\n return typeof option.isHidden === 'function' ?\n option.isHidden(this.player(), this) :\n false;\n }\n\n /**\n * Returns whether an option is currently disabled.\n *\n * @param {Object} option The option config.\n *\n * @returns {boolean} True when disabled.\n */\n isOptionDisabled(option) {\n return typeof option.isDisabled === 'function' ?\n option.isDisabled(this.player(), this) :\n Boolean(option.disabled);\n }\n\n /**\n * Returns the name of the option checked by default. Disabled options are\n * never selected by default.\n *\n * @returns {string} The default option name.\n */\n defaultOption() {\n const { defaultOption, includeCurrentTime } = this.options();\n const preferred = defaultOption ??\n (includeCurrentTime ? 'currentTime' : 'episode');\n const entries = this.entries()\n .filter(([, option]) => !this.isOptionDisabled(option));\n\n return entries.some(([name]) => name === preferred) ?\n preferred :\n entries[0]?.[0];\n }\n\n /**\n * Creates one radio option.\n *\n * @param {string} name The option name.\n * @param {Object} option The option configuration.\n * @param {boolean} checked Whether the option is checked.\n *\n * @returns {HTMLLabelElement} The option label wrapping the radio input.\n */\n createOption(name, option, checked) {\n const id = `${this.id()}_${name}`;\n const label = videojs.dom.createEl('label', {\n className: 'vjs-share-url-option-label',\n title: this.localize(option.title ?? option.label)\n }, { for: id });\n\n label.append(\n videojs.dom.createEl('input', {\n className: 'vjs-share-url-option-input',\n checked,\n disabled: this.isOptionDisabled(option)\n }, {\n id,\n type: 'radio',\n name: `${this.id()}_url_option`,\n value: name\n }),\n videojs.dom.createEl('span', {\n textContent: this.localize(option.label)\n })\n );\n\n return label;\n }\n\n /**\n * Returns the radio input of an option.\n *\n * @param {string} name The option name.\n *\n * @returns {HTMLInputElement|null} The radio input, when rendered.\n */\n input(name) {\n return this.$(`.vjs-share-url-option-input[value=\"${name}\"]`);\n }\n\n /**\n * Returns the name of the selected option.\n *\n * @returns {string|undefined} The selected option name.\n */\n selected() {\n return this.$('.vjs-share-url-option-input:checked')?.value;\n }\n\n /**\n * Refreshes the disabled state of the rendered options, falling back to the\n * default option when the selected one becomes disabled.\n */\n updateOptionsState() {\n this.entries().forEach(([name, option]) => {\n const input = this.input(name);\n\n if (input) input.disabled = this.isOptionDisabled(option);\n });\n\n const selected = this.options().options[this.selected()];\n\n if (selected && this.isOptionDisabled(selected)) {\n this.selectDefaultOption();\n }\n }\n\n /**\n * Selects the current default URL option.\n */\n selectDefaultOption() {\n const input = this.input(this.defaultOption());\n\n if (!input) return;\n\n input.checked = true;\n this.trigger('change');\n }\n\n /**\n * Returns media information available to URL builders.\n *\n * @returns {Object} The current media context.\n */\n context() {\n const currentMedia = getCurrentMedia(this.player());\n\n return {\n currentMedia,\n currentSource: this.player().currentSource?.(),\n currentSubdivision: getCurrentSubdivision(this.player()),\n currentTime: this.player().currentTime(),\n mainChapter: getMainChapter(this.player()),\n mediaData: getSourceMediaData(this.player()),\n subdivisions: getSubdivisions(this.player()),\n title: currentMedia?.title\n };\n }\n\n /**\n * Generates the share URL of the selected option.\n *\n * @returns {string} The share URL.\n */\n generateUrl() {\n const option = this.options().options[this.selected()];\n\n return option ? option.generateUrl(this.player(), this) : '';\n }\n\n /**\n * Re-renders the options with the current language, keeping the selection.\n */\n handleLanguagechange() {\n this.el().setAttribute('aria-label', this.localize('Sharing type'));\n this.render(this.selected());\n }\n}\n\nShareUrlOptions.prototype.options_ = {\n className: 'vjs-share-url-options',\n defaultOption: undefined,\n includeCurrentTime: false,\n url: undefined,\n options: {\n episode: {\n label: 'Episode',\n title: 'Share episode',\n generateUrl: (player, component) => baseUrl(player, component)\n },\n currentTime: {\n label: 'Current position',\n title: 'Share the current position',\n generateUrl: (player, component) => {\n const url = new URL(baseUrl(player, component));\n\n url.searchParams.set('startTime', Math.floor(player.currentTime()));\n\n return url.toString();\n }\n }\n }\n};\n\nvideojs.registerComponent('ShareUrlOptions', ShareUrlOptions);\n\nexport default ShareUrlOptions;\n","import videojs from 'video.js';\nimport './lang';\nimport './share-button-collection.js';\nimport './share-url-options.js';\n\n/**\n * @ignore\n * @type {typeof import('video.js/dist/types/modal-dialog').default}\n */\nconst ModalDialog = videojs.getComponent('ModalDialog');\n\n/**\n * A small share modal anchored to the top-right corner of the player.\n */\nclass ShareModal extends ModalDialog {\n /**\n * Creates an instance of ShareModal.\n *\n * @param {import('video.js/dist/types/player.js').default} player The player instance.\n * @param {Object} options The modal options, on top of the `ModalDialog` ones.\n * @param {string} [options.title='Share'] The title displayed at the top of the modal.\n * @param {boolean} [options.pauseOnOpen=false] Whether opening the modal pauses the player.\n * @param {boolean} [options.temporary=false] Whether the modal is disposed once closed.\n * @param {Object} [options.shareUrlOptions={}] The `ShareUrlOptions` child configuration.\n * @param {Object} [options.shareButtonCollection={}] The `ShareButtonCollection` child configuration.\n */\n constructor(player, options = {}) {\n super(player, options);\n\n this.handleOutsideClick = this.handleOutsideClick.bind(this);\n this.fill();\n this.render();\n }\n\n /**\n * Cleans up the modal and removes its event listeners.\n */\n dispose() {\n this.unbindOutsideClick();\n super.dispose();\n }\n\n /**\n * Builds the CSS class string for the modal.\n *\n * @returns {string} The CSS class string.\n */\n buildCSSClass() {\n return `vjs-share-modal ${super.buildCSSClass()}`;\n }\n\n /**\n * Renders the modal content.\n */\n render() {\n this.title_ = this.createTitle();\n this.urlOptions_ = this.addChild(\n 'ShareUrlOptions',\n this.options().shareUrlOptions\n );\n this.collection_ = this.addChild(\n 'ShareButtonCollection',\n this.options().shareButtonCollection\n );\n\n this.on(this.urlOptions_, 'change', this.updateUrlGenerator);\n this.on('share', this.handleShare);\n this.updateUrlGenerator();\n }\n\n /**\n * Creates the modal title.\n *\n * @returns {Component} The title component.\n */\n createTitle() {\n const title = this.addChild('ShareModalTitle', {\n componentClass: 'TitleBar',\n className: 'vjs-share-title'\n });\n\n title.update({\n title: this.localize(this.options().title ?? 'Share')\n });\n\n return title;\n }\n\n /**\n * Opens the modal.\n */\n open() {\n super.open();\n this.bindOutsideClick();\n this.updateUrlGenerator();\n }\n\n /**\n * Closes the modal.\n */\n close() {\n this.unbindOutsideClick();\n super.close();\n }\n\n /**\n * Updates the collection URL generator.\n */\n updateUrlGenerator() {\n this.collection_.setUrlGenerator(() => this.urlOptions_.generateUrl());\n }\n\n /**\n * Closes the modal after a share action. The `share` event bubbles from the\n * platform buttons.\n */\n handleShare() {\n this.close();\n }\n\n /**\n * Binds the outside click listener.\n */\n bindOutsideClick() {\n document.addEventListener('pointerdown', this.handleOutsideClick);\n }\n\n /**\n * Removes the outside click listener.\n */\n unbindOutsideClick() {\n document.removeEventListener('pointerdown', this.handleOutsideClick);\n }\n\n /**\n * Closes the modal when clicking outside the share modal.\n *\n * @param {PointerEvent} event The pointer event.\n */\n handleOutsideClick(event) {\n if (this.isOwnClick(event)) return;\n\n this.close();\n }\n\n /**\n * Returns whether the click happened inside the share modal.\n *\n * @param {PointerEvent} event The pointer event.\n *\n * @returns {boolean} True when the click belongs to the share modal.\n */\n isOwnClick(event) {\n return this.el().contains(event.target);\n }\n\n handleLanguagechange() {\n this.el().title = this.localize(this.options().title ?? 'Share');\n this.title_.update({\n title: this.localize(this.options().title ?? 'Share')\n });\n }\n}\n\nShareModal.prototype.options_ = {\n pauseOnOpen: false,\n temporary: false,\n title: 'Share',\n shareUrlOptions: {},\n shareButtonCollection: {}\n};\n\nvideojs.registerComponent('ShareModal', ShareModal);\n\nexport default ShareModal;\n","{\n \"name\": \"@srgssr/share-button\",\n \"version\": \"0.0.1\",\n \"license\": \"MIT\",\n \"author\": \"SRG SSR\",\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"git+https://github.com/SRGSSR/pillarbox-web-suite.git\"\n },\n \"publishConfig\": {\n \"access\": \"public\"\n },\n \"homepage\": \"https://github.com/SRGSSR/pillarbox-web-suite/tree/main/packages/share-button#readme\",\n \"type\": \"module\",\n \"main\": \"dist/share-button.cjs\",\n \"browser\": \"dist/share-button.umd.min.js\",\n \"module\": \"dist/share-button.js\",\n \"style\": \"./dist/share-button.min.css\",\n \"exports\": {\n \".\": {\n \"import\": \"./dist/share-button.js\",\n \"require\": \"./dist/share-button.cjs\"\n },\n \"./*\": \"./*\"\n },\n \"files\": [\n \"dist/*\",\n \"scss/*\"\n ],\n \"keywords\": [\n \"video.js\",\n \"player\",\n \"share\",\n \"videojs-component\"\n ],\n \"scripts\": {\n \"clean\": \"rimraf dist\",\n \"build\": \"npm-run-all clean build:*\",\n \"build:css\": \"sass ./scss/share-button.scss:dist/share-button.min.css --style compressed --source-map --load-path node_modules\",\n \"build:lib\": \"vite build --config vite.config.lib.js\",\n \"build:umd\": \"vite build --config vite.config.umd.js\",\n \"github:page\": \"vite build\",\n \"release:ci\": \"semantic-release\",\n \"start\": \" vite --port 4200 --open\",\n \"test\": \"vitest run --silent --coverage --coverage.reporter text\"\n },\n \"dependencies\": {\n \"@srgssr/svg-button\": \"^1.1.3\"\n },\n \"peerDependencies\": {\n \"video.js\": \"^8.0.0\"\n },\n \"devDependencies\": {\n \"@srgssr/pillarbox-web\": \"^1.36.1\"\n }\n}\n","import videojs from 'video.js';\nimport '@srgssr/svg-button';\nimport { version } from '../package.json';\n\n/**\n * @ignore\n * @type {typeof import('@srgssr/svg-button').SvgButton}\n */\nconst SvgButton = videojs.getComponent('SvgButton');\n\n/**\n * @ignore\n * @type {typeof import('video.js/dist/types/utils/log.js').default}\n */\nconst log = videojs.log.createLogger('share-toggle');\n\n/**\n * A Video.js button that opens the share modal. The button follows the modal\n * state: it is hidden while the modal is open and shown again once closed.\n */\nclass ShareToggle extends SvgButton {\n /**\n * Creates an instance of ShareToggle.\n *\n * @param {import('video.js/dist/types/player.js').default} player The player instance.\n * @param {Object} options The button options, on top of the `SvgButton` ones.\n * @param {string} [options.controlText='Share'] The accessible text of the button.\n * @param {SVGElement|string|URL} [options.icon] The icon displayed by the button.\n * @param {string} [options.iconName='share'] The icon name when using Video.js experimental SVG icons.\n */\n constructor(player, options = {}) {\n super(player, options);\n\n // The modal may be initialized after this button depending on the order\n // of the player options, defer the binding until the player is ready.\n this.player().ready(() => this.bindShareModal());\n }\n\n /**\n * Listens to the share modal lifecycle events to follow its state.\n */\n bindShareModal() {\n const modal = this.player().getChild('ShareModal');\n\n if (!modal) {\n log.warn('ShareToggle requires a ShareModal child on the player');\n\n return;\n }\n\n this.on(modal, 'modalopen', this.hide);\n this.on(modal, 'modalclose', this.show);\n this.toggleClass('vjs-hidden', modal.opened());\n }\n\n /**\n * Handles click events on the ShareToggle by opening the share modal.\n *\n * @param {Event} event The click event.\n */\n handleClick(event) {\n super.handleClick(event);\n this.shareModal().open();\n }\n\n /**\n * Returns the modal controlled by this toggle.\n *\n * @returns {import('./share-modal.js').default} The share modal.\n */\n shareModal() {\n const modal = this.player().getChild('ShareModal');\n\n if (!modal) {\n throw new Error('ShareToggle requires a ShareModal child on the player');\n }\n\n return modal;\n }\n\n /**\n * Builds the CSS class string for the toggle.\n *\n * @returns {string} The CSS class string.\n */\n buildCSSClass() {\n return `vjs-share-toggle ${super.buildCSSClass()}`;\n }\n\n /**\n * Returns the package version.\n *\n * @returns {string} The current package version.\n */\n static get VERSION() {\n return version;\n }\n}\n\nShareToggle.prototype.options_ = {\n controlText: 'Share',\n iconName: 'share'\n};\n\nvideojs.registerComponent('ShareToggle', ShareToggle);\n\nexport default ShareToggle;\n"],"mappings":"o2DAOA,SAASA,EAAmBC,EAAW,CAErC,IAAMC,EADM,IAAIC,UAAU,CAAC,CAACC,gBAAgBH,EAAW,eAC1C,CAAG,CAACI,gBAEjB,GAAI,EAAEH,aAAgBI,YACpB,MAAUC,MAAM,kCAAkC,EAGpD,OAAOL,CACT,CAEA,SAOeM,EAAeP,EAAA,CAAA,OAAAQ,EAAAC,MAAA,KAAAC,SAAA,CAAA,CAU9B,SAAAF,GAAA,CAFC,MAEDA,GAAAG,EAVA,UAA+BX,EAAW,CACxC,IAAMC,EAAG,MAASW,MAAMZ,EAAW,CAAEa,KAAM,MAAO,CAAC,EAEnD,GAAI,CAACZ,EAAIa,GACP,MAAUR,MAAM,wBAAwBL,EAAIc,OAAA,GAAUd,EAAIe,YAAY,EAGxE,OAAOjB,EAAkB,MAAOE,EAAIgB,KAAK,CAAC,CAC5C,CAAC,EAAAT,EAAAC,MAAA,KAAAC,SAAA,CAAA,CAAA,SAScQ,EAAoBlB,EAAA,CAAA,OAAAmB,EAAAV,MAAA,KAAAC,SAAA,CAAA,CAenC,SAAAS,GAAA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