From 0d82dddf510a7880057f7b63ffc91a633982ff37 Mon Sep 17 00:00:00 2001 From: ReeceM Date: Thu, 22 Dec 2022 11:07:33 +0200 Subject: [PATCH] bump version and changelog --- CHANGELOG.md | 8 +++++- dist/hBar.js | 47 +++++++++++++++++++++++++++--------- dist/hBar.min.js | 2 +- dist/hBar.min.js.LICENSE.txt | 2 +- package.json | 2 +- 5 files changed, 46 insertions(+), 15 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 75adc50..9814937 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,11 @@ All notable changes to `h-bar` will be documented in this file. ## [Unreleased] +## [2.0.2] - 2022-12-22 +### Fixed +- `customStyles` prop was ignored in version change + + ## [2.0.1] - 2022-12-21 ### Added - Templating for custom styles. @@ -80,7 +85,8 @@ Also update the readme. Before this the documented changes are vague cause it was the initial flesh of the package. -[Unreleased]: https://github.com/reecem/h-bar/compare/v2.0.1...HEAD +[Unreleased]: https://github.com/reecem/h-bar/compare/v2.0.2...HEAD +[2.0.2]: https://github.com/reecem/h-bar/compare/v2.0.1...v2.0.2 [2.0.1]: https://github.com/reecem/h-bar/compare/v1.0.1...v2.0.1 [1.1.0]: https://github.com/reecem/h-bar/compare/v1.0.1...v1.1.0 [1.0.1]: https://github.com/reecem/h-bar/compare/v0.3.0...v1.0.1 diff --git a/dist/hBar.js b/dist/hBar.js index 932ece9..374a5e2 100644 --- a/dist/hBar.js +++ b/dist/hBar.js @@ -422,6 +422,13 @@ function styleTagTransform(css, styleElement) { module.exports = styleTagTransform; +/***/ }), + +/***/ 147: +/***/ ((module) => { + +module.exports = {"i8":"2.0.2"}; + /***/ }) /******/ }); @@ -645,6 +652,8 @@ var themes = { * * @var {object} config * @var {object} config.fetchOptions + * @var {string} config.version + * @var {bool} config.production */ var config = { fetchOptions: { @@ -657,7 +666,10 @@ var config = { 'Accept': 'application/json' }, redirect: 'follow' // manual, *follow, error - } + }, + + version: (__webpack_require__(147)/* .version */ .i8), + production: process.env.production }; ;// CONCATENATED MODULE: ./src/functions/normalise.js /** @@ -753,7 +765,12 @@ function init_init() { configuration.url = options.url; // if the user has dompurify installed. It can be optional configuration.DOMPurify = options.DOMPurify || null; - configuration.theme = themes[options.theme] || 'grey'; + configuration.theme = themes[options.theme] || themes.gray; + + // load overrides for the styling section. + if (options.customStyles) { + configuration.customStyles = Object.assign(styling, options.customStyles); + } configuration.badge = options.badge || null; // we will default to false for configuration @@ -867,6 +884,8 @@ function getElementOptions(element) { /** * Determines if the banner has been dismissed. * + * @todo add option to check the hash on the stored value + * * @returns boolean */ function isDismissed() { @@ -964,13 +983,18 @@ var Banner = /*#__PURE__*/function () { dismissible = _ref.dismissible, dismissFor = _ref.dismissFor, theme = _ref.theme, - badge = _ref.badge; + badge = _ref.badge, + _ref$customStyles = _ref.customStyles, + customStyles = _ref$customStyles === void 0 ? null : _ref$customStyles; banner_classCallCheck(this, Banner); this.$el = $el; this.dismissible = dismissible; this.dismissFor = dismissFor; this.badge = badge; this.theme = theme; + + // use the top level styling preferences + this.styling = customStyles != null ? customStyles : styling; } /** @@ -994,7 +1018,7 @@ var Banner = /*#__PURE__*/function () { var secondaryLinkList = _this.createSecondaryLinks(secondaryLinks); secondaryElement = newElement('div', { children: secondaryLinkList, - classes: "".concat(styling.linkWrapper, " ").concat(_this.theme.linkWrapper) + classes: "".concat(_this.theme.linkWrapper, " ").concat(_this.styling.linkWrapper, " ") }); } else { secondaryElement = _this.dismissibleButton(); @@ -1002,12 +1026,12 @@ var Banner = /*#__PURE__*/function () { var badgeElement = null; if (_this.badge) { badgeElement = newElement('span', { - classes: "".concat(styling.badge, " ").concat(_this.theme.badge) + classes: "".concat(_this.theme.badge, " ").concat(_this.styling.badge) }); badgeElement.innerText = _this.badge; } var postLink = newElement('a', { - classes: "".concat(styling.postTitle, " ").concat(_this.theme.postTitle) + classes: "".concat(_this.theme.postTitle, " ").concat(_this.styling.postTitle) }); postLink.href = link; postLink.innerText = title; @@ -1017,11 +1041,11 @@ var Banner = /*#__PURE__*/function () { postChildren.unshift(badgeElement); } var postElement = newElement('div', { - classes: "".concat(styling.linkWrapper, " ").concat(_this.theme.linkWrapper), + classes: "".concat(_this.theme.linkWrapper, " ").concat(_this.styling.linkWrapper, " "), children: postChildren }); var _hbar = newElement('div', { - classes: "".concat(styling.wrapper, " ").concat(_this.theme.wrapper), + classes: "".concat(_this.theme.wrapper, " ").concat(_this.styling.wrapper, " "), children: [postElement, secondaryElement] }); var container = document.querySelector(_this.$el); @@ -1086,7 +1110,7 @@ var Banner = /*#__PURE__*/function () { return secondaryLinks.map(function (_ref3) { var title = _ref3.title, link = _ref3.link; - var style = "".concat(styling.secondaryLink, " ").concat(_this3.theme.secondaryLink); + var style = "".concat(_this3.theme.secondaryLink, " ").concat(_this3.styling.secondaryLink, " "); var butter = newElement('a', { classes: style }); @@ -1104,7 +1128,7 @@ function src_typeof(obj) { "@babel/helpers - typeof"; return src_typeof = "funct /** * h-bar banner and dynamic announcement library * - * @version 2.0.0 + * @version 2.0.2 * @license MIT * @copyright @ReeceM */ @@ -1115,6 +1139,7 @@ function src_typeof(obj) { "@babel/helpers - typeof"; return src_typeof = "funct + /** * Set all the configuration options for the hBar library * @@ -1135,7 +1160,7 @@ function src_typeof(obj) { "@babel/helpers - typeof"; return src_typeof = "funct * @property {string} title Manual Override */ var hBar = { - version: "2.0.0", + version: config.version, rendered: false, fetching: false, usingBanner: true, diff --git a/dist/hBar.min.js b/dist/hBar.min.js index 8c02b1b..b030f4f 100644 --- a/dist/hBar.min.js +++ b/dist/hBar.min.js @@ -1,2 +1,2 @@ /*! For license information please see hBar.min.js.LICENSE.txt */ -!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.hBar=e():t.hBar=e()}(self,(()=>(()=>{"use strict";var t={363:(t,e,r)=>{r.d(e,{Z:()=>c});var o=r(81),n=r.n(o),a=r(645),i=r.n(a)()(n());i.push([t.id,"*,:after,:before{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(59,130,246,.5);--tw-ring-offset-shadow:0 0 transparent;--tw-ring-shadow:0 0 transparent;--tw-shadow:0 0 transparent;--tw-shadow-colored:0 0 transparent;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: }::backdrop{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(59,130,246,.5);--tw-ring-offset-shadow:0 0 transparent;--tw-ring-shadow:0 0 transparent;--tw-shadow:0 0 transparent;--tw-shadow-colored:0 0 transparent;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: }.hb-mx-2{margin-left:.5rem;margin-right:.5rem}.hb-mx-5{margin-left:1.25rem;margin-right:1.25rem}.hb--mr-2{margin-right:-.5rem}.hb-flex{display:flex}.hb-inline-flex{display:inline-flex}.hb-h-3{height:.75rem}.hb-h-4{height:1rem}.hb-w-3{width:.75rem}.hb-w-4{width:1rem}.hb-w-full{width:100%}.hb-cursor-pointer{cursor:pointer}.hb-items-center{align-items:center}.hb-justify-between{justify-content:space-between}.hb-rounded-md{border-radius:.375rem}.hb-rounded-full{border-radius:9999px}.hb-bg-gray-900{--tw-bg-opacity:1;background-color:rgba(17,24,39,var(--tw-bg-opacity))}.hb-bg-white{--tw-bg-opacity:1;background-color:rgba(255,255,255,var(--tw-bg-opacity))}.hb-bg-gray-400{--tw-bg-opacity:1;background-color:rgba(156,163,175,var(--tw-bg-opacity))}.hb-bg-blue-900{--tw-bg-opacity:1;background-color:rgba(30,58,138,var(--tw-bg-opacity))}.hb-bg-blue-100{--tw-bg-opacity:1;background-color:rgba(219,234,254,var(--tw-bg-opacity))}.hb-bg-green-600{--tw-bg-opacity:1;background-color:rgba(22,163,74,var(--tw-bg-opacity))}.hb-bg-green-100{--tw-bg-opacity:1;background-color:rgba(220,252,231,var(--tw-bg-opacity))}.hb-bg-indigo-800{--tw-bg-opacity:1;background-color:rgba(55,48,163,var(--tw-bg-opacity))}.hb-bg-indigo-100{--tw-bg-opacity:1;background-color:rgba(224,231,255,var(--tw-bg-opacity))}.hb-bg-orange-300{--tw-bg-opacity:1;background-color:rgba(253,186,116,var(--tw-bg-opacity))}.hb-bg-orange-800{--tw-bg-opacity:1;background-color:rgba(154,52,18,var(--tw-bg-opacity))}.hb-bg-yellow-300{--tw-bg-opacity:1;background-color:rgba(253,224,71,var(--tw-bg-opacity))}.hb-bg-yellow-100{--tw-bg-opacity:1;background-color:rgba(254,249,195,var(--tw-bg-opacity))}.hb-bg-teal-500{--tw-bg-opacity:1;background-color:rgba(20,184,166,var(--tw-bg-opacity))}.hb-bg-teal-900{--tw-bg-opacity:1;background-color:rgba(19,78,74,var(--tw-bg-opacity))}.hb-bg-red-400{--tw-bg-opacity:1;background-color:rgba(248,113,113,var(--tw-bg-opacity))}.hb-bg-red-100{--tw-bg-opacity:1;background-color:rgba(254,226,226,var(--tw-bg-opacity))}.hb-p-1{padding:.25rem}.hb-py-2{padding-bottom:.5rem;padding-top:.5rem}.hb-px-1{padding-left:.25rem;padding-right:.25rem}.hb-px-2{padding-left:.5rem;padding-right:.5rem}.hb-text-sm{font-size:.875rem;line-height:1.25rem}.hb-text-xs{font-size:.75rem;line-height:1rem}.hb-font-semibold{font-weight:600}.hb-uppercase{text-transform:uppercase}.hb-leading-relaxed{line-height:1.625}.hb-tracking-wider{letter-spacing:.05em}.hb-text-gray-100{--tw-text-opacity:1;color:rgba(243,244,246,var(--tw-text-opacity))}.hb-text-gray-900{--tw-text-opacity:1;color:rgba(17,24,39,var(--tw-text-opacity))}.hb-text-gray-800{--tw-text-opacity:1;color:rgba(31,41,55,var(--tw-text-opacity))}.hb-text-blue-100{--tw-text-opacity:1;color:rgba(219,234,254,var(--tw-text-opacity))}.hb-text-blue-900{--tw-text-opacity:1;color:rgba(30,58,138,var(--tw-text-opacity))}.hb-text-green-100{--tw-text-opacity:1;color:rgba(220,252,231,var(--tw-text-opacity))}.hb-text-green-900{--tw-text-opacity:1;color:rgba(20,83,45,var(--tw-text-opacity))}.hb-text-indigo-100{--tw-text-opacity:1;color:rgba(224,231,255,var(--tw-text-opacity))}.hb-text-indigo-900{--tw-text-opacity:1;color:rgba(49,46,129,var(--tw-text-opacity))}.hb-text-orange-900{--tw-text-opacity:1;color:rgba(124,45,18,var(--tw-text-opacity))}.hb-text-orange-100{--tw-text-opacity:1;color:rgba(255,237,213,var(--tw-text-opacity))}.hb-text-yellow-900{--tw-text-opacity:1;color:rgba(113,63,18,var(--tw-text-opacity))}.hb-text-teal-100{--tw-text-opacity:1;color:rgba(204,251,241,var(--tw-text-opacity))}.hb-text-red-900{--tw-text-opacity:1;color:rgba(127,29,29,var(--tw-text-opacity))}a{background-color:transparent;color:inherit;text-decoration:inherit}*,:after,:before{border:0 solid #e2e8f0;box-sizing:border-box}.fade-in-top{animation:fade-in-top .8s cubic-bezier(.39,.575,.565,1)}@keyframes fade-in-top{0%{opacity:0;transform:translateY(-50px)}to{opacity:1;transform:translateY(0)}}.hover\\:hb-bg-gray-800:hover{--tw-bg-opacity:1;background-color:rgba(31,41,55,var(--tw-bg-opacity))}.hover\\:hb-text-white:hover{--tw-text-opacity:1;color:rgba(255,255,255,var(--tw-text-opacity))}.hover\\:hb-text-gray-300:hover{--tw-text-opacity:1;color:rgba(209,213,219,var(--tw-text-opacity))}.hover\\:hb-text-gray-600:hover{--tw-text-opacity:1;color:rgba(75,85,99,var(--tw-text-opacity))}.hover\\:hb-text-blue-300:hover{--tw-text-opacity:1;color:rgba(147,197,253,var(--tw-text-opacity))}.hover\\:hb-text-green-300:hover{--tw-text-opacity:1;color:rgba(134,239,172,var(--tw-text-opacity))}.hover\\:hb-text-indigo-300:hover{--tw-text-opacity:1;color:rgba(165,180,252,var(--tw-text-opacity))}.hover\\:hb-text-orange-700:hover{--tw-text-opacity:1;color:rgba(194,65,12,var(--tw-text-opacity))}.hover\\:hb-text-yellow-700:hover{--tw-text-opacity:1;color:rgba(161,98,7,var(--tw-text-opacity))}.hover\\:hb-text-teal-300:hover{--tw-text-opacity:1;color:rgba(94,234,212,var(--tw-text-opacity))}.hover\\:hb-text-red-100:hover{--tw-text-opacity:1;color:rgba(254,226,226,var(--tw-text-opacity))}.hover\\:hb-underline:hover{text-decoration-line:underline}.focus\\:hb-bg-gray-800:focus{--tw-bg-opacity:1;background-color:rgba(31,41,55,var(--tw-bg-opacity))}.focus\\:hb-outline-none:focus{outline:2px solid transparent;outline-offset:2px}@media (min-width:768px){.md\\:hb-flex-row{flex-direction:row}.md\\:hb-px-20{padding-left:5rem;padding-right:5rem}}",""]);const c=i},645:t=>{t.exports=function(t){var e=[];return e.toString=function(){return this.map((function(e){var r="",o=void 0!==e[5];return e[4]&&(r+="@supports (".concat(e[4],") {")),e[2]&&(r+="@media ".concat(e[2]," {")),o&&(r+="@layer".concat(e[5].length>0?" ".concat(e[5]):""," {")),r+=t(e),o&&(r+="}"),e[2]&&(r+="}"),e[4]&&(r+="}"),r})).join("")},e.i=function(t,r,o,n,a){"string"==typeof t&&(t=[[null,t,void 0]]);var i={};if(o)for(var c=0;c0?" ".concat(b[5]):""," {").concat(b[1],"}")),b[5]=a),r&&(b[2]?(b[1]="@media ".concat(b[2]," {").concat(b[1],"}"),b[2]=r):b[2]=r),n&&(b[4]?(b[1]="@supports (".concat(b[4],") {").concat(b[1],"}"),b[4]=n):b[4]="".concat(n)),e.push(b))}},e}},81:t=>{t.exports=function(t){return t[1]}},379:t=>{var e=[];function r(t){for(var r=-1,o=0;o{var e={};t.exports=function(t,r){var o=function(t){if(void 0===e[t]){var r=document.querySelector(t);if(window.HTMLIFrameElement&&r instanceof window.HTMLIFrameElement)try{r=r.contentDocument.head}catch(t){r=null}e[t]=r}return e[t]}(t);if(!o)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");o.appendChild(r)}},216:t=>{t.exports=function(t){var e=document.createElement("style");return t.setAttributes(e,t.attributes),t.insert(e,t.options),e}},565:(t,e,r)=>{t.exports=function(t){var e=r.nc;e&&t.setAttribute("nonce",e)}},795:t=>{t.exports=function(t){var e=t.insertStyleElement(t);return{update:function(r){!function(t,e,r){var o="";r.supports&&(o+="@supports (".concat(r.supports,") {")),r.media&&(o+="@media ".concat(r.media," {"));var n=void 0!==r.layer;n&&(o+="@layer".concat(r.layer.length>0?" ".concat(r.layer):""," {")),o+=r.css,n&&(o+="}"),r.media&&(o+="}"),r.supports&&(o+="}");var a=r.sourceMap;a&&"undefined"!=typeof btoa&&(o+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(a))))," */")),e.styleTagTransform(o,t,e.options)}(e,t,r)},remove:function(){!function(t){if(null===t.parentNode)return!1;t.parentNode.removeChild(t)}(e)}}}},589:t=>{t.exports=function(t,e){if(e.styleSheet)e.styleSheet.cssText=t;else{for(;e.firstChild;)e.removeChild(e.firstChild);e.appendChild(document.createTextNode(t))}}}},e={};function r(o){var n=e[o];if(void 0!==n)return n.exports;var a=e[o]={id:o,exports:{}};return t[o](a,a.exports,r),a.exports}r.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return r.d(e,{a:e}),e},r.d=(t,e)=>{for(var o in e)r.o(e,o)&&!r.o(t,o)&&Object.defineProperty(t,o,{enumerable:!0,get:e[o]})},r.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r.nc=void 0;var o={};return(()=>{r.d(o,{default:()=>H});var t=r(379),e=r.n(t),n=r(795),a=r.n(n),i=r(569),c=r.n(i),s=r(565),l=r.n(s),b=r(216),h=r.n(b),p=r(589),d=r.n(p),u=r(363),g={};g.styleTagTransform=d(),g.setAttributes=l(),g.insert=c().bind(null,"head"),g.domAPI=a(),g.insertStyleElement=h();e()(u.Z,g);u.Z&&u.Z.locals&&u.Z.locals;var y="hb-flex hb-w-full hd-flex-col md:hb-flex-row hb-text-sm hb-py-2 md:hb-px-20 hb-px-1 hb-items-center hb-justify-between",f="hb-flex hb-items-center",w="hb-px-2 hb-mx-2 hb-leading-relaxed hb-tracking-wider hb-uppercase hb-font-semibold hb-rounded-full hb-text-xs",m="hover:hb-underline hb-inline-flex hb-items-center",v="hb-mx-5 hb-cursor-pointer hover:hb-underline",x={gray:{wrapper:"hb-bg-gray-900 hb-text-gray-100",linkWrapper:"",badge:"hb-bg-white hb-text-gray-900",postTitle:"hover:hb-text-gray-300",secondaryLink:"hover:hb-text-gray-300",dismiss:"hb-text-gray-800"},lightGray:{wrapper:"hb-bg-gray-400 hb-text-gray-900",linkWrapper:"",badge:"hb-bg-white hb-text-gray-900 shadow",postTitle:"hover:hb-text-gray-600",secondaryLink:"hover:hb-text-gray-600",dismiss:"hb-text-gray-800"},blue:{wrapper:"hb-bg-blue-900 hb-text-blue-100",linkWrapper:"",badge:"hb-bg-blue-100 hb-text-blue-900 shadow",postTitle:"hover:hb-text-blue-300",secondaryLink:"hover:hb-text-blue-300",dismiss:"hb-text-gray-800"},green:{wrapper:"hb-bg-green-600 hb-text-green-100",linkWrapper:"",badge:"hb-bg-green-100 hb-text-green-900",postTitle:"hover:hb-text-green-300",secondaryLink:"hover:hb-text-green-300",dismiss:"hb-text-gray-800"},indigo:{wrapper:"hb-bg-indigo-800 hb-text-indigo-100",linkWrapper:"",badge:"hb-bg-indigo-100 hb-text-indigo-900 shadow",postTitle:"hover:hb-text-indigo-300",secondaryLink:"hover:hb-text-indigo-300",dismiss:"hb-text-gray-800"},orange:{wrapper:"hb-bg-orange-300 hb-text-orange-900",linkWrapper:"",badge:"hb-bg-orange-800 hb-text-orange-100 shadow",postTitle:"hover:hb-text-orange-700",secondaryLink:"hover:hb-text-orange-700",dismiss:"hb-text-gray-800"},yellow:{wrapper:"hb-bg-yellow-300 hb-text-yellow-900",linkWrapper:"",badge:"hb-bg-yellow-100 hb-text-yellow-900 shadow",postTitle:"hover:hb-text-yellow-700",secondaryLink:"hover:hb-text-yellow-700",dismiss:"hb-text-gray-800"},teal:{wrapper:"hb-bg-teal-500 hb-text-teal-100",linkWrapper:"",badge:"hb-bg-teal-900 hb-text-teal-100 shadow",postTitle:"hover:hb-text-teal-300",secondaryLink:"hover:hb-text-teal-300",dismiss:"hb-text-gray-800"},red:{wrapper:"hb-bg-red-400 hb-text-red-900",linkWrapper:"",badge:"hb-bg-red-100 hb-text-red-900 shadow",postTitle:"hover:hb-text-red-100",secondaryLink:"hover:hb-text-red-100",dismiss:"hb-text-gray-800"}},k={method:"GET",mode:"cors",cache:"no-cache",headers:{Accept:"application/json"},redirect:"follow"};function S(t){var e=t[0],r=e.title.rendered,o=e.link;return null==r&&console.error("WP-json response doesn't have real values %o",t[0]),{title:r,link:o}}var T=S;function j(t){T="function"==typeof t?t:S}function L(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e={};return e.$el=t.el,e.url=t.url,e.DOMPurify=t.DOMPurify||null,e.theme=x[t.theme]||"grey",e.badge=t.badge||null,e.dismissible=t.dismissible||!1,e.dismissFor=t.dismissFor||!1,e.secondaryLinks=t.secondaryLinks||[],e.title=t.title||null,e.link=t.link||null,e.onCompleted=t.onCompleted||function(){},e.onFailure=t.onFailure||function(){},"function"==typeof t.fetch&&(e.fetch=t.fetch),e.fetchOptions=k,e.fetchOptions.headers=Object.assign(k.headers,t.headers),j(t.parser||null),e}function O(t){return function(t){if(Array.isArray(t))return M(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(!t)return;if("string"==typeof t)return M(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return M(t,e)}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function M(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,o=new Array(e);r1&&void 0!==arguments[1]?arguments[1]:"",o=r.trim().split(" ");(e=t.classList).add.apply(e,O(o))}(n,o||""),r&&r.forEach((function(t){Array.isArray(t)?t.forEach((function(t){return a.appendChild(t)})):a.appendChild(t)})),n.appendChild(a),n}function C(t){return{template:t.dataset.template,html:""==t.getAttribute("has-html"),dismissFor:t.dataset.dismissFor||null}}function A(){if(localStorage){var t=localStorage.getItem("h-bar_dismiss_for");if(!t)return!1;if((new Date).getTime()<=t)return!0}return!1}function E(t){return E="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},E(t)}function _(t,e){for(var r=0;r\n \n \n ';var c=[i];a&&c.unshift(a);var s=P("div",{classes:"".concat(f," ").concat(e.theme.linkWrapper),children:c}),l=P("div",{classes:"".concat(y," ").concat(e.theme.wrapper),children:[s,t]}),b=document.querySelector(e.$el);b.innerHTML="",b.appendChild(l)}else console.error("[h-bar] no post data, unable to render")}))}},{key:"destroy",value:function(){try{return document.querySelector(this.$el).innerHTML="",!0}catch(t){console.error("Unable to destroy the h-bar wrapper"),console.error(t)}return!1}},{key:"dismissibleButton",value:function(){var t=this,e=P("button",{classes:"hb--mr-2 hb-flex hb-p-1 hb-rounded-md ".concat(this.theme.dismiss," hover:hb-text-white hover:hb-bg-gray-800 focus:hb-outline-none focus:hb-bg-gray-800")});return e.innerHTML='\n \n ',e.onclick=function(e){return e.preventDefault(),t.dismissFor?(localStorage&&localStorage.setItem("h-bar_dismiss_for",t.dismissFor.getTime()),t.destroy()):t.destroy()},e}},{key:"createSecondaryLinks",value:function(t){var e=this;return t?t.map((function(t){var r=t.title,o=t.link,n=P("a",{classes:"".concat(v," ").concat(e.theme.secondaryLink)});return n.href=o,n.innerText=r,n}),this):[]}}])&&W(e.prototype,r),o&&W(e,o),Object.defineProperty(e,"prototype",{writable:!1}),t}();function I(t){return I="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},I(t)}var z={version:"2.0.0",rendered:!1,fetching:!1,usingBanner:!0,init:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};Object.assign(this,L(t)),this.$elementOpt=C(document.querySelector(this.$el)),this.$elementOpt.template?this.renderer=new F(this.$elementOpt.template,this.DOMPurify):t.renderer?this.renderer=new t.renderer(this):this.renderer=new $(this),Object.defineProperties(this,{renderer:{configurable:!1,writable:!1}})},fetch:function(t){function e(){return t.apply(this,arguments)}return e.toString=function(){return t.toString()},e}((function(){var t=this;this.rendered||A()||(this.fetching=!0,fetch(this.url,this.fetchOptions).then((function(t){return t.json()})).then((function(e){"object"==I(e)?t.render(e):console.error("".concat(t.url," Did not return an object")),t.fetching=!1})).catch((function(e){console.error(e),t.fetching=!1,t.rendered=!1})))})),render:function(t){var e,r=this;(e=t,new Promise((function(t,r){if(e)try{t(T(e))}catch(t){r(t)}r({error:"No Data",data:e})}))).then((function(t){var e=document.querySelector(r.$el);e.innerHTML=r.renderer.resolve(t),e.__hbar__=r,r.rendered=!0,r.onCompleted({__hbar__:r,result:e})})).catch((function(t){console.error(t),r.destroy(),r.fetching=!1,r.rendered=!1,r.onFailure({__hbar__:r})}))},destroy:function(){try{return document.querySelector(this.$el).innerHTML="",!0}catch(t){console.error("Unable to destroy the h-bar wrapper"),console.error(t)}return!1}};Object.defineProperties(z,{init:{writable:!1,configurable:!1},destroy:{writable:!1,configurable:!1},fetch:{writable:!1,configurable:!1}});const H=z})(),o=o.default})())); \ No newline at end of file +!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.hBar=e():t.hBar=e()}(self,(()=>(()=>{"use strict";var t={363:(t,e,r)=>{r.d(e,{Z:()=>c});var o=r(81),n=r.n(o),a=r(645),i=r.n(a)()(n());i.push([t.id,"*,:after,:before{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(59,130,246,.5);--tw-ring-offset-shadow:0 0 transparent;--tw-ring-shadow:0 0 transparent;--tw-shadow:0 0 transparent;--tw-shadow-colored:0 0 transparent;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: }::backdrop{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(59,130,246,.5);--tw-ring-offset-shadow:0 0 transparent;--tw-ring-shadow:0 0 transparent;--tw-shadow:0 0 transparent;--tw-shadow-colored:0 0 transparent;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: }.hb-mx-2{margin-left:.5rem;margin-right:.5rem}.hb-mx-5{margin-left:1.25rem;margin-right:1.25rem}.hb--mr-2{margin-right:-.5rem}.hb-flex{display:flex}.hb-inline-flex{display:inline-flex}.hb-h-3{height:.75rem}.hb-h-4{height:1rem}.hb-w-3{width:.75rem}.hb-w-4{width:1rem}.hb-w-full{width:100%}.hb-cursor-pointer{cursor:pointer}.hb-items-center{align-items:center}.hb-justify-between{justify-content:space-between}.hb-rounded-md{border-radius:.375rem}.hb-rounded-full{border-radius:9999px}.hb-bg-gray-900{--tw-bg-opacity:1;background-color:rgba(17,24,39,var(--tw-bg-opacity))}.hb-bg-white{--tw-bg-opacity:1;background-color:rgba(255,255,255,var(--tw-bg-opacity))}.hb-bg-gray-400{--tw-bg-opacity:1;background-color:rgba(156,163,175,var(--tw-bg-opacity))}.hb-bg-blue-900{--tw-bg-opacity:1;background-color:rgba(30,58,138,var(--tw-bg-opacity))}.hb-bg-blue-100{--tw-bg-opacity:1;background-color:rgba(219,234,254,var(--tw-bg-opacity))}.hb-bg-green-600{--tw-bg-opacity:1;background-color:rgba(22,163,74,var(--tw-bg-opacity))}.hb-bg-green-100{--tw-bg-opacity:1;background-color:rgba(220,252,231,var(--tw-bg-opacity))}.hb-bg-indigo-800{--tw-bg-opacity:1;background-color:rgba(55,48,163,var(--tw-bg-opacity))}.hb-bg-indigo-100{--tw-bg-opacity:1;background-color:rgba(224,231,255,var(--tw-bg-opacity))}.hb-bg-orange-300{--tw-bg-opacity:1;background-color:rgba(253,186,116,var(--tw-bg-opacity))}.hb-bg-orange-800{--tw-bg-opacity:1;background-color:rgba(154,52,18,var(--tw-bg-opacity))}.hb-bg-yellow-300{--tw-bg-opacity:1;background-color:rgba(253,224,71,var(--tw-bg-opacity))}.hb-bg-yellow-100{--tw-bg-opacity:1;background-color:rgba(254,249,195,var(--tw-bg-opacity))}.hb-bg-teal-500{--tw-bg-opacity:1;background-color:rgba(20,184,166,var(--tw-bg-opacity))}.hb-bg-teal-900{--tw-bg-opacity:1;background-color:rgba(19,78,74,var(--tw-bg-opacity))}.hb-bg-red-400{--tw-bg-opacity:1;background-color:rgba(248,113,113,var(--tw-bg-opacity))}.hb-bg-red-100{--tw-bg-opacity:1;background-color:rgba(254,226,226,var(--tw-bg-opacity))}.hb-p-1{padding:.25rem}.hb-py-2{padding-bottom:.5rem;padding-top:.5rem}.hb-px-1{padding-left:.25rem;padding-right:.25rem}.hb-px-2{padding-left:.5rem;padding-right:.5rem}.hb-text-sm{font-size:.875rem;line-height:1.25rem}.hb-text-xs{font-size:.75rem;line-height:1rem}.hb-font-semibold{font-weight:600}.hb-uppercase{text-transform:uppercase}.hb-leading-relaxed{line-height:1.625}.hb-tracking-wider{letter-spacing:.05em}.hb-text-gray-100{--tw-text-opacity:1;color:rgba(243,244,246,var(--tw-text-opacity))}.hb-text-gray-900{--tw-text-opacity:1;color:rgba(17,24,39,var(--tw-text-opacity))}.hb-text-gray-800{--tw-text-opacity:1;color:rgba(31,41,55,var(--tw-text-opacity))}.hb-text-blue-100{--tw-text-opacity:1;color:rgba(219,234,254,var(--tw-text-opacity))}.hb-text-blue-900{--tw-text-opacity:1;color:rgba(30,58,138,var(--tw-text-opacity))}.hb-text-green-100{--tw-text-opacity:1;color:rgba(220,252,231,var(--tw-text-opacity))}.hb-text-green-900{--tw-text-opacity:1;color:rgba(20,83,45,var(--tw-text-opacity))}.hb-text-indigo-100{--tw-text-opacity:1;color:rgba(224,231,255,var(--tw-text-opacity))}.hb-text-indigo-900{--tw-text-opacity:1;color:rgba(49,46,129,var(--tw-text-opacity))}.hb-text-orange-900{--tw-text-opacity:1;color:rgba(124,45,18,var(--tw-text-opacity))}.hb-text-orange-100{--tw-text-opacity:1;color:rgba(255,237,213,var(--tw-text-opacity))}.hb-text-yellow-900{--tw-text-opacity:1;color:rgba(113,63,18,var(--tw-text-opacity))}.hb-text-teal-100{--tw-text-opacity:1;color:rgba(204,251,241,var(--tw-text-opacity))}.hb-text-red-900{--tw-text-opacity:1;color:rgba(127,29,29,var(--tw-text-opacity))}a{background-color:transparent;color:inherit;text-decoration:inherit}*,:after,:before{border:0 solid #e2e8f0;box-sizing:border-box}.fade-in-top{animation:fade-in-top .8s cubic-bezier(.39,.575,.565,1)}@keyframes fade-in-top{0%{opacity:0;transform:translateY(-50px)}to{opacity:1;transform:translateY(0)}}.hover\\:hb-bg-gray-800:hover{--tw-bg-opacity:1;background-color:rgba(31,41,55,var(--tw-bg-opacity))}.hover\\:hb-text-white:hover{--tw-text-opacity:1;color:rgba(255,255,255,var(--tw-text-opacity))}.hover\\:hb-text-gray-300:hover{--tw-text-opacity:1;color:rgba(209,213,219,var(--tw-text-opacity))}.hover\\:hb-text-gray-600:hover{--tw-text-opacity:1;color:rgba(75,85,99,var(--tw-text-opacity))}.hover\\:hb-text-blue-300:hover{--tw-text-opacity:1;color:rgba(147,197,253,var(--tw-text-opacity))}.hover\\:hb-text-green-300:hover{--tw-text-opacity:1;color:rgba(134,239,172,var(--tw-text-opacity))}.hover\\:hb-text-indigo-300:hover{--tw-text-opacity:1;color:rgba(165,180,252,var(--tw-text-opacity))}.hover\\:hb-text-orange-700:hover{--tw-text-opacity:1;color:rgba(194,65,12,var(--tw-text-opacity))}.hover\\:hb-text-yellow-700:hover{--tw-text-opacity:1;color:rgba(161,98,7,var(--tw-text-opacity))}.hover\\:hb-text-teal-300:hover{--tw-text-opacity:1;color:rgba(94,234,212,var(--tw-text-opacity))}.hover\\:hb-text-red-100:hover{--tw-text-opacity:1;color:rgba(254,226,226,var(--tw-text-opacity))}.hover\\:hb-underline:hover{text-decoration-line:underline}.focus\\:hb-bg-gray-800:focus{--tw-bg-opacity:1;background-color:rgba(31,41,55,var(--tw-bg-opacity))}.focus\\:hb-outline-none:focus{outline:2px solid transparent;outline-offset:2px}@media (min-width:768px){.md\\:hb-flex-row{flex-direction:row}.md\\:hb-px-20{padding-left:5rem;padding-right:5rem}}",""]);const c=i},645:t=>{t.exports=function(t){var e=[];return e.toString=function(){return this.map((function(e){var r="",o=void 0!==e[5];return e[4]&&(r+="@supports (".concat(e[4],") {")),e[2]&&(r+="@media ".concat(e[2]," {")),o&&(r+="@layer".concat(e[5].length>0?" ".concat(e[5]):""," {")),r+=t(e),o&&(r+="}"),e[2]&&(r+="}"),e[4]&&(r+="}"),r})).join("")},e.i=function(t,r,o,n,a){"string"==typeof t&&(t=[[null,t,void 0]]);var i={};if(o)for(var c=0;c0?" ".concat(b[5]):""," {").concat(b[1],"}")),b[5]=a),r&&(b[2]?(b[1]="@media ".concat(b[2]," {").concat(b[1],"}"),b[2]=r):b[2]=r),n&&(b[4]?(b[1]="@supports (".concat(b[4],") {").concat(b[1],"}"),b[4]=n):b[4]="".concat(n)),e.push(b))}},e}},81:t=>{t.exports=function(t){return t[1]}},379:t=>{var e=[];function r(t){for(var r=-1,o=0;o{var e={};t.exports=function(t,r){var o=function(t){if(void 0===e[t]){var r=document.querySelector(t);if(window.HTMLIFrameElement&&r instanceof window.HTMLIFrameElement)try{r=r.contentDocument.head}catch(t){r=null}e[t]=r}return e[t]}(t);if(!o)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");o.appendChild(r)}},216:t=>{t.exports=function(t){var e=document.createElement("style");return t.setAttributes(e,t.attributes),t.insert(e,t.options),e}},565:(t,e,r)=>{t.exports=function(t){var e=r.nc;e&&t.setAttribute("nonce",e)}},795:t=>{t.exports=function(t){var e=t.insertStyleElement(t);return{update:function(r){!function(t,e,r){var o="";r.supports&&(o+="@supports (".concat(r.supports,") {")),r.media&&(o+="@media ".concat(r.media," {"));var n=void 0!==r.layer;n&&(o+="@layer".concat(r.layer.length>0?" ".concat(r.layer):""," {")),o+=r.css,n&&(o+="}"),r.media&&(o+="}"),r.supports&&(o+="}");var a=r.sourceMap;a&&"undefined"!=typeof btoa&&(o+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(a))))," */")),e.styleTagTransform(o,t,e.options)}(e,t,r)},remove:function(){!function(t){if(null===t.parentNode)return!1;t.parentNode.removeChild(t)}(e)}}}},589:t=>{t.exports=function(t,e){if(e.styleSheet)e.styleSheet.cssText=t;else{for(;e.firstChild;)e.removeChild(e.firstChild);e.appendChild(document.createTextNode(t))}}},147:t=>{t.exports={i8:"2.0.2"}}},e={};function r(o){var n=e[o];if(void 0!==n)return n.exports;var a=e[o]={id:o,exports:{}};return t[o](a,a.exports,r),a.exports}r.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return r.d(e,{a:e}),e},r.d=(t,e)=>{for(var o in e)r.o(e,o)&&!r.o(t,o)&&Object.defineProperty(t,o,{enumerable:!0,get:e[o]})},r.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r.nc=void 0;var o={};return(()=>{r.d(o,{default:()=>D});var t=r(379),e=r.n(t),n=r(795),a=r.n(n),i=r(569),c=r.n(i),s=r(565),l=r.n(s),b=r(216),h=r.n(b),p=r(589),d=r.n(p),u=r(363),g={};g.styleTagTransform=d(),g.setAttributes=l(),g.insert=c().bind(null,"head"),g.domAPI=a(),g.insertStyleElement=h();e()(u.Z,g);u.Z&&u.Z.locals&&u.Z.locals;var y={wrapper:"hb-flex hb-w-full hd-flex-col md:hb-flex-row hb-text-sm hb-py-2 md:hb-px-20 hb-px-1 hb-items-center hb-justify-between",linkWrapper:"hb-flex hb-items-center",badge:"hb-px-2 hb-mx-2 hb-leading-relaxed hb-tracking-wider hb-uppercase hb-font-semibold hb-rounded-full hb-text-xs",postTitle:"hover:hb-underline hb-inline-flex hb-items-center",secondaryLink:"hb-mx-5 hb-cursor-pointer hover:hb-underline"},f={gray:{wrapper:"hb-bg-gray-900 hb-text-gray-100",linkWrapper:"",badge:"hb-bg-white hb-text-gray-900",postTitle:"hover:hb-text-gray-300",secondaryLink:"hover:hb-text-gray-300",dismiss:"hb-text-gray-800"},lightGray:{wrapper:"hb-bg-gray-400 hb-text-gray-900",linkWrapper:"",badge:"hb-bg-white hb-text-gray-900 shadow",postTitle:"hover:hb-text-gray-600",secondaryLink:"hover:hb-text-gray-600",dismiss:"hb-text-gray-800"},blue:{wrapper:"hb-bg-blue-900 hb-text-blue-100",linkWrapper:"",badge:"hb-bg-blue-100 hb-text-blue-900 shadow",postTitle:"hover:hb-text-blue-300",secondaryLink:"hover:hb-text-blue-300",dismiss:"hb-text-gray-800"},green:{wrapper:"hb-bg-green-600 hb-text-green-100",linkWrapper:"",badge:"hb-bg-green-100 hb-text-green-900",postTitle:"hover:hb-text-green-300",secondaryLink:"hover:hb-text-green-300",dismiss:"hb-text-gray-800"},indigo:{wrapper:"hb-bg-indigo-800 hb-text-indigo-100",linkWrapper:"",badge:"hb-bg-indigo-100 hb-text-indigo-900 shadow",postTitle:"hover:hb-text-indigo-300",secondaryLink:"hover:hb-text-indigo-300",dismiss:"hb-text-gray-800"},orange:{wrapper:"hb-bg-orange-300 hb-text-orange-900",linkWrapper:"",badge:"hb-bg-orange-800 hb-text-orange-100 shadow",postTitle:"hover:hb-text-orange-700",secondaryLink:"hover:hb-text-orange-700",dismiss:"hb-text-gray-800"},yellow:{wrapper:"hb-bg-yellow-300 hb-text-yellow-900",linkWrapper:"",badge:"hb-bg-yellow-100 hb-text-yellow-900 shadow",postTitle:"hover:hb-text-yellow-700",secondaryLink:"hover:hb-text-yellow-700",dismiss:"hb-text-gray-800"},teal:{wrapper:"hb-bg-teal-500 hb-text-teal-100",linkWrapper:"",badge:"hb-bg-teal-900 hb-text-teal-100 shadow",postTitle:"hover:hb-text-teal-300",secondaryLink:"hover:hb-text-teal-300",dismiss:"hb-text-gray-800"},red:{wrapper:"hb-bg-red-400 hb-text-red-900",linkWrapper:"",badge:"hb-bg-red-100 hb-text-red-900 shadow",postTitle:"hover:hb-text-red-100",secondaryLink:"hover:hb-text-red-100",dismiss:"hb-text-gray-800"}},w={fetchOptions:{method:"GET",mode:"cors",cache:"no-cache",headers:{Accept:"application/json"},redirect:"follow"},version:r(147).i8,production:process.env.production};function m(t){var e=t[0],r=e.title.rendered,o=e.link;return null==r&&console.error("WP-json response doesn't have real values %o",t[0]),{title:r,link:o}}var v=m;function x(t){v="function"==typeof t?t:m}function k(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e={};return e.$el=t.el,e.url=t.url,e.DOMPurify=t.DOMPurify||null,e.theme=f[t.theme]||f.gray,t.customStyles&&(e.customStyles=Object.assign(y,t.customStyles)),e.badge=t.badge||null,e.dismissible=t.dismissible||!1,e.dismissFor=t.dismissFor||!1,e.secondaryLinks=t.secondaryLinks||[],e.title=t.title||null,e.link=t.link||null,e.onCompleted=t.onCompleted||function(){},e.onFailure=t.onFailure||function(){},"function"==typeof t.fetch&&(e.fetch=t.fetch),e.fetchOptions=w.fetchOptions,e.fetchOptions.headers=Object.assign(w.fetchOptions.headers,t.headers),x(t.parser||null),e}function S(t){return function(t){if(Array.isArray(t))return T(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(!t)return;if("string"==typeof t)return T(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return T(t,e)}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function T(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,o=new Array(e);r1&&void 0!==arguments[1]?arguments[1]:"",o=r.trim().split(" ");(e=t.classList).add.apply(e,S(o))}(n,o||""),r&&r.forEach((function(t){Array.isArray(t)?t.forEach((function(t){return a.appendChild(t)})):a.appendChild(t)})),n.appendChild(a),n}function L(t){return{template:t.dataset.template,html:""==t.getAttribute("has-html"),dismissFor:t.dataset.dismissFor||null}}function O(){if(localStorage){var t=localStorage.getItem("h-bar_dismiss_for");if(!t)return!1;if((new Date).getTime()<=t)return!0}return!1}function M(t){return M="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},M(t)}function P(t,e){for(var r=0;r\n \n \n ';var c=[i];a&&c.unshift(a);var s=j("div",{classes:"".concat(e.theme.linkWrapper," ").concat(e.styling.linkWrapper," "),children:c}),l=j("div",{classes:"".concat(e.theme.wrapper," ").concat(e.styling.wrapper," "),children:[s,t]}),b=document.querySelector(e.$el);b.innerHTML="",b.appendChild(l)}else console.error("[h-bar] no post data, unable to render")}))}},{key:"destroy",value:function(){try{return document.querySelector(this.$el).innerHTML="",!0}catch(t){console.error("Unable to destroy the h-bar wrapper"),console.error(t)}return!1}},{key:"dismissibleButton",value:function(){var t=this,e=j("button",{classes:"hb--mr-2 hb-flex hb-p-1 hb-rounded-md ".concat(this.theme.dismiss," hover:hb-text-white hover:hb-bg-gray-800 focus:hb-outline-none focus:hb-bg-gray-800")});return e.innerHTML='\n \n ',e.onclick=function(e){return e.preventDefault(),t.dismissFor?(localStorage&&localStorage.setItem("h-bar_dismiss_for",t.dismissFor.getTime()),t.destroy()):t.destroy()},e}},{key:"createSecondaryLinks",value:function(t){var e=this;return t?t.map((function(t){var r=t.title,o=t.link,n=j("a",{classes:"".concat(e.theme.secondaryLink," ").concat(e.styling.secondaryLink," ")});return n.href=o,n.innerText=r,n}),this):[]}}])&&E(e.prototype,r),o&&E(e,o),Object.defineProperty(e,"prototype",{writable:!1}),t}();function W(t){return W="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},W(t)}var F={version:w.version,rendered:!1,fetching:!1,usingBanner:!0,init:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};Object.assign(this,k(t)),this.$elementOpt=L(document.querySelector(this.$el)),this.$elementOpt.template?this.renderer=new C(this.$elementOpt.template,this.DOMPurify):t.renderer?this.renderer=new t.renderer(this):this.renderer=new _(this),Object.defineProperties(this,{renderer:{configurable:!1,writable:!1}})},fetch:function(t){function e(){return t.apply(this,arguments)}return e.toString=function(){return t.toString()},e}((function(){var t=this;this.rendered||O()||(this.fetching=!0,fetch(this.url,this.fetchOptions).then((function(t){return t.json()})).then((function(e){"object"==W(e)?t.render(e):console.error("".concat(t.url," Did not return an object")),t.fetching=!1})).catch((function(e){console.error(e),t.fetching=!1,t.rendered=!1})))})),render:function(t){var e,r=this;(e=t,new Promise((function(t,r){if(e)try{t(v(e))}catch(t){r(t)}r({error:"No Data",data:e})}))).then((function(t){var e=document.querySelector(r.$el);e.innerHTML=r.renderer.resolve(t),e.__hbar__=r,r.rendered=!0,r.onCompleted({__hbar__:r,result:e})})).catch((function(t){console.error(t),r.destroy(),r.fetching=!1,r.rendered=!1,r.onFailure({__hbar__:r})}))},destroy:function(){try{return document.querySelector(this.$el).innerHTML="",!0}catch(t){console.error("Unable to destroy the h-bar wrapper"),console.error(t)}return!1}};Object.defineProperties(F,{init:{writable:!1,configurable:!1},destroy:{writable:!1,configurable:!1},fetch:{writable:!1,configurable:!1}});const D=F})(),o=o.default})())); \ No newline at end of file diff --git a/dist/hBar.min.js.LICENSE.txt b/dist/hBar.min.js.LICENSE.txt index 9806f9d..1f65d85 100644 --- a/dist/hBar.min.js.LICENSE.txt +++ b/dist/hBar.min.js.LICENSE.txt @@ -1,7 +1,7 @@ /** * h-bar banner and dynamic announcement library * - * @version 2.0.0 + * @version 2.0.2 * @license MIT * @copyright @ReeceM */ diff --git a/package.json b/package.json index 5621fac..8485f99 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@reecem/h-bar", - "version": "2.0.1", + "version": "2.0.2", "description": "Lightweight Announcement Bar", "main": "dist/hBar.min.js", "scripts": {